Prev: 52879 Up: Map Next: 52958
52920: Process Script Command With Counter
Processes a character script command, tracking how many commands have been executed. If the counter limit is reached, the script is terminated.
Input
A Counter value (maximum number of commands to process)
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 Call AdvanceScriptPointerByCommandSize to advance past this script command.
52930 BIT 4,(IX+0) Jump to ProcessScriptCommandWithCounter_UpdatePosition if a marker on the record's flag byte is clear.
52934 JR Z,ProcessScriptCommandWithCounter_UpdatePosition
52936 LD E,(HL) Read the command's address into HL.
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 Store H at IY+2.
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 Go to TerminateCharacterScript if the subtraction comes out at zero.
52955 JP DispatchCharacterScript Another command remains, so parse it from DispatchCharacterScript.
Prev: 52879 Up: Map Next: 52958