Prev: AF3C Up: Map Next: AFA9
AF7F: Check Task Completion
Used by the routine at GameStart.
Check Task Completion for the current Thing Upstairs task.
Check_Task_Completion AF7F LD A,($72AE) Load A with the current task index (CurrentTaskIndex).
AF82 CP $05 Is current task index equal to 05? If not, return.
AF84 RET NZ
AF85 LD A,($72B4) Load A with the task status flags (TaskStatusFlags).
AF88 BIT 7,A Is bit 07 of task status flags set? If so, return.
AF8A RET NZ
AF8B LD HL,$8EE9 Point HL at Boney's complex entity state (StateData_Boney).
AF8E LD DE,$000E Each entity record is 000E bytes long, then load that length into DE.
Scan Boney's complex state for the 37 busy pattern that marks task completion.
Check_Task_Completion_ScanBerk AF91 LD A,(HL) Fetch the next byte from Boney's complex entity state.
AF92 CP $37 Is task status flags equal to 37? If so, jump to Check_Task_Completion_SetBusyBit7.
AF94 JR Z,Check_Task_Completion_SetBusyBit7
AF96 CP $01 Is task status flags equal to 01? If so, jump to Check_Task_Completion_NextBerkRecord.
AF98 JR Z,Check_Task_Completion_NextBerkRecord
AF9A BIT 7,A Is bit 07 of task status flags set? If so, jump to Check_Task_Completion_NextBerkRecord.
AF9C JR NZ,Check_Task_Completion_NextBerkRecord
AF9E OR A Is task status flags zero? If not, return.
AF9F RET NZ
Advance to the next Berk state record and keep scanning for completion.
Check_Task_Completion_NextBerkRecord AFA0 ADD HL,DE Add the offset in DE to the pointer in HL.
AFA1 JR Check_Task_Completion_ScanBerk Jump to Check_Task_Completion_ScanBerk to keep testing task-status combinations.
Mark task status bit 07 so Berk's script/dialogue is busy.
Check_Task_Completion_SetBusyBit7 AFA3 LD HL,$72B4 Point HL at the task status flags (TaskStatusFlags).
AFA6 SET 7,(HL) Set "Berk script / dialogue busy" (bit 07 of TaskStatusFlags).
AFA8 RET Return.
Prev: AF3C Up: Map Next: AFA9