Prev: C3F0 Up: Map Next: C426
C40B: Leave Room To The North
Sends the player to the room to the north if it has gone past the north edge of the room. The y position is set to FF, which PlacePlayerAtDoor takes as the sign that the player has come out of the north and puts it at the south side of the new room.
Input
HL Distances to the walls along x and y
IX The address of the object
Leave if past the north edge.
LeaveRoomToNorth C40B POP HL Restore HL from the stack.
C40C LD A,H Copy H to A.
C40D ADD A,$80 Add 80.
C40F LD H,A Copy it to H.
C410 LD A,(IX+$02) Fetch the y position of the player.
C413 ADD A,(IX+$0A) Add the speed along the y axis.
C416 SUB (IX+$05) Subtract the depth of the player.
C419 CP H Return if the player is still in the room.
C41A RET C
C41B LD (IX+$02),$FF Write FF to the y position.
C41F LD A,(IX+$08) Fetch the room number.
C422 ADD A,$10 Add 10.
C424 JR ChangeRoom Jump to ChangeRoom.
View the equivalent code in;
Prev: C3F0 Up: Map Next: C426