si_handle_bind_🔒

This commit is contained in:
Ethan Roseman 2020-10-18 21:20:07 -04:00
parent 78dc55f2f5
commit 0e132ce687
2 changed files with 40 additions and 12 deletions

View File

@ -1131,7 +1131,7 @@ typedef struct TriggerDefinition {
/* 0x10 */ char unk_10[4];
/* 0x14 */ s32 unk_14;
/* 0x18 */ s32 inputArg3;
/* 0x1C */ char unk_1C[4];
/* 0x1C */ s32 unk_1C;
} TriggerDefinition; // size = 0x20
typedef struct CollisionStatus {

View File

@ -954,30 +954,30 @@ s32 _bound_script_trigger_handler(Trigger* trigger) {
ApiStatus si_handle_bind(ScriptInstance* script) {
Bytecode* args = script->ptrReadPos;
Trigger* trigger;
s32 var0 = get_variable(script, *args++);
Bytecode flags = *args++;
Bytecode index = *args++;
Bytecode* triggerScript = get_variable(script, *args++);
Bytecode eventType = *args++;
Bytecode colliderIDVar = *args++;
Bytecode a3 = *args++;
Bytecode a4 = *args++;
Bytecode triggerOut = *args++;
TriggerDefinition def;
def.flags = flags | 0x1000000;
def.flagIndex = get_variable(script, index);
def.colliderIndex = get_variable_index(script, index);
def.flags = eventType | 0x1000000;
def.flagIndex = get_variable(script, colliderIDVar);
def.colliderIndex = get_variable_index(script, colliderIDVar);
def.inputArg3 = a3;
def.unk_14 = 0;
def.function = _bound_script_trigger_handler;
trigger = create_trigger(&def);
trigger->scriptStart = var0;
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]);
if (a4 != 0) {
set_variable(script, a4, trigger);
if (triggerOut != 0) {
set_variable(script, triggerOut, trigger);
}
return ApiStatus_DONE2;
@ -1069,7 +1069,35 @@ void si_standard_trigger_executor(Trigger* trigger) {
}
}
INCLUDE_ASM(s32, "si", si_handle_bind_lock, ScriptInstance* script, s32 isInitialCall);
ApiStatus si_handle_bind_lock(ScriptInstance *script) {
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;
}
INCLUDE_ASM(s32, "si", si_handle_thread, ScriptInstance* script, s32 isInitialCall);