Ejemplo n.º 1
0
        //==================================================================
        //
        //	P_SpawnLightFlash
        //
        //	After the map has been loaded, scan each sector for specials that spawn thinkers
        //
        //==================================================================
        public static void P_SpawnStrobeFlash(r_local.sector_t sector, int fastOrSlow, int inSync)
        {
            p_spec.strobe_t flash;

            flash = new p_spec.strobe_t();
            p_tick.P_AddThinker(flash.thinker);
            flash.sector           = sector;
            flash.darktime         = fastOrSlow;
            flash.brighttime       = p_spec.STROBEBRIGHT;
            flash.thinker.function = new T_StrobeFlash(flash);
            flash.maxlight         = sector.lightlevel;
            flash.minlight         = p_spec.P_FindMinSurroundingLight(sector, sector.lightlevel);

            if (flash.minlight == flash.maxlight)
            {
                flash.minlight = 0;
            }
            sector.special = 0;                         // nothing special about it during gameplay

            if (inSync == 0)
            {
                flash.count = (m_misc.P_Random() & 7) + 1;
            }
            else
            {
                flash.count = 1;
            }
        }
Ejemplo n.º 2
0
            public override void function(object obj)
            {
                p_spec.strobe_t flash = obj as p_spec.strobe_t;
                if (--flash.count != 0)
                {
                    return;
                }

                if (flash.sector.lightlevel == flash.minlight)
                {
                    flash.sector.lightlevel = (short)flash.maxlight;
                    flash.count             = flash.brighttime;
                }
                else
                {
                    flash.sector.lightlevel = (short)flash.minlight;
                    flash.count             = flash.darktime;
                }
            }