2020-08-04 08:49:11 +02:00
|
|
|
#include "common.h"
|
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(s32, "code_e79b0_len_1920", sort_scripts);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(s32, "code_e79b0_len_1920", find_script_labels);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(s32, "code_e79b0_len_1920", clear_script_list);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(s32, "code_e79b0_len_1920", init_script_list);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(s32, "code_e79b0_len_1920", func_802C3390);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(s32, "code_e79b0_len_1920", start_script);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-10-06 21:16:17 +02:00
|
|
|
INCLUDE_ASM(ScriptInstance*, "code_e79b0_len_1920", start_script_in_group, ScriptInstance* script, s32 priority, s32 flags, s32 groups);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(s32, "code_e79b0_len_1920", start_child_script);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(s32, "code_e79b0_len_1920", func_802C39F8);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(s32, "code_e79b0_len_1920", func_802C3C10);
|
2020-09-24 05:16:13 +02:00
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
ScriptInstance* restart_script(ScriptInstance* script) {
|
2020-09-06 17:53:48 +02:00
|
|
|
Bytecode* ptrFirstLine = script->ptrFirstLine;
|
|
|
|
|
|
|
|
// frameCounter gets set to 0 twice which makes me think a macro is being used here
|
2020-08-15 00:05:05 +02:00
|
|
|
script->loopDepth = -1;
|
|
|
|
script->switchDepth = -1;
|
2020-09-06 17:53:48 +02:00
|
|
|
script->frameCounter = 0;
|
2020-10-02 08:07:54 +02:00
|
|
|
script->flags.bytes.currentOpcode = 0;
|
2020-08-15 00:05:05 +02:00
|
|
|
script->frameCounter = 0;
|
|
|
|
script->unk_158 = 0;
|
|
|
|
|
2020-09-06 17:53:48 +02:00
|
|
|
script->ptrNextLine = ptrFirstLine;
|
|
|
|
script->ptrCurrentLine = ptrFirstLine;
|
2020-08-15 00:05:05 +02:00
|
|
|
|
2020-09-06 17:53:48 +02:00
|
|
|
// ???
|
2020-08-18 11:27:30 +02:00
|
|
|
script->timeScale = 1.0f;
|
2020-08-15 00:05:05 +02:00
|
|
|
script->timeScale = gGlobalTimeSpace;
|
2020-08-18 11:27:30 +02:00
|
|
|
|
2020-08-15 00:05:05 +02:00
|
|
|
find_script_labels();
|
|
|
|
func_802C3390(script);
|
2020-08-18 11:27:30 +02:00
|
|
|
|
2020-08-15 00:05:05 +02:00
|
|
|
return script;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(s32, "code_e79b0_len_1920", update_scripts);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(s32, "code_e79b0_len_1920", func_802C3EE4);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(s32, "code_e79b0_len_1920", kill_script);
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-19 02:21:04 +02:00
|
|
|
void kill_script_by_ID(s32 id) {
|
2020-08-14 04:53:38 +02:00
|
|
|
s32 i;
|
2020-08-16 07:13:03 +02:00
|
|
|
ScriptInstance* scriptContextPtr;
|
2020-08-14 04:53:38 +02:00
|
|
|
|
2020-08-15 04:55:54 +02:00
|
|
|
for (i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
|
2020-08-14 16:50:44 +02:00
|
|
|
scriptContextPtr = (*gCurrentScriptListPtr)[i];
|
2020-08-14 07:22:16 +02:00
|
|
|
if (scriptContextPtr != NULL && scriptContextPtr->uniqueID == id) {
|
|
|
|
kill_script(scriptContextPtr);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-19 02:21:04 +02:00
|
|
|
void kill_all_scripts(void) {
|
2020-08-14 07:22:16 +02:00
|
|
|
s32 i;
|
2020-08-16 07:13:03 +02:00
|
|
|
ScriptInstance* scriptContextPtr;
|
2020-08-14 07:22:16 +02:00
|
|
|
|
2020-08-19 02:16:12 +02:00
|
|
|
for (i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
|
2020-08-14 16:50:44 +02:00
|
|
|
scriptContextPtr = (*gCurrentScriptListPtr)[i];
|
2020-08-14 07:22:16 +02:00
|
|
|
if (scriptContextPtr != NULL) {
|
|
|
|
kill_script(scriptContextPtr);
|
2020-08-14 04:53:38 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-14 07:22:16 +02:00
|
|
|
s32 does_script_exist(s32 id) {
|
|
|
|
s32 i;
|
2020-08-16 07:13:03 +02:00
|
|
|
ScriptInstance* scriptContextPtr;
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-19 02:16:12 +02:00
|
|
|
for (i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
|
2020-08-14 16:50:44 +02:00
|
|
|
scriptContextPtr = (*gCurrentScriptListPtr)[i];
|
2020-08-14 07:22:16 +02:00
|
|
|
if (scriptContextPtr != NULL && scriptContextPtr->uniqueID == id) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 07:13:03 +02:00
|
|
|
s32 does_script_exist_by_ref(ScriptInstance* script) {
|
2020-08-15 00:05:05 +02:00
|
|
|
s32 i;
|
|
|
|
|
2020-08-19 02:16:12 +02:00
|
|
|
for (i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
|
|
|
|
if (script == (*gCurrentScriptListPtr)[i]) {
|
2020-08-15 00:05:05 +02:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 07:13:03 +02:00
|
|
|
void set_script_priority(ScriptInstance* script, s8 priority) {
|
2020-10-02 08:07:54 +02:00
|
|
|
script->flags.bytes.priority = priority;
|
2020-08-15 00:05:05 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-20 04:45:43 +02:00
|
|
|
void set_script_timescale(ScriptInstance* script, f32 timescale) {
|
|
|
|
script->timeScale = timescale * gGlobalTimeSpace;
|
2020-08-15 00:05:05 +02:00
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-19 03:45:26 +02:00
|
|
|
#ifdef NON_MATCHING
|
2020-08-15 00:05:05 +02:00
|
|
|
// TODO: figure out why compiler/assembler isn't putting SWC1 in delay slot
|
|
|
|
void set_global_timespace(f32 timeScale) {
|
|
|
|
//gGlobalTimeSpace = timeScale;
|
|
|
|
}
|
2020-08-19 03:45:26 +02:00
|
|
|
#else
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(s32, "code_e79b0_len_1920", set_global_timespace);
|
2020-08-19 03:45:26 +02:00
|
|
|
#endif
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-19 03:45:26 +02:00
|
|
|
#ifdef NON_MATCHING
|
2020-08-15 00:05:05 +02:00
|
|
|
// TODO: figure out why compiler/assembler isn't putting LWC1 in delay slot
|
|
|
|
f32 get_global_timespace(void) {
|
|
|
|
//return gGlobalTimeSpace;
|
|
|
|
}
|
2020-08-19 03:45:26 +02:00
|
|
|
#else
|
2020-09-25 23:18:09 +02:00
|
|
|
INCLUDE_ASM(s32, "code_e79b0_len_1920", get_global_timespace);
|
2020-08-19 03:45:26 +02:00
|
|
|
#endif
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 07:13:03 +02:00
|
|
|
void set_script_group(ScriptInstance* script, s8 groupFlags) {
|
2020-08-15 00:05:05 +02:00
|
|
|
script->groupFlags = groupFlags;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-06 17:53:48 +02:00
|
|
|
Trigger* bind_trigger(Bytecode* script, s32 flags, s32 triggerFlagIndex, s32 triggerVar0, s32 triggerVar1,
|
|
|
|
s32 priority, s32 arg6) {
|
|
|
|
Trigger* trigger;
|
|
|
|
TriggerDefinition def;
|
|
|
|
|
|
|
|
def.flags = flags | 0x1000000;
|
|
|
|
def.flagIndex = triggerFlagIndex;
|
|
|
|
def.unk_14 = 0;
|
|
|
|
def.function = _bound_script_trigger_handler;
|
|
|
|
def.inputArg3 = arg6;
|
|
|
|
|
|
|
|
trigger = create_trigger(&def);
|
|
|
|
trigger->scriptStart = script;
|
|
|
|
trigger->runningScript = NULL;
|
|
|
|
trigger->priority = priority;
|
|
|
|
trigger->scriptVars[0] = triggerVar0;
|
|
|
|
trigger->scriptVars[1] = triggerVar1;
|
|
|
|
return trigger;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-06 17:53:48 +02:00
|
|
|
Trigger* bind_trigger_1(Bytecode* script, s32 flags, s32 triggerFlagIndex, s32 triggerVar0, s32 triggerVar1,
|
|
|
|
s32 priority) {
|
|
|
|
return bind_trigger(script, flags, triggerFlagIndex, triggerVar0, triggerVar1, priority, 1);
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 07:13:03 +02:00
|
|
|
void suspend_group_script(ScriptInstance* script, s32 groupFlags) {
|
2020-08-15 00:05:05 +02:00
|
|
|
int i;
|
2020-08-16 07:13:03 +02:00
|
|
|
ScriptInstance* scriptContextPtr;
|
|
|
|
ScriptInstance* childScript = script->childScript;
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-15 00:05:05 +02:00
|
|
|
if (childScript != NULL) {
|
|
|
|
suspend_group_script(childScript, groupFlags);
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-19 02:16:12 +02:00
|
|
|
for (i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
|
2020-08-15 00:05:05 +02:00
|
|
|
scriptContextPtr = (*gCurrentScriptListPtr)[i];
|
|
|
|
if (scriptContextPtr != NULL && scriptContextPtr->parentScript == script) {
|
|
|
|
suspend_group_script(scriptContextPtr, groupFlags);
|
|
|
|
}
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-15 00:05:05 +02:00
|
|
|
if ((script->groupFlags & groupFlags) != 0) {
|
2020-10-02 08:07:54 +02:00
|
|
|
script->flags.bytes.state |= 0x2;
|
2020-08-15 00:05:05 +02:00
|
|
|
}
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 07:13:03 +02:00
|
|
|
void resume_group_script(ScriptInstance* script, s32 groupFlags) {
|
2020-08-15 00:05:05 +02:00
|
|
|
int i;
|
2020-08-16 07:13:03 +02:00
|
|
|
ScriptInstance* scriptContextPtr;
|
|
|
|
ScriptInstance* childScript = script->childScript;
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-15 00:05:05 +02:00
|
|
|
if (childScript != NULL) {
|
|
|
|
resume_group_script(childScript, groupFlags);
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-19 02:16:12 +02:00
|
|
|
for (i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
|
2020-08-15 00:05:05 +02:00
|
|
|
scriptContextPtr = (*gCurrentScriptListPtr)[i];
|
|
|
|
if (scriptContextPtr != NULL && scriptContextPtr->parentScript == script) {
|
|
|
|
suspend_group_script(scriptContextPtr, groupFlags);
|
|
|
|
}
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-15 00:05:05 +02:00
|
|
|
if ((script->groupFlags & groupFlags) != 0) {
|
2020-10-02 08:07:54 +02:00
|
|
|
script->flags.bytes.state &= ~0x2;
|
2020-08-15 00:05:05 +02:00
|
|
|
}
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-15 00:05:05 +02:00
|
|
|
s32 suspend_all_script(s32 id) {
|
|
|
|
s32 i;
|
2020-08-16 07:13:03 +02:00
|
|
|
ScriptInstance* scriptContextPtr;
|
2020-08-15 00:05:05 +02:00
|
|
|
|
2020-08-15 01:31:50 +02:00
|
|
|
for (i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
|
2020-08-15 00:05:05 +02:00
|
|
|
scriptContextPtr = (*gCurrentScriptListPtr)[i];
|
|
|
|
if (scriptContextPtr != NULL && scriptContextPtr->uniqueID == id) {
|
|
|
|
suspend_group_script(scriptContextPtr, 0xEF);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-15 00:05:05 +02:00
|
|
|
s32 resume_all_script(s32 id) {
|
|
|
|
s32 i;
|
2020-08-16 07:13:03 +02:00
|
|
|
ScriptInstance* scriptContextPtr;
|
2020-08-15 00:05:05 +02:00
|
|
|
|
2020-08-15 01:31:50 +02:00
|
|
|
for (i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
|
2020-08-15 00:05:05 +02:00
|
|
|
scriptContextPtr = (*gCurrentScriptListPtr)[i];
|
|
|
|
if (scriptContextPtr != NULL && scriptContextPtr->uniqueID == id) {
|
|
|
|
resume_group_script(scriptContextPtr, 0xEF);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void suspend_group_script_index(s32 id, s32 groupFlags) {
|
|
|
|
s32 i;
|
2020-08-16 07:13:03 +02:00
|
|
|
ScriptInstance* scriptContextPtr;
|
2020-08-15 00:05:05 +02:00
|
|
|
|
2020-08-15 01:31:50 +02:00
|
|
|
for (i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
|
2020-08-15 00:05:05 +02:00
|
|
|
scriptContextPtr = (*gCurrentScriptListPtr)[i];
|
|
|
|
if (scriptContextPtr != NULL && scriptContextPtr->uniqueID == id) {
|
|
|
|
suspend_group_script(scriptContextPtr, groupFlags);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void resume_group_script_index(s32 id, s32 groupFlags) {
|
|
|
|
s32 i;
|
2020-08-16 07:13:03 +02:00
|
|
|
ScriptInstance* scriptContextPtr;
|
2020-08-15 00:05:05 +02:00
|
|
|
|
2020-08-15 01:31:50 +02:00
|
|
|
for (i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
|
2020-08-15 00:05:05 +02:00
|
|
|
scriptContextPtr = (*gCurrentScriptListPtr)[i];
|
|
|
|
if (scriptContextPtr != NULL && scriptContextPtr->uniqueID == id) {
|
|
|
|
resume_group_script(scriptContextPtr, groupFlags);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
s32 suspend_all_group(s32 groupFlags) {
|
|
|
|
s32 i;
|
2020-08-16 07:13:03 +02:00
|
|
|
ScriptInstance* scriptContextPtr;
|
2020-08-15 00:05:05 +02:00
|
|
|
|
2020-08-15 01:31:50 +02:00
|
|
|
for (i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
|
2020-08-15 00:05:05 +02:00
|
|
|
scriptContextPtr = (*gCurrentScriptListPtr)[i];
|
|
|
|
if (scriptContextPtr != NULL) {
|
|
|
|
suspend_group_script(scriptContextPtr, groupFlags);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
s32 resume_all_group(s32 groupFlags) {
|
|
|
|
s32 i;
|
2020-08-16 07:13:03 +02:00
|
|
|
ScriptInstance* scriptContextPtr;
|
2020-08-15 00:05:05 +02:00
|
|
|
|
2020-08-15 01:31:50 +02:00
|
|
|
for (i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
|
2020-08-15 00:05:05 +02:00
|
|
|
scriptContextPtr = (*gCurrentScriptListPtr)[i];
|
|
|
|
if (scriptContextPtr != NULL) {
|
|
|
|
resume_group_script(scriptContextPtr, groupFlags);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-19 02:23:52 +02:00
|
|
|
void suspend_group_others(ScriptInstance* script, s32 groupFlags) {
|
2020-08-15 00:05:05 +02:00
|
|
|
s32 i;
|
2020-08-16 07:13:03 +02:00
|
|
|
ScriptInstance* scriptContextPtr;
|
2020-08-15 00:05:05 +02:00
|
|
|
|
2020-08-15 01:31:50 +02:00
|
|
|
for (i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
|
2020-08-15 00:05:05 +02:00
|
|
|
scriptContextPtr = (*gCurrentScriptListPtr)[i];
|
|
|
|
if (scriptContextPtr != NULL && scriptContextPtr != script) {
|
|
|
|
suspend_group_script(scriptContextPtr, groupFlags);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-19 02:23:52 +02:00
|
|
|
void resume_group_others(ScriptInstance* script, s32 groupFlags) {
|
2020-08-15 00:05:05 +02:00
|
|
|
s32 i;
|
2020-08-16 07:13:03 +02:00
|
|
|
ScriptInstance* scriptContextPtr;
|
2020-08-15 00:05:05 +02:00
|
|
|
|
2020-08-15 01:31:50 +02:00
|
|
|
for (i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
|
2020-08-15 00:05:05 +02:00
|
|
|
scriptContextPtr = (*gCurrentScriptListPtr)[i];
|
|
|
|
if (scriptContextPtr != NULL && scriptContextPtr != script) {
|
|
|
|
resume_group_script(scriptContextPtr, groupFlags);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 07:13:03 +02:00
|
|
|
ScriptInstance* get_script_by_index(s32 index) {
|
2020-08-14 16:50:44 +02:00
|
|
|
return (*gCurrentScriptListPtr)[index];
|
2020-08-14 04:53:38 +02:00
|
|
|
}
|
|
|
|
|
2020-08-16 07:13:03 +02:00
|
|
|
ScriptInstance* get_script_by_id(s32 id) {
|
2020-08-14 04:53:38 +02:00
|
|
|
s32 i;
|
2020-08-16 07:13:03 +02:00
|
|
|
ScriptInstance* scriptContextPtr;
|
2020-08-14 04:53:38 +02:00
|
|
|
|
2020-08-15 01:31:50 +02:00
|
|
|
for (i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
|
2020-08-14 16:50:44 +02:00
|
|
|
if ((*gCurrentScriptListPtr)[i] != NULL) {
|
|
|
|
scriptContextPtr = (*gCurrentScriptListPtr)[i];
|
2020-08-14 04:53:38 +02:00
|
|
|
if (scriptContextPtr->uniqueID == id) {
|
|
|
|
return scriptContextPtr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-08-16 07:13:03 +02:00
|
|
|
void set_script_flags(ScriptInstance* script, s32 flags) {
|
2020-08-15 00:05:05 +02:00
|
|
|
int i;
|
2020-08-16 07:13:03 +02:00
|
|
|
ScriptInstance* scriptContextPtr;
|
|
|
|
ScriptInstance* childScript = script->childScript;
|
2020-08-14 07:22:16 +02:00
|
|
|
|
2020-10-02 08:07:54 +02:00
|
|
|
script->flags.bytes.state |= flags;
|
2020-08-15 00:05:05 +02:00
|
|
|
if (childScript != NULL) {
|
|
|
|
set_script_flags(childScript, flags);
|
|
|
|
}
|
|
|
|
|
2020-08-19 02:16:12 +02:00
|
|
|
for (i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
|
2020-08-15 00:05:05 +02:00
|
|
|
scriptContextPtr = (*gCurrentScriptListPtr)[i];
|
|
|
|
if (scriptContextPtr != NULL && scriptContextPtr->parentScript == script) {
|
|
|
|
set_script_flags(script->parentScript, flags);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-08-04 08:49:11 +02:00
|
|
|
|
2020-09-06 17:53:48 +02:00
|
|
|
|
2020-08-16 08:55:51 +02:00
|
|
|
void clear_script_flags(ScriptInstance* script, s32 flags) {
|
2020-08-15 00:05:05 +02:00
|
|
|
int i;
|
2020-08-16 08:55:51 +02:00
|
|
|
ScriptInstance* scriptContextPtr;
|
|
|
|
ScriptInstance* childScript = script->childScript;
|
2020-08-15 00:05:05 +02:00
|
|
|
|
2020-10-02 08:07:54 +02:00
|
|
|
script->flags.bytes.state &= ~flags;
|
2020-08-15 00:05:05 +02:00
|
|
|
if (childScript != NULL) {
|
|
|
|
clear_script_flags(childScript, flags);
|
|
|
|
}
|
|
|
|
|
2020-08-20 18:07:05 +02:00
|
|
|
for (i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) {
|
2020-08-15 00:05:05 +02:00
|
|
|
scriptContextPtr = (*gCurrentScriptListPtr)[i];
|
|
|
|
if (scriptContextPtr != NULL && scriptContextPtr->parentScript == script) {
|
2020-09-06 17:53:48 +02:00
|
|
|
clear_script_flags(scriptContextPtr, flags);
|
2020-08-15 00:05:05 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|