//************************************************************************** //** //** ## ## ## ## ## #### #### ### ### //** ## ## ## ## ## ## ## ## ## ## #### #### //** ## ## ## ## ## ## ## ## ## ## ## ## ## ## //** ## ## ######## ## ## ## ## ## ## ## ### ## //** ### ## ## ### ## ## ## ## ## ## //** # ## ## # #### #### ## ## //** //** $Id: GlowingLight.vc 1583 2006-06-27 19:05:42Z dj_jl $ //** //** Copyright (C) 1999-2006 Jānis Legzdiņš //** //** 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. //** //************************************************************************** //** //** GLOWING LIGHT //** //************************************************************************** class GlowingLight : Lighting; float Speed; int Direction; int MaxLight; int MinLight; //========================================================================== // // Init // // Initialise glowing light // //========================================================================== void Init(sector_t* InSector) { Sector = InSector; Sector->LightingData = self; MinLight = Level.FindMinSurroundingLight(Sector, Sector->params.lightlevel); MaxLight = Sector->params.lightlevel; Direction = -1; } //========================================================================== // // Tick // //========================================================================== void Tick(float DeltaTime) { switch (Direction) { case -1: // DOWN Sector->params.lightlevel -= ftoi(Speed * DeltaTime); if (Sector->params.lightlevel <= MinLight) { Sector->params.lightlevel += ftoi(Speed * DeltaTime); Direction = 1; } break; case 1: // UP Sector->params.lightlevel += ftoi(Speed * DeltaTime); if (Sector->params.lightlevel >= MaxLight) { Sector->params.lightlevel -= ftoi(Speed * DeltaTime); Direction = -1; } break; } } defaultproperties { Speed = 256.0; }