![]()  | 
Routines | 
| Prev: 45035 | Up: Map | Next: 45150 | 
| 
 
Used by the routine at ChangeRoom.
 
  | 
||||||||
| MovePlayerToRoom | 45087 | LD C,A | Load the destination room ID into C. | |||||
| 45088 | LD A,(42990) | Jump to SetNewCurrentRoomID if *Count_ScenicEvents is zero. | ||||||
| 45091 | AND A | |||||||
| 45092 | JR Z,SetNewCurrentRoomID | |||||||
| 45094 | LD B,A | B=Count_ScenicEvents. | ||||||
| 45095 | LD HL,(42978) | HL=*Pointer_ScenicEventLocations. | ||||||
| 45098 | JR FindScenicEvents | Jump to FindScenicEvents. | ||||||
| FindScenicEvents_Loop | 45100 | INC HL | Increment the scenic event location pointer by one. | |||||
| FindScenicEvents | 45101 | LD A,(HL) | Load the next scenic event location into A. | |||||
| 45102 | CALL ValidateItemPresent | Call ValidateItemPresent. | ||||||
| 45105 | JR NZ,FindScenicEvents_Next | Jump to FindScenicEvents_Next if the scenic event is not at this location. | ||||||
| 
 
A scenic event matched this location!
 
 | 
||||||||
| 45107 | PUSH HL | Stash the scenic event location pointer and scenic events counter on the stack. | ||||||
| 45108 | PUSH BC | |||||||
| 45109 | LD B,(HL) | Load the current scenic event location into B. | ||||||
| 45110 | CALL Handler_UpdateItemLocation | Call Handler_UpdateItemLocation. | ||||||
| 45113 | POP BC | Restore the scenic events counter and scenic event location pointer from the stack. | ||||||
| 45114 | POP HL | |||||||
| FindScenicEvents_Next | 45115 | 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 | 45117 | LD A,C | Write C to *CurrentRoom. | |||||
| 45118 | LD (42947),A | |||||||
| 45121 | LD A,(42887) | Return if *Flag_EventStates is zero. | ||||||
| 45124 | AND A | |||||||
| 45125 | RET Z | |||||||
| 45126 | LD B,8 | B=8. | ||||||
| 45128 | LD HL,42888 | HL=42888. | ||||||
| 45131 | LD C,A | C=A. | ||||||
| 45132 | JR MovePlayerToRoom_1 | Jump to MovePlayerToRoom_1. | ||||||
| MovePlayerToRoom_0 | 45134 | INC HL | Increment HL by one. | |||||
| MovePlayerToRoom_1 | 45135 | SRL C | Shift C right. | |||||
| 45137 | JR NC,MovePlayerToRoom_2 | Jump to MovePlayerToRoom_2 if HL is greater than or equal to A. | ||||||
| 45139 | LD A,(HL) | A=*HL. | ||||||
| 45140 | PUSH HL | Stash HL and BC on the stack. | ||||||
| 45141 | PUSH BC | |||||||
| 45142 | CALL Handler_UpdateItemEventCurrentRoom | Call Handler_UpdateItemEventCurrentRoom. | ||||||
| 45145 | POP BC | Restore BC and HL from the stack. | ||||||
| 45146 | POP HL | |||||||
| MovePlayerToRoom_2 | 45147 | DJNZ MovePlayerToRoom_0 | Decrease counter by one and loop back to MovePlayerToRoom_0 until counter is zero. | |||||
| 45149 | RET | Return. | ||||||
| 
 
View the equivalent code in The Jewels Of Babylon.
 
 | 
||||||||
| Prev: 45035 | Up: Map | Next: 45150 |