Prev: 45139 Up: Map Next: 45209
45176: Animate Walk
Used by the routine at UpdatePlayerDirection.
Every other frame, if the player has moved, adds one to the animation frame in bits 0-1 of the sprite ID (wrapping from 3 round to 0).
Input
D New Y position
E New X position
IX Actor record of the player
AnimateWalk 45176 LD A,(23672) Fetch the low byte of FRAMES.
45179 AND %00000001 Keep only bit 0.
45181 RET NZ Return if this is an odd frame.
45182 LD A,D Fetch the new Y position.
45183 XOR (IX+4) Find the difference from the Y position of the player.
45186 LD C,A Stash the Y difference in C.
45187 LD A,E Fetch the new X position.
45188 XOR (IX+3) Find the difference from the X position of the player.
45191 OR C Return if the player has not moved.
45192 RET Z
45193 LD A,(IX+0) Fetch the sprite ID of the player.
45196 LD C,A Stash the sprite ID in C.
45197 INC A Move on to the next frame of animation.
45198 AND %00000011 Keep only bits 0-1.
45200 LD B,A Stash the new frame in B.
45201 LD A,C Fetch the old sprite ID.
45202 AND %11111100 Keep only bits 2-7.
45204 OR B Merge in the new frame.
45205 LD (IX+0),A Set the new sprite ID of the player.
45208 RET Return.
Prev: 45139 Up: Map Next: 45209