Prev: 37115 Up: Map Next: 37191
37143: 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 2 are set), and this carries on into EnterRoom to draw the room.
Input
IX The entity of the door
EnterDoor 37143 CALL GetOtherDoorHalf Call GetOtherDoorHalf to point IX at the other half of the door.
37146 LD A,(IX+1) Fetch the room of the other half of the door.
37149 LD (60049),A Update the room of the player in PlayerRoom.
37152 LD A,(IX+2) Fetch offset 2 of the door.
37155 RLCA Rotate A left.
37156 AND %00011110 Keep only bits 1-4.
37158 ADD A,(IX+3) Add the X position of the door.
37161 LD (60051),A Update the X position of the player.
37164 LD A,(IX+2) Fetch offset 2 of the door.
37167 RRCA Rotate A right three times.
37168 RRCA
37169 RRCA
37170 AND %00011110 Keep only bits 1-4.
37172 NEG Make the offset negative.
37174 ADD A,(IX+4) Add the Y position of the door.
37177 LD (60052),A Update the Y position of the player.
37180 CALL SetPlayerVelocity Call SetPlayerVelocity to set the velocity of the player to move out of the door.
37183 LD A,(60050) Fetch offset 2 of the player.
37186 OR %00001111 Set bits 0-3.
37188 LD (60050),A Update offset 2 of the player.
Prev: 37115 Up: Map Next: 37191