Prev: AFEB Up: Map Next: B05E
B01F: Move Player To Room
Used by the routine at ChangeRoom.
Input
A Destination room ID
MovePlayerToRoom B01F LD C,A Load the destination room ID into C.
B020 LD A,($A7EE) Jump to SetNewCurrentRoomID if *Count_ScenicEvents is zero.
B023 AND A
B024 JR Z,SetNewCurrentRoomID
B026 LD B,A B=Count_ScenicEvents.
B027 LD HL,($A7E2) HL=*Pointer_ScenicEventLocations.
B02A JR FindScenicEvents Jump to FindScenicEvents.
FindScenicEvents_Loop B02C INC HL Increment the scenic event location pointer by one.
FindScenicEvents B02D LD A,(HL) Load the next scenic event location into A.
B02E CALL ValidateItemPresent Call ValidateItemPresent.
B031 JR NZ,FindScenicEvents_Next Jump to FindScenicEvents_Next if the scenic event is not at this location.
A scenic event matched this location!
B033 PUSH HL Stash the scenic event location pointer and scenic events counter on the stack.
B034 PUSH BC
B035 LD B,(HL) Load the current scenic event location into B.
B036 CALL Handler_UpdateItemLocation Call Handler_UpdateItemLocation.
B039 POP BC Restore the scenic events counter and scenic event location pointer from the stack.
B03A POP HL
FindScenicEvents_Next B03B DJNZ FindScenicEvents_Loop Decrease counter by one and loop back to FindScenicEvents_Loop until counter is zero.
Sets the destination room ID as the new current room ID.
SetNewCurrentRoomID B03D LD A,C Write C to *CurrentRoom.
B03E LD ($A7C3),A
B041 LD A,($A787) Return if *Flag_EventStates is zero.
B044 AND A
B045 RET Z
B046 LD B,$08 B=08.
B048 LD HL,$A788 HL=A788.
B04B LD C,A C=A.
B04C JR MovePlayerToRoom_1 Jump to MovePlayerToRoom_1.
MovePlayerToRoom_0 B04E INC HL Increment HL by one.
MovePlayerToRoom_1 B04F SRL C Shift C right.
B051 JR NC,MovePlayerToRoom_2 Jump to MovePlayerToRoom_2 if HL is greater than or equal to A.
B053 LD A,(HL) A=*HL.
B054 PUSH HL Stash HL and BC on the stack.
B055 PUSH BC
B056 CALL Handler_UpdateItemEventCurrentRoom Call Handler_UpdateItemEventCurrentRoom.
B059 POP BC Restore BC and HL from the stack.
B05A POP HL
MovePlayerToRoom_2 B05B DJNZ MovePlayerToRoom_0 Decrease counter by one and loop back to MovePlayerToRoom_0 until counter is zero.
B05D RET Return.
View the equivalent code in The Jewels Of Babylon.
Prev: AFEB Up: Map Next: B05E