Prev: 37308 Up: Map Next: 37357
37317: Handle Trap Open
The handler for a trapdoor that is open (sprite ID 25). If the low byte of the random number seed at RandomSeed is not zero then the trapdoor is used by FallThroughTrapdoor. Otherwise HandlerTrap_Toggle closes it.
Input
IX The trapdoor entity
HandlerTrapOpen 37317 LD A,(24069) Fetch the random seed from RandomSeed.
37320 AND A Test whether it is zero.
37321 JP NZ,FallThroughTrapdoor Jump to FallThroughTrapdoor if it is not.
This entry point is used by the routine at HandlerTrapClosed.
Change the trapdoor from open to closed or the other way round. It is erased and drawn again with a temporary attribute.
HandlerTrap_Toggle 37324 LD A,(IX+5) Fetch the attribute of the trapdoor.
37327 PUSH AF Stash it on the stack.
37328 OR %00000011 Set bits 0-1, which is temporary.
37330 LD (IX+5),A Update the attribute of the trapdoor.
37333 CALL DrawItemGraphic Call DrawItemGraphic to erase the trapdoor.
37336 LD A,(IX+0) Fetch the sprite ID of the trapdoor.
37339 XOR %00000001 Flip bit 0, which changes the trapdoor from open to closed or the other way round.
37341 LD (IX+0),A Update the sprite ID of the trapdoor.
37344 CALL DrawItemGraphic Call DrawItemGraphic to draw the trapdoor.
37347 POP AF Restore the attribute of the trapdoor from the stack.
37348 LD (IX+5),A Write it to the attribute of the trapdoor.
37351 CALL HandlerRoomItem Call HandlerRoomItem to handle a room item that does nothing.
37354 JP SoundsDoor Jump to SoundsDoor to make the sound of a door.
Prev: 37308 Up: Map Next: 37357