Prev: AA89 Up: Map Next: AB1F
AAA1: A clockwork mouse (graphics 116 to 119)
Reached through UPDATES. Deadly both ways. It runs straight along U or V at two to five units a turn, flipping between two graphics as it goes, for a random number of turns up to 15 (none left counts as 256); when it is stopped, is blocked, or has run its turns it beeps and turns a quarter, left or right at random, with a new speed and a new count.
The way it faces is its mirror flag (bit 6 of +7: clear along U, set along V) and bit 1 of its graphic (which way along it); a turn always flips the mirror flag, so always changes the axis, and flips bit 1 or not by the random number. The speed is the turn counter's low two bits plus two. +10 counts the turns left. Rooms $3F, $42, $45, $4D, $72, $A9 and $D8 have them (object template 28).
CLOCKWORK_MOUSE AAA1 CALL DRAW_AT_L12_D6 draw 12 left and 6 down
AAA4 CALL DEC_DZ_AND_UPDATE_UVZ fall, and move
AAA7 LD A,(IX+$09) not moving: turn
AAAA OR (IX+$0A)
AAAD JR Z,CLOCKWORK_MOUSE_1
AAAF LD A,(IX+$0C) blocked in U or V: turn
AAB2 AND $03
AAB4 JR NZ,CLOCKWORK_MOUSE_1
AAB6 DEC (IX+$10) its turns run out: turn
AAB9 JR Z,CLOCKWORK_MOUSE_1
CLOCKWORK_MOUSE_0 AABB CALL TOGGLE_FRAME the other of its two graphics
AABE JP DEADLY_AND_DRAW deadly both ways; redraw
CLOCKWORK_MOUSE_1 AAC1 CALL HIGH_BEEP a beep
AAC4 LD A,(TURNS_HIGH) a new count of turns, 0 to 15
AAC7 LD C,A
AAC8 LD A,(RANDOM)
AACB XOR C
AACC AND $0F
AACE LD (IX+$10),A
AAD1 LD A,(IX+$07) always the other axis
AAD4 XOR $40
AAD6 LD (IX+$07),A
AAD9 LD A,(RANDOM) by the random number, flip its way along the axis or not
AADC AND $01
AADE JR Z,CLOCKWORK_MOUSE_5
AAE0 BIT 6,(IX+$07)
AAE4 JR Z,CLOCKWORK_MOUSE_3
CLOCKWORK_MOUSE_2 AAE6 LD A,(IX+$00) flip bit 1: the other way
AAE9 XOR $02
AAEB LD (IX+$00),A
CLOCKWORK_MOUSE_3 AAEE LD A,(TURNS) two to five units, the way bit 1 says
AAF1 AND $03
AAF3 ADD A,$02
AAF5 BIT 1,(IX+$00)
AAF9 JR NZ,CLOCKWORK_MOUSE_4
AAFB NEG
CLOCKWORK_MOUSE_4 AAFD BIT 6,(IX+$07) along U
AB01 JR NZ,CLOCKWORK_MOUSE_6
AB03 LD (IX+$09),A
AB06 LD (IX+$0A),$00
AB0A JR CLOCKWORK_MOUSE_0
CLOCKWORK_MOUSE_5 AB0C BIT 6,(IX+$07) the other half of the random choice
AB10 JR Z,CLOCKWORK_MOUSE_2
AB12 JR CLOCKWORK_MOUSE_3
CLOCKWORK_MOUSE_6 AB14 NEG along V
AB16 LD (IX+$0A),A
AB19 LD (IX+$09),$00
AB1D JR CLOCKWORK_MOUSE_0
Prev: AA89 Up: Map Next: AB1F