Prev: A6CF Up: Map Next: A6FD
A6E8: Move Player
Used by the routine at ABB1.
The data in Table_RoomMap is stored in a particular order for each room:
Offset Exit To Room
00 North
01 South
02 East
03 West
04 Up
05 Down
This is how the movement works; taking the current room from the map - we add a "movement value" (e.g. "East" which is 02) - this then points to data in the table which correlates to either a room number for the exit, or 00 to indicate there is no exit in that direction.
Input
C A movement "value" from the action
MovePlayer A6E8 LD B,$00 Initialise B with 00 so the movement value is now in BC.
A6EA CALL GetRoomPointer Call GetRoomPointer.
HL now holds a pointer to the room data for the current room at Table_RoomMap.
A6ED ADD HL,BC Add the movement value to HL.
A6EE LD A,(HL) Fetch the entry from *HL and store it in A.
A6EF OR A Jump to Response_YouCantGoInThatDirection if there is no exit at the requested memory location.
A6F0 JR Z,Response_YouCantGoInThatDirection
A6F2 CALL ChangeRoom Call ChangeRoom.
A6F5 RET Return.
Print "You can't go in that direction.".
Response_YouCantGoInThatDirection A6F6 LD HL,$0022 HL=Messaging_YouCantGoInThatDirection.
A6F9 CALL PrintCompressedStringAndNewline Call PrintCompressedStringAndNewline.
A6FC RET Return.
Prev: A6CF Up: Map Next: A6FD