![]() |
Routines |
| Prev: 50239 | Up: Map | Next: 50339 |
|
The handler of the legs of the player, which are the object types 32 to 39. The legs are the first of the two objects of the player, and they do everything: the body, which follows them, is run by HandlePlayerTop.
The type of the legs says which way the player is facing, and which step of the walk is being taken. If something dangerous has touched the player the legs explode. Otherwise the controls are read and used to turn, walk, jump, pick up and drop objects, and fire.
|
||||||||
| HandlePlayerLegs | 50240 | CALL SetSpriteOffset_Minus12_Minus6 | Call SetSpriteOffset_Minus12_Minus6 to set where the sprite is drawn. | |||||
| 50243 | BIT 6,(IX+13) | Jump to HandlePlayerLegs_Controls if the player has not been touched by anything dangerous. | ||||||
| 50247 | JR Z,HandlePlayerLegs_Controls | |||||||
| 50249 | SET 6,(IX+45) | Make the body explode too. | ||||||
| 50253 | JP StartExplosion | Jump to StartExplosion to make the legs explode. | ||||||
|
Read the controls, and clear the speeds along x and y.
|
||||||||
| HandlePlayerLegs_Controls | 50256 | CALL ReadControls | Call ReadControls to read the controls. | |||||
| 50259 | XOR A | Set the speeds along x and y to zero. | ||||||
| 50260 | LD (IX+9),A | |||||||
| 50263 | LD (IX+10),A | |||||||
|
Act on the controls.
|
||||||||
| 50266 | CALL HandleTurning | Call HandleTurning to turn the player. | ||||||
| 50269 | CALL StepLegs | Call StepLegs to step the legs. | ||||||
| 50272 | CALL HandleJump | Call HandleJump to start a jump. | ||||||
| 50275 | CALL HandlePickupAndDrop | Call HandlePickupAndDrop to pick up or drop an object. | ||||||
| 50278 | CALL TestPlayerInRoom | Call TestPlayerInRoom to find out if the player is clear of the walls. | ||||||
| 50281 | JR NC,HandlePlayerLegs_Outside | Jump to HandlePlayerLegs_Outside if the player is not. | ||||||
|
Move the player, which is done with the body flagged as being moved so that the legs do not collide with it.
|
||||||||
| HandlePlayerLegs_Move | 50283 | SET 1,(IX+39) | Flag the body as being moved. | |||||
| 50287 | LD A,(IX+3) | Jump to HandlePlayerLegs_MoveLegs unless the legs are higher than 240. | ||||||
| 50290 | CP 240 | |||||||
| 50292 | JR C,HandlePlayerLegs_MoveLegs | |||||||
| 50294 | LD (IX+3),240 | Put the legs at a height of 240, which is the highest that they can be. | ||||||
| HandlePlayerLegs_MoveLegs | 50298 | CALL MovePlayer | Call MovePlayer to move the legs. | |||||
| 50301 | CALL FireProjectile | Call FireProjectile to fire a projectile, if the fire key is pressed. | ||||||
| 50304 | RES 1,(IX+39) | Clear the flag on the body. | ||||||
| 50308 | RES 0,(IX+7) | Clear the flag that makes the legs ignore the walls. | ||||||
|
Count down the time since the player entered the room, which is in the top four bits of the collision flags.
|
||||||||
| 50312 | LD A,(IX+12) | Fetch the collision flags. | ||||||
| 50315 | SUB 16 | Take 16 off them, and jump to HandlePlayerLegs_Done if there was nothing to take off. | ||||||
| 50317 | JR C,HandlePlayerLegs_Done | |||||||
| 50319 | LD (IX+12),A | Set them. | ||||||
| HandlePlayerLegs_Done | 50322 | JP SetWipeAndDrawFlags | Jump to SetWipeAndDrawFlags to mark the legs to be drawn. | |||||
|
The player is not clear of the walls, as it is in a doorway. Stop it from rising, though it can still fall.
|
||||||||
| HandlePlayerLegs_Outside | 50325 | LD A,(IX+11) | Fetch the speed along z. | |||||
| 50328 | AND A | Jump to HandlePlayerLegs_Move if the player is falling. | ||||||
| 50329 | JP M,HandlePlayerLegs_Move | |||||||
| 50332 | XOR A | Set the speed along z to zero. | ||||||
| 50333 | LD (IX+11),A | |||||||
| 50336 | JR HandlePlayerLegs_Move | Jump to HandlePlayerLegs_Move. | ||||||
| 50338 | RET | Return, which nothing does. | ||||||
|
View the equivalent code in;
|
||||||||
| Prev: 50239 | Up: Map | Next: 50339 |