Prev: B19C Up: Map Next: B1E5
B1AE: Turn a creature to face the way it is stepping
Used by the routine at PACER.
Sets bit 0 of the graphic and bit 6 of the flags (the mirror bit) to the pair STEP_FROM_FACING would turn back into this step. The comparison of the two steps is unsigned, which works because one of them is always zero. With no step it leaves them alone. Knight Lore's set_guard_wizard_sprite does the same for its guards.
Input
IX the creature
FACE_ALONG_STEP B1AE LD A,(IX+$09) not stepping: leave it
B1B1 OR (IX+$0A)
B1B4 RET Z
B1B5 LD A,(IX+$09) stepping in V (the U step is the smaller)?
B1B8 CP (IX+$0A)
B1BB JR C,FACE_ALONG_STEP_2
B1BD BIT 7,A in U, and plus: (1,0)
B1BF JR NZ,FACE_ALONG_STEP_1
B1C1 SET 0,(IX+$00)
FACE_ALONG_STEP_0 B1C5 RES 6,(IX+$07)
B1C9 RET
FACE_ALONG_STEP_1 B1CA RES 0,(IX+$00) minus: (0,0)
B1CE JR FACE_ALONG_STEP_0
FACE_ALONG_STEP_2 B1D0 BIT 7,(IX+$0A) in V, and minus: (1,1)
B1D4 JR Z,FACE_ALONG_STEP_4
B1D6 SET 0,(IX+$00)
FACE_ALONG_STEP_3 B1DA SET 6,(IX+$07)
B1DE RET
FACE_ALONG_STEP_4 B1DF RES 0,(IX+$00) plus: (0,1)
B1E3 JR FACE_ALONG_STEP_3
Prev: B19C Up: Map Next: B1E5