54 script->loopStartTable[loopDepth] = (
s32)args;
55 script->loopCounterTable[loopDepth] =
var;
66 loopCounter =
script->loopCounterTable[loopDepth];
68 if (loopCounter == 0) {
73 if (loopCounter >= -10000000) {
74 script->loopCounterTable[loopDepth] = --loopCounter;
81 if (loopCounter != 0) {
105 if (
script->functionTemp[0] == 0) {
109 script->functionTemp[0]--;
110 return !
script->functionTemp[0];
121 if (
script->functionTemp[0] == 0) {
125 script->functionTemp[0]--;
126 return !
script->functionTemp[0];
239 script->switchBlockValue[switchDepth] = value;
240 script->switchBlockState[switchDepth] = 1;
252 script->switchBlockValue[switchDepth] =
a0;
253 script->switchBlockState[switchDepth] = 1;
262 s32 switchBlockValue;
267 switchBlockValue =
script->switchBlockValue[switchDepth];
269 if (
script->switchBlockState[switchDepth] <= 0) {
272 }
else if (
var != switchBlockValue) {
275 script->switchBlockState[switchDepth] = 0;
285 s32 switchBlockValue;
290 switchBlockValue =
script->switchBlockValue[switchDepth];
292 if (
script->switchBlockState[switchDepth] <= 0) {
295 }
else if (
var == switchBlockValue) {
298 script->switchBlockState[switchDepth] = 0;
308 s32 switchBlockValue;
313 switchBlockValue =
script->switchBlockValue[switchDepth];
315 if (
script->switchBlockState[switchDepth] <= 0) {
318 }
else if (
var <= switchBlockValue) {
321 script->switchBlockState[switchDepth] = 0;
331 s32 switchBlockValue;
336 switchBlockValue =
script->switchBlockValue[switchDepth];
338 if (
script->switchBlockState[switchDepth] <= 0) {
341 }
else if (
var < switchBlockValue) {
344 script->switchBlockState[switchDepth] = 0;
354 s32 switchBlockValue;
359 switchBlockValue =
script->switchBlockValue[switchDepth];
361 if (
script->switchBlockState[switchDepth] <= 0) {
364 }
else if (
var >= switchBlockValue) {
367 script->switchBlockState[switchDepth] = 0;
377 s32 switchBlockValue;
382 switchBlockValue =
script->switchBlockValue[switchDepth];
384 if (
script->switchBlockState[switchDepth] <= 0) {
387 }
else if (
var > switchBlockValue) {
390 script->switchBlockState[switchDepth] = 0;
401 s32 switchBlockValue;
408 switchBlockValue =
script->switchBlockValue[switchDepth];
410 if (
script->switchBlockState[switchDepth] <= 0) {
413 }
else if ((
var <= switchBlockValue) && (switchBlockValue <= var2)) {
414 script->switchBlockState[switchDepth] = 0;
427 if (
script->switchBlockState[switchDepth] <= 0) {
431 script->switchBlockState[switchDepth] = 0;
441 s32 switchBlockValue;
442 s32 switchBlockState;
447 switchBlockValue =
script->switchBlockValue[switchDepth];
448 switchBlockState =
script->switchBlockState[switchDepth];
450 if (switchBlockState <= 0) {
453 }
else if ((
var & switchBlockValue) == 0) {
456 script->switchBlockState[switchDepth] = 0;
466 s32 switchBlockValue;
467 s32 switchBlockState;
472 switchBlockValue =
script->switchBlockValue[switchDepth];
473 switchBlockState =
script->switchBlockState[switchDepth];
475 if (switchBlockState == 0) {
478 }
else if (
var == switchBlockValue) {
479 script->switchBlockState[switchDepth] = -1;
480 }
else if (switchBlockState != -1) {
491 s32 switchBlockValue;
492 s32 switchBlockState;
497 switchBlockValue =
script->switchBlockValue[switchDepth];
498 switchBlockState =
script->switchBlockState[switchDepth];
500 if (switchBlockState == 0) {
503 }
else if (switchBlockState == -2) {
505 }
else if (
var == switchBlockValue) {
506 script->switchBlockState[switchDepth] = -1;
508 script->switchBlockState[switchDepth] = -2;
518 if (
script->switchBlockState[
script->switchDepth] == 0) {
521 }
else if (
script->switchBlockState[
script->switchDepth] != -1) {
543 script->switchBlockState[switchDepth] = 0;
624 result = num % result;
897 func =
script->callFunction;
901 script->ptrReadPos = args;
905 func =
script->callFunction;
996 script->varTable[0] = trigger->varTable[0];
997 script->varTable[1] = trigger->varTable[1];
998 script->varTable[2] = trigger->varTable[2];
999 script->owner2.trigger = trigger;
1116 newScript->varTable[0] = trigger->varTable[0];
1117 newScript->varTable[1] = trigger->varTable[1];
1118 newScript->varTable[2] = trigger->varTable[2];
1142 bp.itemList = itemList;
1369 switch (
script->debugStep) {
1385 switch (
script->curOpcode) {
1388 lines =
script->ptrNextLine;
1389 script->curOpcode = *lines++;
1391 script->ptrReadPos = lines;
1394 lines = &lines[
nargs];
1395 script->ptrNextLine = lines;
2067 if (
script->labelIndices[i] == arg1) {
2165 s32 switchDepth = 1;
2184 if (switchDepth == 0) {
2193 s32 switchDepth = 1;
2212 if (switchDepth == 0) {
2227 if (switchDepth == 1) {
2252 if (loopDepth < 0) {
BSS s32 PopupMenu_SelectedIndex
ApiStatus(* ApiFunc)(struct Evt *, s32)
#define ASSERT(condition)
@ DEBUG_SCRIPTS_BLOCK_FUNC_DONE
ApiStatus func_802C739C(Evt *script)
ApiStatus evt_handle_OR(Evt *script)
ApiStatus func_802C73B0(Evt *script)
ApiStatus evt_handle_set_int_buffer_ptr(Evt *script)
ApiStatus evt_handle_break_loop(Evt *script)
s32 evt_get_variable_index(Evt *script, s32 var)
Bytecode * evt_skip_if(Evt *script)
ApiStatus evt_handle_AND(Evt *script)
ApiStatus evt_handle_set_float(Evt *script)
s32 evt_get_variable(Evt *script, Bytecode var)
ApiStatus evt_handle_switch_const(Evt *script)
ApiStatus evt_handle_call(Evt *script)
ApiStatus evt_handle_case_greater(Evt *script)
ApiStatus evt_handle_end_thread(Evt *script)
ApiStatus evt_handle_case_equal_OR(Evt *script)
ApiStatus evt_handle_get_3_word(Evt *script)
ApiStatus evt_handle_divideF(Evt *script)
ApiStatus evt_handle_multiply(Evt *script)
ApiStatus evt_handle_switch(Evt *script)
char evtDebugPrintBuffer[0x100]
ApiStatus evt_handle_AND_const(Evt *script)
ApiStatus evt_handle_break_case(Evt *script)
Bytecode * evt_goto_end_case(Evt *script)
ApiStatus evt_handle_debug_breakpoint(Evt *script)
ApiStatus evt_handle_jump(Evt *script)
Bytecode * evt_skip_else(Evt *script)
ApiStatus evt_handle_suspend_all(Evt *script)
ApiStatus evt_handle_case_less(Evt *script)
ApiStatus evt_handle_set_timescale(Evt *script)
ApiStatus evt_handle_set_const(Evt *script)
ApiStatus evt_handle_subtract(Evt *script)
ApiStatus evt_handle_if_greater(Evt *script)
ApiStatus evt_handle_exec_wait(Evt *script)
f32 evt_set_float_variable(Evt *script, Bytecode var, f32 value)
ApiStatus evt_handle_set_array(Evt *script)
Bytecode * EvtCallingLine
Bytecode * evt_goto_next_case(Evt *script)
ApiStatus evt_handle_if_less(Evt *script)
ApiStatus evt_handle_case_default(Evt *script)
ApiStatus evt_handle_exec1(Evt *script)
s32 evt_set_variable(Evt *script, Bytecode var, s32 value)
ApiStatus evt_handle_add(Evt *script)
ApiStatus evt_handle_loop(Evt *script)
ApiStatus evt_handle_return(Evt *script)
Bytecode * evt_goto_end_loop(Evt *script)
ApiStatus evt_handle_mod(Evt *script)
ApiStatus evt_handle_thread(Evt *script)
s32 evt_get_variable_index_alt(s32 var)
s32 evt_trigger_on_activate_lock(Trigger *trigger)
ApiStatus evt_handle_case_equal_AND(Evt *script)
ApiStatus evt_handle_case_range(Evt *script)
Bytecode evt_float_to_fixed_var(f32 value)
ApiStatus evt_handle_goto(Evt *script)
s32 evt_trigger_on_activate_exec_script(Trigger *trigger)
ApiStatus evt_handle_OR_const(Evt *script)
ApiStatus evt_handle_bind(Evt *script)
ApiStatus evt_handle_print_debug_var(Evt *script)
ApiStatus evt_handle_set_var(Evt *script)
ApiStatus evt_handle_get_4_word(Evt *script)
ApiStatus evt_handle_unbind(Evt *script)
ApiStatus evt_handle_bind_lock(Evt *script)
ApiStatus evt_handle_if_not_equal(Evt *script)
ApiStatus evt_handle_get_1_float(Evt *script)
ApiStatus evt_handle_if_less_equal(Evt *script)
ApiStatus evt_handle_end_loop(Evt *script)
ApiStatus evt_handle_debug_log(Evt *script)
ApiStatus func_802C73B8(Evt *script)
s32 evt_execute_next_command(Evt *script)
ApiStatus evt_handle_get_Nth_word(Evt *script)
ApiStatus evt_handle_exec1_get_id(Evt *script)
ApiStatus evt_handle_case_AND(Evt *script)
ApiStatus evt_handle_subtractF(Evt *script)
ApiStatus evt_handle_set_flag_array(Evt *script)
ApiStatus evt_handle_set_float_buffer_ptr(Evt *script)
ApiStatus evt_handle_end_child_thread(Evt *script)
ApiStatus evt_handle_end_case_group(Evt *script)
ApiStatus evt_handle_get_Nth_float(Evt *script)
ApiStatus evt_handle_addF(Evt *script)
ApiStatus evt_handle_get_1_word(Evt *script)
ApiStatus evt_handle_set_priority(Evt *script)
ApiStatus evt_handle_suspend(Evt *script)
ApiStatus evt_handle_get_2_float(Evt *script)
ApiStatus evt_handle_case_less_equal(Evt *script)
ApiStatus evt_handle_get_2_word(Evt *script)
ApiStatus evt_handle_end_switch(Evt *script)
ApiStatus evt_handle_if_greater_equal(Evt *script)
ApiStatus evt_handle_resume_all(Evt *script)
ApiStatus evt_handle_if_equal(Evt *script)
f32 evt_fixed_var_to_float(Bytecode scriptVar)
ApiStatus evt_handle_child_thread(Evt *script)
f32 evt_get_float_variable(Evt *script, Bytecode var)
ApiStatus evt_handle_case_equal(Evt *script)
ApiStatus evt_handle_get_3_float(Evt *script)
ApiStatus evt_handle_does_script_exist(Evt *script)
Bytecode * evt_find_label(Evt *script, s32 arg1)
ApiStatus evt_handle_else(Evt *script)
ApiStatus evt_handle_set_group(Evt *script)
ApiStatus evt_handle_multiplyF(Evt *script)
ApiStatus evt_handle_resume(Evt *script)
ApiStatus evt_handle_if_not_AND(Evt *script)
ApiStatus evt_handle_end_if(Evt *script)
ApiStatus evt_handle_kill(Evt *script)
ApiStatus evt_handle_resume_others(Evt *script)
ApiStatus evt_handle_if_AND(Evt *script)
ApiStatus evt_handle_wait_seconds(Evt *script)
ApiStatus evt_handle_wait(Evt *script)
ApiStatus evt_handle_case_not_equal(Evt *script)
ApiStatus evt_handle_get_4_float(Evt *script)
ApiStatus evt_handle_label(Evt *script)
ApiStatus evt_handle_case_greater_equal(Evt *script)
ApiStatus evt_handle_suspend_others(Evt *script)
ApiStatus evt_handle_allocate_array(Evt *script)
ApiStatus evt_handle_divide(Evt *script)
@ EVT_OP_LOOP
Args: number of repeats (0 = infinite)
@ EVT_OP_EXEC_GET_TID
Args: EvtScript*, container.
@ EVT_OP_MOD
Args: container, expression to divide by.
@ EVT_OP_DEBUG_BREAKPOINT
@ EVT_OP_FBUF_READ2
Args: container.
@ EVT_OP_UNBIND
Unbinds any triggers bound to this script.
@ EVT_OP_ADDF
Args: container, expression to increment by.
@ EVT_OP_FBUF_READ3
Args: container, container.
@ EVT_OP_SET_PRIORITY
Args: priority.
@ EVT_OP_DIVF
Args: container, expression to divide by.
@ EVT_OP_CASE_FLAG
Args: expression to test for.
@ EVT_OP_MULF
Args: container, expression to multiply by.
@ EVT_OP_SUSPEND_OTHERS
Args: group.
@ EVT_OP_SUSPEND_THREAD
Args: ScriptID.
@ EVT_OP_GOTO
Args: index.
@ EVT_OP_EXEC
Args: EvtScript*.
@ EVT_OP_USE_ARRAY
Args: *s32.
@ EVT_OP_MUL
Args: container, expression to multiply by.
@ EVT_OP_END_CASE_GROUP
Ends the case block of EVT_OP_CASE_OR_EQ condition(s).
@ EVT_OP_IF_LE
Args: a, b.
@ EVT_OP_IF_FLAG
Args: a, b.
@ EVT_OP_SET
Args: container, expression.
@ EVT_OP_IF_NE
Args: a, b.
@ EVT_OP_CASE_EQ
Args: expression to test for.
@ EVT_OP_BITWISE_OR_CONST
Args: container, value to bitwise OR with.
@ EVT_OP_USE_FBUF
Identical to USE_BUFFER. Args: f32*.
@ EVT_OP_SETF
Args: container, expression.
@ EVT_OP_CHILD_THREAD
Parallel threads are killed as soon as the parent script returns.
@ EVT_OP_CASE_GE
Args: expression to test for.
@ EVT_OP_IF_GT
Args: a, b.
@ EVT_OP_CASE_OR_EQ
Args: expression to test for.
@ EVT_OP_END_CHILD_THREAD
@ EVT_OP_DEBUG_PRINT_VAR
Args: expression.
@ EVT_OP_BUF_READ3
Args: container, container.
@ EVT_OP_DIV
Integer division. Args: container, expression to divide by.
@ EVT_OP_EXEC_WAIT
Spawns a script and waits for it to return before continuing. Args: EvtScript*.
@ EVT_OP_BUF_READ4
Args: container, container, container.
@ EVT_OP_ADD
Args: container, expression to increment by.
@ EVT_OP_FBUF_READ4
Args: container, container, container.
@ EVT_OP_SET_TIMESCALE
Args: timescale.
@ EVT_OP_USE_BUF
Args: s32*.
@ EVT_OP_USE_FLAGS
Args: *s32.
@ EVT_OP_CASE_RANGE
Args: from, to.
@ EVT_OP_BITWISE_AND_CONST
Args: container, value to bitwise AND with.
@ EVT_OP_SUBF
Args: container, expression to decrement by.
@ EVT_OP_JUMP
Args: EvtScript*.
@ EVT_OP_CASE_AND_EQ
Args: expression to test for.
@ EVT_OP_SWITCH
Args: expression to test against.
@ EVT_OP_CASE_LE
Args: expression to test for.
@ EVT_OP_SUB
Args: container, expression to decrement by.
@ EVT_OP_IF_GE
Args: a, b.
@ EVT_OP_CALL
Args: *function, ...
@ EVT_OP_IF_NOT_FLAG
Args: a, b.
@ EVT_OP_IS_THREAD_RUNNING
Args: ScriptID, container.
@ EVT_OP_IF_LT
Args: a, b.
@ EVT_OP_SWITCH_CONST
Args: value to test against.
@ EVT_OP_CASE_NE
Args: expression to test for.
@ EVT_OP_SET_CONST
Args: container, value.
@ EVT_OP_KILL_THREAD
Args: ScriptID.
@ EVT_OP_LABEL
Args: index.
@ EVT_OP_RESUME_OTHERS
Args: group.
@ EVT_OP_RESUME_THREAD
Args: ScriptID.
@ EVT_OP_BUF_READ2
Args: container.
@ EVT_OP_RESUME_GROUP
Args: group.
@ EVT_OP_BIND_TRIGGER
Args: EvtScript*, trigger flags, s32 target, 1, Trigger*.
@ EVT_OP_BITWISE_AND
Args: container, expression to bitwise AND with.
@ EVT_OP_CASE_GT
Args: expression to test for.
@ EVT_OP_BITWISE_OR
Args: container, expression to bitwise OR with.
@ EVT_OP_SET_GROUP
Args: group.
@ EVT_OP_BIND_PADLOCK
Args: EvtScript*, trigger flags, s32 target, ItemList*, 0, 1.
@ EVT_OP_SUSPEND_GROUP
Args: group.
@ EVT_OP_CASE_LT
Args: expression to test for.
@ EVT_OP_MALLOC_ARRAY
Allocates a new array. Args: length, s32*.
@ EVT_OP_BUF_PEEK
Args: container, container, container, container.
@ EVT_OP_IF_EQ
Args: a, b.
@ EVT_OP_FBUF_PEEK
Args: container, container, container, container.
@ EVT_CMD_RESULT_CONTINUE
@ EVT_FLAG_RUN_IMMEDIATELY
don't wait for next update_scripts call
void suspend_group_others(Evt *script, s32 groupFlags)
void kill_script(Evt *instanceToKill)
void set_script_group(Evt *script, s32 groupFlags)
Evt * start_child_script(Evt *parentScript, EvtScript *source, s32 initialState)
Evt * get_script_by_index(s32 index)
s32 resume_all_group(s32 groupFlags)
s32 suspend_all_script(s32 id)
s32 is_another_trigger_bound(Trigger *, EvtScript *script)
Evt * start_script(EvtScript *source, s32 priority, s32 initialState)
Evt * start_child_thread(Evt *parentScript, Bytecode *nextLine, s32 newState)
void resume_group_others(Evt *script, s32 groupFlags)
void kill_script_by_ID(s32 id)
Trigger * create_trigger(TriggerBlueprint *def)
void set_script_timescale(Evt *script, f32 timescale)
void set_script_priority(Evt *script, s32 priority)
s32 resume_all_script(s32 id)
s32 does_script_exist(s32 id)
void delete_trigger(Trigger *toDelete)
Evt * start_script_in_group(EvtScript *source, u8 priority, u8 initialState, u8 groupFlags)
void suspend_all_group(s32 groupFlags)
Evt * restart_script(Evt *script)
void * heap_malloc(s32 size)
ApiStatus DeleteTrigger(Evt *script, b32 isInitialCall)
Removes a trigger previously bound with BindTrigger.
#define EVT_LOCAL_VAR_CUTOFF
Expressions in EVT instructions should be one of the following types:
#define EVT_INDEX_OF_AREA_BYTE(v)
#define EVT_ARRAY_VAR_CUTOFF
#define EVT_MAP_FLAG_CUTOFF
#define EVT_LOCAL_FLAG_CUTOFF
#define EVT_GAME_FLAG_CUTOFF
#define EVT_AREA_BYTE_CUTOFF
#define EVT_INDEX_OF_AREA_FLAG(v)
#define EVT_INDEX_OF_ARRAY_FLAG(v)
#define EVT_INDEX_OF_LOCAL_VAR(v)
#define EVT_INDEX_OF_ARRAY_VAR(v)
#define EVT_INDEX_OF_GAME_BYTE(v)
#define EVT_GAME_BYTE_CUTOFF
#define EVT_FIXED_TO_FLOAT(x)
Progammatically converts Float --> f32.
#define EVT_ARRAY_FLAG_CUTOFF
#define ASSERT_MSG(condition, msg, args...)
#define EVT_INDEX_OF_MAP_FLAG(v)
#define EVT_INDEX_OF_LOCAL_FLAG(v)
#define EVT_AREA_FLAG_CUTOFF
#define EVT_INDEX_OF_MAP_VAR(v)
#define EVT_MAP_VAR_CUTOFF
#define EVT_INDEX_OF_GAME_FLAG(v)
struct Evt * runningScript
GameStatus * gGameStatusPtr
s32 set_global_flag(s32 index)
s32 get_global_flag(s32 index)
s32 set_area_flag(s32 index)
s32 get_global_byte(s32 index)
Get value of saved game byte.
s32 clear_area_flag(s32 index)
s32 get_area_flag(s32 index)
s32 get_area_byte(s32 index)
s8 set_area_byte(s32 index, s32 value)
s32 clear_global_flag(s32 index)
s8 set_global_byte(s32 index, s32 value)
Set value of saved game byte.