Prev: 49897 Up: Map Next: 50098
50040: 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 50040 CALL Update_Task_Three_Helpers Call Update_Task_Three_Helpers to update the task-three helpers.
50043 LD A,(29379) Load A with the task-three timer (TaskThreeTimer).
50046 OR A Is the task-three timer zero? If so, skip the divider at Update_Task_Three_Entities_RunStateMachine.
50047 JR Z,Update_Task_Three_Entities_RunStateMachine
50049 LD HL,49893 Point HL at the task-three frame divider (49893).
50052 DEC (HL) Decrease the frame divider. if it is still non-zero, skip to Update_Task_Three_Entities_RunStateMachine.
50053 JR NZ,Update_Task_Three_Entities_RunStateMachine
50055 LD (HL),4 Reload the frame divider with 4.
50057 DEC A Step the task-three timer (TaskThreeTimer) back by one.
50058 LD (29379),A
50061 CP 10 Is the task-three timer less than 10? If not, skip to Update_Task_Three_Entities_RunStateMachine.
50063 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 5 of the task-three flags.
50065 LD HL,40861 Point HL at the cauldron layout (GraphicLayout_Cauldron).
50068 LD (36973),HL Write that layout into the graphic-layout field of StateData_Complex_27 (36973).
50071 LD HL,29366 Point HL at the task-three flags (TaskThreeFlags).
50074 RES 5,(HL) Clear bit 5 of the task-three flags.
Run the task-three entity state machine while the phase is 3.
Update_Task_Three_Entities_RunStateMachine 50076 LD A,(29359) Load A with the current task phase (CurrentTaskPhase).
50079 CP 3 Is the current task phase equal to 3? If not, return.
50081 RET NZ
50082 LD HL,(29393) Copy the task-three script position (Pointer_TaskThreeScriptPosition) into the temporary script-position pointer (Pointer_ActiveScriptCursor).
50085 LD (29391),HL
50088 CALL Update_Task_Three_Entity_State Call Update_Task_Three_Entity_State to update the task-three entity state.
50091 LD HL,(29391) Write the active script cursor (Pointer_ActiveScriptCursor) back to Pointer_TaskThreeScriptPosition.
50094 LD (29393),HL
50097 RET Return.
Prev: 49897 Up: Map Next: 50098