A Split Door
By Richard Clark

Figure 1: Split Door in Action

As illustrated in Figure 1, a split door is a door that opens in the middle. The top moves up to the ceiling and the bottom moves down to the floor. The door remains open for a time, then closes. The split door wad illustrates the use of a split door.

The split door doesn't use any door functions. Rather, it is controlled by using the floor raise and lower and the ceiling raise and lower specials. Figure 2 shows a typical layout.

Figure 2: Map Layout

The door sector is between the two rooms, just like a normal door and has a tag of 1. However, unlike a normal door, the floor and ceiling need to meet in the middle. Since the door should be 128 units tall, the floor and ceiling height both have a value of 64.

The split door uses upper and lower textures and no middle texture. The textures should have a Y offset of the floor and ceiling height, in this case 64. This will make the texture look normal.

When the player triggers the door, a script is called using the ACS_Execute method. The script takes one parameter, the tag id of the door. This enables the script to work on any split door in the level. Here is the script:

    #include "zcommon.acs"

    script 1 (int DoorTag)
    {
    	//Open the door by 64 units.
    	Floor_LowerByValue (DoorTag, 16, 64);
    	Ceiling_RaiseByValue (DoorTag, 16, 64);

    	//Delay for 120 ticks.
    	Delay (120);

    	//Close the door by 64 units.
    	Floor_RaiseByValue (DoorTag, 16, 64);
    	Ceiling_LowerByValue (DoorTag, 16, 64);
    }

The operation of the door is quite simple. When opening the door, the floor is lowered by 64 units using the Floor_LowerByValue (# 20) special. The parameters of the special are the sector tag, the speed to lower the floor and the amount to lower the floor.

Floor_LowerByValue(tag, speed, distance)

- tag: the floor sector tag.
- speed: the speed at which floor moves.
- distance: the distance the floor moves.

The Ceiling_RaiseByValue (# 41) uses the exact same parameters.

Ceiling_RaiseByValue(tag, speed, distance)

- tag: the ceiling sector tag.
- speed: the speed at which ceiling moves.
- distance: the distance the ceiling moves.

Since ACS runs the specials asynchronously, both specials are activated and run at the same time.

Like a normal door, the split door should be in the open position for a few seconds, so we add a delay in the script.

The door should obviously close, so the specials Floor_RaiseByValue (# 23) and Ceiling_LowerByValue (# 40) are called after the delay to close the door. The parameters for these specials are the same as the previous two.

Floor_RaiseByValue(tag, speed, distance)

- tag: the floor sector tag.
- speed: the speed at which floor moves.
- distance: the distance the floor moves.

Ceiling_LowerByValue(tag, speed, distance)

- tag: the ceiling sector tag.
- speed: the speed at which ceiling moves.
- distance: the distance the ceiling moves.

By using the power of ACS, it is quite easy to build custom constructs in your level to offer your players an interesting and varied playing experience.

Sources
ZDoom reference by Randy Heit.

Back