Prev: C2E9 Up: Map Next: C3B2
C378: Update Task Three Entities
Used by the routine at GameStart.
Once per frame while task three is active: tick the task-three timers, refresh the cauldron layout when the frame divider hits zero, and run the task-three entity state machine at Update_Task_Three_Entity_State.
Tick the task-three frame divider and timer.
Update_Task_Three_Entities C378 CALL Update_Task_Three_Helpers Call Update_Task_Three_Helpers to update the task-three helpers.
C37B LD A,($72C3) Load A with the task-three timer (TaskThreeTimer).
C37E OR A Is the task-three timer zero? If so, skip the divider at Update_Task_Three_Entities_RunStateMachine.
C37F JR Z,Update_Task_Three_Entities_RunStateMachine
C381 LD HL,$C2E5 Point HL at the task-three frame divider (C2E5).
C384 DEC (HL) Decrease the frame divider. if it is still non-zero, skip to Update_Task_Three_Entities_RunStateMachine.
C385 JR NZ,Update_Task_Three_Entities_RunStateMachine
C387 LD (HL),$04 Reload the frame divider with 04.
C389 DEC A Step the task-three timer (TaskThreeTimer) back by one.
C38A LD ($72C3),A
C38D CP $0A Is the task-three timer less than 0A? If not, skip to Update_Task_Three_Entities_RunStateMachine.
C38F JR NC,Update_Task_Three_Entities_RunStateMachine
When the timer is in the low band, point the cauldron at layout GraphicLayout_Cauldron and clear bit 05 of the task-three flags.
C391 LD HL,$9F9D Point HL at the cauldron layout (GraphicLayout_Cauldron).
C394 LD ($906D),HL Write that layout into the graphic-layout field of StateData_Complex_27 (906D).
C397 LD HL,$72B6 Point HL at the task-three flags (TaskThreeFlags).
C39A RES 5,(HL) Clear bit 05 of the task-three flags.
Run the task-three entity state machine while the phase is 03.
Update_Task_Three_Entities_RunStateMachine C39C LD A,($72AF) Load A with the current task phase (CurrentTaskPhase).
C39F CP $03 Is the current task phase equal to 03? If not, return.
C3A1 RET NZ
C3A2 LD HL,($72D1) Copy the task-three script position (Pointer_TaskThreeScriptPosition) into the temporary script-position pointer (Pointer_ActiveScriptCursor).
C3A5 LD ($72CF),HL
C3A8 CALL Update_Task_Three_Entity_State Call Update_Task_Three_Entity_State to update the task-three entity state.
C3AB LD HL,($72CF) Write the active script cursor (Pointer_ActiveScriptCursor) back to Pointer_TaskThreeScriptPosition.
C3AE LD ($72D1),HL
C3B1 RET Return.
Prev: C2E9 Up: Map Next: C3B2