Prev: 42703 Up: Map Next: 42749
42728: Move Player
Used by the routine at 43953.
The data in Table_RoomMap is stored in a particular order for each room:
Offset Exit To Room
0 North
1 South
2 East
3 West
4 Up
5 Down
This is how the movement works; taking the current room from the map - we add a "movement value" (e.g. "East" which is 2) - this then points to data in the table which correlates to either a room number for the exit, or 0 to indicate there is no exit in that direction.
Input
C A movement "value" from the action
MovePlayer 42728 LD B,0 Initialise B with 0 so the movement value is now in BC.
42730 CALL GetRoomPointer Call GetRoomPointer.
HL now holds a pointer to the room data for the current room at Table_RoomMap.
42733 ADD HL,BC Add the movement value to HL.
42734 LD A,(HL) Fetch the entry from *HL and store it in A.
42735 OR A Jump to Response_YouCantGoInThatDirection if there is no exit at the requested memory location.
42736 JR Z,Response_YouCantGoInThatDirection
42738 CALL ChangeRoom Call ChangeRoom.
42741 RET Return.
Print "You can't go in that direction.".
Response_YouCantGoInThatDirection 42742 LD HL,34 HL=Messaging_YouCantGoInThatDirection.
42745 CALL PrintCompressedStringAndNewline Call PrintCompressedStringAndNewline.
42748 RET Return.
Prev: 42703 Up: Map Next: 42749