Prev: 51982 Up: Map Next: 52037
52009: Leave Room To The South
Sends the player to the room to the south if it has gone past the south edge of the room. The y position is set to 0, which PlacePlayerAtDoor takes as the sign that the player has come out of the south and puts it at the north 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 south edge.
LeaveRoomToSouth 52009 POP HL Unstack the size of the room in X and Y.
Work out the coordinate of the south edge of the room.
52010 LD A,128 Set A to 128.
52012 SUB H Subtract H.
52013 LD H,A Copy it to H.
Add the speed in Y and the depth of the player to the Y coordinate.
52014 LD A,(IX+2) Fetch the y position of the player.
52017 ADD A,(IX+10) Add the speed along the y axis.
52020 ADD A,(IX+5) Add the depth of the player.
Compare it with the south edge.
52023 CP H Return if the player is still in the room.
52024 RET NC
52025 LD (IX+2),0 Write 0 to the y position.
Fetch the room number and take 16 off it to go to the room to the south.
52029 LD A,(IX+8) Fetch the room number.
52032 SUB 16 Subtract 16.
52034 JP ChangeRoom Jump to ChangeRoom.
View the equivalent code in;
Prev: 51982 Up: Map Next: 52037