Prev: 51966 Up: Map Next: 52036
51998: Script Routine: (79) Task-four entity action
Pick a new extra-state value for the task-four creature's next beat.
Input
IX Address of complex state data for an entity
ScriptRoutine_TaskFourRandomiseExtra 51998 LD (IX+12),4 Write 4 to the current entity's extra state.
52002 LD A,5 Load A with 5.
52004 CALL PseudoRandom Call PseudoRandom to pick a pseudo-random value.
52007 ADD A,6 Add 6 to A (adjust a task-four index/counter).
52009 LD C,A Keep the index in C.
52010 LD A,2 Load A with 2.
52012 CALL PseudoRandom Call PseudoRandom to pick a pseudo-random value.
52015 OR A Is A zero? If so, jump to ScriptRoutine_TaskFourRandomiseExtra_StoreDeltaClearBit4.
52016 JR Z,ScriptRoutine_TaskFourRandomiseExtra_StoreDeltaClearBit4
52018 LD A,C Copy the saved count/flag from C into A.
52019 NEG Negate A (flip a delta/direction).
52021 LD C,A Keep the delta in C.
Keep the signed step delta, drop the upstairs latch on GameEventFlags, and continue the script.
ScriptRoutine_TaskFourRandomiseExtra_StoreDeltaClearBit4 52022 LD (IX+9),C Store C in the current entity's direction / state.
52025 LD A,(29363) Load A with the game event flags (GameEventFlags).
52028 RES 4,A Clear bit 4 of the flag byte in A.
52030 LD (29363),A Set the game event flags (GameEventFlags).
52033 JP AdvanceScriptInstruction Jump to AdvanceScriptInstruction to run the next script instruction.
Prev: 51966 Up: Map Next: 52036