示例#1
0
        public void BossDeath(Mobj mo)
        {
            var options = world.Options;

            if (options.GameMode == GameMode.Commercial)
            {
                if (options.Map != 7)
                {
                    return;
                }

                if ((mo.Type != MobjType.Fatso) && (mo.Type != MobjType.Baby))
                {
                    return;
                }
            }
            else
            {
                switch (options.Episode)
                {
                case 1:
                    if (options.Map != 8)
                    {
                        return;
                    }

                    if (mo.Type != MobjType.Bruiser)
                    {
                        return;
                    }

                    break;

                case 2:
                    if (options.Map != 8)
                    {
                        return;
                    }

                    if (mo.Type != MobjType.Cyborg)
                    {
                        return;
                    }

                    break;

                case 3:
                    if (options.Map != 8)
                    {
                        return;
                    }

                    if (mo.Type != MobjType.Spider)
                    {
                        return;
                    }

                    break;

                case 4:
                    switch (options.Map)
                    {
                    case 6:
                        if (mo.Type != MobjType.Cyborg)
                        {
                            return;
                        }

                        break;

                    case 8:
                        if (mo.Type != MobjType.Spider)
                        {
                            return;
                        }

                        break;

                    default:
                        return;
                    }
                    break;

                default:
                    if (options.Map != 8)
                    {
                        return;
                    }

                    break;
                }
            }

            // Make sure there is a player alive for victory.
            var players = world.Players;
            int i;

            for (i = 0; i < Player.MaxPlayerCount; i++)
            {
                if (players[i].InGame && players[i].Health > 0)
                {
                    break;
                }
            }

            if (i == Player.MaxPlayerCount)
            {
                // No one left alive, so do not end game.
                return;
            }

            // Scan the remaining thinkers to see if all bosses are dead.
            foreach (var thinker in world.Thinkers)
            {
                var mo2 = thinker as Mobj;
                if (mo2 == null)
                {
                    continue;
                }

                if (mo2 != mo && mo2.Type == mo.Type && mo2.Health > 0)
                {
                    // Other boss not dead.
                    return;
                }
            }

            // Victory!
            if (options.GameMode == GameMode.Commercial)
            {
                if (options.Map == 7)
                {
                    if (mo.Type == MobjType.Fatso)
                    {
                        junk.Tag = 666;
                        world.SectorAction.EV_DoFloor(junk, FloorMoveType.LowerFloorToLowest);
                        return;
                    }

                    if (mo.Type == MobjType.Baby)
                    {
                        junk.Tag = 667;
                        world.SectorAction.EV_DoFloor(junk, FloorMoveType.RaiseToTexture);
                        return;
                    }
                }
            }
            else
            {
                switch (options.Episode)
                {
                case 1:
                    junk.Tag = 666;
                    world.SectorAction.EV_DoFloor(junk, FloorMoveType.LowerFloorToLowest);
                    return;

                case 4:
                    switch (options.Map)
                    {
                    case 6:
                        junk.Tag = 666;
                        world.SectorAction.EV_DoDoor(junk, VlDoorType.BlazeOpen);
                        return;

                    case 8:
                        junk.Tag = 666;
                        world.SectorAction.EV_DoFloor(junk, FloorMoveType.LowerFloorToLowest);
                        return;
                    }
                    break;
                }
            }

            world.G_ExitLevel();
        }
