Exemple #1
0
        /// <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);
        }