Prev: 43249 Up: Map Next: 43354
43257: Handle Land Mine
The update routine for the land mine (object 130). It sits on the floor and is deadly to touch. Every so often one mine in the room leaps and falls. Bit 0 of IX+16 is set while it is leaping, bit 1 while it is falling. IX+17 is the height at the top of the leap. LandMineFlag is set while any mine is leaping.
Input
IX The address of the object
Start a leap if no other mine is leaping.
HandleLandMine 43257 CALL SetPixelAdjustments Call SetPixelAdjustments.
43260 CALL SetDeadlyFlags Call SetDeadlyFlags.
43263 BIT 0,(IX+16) Jump to HandleLandMine_MoveMine if the mine is already leaping.
43267 JR NZ,HandleLandMine_MoveMine
43269 LD A,(23363) Return if LandMineFlag is set.
43272 AND A
43273 RET NZ
43274 LD A,(23301) Fetch RandomSeed2.
43277 INC A Add one to it.
43278 AND %00000011 Keep bits 0 and 1.
43280 RET NZ Return if they are not zero.
43281 LD A,1 Set A to 1.
43283 LD (23363),A Set LandMineFlag.
43286 LD (IX+16),A Mark this mine as leaping.
43289 LD A,(IX+3) Fetch the height of the mine.
43292 ADD A,48 Add 48.
43294 LD (IX+17),A Store the height at the top of the leap.
Move the mine for this pass.
HandleLandMine_MoveMine 43297 BIT 1,(IX+16) Jump to HandleLandMine_Rising if the mine is not falling.
43301 JR Z,HandleLandMine_Rising
43303 CALL ApplyGravityAndMove Call ApplyGravityAndMove.
43306 BIT 2,(IX+12) Jump to HandleLandMine_SoundAndRedraw if the mine has not landed.
43310 JR Z,HandleLandMine_SoundAndRedraw
43312 XOR A Write 0.
43313 LD (IX+16),A Clear the state of the mine.
43316 LD (23363),A Write 0 to LandMineFlag.
Play a sound and redraw the mine.
HandleLandMine_SoundAndRedraw 43319 CALL PlaySoundFromHeight Call PlaySoundFromHeight.
43322 JP SetWipeAndDrawFlags Jump to SetWipeAndDrawFlags.
The mine is rising.
HandleLandMine_Rising 43325 LD (IX+11),3 Set the vertical speed to 3.
43329 CALL ApplyGravityAndMove Call ApplyGravityAndMove.
43332 LD A,(IX+3) Fetch the height of the mine.
43335 CP (IX+17) Jump to HandleLandMine_StartFalling if it has reached the top.
43338 JR NC,HandleLandMine_StartFalling
43340 BIT 2,(IX+12) Jump to HandleLandMine_StartFalling if it has hit something above.
43344 JR NZ,HandleLandMine_StartFalling
43346 JR HandleLandMine_SoundAndRedraw Jump to HandleLandMine_SoundAndRedraw.
The mine starts falling.
HandleLandMine_StartFalling 43348 SET 1,(IX+16) Mark the mine as falling.
43352 JR HandleLandMine_SoundAndRedraw Jump to HandleLandMine_SoundAndRedraw.
Prev: 43249 Up: Map Next: 43354