/* * PlanetPenguin Racer * Copyright (C) 2004-2005 Volker Stroebel * * Copyright (C) 1999-2001 Jasmin F. Patry * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "lights.h" #include "gl_util.h" #include "ppogl/base/glwrappers.h" static Light course_lights[NUM_COURSE_LIGHTS]; Light* get_course_lights() { return course_lights; } void reset_lights() { for (int i=0; igetTop(); if(num_args<=1){ PP_WARNING("pptheme.course_light: Invalid number of arguments"); return 0; } int light_num = int(vm->getFloat(1)); if(light_num < 0 || light_num >= NUM_COURSE_LIGHTS ) { PP_WARNING("pptheme.course_light: Invalid light number: " << light_num); return 0; } // activated if(num_args>=2){ course_lights[light_num].is_on = vm->getBool(2); } // position if(num_args>=3){ vm->pushNull(); for(int i=0; i<4; i++){ vm->next(3); course_lights[light_num].position.values[i]=vm->getFloat(); vm->pop(); } } // diffuse if(num_args>=4){ vm->pushNull(); for(int i=0; i<4; i++){ vm->next(4); course_lights[light_num].diffuse.values[i]=vm->getFloat(); vm->pop(); } } // specular if(num_args>=5){ vm->pushNull(); for(int i=0; i<4; i++){ vm->next(5); course_lights[light_num].specular.values[i]=vm->getFloat(); vm->pop(); } } // ambient if(num_args>=6){ vm->pushNull(); for(int i=0; i<4; i++){ vm->next(6); course_lights[light_num].ambient.values[i]=vm->getFloat(); vm->pop(); } } return 0; } static const struct ppogl::Script::Lib ppthemelib[]={ {"course_light", course_light_cb}, {NULL, NULL} }; void register_course_light_callbacks() { script.registerLib("pptheme", ppthemelib); }