2020-08-04 08:49:11 +02:00
|
|
|
#include "common.h"
|
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
s32 si_find_label(ScriptInstance* script, s32 arg1);
|
|
|
|
s32 si_skip_if(ScriptInstance* script);
|
|
|
|
s32 si_skip_else(ScriptInstance* script);
|
|
|
|
s32 si_goto_end_loop(ScriptInstance* script);
|
2020-10-24 23:51:27 +02:00
|
|
|
Bytecode* si_goto_end_case(ScriptInstance* script);
|
2020-10-02 08:07:54 +02:00
|
|
|
s32 si_goto_next_case(ScriptInstance* script);
|
2020-10-08 21:03:58 +02:00
|
|
|
s32 get_variable_index(ScriptInstance* script, s32 var);
|
2020-09-25 23:18:09 +02:00
|
|
|
|
2020-10-20 08:33:40 +02:00
|
|
|
f32 fixed_var_to_float(Bytecode scriptVar) {
|
2020-08-14 17:18:05 +02:00
|
|
|
if (scriptVar <= -220000000) {
|
2020-10-20 08:33:40 +02:00
|
|
|
return (scriptVar + 230000000) / 1024.0f;
|
2020-09-27 03:02:29 +02:00
|
|
|
} else {
|
|
|
|
return scriptVar;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
2020-08-18 11:27:30 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-20 08:33:40 +02:00
|
|
|
Bytecode float_to_fixed_var(f32 value) {
|
2020-08-18 11:27:30 +02:00
|
|
|
return (s32)(value * 1024.0f) - 230000000;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
ApiStatus si_handle_return(ScriptInstance* script) {
|
2020-08-14 17:18:05 +02:00
|
|
|
kill_script(script);
|
2020-08-16 08:55:51 +02:00
|
|
|
return ApiStatus_FINISH;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
ApiStatus si_handle_label(ScriptInstance* script) {
|
|
|
|
return ApiStatus_DONE2;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
ApiStatus si_handle_goto(ScriptInstance* script) {
|
2020-09-24 05:16:13 +02:00
|
|
|
script->ptrNextLine = si_find_label(script, get_variable(script, *script->ptrReadPos));
|
2020-08-16 08:55:51 +02:00
|
|
|
return ApiStatus_DONE2;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-24 05:16:13 +02:00
|
|
|
ApiStatus si_handle_loop(ScriptInstance* script) {
|
2020-10-08 21:03:58 +02:00
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
Bytecode var = *args++;
|
2020-08-19 04:36:21 +02:00
|
|
|
s32 loopDepth = ++script->loopDepth;
|
|
|
|
|
|
|
|
ASSERT(loopDepth < 8);
|
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
script->loopStartTable[loopDepth] = args;
|
2020-08-19 04:36:21 +02:00
|
|
|
script->loopCounterTable[loopDepth] = var;
|
|
|
|
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-06 21:16:17 +02:00
|
|
|
ApiStatus si_handle_end_loop(ScriptInstance* script) {
|
|
|
|
s32 loopDepth = script->loopDepth;
|
|
|
|
s32 loopCounter;
|
|
|
|
|
|
|
|
ASSERT(loopDepth >= 0);
|
|
|
|
|
|
|
|
loopCounter = script->loopCounterTable[loopDepth];
|
|
|
|
|
|
|
|
if (loopCounter == 0) {
|
|
|
|
script->ptrNextLine = script->loopStartTable[loopDepth];
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (loopCounter >= -10000000) {
|
|
|
|
script->loopCounterTable[loopDepth] = --loopCounter;
|
|
|
|
} else {
|
|
|
|
s32 var = get_variable(script, loopCounter) - 1;
|
|
|
|
set_variable(script, loopCounter, var);
|
|
|
|
loopCounter = var;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (loopCounter != 0) {
|
|
|
|
script->ptrNextLine = script->loopStartTable[loopDepth];
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
} else {
|
|
|
|
script->loopDepth--;
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
ApiStatus si_handle_break_loop(ScriptInstance* script) {
|
2020-08-17 14:09:19 +02:00
|
|
|
ASSERT(script->loopDepth >= 0);
|
2020-08-14 17:18:05 +02:00
|
|
|
script->ptrNextLine = si_goto_end_loop(script);
|
|
|
|
script->loopDepth -= 1;
|
2020-08-16 08:55:51 +02:00
|
|
|
return ApiStatus_DONE2;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-22 05:04:10 +02:00
|
|
|
ApiStatus si_handle_wait(ScriptInstance* script) {
|
|
|
|
Bytecode* ptrReadPos = script->ptrReadPos;
|
|
|
|
|
|
|
|
if (!script->blocked) {
|
2020-10-26 02:12:01 +01:00
|
|
|
script->functionTemp[0].s = get_variable(script, *ptrReadPos);
|
2020-08-22 05:04:10 +02:00
|
|
|
script->blocked = 1;
|
|
|
|
}
|
|
|
|
|
2020-10-26 02:12:01 +01:00
|
|
|
if (script->functionTemp[0].s) {
|
2020-08-24 06:18:10 +02:00
|
|
|
s32 todo = 1; // val can be anything
|
2020-08-22 05:04:10 +02:00
|
|
|
if (todo) {
|
2020-10-26 02:12:01 +01:00
|
|
|
script->functionTemp[0].s -= 1;
|
2020-08-22 05:04:10 +02:00
|
|
|
}
|
2020-10-26 02:12:01 +01:00
|
|
|
return !script->functionTemp[0].s;
|
2020-08-22 05:04:10 +02:00
|
|
|
}
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-22 05:04:10 +02:00
|
|
|
ApiStatus si_handle_wait_seconds(ScriptInstance* script) {
|
|
|
|
Bytecode* ptrReadPos = script->ptrReadPos;
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-22 05:04:10 +02:00
|
|
|
if (!script->blocked) {
|
2020-10-26 02:12:01 +01:00
|
|
|
script->functionTemp[0].s = get_float_variable(script, *ptrReadPos) * 30.0f + 0.5;
|
2020-08-22 05:04:10 +02:00
|
|
|
script->blocked = 1;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-26 02:12:01 +01:00
|
|
|
if (script->functionTemp[0].s != 0) {
|
2020-08-24 06:18:10 +02:00
|
|
|
s32 todo = 1; // val can be anything
|
2020-08-22 05:04:10 +02:00
|
|
|
if (todo) {
|
2020-10-26 02:12:01 +01:00
|
|
|
script->functionTemp[0].s -= 1;
|
2020-08-22 05:04:10 +02:00
|
|
|
}
|
2020-10-26 02:12:01 +01:00
|
|
|
return !script->functionTemp[0].s;
|
2020-08-22 05:04:10 +02:00
|
|
|
}
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus si_handle_if_equal(ScriptInstance* script) {
|
2020-10-08 21:03:58 +02:00
|
|
|
Bytecode* args = script->ptrReadPos;
|
2020-08-24 03:23:37 +02:00
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
if (get_variable(script, *args++) != get_variable(script, *args++)) {
|
2020-08-22 05:04:10 +02:00
|
|
|
script->ptrNextLine = si_skip_if(script);
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus si_handle_if_not_equal(ScriptInstance* script) {
|
2020-10-08 21:03:58 +02:00
|
|
|
Bytecode* args = script->ptrReadPos;
|
2020-08-24 03:23:37 +02:00
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
if (get_variable(script, *args++) == get_variable(script, *args++)) {
|
2020-08-22 05:04:10 +02:00
|
|
|
script->ptrNextLine = si_skip_if(script);
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-22 05:04:10 +02:00
|
|
|
ApiStatus si_handle_if_less(ScriptInstance* script) {
|
2020-10-08 21:03:58 +02:00
|
|
|
Bytecode* args = script->ptrReadPos;
|
2020-08-24 03:23:37 +02:00
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
if (get_variable(script, *args++) >= get_variable(script, *args++)) {
|
2020-08-22 05:04:10 +02:00
|
|
|
script->ptrNextLine = si_skip_if(script);
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-22 05:04:10 +02:00
|
|
|
ApiStatus si_handle_if_greater(ScriptInstance* script) {
|
2020-10-08 21:03:58 +02:00
|
|
|
Bytecode* args = script->ptrReadPos;
|
2020-08-24 03:23:37 +02:00
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
if (get_variable(script, *args++) <= get_variable(script, *args++)) {
|
2020-08-22 05:04:10 +02:00
|
|
|
script->ptrNextLine = si_skip_if(script);
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-22 05:04:10 +02:00
|
|
|
ApiStatus si_handle_if_less_equal(ScriptInstance* script) {
|
2020-10-08 21:03:58 +02:00
|
|
|
Bytecode* args = script->ptrReadPos;
|
2020-08-24 03:23:37 +02:00
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
if (get_variable(script, *args++) > get_variable(script, *args++)) {
|
2020-08-22 05:04:10 +02:00
|
|
|
script->ptrNextLine = si_skip_if(script);
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-22 05:04:10 +02:00
|
|
|
ApiStatus si_handle_if_greater_equal(ScriptInstance* script) {
|
2020-10-08 21:03:58 +02:00
|
|
|
Bytecode* args = script->ptrReadPos;
|
2020-08-24 03:23:37 +02:00
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
if (get_variable(script, *args++) < get_variable(script, *args++)) {
|
2020-08-22 05:04:10 +02:00
|
|
|
script->ptrNextLine = si_skip_if(script);
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
ApiStatus si_handle_if_AND(ScriptInstance* script) {
|
2020-10-08 21:03:58 +02:00
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
Bytecode var = *args++;
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
if ((get_variable(script, var) & *args) == 0) {
|
2020-08-14 17:18:05 +02:00
|
|
|
script->ptrNextLine = si_skip_if(script);
|
2020-08-16 08:55:51 +02:00
|
|
|
return ApiStatus_DONE2;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
2020-08-16 08:55:51 +02:00
|
|
|
return ApiStatus_DONE2;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
ApiStatus si_handle_if_not_AND(ScriptInstance* script) {
|
2020-10-08 21:03:58 +02:00
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
Bytecode var = *args++;
|
2020-08-14 17:18:05 +02:00
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
if ((get_variable(script, var) & *args) != 0) {
|
2020-08-14 17:18:05 +02:00
|
|
|
script->ptrNextLine = si_skip_if(script);
|
2020-08-16 08:55:51 +02:00
|
|
|
return ApiStatus_DONE2;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
2020-08-16 08:55:51 +02:00
|
|
|
return ApiStatus_DONE2;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
ApiStatus si_handle_else(ScriptInstance* script) {
|
2020-08-14 17:18:05 +02:00
|
|
|
script->ptrNextLine = si_skip_else(script);
|
2020-08-16 08:55:51 +02:00
|
|
|
return ApiStatus_DONE2;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
ApiStatus si_handle_end_if(ScriptInstance* script) {
|
|
|
|
return ApiStatus_DONE2;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-17 19:16:13 +02:00
|
|
|
ApiStatus si_handle_switch(ScriptInstance* script) {
|
|
|
|
Bytecode value = get_variable(script, *script->ptrReadPos);
|
2020-08-17 14:05:40 +02:00
|
|
|
s32 switchDepth = ++script->switchDepth;
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-17 14:09:19 +02:00
|
|
|
ASSERT(switchDepth < 8);
|
2020-08-19 02:55:56 +02:00
|
|
|
|
2020-08-17 14:05:40 +02:00
|
|
|
script->switchBlockValue[switchDepth] = value;
|
|
|
|
script->switchBlockState[switchDepth] = 1;
|
2020-08-16 05:19:00 +02:00
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
return ApiStatus_DONE2;
|
2020-08-17 14:05:40 +02:00
|
|
|
}
|
|
|
|
|
2020-08-17 19:16:13 +02:00
|
|
|
ApiStatus si_handle_switch_const(ScriptInstance* script) {
|
2020-10-08 21:03:58 +02:00
|
|
|
Bytecode* args = *script->ptrReadPos;
|
2020-08-17 14:05:40 +02:00
|
|
|
s32 switchDepth = ++script->switchDepth;
|
|
|
|
|
2020-08-17 14:09:19 +02:00
|
|
|
ASSERT(switchDepth < 8);
|
2020-08-17 14:05:40 +02:00
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
script->switchBlockValue[switchDepth] = args;
|
2020-08-17 14:05:40 +02:00
|
|
|
script->switchBlockState[switchDepth] = 1;
|
2020-08-17 19:16:13 +02:00
|
|
|
|
|
|
|
return ApiStatus_DONE2;
|
2020-08-17 14:05:40 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-06 21:16:17 +02:00
|
|
|
ApiStatus si_handle_case_equal(ScriptInstance* script) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
s32 switchDepth = script->switchDepth;
|
|
|
|
s32 var;
|
|
|
|
s32 switchBlockValue;
|
|
|
|
|
|
|
|
ASSERT(switchDepth >= 0);
|
|
|
|
|
|
|
|
var = get_variable(script, *args);
|
|
|
|
switchBlockValue = script->switchBlockValue[switchDepth];
|
|
|
|
|
|
|
|
if (script->switchBlockState[switchDepth] <= 0) {
|
|
|
|
script->ptrNextLine = si_goto_end_case(script);
|
|
|
|
} else if (var != switchBlockValue) {
|
|
|
|
script->ptrNextLine = si_goto_next_case(script);
|
|
|
|
} else {
|
|
|
|
script->switchBlockState[switchDepth] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
do {} while (0); // Necessary to match
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus si_handle_case_not_equal(ScriptInstance* script) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
s32 switchDepth = script->switchDepth;
|
|
|
|
s32 var;
|
|
|
|
s32 switchBlockValue;
|
|
|
|
|
|
|
|
ASSERT(switchDepth >= 0);
|
|
|
|
|
|
|
|
var = get_variable(script, *args);
|
|
|
|
switchBlockValue = script->switchBlockValue[switchDepth];
|
|
|
|
|
|
|
|
if (script->switchBlockState[switchDepth] <= 0) {
|
|
|
|
script->ptrNextLine = si_goto_end_case(script);
|
|
|
|
} else if (var == switchBlockValue) {
|
|
|
|
script->ptrNextLine = si_goto_next_case(script);
|
|
|
|
} else {
|
|
|
|
script->switchBlockState[switchDepth] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
do {} while (0); // Necessary to match
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus si_handle_case_less(ScriptInstance* script) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
s32 switchDepth = script->switchDepth;
|
|
|
|
s32 var;
|
|
|
|
s32 switchBlockValue;
|
|
|
|
|
|
|
|
ASSERT(switchDepth >= 0);
|
|
|
|
|
|
|
|
var = get_variable(script, *args);
|
|
|
|
switchBlockValue = script->switchBlockValue[switchDepth];
|
|
|
|
|
|
|
|
if (script->switchBlockState[switchDepth] <= 0) {
|
|
|
|
script->ptrNextLine = si_goto_end_case(script);
|
|
|
|
} else if (var <= switchBlockValue) {
|
|
|
|
script->ptrNextLine = si_goto_next_case(script);
|
|
|
|
} else {
|
|
|
|
script->switchBlockState[switchDepth] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
do {} while (0); // Necessary to match
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus si_handle_case_less_equal(ScriptInstance* script) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
s32 switchDepth = script->switchDepth;
|
|
|
|
s32 var;
|
|
|
|
s32 switchBlockValue;
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-06 21:16:17 +02:00
|
|
|
ASSERT(switchDepth >= 0);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-06 21:16:17 +02:00
|
|
|
var = get_variable(script, *args);
|
|
|
|
switchBlockValue = script->switchBlockValue[switchDepth];
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-06 21:16:17 +02:00
|
|
|
if (script->switchBlockState[switchDepth] <= 0) {
|
|
|
|
script->ptrNextLine = si_goto_end_case(script);
|
|
|
|
} else if (var < switchBlockValue) {
|
|
|
|
script->ptrNextLine = si_goto_next_case(script);
|
|
|
|
} else {
|
|
|
|
script->switchBlockState[switchDepth] = 0;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-06 21:16:17 +02:00
|
|
|
return ApiStatus_DONE2;
|
|
|
|
do {} while (0); // Necessary to match
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-06 21:16:17 +02:00
|
|
|
ApiStatus si_handle_case_greater(ScriptInstance* script) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
s32 switchDepth = script->switchDepth;
|
|
|
|
s32 var;
|
|
|
|
s32 switchBlockValue;
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-06 21:16:17 +02:00
|
|
|
ASSERT(switchDepth >= 0);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-06 21:16:17 +02:00
|
|
|
var = get_variable(script, *args);
|
|
|
|
switchBlockValue = script->switchBlockValue[switchDepth];
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-06 21:16:17 +02:00
|
|
|
if (script->switchBlockState[switchDepth] <= 0) {
|
|
|
|
script->ptrNextLine = si_goto_end_case(script);
|
|
|
|
} else if (var >= switchBlockValue) {
|
|
|
|
script->ptrNextLine = si_goto_next_case(script);
|
|
|
|
} else {
|
|
|
|
script->switchBlockState[switchDepth] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
do {} while (0); // Necessary to match
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-06 21:16:17 +02:00
|
|
|
ApiStatus si_handle_case_greater_equal(ScriptInstance* script) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
s32 switchDepth = script->switchDepth;
|
|
|
|
s32 var;
|
|
|
|
s32 switchBlockValue;
|
|
|
|
|
|
|
|
ASSERT(switchDepth >= 0);
|
|
|
|
|
|
|
|
var = get_variable(script, *args);
|
|
|
|
switchBlockValue = script->switchBlockValue[switchDepth];
|
|
|
|
|
|
|
|
if (script->switchBlockState[switchDepth] <= 0) {
|
|
|
|
script->ptrNextLine = si_goto_end_case(script);
|
|
|
|
} else if (var > switchBlockValue) {
|
|
|
|
script->ptrNextLine = si_goto_next_case(script);
|
|
|
|
} else {
|
|
|
|
script->switchBlockState[switchDepth] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
do {} while (0); // Necessary to match
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus si_handle_case_range(ScriptInstance* script) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
s32 switchDepth = script->switchDepth;
|
|
|
|
s32 var;
|
|
|
|
s32 var2;
|
|
|
|
s32 switchBlockValue;
|
|
|
|
|
|
|
|
ASSERT(switchDepth >= 0);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-06 21:16:17 +02:00
|
|
|
var = get_variable(script, *args++);
|
|
|
|
var2 = get_variable(script, *args++);
|
|
|
|
|
|
|
|
switchBlockValue = script->switchBlockValue[switchDepth];
|
|
|
|
|
|
|
|
if (script->switchBlockState[switchDepth] <= 0) {
|
|
|
|
script->ptrNextLine = si_goto_end_case(script);
|
|
|
|
} else if ((var <= switchBlockValue) && (switchBlockValue <= var2)) {
|
|
|
|
script->switchBlockState[switchDepth] = 0;
|
|
|
|
} else {
|
|
|
|
script->ptrNextLine = si_goto_next_case(script);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
do {} while (0); // Necessary to match
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-18 03:28:34 +02:00
|
|
|
ApiStatus si_handle_case_default(ScriptInstance* script) {
|
|
|
|
s32 switchDepth = script->switchDepth;
|
|
|
|
|
|
|
|
ASSERT(switchDepth >= 0);
|
|
|
|
|
|
|
|
if (script->switchBlockState[switchDepth] > 0) {
|
|
|
|
script->switchBlockState[switchDepth] = 0;
|
|
|
|
} else {
|
|
|
|
script->ptrNextLine = si_goto_end_case(script);
|
|
|
|
}
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
do {} while (0); // Necessary to match
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-02 08:07:54 +02:00
|
|
|
ApiStatus si_handle_case_AND(ScriptInstance* script) {
|
2020-10-03 22:20:12 +02:00
|
|
|
Bytecode* args = script->ptrReadPos;
|
2020-10-06 21:16:17 +02:00
|
|
|
s32 switchDepth = script->switchDepth;
|
|
|
|
s32 var;
|
2020-10-02 08:07:54 +02:00
|
|
|
s32 switchBlockValue;
|
2020-10-24 06:23:16 +02:00
|
|
|
s32 switchBlockState;
|
2020-10-03 22:20:12 +02:00
|
|
|
|
2020-10-06 21:16:17 +02:00
|
|
|
ASSERT(switchDepth >= 0);
|
2020-10-02 08:07:54 +02:00
|
|
|
|
2020-10-06 21:16:17 +02:00
|
|
|
var = *args;
|
|
|
|
switchBlockValue = script->switchBlockValue[switchDepth];
|
2020-10-24 06:23:16 +02:00
|
|
|
switchBlockState = script->switchBlockState[switchDepth];
|
2020-10-02 08:07:54 +02:00
|
|
|
|
2020-10-24 06:23:16 +02:00
|
|
|
if (switchBlockState <= 0) {
|
2020-10-02 08:07:54 +02:00
|
|
|
script->ptrNextLine = si_goto_end_case(script);
|
2020-10-06 21:16:17 +02:00
|
|
|
} else if ((var & switchBlockValue) == 0) {
|
2020-10-03 22:20:12 +02:00
|
|
|
script->ptrNextLine = si_goto_next_case(script);
|
2020-10-06 21:16:17 +02:00
|
|
|
} else {
|
|
|
|
script->switchBlockState[switchDepth] = 0;
|
2020-10-02 08:07:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return ApiStatus_DONE2;
|
2020-10-24 06:23:16 +02:00
|
|
|
do {} while (0); // Necessary to match
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus si_handle_case_equal_OR(ScriptInstance* script) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
s32 switchDepth = script->switchDepth;
|
|
|
|
s32 var;
|
|
|
|
s32 switchBlockValue;
|
|
|
|
s32 switchBlockState;
|
|
|
|
|
|
|
|
ASSERT(switchDepth >= 0);
|
|
|
|
|
|
|
|
var = get_variable(script, *args);
|
|
|
|
switchBlockValue = script->switchBlockValue[switchDepth];
|
|
|
|
switchBlockState = script->switchBlockState[switchDepth];
|
|
|
|
|
|
|
|
if (switchBlockState == 0) {
|
|
|
|
script->ptrNextLine = si_goto_end_case(script);
|
|
|
|
} else if (var == switchBlockValue) {
|
|
|
|
script->switchBlockState[switchDepth] = -1;
|
|
|
|
} else if (switchBlockState != -1) {
|
|
|
|
script->ptrNextLine = si_goto_next_case(script);
|
|
|
|
}
|
2020-10-06 21:16:17 +02:00
|
|
|
|
2020-10-24 06:23:16 +02:00
|
|
|
return ApiStatus_DONE2;
|
2020-10-02 08:07:54 +02:00
|
|
|
do {} while (0); // Necessary to match
|
|
|
|
}
|
2020-10-06 21:16:17 +02:00
|
|
|
|
2020-10-24 06:23:16 +02:00
|
|
|
ApiStatus si_handle_case_equal_AND(ScriptInstance* script) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
s32 switchDepth = script->switchDepth;
|
|
|
|
s32 var;
|
|
|
|
s32 switchBlockValue;
|
|
|
|
s32 switchBlockState;
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-24 06:23:16 +02:00
|
|
|
ASSERT(switchDepth >= 0);
|
|
|
|
|
|
|
|
var = get_variable(script, *args);
|
|
|
|
switchBlockValue = script->switchBlockValue[switchDepth];
|
|
|
|
switchBlockState = script->switchBlockState[switchDepth];
|
|
|
|
|
|
|
|
if (switchBlockState == 0) {
|
|
|
|
script->ptrNextLine = si_goto_end_case(script);
|
|
|
|
} else if (switchBlockState == -2) {
|
|
|
|
script->ptrNextLine = si_goto_next_case(script);
|
2020-10-24 06:25:25 +02:00
|
|
|
} else if (var == switchBlockValue) {
|
2020-10-24 06:23:16 +02:00
|
|
|
script->switchBlockState[switchDepth] = -1;
|
|
|
|
} else {
|
|
|
|
script->switchBlockState[switchDepth] = -2;
|
|
|
|
script->ptrNextLine = si_goto_next_case(script);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
do {} while (0); // Necessary to match
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-02 08:07:54 +02:00
|
|
|
ApiStatus si_handle_end_case_group(ScriptInstance* script) {
|
|
|
|
ASSERT(script->switchDepth >= 0);
|
|
|
|
|
|
|
|
if (script->switchBlockState[script->switchDepth] == 0) {
|
|
|
|
script->ptrNextLine = si_goto_end_case(script);
|
|
|
|
} else if (script->switchBlockState[script->switchDepth] != -1) {
|
|
|
|
script->switchBlockState[script->switchDepth] = 1;
|
|
|
|
script->ptrNextLine = si_goto_next_case(script);
|
|
|
|
} else {
|
|
|
|
script->switchBlockState[script->switchDepth] = 0;
|
|
|
|
script->ptrNextLine = si_goto_end_case(script);
|
|
|
|
}
|
2020-10-03 22:20:12 +02:00
|
|
|
|
2020-10-02 08:07:54 +02:00
|
|
|
return ApiStatus_DONE2;
|
2020-10-06 21:16:17 +02:00
|
|
|
|
2020-10-02 08:07:54 +02:00
|
|
|
do {} while (0); // Necessary to match
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
ApiStatus si_handle_break_case(ScriptInstance* script) {
|
2020-08-17 14:09:19 +02:00
|
|
|
ASSERT(script->switchDepth >= 0);
|
2020-08-14 17:18:05 +02:00
|
|
|
script->ptrNextLine = si_goto_end_case(script);
|
2020-08-16 08:55:51 +02:00
|
|
|
return ApiStatus_DONE2;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
ApiStatus si_handle_end_switch(ScriptInstance* script) {
|
2020-08-14 17:18:05 +02:00
|
|
|
s32 switchDepth = script->switchDepth;
|
2020-08-19 02:55:56 +02:00
|
|
|
|
2020-08-17 14:09:19 +02:00
|
|
|
ASSERT(switchDepth >= 0);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-17 19:27:37 +02:00
|
|
|
script->switchBlockState[switchDepth] = 0;
|
2020-08-14 17:18:05 +02:00
|
|
|
script->switchDepth -= 1;
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-17 19:16:13 +02:00
|
|
|
return ApiStatus_DONE2;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
ApiStatus si_handle_set_var(ScriptInstance* script) {
|
2020-10-08 21:03:58 +02:00
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
s32 curPtrReadPos = args[0];
|
2020-08-14 17:18:05 +02:00
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
set_variable(script, curPtrReadPos, get_variable(script, args[1]));
|
2020-08-16 08:55:51 +02:00
|
|
|
return ApiStatus_DONE2;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
ApiStatus si_handle_set_const(ScriptInstance* script) {
|
2020-08-14 17:18:05 +02:00
|
|
|
set_variable(script, *script->ptrReadPos, script->ptrReadPos[1]);
|
2020-08-16 08:55:51 +02:00
|
|
|
return ApiStatus_DONE2;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
ApiStatus si_handle_set_float(ScriptInstance* script) {
|
2020-10-08 21:03:58 +02:00
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
Bytecode var = *args++;
|
2020-08-14 17:18:05 +02:00
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
set_float_variable(script, var, get_float_variable(script, *args));
|
2020-08-16 08:55:51 +02:00
|
|
|
return ApiStatus_DONE2;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-24 06:16:43 +02:00
|
|
|
ApiStatus si_handle_add(ScriptInstance* script) {
|
2020-10-08 21:03:58 +02:00
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
Bytecode var = *args++;
|
|
|
|
s32 result = get_variable(script, *args++);
|
2020-08-24 06:16:43 +02:00
|
|
|
s32 addend = get_variable(script, var);
|
|
|
|
|
|
|
|
result += addend;
|
|
|
|
|
|
|
|
set_variable(script, var, result);
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus si_handle_subtract(ScriptInstance* script) {
|
2020-10-08 21:03:58 +02:00
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
Bytecode var = *args++;
|
|
|
|
s32 result = get_variable(script, *args++);
|
2020-08-24 06:16:43 +02:00
|
|
|
s32 minuend = get_variable(script, var);
|
|
|
|
|
|
|
|
result = minuend - result;
|
|
|
|
|
|
|
|
set_variable(script, var, result);
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus si_handle_multiply(ScriptInstance* script) {
|
2020-10-08 21:03:58 +02:00
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
Bytecode var = *args++;
|
|
|
|
s32 result = get_variable(script, *args++);
|
2020-08-24 06:16:43 +02:00
|
|
|
s32 multiplier = get_variable(script, var);
|
|
|
|
|
|
|
|
result *= multiplier;
|
|
|
|
|
|
|
|
set_variable(script, var, result);
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus si_handle_divide(ScriptInstance* script) {
|
2020-10-08 21:03:58 +02:00
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
Bytecode var = *args++;
|
|
|
|
s32 result = get_variable(script, *args++);
|
2020-08-24 06:16:43 +02:00
|
|
|
s32 dividend = get_variable(script, var);
|
|
|
|
|
|
|
|
result = dividend / result;
|
|
|
|
|
|
|
|
set_variable(script, var, result);
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-08-22 05:04:10 +02:00
|
|
|
|
2020-08-24 06:16:43 +02:00
|
|
|
ApiStatus si_handle_mod(ScriptInstance* script) {
|
2020-10-08 21:03:58 +02:00
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
Bytecode var = *args++;
|
|
|
|
s32 result = get_variable(script, *args++) + 0.5;
|
2020-08-24 06:16:43 +02:00
|
|
|
s32 num = get_variable(script, var) + 0.5;
|
|
|
|
|
|
|
|
result = num % result;
|
|
|
|
|
|
|
|
set_variable(script, var, result);
|
2020-08-22 05:04:10 +02:00
|
|
|
return ApiStatus_DONE2;
|
2020-08-24 06:16:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus si_handle_addF(ScriptInstance* script) {
|
2020-10-08 21:03:58 +02:00
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
Bytecode var = *args++;
|
|
|
|
f32 result = get_float_variable(script, *args++);
|
2020-08-24 06:16:43 +02:00
|
|
|
f32 addend = get_float_variable(script, var);
|
|
|
|
|
|
|
|
result += addend;
|
|
|
|
|
|
|
|
set_float_variable(script, var, result);
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus si_handle_subtractF(ScriptInstance* script) {
|
2020-10-08 21:03:58 +02:00
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
Bytecode var = *args++;
|
|
|
|
f32 result = get_float_variable(script, *args++);
|
2020-08-24 06:16:43 +02:00
|
|
|
f32 minuend = get_float_variable(script, var);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-24 06:16:43 +02:00
|
|
|
result = minuend - result;
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-24 06:16:43 +02:00
|
|
|
set_float_variable(script, var, result);
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-24 06:16:43 +02:00
|
|
|
ApiStatus si_handle_multiplyF(ScriptInstance* script) {
|
2020-10-08 21:03:58 +02:00
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
Bytecode var = *args++;
|
|
|
|
f32 result = get_float_variable(script, *args++);
|
2020-08-24 06:16:43 +02:00
|
|
|
f32 multiplier = get_float_variable(script, var);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-24 06:16:43 +02:00
|
|
|
result *= multiplier;
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-24 06:16:43 +02:00
|
|
|
set_float_variable(script, var, result);
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus si_handle_divideF(ScriptInstance* script) {
|
2020-10-08 21:03:58 +02:00
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
Bytecode var = *args++;
|
|
|
|
f32 result = get_float_variable(script, *args++);
|
2020-08-24 06:16:43 +02:00
|
|
|
f32 dividend = get_float_variable(script, var);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-24 06:16:43 +02:00
|
|
|
result = dividend / result;
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-24 06:16:43 +02:00
|
|
|
set_float_variable(script, var, result);
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
ApiStatus si_handle_set_int_buffer_ptr(ScriptInstance* script) {
|
2020-08-14 17:18:05 +02:00
|
|
|
script->buffer = get_variable(script, *script->ptrReadPos);
|
2020-08-16 08:55:51 +02:00
|
|
|
return ApiStatus_DONE2;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
ApiStatus si_handle_set_float_buffer_ptr(ScriptInstance* script) {
|
2020-08-14 17:18:05 +02:00
|
|
|
script->buffer = get_variable(script, *script->ptrReadPos);
|
2020-08-16 08:55:51 +02:00
|
|
|
return ApiStatus_DONE2;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
ApiStatus si_handle_get_1_word(ScriptInstance* script) {
|
2020-10-08 21:03:58 +02:00
|
|
|
Bytecode* args = script->ptrReadPos;
|
2020-08-19 04:36:21 +02:00
|
|
|
Bytecode var;
|
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
var = *args++;
|
2020-08-19 04:36:21 +02:00
|
|
|
set_variable(script, var, *script->buffer++);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
return ApiStatus_DONE2;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-19 04:36:21 +02:00
|
|
|
ApiStatus si_handle_get_2_word(ScriptInstance* script) {
|
2020-10-08 21:03:58 +02:00
|
|
|
Bytecode* args = script->ptrReadPos;
|
2020-08-19 04:36:21 +02:00
|
|
|
Bytecode var;
|
|
|
|
Bytecode var2;
|
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
var = *args++;
|
2020-08-19 04:36:21 +02:00
|
|
|
set_variable(script, var, *script->buffer++);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
var2 = *args++;
|
2020-08-19 04:36:21 +02:00
|
|
|
set_variable(script, var2, *script->buffer++);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
return ApiStatus_DONE2;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-19 04:36:21 +02:00
|
|
|
ApiStatus si_handle_get_3_word(ScriptInstance* script) {
|
2020-10-08 21:03:58 +02:00
|
|
|
Bytecode* args = script->ptrReadPos;
|
2020-08-19 04:36:21 +02:00
|
|
|
Bytecode var;
|
|
|
|
Bytecode var2;
|
|
|
|
Bytecode var3;
|
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
var = *args++;
|
2020-08-19 04:36:21 +02:00
|
|
|
set_variable(script, var, *script->buffer++);
|
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
var2 = *args++;
|
2020-08-19 04:36:21 +02:00
|
|
|
set_variable(script, var2, *script->buffer++);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
var3 = *args++;
|
2020-08-19 04:36:21 +02:00
|
|
|
set_variable(script, var3, *script->buffer++);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-19 04:36:21 +02:00
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus si_handle_get_4_word(ScriptInstance* script) {
|
2020-10-08 21:03:58 +02:00
|
|
|
Bytecode* args = script->ptrReadPos;
|
2020-08-19 04:36:21 +02:00
|
|
|
Bytecode var;
|
|
|
|
Bytecode var2;
|
|
|
|
Bytecode var3;
|
|
|
|
Bytecode var4;
|
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
var = *args++;
|
2020-08-19 04:36:21 +02:00
|
|
|
set_variable(script, var, *script->buffer++);
|
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
var2 = *args++;
|
2020-08-19 04:36:21 +02:00
|
|
|
set_variable(script, var2, *script->buffer++);
|
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
var3 = *args++;
|
2020-08-19 04:36:21 +02:00
|
|
|
set_variable(script, var3, *script->buffer++);
|
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
var4 = *args++;
|
2020-08-19 04:36:21 +02:00
|
|
|
set_variable(script, var4, *script->buffer++);
|
|
|
|
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
ApiStatus si_handle_get_Nth_word(ScriptInstance* script) {
|
2020-10-08 21:03:58 +02:00
|
|
|
Bytecode* args = script->ptrReadPos;
|
2020-08-19 04:36:21 +02:00
|
|
|
Bytecode var;
|
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
var = *args++;
|
|
|
|
set_variable(script, var, script->buffer[get_variable(script, *args)]);
|
2020-08-14 17:18:05 +02:00
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
return ApiStatus_DONE2;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-19 04:36:21 +02:00
|
|
|
ApiStatus si_handle_get_1_float(ScriptInstance* script) {
|
2020-10-08 21:03:58 +02:00
|
|
|
Bytecode* args = script->ptrReadPos;
|
2020-08-19 04:36:21 +02:00
|
|
|
Bytecode var;
|
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
var = *args++;
|
2020-08-19 04:36:21 +02:00
|
|
|
set_float_variable(script, var, get_float_variable(script, *script->buffer++));
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-19 04:36:21 +02:00
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-19 04:36:21 +02:00
|
|
|
ApiStatus si_handle_get_2_float(ScriptInstance* script) {
|
2020-10-08 21:03:58 +02:00
|
|
|
Bytecode* args = script->ptrReadPos;
|
2020-08-19 04:36:21 +02:00
|
|
|
Bytecode var;
|
|
|
|
Bytecode var2;
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
var = *args++;
|
2020-08-19 04:36:21 +02:00
|
|
|
set_float_variable(script, var, get_float_variable(script, *script->buffer++));
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
var2 = *args++;
|
2020-08-19 04:36:21 +02:00
|
|
|
set_float_variable(script, var2, get_float_variable(script, *script->buffer++));
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-19 04:36:21 +02:00
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus si_handle_get_3_float(ScriptInstance* script) {
|
2020-10-08 21:03:58 +02:00
|
|
|
Bytecode* args = script->ptrReadPos;
|
2020-08-19 04:36:21 +02:00
|
|
|
Bytecode var;
|
|
|
|
Bytecode var2;
|
|
|
|
Bytecode var3;
|
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
var = *args++;
|
2020-08-19 04:36:21 +02:00
|
|
|
set_float_variable(script, var, get_float_variable(script, *script->buffer++));
|
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
var2 = *args++;
|
2020-08-19 04:36:21 +02:00
|
|
|
set_float_variable(script, var2, get_float_variable(script, *script->buffer++));
|
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
var3 = *args++;
|
2020-08-19 04:36:21 +02:00
|
|
|
set_float_variable(script, var3, get_float_variable(script, *script->buffer++));
|
2020-08-14 17:18:05 +02:00
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
return ApiStatus_DONE2;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-19 04:36:21 +02:00
|
|
|
ApiStatus si_handle_get_4_float(ScriptInstance* script) {
|
2020-10-08 21:03:58 +02:00
|
|
|
Bytecode* args = script->ptrReadPos;
|
2020-08-19 04:36:21 +02:00
|
|
|
Bytecode var;
|
|
|
|
Bytecode var2;
|
|
|
|
Bytecode var3;
|
|
|
|
Bytecode var4;
|
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
var = *args++;
|
2020-08-19 04:36:21 +02:00
|
|
|
set_float_variable(script, var, get_float_variable(script, *script->buffer++));
|
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
var2 = *args++;
|
2020-08-19 04:36:21 +02:00
|
|
|
set_float_variable(script, var2, get_float_variable(script, *script->buffer++));
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
var3 = *args++;
|
2020-08-19 04:36:21 +02:00
|
|
|
set_float_variable(script, var3, get_float_variable(script, *script->buffer++));
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
var4 = *args++;
|
2020-08-19 04:36:21 +02:00
|
|
|
set_float_variable(script, var4, get_float_variable(script, *script->buffer++));
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-19 04:36:21 +02:00
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-19 04:36:21 +02:00
|
|
|
ApiStatus si_handle_get_Nth_float(ScriptInstance* script) {
|
2020-10-08 21:03:58 +02:00
|
|
|
Bytecode* args = script->ptrReadPos;
|
2020-08-19 04:36:21 +02:00
|
|
|
Bytecode var;
|
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
var = *args++;
|
|
|
|
set_float_variable(script, var, script->buffer[get_variable(script, *args)]);
|
2020-08-19 04:36:21 +02:00
|
|
|
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
ApiStatus si_handle_set_array(ScriptInstance* script) {
|
2020-08-19 02:23:52 +02:00
|
|
|
script->array = (s32*)get_variable(script, *script->ptrReadPos);
|
2020-08-16 08:55:51 +02:00
|
|
|
return ApiStatus_DONE2;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
ApiStatus si_handle_set_flag_array(ScriptInstance* script) {
|
2020-08-19 02:23:52 +02:00
|
|
|
script->flagArray = (s32*)get_variable(script, *script->ptrReadPos);
|
2020-08-16 08:55:51 +02:00
|
|
|
return ApiStatus_DONE2;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-27 00:54:55 +02:00
|
|
|
ApiStatus si_handle_allocate_array(ScriptInstance* script) {
|
2020-10-08 21:03:58 +02:00
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
s32 size = get_variable(script, *args++);
|
|
|
|
Bytecode var = *args++;
|
2020-08-27 00:54:55 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
script->array = (s32)heap_malloc(size * 4);
|
|
|
|
set_variable(script, var, (s32)script->array);
|
2020-08-27 00:54:55 +02:00
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
ApiStatus si_handle_AND(ScriptInstance* script) {
|
|
|
|
Bytecode var = script->ptrReadPos[0];
|
|
|
|
s32 val = get_variable(script, script->ptrReadPos[1]);
|
|
|
|
|
|
|
|
val &= get_variable(script, var);
|
|
|
|
set_variable(script, var, val);
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
ApiStatus si_handle_AND_const(ScriptInstance* script) {
|
|
|
|
Bytecode* ptrReadPos = script->ptrReadPos;
|
2020-08-27 00:54:55 +02:00
|
|
|
// todo improve
|
2020-08-19 02:21:04 +02:00
|
|
|
s32 constant = ptrReadPos[0]; // NOLINT
|
|
|
|
s32 var = ptrReadPos[0];
|
|
|
|
|
|
|
|
constant = ptrReadPos[1];
|
2020-08-14 17:18:05 +02:00
|
|
|
|
2020-08-19 02:21:04 +02:00
|
|
|
set_variable(script, var, constant & get_variable(script, var));
|
2020-08-16 08:55:51 +02:00
|
|
|
return ApiStatus_DONE2;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
ApiStatus si_handle_OR(ScriptInstance* script) {
|
|
|
|
Bytecode var = script->ptrReadPos[0];
|
|
|
|
s32 val = get_variable(script, script->ptrReadPos[1]);
|
|
|
|
|
|
|
|
val |= get_variable(script, var);
|
|
|
|
set_variable(script, var, val);
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
ApiStatus si_handle_OR_const(ScriptInstance* script) {
|
|
|
|
Bytecode* ptrReadPos = script->ptrReadPos;
|
2020-08-27 00:54:55 +02:00
|
|
|
// todo improve
|
2020-08-19 02:21:04 +02:00
|
|
|
s32 constant = ptrReadPos[0]; // NOLINT
|
|
|
|
s32 var = ptrReadPos[0];
|
2020-08-14 17:18:05 +02:00
|
|
|
|
2020-08-19 02:21:04 +02:00
|
|
|
constant = ptrReadPos[1];
|
|
|
|
|
|
|
|
set_variable(script, var, constant | get_variable(script, var));
|
2020-08-16 08:55:51 +02:00
|
|
|
return ApiStatus_DONE2;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-02 08:07:54 +02:00
|
|
|
ApiStatus si_handle_call(ScriptInstance* script) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
s32 isInitialCall;
|
|
|
|
ApiFunc func;
|
2020-10-03 22:20:12 +02:00
|
|
|
ScriptInstance* newScript; // todo fake match
|
2020-10-02 08:07:54 +02:00
|
|
|
|
|
|
|
if (script->blocked) {
|
|
|
|
isInitialCall = FALSE;
|
|
|
|
func = script->callFunction;
|
2020-10-03 22:20:12 +02:00
|
|
|
newScript = script; // todo fake match
|
2020-10-02 08:07:54 +02:00
|
|
|
} else {
|
2020-10-06 21:16:17 +02:00
|
|
|
script->callFunction = (ApiFunc)get_variable(script, *args++);
|
2020-10-03 22:20:12 +02:00
|
|
|
newScript = script; // todo fake match
|
2020-10-02 08:07:54 +02:00
|
|
|
script->ptrReadPos = args;
|
2020-10-08 21:03:58 +02:00
|
|
|
script->currentArgc--;
|
2020-10-02 08:07:54 +02:00
|
|
|
script->blocked = TRUE;
|
|
|
|
isInitialCall = TRUE;
|
|
|
|
func = script->callFunction;
|
|
|
|
}
|
2020-10-03 22:20:12 +02:00
|
|
|
|
|
|
|
return func(newScript, isInitialCall); // todo fake match
|
2020-10-02 08:07:54 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
ApiStatus si_handle_exec1(ScriptInstance* script) {
|
2020-10-06 21:16:17 +02:00
|
|
|
ScriptInstance* newScript;
|
|
|
|
s32 i;
|
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
newScript = start_script_in_group((ScriptInstance*)get_variable(script, *script->ptrReadPos), script->priority, 0,
|
|
|
|
script->groupFlags);
|
|
|
|
|
2020-10-21 01:02:05 +02:00
|
|
|
newScript->owner1 = script->owner1;
|
|
|
|
newScript->owner2 = script->owner2;
|
2020-10-06 21:16:17 +02:00
|
|
|
|
|
|
|
i = 0;
|
|
|
|
while (i < ARRAY_COUNT(script->varTable)) {
|
|
|
|
newScript->varTable[i] = script->varTable[i++];
|
|
|
|
}
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
while (i < ARRAY_COUNT(script->varFlags)) {
|
|
|
|
newScript->varFlags[i] = script->varFlags[i++];
|
|
|
|
}
|
|
|
|
|
|
|
|
newScript->array = script->array;
|
|
|
|
newScript->flagArray = script->flagArray;
|
2020-10-08 21:03:58 +02:00
|
|
|
|
2020-10-06 21:16:17 +02:00
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
ApiStatus si_handle_exec2(ScriptInstance* script) {
|
2020-10-06 21:16:17 +02:00
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
ScriptInstance* var = (ScriptInstance*)get_variable(script, *args++);
|
|
|
|
Bytecode arg2 = *args++;
|
|
|
|
ScriptInstance* newScript;
|
|
|
|
s32 i;
|
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
newScript = start_script_in_group(var, script->priority, 0, script->groupFlags);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-21 01:02:05 +02:00
|
|
|
newScript->owner1 = script->owner1;
|
|
|
|
newScript->owner2 = script->owner2;
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-10 05:18:32 +02:00
|
|
|
for (i = 0; i < ARRAY_COUNT(script->varTable); i++) {
|
|
|
|
newScript->varTable[i] = script->varTable[i];
|
2020-10-06 21:16:17 +02:00
|
|
|
}
|
|
|
|
|
2020-10-10 05:18:32 +02:00
|
|
|
for (i = 0; i < ARRAY_COUNT(script->varFlags); i++) {
|
|
|
|
newScript->varFlags[i] = script->varFlags[i];
|
2020-10-06 21:16:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
newScript->array = script->array;
|
|
|
|
newScript->flagArray = script->flagArray;
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-20 08:33:40 +02:00
|
|
|
set_variable(script, arg2, newScript->id);
|
2020-10-08 21:03:58 +02:00
|
|
|
|
2020-10-06 21:16:17 +02:00
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
ApiStatus si_handle_exec_wait(ScriptInstance* script) {
|
2020-08-14 17:18:05 +02:00
|
|
|
start_child_script(script, get_variable(script, *script->ptrReadPos), 0);
|
|
|
|
script->currentOpcode = 0;
|
2020-10-02 08:07:54 +02:00
|
|
|
return ApiStatus_FINISH;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
ApiStatus si_handle_jump(ScriptInstance* script) {
|
2020-08-19 02:23:52 +02:00
|
|
|
script->ptrFirstLine = (Bytecode*)get_variable(script, *script->ptrReadPos);
|
2020-08-14 17:18:05 +02:00
|
|
|
restart_script(script);
|
2020-08-16 08:55:51 +02:00
|
|
|
return ApiStatus_DONE2;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
s32 _bound_script_trigger_handler(Trigger* trigger) {
|
|
|
|
Bytecode* scriptStart;
|
|
|
|
ScriptInstance* script;
|
|
|
|
|
|
|
|
if (trigger->runningScript == NULL) {
|
|
|
|
scriptStart = trigger->scriptStart;
|
|
|
|
if (is_trigger_bound(trigger, scriptStart)) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
script = start_script(scriptStart, trigger->priority, 0x20);
|
|
|
|
trigger->runningScript = script;
|
2020-10-20 08:33:40 +02:00
|
|
|
trigger->runningScriptID = script->id;
|
2020-10-08 21:03:58 +02:00
|
|
|
script->varTable[0] = trigger->scriptVars[0];
|
|
|
|
script->varTable[1] = trigger->scriptVars[1];
|
|
|
|
script->varTable[2] = trigger->scriptVars[2];
|
2020-10-21 01:02:05 +02:00
|
|
|
script->owner2.trigger = trigger;
|
2020-10-08 21:03:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!does_script_exist(trigger->runningScriptID)) {
|
|
|
|
trigger->runningScript = NULL;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
ApiStatus si_handle_bind(ScriptInstance* script) {
|
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
Trigger* trigger;
|
2020-10-19 03:20:07 +02:00
|
|
|
Bytecode* triggerScript = get_variable(script, *args++);
|
|
|
|
Bytecode eventType = *args++;
|
|
|
|
Bytecode colliderIDVar = *args++;
|
2020-10-08 21:03:58 +02:00
|
|
|
Bytecode a3 = *args++;
|
2020-10-19 03:20:07 +02:00
|
|
|
Bytecode triggerOut = *args++;
|
2020-10-08 21:03:58 +02:00
|
|
|
TriggerDefinition def;
|
|
|
|
|
2020-10-19 03:20:07 +02:00
|
|
|
def.flags = eventType | 0x1000000;
|
|
|
|
def.flagIndex = get_variable(script, colliderIDVar);
|
|
|
|
def.colliderIndex = get_variable_index(script, colliderIDVar);
|
2020-10-08 21:03:58 +02:00
|
|
|
def.inputArg3 = a3;
|
|
|
|
def.unk_14 = 0;
|
|
|
|
def.function = _bound_script_trigger_handler;
|
|
|
|
|
|
|
|
trigger = create_trigger(&def);
|
2020-10-19 03:20:07 +02:00
|
|
|
trigger->scriptStart = triggerScript;
|
2020-10-08 21:03:58 +02:00
|
|
|
trigger->runningScript = NULL;
|
|
|
|
trigger->priority = script->priority;
|
|
|
|
trigger->scriptVars[0] = get_variable(script, script->varTable[0]);
|
|
|
|
trigger->scriptVars[1] = get_variable(script, script->varTable[1]);
|
|
|
|
trigger->scriptVars[2] = get_variable(script, script->varTable[2]);
|
|
|
|
|
2020-10-19 03:20:07 +02:00
|
|
|
if (triggerOut != 0) {
|
|
|
|
set_variable(script, triggerOut, trigger);
|
2020-10-08 21:03:58 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
ApiStatus DeleteTrigger(ScriptInstance* script, s32 isInitialCall) {
|
2020-08-14 17:18:05 +02:00
|
|
|
delete_trigger(get_variable(script, *script->ptrReadPos));
|
2020-08-16 08:55:51 +02:00
|
|
|
return ApiStatus_DONE2;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
ApiStatus si_handle_unbind(ScriptInstance* script) {
|
2020-10-21 01:02:05 +02:00
|
|
|
delete_trigger(script->owner2.trigger);
|
2020-08-16 08:55:51 +02:00
|
|
|
return ApiStatus_DONE2;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
ApiStatus si_handle_kill(ScriptInstance* script) {
|
2020-08-14 17:18:05 +02:00
|
|
|
kill_script_by_ID(get_variable(script, *script->ptrReadPos));
|
2020-08-16 08:55:51 +02:00
|
|
|
return ApiStatus_DONE2;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
ApiStatus si_handle_set_priority(ScriptInstance* script) {
|
2020-08-14 17:18:05 +02:00
|
|
|
set_script_priority(script, get_variable(script, *script->ptrReadPos));
|
2020-08-16 08:55:51 +02:00
|
|
|
return ApiStatus_DONE2;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
ApiStatus si_handle_set_timescale(ScriptInstance* script) {
|
2020-08-14 17:18:05 +02:00
|
|
|
set_script_timescale(script, get_float_variable(script, *script->ptrReadPos));
|
2020-08-16 08:55:51 +02:00
|
|
|
return ApiStatus_DONE2;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
ApiStatus si_handle_set_group(ScriptInstance* script) {
|
2020-08-14 17:18:05 +02:00
|
|
|
set_script_group(script, get_variable(script, *script->ptrReadPos));
|
2020-08-16 08:55:51 +02:00
|
|
|
return ApiStatus_DONE2;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
ApiStatus si_handle_suspend_all(ScriptInstance* script) {
|
2020-08-14 17:18:05 +02:00
|
|
|
suspend_all_group(get_variable(script, *script->ptrReadPos));
|
2020-08-16 08:55:51 +02:00
|
|
|
return ApiStatus_DONE2;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
ApiStatus si_handle_resume_all(ScriptInstance* script) {
|
2020-08-14 17:18:05 +02:00
|
|
|
resume_all_group(get_variable(script, *script->ptrReadPos));
|
2020-08-16 08:55:51 +02:00
|
|
|
return ApiStatus_DONE2;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
ApiStatus si_handle_suspend_others(ScriptInstance* script) {
|
2020-08-14 17:18:05 +02:00
|
|
|
suspend_group_others(script, get_variable(script, *script->ptrReadPos));
|
2020-08-16 08:55:51 +02:00
|
|
|
return ApiStatus_DONE2;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
ApiStatus si_handle_resume_others(ScriptInstance* script) {
|
2020-08-14 17:18:05 +02:00
|
|
|
resume_group_others(script, get_variable(script, *script->ptrReadPos));
|
2020-08-16 08:55:51 +02:00
|
|
|
return ApiStatus_DONE2;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
ApiStatus si_handle_suspend(ScriptInstance* script) {
|
2020-08-14 17:18:05 +02:00
|
|
|
suspend_all_script(get_variable(script, *script->ptrReadPos));
|
2020-08-16 08:55:51 +02:00
|
|
|
return ApiStatus_DONE2;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
ApiStatus si_handle_resume(ScriptInstance* script) {
|
2020-08-14 17:18:05 +02:00
|
|
|
resume_all_script(get_variable(script, *script->ptrReadPos));
|
2020-08-16 08:55:51 +02:00
|
|
|
return ApiStatus_DONE2;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
ApiStatus si_handle_does_script_exist(ScriptInstance* script) {
|
2020-10-08 21:03:58 +02:00
|
|
|
Bytecode* args = script->ptrReadPos;
|
2020-10-20 08:33:40 +02:00
|
|
|
ScriptID scriptID = get_variable(script, *args++);
|
2020-10-08 21:03:58 +02:00
|
|
|
Bytecode var2 = *args++;
|
2020-09-25 23:18:09 +02:00
|
|
|
|
|
|
|
set_variable(script, var2, does_script_exist(scriptID));
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
void si_standard_trigger_executor(Trigger* trigger) {
|
|
|
|
if (trigger->runningScript == NULL) {
|
|
|
|
ScriptInstance* newScript = start_script(trigger->scriptStart, trigger->priority, 0x20);
|
|
|
|
trigger->runningScript = newScript;
|
2020-10-20 08:33:40 +02:00
|
|
|
trigger->runningScriptID = newScript->id;
|
2020-10-08 21:03:58 +02:00
|
|
|
newScript->varTable[0] = trigger->scriptVars[0];
|
|
|
|
newScript->varTable[1] = trigger->scriptVars[1];
|
|
|
|
newScript->varTable[2] = trigger->scriptVars[2];
|
2020-10-21 01:02:05 +02:00
|
|
|
newScript->owner2.trigger = trigger;
|
2020-10-02 08:07:54 +02:00
|
|
|
}
|
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
if (!does_script_exist(trigger->runningScriptID)) {
|
|
|
|
trigger->runningScript = NULL;
|
|
|
|
trigger->flags.flags &= ~0x2;
|
2020-10-02 08:07:54 +02:00
|
|
|
}
|
2020-10-03 22:11:05 +02:00
|
|
|
}
|
2020-09-24 05:16:13 +02:00
|
|
|
|
2020-10-19 04:55:52 +02:00
|
|
|
ApiStatus si_handle_bind_lock(ScriptInstance* script) {
|
2020-10-19 03:20:07 +02:00
|
|
|
Bytecode* args = script->ptrReadPos;
|
|
|
|
Trigger* trigger;
|
|
|
|
Bytecode* triggerScript = get_variable(script, *args++);
|
|
|
|
Bytecode eventType = *args++;
|
|
|
|
Bytecode colliderIDVar = *args++;
|
|
|
|
s32* itemList = get_variable(script, *args++);
|
|
|
|
Bytecode triggerOut = *args++;
|
|
|
|
s32 a5 = *args++;
|
|
|
|
TriggerDefinition def;
|
|
|
|
|
|
|
|
def.flags = eventType | 0x1000000;
|
|
|
|
def.flagIndex = get_variable(script, colliderIDVar);
|
|
|
|
def.colliderIndex = get_variable_index(script, colliderIDVar);
|
|
|
|
def.unk_1C = itemList;
|
|
|
|
def.function = si_standard_trigger_executor;
|
|
|
|
def.unk_14 = triggerOut;
|
|
|
|
def.inputArg3 = a5;
|
|
|
|
|
|
|
|
trigger = create_trigger(&def);
|
|
|
|
trigger->scriptStart = triggerScript;
|
|
|
|
trigger->runningScript = NULL;
|
|
|
|
trigger->priority = script->priority;
|
|
|
|
trigger->scriptVars[0] = get_variable(script, script->varTable[0]);
|
|
|
|
trigger->scriptVars[1] = get_variable(script, script->varTable[1]);
|
|
|
|
trigger->scriptVars[2] = get_variable(script, script->varTable[2]);
|
|
|
|
|
|
|
|
return ApiStatus_DONE2;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-18 03:05:17 +02:00
|
|
|
INCLUDE_ASM(s32, "si", si_handle_thread, ScriptInstance* script, s32 isInitialCall);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
ApiStatus si_handle_end_thread(ScriptInstance* script) {
|
2020-08-14 17:18:05 +02:00
|
|
|
kill_script(script);
|
2020-08-16 08:55:51 +02:00
|
|
|
return ApiStatus_FINISH;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-18 03:05:17 +02:00
|
|
|
INCLUDE_ASM(s32, "si", si_handle_child_thread, ScriptInstance* script, s32 isInitialCall);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
ApiStatus si_handle_end_child_thread(ScriptInstance* script) {
|
2020-08-14 17:18:05 +02:00
|
|
|
kill_script(script);
|
2020-08-16 08:55:51 +02:00
|
|
|
return ApiStatus_BLOCK;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
ApiStatus func_802C6E14(ScriptInstance* script) {
|
|
|
|
return ApiStatus_DONE2;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-18 03:05:17 +02:00
|
|
|
INCLUDE_ASM(s32, "si", si_handle_print_debug_var, ScriptInstance* script, s32 isInitialCall);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
ApiStatus func_802C739C(ScriptInstance* script) {
|
2020-08-19 02:23:52 +02:00
|
|
|
script->ptrSavedPosition = (Bytecode*)*script->ptrReadPos;
|
2020-08-16 08:55:51 +02:00
|
|
|
return ApiStatus_DONE2;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
ApiStatus func_802C73B0(ScriptInstance* script) {
|
|
|
|
return ApiStatus_DONE2;
|
2020-08-14 17:18:05 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 07:13:03 +02:00
|
|
|
s32 func_802C73B8(ScriptInstance* script) {
|
2020-08-14 17:18:05 +02:00
|
|
|
s32 i;
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-13 04:54:27 +02:00
|
|
|
for (i = 0; i < MAX_SCRIPTS; i++) {
|
2020-08-14 17:18:05 +02:00
|
|
|
if (script == get_script_by_index(i)) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-18 03:05:17 +02:00
|
|
|
INCLUDE_ASM(s32, "si", si_execute_next_command);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-19 17:16:02 +02:00
|
|
|
// TODO: consider renaming to si_get_variable
|
2020-09-20 02:13:52 +02:00
|
|
|
#ifdef NON_MATCHING
|
|
|
|
s32 get_variable(ScriptInstance* script, Bytecode var) {
|
2020-09-22 05:10:53 +02:00
|
|
|
s32 wordIdx;
|
|
|
|
s32 bitIdx;
|
2020-09-19 17:16:02 +02:00
|
|
|
|
|
|
|
if (var <= -270000000) {
|
|
|
|
return var;
|
|
|
|
} else if (var <= -250000000) {
|
|
|
|
return var;
|
|
|
|
} else if (var <= -220000000) {
|
2020-09-22 05:10:53 +02:00
|
|
|
return fixed_var_to_float(var);
|
2020-09-19 17:16:02 +02:00
|
|
|
} else if (var <= -200000000) {
|
|
|
|
var += 210000000;
|
2020-09-22 05:10:53 +02:00
|
|
|
wordIdx = var / 32;
|
|
|
|
bitIdx = var % 32;
|
|
|
|
return (script->flagArray[wordIdx] & (1 << bitIdx)) != 0;
|
2020-09-19 17:16:02 +02:00
|
|
|
} else if (var <= -180000000) {
|
|
|
|
var += 190000000;
|
|
|
|
var = script->array[var];
|
2020-09-22 05:10:53 +02:00
|
|
|
return (var > -270000000 && var < -220000000) ? fixed_var_to_float(var) : var;
|
2020-09-19 17:16:02 +02:00
|
|
|
} else if (var <= -160000000) {
|
2020-09-22 05:10:53 +02:00
|
|
|
var += 170000000;
|
|
|
|
return get_global_byte(var);
|
2020-09-19 17:16:02 +02:00
|
|
|
} else if (var <= -140000000) {
|
2020-09-22 05:10:53 +02:00
|
|
|
var += 150000000;
|
|
|
|
return get_area_byte(var);
|
2020-09-19 17:16:02 +02:00
|
|
|
} else if (var <= -120000000) {
|
2020-09-22 05:10:53 +02:00
|
|
|
var += 130000000;
|
|
|
|
return get_global_flag(var);
|
2020-09-19 17:16:02 +02:00
|
|
|
} else if (var <= -100000000) {
|
2020-09-22 05:10:53 +02:00
|
|
|
var += 110000000;
|
|
|
|
return get_area_flag(var);
|
2020-09-19 17:16:02 +02:00
|
|
|
} else if (var <= -80000000) {
|
2020-09-22 05:10:53 +02:00
|
|
|
var += 90000000;
|
|
|
|
wordIdx = var / 32;
|
|
|
|
bitIdx = var % 32;
|
|
|
|
return (gMapFlags[wordIdx] & (1 << bitIdx)) != 0;
|
2020-09-19 17:16:02 +02:00
|
|
|
} else if (var <= -60000000) {
|
|
|
|
var += 70000000;
|
2020-09-22 05:10:53 +02:00
|
|
|
wordIdx = var / 32;
|
|
|
|
bitIdx = var % 32;
|
|
|
|
return (script->varFlags[wordIdx] & (1 << bitIdx)) != 0;
|
2020-09-19 17:16:02 +02:00
|
|
|
} else if (var <= -40000000) {
|
|
|
|
var += 50000000;
|
|
|
|
var = gMapVars[var];
|
2020-09-22 05:10:53 +02:00
|
|
|
return (var > -270000000 && var < -220000000) ? fixed_var_to_float(var) : var;
|
2020-09-19 17:16:02 +02:00
|
|
|
} else if (var <= -20000000) {
|
|
|
|
var += 30000000;
|
|
|
|
var = script->varTable[var];
|
2020-09-22 05:10:53 +02:00
|
|
|
return (var > -270000000 && var < -220000000) ? fixed_var_to_float(var) : var;
|
2020-09-19 17:16:02 +02:00
|
|
|
} else {
|
|
|
|
return var;
|
|
|
|
}
|
2020-09-20 02:13:52 +02:00
|
|
|
}
|
|
|
|
#else
|
2020-10-18 03:05:17 +02:00
|
|
|
INCLUDE_ASM(s32, "si", get_variable, ScriptInstance* script, Bytecode var);
|
2020-09-20 02:13:52 +02:00
|
|
|
#endif
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
s32 get_variable_index(ScriptInstance* script, s32 var) {
|
|
|
|
if (-270000000 >= var) {
|
|
|
|
return var;
|
|
|
|
}
|
|
|
|
if (-250000000 >= var) {
|
|
|
|
return var;
|
|
|
|
}
|
|
|
|
if (-220000000 >= var) {
|
|
|
|
return var;
|
|
|
|
}
|
|
|
|
if (-200000000 >= var) {
|
|
|
|
return var + 210000000;
|
|
|
|
}
|
|
|
|
if (-180000000 >= var) {
|
|
|
|
return var + 190000000;
|
|
|
|
}
|
|
|
|
if (-160000000 >= var) {
|
|
|
|
return var + 170000000;
|
|
|
|
}
|
|
|
|
if (-140000000 >= var) {
|
|
|
|
return var + 150000000;
|
|
|
|
}
|
|
|
|
if (-120000000 >= var) {
|
|
|
|
return var + 130000000;
|
|
|
|
}
|
|
|
|
if (-100000000 >= var) {
|
|
|
|
return var + 110000000;
|
|
|
|
}
|
|
|
|
if (-80000000 >= var) {
|
|
|
|
return var + 90000000;
|
|
|
|
}
|
|
|
|
if (-60000000 >= var) {
|
|
|
|
return var + 70000000;
|
|
|
|
}
|
|
|
|
if (-40000000 >= var) {
|
|
|
|
return var + 50000000;
|
|
|
|
}
|
|
|
|
if (-20000000 >= var) {
|
|
|
|
return var + 30000000;
|
|
|
|
}
|
|
|
|
return var;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-08 21:03:58 +02:00
|
|
|
s32 get_variable_index_alt(s32 var) {
|
|
|
|
if (-270000000 >= var) {
|
|
|
|
return var;
|
|
|
|
}
|
|
|
|
if (-250000000 >= var) {
|
|
|
|
return var;
|
|
|
|
}
|
|
|
|
if (-220000000 >= var) {
|
|
|
|
return var;
|
|
|
|
}
|
|
|
|
if (-200000000 >= var) {
|
|
|
|
return var + 210000000;
|
|
|
|
}
|
|
|
|
if (-180000000 >= var) {
|
|
|
|
return var + 190000000;
|
|
|
|
}
|
|
|
|
if (-160000000 >= var) {
|
|
|
|
return var + 170000000;
|
|
|
|
}
|
|
|
|
if (-140000000 >= var) {
|
|
|
|
return var + 150000000;
|
|
|
|
}
|
|
|
|
if (-120000000 >= var) {
|
|
|
|
return var + 130000000;
|
|
|
|
}
|
|
|
|
if (-100000000 >= var) {
|
|
|
|
return var + 110000000;
|
|
|
|
}
|
|
|
|
if (-80000000 >= var) {
|
|
|
|
return var + 90000000;
|
|
|
|
}
|
|
|
|
if (-60000000 >= var) {
|
|
|
|
return var + 70000000;
|
|
|
|
}
|
|
|
|
if (-40000000 >= var) {
|
|
|
|
return var + 50000000;
|
|
|
|
}
|
|
|
|
if (-20000000 >= var) {
|
|
|
|
return var + 30000000;
|
|
|
|
}
|
|
|
|
return var;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-18 03:05:17 +02:00
|
|
|
INCLUDE_ASM(s32, "si", set_variable, ScriptInstance* script, Bytecode var, s32 value);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-24 06:23:16 +02:00
|
|
|
// Tiny regalloc issue with the var <= -80000000 / -60000000 blocks
|
|
|
|
#ifdef NON_MATCHING
|
|
|
|
f32 get_float_variable(ScriptInstance* script, Bytecode var) {
|
|
|
|
s32 temp;
|
|
|
|
|
|
|
|
if (var <= -270000000) {
|
|
|
|
return var;
|
|
|
|
} else if (var <= -250000000) {
|
|
|
|
return var;
|
|
|
|
} else if (var <= -220000000) {
|
|
|
|
return fixed_var_to_float(var);
|
|
|
|
} else if (var <= -180000000) {
|
|
|
|
var += 190000000;
|
|
|
|
return fixed_var_to_float(script->array[var]);
|
|
|
|
} else if (var <= -160000000) {
|
|
|
|
var += 170000000;
|
|
|
|
return fixed_var_to_float(get_global_byte(var));
|
|
|
|
} else if (var <= -140000000) {
|
|
|
|
var += 150000000;
|
|
|
|
return fixed_var_to_float(get_area_byte(var));
|
|
|
|
} else if (var <= -80000000) {
|
|
|
|
var += 90000000;
|
|
|
|
temp = var % 32;
|
|
|
|
if ((gMapFlags[var / 32] & (1 << temp))) {
|
|
|
|
return 1.0f;
|
|
|
|
} else {
|
|
|
|
return 0.0f;
|
|
|
|
}
|
|
|
|
} else if (var <= -60000000) {
|
|
|
|
var += 70000000;
|
|
|
|
temp = var % 32;
|
|
|
|
if ((script->varFlags[var / 32] & (1 << temp))) {
|
|
|
|
return 1.0f;
|
|
|
|
} else {
|
|
|
|
return 0.0f;
|
|
|
|
}
|
|
|
|
} else if (var <= -40000000) {
|
|
|
|
var += 50000000;
|
|
|
|
return fixed_var_to_float(gMapVars[var]);
|
|
|
|
} else if (var <= -20000000) {
|
|
|
|
var += 30000000;
|
|
|
|
return fixed_var_to_float(script->varTable[var]);
|
|
|
|
} else {
|
|
|
|
return fixed_var_to_float(var);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#else
|
2020-10-18 03:05:17 +02:00
|
|
|
INCLUDE_ASM(f32, "si", get_float_variable, ScriptInstance* script, Bytecode var);
|
2020-10-24 06:23:16 +02:00
|
|
|
#endif
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-18 03:05:17 +02:00
|
|
|
INCLUDE_ASM(f32, "si", set_float_variable, ScriptInstance* script, Bytecode var, f32 value);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-24 22:07:26 +02:00
|
|
|
s32 si_find_label(ScriptInstance* script, s32 arg1) {
|
|
|
|
s32 ret = script->ptrReadPos;
|
|
|
|
s32 i;
|
|
|
|
|
|
|
|
if (arg1 < -270000000) {
|
|
|
|
return arg1;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < 0x10; i++) {
|
|
|
|
if (script->labelIndices[i] == arg1) {
|
|
|
|
ret = script->labelPositions[i];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ASSERT(i < 0x10);
|
|
|
|
return ret;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-18 03:05:17 +02:00
|
|
|
INCLUDE_ASM(s32, "si", si_skip_if, ScriptInstance* script);
|
2020-09-18 03:28:34 +02:00
|
|
|
// Matching but needs rodata support
|
|
|
|
/*Bytecode* si_skip_if(ScriptInstance* script) {
|
|
|
|
s32 nestedIfDepth = 0;
|
|
|
|
Bytecode* pos = script->ptrNextLine;
|
|
|
|
Bytecode opcode;
|
|
|
|
s32 nargs;
|
|
|
|
|
|
|
|
do {
|
|
|
|
opcode = *pos++;
|
|
|
|
nargs = *pos++;
|
|
|
|
pos += nargs;
|
|
|
|
switch(opcode) {
|
|
|
|
case 1:
|
|
|
|
PANIC();
|
|
|
|
case 10:
|
|
|
|
case 11:
|
|
|
|
case 12:
|
|
|
|
case 13:
|
|
|
|
case 14:
|
|
|
|
case 15:
|
|
|
|
case 16:
|
|
|
|
case 19:
|
|
|
|
nestedIfDepth--;
|
|
|
|
if (nestedIfDepth < 0) {
|
|
|
|
return pos;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 17:
|
|
|
|
nestedIfDepth++;
|
|
|
|
break;
|
|
|
|
case 18:
|
|
|
|
if (nestedIfDepth == 0) {
|
|
|
|
return pos;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} while(1);
|
|
|
|
}*/
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-18 03:05:17 +02:00
|
|
|
INCLUDE_ASM(s32, "si", si_skip_else, ScriptInstance* script);
|
2020-09-18 03:28:34 +02:00
|
|
|
// Matching but needs rodata support
|
|
|
|
/*Bytecode* si_skip_else(ScriptInstance* script) {
|
|
|
|
s32 nestedIfDepth = 0;
|
|
|
|
Bytecode* pos = script->ptrNextLine;
|
|
|
|
Bytecode opcode;
|
|
|
|
s32 nargs;
|
|
|
|
|
|
|
|
do {
|
|
|
|
opcode = *pos++;
|
|
|
|
nargs = *pos++;
|
|
|
|
pos += nargs;
|
|
|
|
switch(opcode) {
|
|
|
|
case 1:
|
|
|
|
PANIC();
|
|
|
|
case 10:
|
|
|
|
case 11:
|
|
|
|
case 12:
|
|
|
|
case 13:
|
|
|
|
case 14:
|
|
|
|
case 15:
|
|
|
|
case 16:
|
|
|
|
case 19:
|
|
|
|
nestedIfDepth--;
|
|
|
|
if (nestedIfDepth < 0) {
|
|
|
|
return pos;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 17:
|
|
|
|
nestedIfDepth++;
|
|
|
|
break;
|
2020-09-18 03:34:13 +02:00
|
|
|
|
2020-09-18 03:28:34 +02:00
|
|
|
}
|
|
|
|
} while(1);
|
|
|
|
}*/
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-24 23:51:27 +02:00
|
|
|
INCLUDE_ASM(Bytecode*, "si", si_goto_end_case, ScriptInstance* script);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-18 03:05:17 +02:00
|
|
|
INCLUDE_ASM(s32, "si", si_goto_next_case, ScriptInstance* script);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-18 03:05:17 +02:00
|
|
|
INCLUDE_ASM(s32, "si", si_goto_end_loop, ScriptInstance* script);
|