![]() |
Routines |
| Prev: 52640 | Up: Map | Next: 52785 |
|
The handler of the object type 84, which is a lift. When the player (or a block of type 91) lands on it, it carries it up, to a height of 176. 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 | 52667 | LD (IX+9),0 | Set the speeds along x and y to zero. | |||||
| 52671 | LD (IX+10),0 | |||||||
| 52675 | CALL SetSpriteOffset_Minus16_Minus8 | Call SetSpriteOffset_Minus16_Minus8 to set the offsets of the sprite. | ||||||
| 52678 | CALL ApplyGravityAndMove_Move | Call ApplyGravityAndMove_Move to move the lift, without gravity. | ||||||
| 52681 | XOR A | Set the speeds along x and y to zero. | ||||||
| 52682 | LD (IX+9),A | |||||||
| 52685 | LD (IX+10),A | |||||||
| 52688 | BIT 0,(IX+23) | Jump to RunLift_Moving if the lift is moving. | ||||||
| 52692 | JR NZ,RunLift_Moving | |||||||
|
The lift is waiting. Start it when something that is pushing down on it has landed on it.
|
||||||||
| 52694 | BIT 2,(IX+12) | Jump to FinishObjectMove if nothing is pushing down on the lift. | ||||||
| 52698 | JR Z,FinishObjectMove | |||||||
| 52700 | BIT 7,(IX+23) | Jump to FinishObjectMove if nothing has landed on it. | ||||||
| 52704 | JR Z,FinishObjectMove | |||||||
| 52706 | RES 7,(IX+23) | Clear the flag for something having landed on it. | ||||||
| 52710 | SET 0,(IX+23) | Set the flag for the lift going up. | ||||||
| 52714 | 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 | 52716 | BIT 2,(IX+12) | Jump to RunLift_Pushed if it is being pushed down. | |||||
| 52720 | JR NZ,RunLift_Pushed | |||||||
| 52722 | SET 1,(IX+23) | Set the flag for the lift coming down. | ||||||
| 52726 | LD (IX+11),255 | Set the speed along z of the lift to 255. | ||||||
| 52730 | JP SetWipeAndDrawFlags | Jump to SetWipeAndDrawFlags to flag the lift as moved. | ||||||
| RunLift_Pushed | 52733 | BIT 1,(IX+23) | Jump to RunLift_Landed if the lift is coming down, which means that it has landed. | |||||
| 52737 | JR NZ,RunLift_Landed | |||||||
| 52739 | LD A,(IX+3) | Jump to RunLift_Rise to keep going up if the lift is not at the top, which is 176. | ||||||
| 52742 | CP 176 | |||||||
| 52744 | JR C,RunLift_Rise | |||||||
| 52746 | LD (IX+3),176 | Put the lift at the top. | ||||||
| 52750 | LD A,254 | Set the speed along z of the player to 254, to hold it down on the lift. | ||||||
| 52752 | LD (42874),A | |||||||
| 52755 | JP SetWipeAndDrawFlags | Jump to SetWipeAndDrawFlags to flag the lift as moved. | ||||||
| RunLift_Rise | 52758 | LD (IX+11),2 | Set the speed along z of the lift to 2. | |||||
| 52762 | LD A,3 | Set the speed along z of the player to 3, to take it up with the lift. | ||||||
| 52764 | LD (42874),A | |||||||
| 52767 | LD A,(42875) | Fetch the collision flags of the player. | ||||||
| 52770 | OR %00000100 | Set the flag for being on the ground, so that the player can jump from the lift. | ||||||
| 52772 | LD (42875),A | Write the collision flags of the player back. | ||||||
| 52775 | JP SetWipeAndDrawFlags | Jump to SetWipeAndDrawFlags to flag the lift as moved. | ||||||
| RunLift_Landed | 52778 | LD (IX+23),0 | Set the state of the lift to waiting. | |||||
| 52782 | JP FinishObjectMove | Jump to FinishObjectMove to finish. | ||||||
| Prev: 52640 | Up: Map | Next: 52785 |