Prev: 45141 Up: Map Next: 45229
45163: Handle Circuit Mouse
The handler for the robot mice (objects 94 and 95) which run in circuits. When a mouse is blocked, or is not moving, it makes a noise and turns a quarter turn one way or the other, chosen at random. Its speed is then set from the way it faces, and doubled.
Input
IX The address of the object
Move, or turn if the mouse is blocked.
HandleCircuitMouse 45163 CALL SetPixelAdjustments_Mouse Call SetPixelAdjustments_Mouse.
45166 CALL ExtendObjectDownwards Call ExtendObjectDownwards.
45169 LD A,(IX+9) Jump to HandleCircuitMouse_Turn if the mouse is not moving.
45172 OR (IX+10)
45175 JR Z,HandleCircuitMouse_Turn
45177 CALL ApplyGravityAndMove Call ApplyGravityAndMove.
45180 LD A,(IX+11) Call PlaySoundFromHeight if it is rising or falling.
45183 AND A
45184 CALL NZ,PlaySoundFromHeight
45187 LD A,(IX+12) Fetch the collision flags.
45190 AND %00000011 Keep bits 0 and 1.
45192 JR Z,HandleCircuitMouse_Finish Jump to HandleCircuitMouse_Finish if the mouse has not been blocked.
HandleCircuitMouse_Turn 45194 CALL PlayBumpSound Call PlayBumpSound.
45197 LD A,(23301) Fetch RandomSeed2.
45200 AND %00000001 Keep bit 0.
45202 JR Z,HandleCircuitMouse_TurnOneWay Jump to HandleCircuitMouse_TurnOneWay if it is zero.
45204 CALL TurnMouseOtherWay Call TurnMouseOtherWay.
HandleCircuitMouse_SetSpeed 45207 CALL SetMouseSpeed Call SetMouseSpeed.
45210 SLA (IX+9) Double the speed along the x axis.
45214 SLA (IX+10) Double the speed along the y axis.
HandleCircuitMouse_Finish 45218 CALL RestoreObjectHeight Call RestoreObjectHeight.
45221 JP SetDeadlyFlagsAndDraw Jump to SetDeadlyFlagsAndDraw.
HandleCircuitMouse_TurnOneWay 45224 CALL TurnMouseOneWay Call TurnMouseOneWay.
45227 JR HandleCircuitMouse_SetSpeed Jump to HandleCircuitMouse_SetSpeed.
Prev: 45141 Up: Map Next: 45229