Prev: BFEA Up: Map Next: C027
C000: Script Routine: (26) 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 C000 LD A,($72B5) Load A with the task-two flags (TaskTwoFlags).
C003 BIT 2,A Test bit 02 of task-two flags.
C005 LD A,(IX+$07) Load A with the current entity's x-coordinate.
C008 JR Z,ScriptRoutine_TaskTwoWalkHorizontal_WalkLeftOrBound Jump to ScriptRoutine_TaskTwoWalkHorizontal_WalkLeftOrBound to continue if the comparison matched.
C00A CP $6E Is the current entity's x-coordinate equal to 6E? If so, jump to ScriptRoutine_TaskTwoWalkHorizontal_RunBoundScript.
C00C JR Z,ScriptRoutine_TaskTwoWalkHorizontal_RunBoundScript
Walk left while above X 63; otherwise turn via ScriptRoutine_TaskTwoWalkHorizontal_RunTurnScript.
ScriptRoutine_TaskTwoWalkHorizontal_WalkLeftOrBound C00E CP $63 Is the current entity's x-coordinate less than 63? If so, jump to ScriptRoutine_TaskTwoWalkHorizontal_RunTurnScript.
C010 JR C,ScriptRoutine_TaskTwoWalkHorizontal_RunTurnScript
C012 DEC (IX+$07) Move this entity one character left.
C015 DEC (IX+$08)
C018 JP AdvanceScriptInstruction Jump to AdvanceScriptInstruction to run the next script instruction.
Hit the right bound (X 6E): run bound script BirdScript_BoundLoop.
ScriptRoutine_TaskTwoWalkHorizontal_RunBoundScript C01B LD HL,$BEB9 Point HL at bird script data BirdScript_BoundLoop.
C01E 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 C021 LD HL,$BE89 Point HL at bird script data BirdScript_TurnLoop.
C024 JP ScriptInstruction Jump to ScriptInstruction to execute the script instruction at HL.
Prev: BFEA Up: Map Next: C027