Prev: 54342 Up: Map Next: 54414
54363: Update Collectibles
Used by the routine at Update_Miscellaneous_Entities.
Update Collectibles against the complex entity table at StateData_Boney.
Update_Collectibles 54363 LD HL,29407 Point HL at collectible slot state (CollectibleSlotState).
54366 LD IX,36767 Point IX at an inactive complex-entity slot (StateData_Complex_13).
54370 LD B,3 Load B with 3 as a loop counter.
For each collectible slot: reload its script cursor / counter, run Collect_Entity, then save them back.
Update_Collectibles_Scan 54372 PUSH BC Stash BC on the stack.
54373 LD C,(HL) Fetch the word at HL into BC.
54374 INC HL
54375 LD B,(HL)
54376 INC HL Advance CollectibleSlotState by one byte.
54377 LD A,(HL) Fetch the next byte from CollectibleSlotState.
54378 LD (29372),A Set the collectible counter (CollectibleCounter).
54381 LD (29391),BC Store BC in the active script cursor (Pointer_ActiveScriptCursor).
54385 PUSH HL Stash HL on the stack.
54386 CALL Collect_Entity Call Collect_Entity to collect Entity.
54389 POP HL Restore HL from the stack.
54390 LD A,(29372) Load A with the collectible counter (CollectibleCounter).
54393 LD (HL),A Write collectible counter through CollectibleSlotState.
54394 DEC HL Step CollectibleSlotState back by one byte.
54395 LD BC,(29391) Load BC with the active script cursor (Pointer_ActiveScriptCursor).
54399 LD (HL),B Write the loop counter through the pointer in HL.
54400 DEC HL Step CollectibleSlotState back by one byte.
54401 LD (HL),C Write the saved count in C through the pointer in HL.
54402 INC HL Advance HL onto the next collectible slot record.
54403 INC HL
54404 INC HL
54405 LD BC,14 Each entity record is 0014 bytes long, then load that length into BC.
54408 ADD IX,BC Advance IX to the next entity record.
54410 POP BC Restore BC from the stack.
54411 DJNZ Update_Collectibles_Scan Decrease the loop counter in B and jump to Update_Collectibles_Scan if more iterations remain.
54413 RET Return.
Prev: 54342 Up: Map Next: 54414