Prev: 90FB Up: Map Next: 9147
9117: Enter Door
Used by the routines at HandlerDoorExit, HandlerDoorLocked and FallThroughTrapdoor.
Moves the player through the door that has been entered, to the room on the other side. The entity for the other half of the door is found with GetOtherDoorHalf. The room, the position, and the velocity of the player (from SetPlayerVelocity) are set from it. The player is flagged as being in a doorway (the bottom four bits of offset 02 are set), and this carries on into EnterRoom to draw the room.
Input
IX The entity of the door
EnterDoor 9117 CALL GetOtherDoorHalf Call GetOtherDoorHalf to point IX at the other half of the door.
911A LD A,(IX+$01) Fetch the room of the other half of the door.
911D LD ($EA91),A Update the room of the player in PlayerRoom.
9120 LD A,(IX+$02) Fetch offset 02 of the door.
9123 RLCA Rotate A left.
9124 AND %00011110 Keep only bits 1-4.
9126 ADD A,(IX+$03) Add the X position of the door.
9129 LD ($EA93),A Update the X position of the player.
912C LD A,(IX+$02) Fetch offset 02 of the door.
912F RRCA Rotate A right three times.
9130 RRCA
9131 RRCA
9132 AND %00011110 Keep only bits 1-4.
9134 NEG Make the offset negative.
9136 ADD A,(IX+$04) Add the Y position of the door.
9139 LD ($EA94),A Update the Y position of the player.
913C CALL SetPlayerVelocity Call SetPlayerVelocity to set the velocity of the player to move out of the door.
913F LD A,($EA92) Fetch offset 02 of the player.
9142 OR %00001111 Set bits 0-3.
9144 LD ($EA92),A Update offset 02 of the player.
Prev: 90FB Up: Map Next: 9147