![]() |
Routines |
| Prev: D446 | Up: Map | Next: D48E |
|
Used by the routine at Update_Miscellaneous_Entities.
Update Collectibles against the complex entity table at StateData_Boney.
|
||||
| Update_Collectibles | D45B | LD HL,$72DF | Point HL at collectible slot state (CollectibleSlotState). | |
| D45E | LD IX,$8F9F | Point IX at an inactive complex-entity slot (StateData_Complex_13). | ||
| D462 | LD B,$03 | Load B with 03 as a loop counter. | ||
|
For each collectible slot: reload its script cursor / counter, run Collect_Entity, then save them back.
|
||||
| Update_Collectibles_Scan | D464 | PUSH BC | Stash BC on the stack. | |
| D465 | LD C,(HL) | Fetch the word at HL into BC. | ||
| D466 | INC HL | |||
| D467 | LD B,(HL) | |||
| D468 | INC HL | Advance CollectibleSlotState by one byte. | ||
| D469 | LD A,(HL) | Fetch the next byte from CollectibleSlotState. | ||
| D46A | LD ($72BC),A | Set the collectible counter (CollectibleCounter). | ||
| D46D | LD ($72CF),BC | Store BC in the active script cursor (Pointer_ActiveScriptCursor). | ||
| D471 | PUSH HL | Stash HL on the stack. | ||
| D472 | CALL Collect_Entity | Call Collect_Entity to collect Entity. | ||
| D475 | POP HL | Restore HL from the stack. | ||
| D476 | LD A,($72BC) | Load A with the collectible counter (CollectibleCounter). | ||
| D479 | LD (HL),A | Write collectible counter through CollectibleSlotState. | ||
| D47A | DEC HL | Step CollectibleSlotState back by one byte. | ||
| D47B | LD BC,($72CF) | Load BC with the active script cursor (Pointer_ActiveScriptCursor). | ||
| D47F | LD (HL),B | Write the loop counter through the pointer in HL. | ||
| D480 | DEC HL | Step CollectibleSlotState back by one byte. | ||
| D481 | LD (HL),C | Write the saved count in C through the pointer in HL. | ||
| D482 | INC HL | Advance HL onto the next collectible slot record. | ||
| D483 | INC HL | |||
| D484 | INC HL | |||
| D485 | LD BC,$000E | Each entity record is 000E bytes long, then load that length into BC. | ||
| D488 | ADD IX,BC | Advance IX to the next entity record. | ||
| D48A | POP BC | Restore BC from the stack. | ||
| D48B | DJNZ Update_Collectibles_Scan | Decrease the loop counter in B and jump to Update_Collectibles_Scan if more iterations remain. | ||
| D48D | RET | Return. | ||
| Prev: D446 | Up: Map | Next: D48E |