Prev: C23D Up: Map Next: C296
C25E: Handle Walking
Used by the routine at HandlePlayerLegs.
Animates the legs of the player, with a footstep sound, while the player is walking, entering the room or jumping. The frame of the animation is in the lowest two bits of the sprite number. When the player stops walking the legs carry on until they reach frame 01, where the feet are together. The routine does nothing while the player is turning (objects 18 to 1B).
Input
C The controls
IX The address of the object
Return while turning.
HandleWalking C25E LD A,(IX+$00) Fetch the sprite number of the player.
C261 SUB $18 Subtract 18.
C263 CP $04 Return if the player is turning.
C265 RET C
Step while entering, jumping or walking.
C266 LD A,(IX+$0C) Fetch the collision flags.
C269 AND %11110000 Keep only bits 4-7.
C26B JR NZ,HandleWalking_Step Jump to HandleWalking_Step if the player is entering the room.
C26D BIT 3,(IX+$0C) Jump to HandleWalking_Step if the player is jumping.
C271 JR NZ,HandleWalking_Step
C273 BIT 2,C Jump to HandleWalking_Stop if bit 2 of C is clear.
C275 JR Z,HandleWalking_Stop
HandleWalking_Step C277 PUSH BC Stash BC on the stack.
C278 CALL PlayFootstepsSound Call PlayFootstepsSound.
C27B POP BC Restore BC from the stack.
Go on to the next frame, which is 00 to 03.
HandleWalking_Animate C27C LD A,(IX+$00) Fetch the sprite number of the player.
C27F LD E,A Copy it to E.
C280 INC A Increment A.
C281 AND %00000011 Keep only bits 0 and 1.
C283 LD D,A Copy the frame to D.
C284 LD A,E Copy E to A.
C285 AND %11111100 Keep only bits 2-7.
C287 OR D Merge the new frame.
C288 LD (IX+$00),A Set the sprite number of the player.
C28B RET Return.
HandleWalking_Stop C28C LD A,(IX+$00) Fetch the sprite number of the player.
C28F AND %00000011 Keep only bits 0 and 1.
C291 CP $01 Return if it is 01.
C293 RET Z
C294 JR HandleWalking_Animate Jump to HandleWalking_Animate.
View the equivalent code in;
Prev: C23D Up: Map Next: C296