Prev: 91BC Up: Map Next: 91ED
91C5: Handle Trap Open
The handler for a trapdoor that is open (sprite ID 19). 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 91C5 LD A,($5E05) Fetch the random seed from RandomSeed.
91C8 AND A Test whether it is zero.
91C9 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 91CC LD A,(IX+$05) Fetch the attribute of the trapdoor.
91CF PUSH AF Stash it on the stack.
91D0 OR %00000011 Set bits 0-1, which is temporary.
91D2 LD (IX+$05),A Update the attribute of the trapdoor.
91D5 CALL DrawItemGraphic Call DrawItemGraphic to erase the trapdoor.
91D8 LD A,(IX+$00) Fetch the sprite ID of the trapdoor.
91DB XOR %00000001 Flip bit 0, which changes the trapdoor from open to closed or the other way round.
91DD LD (IX+$00),A Update the sprite ID of the trapdoor.
91E0 CALL DrawItemGraphic Call DrawItemGraphic to draw the trapdoor.
91E3 POP AF Restore the attribute of the trapdoor from the stack.
91E4 LD (IX+$05),A Write it to the attribute of the trapdoor.
91E7 CALL HandlerRoomItem Call HandlerRoomItem to handle a room item that does nothing.
91EA JP SoundsDoor Jump to SoundsDoor to make the sound of a door.
Prev: 91BC Up: Map Next: 91ED