Prev: A4B3 Up: Map Next: A4D7
A4C3: Face Direction
Used by the routine at HandlerChasingNastie.
Updates the sprite ID of an actor so that it faces the way it is moving and flips its animation frame. Bit 1 of the sprite ID is set when the X velocity is positive, and bit 0 of the sprite ID is flipped.
Input
IX Actor record
FaceDirection A4C3 LD A,(IX+$06) Fetch the X velocity of the actor.
A4C6 RLCA Rotate the X velocity left twice, so that the direction is in bit 1.
A4C7 RLCA
A4C8 AND %00000010 Keep only the direction bit (bit 1).
A4CA LD C,A Stash the direction bit in C.
A4CB LD A,(IX+$00) Fetch the sprite ID of the actor.
A4CE AND %11111101 Keep only bits 0 and 2-7.
A4D0 OR C Merge in the direction bit.
A4D1 XOR %00000011 Flip bits 0 and 1.
A4D3 LD (IX+$00),A Set the new sprite ID of the actor.
A4D6 RET Return.
Prev: A4B3 Up: Map Next: A4D7