Prev: F8DD Up: Map Next: F8F2
F8DF: Move Player
Used by the routines at Action_North, Action_South, Action_East, Action_West and Action_Up.
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 F8DF CALL Parser_ValidateNoDirectObject Call Parser_ValidateNoDirectObject.
Directional commands can only be called on their own.
Other commands like "GO" and "SWIM" are just treated like aliases, where the second token (the direction) is shunted down to being the first token, and the second token is then just erased: RemoveUserInput_Token_1.
F8E2 RET C Return if there's any token set in UserInput_Token_2.
F8E3 LD B,$00 Initialise B with 00 so the movement value is now in BC.
F8E5 CALL GetRoomPointer Call GetRoomPointer.
HL now holds a pointer to the room data for the current room at Table_RoomMap.
F8E8 ADD HL,BC Add the movement value to HL.
F8E9 LD A,(HL) Fetch the entry from *HL and store it in A.
F8EA OR A Jump to Response_YouCantGoInThatDirection if there is no exit at the requested memory location.
F8EB JP Z,Response_YouCantGoInThatDirection
F8EE CALL $EB10 Call EB10.
F8F1 RET Return.
Prev: F8DD Up: Map Next: F8F2