From 177aab5f443adf7237af28c3ed87d4b99010c6eb Mon Sep 17 00:00:00 2001 From: angie Date: Wed, 27 Jan 2021 22:47:54 -0300 Subject: [PATCH] func_809797E4 Signed-off-by: angie --- .../actors/ovl_Demo_Gj/func_809797E4.s | 16 ------------- .../actors/ovl_Boss_Ganon2/z_boss_ganon2.h | 4 +++- src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c | 24 +++++++------------ src/overlays/actors/ovl_Demo_Gj/z_demo_gj.h | 4 +++- 4 files changed, 14 insertions(+), 34 deletions(-) delete mode 100644 asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_809797E4.s diff --git a/asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_809797E4.s b/asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_809797E4.s deleted file mode 100644 index fe6a06a07f..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_809797E4.s +++ /dev/null @@ -1,16 +0,0 @@ -glabel func_809797E4 -/* 00EB4 809797E4 AFA50004 */ sw $a1, 0x0004($sp) -/* 00EB8 809797E8 8C820178 */ lw $v0, 0x0178($a0) ## 00000178 -/* 00EBC 809797EC 30A500FF */ andi $a1, $a1, 0x00FF ## $a1 = 00000000 -/* 00EC0 809797F0 50400007 */ beql $v0, $zero, .L80979810 -/* 00EC4 809797F4 00001025 */ or $v0, $zero, $zero ## $v0 = 00000000 -/* 00EC8 809797F8 904E0314 */ lbu $t6, 0x0314($v0) ## 00000314 -/* 00ECC 809797FC 54AE0004 */ bnel $a1, $t6, .L80979810 -/* 00ED0 80979800 00001025 */ or $v0, $zero, $zero ## $v0 = 00000000 -/* 00ED4 80979804 03E00008 */ jr $ra -/* 00ED8 80979808 24020001 */ addiu $v0, $zero, 0x0001 ## $v0 = 00000001 -.L8097980C: -/* 00EDC 8097980C 00001025 */ or $v0, $zero, $zero ## $v0 = 00000000 -.L80979810: -/* 00EE0 80979810 03E00008 */ jr $ra -/* 00EE4 80979814 00000000 */ nop diff --git a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.h b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.h index 8b3a1c44fe..fa1ac8fae9 100644 --- a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.h +++ b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.h @@ -8,7 +8,9 @@ struct BossGanon2; typedef struct BossGanon2 { /* 0x0000 */ Actor actor; - /* 0x014C */ char unk_14C[0x1D8]; + /* 0x014C */ char unk_14C[0x1C8]; + /* 0x0314 */ u8 unk_314; + /* 0x0315 */ char unk_315[0x0F]; /* 0x0324 */ f32 unk_324; /* 0x0328 */ char unk_328[0x5BC]; } BossGanon2; // size = 0x08E4 diff --git a/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c b/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c index e136a9c48f..b21166bffc 100644 --- a/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c +++ b/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c @@ -1,5 +1,4 @@ #include "z_demo_gj.h" -#include "overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.h" #define FLAGS 0x00000030 @@ -432,18 +431,18 @@ s32 DemoGj_FindGanon(DemoGj *this, GlobalContext *globalCtx) { while (actor != NULL) { if (actor->id == ACTOR_BOSS_GANON2) { - this->ganon = actor; + this->ganon = (BossGanon2 *) actor; // Demo_Gj_Search_Boss_Ganon %d: Discover Ganon !!!! osSyncPrintf("Demo_Gj_Search_Boss_Ganon %d:ガノン発見!!!!\n", this->dyna.actor.params); - return 1; + return true; } actor = actor->next; } // Demo_Gj_Search_Boss_Ganon %d: I couldn't find Ganon osSyncPrintf("Demo_Gj_Search_Boss_Ganon %d:ガノン発見出来ず\n", this->dyna.actor.params); - return 0; + return false; } //! @bug: Missing return value when `this->ganon` is already set. } @@ -649,22 +648,15 @@ void func_8097923C(DemoGj *this, GlobalContext *globalCtx) { #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_8097923C.s") #endif - -s32 func_809797E4(DemoGj *this, s32 arg1); -#ifdef NON_MATCHING -s32 func_809797E4(DemoGj *this, s32 arg1) { - BossGanon2 *ganon = (BossGanon2 *)this->ganon; +s32 func_809797E4(DemoGj *this, u8 arg1) { + BossGanon2 *ganon = this->ganon; arg1 &= 0xFF; - //if ((ganon != 0) && ((arg1 & 0xFF) == ganon->unk314)) { - if ((ganon != NULL) && (arg1 == *((u8 *)ganon + 0x314))) { + if ((ganon != 0) && (ganon->unk_314 == arg1)) { return 1; } return 0; } -#else -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Gj/func_809797E4.s") -#endif s32 func_80979818(DemoGj *this, GlobalContext* globalCtx) { return func_809797E4(this, 1); @@ -687,8 +679,8 @@ void func_80979860(DemoGj *this, GlobalContext *globalCtx) { pos = &actor->world.pos; if (this->ganon != NULL) { - xDistance = actor->world.pos.x - this->ganon->world.pos.x; - zDistance = actor->world.pos.z - this->ganon->world.pos.z; + xDistance = actor->world.pos.x - this->ganon->actor.world.pos.x; + zDistance = actor->world.pos.z - this->ganon->actor.world.pos.z; unk_172 = &this->unk_172; diff --git a/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.h b/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.h index 63cc84652e..b93fe969de 100644 --- a/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.h +++ b/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.h @@ -4,6 +4,8 @@ #include "ultra64.h" #include "global.h" +#include "overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.h" + struct DemoGj; typedef struct DemoGj { @@ -12,7 +14,7 @@ typedef struct DemoGj { /* 0x0168 */ s32 unk_168; /* 0x016C */ Vec3s unk_16C; // x,y,z? /* 0x0172 */ Vec3s unk_172; - /* 0x0178 */ Actor* ganon; + /* 0x0178 */ BossGanon2* ganon; /* 0x017C */ s32 unk_17C; /* 0x0180 */ s32 unk_180; /* 0x0184 */ ColliderCylinder unk_184[3];