Prev: C948 Up: Map Next: C9A1
C969: 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 C969 LD A,(IX+$0C) Fetch the flags.
C96C AND %11110000 Keep the counter of the player entering the room.
C96E JR NZ,HandleWalking_Step Jump to HandleWalking_Step if it is.
C970 BIT 3,(IX+$0C) Jump to HandleWalking_Step if the player is jumping.
C974 JR NZ,HandleWalking_Step
C976 BIT 2,C Jump to HandleWalking_Stop if it is not pressed.
C978 JR Z,HandleWalking_Stop
HandleWalking_Step C97A PUSH BC Stash the controls on the stack.
C97B CALL PlayFootstepsSound Play the sound of the footsteps.
C97E 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 00 to 05.
HandleWalking_Animate C97F LD A,(IX+$00) Fetch the graphic number and stash it in E.
C982 LD E,A
C983 INC A Go to the next frame.
C984 AND %00000111 Keep the frame in the low three bits.
C986 CP $06 Jump to HandleWalking_Animate_StashFrame if it has not.
C988 JR NZ,HandleWalking_Animate_StashFrame
C98A XOR A Go back to the first frame.
HandleWalking_Animate_StashFrame C98B LD D,A Stash the frame in D.
C98C LD A,E Fetch the graphic number.
C98D AND %11111000 Take the frame off it.
C98F OR D Put the new frame back.
C990 LD (IX+$00),A Update the graphic number.
C993 RET Return.
HandleWalking_Stop C994 LD A,(IX+$00) Fetch the graphic number.
C997 AND %00000111 Keep the frame of the animation.
C999 CP $02 Test whether it is frame 02.
C99B RET Z Return if it is.
C99C CP $04 Test whether it is frame 04.
C99E RET Z Return if it is.
C99F JR HandleWalking_Animate Jump to HandleWalking_Animate to carry on animating the legs.
View the equivalent code in;
Prev: C948 Up: Map Next: C9A1