Prev: 51528 Up: Map Next: 51617
51561: Handle Walking
Used by the routine at HandlePlayerLegs.
Animates the legs of the player. The legs are only animated while the player is walking, entering the room or jumping. When the player stops, the legs carry on until they reach a frame in which the feet are together.
Input
C The controls
IX Address of the object
HandleWalking 51561 LD A,(IX+12) Fetch the flags.
51564 AND %11110000 Keep the counter of the player entering the room.
51566 JR NZ,HandleWalking_Step Jump to HandleWalking_Step if it is.
51568 BIT 3,(IX+12) Jump to HandleWalking_Step if the player is jumping.
51572 JR NZ,HandleWalking_Step
51574 BIT 2,C Jump to HandleWalking_Stop if it is not pressed.
51576 JR Z,HandleWalking_Stop
HandleWalking_Step 51578 PUSH BC Stash the controls on the stack.
51579 CALL PlayFootstepsSound Play the sound of the footsteps.
51582 POP BC Restore the controls from the stack.
This entry point is used by the routine at HandleGuardBottomHalf.
The frame of the animation is in the low three bits of the graphic number and goes from 0 to 5.
HandleWalking_Animate 51583 LD A,(IX+0) Fetch the graphic number and stash it in E.
51586 LD E,A
51587 INC A Go to the next frame.
51588 AND %00000111 Keep the frame in the low three bits.
51590 CP 6 Jump to HandleWalking_Animate_StashFrame if it has not.
51592 JR NZ,HandleWalking_Animate_StashFrame
51594 XOR A Go back to the first frame.
HandleWalking_Animate_StashFrame 51595 LD D,A Stash the frame in D.
51596 LD A,E Fetch the graphic number.
51597 AND %11111000 Take the frame off it.
51599 OR D Put the new frame back.
51600 LD (IX+0),A Update the graphic number.
51603 RET Return.
HandleWalking_Stop 51604 LD A,(IX+0) Fetch the graphic number.
51607 AND %00000111 Keep the frame of the animation.
51609 CP 2 Test whether it is frame 2.
51611 RET Z Return if it is.
51612 CP 4 Test whether it is frame 4.
51614 RET Z Return if it is.
51615 JR HandleWalking_Animate Jump to HandleWalking_Animate to carry on animating the legs.
View the equivalent code in;
Prev: 51528 Up: Map Next: 51617