![]() |
Routines |
| Prev: CAFE | Up: Map | Next: CB44 |
|
Pick a new extra-state value for the task-four creature's next beat.
|
||||||||
| ScriptRoutine_TaskFourRandomiseExtra | CB1E | LD (IX+$0C),$04 | Write 04 to the current entity's extra state. | |||||
| CB22 | LD A,$05 | Load A with 05. | ||||||
| CB24 | CALL PseudoRandom | Call PseudoRandom to pick a pseudo-random value. | ||||||
| CB27 | ADD A,$06 | Add 06 to A (adjust a task-four index/counter). | ||||||
| CB29 | LD C,A | Keep the index in C. | ||||||
| CB2A | LD A,$02 | Load A with 02. | ||||||
| CB2C | CALL PseudoRandom | Call PseudoRandom to pick a pseudo-random value. | ||||||
| CB2F | OR A | Is A zero? If so, jump to ScriptRoutine_TaskFourRandomiseExtra_StoreDeltaClearBit4. | ||||||
| CB30 | JR Z,ScriptRoutine_TaskFourRandomiseExtra_StoreDeltaClearBit4 | |||||||
| CB32 | LD A,C | Copy the saved count/flag from C into A. | ||||||
| CB33 | NEG | Negate A (flip a delta/direction). | ||||||
| CB35 | 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 | CB36 | LD (IX+$09),C | Store C in the current entity's direction / state. | |||||
| CB39 | LD A,($72B3) | Load A with the game event flags (GameEventFlags). | ||||||
| CB3C | RES 4,A | Clear bit 04 of the flag byte in A. | ||||||
| CB3E | LD ($72B3),A | Set the game event flags (GameEventFlags). | ||||||
| CB41 | JP AdvanceScriptInstruction | Jump to AdvanceScriptInstruction to run the next script instruction. | ||||||
| Prev: CAFE | Up: Map | Next: CB44 |