Prev: B108 Up: Map Next: B165
B110: The update routine for a creature that paces to and fro (graphics 86 and 87)
The upper half of object templates 18 and 19 (the lower half is LOWER_HALF's). It walks two units a turn along one axis, and when it is stopped it turns round, with a thud, and walks back the other way. It keeps its step in U or V in +10 while it moves, since a blocked move leaves the step zero. With no step at all, as when the room has just been built, it takes the way it faces (STEP_FROM_FACING). It is deadly both ways.
Measured in the simulator in room $A6: from U 180 down two units a turn to 168, then back up to 184 and down again, the picture turning with it, and the lower half following.
Input
IX the upper half's record
PACER B110 CALL DRAW_AT_L12_D6 the drawing nudge
B113 CALL JOIN_HALVES the two halves as one box
PACER_0 B116 LD A,(IX+$09) a step in U?
B119 AND A
B11A JR Z,PACER_3
B11C LD (IX+$10),A yes: keep it, and move
B11F CALL DEC_DZ_AND_UPDATE_UVZ
B122 BIT 0,(IX+$0C) not stopped in U: done
B126 JR Z,PACER_2
B128 LD A,(IX+$10) stopped: walk back the other way
B12B NEG
B12D LD (IX+$09),A
PACER_1 B130 CALL THUD_SOUND a thud, and face the new way
B133 CALL FACE_ALONG_STEP
PACER_2 B136 CALL PART_HALVES part the halves; deadly both ways, and redraw it
B139 JP DEADLY_AND_DRAW
PACER_3 B13C LD A,(IX+$0A) a step in V?
B13F AND A
B140 JR Z,PACER_4
B142 LD (IX+$10),A yes: keep it, and move
B145 CALL DEC_DZ_AND_UPDATE_UVZ
B148 BIT 1,(IX+$0C) not stopped in V: done
B14C JR Z,PACER_2
B14E LD A,(IX+$10) stopped: walk back the other way
B151 NEG
B153 LD (IX+$0A),A
B156 JR PACER_1
PACER_4 B158 CALL STEP_FROM_FACING no step: take the way it faces, two units a turn, and go again
B15B SLA (IX+$09)
B15F SLA (IX+$0A)
B163 JR PACER_0
Prev: B108 Up: Map Next: B165