Prev: CB0E Up: Map Next: CB45
CB29: 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 00, 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 CB29 POP HL Unstack the size of the room in X and Y.
Work out the coordinate of the south edge of the room.
CB2A LD A,$80 Set A to 80.
CB2C SUB H Subtract H.
CB2D LD H,A Copy it to H.
Add the speed in Y and the depth of the player to the Y coordinate.
CB2E LD A,(IX+$02) Fetch the y position of the player.
CB31 ADD A,(IX+$0A) Add the speed along the y axis.
CB34 ADD A,(IX+$05) Add the depth of the player.
Compare it with the south edge.
CB37 CP H Return if the player is still in the room.
CB38 RET NC
CB39 LD (IX+$02),$00 Write 00 to the y position.
Fetch the room number and take 10 off it to go to the room to the south.
CB3D LD A,(IX+$08) Fetch the room number.
CB40 SUB $10 Subtract 10.
CB42 JP ChangeRoom Jump to ChangeRoom.
View the equivalent code in;
Prev: CB0E Up: Map Next: CB45