//************************************************************************** //** //** ## ## ## ## ## #### #### ### ### //** ## ## ## ## ## ## ## ## ## ## #### #### //** ## ## ## ## ## ## ## ## ## ## ## ## ## ## //** ## ## ######## ## ## ## ## ## ## ## ### ## //** ### ## ## ### ## ## ## ## ## ## //** # ## ## # #### #### ## ## //** //** $Id: LightFlash.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. //** //************************************************************************** //** //** BROKEN LIGHT FLASHING //** //************************************************************************** class LightFlash : Lighting; float Time; int MaxLight; int MinLight; int MaxTime; int MinTime; //========================================================================== // // Init // //========================================================================== void Init(sector_t* InSector) { Sector = InSector; Sector->LightingData = self; MaxLight = Sector->params.lightlevel; MinLight = Level.FindMinSurroundingLight(Sector, Sector->params.lightlevel); MaxTime = 64; MinTime = 7; Time = itof((P_Random() & MaxTime) + 1) / 35.0; } //========================================================================== // // Tick // // Do flashing lights. // //========================================================================== void Tick(float DeltaTime) { Time -= DeltaTime; if (Time >= 0.0) { return; } if (Sector->params.lightlevel == MaxLight) { Sector->params.lightlevel = MinLight; Time = itof((P_Random() & MinTime) + 1) / 35.0; } else { Sector->params.lightlevel = MaxLight; Time = itof((P_Random() & MaxTime) + 1) / 35.0; } } defaultproperties { }