This commit is contained in:
dark-samus 2020-11-08 15:42:47 -05:00
parent 1e70aa7667
commit ee24e5a629
8 changed files with 33 additions and 49 deletions

View File

@ -194,27 +194,19 @@ typedef union {
} TriggerFlags;
typedef union {
struct {
/* 0x0 */ s16 unkParams;
/* 0x2 */ char unk_2;
} bytes;
s32 params;
s16 s;
s32 w;
} TriggerParams;
typedef union {
u16 s[6];
s32 w[3];
} ScriptVariables;
typedef struct Trigger {
/* 0x00 */ TriggerFlags flags;
/* 0x04 */ TriggerParams params1; // TODO: remove TriggerParams
/* 0x08 */ TriggerParams params2;
/* 0x04 */ TriggerParams params1;
/* 0x08 */ s32 params2;
/* 0x0C */ UNK_FUN_PTR(functionHandler);
/* 0x10 */ Bytecode* scriptStart;
/* 0x14 */ struct ScriptInstance* runningScript;
/* 0x18 */ s32 priority;
/* 0x1C */ ScriptVariables scriptVars; // TODO: remove ScriptVariables
/* 0x1C */ s32 scriptVars[3];
/* 0x28 */ char unk_2C[8];
/* 0x30 */ u8 unk_30;
/* 0x31 */ char unk_31[3];

View File

@ -102,5 +102,5 @@ void func_802E13B8(Entity *entity) {
trigger = entity->trigger;
entity_init_Hammer23Block_normal();
entity->unk_3C = func_802E0DE0;
trigger->params1.bytes.unkParams = 8;
trigger->params1.s = 8;
}

View File

@ -258,14 +258,6 @@ void func_802E2EB0(struct802E176C* arg0) {
INCLUDE_ASM(void, "code_102c80", func_802E2EB0, struct802E176C* arg0);
#endif
s32 D_802E9C8C = 0 ; // TODO: correct data here.
s32 D_802E9CF8 = 0 ; // TODO: correct data here.
s32 D_802E9CB0 = 0 ; // TODO: correct data here.
s32 D_802E9D1C = 0 ; // TODO: correct data here.
s32 D_802E9CD4 = 0 ; // TODO: correct data here.
s32 D_802E9D40 = 0 ; // TODO: correct data here.
s32 D_802E9D64 = 0 ; // TODO: correct data here.
#ifdef NON_MATCHING
//Needs rodata support
void func_802E2FD0(struct802E176C* arg0) {
@ -276,25 +268,25 @@ void func_802E2FD0(struct802E176C* arg0) {
switch(type) {
case 21:
addr = D_802E9C8C;
addr = &D_802E9C8C;
break;
case 24:
addr = D_802E9CF8;
addr = &D_802E9CF8;
break;
case 22:
addr = D_802E9CB0;
addr = &D_802E9CB0;
break;
case 25:
addr = D_802E9D1C;
addr = &D_802E9D1C;
break;
case 23:
addr = D_802E9CD4;
addr = &D_802E9CD4;
break;
case 26:
addr = D_802E9D40;
addr = &D_802E9D40;
break;
case 13:
addr = D_802E9D64;
addr = &D_802E9D64;
break;
case 14:
case 15:

View File

@ -31,7 +31,7 @@ void player_enter_blue_pipe(Entity* bluePipe) {
Trigger* pipeTrigger = bluePipe->trigger;
playerStatus->targetYaw = CURRENT_CAM->currentYaw + 180.0f;
pipeTrigger->params1 = 0x19;
pipeTrigger->params1.w = 0x19;
playerStatus->renderMode = 0xD;
func_802DDFF8(0x10002, 5, 2, 1, 1, 0, 0);
@ -44,9 +44,9 @@ void func_802E8D74(Entity* entity) {
Trigger* entityTrigger = entity->trigger;
playerStatus->position.y--;
entityTrigger->params1.params--;
entityTrigger->params1.w--;
if (entityTrigger->params1.params == -1) {
if (entityTrigger->params1.w == -1) {
playerStatus->renderMode = 0xD;
playerStatus->position.y -= 50.0f;
func_802DDFF8(0x10002, 0, 0, 0, 0, 0, 0);

View File

@ -58,7 +58,7 @@ ShadowList* get_shadow_list(void) {
INCLUDE_ASM(s32, "code_a5dd0_len_114e0", func_80110678);
INCLUDE_ASM(s32, "code_a5dd0_len_114e0", get_entity_type);
INCLUDE_ASM(u32, "code_a5dd0_len_114e0", get_entity_type, s32 arg0);
INCLUDE_ASM(s32, "code_a5dd0_len_114e0", delete_entity);
@ -100,7 +100,7 @@ INCLUDE_ASM(s32, "code_a5dd0_len_114e0", func_80111790);
INCLUDE_ASM(s32, "code_a5dd0_len_114e0", func_801117DC);
INCLUDE_ASM(s32, "code_a5dd0_len_114e0", create_entity);
INCLUDE_ASM(void, "code_a5dd0_len_114e0", create_entity, void* arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5);
INCLUDE_ASM(s32, "code_a5dd0_len_114e0", create_shadow_from_data);

View File

@ -54,7 +54,7 @@ s32 func_80145CE8(s32 arg0) {
if ((trigger != NULL) &&
(trigger->unk_30 != 0) &&
(trigger->params2.params == arg0) &&
(trigger->params2 == arg0) &&
(trigger->flags.flags & 0x100)) {
return 1;
}

View File

@ -580,8 +580,8 @@ Trigger* bind_trigger(Bytecode* script, s32 flags, s32 triggerFlagIndex, s32 tri
trigger->scriptStart = script;
trigger->runningScript = NULL;
trigger->priority = priority;
trigger->scriptVars.w[0] = triggerVar0;
trigger->scriptVars.w[1] = triggerVar1;
trigger->scriptVars[0] = triggerVar0;
trigger->scriptVars[1] = triggerVar1;
return trigger;
}

View File

@ -977,9 +977,9 @@ s32 _bound_script_trigger_handler(Trigger* trigger) {
script = start_script(scriptStart, trigger->priority, 0x20);
trigger->runningScript = script;
trigger->runningScriptID = script->id;
script->varTable[0] = trigger->scriptVars.w[0];
script->varTable[1] = trigger->scriptVars.w[1];
script->varTable[2] = trigger->scriptVars.w[2];
script->varTable[0] = trigger->scriptVars[0];
script->varTable[1] = trigger->scriptVars[1];
script->varTable[2] = trigger->scriptVars[2];
script->owner2.trigger = trigger;
}
@ -1012,9 +1012,9 @@ ApiStatus si_handle_bind(ScriptInstance* script) {
trigger->scriptStart = triggerScript;
trigger->runningScript = NULL;
trigger->priority = script->priority;
trigger->scriptVars.w[0] = get_variable(script, script->varTable[0]);
trigger->scriptVars.w[1] = get_variable(script, script->varTable[1]);
trigger->scriptVars.w[2] = get_variable(script, script->varTable[2]);
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 (triggerOut != 0) {
set_variable(script, triggerOut, trigger);
@ -1097,9 +1097,9 @@ void si_standard_trigger_executor(Trigger* trigger) {
ScriptInstance* newScript = start_script(trigger->scriptStart, trigger->priority, 0x20);
trigger->runningScript = newScript;
trigger->runningScriptID = newScript->id;
newScript->varTable[0] = trigger->scriptVars.w[0];
newScript->varTable[1] = trigger->scriptVars.w[1];
newScript->varTable[2] = trigger->scriptVars.w[2];
newScript->varTable[0] = trigger->scriptVars[0];
newScript->varTable[1] = trigger->scriptVars[1];
newScript->varTable[2] = trigger->scriptVars[2];
newScript->owner2.trigger = trigger;
}
@ -1132,9 +1132,9 @@ ApiStatus si_handle_bind_lock(ScriptInstance* script) {
trigger->scriptStart = triggerScript;
trigger->runningScript = NULL;
trigger->priority = script->priority;
trigger->scriptVars.w[0] = get_variable(script, script->varTable[0]);
trigger->scriptVars.w[1] = get_variable(script, script->varTable[1]);
trigger->scriptVars.w[2] = get_variable(script, script->varTable[2]);
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;
}