![]() |
Routines |
| Prev: 44168 | Up: Map | Next: 44284 |
|
Used by the routine at ChangeRoom.
|
||||||||
| MovePlayerToRoom | 44221 | LD C,A | Load the destination room ID into C. | |||||
| 44222 | LD A,(48079) | Jump to MovePlayerToRoom_0 if *Count_ScenicEvents is zero. | ||||||
| 44225 | AND A | |||||||
| 44226 | JR Z,MovePlayerToRoom_0 | |||||||
|
Scenic events that are present come with the player to the destination room.
|
||||||||
| 44228 | LD B,A | The scenic items are listed at Table_ScenicEventLocations2. | ||||||
| 44229 | LD HL,46778 | |||||||
| 44232 | JR ScenicItem_Next | |||||||
| ScenicItem_Advance | 44234 | INC HL | The next scenic item. | |||||
| ScenicItem_Next | 44235 | LD A,(HL) | Its item id. | |||||
| 44236 | CALL ValidateItemPresent | Call ValidateItemPresent. | ||||||
| 44239 | JR NZ,ScenicItem_Count | It is not coming with the player. | ||||||
| 44241 | PUSH HL | This scenic item, and the destination room. | ||||||
| 44242 | PUSH BC | |||||||
| 44243 | LD B,(HL) | |||||||
| 44244 | CALL Handler_UpdateItemLocation | Call Handler_UpdateItemLocation. | ||||||
| 44247 | POP BC | Restore the scenic scan from the stack. | ||||||
| 44248 | POP HL | |||||||
| ScenicItem_Count | 44249 | DJNZ ScenicItem_Advance | On to the next scenic item. | |||||
|
The destination room is now the current room.
|
||||||||
| MovePlayerToRoom_0 | 44251 | LD A,C | Remember it at CurrentRoom and read the event flags. | |||||
| 44252 | LD (41222),A | |||||||
| 44255 | LD A,(41169) | |||||||
| 44258 | AND A | |||||||
|
No event flag is set, so the move is finished.
|
||||||||
| 44259 | RET Z | Return. | ||||||
|
For each set bit in Flags_EventStates, bring the corresponding byte from Data_PhraseTokens into the room.
|
||||||||
| 44260 | LD B,8 | Eight event bits, and the items at Data_PhraseTokens. | ||||||
| 44262 | LD HL,46836 | |||||||
| 44265 | LD C,A | |||||||
| 44266 | JR EventFlag_Next | |||||||
| EventFlag_Advance | 44268 | INC HL | The next event. | |||||
| EventFlag_Next | 44269 | SRL C | This event is not following the player. | |||||
| 44271 | JR NC,EventFlag_Count | |||||||
| 44273 | LD A,(HL) | This event's item. | ||||||
| 44274 | PUSH HL | |||||||
| 44275 | PUSH BC | |||||||
| 44276 | CALL Handler_UpdateItemEventCurrentRoom | Call Handler_UpdateItemEventCurrentRoom. | ||||||
| 44279 | POP BC | Restore the event scan from the stack. | ||||||
| 44280 | POP HL | |||||||
| EventFlag_Count | 44281 | DJNZ EventFlag_Advance | The remaining event bits. | |||||
|
The move is complete.
|
||||||||
| 44283 | RET | Return. | ||||||
|
View the equivalent code in;
|
||||||||
| Prev: 44168 | Up: Map | Next: 44284 |