Prev: 50540 Up: Map Next: 50621
50573: 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 50573 LD A,(IX+12) Fetch the collision flags.
50576 AND %11110000 Keep only the countdown from entering the room.
50578 JR NZ,StepLegs_Step Jump to StepLegs_Step to step if the player has just entered the room.
50580 BIT 3,(IX+12) Jump to StepLegs_Step to step if the player is jumping.
50584 JR NZ,StepLegs_Step
50586 BIT 2,C Jump to StepLegs_Standing if the player is not walking.
50588 JR Z,StepLegs_Standing
Move on to the next of the four steps.
StepLegs_Step 50590 LD A,(IX+0) Fetch the type of the legs.
50593 LD E,A Stash the type of the legs in E.
50594 INC A Add one to it, and keep the lowest two bits to get the next step.
50595 AND %00000011 Keep only the step.
50597 LD D,A Stash the step in D.
50598 LD A,E Fetch the type of the legs again.
50599 AND %11111100 Clear the lowest two bits of it.
50601 OR D Set the next step.
50602 LD (IX+0),A Set the type of the legs.
50605 PUSH BC Stash the controls on the stack.
50606 CALL PlayFootstepSound Call PlayFootstepSound to make the sound of a footstep.
50609 POP BC Restore the controls from the stack.
50610 RET Return.
Step until the legs are in the standing position.
StepLegs_Standing 50611 LD A,(IX+0) Fetch the type of the legs.
50614 AND %00000011 Keep only the step.
50616 CP 2 Return if the legs are in the standing position.
50618 RET Z
50619 JR StepLegs_Step Jump to StepLegs_Step to take another step.
Prev: 50540 Up: Map Next: 50621