![]() |
Routines |
| Prev: C3DF | Up: Map | Next: C556 |
|
Clear the upstairs event bit, then resume the task-three script.
|
||||||||
| ScriptRoutine_TaskThreeClearUpstairs | C443 | LD A,($72B3) | Load A with the game event flags (GameEventFlags). | |||||
| C446 | RES 4,A | Clear bit 04 of the flag byte in A. | ||||||
| C448 | LD ($72B3),A | Set the game event flags (GameEventFlags). | ||||||
| C44B | JR ScriptRoutine_TaskThreeSeekBerk_IncRoomAndHeater | Jump to ScriptRoutine_TaskThreeSeekBerk_IncRoomAndHeater to continue this routine. | ||||||
|
This entry point is used by the routine at ScriptRoutine_TaskThreeSeekBerk.
Descend toward Berk: at room 02 arm Slimy (ScriptRoutine_TaskThreeSeekBerk_ArmSlimyRange10); else fall when bit 03 is set, or run the descend script.
|
||||||||
| ScriptRoutine_TaskThreeSeekBerk_MoveRoomDown | C44D | LD A,(IX+$04) | Load A with the current entity's room index. | |||||
| C450 | CP $02 | Is the current entity's room index equal to 02? If so, jump to ScriptRoutine_TaskThreeSeekBerk_ArmSlimyRange10. | ||||||
| C452 | JP Z,ScriptRoutine_TaskThreeSeekBerk_ArmSlimyRange10 | |||||||
| C455 | LD A,(IX+$09) | Load A with the current entity's direction / state. | ||||||
| C458 | BIT 3,A | Is bit 03 of the current entity's direction / state set? If so, jump to ScriptRoutine_TaskThreeSeekBerk_TestCameraThenFall. | ||||||
| C45A | JR NZ,ScriptRoutine_TaskThreeSeekBerk_TestCameraThenFall | |||||||
| C45C | LD HL,$C33A | Point HL at task-three table entry C33A. | ||||||
| C45F | JP ScriptInstruction | Jump to ScriptInstruction to execute the script instruction at HL. | ||||||
|
Probe with Clamp_CameraPosition, then fall one room toward Berk and refresh the heater.
|
||||||||
| ScriptRoutine_TaskThreeSeekBerk_TestCameraThenFall | C462 | CALL Clamp_CameraPosition | Call Clamp_CameraPosition to clamp the camera position. | |||||
| C465 | JR NC,ScriptRoutine_TaskThreeSeekBerk_MaybeArmSlimyFromFall | Jump to ScriptRoutine_TaskThreeSeekBerk_MaybeArmSlimyFromFall if the result did not underflow. | ||||||
| C467 | DEC (IX+$05) | Move this entity one character up. | ||||||
| C46A | DEC (IX+$06) | |||||||
| C46D | DEC (IX+$04) | Move this entity back one room. | ||||||
| C470 | CALL Update_Heater | Call Update_Heater to update Heater. | ||||||
| C473 | JP AdvanceScriptInstruction | Jump to AdvanceScriptInstruction to run the next script instruction. | ||||||
|
Blocked fall: treat direction 1F as a door hit (TaskThree_DoorHitThenNextScript), otherwise arm Slimy at ScriptRoutine_TaskThreeSeekBerk_ArmSlimyRange10.
|
||||||||
| ScriptRoutine_TaskThreeSeekBerk_MaybeArmSlimyFromFall | C476 | CP $1F | Is the current entity's direction / state equal to 1F? If so, jump to TaskThree_DoorHitThenNextScript. | |||||
| C478 | JP Z,TaskThree_DoorHitThenNextScript | |||||||
| C47B | JP ScriptRoutine_TaskThreeSeekBerk_ArmSlimyRange10 | Jump to ScriptRoutine_TaskThreeSeekBerk_ArmSlimyRange10 to continue this routine. | ||||||
|
This entry point is used by the routine at ScriptRoutine_TaskThreeSeekBerk.
Same-room chase: compare Berk's X band (BerkXCoordinateCopy/BerkXExtentCopy) and walk right, left, or stop.
|
||||||||
| ScriptRoutine_TaskThreeSeekBerk_CompareBerkXEdges | C47E | LD A,($7303) | Load A with Berk's X-coordinate copy (BerkXCoordinateCopy). | |||||
| C481 | LD C,A | Keep Berk's X coordinate in C. | ||||||
| C482 | LD A,(IX+$08) | Load A with the current entity's x-extent. | ||||||
| C485 | CP C | Is this entity's x-extent left of Berk's X-coordinate copy (BerkXCoordinateCopy)? If so, jump to ScriptRoutine_TaskThreeSeekBerk_BuildRightWindow. | ||||||
| C486 | JR C,ScriptRoutine_TaskThreeSeekBerk_BuildRightWindow | |||||||
| C488 | LD A,($7304) | Load A with Berk's X-extent copy (BerkXExtentCopy). | ||||||
| C48B | CP (IX+$07) | Is Berk's X-extent copy left of this entity's x (IX+07)? If so, jump to ScriptRoutine_TaskThreeSeekBerk_BuildLeftWindow. | ||||||
| C48E | JR C,ScriptRoutine_TaskThreeSeekBerk_BuildLeftWindow | |||||||
| C490 | JP TaskThree_DoorHitThenNextScript | Jump to TaskThree_DoorHitThenNextScript to finish this handler. | ||||||
|
This entry point is used by the routine at ScriptRoutine_TaskThreeSeekBerk.
Build the right-side Berk window into C2E6 and run the peek script when he sits in that band.
|
||||||||
| ScriptRoutine_TaskThreeSeekBerk_BuildRightWindow | C493 | LD A,($7305) | Load A with Berk's room-index copy (BerkRoomIndexCopy). | |||||
| C496 | CP (IX+$04) | Is Berk in the same room as this entity (IX+04)? If not, jump to ScriptRoutine_TaskThreeSeekBerk_WalkRight. | ||||||
| C499 | JR NZ,ScriptRoutine_TaskThreeSeekBerk_WalkRight | |||||||
| C49B | OR A | Is A zero? If so, jump to ScriptRoutine_TaskThreeSeekBerk_WalkRight. | ||||||
| C49C | JR Z,ScriptRoutine_TaskThreeSeekBerk_WalkRight | |||||||
| C49E | LD A,(IX+$08) | Load A with the current entity's x-extent. | ||||||
| C4A1 | ADD A,$03 | Add 03 to A (adjust a task phase/index). | ||||||
| C4A3 | LD C,A | Keep the index in C. | ||||||
| C4A4 | ADD A,$04 | Add 04 to A (step a coordinate/index). | ||||||
| C4A6 | LD B,A | Keep a copy of A in B. | ||||||
| C4A7 | LD ($C2E6),BC | Store BC in the task-three word (C2E6). | ||||||
| C4AB | LD A,($7303) | Load A with Berk's X-coordinate copy (BerkXCoordinateCopy). | ||||||
| C4AE | CP B | Is Berk's X-coordinate copy (BerkXCoordinateCopy) at or beyond this entity's x-extent? If so, jump to ScriptRoutine_TaskThreeSeekBerk_WalkRight. | ||||||
| C4AF | JR NC,ScriptRoutine_TaskThreeSeekBerk_WalkRight | |||||||
| C4B1 | CP C | Is Berk's X-coordinate copy (BerkXCoordinateCopy) left of this entity's x-extent? If so, jump to ScriptRoutine_TaskThreeSeekBerk_WalkRight. | ||||||
| C4B2 | JR C,ScriptRoutine_TaskThreeSeekBerk_WalkRight | |||||||
| C4B4 | LD HL,$C35E | Point HL at task-three table entry C35E. | ||||||
| C4B7 | JP ScriptInstruction | Jump to ScriptInstruction to execute the script instruction at HL. | ||||||
|
Walk right toward Berk until the right edge (B6), then arm Slimy or keep stepping.
|
||||||||
| ScriptRoutine_TaskThreeSeekBerk_WalkRight | C4BA | LD A,(IX+$08) | Load A with the current entity's x-extent. | |||||
| C4BD | CP $B6 | Is the current entity's x-extent less than B6? If not, jump to ScriptRoutine_TaskThreeSeekBerk_ArmSlimyRange06. | ||||||
| C4BF | JR NC,ScriptRoutine_TaskThreeSeekBerk_ArmSlimyRange06 | |||||||
| C4C1 | BIT 0,(IX+$09) | Is bit 00 of the current entity's direction / state set? If so, jump to ScriptRoutine_TaskThreeSeekBerk_TestBelowThenIncX. | ||||||
| C4C5 | JR NZ,ScriptRoutine_TaskThreeSeekBerk_TestBelowThenIncX | |||||||
| C4C7 | LD HL,$C31C | Point HL at task-three table entry C31C. | ||||||
| C4CA | JP ScriptInstruction | Jump to ScriptInstruction to execute the script instruction at HL. | ||||||
|
If the way below is clear (Test_EntityBelow), step right and refresh the heater.
|
||||||||
| ScriptRoutine_TaskThreeSeekBerk_TestBelowThenIncX | C4CD | CALL Test_EntityBelow | Call Test_EntityBelow to test whether an entity is below. | |||||
| C4D0 | JR NC,ScriptRoutine_TaskThreeSeekBerk_ArmSlimyRange06 | Jump to ScriptRoutine_TaskThreeSeekBerk_ArmSlimyRange06 if the result did not underflow. | ||||||
| C4D2 | INC (IX+$07) | Move this entity one character right. | ||||||
| C4D5 | INC (IX+$08) | |||||||
| C4D8 | CALL Update_Heater | Call Update_Heater to update Heater. | ||||||
| C4DB | JP AdvanceScriptInstruction | Jump to AdvanceScriptInstruction to run the next script instruction. | ||||||
|
This entry point is used by the routine at ScriptRoutine_TaskThreeSeekBerk.
Build the left-side Berk window into C2E6 and run the peek script when he sits in that band.
|
||||||||
| ScriptRoutine_TaskThreeSeekBerk_BuildLeftWindow | C4DE | LD A,($7305) | Load A with Berk's room-index copy (BerkRoomIndexCopy). | |||||
| C4E1 | CP (IX+$04) | Is Berk in the same room as this entity (IX+04)? If not, jump to ScriptRoutine_TaskThreeSeekBerk_WalkLeft. | ||||||
| C4E4 | JR NZ,ScriptRoutine_TaskThreeSeekBerk_WalkLeft | |||||||
| C4E6 | OR A | Is A zero? If so, jump to ScriptRoutine_TaskThreeSeekBerk_WalkLeft. | ||||||
| C4E7 | JR Z,ScriptRoutine_TaskThreeSeekBerk_WalkLeft | |||||||
| C4E9 | LD A,(IX+$07) | Load A with the current entity's x-coordinate. | ||||||
| C4EC | SUB $03 | Subtract 03 from A. | ||||||
| C4EE | LD C,A | Keep the delta in C. | ||||||
| C4EF | SUB $03 | Subtract 03 from A. | ||||||
| C4F1 | LD B,A | Keep a copy of A in B. | ||||||
| C4F2 | LD ($C2E6),BC | Store BC in the task-three word (C2E6). | ||||||
| C4F6 | LD A,($7304) | Load A with Berk's X-extent copy (BerkXExtentCopy). | ||||||
| C4F9 | CP B | Is Berk's X-extent copy (BerkXExtentCopy) left of the entity's x (IX+07)? If so, jump to ScriptRoutine_TaskThreeSeekBerk_WalkLeft. | ||||||
| C4FA | JR C,ScriptRoutine_TaskThreeSeekBerk_WalkLeft | |||||||
| C4FC | CP C | Is Berk's X-extent copy (BerkXExtentCopy) at or beyond the entity's x (IX+07)? If so, jump to ScriptRoutine_TaskThreeSeekBerk_WalkLeft. | ||||||
| C4FD | JR NC,ScriptRoutine_TaskThreeSeekBerk_WalkLeft | |||||||
| C4FF | LD HL,$C344 | Point HL at task-three table entry C344. | ||||||
| C502 | JP ScriptInstruction | Jump to ScriptInstruction to execute the script instruction at HL. | ||||||
|
Walk left toward Berk until the left edge (49), then arm Slimy or keep stepping.
|
||||||||
| ScriptRoutine_TaskThreeSeekBerk_WalkLeft | C505 | LD A,(IX+$07) | Load A with the current entity's x-coordinate. | |||||
| C508 | CP $49 | Is the current entity's x-coordinate less than 49? If so, jump to ScriptRoutine_TaskThreeSeekBerk_ArmSlimyRange06. | ||||||
| C50A | JR C,ScriptRoutine_TaskThreeSeekBerk_ArmSlimyRange06 | |||||||
| C50C | BIT 1,(IX+$09) | Is bit 01 of the current entity's direction / state set? If so, jump to ScriptRoutine_TaskThreeSeekBerk_TestRightThenDecX. | ||||||
| C510 | JR NZ,ScriptRoutine_TaskThreeSeekBerk_TestRightThenDecX | |||||||
| C512 | LD HL,$C326 | Point HL at task-three table entry C326. | ||||||
| C515 | JP ScriptInstruction | Jump to ScriptInstruction to execute the script instruction at HL. | ||||||
|
If the way on the right is clear (Test_EntityOnRight), step left and refresh the heater.
|
||||||||
| ScriptRoutine_TaskThreeSeekBerk_TestRightThenDecX | C518 | CALL Test_EntityOnRight | Call Test_EntityOnRight to test whether an entity is on the right. | |||||
| C51B | JR NC,ScriptRoutine_TaskThreeSeekBerk_ArmSlimyRange06 | Jump to ScriptRoutine_TaskThreeSeekBerk_ArmSlimyRange06 if the result did not underflow. | ||||||
| C51D | DEC (IX+$07) | Move this entity one character left. | ||||||
| C520 | DEC (IX+$08) | |||||||
| C523 | CALL Update_Heater | Call Update_Heater to update Heater. | ||||||
| C526 | JP AdvanceScriptInstruction | Jump to AdvanceScriptInstruction to run the next script instruction. | ||||||
|
Edge / stuck path: arm Slimy with range 06 via Update_Slimy_Creature, then pick a seek or descend script.
|
||||||||
| ScriptRoutine_TaskThreeSeekBerk_ArmSlimyRange06 | C529 | CP $1F | Is the current entity's x-coordinate equal to 1F? If so, jump to TaskThree_DoorHitThenNextScript. | |||||
| C52B | JP Z,TaskThree_DoorHitThenNextScript | |||||||
| C52E | LD A,$06 | Load A with 06. | ||||||
| C530 | CALL Update_Slimy_Creature | Call Update_Slimy_Creature to update Slimy Creature. | ||||||
| C533 | OR A | Is A zero? If so, jump to ScriptRoutine_TaskThreeSeekBerk_RunSeekScript. | ||||||
| C534 | JR Z,ScriptRoutine_TaskThreeSeekBerk_RunSeekScript | |||||||
| C536 | LD HL,$C33A | Point HL at task-three table entry C33A. | ||||||
| C539 | JP ScriptInstruction | Jump to ScriptInstruction to execute the script instruction at HL. | ||||||
|
Run the climb/seek script at table entry C330.
|
||||||||
| ScriptRoutine_TaskThreeSeekBerk_RunSeekScript | C53C | LD HL,$C330 | Point HL at task-three table entry C330. | |||||
| C53F | JP ScriptInstruction | Jump to ScriptInstruction to execute the script instruction at HL. | ||||||
|
This entry point is used by the routine at ScriptRoutine_TaskThreeSeekBerk.
Arm Slimy with range 10 via Update_Slimy_Creature, then pick an approach or walk-left script.
|
||||||||
| ScriptRoutine_TaskThreeSeekBerk_ArmSlimyRange10 | C542 | LD A,$10 | Load A with 10. | |||||
| C544 | CALL Update_Slimy_Creature | Call Update_Slimy_Creature to update the slimy creature. | ||||||
| C547 | OR A | Is the random result in A zero? If so, jump to ScriptRoutine_TaskThreeSeekBerk_RunApproachScript. | ||||||
| C548 | JR Z,ScriptRoutine_TaskThreeSeekBerk_RunApproachScript | |||||||
| C54A | LD HL,$C326 | Point HL at task-three table entry C326. | ||||||
| C54D | JP ScriptInstruction | Jump to ScriptInstruction to execute the script instruction at HL. | ||||||
|
Run the walk-right approach script at table entry C31C.
|
||||||||
| ScriptRoutine_TaskThreeSeekBerk_RunApproachScript | C550 | LD HL,$C31C | Point HL at task-three table entry C31C. | |||||
| C553 | JP ScriptInstruction | Jump to ScriptInstruction to execute the script instruction at HL. | ||||||
| Prev: C3DF | Up: Map | Next: C556 |