Prev: C56C Up: Map Next: C5BD
C58D: Step the legs
Used by the routine at PLAYER_LEGS.
While the player walks, jumps or is walking into a room, the legs step on through their four frames -- the low two bits of the graphic -- and the footstep sound (FOOTSTEP) counts, sounding every fourth step. When none of those applies the legs carry on stepping to frame 2, the standing pose, and stop there. Knight Lore's cycle is six frames with two standing poses, and it carries on to them in silence; here the steps to the standing pose count towards a footstep too.
Input
IX The player's legs
C The controls
HANDLE_FORWARD C58D LD A,(IX+$0C) Walking into a room: step
C590 AND $F0
C592 JR NZ,HANDLE_FORWARD_0
C594 BIT 3,(IX+$0C) Jumping: step
C598 JR NZ,HANDLE_FORWARD_0
C59A BIT 2,C Walk not held: go to the standing pose
C59C JR Z,HANDLE_FORWARD_1
HANDLE_FORWARD_0 C59E LD A,(IX+$00) The next frame of four, in the graphic's low two bits
C5A1 LD E,A
C5A2 INC A
C5A3 AND $03
C5A5 LD D,A
C5A6 LD A,E
C5A7 AND $FC
C5A9 OR D
C5AA LD (IX+$00),A
C5AD PUSH BC The footstep count and sound, the controls kept
C5AE CALL FOOTSTEP
C5B1 POP BC
C5B2 RET
HANDLE_FORWARD_1 C5B3 LD A,(IX+$00) Frame 2 is the standing pose: done
C5B6 AND $03
C5B8 CP $02
C5BA RET Z
C5BB JR HANDLE_FORWARD_0 Otherwise step on towards it
Prev: C56C Up: Map Next: C5BD