示例#2
0
        //
        // P_UseSpecialLine
        // Called when a thing uses a special line.
        // Only the front sides of lines are usable.
        //
        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&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.EV_VerticalDoor(line, thing);
                break;

            //UNUSED - Door Slide Open&Close
            // case 124:
            // EV_SlidingDoor (line, thing);
            // break;

            // SWITCHES
            case 7:
                // Build Stairs
                if (sa.EV_BuildStairs(line, StairType.Build8))
                {
                    specials.ChangeSwitchTexture(line, false);
                }
                break;

            case 9:
                // Change Donut
                //if (EV_DoDonut(line))
            {
                //P_ChangeSwitchTexture(line, 0);
            }
            break;

            case 11:
                // Exit level
                specials.ChangeSwitchTexture(line, false);
                world.G_ExitLevel();
                break;

            case 14:
                // Raise Floor 32 and change texture
                if (sa.EV_DoPlat(line, PlatformType.RaiseAndChange, 32))
                {
                    specials.ChangeSwitchTexture(line, false);
                }
                break;

            case 15:
                // Raise Floor 24 and change texture
                if (sa.EV_DoPlat(line, PlatformType.RaiseAndChange, 24))
                {
                    specials.ChangeSwitchTexture(line, false);
                }
                break;

            case 18:
                // Raise Floor to next highest floor
                if (sa.EV_DoFloor(line, FloorMoveType.RaiseFloorToNearest))
                {
                    specials.ChangeSwitchTexture(line, false);
                }
                break;

            case 20:
                // Raise Plat next highest floor and change texture
                if (sa.EV_DoPlat(line, PlatformType.RaiseToNearestAndChange, 0))
                {
                    specials.ChangeSwitchTexture(line, false);
                }
                break;

            case 21:
                // PlatDownWaitUpStay
                if (sa.EV_DoPlat(line, PlatformType.DownWaitUpStay, 0))
                {
                    specials.ChangeSwitchTexture(line, false);
                }
                break;

            case 23:
                // Lower Floor to Lowest
                if (sa.EV_DoFloor(line, FloorMoveType.LowerFloorToLowest))
                {
                    specials.ChangeSwitchTexture(line, false);
                }
                break;

            case 29:
                // Raise Door
                if (sa.EV_DoDoor(line, VlDoorType.Normal))
                {
                    specials.ChangeSwitchTexture(line, false);
                }
                break;

            case 41:
                // Lower Ceiling to Floor
                if (sa.EV_DoCeiling(line, CeilingMoveType.LowerToFloor))
                {
                    specials.ChangeSwitchTexture(line, false);
                }
                break;

            case 71:
                // Turbo Lower Floor
                if (sa.EV_DoFloor(line, FloorMoveType.TurboLower))
                {
                    specials.ChangeSwitchTexture(line, false);
                }
                break;

            case 49:
                // Ceiling Crush And Raise
                if (sa.EV_DoCeiling(line, CeilingMoveType.CrushAndRaise))
                {
                    specials.ChangeSwitchTexture(line, false);
                }
                break;

            case 50:
                // Close Door
                if (sa.EV_DoDoor(line, VlDoorType.Close))
                {
                    specials.ChangeSwitchTexture(line, false);
                }
                break;

            case 51:
                // Secret EXIT
                //P_ChangeSwitchTexture(line, 0);
                //G_SecretExitLevel();
                break;

            case 55:
                // Raise Floor Crush
                if (sa.EV_DoFloor(line, FloorMoveType.RaiseFloorCrush))
                {
                    specials.ChangeSwitchTexture(line, false);
                }
                break;

            case 101:
                // Raise Floor
                if (sa.EV_DoFloor(line, FloorMoveType.RaiseFloor))
                {
                    specials.ChangeSwitchTexture(line, false);
                }
                break;

            case 102:
                // Lower Floor to Surrounding floor height
                if (sa.EV_DoFloor(line, FloorMoveType.LowerFloor))
                {
                    specials.ChangeSwitchTexture(line, false);
                }
                break;

            case 103:
                // Open Door
                if (sa.EV_DoDoor(line, VlDoorType.Open))
                {
                    specials.ChangeSwitchTexture(line, false);
                }
                break;

            case 111:
                // Blazing Door Raise (faster than TURBO!)
                if (sa.EV_DoDoor(line, VlDoorType.BlazeRaise))
                {
                    specials.ChangeSwitchTexture(line, false);
                }
                break;

            case 112:
                // Blazing Door Open (faster than TURBO!)
                if (sa.EV_DoDoor(line, VlDoorType.BlazeOpen))
                {
                    specials.ChangeSwitchTexture(line, false);
                }
                break;

            case 113:
                // Blazing Door Close (faster than TURBO!)
                if (sa.EV_DoDoor(line, VlDoorType.BlazeClose))
                {
                    specials.ChangeSwitchTexture(line, false);
                }
                break;

            case 122:
                // Blazing PlatDownWaitUpStay
                if (sa.EV_DoPlat(line, PlatformType.BlazeDwus, 0))
                {
                    specials.ChangeSwitchTexture(line, false);
                }
                break;

            case 127:
                // Build Stairs Turbo 16
                if (sa.EV_BuildStairs(line, StairType.Turbo16))
                {
                    specials.ChangeSwitchTexture(line, false);
                }
                break;

            case 131:
                // Raise Floor Turbo
                if (sa.EV_DoFloor(line, FloorMoveType.RaiseFloorTurbo))
                {
                    specials.ChangeSwitchTexture(line, false);
                }
                break;

            case 133:
            // BlzOpenDoor BLUE
            case 135:
            // BlzOpenDoor RED
            case 137:
                // BlzOpenDoor YELLOW
                if (sa.EV_DoLockedDoor(line, VlDoorType.BlazeOpen, thing))
                {
                    specials.ChangeSwitchTexture(line, false);
                }
                break;

            case 140:
                // Raise Floor 512
                if (sa.EV_DoFloor(line, FloorMoveType.RaiseFloor512))
                {
                    specials.ChangeSwitchTexture(line, false);
                }
                break;

            // BUTTONS
            case 42:
                // Close Door
                if (sa.EV_DoDoor(line, VlDoorType.Close))
                {
                    specials.ChangeSwitchTexture(line, true);
                }
                break;

            case 43:
                // Lower Ceiling to Floor
                if (sa.EV_DoCeiling(line, CeilingMoveType.LowerToFloor))
                {
                    specials.ChangeSwitchTexture(line, true);
                }
                break;

            case 45:
                // Lower Floor to Surrounding floor height
                if (sa.EV_DoFloor(line, FloorMoveType.LowerFloor))
                {
                    specials.ChangeSwitchTexture(line, true);
                }
                break;

            case 60:
                // Lower Floor to Lowest
                if (sa.EV_DoFloor(line, FloorMoveType.LowerFloorToLowest))
                {
                    specials.ChangeSwitchTexture(line, true);
                }
                break;

            case 61:
                // Open Door
                if (sa.EV_DoDoor(line, VlDoorType.Open))
                {
                    specials.ChangeSwitchTexture(line, true);
                }
                break;

            case 62:
                // PlatDownWaitUpStay
                if (sa.EV_DoPlat(line, PlatformType.DownWaitUpStay, 1))
                {
                    specials.ChangeSwitchTexture(line, true);
                }
                break;

            case 63:
                // Raise Door
                if (sa.EV_DoDoor(line, VlDoorType.Normal))
                {
                    specials.ChangeSwitchTexture(line, true);
                }
                break;

            case 64:
                // Raise Floor to ceiling
                if (sa.EV_DoFloor(line, FloorMoveType.RaiseFloor))
                {
                    specials.ChangeSwitchTexture(line, true);
                }
                break;

            case 66:
                // Raise Floor 24 and change texture
                if (sa.EV_DoPlat(line, PlatformType.RaiseAndChange, 24))
                {
                    specials.ChangeSwitchTexture(line, true);
                }
                break;

            case 67:
                // Raise Floor 32 and change texture
                if (sa.EV_DoPlat(line, PlatformType.RaiseAndChange, 32))
                {
                    specials.ChangeSwitchTexture(line, true);
                }
                break;

            case 65:
                // Raise Floor Crush
                if (sa.EV_DoFloor(line, FloorMoveType.RaiseFloorCrush))
                {
                    specials.ChangeSwitchTexture(line, true);
                }
                break;

            case 68:
                // Raise Plat to next highest floor and change texture
                if (sa.EV_DoPlat(line, PlatformType.RaiseToNearestAndChange, 0))
                {
                    specials.ChangeSwitchTexture(line, true);
                }
                break;

            case 69:
                // Raise Floor to next highest floor
                if (sa.EV_DoFloor(line, FloorMoveType.RaiseFloorToNearest))
                {
                    specials.ChangeSwitchTexture(line, true);
                }
                break;

            case 70:
                // Turbo Lower Floor
                if (sa.EV_DoFloor(line, FloorMoveType.TurboLower))
                {
                    specials.ChangeSwitchTexture(line, true);
                }
                break;

            case 114:
                // Blazing Door Raise (faster than TURBO!)
                if (sa.EV_DoDoor(line, VlDoorType.BlazeRaise))
                {
                    specials.ChangeSwitchTexture(line, true);
                }
                break;

            case 115:
                // Blazing Door Open (faster than TURBO!)
                if (sa.EV_DoDoor(line, VlDoorType.BlazeOpen))
                {
                    specials.ChangeSwitchTexture(line, true);
                }
                break;

            case 116:
                // Blazing Door Close (faster than TURBO!)
                if (sa.EV_DoDoor(line, VlDoorType.BlazeClose))
                {
                    specials.ChangeSwitchTexture(line, true);
                }
                break;

            case 123:
                // Blazing PlatDownWaitUpStay
                if (sa.EV_DoPlat(line, PlatformType.BlazeDwus, 0))
                {
                    specials.ChangeSwitchTexture(line, true);
                }
                break;

            case 132:
                // Raise Floor Turbo
                if (sa.EV_DoFloor(line, FloorMoveType.RaiseFloorTurbo))
                {
                    specials.ChangeSwitchTexture(line, true);
                }
                break;

            case 99:
            // BlzOpenDoor BLUE
            case 134:
            // BlzOpenDoor RED
            case 136:
                // BlzOpenDoor YELLOW
                if (sa.EV_DoLockedDoor(line, VlDoorType.BlazeOpen, thing))
                {
                    specials.ChangeSwitchTexture(line, true);
                }
                break;

            case 138:
                // Light Turn On
                sa.EV_LightTurnOn(line, 255);
                specials.ChangeSwitchTexture(line, true);
                break;

            case 139:
                // Light Turn Off
                sa.EV_LightTurnOn(line, 35);
                specials.ChangeSwitchTexture(line, true);
                break;
            }

            return(true);
        }
示例#3
0
        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:
                // HELLSLIME 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 HELLSLIME 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.G_ExitLevel();
                }

                break;

            default:
                throw new Exception("Unknown sector special: " + (int)sector.Special);
            }
        }