![]() |
Routines |
| Prev: AC88 | Up: Map | Next: ACFC |
|
Used by the routine at ChangeRoom.
|
||||||||
| MovePlayerToRoom | ACBD | LD C,A | Load the destination room ID into C. | |||||
| ACBE | LD A,($BBCF) | Jump to MovePlayerToRoom_0 if *Count_ScenicEvents is zero. | ||||||
| ACC1 | AND A | |||||||
| ACC2 | JR Z,MovePlayerToRoom_0 | |||||||
|
Scenic events that are present come with the player to the destination room.
|
||||||||
| ACC4 | LD B,A | The scenic items are listed at Table_ScenicEventLocations2. | ||||||
| ACC5 | LD HL,$B6BA | |||||||
| ACC8 | JR ScenicItem_Next | |||||||
| ScenicItem_Advance | ACCA | INC HL | The next scenic item. | |||||
| ScenicItem_Next | ACCB | LD A,(HL) | Its item id. | |||||
| ACCC | CALL ValidateItemPresent | Call ValidateItemPresent. | ||||||
| ACCF | JR NZ,ScenicItem_Count | It is not coming with the player. | ||||||
| ACD1 | PUSH HL | This scenic item, and the destination room. | ||||||
| ACD2 | PUSH BC | |||||||
| ACD3 | LD B,(HL) | |||||||
| ACD4 | CALL Handler_UpdateItemLocation | Call Handler_UpdateItemLocation. | ||||||
| ACD7 | POP BC | Restore the scenic scan from the stack. | ||||||
| ACD8 | POP HL | |||||||
| ScenicItem_Count | ACD9 | DJNZ ScenicItem_Advance | On to the next scenic item. | |||||
|
The destination room is now the current room.
|
||||||||
| MovePlayerToRoom_0 | ACDB | LD A,C | Remember it at CurrentRoom and read the event flags. | |||||
| ACDC | LD ($A106),A | |||||||
| ACDF | LD A,($A0D1) | |||||||
| ACE2 | AND A | |||||||
|
No event flag is set, so the move is finished.
|
||||||||
| ACE3 | RET Z | Return. | ||||||
|
For each set bit in Flags_EventStates, bring the corresponding byte from Data_PhraseTokens into the room.
|
||||||||
| ACE4 | LD B,$08 | Eight event bits, and the items at Data_PhraseTokens. | ||||||
| ACE6 | LD HL,$B6F4 | |||||||
| ACE9 | LD C,A | |||||||
| ACEA | JR EventFlag_Next | |||||||
| EventFlag_Advance | ACEC | INC HL | The next event. | |||||
| EventFlag_Next | ACED | SRL C | This event is not following the player. | |||||
| ACEF | JR NC,EventFlag_Count | |||||||
| ACF1 | LD A,(HL) | This event's item. | ||||||
| ACF2 | PUSH HL | |||||||
| ACF3 | PUSH BC | |||||||
| ACF4 | CALL Handler_UpdateItemEventCurrentRoom | Call Handler_UpdateItemEventCurrentRoom. | ||||||
| ACF7 | POP BC | Restore the event scan from the stack. | ||||||
| ACF8 | POP HL | |||||||
| EventFlag_Count | ACF9 | DJNZ EventFlag_Advance | The remaining event bits. | |||||
|
The move is complete.
|
||||||||
| ACFB | RET | Return. | ||||||
|
View the equivalent code in;
|
||||||||
| Prev: AC88 | Up: Map | Next: ACFC |