Prev: C56C Up: Map Next: C5BD
C58D: Step Legs
Used by the routine at HandlePlayerLegs.
Makes the legs take a step, which means that the type moves on to the next of four, if the player is walking or is in the air or has just entered a room. If the player is standing still, the legs are moved on until they are in the standing position, which is the third of the four.
Input
C Controls
IX Record of the legs
Step while walking, jumping or entering the room.
StepLegs C58D LD A,(IX+$0C) Fetch the collision flags.
C590 AND %11110000 Keep only the countdown from entering the room.
C592 JR NZ,StepLegs_Step Jump to StepLegs_Step to step if the player has just entered the room.
C594 BIT 3,(IX+$0C) Jump to StepLegs_Step to step if the player is jumping.
C598 JR NZ,StepLegs_Step
C59A BIT 2,C Jump to StepLegs_Standing if the player is not walking.
C59C JR Z,StepLegs_Standing
Move on to the next of the four steps.
StepLegs_Step C59E LD A,(IX+$00) Fetch the type of the legs.
C5A1 LD E,A Stash the type of the legs in E.
C5A2 INC A Add one to it, and keep the lowest two bits to get the next step.
C5A3 AND %00000011 Keep only the step.
C5A5 LD D,A Stash the step in D.
C5A6 LD A,E Fetch the type of the legs again.
C5A7 AND %11111100 Clear the lowest two bits of it.
C5A9 OR D Set the next step.
C5AA LD (IX+$00),A Set the type of the legs.
C5AD PUSH BC Stash the controls on the stack.
C5AE CALL PlayFootstepSound Call PlayFootstepSound to make the sound of a footstep.
C5B1 POP BC Restore the controls from the stack.
C5B2 RET Return.
Step until the legs are in the standing position.
StepLegs_Standing C5B3 LD A,(IX+$00) Fetch the type of the legs.
C5B6 AND %00000011 Keep only the step.
C5B8 CP $02 Return if the legs are in the standing position.
C5BA RET Z
C5BB JR StepLegs_Step Jump to StepLegs_Step to take another step.
Prev: C56C Up: Map Next: C5BD