Prev: 51359 Up: Map Next: 51561
51528: Handle Jump
Used by the routine at HandlePlayerLegs.
Makes the player jump if the jump control is pressed. The player cannot jump while entering a room, while already jumping, or while falling quickly.
Input
C The controls
IX Address of the object
Start a jump if the control is pressed and the player is ready.
HandleJump 51528 BIT 3,C Test the jump control.
51530 RET Z Return if it is not pressed.
51531 LD A,(IX+12) Fetch the flags of the player.
51534 AND %11110000 Keep the counter of the player entering the room.
51536 RET NZ Return if the player is entering the room.
51537 BIT 3,(IX+12) Test whether the player is already jumping.
51541 RET NZ Return if it is.
51542 LD A,(IX+11) Fetch the speed in Z and add one to it.
51545 INC A
51546 RET M Return if it was lower than 255, as the player is falling.
51547 SET 3,(IX+12) Flag the player as jumping.
51551 LD (IX+11),8 Set the speed in Z to 8.
51555 PUSH BC Stash the controls on the stack.
51556 CALL PlayJumpSound Play the sound of a jump.
51559 POP BC Restore the controls from the stack.
51560 RET Return.
View the equivalent code in;
Prev: 51359 Up: Map Next: 51561