Scrolling
Let's continue to the hallway at the top where you can learn about scrolling elevators. Every time you see a flowing river or a waterfall; all of it is performed using the scrolling mechanism.
Scrolling Floors
All flowing water in the game is performed with scrolling floors. Come to the river and take a look. You can hear water flowing.
Lets look at the WATER sector code. You can see that it is a new type of elevator.
seq class: elevator scroll_floor sound: 2 water1.voc angle: 270 speed: 5 seqend
Elevator Scroll_Floor does what the name implies. It just moves the texture on the floor. You can also see that the elevator has a new parameter called angle - all it does is move the water flow in a particular direction. Additionally, to make a nice soothing sound effect, it has a sound value of a waterflow. This means that anytime you are near this sector you will hear WATER1.VOC .
Scrolling Walls
Continue down the hallway and you will see two walls. The one on the right is scrolling and the one on the left is not.
Lets look at the code of the sector SCROLL. It is an elevator class of scroll_wall.
seq class: elevator scroll_wall angle: 90 speed: 30 seqend
Scroll_Wall elevators move a wall along a particular angle and speed. They can be applied to the whole sector or a single wall.
You must be wondering, how come the wall on the left is not moving? It's because for a scroll wall to work properly, you would need to apply a specific flag.
Once the sector is set to be a scroll wall sector you must specify which of the wall sections (TOP / MID / BOT / SIGN ) should scroll. Depending on which you select, they will begin scrolling. To fix the other wall simply change the flag go 128 (Scroll Mid).
Once you fix the other wall you may notice that it scrolls at the same angle as the other one . That's because all the walls always move with the sector's angle command. Lets continue down the hall and around the corner.
Here you will see a sign that changes between different aurebesh letters. Lets look at the texture first.
You will see that it is a long texture divided into three parts. How does Dark Forces render it? Click on the SIGN sector code.
seq class: elevator scroll_wall angle: 0 speed: 0 event_mask: 0 stop: 0 2 stop: 43 3 stop: 86 6 stop: 0 5 stop: 43 5 stop: 86 3 seqend
As you see above, this sector is also a scroll_wall elevator class. However in this case, instead of using a hardcoded angle, it jumps between stops on the texture which are really the vertical offsets. You can see that the height of each sign portion is 43 pixels. The first offset starts with 0 while the second starts with 43 and the last is 86.
To prove that we are just scrolling the texture. Change the floor altitude of the sector to 0 and change the height to 16. Now you can see that the scroll_wall sector just changes the texture offsets as it scrolls.
Lights
You are already familiar that you can change sector or wall ambient lighting. You can also change them using an elevator. Go around the corner and look at the hallway with the changing lights.
This is a simple elevator. If you look at the code you will see that the elevator change_light just has stops that define the value of the light used by the sector.
seq class: elevator change_light stop: 0 2 stop: 31 2 seqend
Above, the stop value 0 corresponds to total darkness and value 31 corresponds to full brightness. You can attach a switch trigger to this elevator and turn room lights on and off as you please!
Morphing Elevators
Go around the corner and look at this large room with multiple moving shapes,
Not everything in Dark Forces only moves up or down. Here you will see a lot of moving shapes that are utilizing the morph and spin elevators.
Morph Elevators
You will see two crates that are slowly moving by themselves. They are two subsectors that start on the right hand of the sector and move back and forth. If you stand in their way they will stop. You can also climb on them.
Lets look at the top sector's INF script called CRATE .
seq class: elevator morph_move2 sound: 1 DOOR1-1.VOC sound: 2 NOSOUND.VOC sound: 3 NOSOUND.VOC angle: 270 speed: 5 stop: @0 2 stop: @40 2 seqend
You can see that it is of type elevator morph_move2. There is also a morph_move1 and the main difference between them is that the player can ride the elevator with move2 but they cannot with move1. You can see that the sounds are set where on start of movement they play a DOOR1-VOC and no sounds for movement or stopping. Just like the scrolling elevator they have an angle to specify the angle at which they are supposed to move. You will see that the stops have @ in front of them which means they move at relative position to the beginning. In reality, they just move 40 Dark Forces Units (dfu) to the left and come back on a loop.
One important thing you must learn is that when you use morphing sectors the walls also have to move. This is not enabled by default. In order for walls to move (morph) they must be tagged with "Wall Morph With Sector" flag (32).
Remember! Every wall (inside and outside the subsectors) in this room must have flag 32 or the morphing sectors will not move.
One interesting thing you may notice is that the top textures are quite different. The texture on the top one is solid-colored and the bottom one has a full texture. You will now learn this is the case.
Morph Scroling
Look at the second crate called CRATE2 . On top it has a texture that moves along the elevator. This is unusual because by default floor textures are not anchored. In fact, you cannot anchor floor textures like you can with walls. So how is this done? Look at the INF code of the second crate.
seq class: elevator morph_move2 sound: 1 DOOR1-1.VOC sound: 2 NOSOUND.VOC sound: 3 NOSOUND.VOC angle: 270 speed: 5 stop: @0 2 stop: @40 2 class: elevator scroll_floor flags: 0 angle: 270 speed: 5 stop: @0 2 stop: @40 2 seqend
The morph_move2 elevator on top is identical to CRATE . However, you can see that this sequence is overloaded by another elevator called scroll_floor. As you see, you can combine multiple classes to make some unique combinations. In this case, the scroll_floor moves at exactly the same angle and position as the wall . What this does is make the texture on top of the crate to move along with the elevator.
You must be wondering. what happens if you get rid of scroll floor elevator? Lets try it out! Go ahead and delete the scroll_floor elevator and run the game.
You will see that the texture is static as the elevator moves. In Dark Forces, any time you see a texture that moves on the floor it is because it is being scrolled by a scroll_floor elevator. This is how it is done in the Detention Center moving platform. It is a morph elevator with a scroll_floor texture.
The box at the top hides the fact that it is scrolling by using a single color texture. This kind of "workaround" is used by all morphing elevators in the game.
Spin Elevators
Dark Forces elevators not only move along the X,Y,Z axis but can also spin place. Lets take a look at the triangle-shaped spinning sector called SPIN1.