From 41e9cf18ba37485cf82d0f7db87e4497907c648a Mon Sep 17 00:00:00 2001 From: Ethan Roseman Date: Fri, 9 Oct 2020 14:55:23 -0400 Subject: [PATCH] matched func_80145CE8 --- .../code_dbd70_len_700/func_80145CE8.s | 42 ------------------- include/common_structs.h | 3 +- src/code_dbd70_len_700.c | 20 ++++----- 3 files changed, 10 insertions(+), 55 deletions(-) delete mode 100644 asm/nonmatchings/code_dbd70_len_700/func_80145CE8.s diff --git a/asm/nonmatchings/code_dbd70_len_700/func_80145CE8.s b/asm/nonmatchings/code_dbd70_len_700/func_80145CE8.s deleted file mode 100644 index 953ab8b807..0000000000 --- a/asm/nonmatchings/code_dbd70_len_700/func_80145CE8.s +++ /dev/null @@ -1,42 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel func_80145CE8 -/* DC3E8 80145CE8 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* DC3EC 80145CEC AFB00010 */ sw $s0, 0x10($sp) -/* DC3F0 80145CF0 AFBF0014 */ sw $ra, 0x14($sp) -/* DC3F4 80145CF4 0C0394BE */ jal func_800E52F8 -/* DC3F8 80145CF8 0080802D */ daddu $s0, $a0, $zero -/* DC3FC 80145CFC 14400003 */ bnez $v0, .L80145D0C -/* DC400 80145D00 0000282D */ daddu $a1, $zero, $zero -/* DC404 80145D04 08051756 */ j .L80145D58 -/* DC408 80145D08 0000102D */ daddu $v0, $zero, $zero -.L80145D0C: -/* DC40C 80145D0C 3C048016 */ lui $a0, %hi(gCurrentTriggerListPtr) -/* DC410 80145D10 8C849390 */ lw $a0, %lo(gCurrentTriggerListPtr)($a0) -.L80145D14: -/* DC414 80145D14 8C830000 */ lw $v1, ($a0) -/* DC418 80145D18 5060000B */ beql $v1, $zero, .L80145D48 -/* DC41C 80145D1C 24A50001 */ addiu $a1, $a1, 1 -/* DC420 80145D20 90620030 */ lbu $v0, 0x30($v1) -/* DC424 80145D24 10400008 */ beqz $v0, .L80145D48 -/* DC428 80145D28 24A50001 */ addiu $a1, $a1, 1 -/* DC42C 80145D2C 8C620008 */ lw $v0, 8($v1) -/* DC430 80145D30 14500005 */ bne $v0, $s0, .L80145D48 -/* DC434 80145D34 00000000 */ nop -/* DC438 80145D38 8C620000 */ lw $v0, ($v1) -/* DC43C 80145D3C 30420100 */ andi $v0, $v0, 0x100 -/* DC440 80145D40 14400005 */ bnez $v0, .L80145D58 -/* DC444 80145D44 24020001 */ addiu $v0, $zero, 1 -.L80145D48: -/* DC448 80145D48 28A20040 */ slti $v0, $a1, 0x40 -/* DC44C 80145D4C 1440FFF1 */ bnez $v0, .L80145D14 -/* DC450 80145D50 24840004 */ addiu $a0, $a0, 4 -/* DC454 80145D54 0000102D */ daddu $v0, $zero, $zero -.L80145D58: -/* DC458 80145D58 8FBF0014 */ lw $ra, 0x14($sp) -/* DC45C 80145D5C 8FB00010 */ lw $s0, 0x10($sp) -/* DC460 80145D60 03E00008 */ jr $ra -/* DC464 80145D64 27BD0018 */ addiu $sp, $sp, 0x18 -/* DC468 80145D68 00000000 */ nop -/* DC46C 80145D6C 00000000 */ nop diff --git a/include/common_structs.h b/include/common_structs.h index 94f86559e8..325f9ac634 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -184,7 +184,8 @@ typedef struct Trigger { /* 0x18 */ s32 priority; /* 0x1C */ s32 scriptVars[3]; /* 0x28 */ char unk_28[8]; - /* 0x30 */ s32 unk_30; + /* 0x30 */ u8 unk_30; + /* 0x31 */ char unk_31[3]; /* 0x34 */ s32 runningScriptID; } Trigger; // size = 0x38 diff --git a/src/code_dbd70_len_700.c b/src/code_dbd70_len_700.c index 2eb53ad76c..440595e44a 100644 --- a/src/code_dbd70_len_700.c +++ b/src/code_dbd70_len_700.c @@ -41,26 +41,22 @@ Trigger* get_trigger_by_id(s32 triggerID) { return (*gCurrentTriggerListPtr)[triggerID]; } -#ifdef NON_MATCHING s32 func_80145CE8(s32 arg0) { s32 i; - s32 ret; if (func_800E52F8() == 0) { return 0; } for (i = 0; i < ARRAY_COUNT(gCurrentTriggerListPtr); i++) { - if (((*gCurrentTriggerListPtr)[i] == NULL) || - ((*gCurrentTriggerListPtr)[i]->unk_30 == 0) || - ((*gCurrentTriggerListPtr)[i]->colliderID != arg0) || - ((*gCurrentTriggerListPtr)[i]->genericFlagIndex & 0x100) == 0) { - ret = 1; + Trigger* curTrigger = (*gCurrentTriggerListPtr)[i]; + + if ((curTrigger != NULL) && + (curTrigger->unk_30 != 0) && + (curTrigger->params2 == arg0) && + (curTrigger->flags.flags & 0x100)) { + return 1; } } - - return ret; + return 0; } -#else -INCLUDE_ASM(s32, "code_dbd70_len_700", func_80145CE8); -#endif