Prev: 49130 Up: Map Next: 49191
49152: Script Routine: (38) Task-two entity action
Walk the task-two entity left or right according to the task-two flags.
Input
IX Address of complex state data for an entity
ScriptRoutine_TaskTwoWalkHorizontal 49152 LD A,(29365) Load A with the task-two flags (TaskTwoFlags).
49155 BIT 2,A Test bit 2 of task-two flags.
49157 LD A,(IX+7) Load A with the current entity's x-coordinate.
49160 JR Z,ScriptRoutine_TaskTwoWalkHorizontal_WalkLeftOrBound Jump to ScriptRoutine_TaskTwoWalkHorizontal_WalkLeftOrBound to continue if the comparison matched.
49162 CP 110 Is the current entity's x-coordinate equal to 110? If so, jump to ScriptRoutine_TaskTwoWalkHorizontal_RunBoundScript.
49164 JR Z,ScriptRoutine_TaskTwoWalkHorizontal_RunBoundScript
Walk left while above X 99; otherwise turn via ScriptRoutine_TaskTwoWalkHorizontal_RunTurnScript.
ScriptRoutine_TaskTwoWalkHorizontal_WalkLeftOrBound 49166 CP 99 Is the current entity's x-coordinate less than 99? If so, jump to ScriptRoutine_TaskTwoWalkHorizontal_RunTurnScript.
49168 JR C,ScriptRoutine_TaskTwoWalkHorizontal_RunTurnScript
49170 DEC (IX+7) Move this entity one character left.
49173 DEC (IX+8)
49176 JP AdvanceScriptInstruction Jump to AdvanceScriptInstruction to run the next script instruction.
Hit the right bound (X 110): run bound script BirdScript_BoundLoop.
ScriptRoutine_TaskTwoWalkHorizontal_RunBoundScript 49179 LD HL,48825 Point HL at bird script data BirdScript_BoundLoop.
49182 JP ScriptInstruction Jump to ScriptInstruction to execute the script instruction at HL.
Hit the left bound: run the turn-around script (BirdScript_TurnLoop).
ScriptRoutine_TaskTwoWalkHorizontal_RunTurnScript 49185 LD HL,48777 Point HL at bird script data BirdScript_TurnLoop.
49188 JP ScriptInstruction Jump to ScriptInstruction to execute the script instruction at HL.
Prev: 49130 Up: Map Next: 49191