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 MovePlayerToRoom_Next to continue.
50224 LD A,(47872)
50227 LD B,A
50228 LD A,(47771)
50231 LD HL,47688
50234 JR MovePlayerToRoom_Next
MovePlayerToRoom_Loop 50236 INC HL Step to the next scenic entry.
MovePlayerToRoom_Next 50237 CP (HL) Jump to MovePlayerToRoom_ScenicNext unless this scenic entry watched the old room.
50238 JR NZ,MovePlayerToRoom_ScenicNext
50240 LD (HL),C Retarget this scenic entry to the new room.
MovePlayerToRoom_ScenicNext 50241 DJNZ MovePlayerToRoom_Loop Repeat from MovePlayerToRoom_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 MovePlayerToRoom_EventBit
MovePlayerToRoom_EventAdvance 50261 INC HL Step to the next event object.
MovePlayerToRoom_EventBit 50262 SRL C Skip this object when its event bit is clear.
50264 JR NC,MovePlayerToRoom_EventNext
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.
MovePlayerToRoom_EventNext 50272 DJNZ MovePlayerToRoom_EventAdvance Repeat from MovePlayerToRoom_EventAdvance for the remaining event bits.
MovePlayerToRoom_Return 50274 RET Return.
View the equivalent code in;
Prev: 50170 Up: Map Next: 50275