![]() |
Routines |
| Prev: 52879 | Up: Map | Next: 52958 |
|
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 | 52920 | LD HL,52235 | Increment the script command counter. | |||||
| 52923 | INC (HL) | |||||||
| 52924 | CALL GetCurrentScriptState | Get the current script state (command byte and position). | ||||||
| 52927 | CALL AdvanceScriptPointerByCommandSize | Process the command byte and advance the script pointer. | ||||||
| 52930 | BIT 4,(IX+0) | Jump to ProcessScriptCommandWithCounter_UpdatePosition if bit 4 is not set (no pointer to load). | ||||||
| 52934 | JR Z,ProcessScriptCommandWithCounter_UpdatePosition | |||||||
| 52936 | LD E,(HL) | Load the script pointer from the command data (two bytes into DE). | ||||||
| 52937 | INC HL | |||||||
| 52938 | LD D,(HL) | |||||||
| 52939 | EX DE,HL | |||||||
| ProcessScriptCommandWithCounter_UpdatePosition | 52940 | LD (IY+1),L | Update the character's script position pointer (IY+1/2). | |||||
| 52943 | LD (IY+2),H | |||||||
| 52946 | PUSH IX | Calculate how many bytes have been processed in the script (HL-IX). | ||||||
| 52948 | POP DE | |||||||
| 52949 | AND A | |||||||
| 52950 | SBC HL,DE | |||||||
| 52952 | JP Z,TerminateCharacterScript | Jump to TerminateCharacterScript if the counter limit has been reached (HL equals A). | ||||||
| 52955 | JP ScriptInterpreter_0 | Jump to ScriptInterpreter_0 (continue processing the next script command). | ||||||
| Prev: 52879 | Up: Map | Next: 52958 |