Prev: 38672 Up: Map Next: 38772
38705: Fall Through Trapdoor
Used by the routine at HandlerTrapOpen.
Used by HandlerTrapOpen for a trapdoor that is open. If the player is in range of the trapdoor (24 in each direction), the screen is cleared and the frame of room 150 is drawn. Then for 128 frames of rings of colour (see RippleAttributes) spread out from the centre of the screen, while the centre flashes and clicks are made. Then the player goes through the door with EnterDoor. If the player is not in range then the trapdoor is just shown by HandlerRoomItem.
Input
IX The trapdoor entity
FallThroughTrapdoor 38705 LD BC,6168 BC=6168 (the range of the trapdoor).
38708 CALL CheckPlayerInRange Call CheckPlayerInRange to see whether the player is in range.
38711 JP NC,HandlerRoomItem Jump to HandlerRoomItem if the player is not.
38714 CALL ClearPlayArea Call ClearPlayArea to clear the play area.
38717 LD A,150 A=150 (the room to draw the frame of).
38719 PUSH IX Stash IX on the stack.
38721 CALL DrawRoomFrame_Room Call DrawRoomFrame_Room to draw the frame of the room.
38724 POP IX Restore IX from the stack.
38726 LD B,128 B=128 (the number of frames to fall for, which also sets the pitch of the clicks).
FallThroughTrapdoor_Loop 38728 LD A,(23672) Fetch FRAMES and keep FRAMES in C.
38731 LD C,A
Make clicks until FRAMES has changed.
FallThroughTrapdoor_Wait 38732 PUSH BC Stash the fall counter and FRAMES on the stack.
38733 LD A,B Fetch the fall counter.
38734 CPL Flip the bits of the fall counter.
38735 LD B,A Keep the pitch of the click in B.
38736 CALL SoundsClick Call SoundsClick to make a click.
38739 POP BC Restore the fall counter and FRAMES from the stack.
38740 LD A,(23672) Fetch FRAMES.
38743 CP C Jump to FallThroughTrapdoor_Wait if FRAMES has not changed.
38744 JR Z,FallThroughTrapdoor_Wait
Flash the centre of the screen on every eighth frame.
38746 AND %00000111 Keep only bits 0-2.
38748 LD A,0 A=0 (the attribute for black).
38750 JR NZ,FallThroughTrapdoor_Flash Jump to FallThroughTrapdoor_Flash if FRAMES is not a multiple of eight.
38752 LD A,71 A=71 (the attribute for bright white ink on black).
FallThroughTrapdoor_Flash 38754 LD L,A Keep the attribute in L.
38755 LD H,A Keep the attribute in H.
38756 LD (22891),HL Write the attribute to the two cells at 22891.
38759 LD (22923),HL Write the attribute to the two cells at 22923.
38762 PUSH BC Stash the fall counter on the stack.
38763 CALL RippleAttributes Call RippleAttributes to spread the colours out.
38766 POP BC Restore the fall counter from the stack.
38767 DJNZ FallThroughTrapdoor_Loop Decrease the fall counter by one and loop back to FallThroughTrapdoor_Loop until the fall has finished.
38769 JP EnterDoor Jump to EnterDoor to enter the door.
Prev: 38672 Up: Map Next: 38772