![]() |
Routines |
| Prev: 51561 | Up: Map | Next: 51707 |
|
Used by the routine at HandlePlayerLegs.
Moves the player by one frame. The speeds in X and Y are only set up while the player walks or is jumping, and they are cleared again afterwards. The speed in Z has gravity taken off it, which is more if the player is falling or has let go of the jump control.
|
||||||||||
| MovePlayer | 51617 | LD A,(23492) | Fetch the flag that is set while an object is put into the cauldron from ObjectInCauldronFlag. | |||||||
| 51620 | AND A | |||||||||
| 51621 | JR Z,MovePlayer_Speed | Jump to MovePlayer_Speed if it is not set. | ||||||||
| 51623 | LD (IX+11),2 | Set the speed in Z to 2. | ||||||||
| MovePlayer_Speed | 51627 | BIT 3,(IX+12) | Jump to MovePlayer_Forward if the player is jumping. | |||||||
| 51631 | JR NZ,MovePlayer_Forward | |||||||||
| 51633 | LD A,(IX+12) | Fetch the flags. | ||||||||
| 51636 | AND %11110000 | Keep the counter of the player entering the room. | ||||||||
| 51638 | JR NZ,MovePlayer_Forward | Jump to MovePlayer_Forward if it is. | ||||||||
| 51640 | BIT 2,C | Jump to MovePlayer_Gravity if it is not pressed. | ||||||||
| 51642 | JR Z,MovePlayer_Gravity | |||||||||
| MovePlayer_Forward | 51644 | PUSH BC | Stash the controls on the stack. | |||||||
| 51645 | CALL SetPlayerSpeed | Set the speeds in X and Y from the direction of the player. | ||||||||
| 51648 | POP BC | Restore the controls from the stack. | ||||||||
|
Gravity takes one off the speed in Z when the player is rising with the jump control held down, and two otherwise.
|
||||||||||
| MovePlayer_Gravity | 51649 | LD A,(IX+11) | Fetch the speed in Z and test it. | |||||||
| 51652 | AND A | |||||||||
| 51653 | JP M,MovePlayer_Fall | Jump to MovePlayer_Fall if it is negative. | ||||||||
| 51656 | BIT 3,C | Jump to MovePlayer_Store if it is pressed. | ||||||||
| 51658 | JR NZ,MovePlayer_Store | |||||||||
| MovePlayer_Fall | 51660 | DEC A | Take one off the speed in Z. | |||||||
| MovePlayer_Store | 51661 | DEC A | Take one off the speed in Z. | |||||||
| 51662 | LD (IX+11),A | Store the new speed in Z. | ||||||||
| 51665 | LD (23489),A | Store it as the last speed in Z of the player too at PlayerFallSpeed. | ||||||||
| 51668 | ADD A,2 | Add two to it. | ||||||||
| 51670 | CALL M,PlaySoundFromHeight | Play the sound of falling if the player is falling fast enough. | ||||||||
| 51673 | CALL BlockMovement | Stop the player moving through other objects and the walls of the room. | ||||||||
| 51676 | CALL HandleRoomExit | Change room if the player has gone through an arch. | ||||||||
| 51679 | CALL MoveObject | Add the speeds to the position of the player. | ||||||||
| 51682 | BIT 2,(IX+12) | Jump to MovePlayer_Stop if the player is not blocked in Z. | ||||||||
| 51686 | JR Z,MovePlayer_Stop | |||||||||
| 51688 | LD A,(23489) | Fetch the last speed in Z and test it from PlayerFallSpeed. | ||||||||
| 51691 | AND A | |||||||||
| 51692 | JP P,MovePlayer_Stop | Jump to MovePlayer_Stop if the player was rising. | ||||||||
| 51695 | RES 3,(IX+12) | Flag the player as no longer jumping, as it has landed. | ||||||||
|
|
||||||||||
| MovePlayer_Stop | 51699 | XOR A | Set the speeds in X and Y to zero. | |||||||
| 51700 | LD (IX+9),A | |||||||||
| 51703 | LD (IX+10),A | |||||||||
| 51706 | RET | Return. | ||||||||
| Prev: 51561 | Up: Map | Next: 51707 |