Prev: CAA7 Up: Map Next: CAF0
CAC4: Update Task Four Entity State
Used by the routine at Update_Task_Four_Entities.
Advance task-four entity scripts and start/stop the entity when game event flags at GameEventFlags change.
Update_TaskFourEntityState CAC4 LD A,($72B3) Load A with the game event flags (GameEventFlags).
CAC7 BIT 7,A Is bit 07 of game event flags set? If so, jump to AdvanceScriptInstruction.
CAC9 JP NZ,AdvanceScriptInstruction
CACC BIT 7,(IX+$00) Is bit 07 of the current entity's entity type set? If so, jump to Update_TaskFour_StopEntity.
CAD0 JR NZ,Update_TaskFour_StopEntity
CAD2 BIT 1,A Is bit 01 of game event flags set? If so, jump to AdvanceScriptInstruction.
CAD4 JP NZ,AdvanceScriptInstruction
This entry point is used by the routine at ScriptRoutine_TaskFourClearScriptFlags.
Shared entry used by script routine ScriptRoutine_TaskFourClearScriptFlags to start the task-four entity script.
Update_TaskFour_StartEntity CAD7 SET 7,(IX+$00) Set bit 07 of the current entity's entity type.
CADB XOR A Clear the current task phase (idle).
CADC LD ($72AF),A Set the current task phase (CurrentTaskPhase).
CADF LD HL,$CA23 Point HL at task-four script Data_TaskFourScript.
CAE2 LD ($72CF),HL Store HL in the active script cursor (Pointer_ActiveScriptCursor).
CAE5 RET Return.
Stop the task-four entity when game-event bit 01 is set: clear type bit 07 and continue the script.
Update_TaskFour_StopEntity CAE6 BIT 1,A Is bit 01 of game event flags set? If not, return.
CAE8 RET Z
CAE9 RES 7,(IX+$00) Reset bit 07 of the current entity's entity type.
CAED JP AdvanceScriptInstruction Jump to AdvanceScriptInstruction to run the next script instruction.
Prev: CAA7 Up: Map Next: CAF0