Prev: DCA3 Up: Map Next: DCDC
DCA8: Walk on, speeding up
Used by the routine at KNIGHT_WALKS.
His speed goes halfway to his top speed (TOP_SPEED) each turn, rounded down to an even number -- which means it never reaches it: from 0 with top speed 10 it goes 4, 6, 8 and stays at 8; with the bonus's 18 it goes 8, 12, 14, 16 and stays at 16 (both measured in the simulator, walking held).
From offset 13 (WALK_STEP, also where he comes to a stop, COAST_PLUS_V): the step from the speed and the facing, trimmed at walls, and moved; the visited cell and the percentage (VISIT_CELL); a footstep (FOOTSTEP); and the next of six walking frames.
Input
IX The legs' record
WALK_ON DCA8 LD A,(TOP_SPEED) Halfway to the top speed, even
DCAB SUB (IX+$05)
DCAE SRL A
DCB0 ADD A,(IX+$05)
DCB3 AND $FE
This entry point is used by the routine at COAST_PLUS_V.
WALK_STEP DCB5 LD (IX+$05),A The speed
DCB8 CALL SET_STEP Step, trimmed at walls, and move
DCBB CALL MOVE_CLIPPED
DCBE CALL APPLY_STEP
DCC1 CALL VISIT_CELL A new cell visited?
DCC4 CALL FOOTSTEP A footstep
DCC7 LD A,(IX+$00) The next walking frame, 0-5 in the low three bits
DCCA LD C,A
DCCB INC A
DCCC AND $07
DCCE CP $06
DCD0 JR C,WALK_ON_0
DCD2 XOR A
WALK_ON_0 DCD3 LD B,A Keep the rest of the graphic (bit 3, from behind or the front)
DCD4 LD A,C
DCD5 AND $F8
DCD7 OR B
DCD8 LD (IX+$00),A
DCDB RET
Prev: DCA3 Up: Map Next: DCDC