Prev: CAF3 Up: Map Next: CB29
CB0E: 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 CB0E POP HL Unstack the size of the room in X and Y.
Work out the coordinate of the north edge of the room.
CB0F LD A,H Copy H to A.
CB10 ADD A,$80 Add 80.
CB12 LD H,A Copy it to H.
Add the speed in Y to the Y coordinate, and take the depth of the player off it.
CB13 LD A,(IX+$02) Fetch the y position of the player.
CB16 ADD A,(IX+$0A) Add the speed along the y axis.
CB19 SUB (IX+$05) Subtract the depth of the player.
Compare it with the north edge.
CB1C CP H Return if the player is still in the room.
CB1D RET C
CB1E LD (IX+$02),$FF Write FF to the y position.
Fetch the room number and add 10 to go to the room to the north.
CB22 LD A,(IX+$08) Fetch the room number.
CB25 ADD A,$10 Add 10.
CB27 JR ChangeRoom Jump to ChangeRoom.
View the equivalent code in;
Prev: CAF3 Up: Map Next: CB29