Prev: AD78 Up: Map Next: ADA1
AD79: Change Room
Used by the routines at MovePlayer, Action_GoToRoom and GameStart.
Commits a move into the destination room held in A. It stashes the room in TemporaryRoom, runs the pre-move script at Data_ArrivalScript, abandons the move when flag bit 00 says the player is dead, then calls MovePlayerToRoom, describes the room, and runs the post-move script at Data_RoomSetupScript.
Input
A Destination room ID
Remember the destination and run the pre-move script.
ChangeRoom AD79 LD ($AD78),A Store the destination room ID at TemporaryRoom.
AD7C PUSH IX Stash IX on the stack.
AD7E LD IX,$BBD8 Point IX at the pre-move script at Data_ArrivalScript.
AD82 CALL Handler_RunScript Call Handler_RunScript to run that script.
Abort the move when flag bit 00 (player dead) is set.
AD85 LD A,$00 Load flag bit 00 into A.
AD87 CALL TestFlag Call TestFlag to test that flag bit.
AD8A JR NZ,ChangeRoom_Return Jump to ChangeRoom_Return if the player is dead.
Enter the room, describe it, and run the post-move script.
AD8C LD A,($AD78) Fetch the destination room ID from *TemporaryRoom into A.
AD8F CALL MovePlayerToRoom Call MovePlayerToRoom to move the player into that room.
AD92 LD E,$00 Set E to 00 so the room picture is not forced.
AD94 CALL Handler_RoomExits Call Handler_RoomExits to describe the current room.
AD97 LD IX,$BC4C Point IX at the post-move script at Data_RoomSetupScript.
AD9B CALL Handler_RunScript Call Handler_RunScript to run that script.
ChangeRoom_Return AD9E POP IX Restore IX from the stack.
ADA0 RET Return.
Prev: AD78 Up: Map Next: ADA1