public void SpawnStrobeFlash(Sector sector, int fastOrSlow, int inSync) { var flash = ThinkerPool.RentStrobeFlash(world); world.Thinkers.Add(flash); flash.sector = sector; flash.darktime = fastOrSlow; flash.brighttime = StrobeFlash.STROBEBRIGHT; flash.maxlight = sector.LightLevel; flash.minlight = FindMinSurroundingLight(sector, sector.LightLevel); if (flash.minlight == flash.maxlight) { flash.minlight = 0; } // Nothing special about it during gameplay. sector.Special = 0; if (inSync == 0) { flash.count = (world.Random.Next() & 7) + 1; } else { flash.count = 1; } }
public Mobj SpawnMobj(Fixed x, Fixed y, Fixed z, MobjType type) { var mobj = ThinkerPool.RentMobj(world); var info = DoomInfo.MobjInfos[(int)type]; mobj.Type = type; mobj.Info = info; mobj.X = x; mobj.Y = y; mobj.Radius = info.Radius; mobj.Height = info.Height; mobj.Flags = info.Flags; mobj.Health = info.SpawnHealth; if (world.Options.Skill != GameSkill.Nightmare) { mobj.ReactionTime = info.ReactionTime; } mobj.LastLook = world.Random.Next() % Player.MaxPlayerCount; // Do not set the state with P_SetMobjState, // because action routines can not be called yet. var st = DoomInfo.States[(int)info.SpawnState]; mobj.State = st; mobj.Tics = st.Tics; mobj.Sprite = st.Sprite; mobj.Frame = st.Frame; // Set subsector and/or block links. world.ThingMovement.SetThingPosition(mobj); mobj.FloorZ = mobj.Subsector.Sector.FloorHeight; mobj.CeilingZ = mobj.Subsector.Sector.CeilingHeight; if (z == Mobj.OnFloorZ) { mobj.Z = mobj.FloorZ; } else if (z == Mobj.OnCeilingZ) { mobj.Z = mobj.CeilingZ - mobj.Info.Height; } else { mobj.Z = z; } world.Thinkers.Add(mobj); return(mobj); }
public void SpawnGlowingLight(Sector sector) { var g = ThinkerPool.RentGlowLight(world); world.Thinkers.Add(g); g.sector = sector; g.minlight = FindMinSurroundingLight(sector, sector.LightLevel); g.maxlight = sector.LightLevel; g.direction = -1; sector.Special = 0; }
public void SpawnFireFlicker(Sector sector) { // Note that we are resetting sector attributes. // Nothing special about it during gameplay. sector.Special = 0; var flick = ThinkerPool.RentFireFlicker(world); world.Thinkers.Add(flick); flick.sector = sector; flick.maxlight = sector.LightLevel; flick.minlight = FindMinSurroundingLight(sector, sector.LightLevel) + 16; flick.count = 4; }
public void SpawnLightFlash(Sector sector) { // Nothing special about it during gameplay. sector.Special = 0; var flash = ThinkerPool.RentLightFlash(world); world.Thinkers.Add(flash); flash.sector = sector; flash.maxlight = sector.LightLevel; flash.minlight = FindMinSurroundingLight(sector, sector.LightLevel); flash.maxtime = 64; flash.mintime = 7; flash.count = (world.Random.Next() & flash.maxtime) + 1; }
public void Run() { var current = cap.Next; while (current != cap) { if (current.ThinkerState == ThinkerState.Removed) { // Time to remove it. current.Next.Prev = current.Prev; current.Prev.Next = current.Next; ThinkerPool.Return(current); } else { if (current.ThinkerState == ThinkerState.Active) { current.Run(); } } current = current.Next; } }