![]() |
Routines |
| Prev: CDA0 | Up: Map | Next: CE31 |
|
The handler of the object type 54, which is a lift. When the player (or a block of type 5B) lands on it, it carries it up, to a height of B0. When there is nothing on it any longer, it comes down again to where it started.
The state of the lift is in the handler flags: bit 0 is set while it is going up, bit 1 is set while it is coming down, and bit 7 is set by MarkObjectBelow when something lands on it. The collision flag for being stopped along z is used to find out if something is pushing down on it.
|
||||||||
| RunLift | CDBB | LD (IX+$09),$00 | Set the speeds along x and y to zero. | |||||
| CDBF | LD (IX+$0A),$00 | |||||||
| CDC3 | CALL SetSpriteOffset_Minus16_Minus8 | Call SetSpriteOffset_Minus16_Minus8 to set the offsets of the sprite. | ||||||
| CDC6 | CALL ApplyGravityAndMove_Move | Call ApplyGravityAndMove_Move to move the lift, without gravity. | ||||||
| CDC9 | XOR A | Set the speeds along x and y to zero. | ||||||
| CDCA | LD (IX+$09),A | |||||||
| CDCD | LD (IX+$0A),A | |||||||
| CDD0 | BIT 0,(IX+$17) | Jump to RunLift_Moving if the lift is moving. | ||||||
| CDD4 | JR NZ,RunLift_Moving | |||||||
|
The lift is waiting. Start it when something that is pushing down on it has landed on it.
|
||||||||
| CDD6 | BIT 2,(IX+$0C) | Jump to FinishObjectMove if nothing is pushing down on the lift. | ||||||
| CDDA | JR Z,FinishObjectMove | |||||||
| CDDC | BIT 7,(IX+$17) | Jump to FinishObjectMove if nothing has landed on it. | ||||||
| CDE0 | JR Z,FinishObjectMove | |||||||
| CDE2 | RES 7,(IX+$17) | Clear the flag for something having landed on it. | ||||||
| CDE6 | SET 0,(IX+$17) | Set the flag for the lift going up. | ||||||
| CDEA | JR RunLift_Rise | Jump to RunLift_Rise to start it going up. | ||||||
|
The lift is moving. If nothing is pushing down on it, it comes down.
|
||||||||
| RunLift_Moving | CDEC | BIT 2,(IX+$0C) | Jump to RunLift_Pushed if it is being pushed down. | |||||
| CDF0 | JR NZ,RunLift_Pushed | |||||||
| CDF2 | SET 1,(IX+$17) | Set the flag for the lift coming down. | ||||||
| CDF6 | LD (IX+$0B),$FF | Set the speed along z of the lift to FF. | ||||||
| CDFA | JP SetWipeAndDrawFlags | Jump to SetWipeAndDrawFlags to flag the lift as moved. | ||||||
| RunLift_Pushed | CDFD | BIT 1,(IX+$17) | Jump to RunLift_Landed if the lift is coming down, which means that it has landed. | |||||
| CE01 | JR NZ,RunLift_Landed | |||||||
| CE03 | LD A,(IX+$03) | Jump to RunLift_Rise to keep going up if the lift is not at the top, which is B0. | ||||||
| CE06 | CP $B0 | |||||||
| CE08 | JR C,RunLift_Rise | |||||||
| CE0A | LD (IX+$03),$B0 | Put the lift at the top. | ||||||
| CE0E | LD A,$FE | Set the speed along z of the player to FE, to hold it down on the lift. | ||||||
| CE10 | LD ($A77A),A | |||||||
| CE13 | JP SetWipeAndDrawFlags | Jump to SetWipeAndDrawFlags to flag the lift as moved. | ||||||
| RunLift_Rise | CE16 | LD (IX+$0B),$02 | Set the speed along z of the lift to 02. | |||||
| CE1A | LD A,$03 | Set the speed along z of the player to 03, to take it up with the lift. | ||||||
| CE1C | LD ($A77A),A | |||||||
| CE1F | LD A,($A77B) | Fetch the collision flags of the player. | ||||||
| CE22 | OR %00000100 | Set the flag for being on the ground, so that the player can jump from the lift. | ||||||
| CE24 | LD ($A77B),A | Write the collision flags of the player back. | ||||||
| CE27 | JP SetWipeAndDrawFlags | Jump to SetWipeAndDrawFlags to flag the lift as moved. | ||||||
| RunLift_Landed | CE2A | LD (IX+$17),$00 | Set the state of the lift to waiting. | |||||
| CE2E | JP FinishObjectMove | Jump to FinishObjectMove to finish. | ||||||
| Prev: CDA0 | Up: Map | Next: CE31 |