48 s32 loopDepth = ++
script->loopDepth;
52 script->loopStartTable[loopDepth] = (s32)args;
53 script->loopCounterTable[loopDepth] =
var;
59 s32 loopDepth =
script->loopDepth;
64 loopCounter =
script->loopCounterTable[loopDepth];
66 if (loopCounter == 0) {
71 if (loopCounter >= -10000000) {
72 script->loopCounterTable[loopDepth] = --loopCounter;
79 if (loopCounter != 0) {
103 if (
script->functionTemp[0] == 0) {
107 script->functionTemp[0]--;
108 return !
script->functionTemp[0];
119 if (
script->functionTemp[0] == 0) {
123 script->functionTemp[0]--;
124 return !
script->functionTemp[0];
233 s32 switchDepth = ++
script->switchDepth;
237 script->switchBlockValue[switchDepth] = value;
238 script->switchBlockState[switchDepth] = 1;
246 s32 switchDepth = ++
script->switchDepth;
250 script->switchBlockValue[switchDepth] =
a0;
251 script->switchBlockState[switchDepth] = 1;
258 s32 switchDepth =
script->switchDepth;
260 s32 switchBlockValue;
265 switchBlockValue =
script->switchBlockValue[switchDepth];
267 if (
script->switchBlockState[switchDepth] <= 0) {
270 }
else if (
var != switchBlockValue) {
273 script->switchBlockState[switchDepth] = 0;
281 s32 switchDepth =
script->switchDepth;
283 s32 switchBlockValue;
288 switchBlockValue =
script->switchBlockValue[switchDepth];
290 if (
script->switchBlockState[switchDepth] <= 0) {
293 }
else if (
var == switchBlockValue) {
296 script->switchBlockState[switchDepth] = 0;
304 s32 switchDepth =
script->switchDepth;
306 s32 switchBlockValue;
311 switchBlockValue =
script->switchBlockValue[switchDepth];
313 if (
script->switchBlockState[switchDepth] <= 0) {
316 }
else if (
var <= switchBlockValue) {
319 script->switchBlockState[switchDepth] = 0;
327 s32 switchDepth =
script->switchDepth;
329 s32 switchBlockValue;
334 switchBlockValue =
script->switchBlockValue[switchDepth];
336 if (
script->switchBlockState[switchDepth] <= 0) {
339 }
else if (
var < switchBlockValue) {
342 script->switchBlockState[switchDepth] = 0;
350 s32 switchDepth =
script->switchDepth;
352 s32 switchBlockValue;
357 switchBlockValue =
script->switchBlockValue[switchDepth];
359 if (
script->switchBlockState[switchDepth] <= 0) {
362 }
else if (
var >= switchBlockValue) {
365 script->switchBlockState[switchDepth] = 0;
373 s32 switchDepth =
script->switchDepth;
375 s32 switchBlockValue;
380 switchBlockValue =
script->switchBlockValue[switchDepth];
382 if (
script->switchBlockState[switchDepth] <= 0) {
385 }
else if (
var > switchBlockValue) {
388 script->switchBlockState[switchDepth] = 0;
396 s32 switchDepth =
script->switchDepth;
399 s32 switchBlockValue;
406 switchBlockValue =
script->switchBlockValue[switchDepth];
408 if (
script->switchBlockState[switchDepth] <= 0) {
411 }
else if ((
var <= switchBlockValue) && (switchBlockValue <= var2)) {
412 script->switchBlockState[switchDepth] = 0;
421 s32 switchDepth =
script->switchDepth;
425 if (
script->switchBlockState[switchDepth] <= 0) {
429 script->switchBlockState[switchDepth] = 0;
437 s32 switchDepth =
script->switchDepth;
439 s32 switchBlockValue;
440 s32 switchBlockState;
445 switchBlockValue =
script->switchBlockValue[switchDepth];
446 switchBlockState =
script->switchBlockState[switchDepth];
448 if (switchBlockState <= 0) {
451 }
else if ((
var & switchBlockValue) == 0) {
454 script->switchBlockState[switchDepth] = 0;
462 s32 switchDepth =
script->switchDepth;
464 s32 switchBlockValue;
465 s32 switchBlockState;
470 switchBlockValue =
script->switchBlockValue[switchDepth];
471 switchBlockState =
script->switchBlockState[switchDepth];
473 if (switchBlockState == 0) {
476 }
else if (
var == switchBlockValue) {
477 script->switchBlockState[switchDepth] = -1;
478 }
else if (switchBlockState != -1) {
487 s32 switchDepth =
script->switchDepth;
489 s32 switchBlockValue;
490 s32 switchBlockState;
495 switchBlockValue =
script->switchBlockValue[switchDepth];
496 switchBlockState =
script->switchBlockState[switchDepth];
498 if (switchBlockState == 0) {
501 }
else if (switchBlockState == -2) {
503 }
else if (
var == switchBlockValue) {
504 script->switchBlockState[switchDepth] = -1;
506 script->switchBlockState[switchDepth] = -2;
516 if (
script->switchBlockState[
script->switchDepth] == 0) {
519 }
else if (
script->switchBlockState[
script->switchDepth] != -1) {
537 s32 switchDepth =
script->switchDepth;
541 script->switchBlockState[switchDepth] = 0;
622 result = num % result;
895 func =
script->callFunction;
899 script->ptrReadPos = args;
903 func =
script->callFunction;
994 script->varTable[0] = trigger->varTable[0];
995 script->varTable[1] = trigger->varTable[1];
996 script->varTable[2] = trigger->varTable[2];
997 script->owner2.trigger = trigger;
1114 newScript->varTable[0] = trigger->varTable[0];
1115 newScript->varTable[1] = trigger->varTable[1];
1116 newScript->varTable[2] = trigger->varTable[2];
1140 bp.itemList = itemList;
1361 switch (
script->curOpcode) {
1364 lines =
script->ptrNextLine;
1365 script->curOpcode = *lines++;
1367 script->ptrReadPos = lines;
1370 lines = &lines[
nargs];
1371 script->ptrNextLine = lines;
2129 s32 switchDepth = 1;
2148 if (switchDepth == 0) {
2157 s32 switchDepth = 1;
2176 if (switchDepth == 0) {
2191 if (switchDepth == 1) {
2216 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_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_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)
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)
Evt * func_802C39F8(Evt *parentScript, Bytecode *nextLine, s32 newState)
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.