Prev: CC78 Up: Map Next: CCB9
CC8B: Script Routine: (4C) Task-four entity action
Test whether the task-four creature currently overlaps Berk.
Input
IX Address of complex state data for an entity
ScriptRoutine_TaskFourBerkOverlap CC8B LD A,$8E Load A with 8E.
CC8D CALL Queue_Sound Call Queue_Sound to queue a sound effect.
CC90 LD A,($7305) Load A with Berk's room-index copy (BerkRoomIndexCopy).
CC93 CP (IX+$04) Is Berk in the same room as this entity (IX+04)? If so, jump to ScriptRoutine_TaskFourBerkOverlap_TestBerkOverlap.
CC96 JR Z,ScriptRoutine_TaskFourBerkOverlap_TestBerkOverlap
CC98 INC A Advance Berk's room-index copy by one.
CC99 CP (IX+$04) Is Berk in the same room as this entity (IX+04)? If not, jump to AdvanceScriptInstruction.
CC9C JP NZ,AdvanceScriptInstruction
Same-room Berk overlap: if X bands intersect, treat it as a door / interaction hit via Reposition_CameraFollowEntity.
ScriptRoutine_TaskFourBerkOverlap_TestBerkOverlap CC9F LD A,($7304) Load A with Berk's X-extent copy (BerkXExtentCopy).
CCA2 CP (IX+$07) Is Berk's X-extent copy left of this entity's x (IX+07)? If so, no overlap, jump to AdvanceScriptInstruction.
CCA5 JP C,AdvanceScriptInstruction
CCA8 LD A,($7303) Load A with Berk's X-coordinate copy (BerkXCoordinateCopy).
CCAB LD C,A Keep Berk's X coordinate in C.
CCAC LD A,(IX+$08) Load A with the current entity's x-extent.
CCAF CP C Is this entity's x-extent left of Berk's X-coordinate copy (BerkXCoordinateCopy)? If so, no overlap, jump to AdvanceScriptInstruction.
CCB0 JP C,AdvanceScriptInstruction
CCB3 CALL Reposition_CameraFollowEntity Call Reposition_CameraFollowEntity to handle the door / interaction hit.
Advance to the next script instruction after the Berk-overlap hit.
ScriptRoutine_TaskFourBerkOverlap_NextScript CCB6 JP AdvanceScriptInstruction Jump to AdvanceScriptInstruction to run the next script instruction.
Prev: CC78 Up: Map Next: CCB9