//************************************************************************** //** //** ## ## ## ## ## #### #### ### ### //** ## ## ## ## ## ## ## ## ## ## #### #### //** ## ## ## ## ## ## ## ## ## ## ## ## ## ## //** ## ## ######## ## ## ## ## ## ## ## ### ## //** ### ## ## ### ## ## ## ## ## ## //** # ## ## # #### #### ## ## //** //** $Id: Strobe.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. //** //************************************************************************** //** //** STROBE LIGHT FLASHING //** //************************************************************************** class Strobe : Lighting; float Time; int MaxLight; int MinLight; float MaxTime; float MinTime; //========================================================================== // // Init // //========================================================================== void Init(sector_t* InSector, int FastOrSlow, int InMaxTime, int InSync) { Sector = InSector; Sector->LightingData = self; MinTime = itof(FastOrSlow) / 35.0; MaxTime = itof(InMaxTime) / 35.0; MaxLight = Sector->params.lightlevel; MinLight = Level.FindMinSurroundingLight(Sector, Sector->params.lightlevel); if (MinLight == MaxLight) MinLight = 0; if (!InSync) Time = (Random() * 8.0 + 1.0) / 35.0; else Time = 1.0 / 35.0; } //========================================================================== // // Tick // //========================================================================== void Tick(float DeltaTime) { Time -= DeltaTime; if (Time > 0.0) { return; } if (Sector->params.lightlevel == MinLight) { Sector->params.lightlevel = MaxLight; Time = MaxTime; } else { Sector->params.lightlevel = MinLight; Time = MinTime; } } defaultproperties { }