Prev: 50170 Up: Map Next: 50275
50223: Move Player To Room
Used by the routines at Handler_InjuryCheck and Action_Blow.
Move the player to the given room and retarget any scenic events that watched the old room.
MovePlayerToRoom 50223 LD C,A Read the current room and the scenic list. Jump to FindScenicEvents to continue.
50224 LD A,(47872)
50227 LD B,A
50228 LD A,(47771)
50231 LD HL,47688
50234 JR FindScenicEvents
FindScenicEvents_Loop 50236 INC HL Step to the next scenic entry.
FindScenicEvents 50237 CP (HL) Jump to FindScenicEvents_Next unless this scenic entry watched the old room.
50238 JR NZ,FindScenicEvents_Next
50240 LD (HL),C Retarget this scenic entry to the new room.
FindScenicEvents_Next 50241 DJNZ FindScenicEvents_Loop Repeat from FindScenicEvents_Loop for the remaining scenic entries.
50243 LD A,C Remember the new room. Return when no event bits are set.
50244 LD (47771),A
50247 LD A,(47679)
50250 AND A
50251 JR Z,MovePlayerToRoom_Return
50253 LD B,8 Take the eight event bits and the objects they summon.
50255 LD HL,47680
50258 LD C,A
50259 JR FollowingItems_CheckBit
FollowingItems_Loop 50261 INC HL Step to the next event object.
FollowingItems_CheckBit 50262 SRL C Skip this object when its event bit is clear.
50264 JR NC,FollowingItems_Next
50266 LD A,(HL) Call Handler_UpdateItemForTheCurrentRoom to move that event's object into this room.
50267 EXX
50268 CALL Handler_UpdateItemForTheCurrentRoom
50271 EXX Switch back to the event scan.
FollowingItems_Next 50272 DJNZ FollowingItems_Loop Repeat from FollowingItems_Loop for the remaining event bits.
MovePlayerToRoom_Return 50274 RET Return.
Prev: 50170 Up: Map Next: 50275