![]() |
Routines |
| Prev: 50135 | Up: Map | Next: 50243 |
|
Steer the task-three creature toward Berk while pursuit flags allow it.
|
||||||||
| ScriptRoutine_TaskThreeSeekBerk | 50143 | BIT 0,(IX+3) | Is the current entity script-locked (bit 0 of IX+3)? If not, jump to ScriptRoutine_TaskThreeSeekBerk_ClearActiveAndSeekBerk. | |||||
| 50147 | JR Z,ScriptRoutine_TaskThreeSeekBerk_ClearActiveAndSeekBerk | |||||||
| 50149 | LD A,(49892) | Load A with the task-three byte (TaskThree_Workspace). | ||||||
| 50152 | OR A | Is the task-three byte (TaskThree_Workspace) zero? If so, jump to ScriptRoutine_TaskThreeSeekBerk_ClearActiveAndSeekBerk. | ||||||
| 50153 | JR Z,ScriptRoutine_TaskThreeSeekBerk_ClearActiveAndSeekBerk | |||||||
| 50155 | DEC A | Step task-three byte back by one. | ||||||
| 50156 | LD (49892),A | Set the task-three byte (TaskThree_Workspace). | ||||||
| 50159 | LD A,(IX+9) | Load A with the current entity's direction / state. | ||||||
| 50162 | BIT 0,A | Is bit 0 of the current entity's direction / state set? If so, jump to ScriptRoutine_TaskThreeSeekBerk_BuildRightWindow. | ||||||
| 50164 | JP NZ,ScriptRoutine_TaskThreeSeekBerk_BuildRightWindow | |||||||
| 50167 | BIT 1,A | Is bit 1 of the current entity's direction / state set? If so, jump to ScriptRoutine_TaskThreeSeekBerk_BuildLeftWindow. | ||||||
| 50169 | JP NZ,ScriptRoutine_TaskThreeSeekBerk_BuildLeftWindow | |||||||
| 50172 | BIT 2,A | Is bit 2 of the current entity's direction / state set? If so, jump to ScriptRoutine_TaskThreeSeekBerk_MoveRoomUp. | ||||||
| 50174 | JR NZ,ScriptRoutine_TaskThreeSeekBerk_MoveRoomUp | |||||||
| 50176 | BIT 3,A | Is bit 3 of the current entity's direction / state set? If so, jump to ScriptRoutine_TaskThreeSeekBerk_MoveRoomDown. | ||||||
| 50178 | JR NZ,ScriptRoutine_TaskThreeSeekBerk_MoveRoomDown | |||||||
|
Clear the seek latch and chase Berk by room: same room compares X; else move up or down toward him.
|
||||||||
| ScriptRoutine_TaskThreeSeekBerk_ClearActiveAndSeekBerk | 50180 | RES 0,(IX+3) | Reset bit 0 of the current entity's flags byte 3. | |||||
| 50184 | LD A,(29445) | Load A with Berk's room-index copy (BerkRoomIndexCopy). | ||||||
| 50187 | CP (IX+4) | Is Berk in the same room as this entity (IX+4)? If so, jump to ScriptRoutine_TaskThreeSeekBerk_CompareBerkXEdges. | ||||||
| 50190 | JR Z,ScriptRoutine_TaskThreeSeekBerk_CompareBerkXEdges | |||||||
| 50192 | JR C,ScriptRoutine_TaskThreeSeekBerk_MoveRoomDown | Jump to ScriptRoutine_TaskThreeSeekBerk_MoveRoomDown if the result underflowed. | ||||||
|
Climb toward Berk: at room 4 arm Slimy (ScriptRoutine_TaskThreeSeekBerk_ArmSlimyRange10); else rise when bit 2 is set, or run the climb script.
|
||||||||
| ScriptRoutine_TaskThreeSeekBerk_MoveRoomUp | 50194 | LD A,(IX+4) | Load A with the current entity's room index. | |||||
| 50197 | CP 4 | Is the current entity's room index equal to 4? If so, jump to ScriptRoutine_TaskThreeSeekBerk_ArmSlimyRange10. | ||||||
| 50199 | JP Z,ScriptRoutine_TaskThreeSeekBerk_ArmSlimyRange10 | |||||||
| 50202 | LD A,(IX+9) | Load A with the current entity's direction / state. | ||||||
| 50205 | BIT 2,A | Is bit 2 of the current entity's direction / state set? If so, jump to ScriptRoutine_TaskThreeSeekBerk_TestOverlapThenRise. | ||||||
| 50207 | JR NZ,ScriptRoutine_TaskThreeSeekBerk_TestOverlapThenRise | |||||||
| 50209 | LD HL,49968 | Point HL at task-three table entry 49968. | ||||||
| 50212 | JP ScriptInstruction | Jump to ScriptInstruction to execute the script instruction at HL. | ||||||
|
Probe the path above with Test_EntityOverlap_AtDepth before rising into the next room.
|
||||||||
| ScriptRoutine_TaskThreeSeekBerk_TestOverlapThenRise | 50215 | CALL Test_EntityOverlap_AtDepth | Call Test_EntityOverlap_AtDepth to test collectible / room collision. | |||||
| 50218 | JR NC,ScriptRoutine_TaskThreeSeekBerk_MaybeArmSlimyFromRise | Jump to ScriptRoutine_TaskThreeSeekBerk_MaybeArmSlimyFromRise if the result did not underflow. | ||||||
|
This entry point is used by the routine at ScriptRoutine_TaskThreeClearUpstairs.
Step down a room toward Berk, refresh the heater at Update_Heater, and continue the script.
|
||||||||
| ScriptRoutine_TaskThreeSeekBerk_IncRoomAndHeater | 50220 | INC (IX+5) | Move this entity one character down. | |||||
| 50223 | INC (IX+6) | |||||||
| 50226 | INC (IX+4) | Advance this entity into the next room. | ||||||
| 50229 | CALL Update_Heater | Call Update_Heater to update Heater. | ||||||
| 50232 | JP AdvanceScriptInstruction | Jump to AdvanceScriptInstruction to run the next script instruction. | ||||||
|
Blocked rise: treat direction 31 as a door hit (TaskThree_DoorHitThenNextScript), otherwise arm Slimy at ScriptRoutine_TaskThreeSeekBerk_ArmSlimyRange10.
|
||||||||
| ScriptRoutine_TaskThreeSeekBerk_MaybeArmSlimyFromRise | 50235 | CP 31 | Is the current entity's direction / state equal to 31? If so, jump to TaskThree_DoorHitThenNextScript. | |||||
| 50237 | JP Z,TaskThree_DoorHitThenNextScript | |||||||
| 50240 | JP ScriptRoutine_TaskThreeSeekBerk_ArmSlimyRange10 | Jump to ScriptRoutine_TaskThreeSeekBerk_ArmSlimyRange10 to continue this routine. | ||||||
| Prev: 50135 | Up: Map | Next: 50243 |