![]() |
Routines |
| Prev: CE8F | Up: Map | Next: CEDE |
|
Used by the routines at HandleCommandType_0E_0C_0B_0A, HandlePopStack, HandleDisplayRoomDescription, ClearRoomDisplayParameters and HandleSimpleAction.
Processes a character script command, tracking how many commands have been executed. If the counter limit is reached, the script is terminated.
|
||||||||
| ProcessScriptCommandWithCounter | CEB8 | LD HL,$CC0B | Increment the script command counter. | |||||
| CEBB | INC (HL) | |||||||
| CEBC | CALL GetCurrentScriptState | Get the current script state (command byte and position). | ||||||
| CEBF | CALL AdvanceScriptPointerByCommandSize | Process the command byte and advance the script pointer. | ||||||
| CEC2 | BIT 4,(IX+$00) | Jump to ProcessScriptCommandWithCounter_UpdatePosition if bit 4 is not set (no pointer to load). | ||||||
| CEC6 | JR Z,ProcessScriptCommandWithCounter_UpdatePosition | |||||||
| CEC8 | LD E,(HL) | Load the script pointer from the command data (two bytes into DE). | ||||||
| CEC9 | INC HL | |||||||
| CECA | LD D,(HL) | |||||||
| CECB | EX DE,HL | |||||||
| ProcessScriptCommandWithCounter_UpdatePosition | CECC | LD (IY+$01),L | Update the character's script position pointer (IY+01/02). | |||||
| CECF | LD (IY+$02),H | |||||||
| CED2 | PUSH IX | Calculate how many bytes have been processed in the script (HL-IX). | ||||||
| CED4 | POP DE | |||||||
| CED5 | AND A | |||||||
| CED6 | SBC HL,DE | |||||||
| CED8 | JP Z,TerminateCharacterScript | Jump to TerminateCharacterScript if the counter limit has been reached (HL equals A). | ||||||
| CEDB | JP ScriptInterpreter_0 | Jump to ScriptInterpreter_0 (continue processing the next script command). | ||||||
| Prev: CE8F | Up: Map | Next: CEDE |