Prev: 52344 Up: Map Next: 52409
52363: Script Routine: (76) 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 52363 LD A,142 Load A with 142.
52365 CALL Queue_Sound Call Queue_Sound to queue a sound effect.
52368 LD A,(29445) Load A with Berk's room-index copy (BerkRoomIndexCopy).
52371 CP (IX+4) Is Berk in the same room as this entity (IX+4)? If so, jump to ScriptRoutine_TaskFourBerkOverlap_TestBerkOverlap.
52374 JR Z,ScriptRoutine_TaskFourBerkOverlap_TestBerkOverlap
52376 INC A Advance Berk's room-index copy by one.
52377 CP (IX+4) Is Berk in the same room as this entity (IX+4)? If not, jump to AdvanceScriptInstruction.
52380 JP NZ,AdvanceScriptInstruction
Same-room Berk overlap: if X bands intersect, treat it as a door / interaction hit via Reposition_CameraFollowEntity.
ScriptRoutine_TaskFourBerkOverlap_TestBerkOverlap 52383 LD A,(29444) Load A with Berk's X-extent copy (BerkXExtentCopy).
52386 CP (IX+7) Is Berk's X-extent copy left of this entity's x (IX+7)? If so, no overlap, jump to AdvanceScriptInstruction.
52389 JP C,AdvanceScriptInstruction
52392 LD A,(29443) Load A with Berk's X-coordinate copy (BerkXCoordinateCopy).
52395 LD C,A Keep Berk's X coordinate in C.
52396 LD A,(IX+8) Load A with the current entity's x-extent.
52399 CP C Is this entity's x-extent left of Berk's X-coordinate copy (BerkXCoordinateCopy)? If so, no overlap, jump to AdvanceScriptInstruction.
52400 JP C,AdvanceScriptInstruction
52403 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 52406 JP AdvanceScriptInstruction Jump to AdvanceScriptInstruction to run the next script instruction.
Prev: 52344 Up: Map Next: 52409