/// <summary> /// Called every tic frame that the player origin is in a special sector. /// </summary> private void PlayerInSpecialSector(Player player) { var sector = player.Mobj.Subsector.Sector; // Falling, not all the way down yet? if (player.Mobj.Z != sector.FloorHeight) { return; } var ti = world.ThingInteraction; // Has hitten ground. switch ((int)sector.Special) { case 5: // Hell slime damage. if (player.Powers[(int)PowerType.IronFeet] == 0) { if ((world.LevelTime & 0x1f) == 0) { ti.DamageMobj(player.Mobj, null, null, 10); } } break; case 7: // Nukage damage. if (player.Powers[(int)PowerType.IronFeet] == 0) { if ((world.LevelTime & 0x1f) == 0) { ti.DamageMobj(player.Mobj, null, null, 5); } } break; case 16: // Super hell slime damage. case 4: // Strobe hurt. if (player.Powers[(int)PowerType.IronFeet] == 0 || (world.Random.Next() < 5)) { if ((world.LevelTime & 0x1f) == 0) { ti.DamageMobj(player.Mobj, null, null, 20); } } break; case 9: // Secret sector. player.SecretCount++; sector.Special = 0; break; case 11: // Exit super damage for E1M8 finale. player.Cheats &= ~CheatFlags.GodMode; if ((world.LevelTime & 0x1f) == 0) { ti.DamageMobj(player.Mobj, null, null, 20); } if (player.Health <= 10) { world.ExitLevel(); } break; default: throw new Exception("Unknown sector special: " + (int)sector.Special); } }
/// <summary> /// Animate planes, scroll walls, etc. /// </summary> public void Update() { // Level timer. if (levelTimer) { levelTimeCount--; if (levelTimeCount == 0) { world.ExitLevel(); } } // Animate flats and textures globally. var animations = world.Map.Animation.Animations; for (var k = 0; k < animations.Length; k++) { var anim = animations[k]; for (var i = anim.BasePic; i < anim.BasePic + anim.NumPics; i++) { var pic = anim.BasePic + ((world.LevelTime / anim.Speed + i) % anim.NumPics); if (anim.IsTexture) { textureTranslation[i] = pic; } else { flatTranslation[i] = pic; } } } // Animate line specials. foreach (var line in scrollLines) { line.FrontSide.TextureOffset += Fixed.One; } // Do buttons. for (var i = 0; i < maxButtonCount; i++) { if (buttonList[i].Timer > 0) { buttonList[i].Timer--; if (buttonList[i].Timer == 0) { switch (buttonList[i].Position) { case ButtonPosition.Top: buttonList[i].Line.FrontSide.TopTexture = buttonList[i].Texture; break; case ButtonPosition.Middle: buttonList[i].Line.FrontSide.MiddleTexture = buttonList[i].Texture; break; case ButtonPosition.Bottom: buttonList[i].Line.FrontSide.BottomTexture = buttonList[i].Texture; break; } world.StartSound(buttonList[i].SoundOrigin, Sfx.SWTCHN, SfxType.Misc, 50); buttonList[i].Clear(); } } } }
/// <summary> /// Called when a thing uses a special line. /// Only the front sides of lines are usable. /// </summary> public bool UseSpecialLine(Mobj thing, LineDef line, int side) { var specials = world.Specials; var sa = world.SectorAction; // Err... // Use the back sides of VERY SPECIAL lines... if (side != 0) { switch ((int)line.Special) { case 124: // Sliding door open and close (unused). break; default: return(false); } } // Switches that other things can activate. if (thing.Player == null) { // Never open secret doors. if ((line.Flags & LineFlags.Secret) != 0) { return(false); } switch ((int)line.Special) { case 1: // Manual door raise. case 32: // Manual blue. case 33: // Manual red. case 34: // Manual yellow. break; default: return(false); } } // Do something. switch ((int)line.Special) { // MANUALS case 1: // Vertical door. case 26: // Blue door (locked). case 27: // Yellow door (locked). case 28: // Red door (locked). case 31: // Manual door open. case 32: // Blue locked door open. case 33: // Red locked door open. case 34: // Yellow locked door open. case 117: // Blazing door raise. case 118: // Blazing door open. sa.DoLocalDoor(line, thing); break; // SWITCHES case 7: // Build stairs. if (sa.BuildStairs(line, StairType.Build8)) { specials.ChangeSwitchTexture(line, false); } break; case 9: // Change donut. if (sa.DoDonut(line)) { specials.ChangeSwitchTexture(line, false); } break; case 11: // Exit level. specials.ChangeSwitchTexture(line, false); world.ExitLevel(); break; case 14: // Raise floor 32 and change texture. if (sa.DoPlatform(line, PlatformType.RaiseAndChange, 32)) { specials.ChangeSwitchTexture(line, false); } break; case 15: // Raise floor 24 and change texture. if (sa.DoPlatform(line, PlatformType.RaiseAndChange, 24)) { specials.ChangeSwitchTexture(line, false); } break; case 18: // Raise floor to next highest floor. if (sa.DoFloor(line, FloorMoveType.RaiseFloorToNearest)) { specials.ChangeSwitchTexture(line, false); } break; case 20: // Raise platform next highest floor and change texture. if (sa.DoPlatform(line, PlatformType.RaiseToNearestAndChange, 0)) { specials.ChangeSwitchTexture(line, false); } break; case 21: // Platform down, wait, up and stay. if (sa.DoPlatform(line, PlatformType.DownWaitUpStay, 0)) { specials.ChangeSwitchTexture(line, false); } break; case 23: // Lower floor to Lowest. if (sa.DoFloor(line, FloorMoveType.LowerFloorToLowest)) { specials.ChangeSwitchTexture(line, false); } break; case 29: // Raise door. if (sa.DoDoor(line, VerticalDoorType.Normal)) { specials.ChangeSwitchTexture(line, false); } break; case 41: // Lower ceiling to floor. if (sa.DoCeiling(line, CeilingMoveType.LowerToFloor)) { specials.ChangeSwitchTexture(line, false); } break; case 71: // Turbo lower floor. if (sa.DoFloor(line, FloorMoveType.TurboLower)) { specials.ChangeSwitchTexture(line, false); } break; case 49: // Ceiling crush and raise. if (sa.DoCeiling(line, CeilingMoveType.CrushAndRaise)) { specials.ChangeSwitchTexture(line, false); } break; case 50: // Close door. if (sa.DoDoor(line, VerticalDoorType.Close)) { specials.ChangeSwitchTexture(line, false); } break; case 51: // Secret exit. specials.ChangeSwitchTexture(line, false); world.SecretExitLevel(); break; case 55: // Raise floor crush. if (sa.DoFloor(line, FloorMoveType.RaiseFloorCrush)) { specials.ChangeSwitchTexture(line, false); } break; case 101: // Raise floor. if (sa.DoFloor(line, FloorMoveType.RaiseFloor)) { specials.ChangeSwitchTexture(line, false); } break; case 102: // Lower floor to surrounding floor height. if (sa.DoFloor(line, FloorMoveType.LowerFloor)) { specials.ChangeSwitchTexture(line, false); } break; case 103: // Open door. if (sa.DoDoor(line, VerticalDoorType.Open)) { specials.ChangeSwitchTexture(line, false); } break; case 111: // Blazing door raise (faster than turbo). if (sa.DoDoor(line, VerticalDoorType.BlazeRaise)) { specials.ChangeSwitchTexture(line, false); } break; case 112: // Blazing door open (faster than turbo). if (sa.DoDoor(line, VerticalDoorType.BlazeOpen)) { specials.ChangeSwitchTexture(line, false); } break; case 113: // Blazing door close (faster than turbo). if (sa.DoDoor(line, VerticalDoorType.BlazeClose)) { specials.ChangeSwitchTexture(line, false); } break; case 122: // Blazing platform down, wait, up and stay. if (sa.DoPlatform(line, PlatformType.BlazeDwus, 0)) { specials.ChangeSwitchTexture(line, false); } break; case 127: // Build stairs turbo 16. if (sa.BuildStairs(line, StairType.Turbo16)) { specials.ChangeSwitchTexture(line, false); } break; case 131: // Raise floor turbo. if (sa.DoFloor(line, FloorMoveType.RaiseFloorTurbo)) { specials.ChangeSwitchTexture(line, false); } break; case 133: // Blazing open door (blue). case 135: // Blazing open door (red). case 137: // Blazing open door (yellow). if (sa.DoLockedDoor(line, VerticalDoorType.BlazeOpen, thing)) { specials.ChangeSwitchTexture(line, false); } break; case 140: // Raise floor 512. if (sa.DoFloor(line, FloorMoveType.RaiseFloor512)) { specials.ChangeSwitchTexture(line, false); } break; // BUTTONS case 42: // Close door. if (sa.DoDoor(line, VerticalDoorType.Close)) { specials.ChangeSwitchTexture(line, true); } break; case 43: // Lower ceiling to floor. if (sa.DoCeiling(line, CeilingMoveType.LowerToFloor)) { specials.ChangeSwitchTexture(line, true); } break; case 45: // lower floor to surrounding floor height. if (sa.DoFloor(line, FloorMoveType.LowerFloor)) { specials.ChangeSwitchTexture(line, true); } break; case 60: // Lower floor to Lowest. if (sa.DoFloor(line, FloorMoveType.LowerFloorToLowest)) { specials.ChangeSwitchTexture(line, true); } break; case 61: // Open door. if (sa.DoDoor(line, VerticalDoorType.Open)) { specials.ChangeSwitchTexture(line, true); } break; case 62: // Platform down, wait, up and stay. if (sa.DoPlatform(line, PlatformType.DownWaitUpStay, 1)) { specials.ChangeSwitchTexture(line, true); } break; case 63: // Raise door. if (sa.DoDoor(line, VerticalDoorType.Normal)) { specials.ChangeSwitchTexture(line, true); } break; case 64: // Raise floor to ceiling. if (sa.DoFloor(line, FloorMoveType.RaiseFloor)) { specials.ChangeSwitchTexture(line, true); } break; case 66: // Raise floor 24 and change texture. if (sa.DoPlatform(line, PlatformType.RaiseAndChange, 24)) { specials.ChangeSwitchTexture(line, true); } break; case 67: // Raise floor 32 and change texture. if (sa.DoPlatform(line, PlatformType.RaiseAndChange, 32)) { specials.ChangeSwitchTexture(line, true); } break; case 65: // Raise floor crush. if (sa.DoFloor(line, FloorMoveType.RaiseFloorCrush)) { specials.ChangeSwitchTexture(line, true); } break; case 68: // Raise platform to next highest floor and change texture. if (sa.DoPlatform(line, PlatformType.RaiseToNearestAndChange, 0)) { specials.ChangeSwitchTexture(line, true); } break; case 69: // Raise floor to next highest floor. if (sa.DoFloor(line, FloorMoveType.RaiseFloorToNearest)) { specials.ChangeSwitchTexture(line, true); } break; case 70: // Turbo lower floor. if (sa.DoFloor(line, FloorMoveType.TurboLower)) { specials.ChangeSwitchTexture(line, true); } break; case 114: // Blazing door raise (faster than turbo). if (sa.DoDoor(line, VerticalDoorType.BlazeRaise)) { specials.ChangeSwitchTexture(line, true); } break; case 115: // Blazing door open (faster than turbo). if (sa.DoDoor(line, VerticalDoorType.BlazeOpen)) { specials.ChangeSwitchTexture(line, true); } break; case 116: // Blazing door close (faster than turbo). if (sa.DoDoor(line, VerticalDoorType.BlazeClose)) { specials.ChangeSwitchTexture(line, true); } break; case 123: // Blazing platform down, wait, up and stay. if (sa.DoPlatform(line, PlatformType.BlazeDwus, 0)) { specials.ChangeSwitchTexture(line, true); } break; case 132: // Raise floor turbo. if (sa.DoFloor(line, FloorMoveType.RaiseFloorTurbo)) { specials.ChangeSwitchTexture(line, true); } break; case 99: // Blazing open door (blue). case 134: // Blazing open door (red). case 136: // Blazing open door (yellow). if (sa.DoLockedDoor(line, VerticalDoorType.BlazeOpen, thing)) { specials.ChangeSwitchTexture(line, true); } break; case 138: // Light turn on. sa.LightTurnOn(line, 255); specials.ChangeSwitchTexture(line, true); break; case 139: // Light turn Off. sa.LightTurnOn(line, 35); specials.ChangeSwitchTexture(line, true); break; } return(true); }