From 4c3b7644617a389f0cb664b63c257f90eb88fdc4 Mon Sep 17 00:00:00 2001 From: Ethan Roseman Date: Mon, 23 Mar 2020 01:31:03 -0400 Subject: [PATCH 1/5] Almost done --- .../ovl_Bg_Haka_Megane/BgHakaMegane_Destroy.s | 16 --- .../ovl_Bg_Haka_Megane/BgHakaMegane_Init.s | 57 ---------- .../ovl_Bg_Haka_Megane/BgHakaMegane_Update.s | 12 --- .../actors/ovl_Bg_Haka_Megane/func_8087DBF0.s | 34 ------ .../actors/ovl_Bg_Haka_Megane/func_8087DC64.s | 6 -- .../actors/ovl_Bg_Haka_Megane/func_8087DC94.s | 47 -------- spec | 1 - .../ovl_Bg_Haka_Megane/z_bg_haka_megane.c | 102 ++++++++++++++++-- .../ovl_Bg_Haka_Megane/z_bg_haka_megane.h | 7 +- undefined_syms.txt | 3 + 10 files changed, 101 insertions(+), 184 deletions(-) delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Haka_Megane/BgHakaMegane_Destroy.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Haka_Megane/BgHakaMegane_Init.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Haka_Megane/BgHakaMegane_Update.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Haka_Megane/func_8087DBF0.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Haka_Megane/func_8087DC64.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Haka_Megane/func_8087DC94.s diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Haka_Megane/BgHakaMegane_Destroy.s b/asm/non_matchings/overlays/actors/ovl_Bg_Haka_Megane/BgHakaMegane_Destroy.s deleted file mode 100644 index 6e38aca86e..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Haka_Megane/BgHakaMegane_Destroy.s +++ /dev/null @@ -1,16 +0,0 @@ -glabel BgHakaMegane_Destroy -/* 000B4 8087DAF4 27BDFFE8 */ addiu $sp, $sp, 0xFFE8 ## $sp = FFFFFFE8 -/* 000B8 8087DAF8 AFA40018 */ sw $a0, 0x0018($sp) -/* 000BC 8087DAFC 8FAE0018 */ lw $t6, 0x0018($sp) -/* 000C0 8087DB00 AFBF0014 */ sw $ra, 0x0014($sp) -/* 000C4 8087DB04 00A02025 */ or $a0, $a1, $zero ## $a0 = 00000000 -/* 000C8 8087DB08 24A50810 */ addiu $a1, $a1, 0x0810 ## $a1 = 00000810 -/* 000CC 8087DB0C 0C00FB56 */ jal DynaPolyInfo_Free - ## DynaPolyInfo_delReserve -/* 000D0 8087DB10 8DC6014C */ lw $a2, 0x014C($t6) ## 0000014C -/* 000D4 8087DB14 8FBF0014 */ lw $ra, 0x0014($sp) -/* 000D8 8087DB18 27BD0018 */ addiu $sp, $sp, 0x0018 ## $sp = 00000000 -/* 000DC 8087DB1C 03E00008 */ jr $ra -/* 000E0 8087DB20 00000000 */ nop - - diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Haka_Megane/BgHakaMegane_Init.s b/asm/non_matchings/overlays/actors/ovl_Bg_Haka_Megane/BgHakaMegane_Init.s deleted file mode 100644 index 1845ff85c2..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Haka_Megane/BgHakaMegane_Init.s +++ /dev/null @@ -1,57 +0,0 @@ -glabel BgHakaMegane_Init -/* 00000 8087DA40 27BDFFE0 */ addiu $sp, $sp, 0xFFE0 ## $sp = FFFFFFE0 -/* 00004 8087DA44 AFA50024 */ sw $a1, 0x0024($sp) -/* 00008 8087DA48 AFBF001C */ sw $ra, 0x001C($sp) -/* 0000C 8087DA4C AFB00018 */ sw $s0, 0x0018($sp) -/* 00010 8087DA50 3C058088 */ lui $a1, %hi(D_8087DD50) ## $a1 = 80880000 -/* 00014 8087DA54 00808025 */ or $s0, $a0, $zero ## $s0 = 00000000 -/* 00018 8087DA58 0C01E037 */ jal Actor_ProcessInitChain - -/* 0001C 8087DA5C 24A5DD50 */ addiu $a1, $a1, %lo(D_8087DD50) ## $a1 = 8087DD50 -/* 00020 8087DA60 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000 -/* 00024 8087DA64 0C010D20 */ jal DynaPolyInfo_SetActorMove - -/* 00028 8087DA68 00002825 */ or $a1, $zero, $zero ## $a1 = 00000000 -/* 0002C 8087DA6C 860E001C */ lh $t6, 0x001C($s0) ## 0000001C -/* 00030 8087DA70 8FA40024 */ lw $a0, 0x0024($sp) -/* 00034 8087DA74 24050069 */ addiu $a1, $zero, 0x0069 ## $a1 = 00000069 -/* 00038 8087DA78 29C10003 */ slti $at, $t6, 0x0003 -/* 0003C 8087DA7C 5020000A */ beql $at, $zero, .L8087DAA8 -/* 00040 8087DA80 3C010001 */ lui $at, 0x0001 ## $at = 00010000 -/* 00044 8087DA84 8FA40024 */ lw $a0, 0x0024($sp) -/* 00048 8087DA88 3C010001 */ lui $at, 0x0001 ## $at = 00010000 -/* 0004C 8087DA8C 342117A4 */ ori $at, $at, 0x17A4 ## $at = 000117A4 -/* 00050 8087DA90 2405008D */ addiu $a1, $zero, 0x008D ## $a1 = 0000008D -/* 00054 8087DA94 0C02604B */ jal Object_GetIndex - ## ObjectIndex -/* 00058 8087DA98 00812021 */ addu $a0, $a0, $at -/* 0005C 8087DA9C 10000006 */ beq $zero, $zero, .L8087DAB8 -/* 00060 8087DAA0 A2020169 */ sb $v0, 0x0169($s0) ## 00000169 -/* 00064 8087DAA4 3C010001 */ lui $at, 0x0001 ## $at = 00010000 -.L8087DAA8: -/* 00068 8087DAA8 342117A4 */ ori $at, $at, 0x17A4 ## $at = 000117A4 -/* 0006C 8087DAAC 0C02604B */ jal Object_GetIndex - ## ObjectIndex -/* 00070 8087DAB0 00812021 */ addu $a0, $a0, $at -/* 00074 8087DAB4 A2020169 */ sb $v0, 0x0169($s0) ## 00000169 -.L8087DAB8: -/* 00078 8087DAB8 820F0169 */ lb $t7, 0x0169($s0) ## 00000169 -/* 0007C 8087DABC 3C188088 */ lui $t8, %hi(func_8087DB24) ## $t8 = 80880000 -/* 00080 8087DAC0 2718DB24 */ addiu $t8, $t8, %lo(func_8087DB24) ## $t8 = 8087DB24 -/* 00084 8087DAC4 05E30006 */ bgezl $t7, .L8087DAE0 -/* 00088 8087DAC8 AE180164 */ sw $t8, 0x0164($s0) ## 00000164 -/* 0008C 8087DACC 0C00B55C */ jal Actor_Kill - -/* 00090 8087DAD0 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000 -/* 00094 8087DAD4 10000003 */ beq $zero, $zero, .L8087DAE4 -/* 00098 8087DAD8 8FBF001C */ lw $ra, 0x001C($sp) -/* 0009C 8087DADC AE180164 */ sw $t8, 0x0164($s0) ## 00000164 -.L8087DAE0: -/* 000A0 8087DAE0 8FBF001C */ lw $ra, 0x001C($sp) -.L8087DAE4: -/* 000A4 8087DAE4 8FB00018 */ lw $s0, 0x0018($sp) -/* 000A8 8087DAE8 27BD0020 */ addiu $sp, $sp, 0x0020 ## $sp = 00000000 -/* 000AC 8087DAEC 03E00008 */ jr $ra -/* 000B0 8087DAF0 00000000 */ nop - - diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Haka_Megane/BgHakaMegane_Update.s b/asm/non_matchings/overlays/actors/ovl_Bg_Haka_Megane/BgHakaMegane_Update.s deleted file mode 100644 index e2ad034ac0..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Haka_Megane/BgHakaMegane_Update.s +++ /dev/null @@ -1,12 +0,0 @@ -glabel BgHakaMegane_Update -/* 00230 8087DC70 27BDFFE8 */ addiu $sp, $sp, 0xFFE8 ## $sp = FFFFFFE8 -/* 00234 8087DC74 AFBF0014 */ sw $ra, 0x0014($sp) -/* 00238 8087DC78 8C990164 */ lw $t9, 0x0164($a0) ## 00000164 -/* 0023C 8087DC7C 0320F809 */ jalr $ra, $t9 -/* 00240 8087DC80 00000000 */ nop -/* 00244 8087DC84 8FBF0014 */ lw $ra, 0x0014($sp) -/* 00248 8087DC88 27BD0018 */ addiu $sp, $sp, 0x0018 ## $sp = 00000000 -/* 0024C 8087DC8C 03E00008 */ jr $ra -/* 00250 8087DC90 00000000 */ nop - - diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Haka_Megane/func_8087DBF0.s b/asm/non_matchings/overlays/actors/ovl_Bg_Haka_Megane/func_8087DBF0.s deleted file mode 100644 index 23e2a2b082..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Haka_Megane/func_8087DBF0.s +++ /dev/null @@ -1,34 +0,0 @@ -glabel func_8087DBF0 -/* 001B0 8087DBF0 27BDFFE0 */ addiu $sp, $sp, 0xFFE0 ## $sp = FFFFFFE0 -/* 001B4 8087DBF4 AFBF001C */ sw $ra, 0x001C($sp) -/* 001B8 8087DBF8 AFB00018 */ sw $s0, 0x0018($sp) -/* 001BC 8087DBFC 90AE1C27 */ lbu $t6, 0x1C27($a1) ## 00001C27 -/* 001C0 8087DC00 00A08025 */ or $s0, $a1, $zero ## $s0 = 00000000 -/* 001C4 8087DC04 00803825 */ or $a3, $a0, $zero ## $a3 = 00000000 -/* 001C8 8087DC08 11C0000A */ beq $t6, $zero, .L8087DC34 -/* 001CC 8087DC0C 2401FF7F */ addiu $at, $zero, 0xFF7F ## $at = FFFFFF7F -/* 001D0 8087DC10 8C8F0004 */ lw $t7, 0x0004($a0) ## 00000004 -/* 001D4 8087DC14 35F80080 */ ori $t8, $t7, 0x0080 ## $t8 = 00000080 -/* 001D8 8087DC18 AC980004 */ sw $t8, 0x0004($a0) ## 00000004 -/* 001DC 8087DC1C 00A02025 */ or $a0, $a1, $zero ## $a0 = 00000000 -/* 001E0 8087DC20 24A50810 */ addiu $a1, $a1, 0x0810 ## $a1 = 00000810 -/* 001E4 8087DC24 0C00FAFE */ jal func_8003EBF8 -/* 001E8 8087DC28 8CE6014C */ lw $a2, 0x014C($a3) ## 0000014C -/* 001EC 8087DC2C 10000009 */ beq $zero, $zero, .L8087DC54 -/* 001F0 8087DC30 8FBF001C */ lw $ra, 0x001C($sp) -.L8087DC34: -/* 001F4 8087DC34 8CF90004 */ lw $t9, 0x0004($a3) ## 00000004 -/* 001F8 8087DC38 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000 -/* 001FC 8087DC3C 26050810 */ addiu $a1, $s0, 0x0810 ## $a1 = 00000810 -/* 00200 8087DC40 03214024 */ and $t0, $t9, $at -/* 00204 8087DC44 ACE80004 */ sw $t0, 0x0004($a3) ## 00000004 -/* 00208 8087DC48 0C00FB14 */ jal func_8003EC50 -/* 0020C 8087DC4C 8CE6014C */ lw $a2, 0x014C($a3) ## 0000014C -/* 00210 8087DC50 8FBF001C */ lw $ra, 0x001C($sp) -.L8087DC54: -/* 00214 8087DC54 8FB00018 */ lw $s0, 0x0018($sp) -/* 00218 8087DC58 27BD0020 */ addiu $sp, $sp, 0x0020 ## $sp = 00000000 -/* 0021C 8087DC5C 03E00008 */ jr $ra -/* 00220 8087DC60 00000000 */ nop - - diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Haka_Megane/func_8087DC64.s b/asm/non_matchings/overlays/actors/ovl_Bg_Haka_Megane/func_8087DC64.s deleted file mode 100644 index 3f17a97c65..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Haka_Megane/func_8087DC64.s +++ /dev/null @@ -1,6 +0,0 @@ -glabel func_8087DC64 -/* 00224 8087DC64 AFA40000 */ sw $a0, 0x0000($sp) -/* 00228 8087DC68 03E00008 */ jr $ra -/* 0022C 8087DC6C AFA50004 */ sw $a1, 0x0004($sp) - - diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Haka_Megane/func_8087DC94.s b/asm/non_matchings/overlays/actors/ovl_Bg_Haka_Megane/func_8087DC94.s deleted file mode 100644 index 3f612a4b87..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Haka_Megane/func_8087DC94.s +++ /dev/null @@ -1,47 +0,0 @@ -glabel func_8087DC94 -/* 00254 8087DC94 27BDFFE8 */ addiu $sp, $sp, 0xFFE8 ## $sp = FFFFFFE8 -/* 00258 8087DC98 AFBF0014 */ sw $ra, 0x0014($sp) -/* 0025C 8087DC9C AFA5001C */ sw $a1, 0x001C($sp) -/* 00260 8087DCA0 8C8E0004 */ lw $t6, 0x0004($a0) ## 00000004 -/* 00264 8087DCA4 00803025 */ or $a2, $a0, $zero ## $a2 = 00000000 -/* 00268 8087DCA8 24010080 */ addiu $at, $zero, 0x0080 ## $at = 00000080 -/* 0026C 8087DCAC 31CF0080 */ andi $t7, $t6, 0x0080 ## $t7 = 00000000 -/* 00270 8087DCB0 15E1000B */ bne $t7, $at, .L8087DCE0 -/* 00274 8087DCB4 8FA4001C */ lw $a0, 0x001C($sp) -/* 00278 8087DCB8 84D8001C */ lh $t8, 0x001C($a2) ## 0000001C -/* 0027C 8087DCBC 00A02025 */ or $a0, $a1, $zero ## $a0 = 00000000 -/* 00280 8087DCC0 3C058088 */ lui $a1, %hi(D_8087DD88) ## $a1 = 80880000 -/* 00284 8087DCC4 0018C880 */ sll $t9, $t8, 2 -/* 00288 8087DCC8 00B92821 */ addu $a1, $a1, $t9 -/* 0028C 8087DCCC 8CA5DD88 */ lw $a1, %lo(D_8087DD88)($a1) -/* 00290 8087DCD0 0C00D4C9 */ jal Draw_DListXlu - -/* 00294 8087DCD4 AFA60018 */ sw $a2, 0x0018($sp) -/* 00298 8087DCD8 10000009 */ beq $zero, $zero, .L8087DD00 -/* 0029C 8087DCDC 8FAA0018 */ lw $t2, 0x0018($sp) -.L8087DCE0: -/* 002A0 8087DCE0 84C8001C */ lh $t0, 0x001C($a2) ## 0000001C -/* 002A4 8087DCE4 3C058088 */ lui $a1, %hi(D_8087DD88) ## $a1 = 80880000 -/* 002A8 8087DCE8 AFA60018 */ sw $a2, 0x0018($sp) -/* 002AC 8087DCEC 00084880 */ sll $t1, $t0, 2 -/* 002B0 8087DCF0 00A92821 */ addu $a1, $a1, $t1 -/* 002B4 8087DCF4 0C00D498 */ jal Draw_DListOpa - -/* 002B8 8087DCF8 8CA5DD88 */ lw $a1, %lo(D_8087DD88)($a1) -/* 002BC 8087DCFC 8FAA0018 */ lw $t2, 0x0018($sp) -.L8087DD00: -/* 002C0 8087DD00 8FA4001C */ lw $a0, 0x001C($sp) -/* 002C4 8087DD04 3C050600 */ lui $a1, 0x0600 ## $a1 = 06000000 -/* 002C8 8087DD08 854B001C */ lh $t3, 0x001C($t2) ## 0000001C -/* 002CC 8087DD0C 55600004 */ bnel $t3, $zero, .L8087DD20 -/* 002D0 8087DD10 8FBF0014 */ lw $ra, 0x0014($sp) -/* 002D4 8087DD14 0C00D4C9 */ jal Draw_DListXlu - -/* 002D8 8087DD18 24A51250 */ addiu $a1, $a1, 0x1250 ## $a1 = 06001250 -/* 002DC 8087DD1C 8FBF0014 */ lw $ra, 0x0014($sp) -.L8087DD20: -/* 002E0 8087DD20 27BD0018 */ addiu $sp, $sp, 0x0018 ## $sp = 00000000 -/* 002E4 8087DD24 03E00008 */ jr $ra -/* 002E8 8087DD28 00000000 */ nop -/* 002EC 8087DD2C 00000000 */ nop - diff --git a/spec b/spec index 1c5e4ba705..7b5f072fc7 100644 --- a/spec +++ b/spec @@ -866,7 +866,6 @@ endseg beginseg name "ovl_Bg_Haka_Megane" include "build/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.o" - include "build/data/overlays/actors/z_bg_haka_megane.data.o" include "build/data/overlays/actors/z_bg_haka_megane.reloc.o" endseg diff --git a/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c b/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c index 2454dc22ea..980d584f1e 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c +++ b/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c @@ -7,7 +7,11 @@ void BgHakaMegane_Init(BgHakaMegane* this, GlobalContext* globalCtx); void BgHakaMegane_Destroy(BgHakaMegane* this, GlobalContext* globalCtx); void BgHakaMegane_Update(BgHakaMegane* this, GlobalContext* globalCtx); -/* +void func_8087DB24(BgHakaMegane* this, GlobalContext* globalCtx); +void func_8087DBF0(BgHakaMegane* this, GlobalContext* globalCtx); +void func_8087DC64(BgHakaMegane* this, GlobalContext* globalCtx); +void func_8087DC94(BgHakaMegane* this, GlobalContext* globalCtx); + const ActorInit Bg_Haka_Megane_InitVars = { ACTOR_BG_HAKA_MEGANE, @@ -21,17 +25,97 @@ const ActorInit Bg_Haka_Megane_InitVars = (ActorFunc)BgHakaMegane_Update, NULL, }; -*/ -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_Megane/BgHakaMegane_Init.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_Megane/BgHakaMegane_Destroy.s") +InitChainEntry initChain[] = { + ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_Megane/func_8087DB24.s") +UNK_TYPE D_8087DD54[] = { + 0x06001830, 0x06001AB8, 0x00000000, 0x06004330, 0x060044D0, 0x00000000, 0x06004780, + 0x06004940, 0x00000000, 0x06004B00, 0x00000000, 0x06004CC0, 0x00000000, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_Megane/func_8087DBF0.s") +UNK_TYPE D_8087DD88[] = { + 0x06001060, 0x06001920, 0x060003F0, 0x060040F0, 0x060043B0, 0x06001120, 0x060045A0, + 0x060047F0, 0x060018F0, 0x060049B0, 0x06003CF0, 0x06004B70, 0x06002ED0, 0x00000000, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_Megane/func_8087DC64.s") +extern UNK_TYPE D_06001250; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_Megane/BgHakaMegane_Update.s") +void BgHakaMegane_Init(BgHakaMegane* this, GlobalContext* globalCtx) { + Actor* thisx = &this->dyna.actor; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Haka_Megane/func_8087DC94.s") + Actor_ProcessInitChain(thisx, initChain); + DynaPolyInfo_SetActorMove(thisx, 0); + + if (thisx->params < 3) { + this->objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_HAKACH_OBJECTS); + } else { + this->objBankIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_HAKA_OBJECTS); + } + + if (this->objBankIndex < 0) { + Actor_Kill(thisx); + } else { + this->actionFunc = (ActorFunc)func_8087DB24; + } +} + +void BgHakaMegane_Destroy(BgHakaMegane* this, GlobalContext* globalCtx) { + DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId); +} + +void func_8087DB24(BgHakaMegane* this, GlobalContext* globalCtx) { + Actor* thisx = &this->dyna.actor; + s32 local_c; + u32 collision; + + if (Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndex)) { + thisx->draw = (ActorFunc)func_8087DC94; + thisx->objBankIndex = this->objBankIndex; + Actor_SetObjectDependency(globalCtx, thisx); + if (globalCtx->roomCtx.curRoom.showInvisActors) { + this->actionFunc = (ActorFunc)func_8087DBF0; + collision = D_8087DD54[thisx->params]; + if (collision != 0) { + DynaPolyInfo_Alloc(&collision, &local_c); + this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, thisx, local_c); + } + } else { + this->actionFunc = (ActorFunc)func_8087DC64; + } + } +} + +void func_8087DBF0(BgHakaMegane* this, GlobalContext* globalCtx) { + Actor* thisx = &this->dyna.actor; + if (globalCtx->actorCtx.unk_03 != 0) { + thisx->flags |= 0x80; + func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId); + } else { + thisx->flags &= -0x81; + func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId); + } +} + +void func_8087DC64(BgHakaMegane* this, GlobalContext* globalCtx) { + +} + +void BgHakaMegane_Update(BgHakaMegane* this, GlobalContext* globalCtx) { + this->actionFunc(this, globalCtx); +} + +void func_8087DC94(BgHakaMegane* this, GlobalContext* globalCtx) { + Actor* thisx = &this->dyna.actor; + + if ((thisx->flags & 0x80) == 0x80) { + Draw_DListXlu(globalCtx, D_8087DD88[thisx->params]); + } else { + Draw_DListOpa(globalCtx, D_8087DD88[thisx->params]); + } + + if (thisx->params == 0) { + Draw_DListXlu(globalCtx, &D_06001250); + } +} diff --git a/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.h b/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.h index 06fb457b62..18d029aeb3 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.h +++ b/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.h @@ -5,8 +5,11 @@ #include typedef struct { - /* 0x0000 */ Actor actor; - /* 0x014C */ char unk_14C[0x20]; + /* 0x0000 */ DynaPolyActor dyna; + /* 0x0164 */ ActorFunc actionFunc; + /* 0x0168 */ char unk_168[0x1]; + /* 0x0169 */ s8 objBankIndex; + /* 0x016A */ char unk_16A[0x2]; } BgHakaMegane; // size = 0x016C extern const ActorInit Bg_Haka_Megane_InitVars; diff --git a/undefined_syms.txt b/undefined_syms.txt index 7980357d0d..120d605fbd 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -258,6 +258,9 @@ D_060003C0 = 0x060003C0; D_060030A0 = 0x060030A0; D_06003158 = 0x06003158; +// z_bg_haka_megane +D_06001250 = 0x06001250; + // z_bg_haka_meganebg D_06005334 = 0x06005334; D_06009168 = 0x06009168; From 1042a72fd2439e6c0f02bb37bb221572caa4d157 Mon Sep 17 00:00:00 2001 From: Ethan Roseman Date: Mon, 23 Mar 2020 15:23:50 -0400 Subject: [PATCH 2/5] Done --- data/overlays/actors/z_bg_haka_megane.data.s | 22 ------- data/overlays/actors/z_bg_haka_megane.reloc.s | 11 ---- spec | 2 +- .../ovl_Bg_Haka_Megane/z_bg_haka_megane.c | 64 ++++++++++--------- 4 files changed, 36 insertions(+), 63 deletions(-) delete mode 100644 data/overlays/actors/z_bg_haka_megane.data.s delete mode 100644 data/overlays/actors/z_bg_haka_megane.reloc.s diff --git a/data/overlays/actors/z_bg_haka_megane.data.s b/data/overlays/actors/z_bg_haka_megane.data.s deleted file mode 100644 index 549be94316..0000000000 --- a/data/overlays/actors/z_bg_haka_megane.data.s +++ /dev/null @@ -1,22 +0,0 @@ -.include "macro.inc" - - # assembler directives - .set noat # allow manual use of $at - .set noreorder # don't insert nops after branches - .set gp=64 # allow use of 64-bit general purposee registers - -.section .data - -glabel Bg_Haka_Megane_InitVars - .word 0x00AE0600, 0x000000B0, 0x00010000, 0x0000016C -.word BgHakaMegane_Init -.word BgHakaMegane_Destroy -.word BgHakaMegane_Update -.word 0x00000000 -glabel D_8087DD50 - .word 0x48500064 -glabel D_8087DD54 - .word 0x06001830, 0x06001AB8, 0x00000000, 0x06004330, 0x060044D0, 0x00000000, 0x06004780, 0x06004940, 0x00000000, 0x06004B00, 0x00000000, 0x06004CC0, 0x00000000 -glabel D_8087DD88 - .word 0x06001060, 0x06001920, 0x060003F0, 0x060040F0, 0x060043B0, 0x06001120, 0x060045A0, 0x060047F0, 0x060018F0, 0x060049B0, 0x06003CF0, 0x06004B70, 0x06002ED0, 0x00000000 - diff --git a/data/overlays/actors/z_bg_haka_megane.reloc.s b/data/overlays/actors/z_bg_haka_megane.reloc.s deleted file mode 100644 index 93d77a13c6..0000000000 --- a/data/overlays/actors/z_bg_haka_megane.reloc.s +++ /dev/null @@ -1,11 +0,0 @@ -.include "macro.inc" - - # assembler directives - .set noat # allow manual use of $at - .set noreorder # don't insert nops after branches - .set gp=64 # allow use of 64-bit general purposee registers - -.section .rodata -glabel D_8087DDC0 - -.incbin "baserom/ovl_Bg_Haka_Megane", 0x380, 0x00000070 diff --git a/spec b/spec index 7b5f072fc7..f640e16ab9 100644 --- a/spec +++ b/spec @@ -866,7 +866,7 @@ endseg beginseg name "ovl_Bg_Haka_Megane" include "build/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.o" - include "build/data/overlays/actors/z_bg_haka_megane.reloc.o" + include "build/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane_reloc.o" endseg beginseg diff --git a/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c b/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c index 980d584f1e..a3d30e0823 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c +++ b/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c @@ -1,16 +1,22 @@ +/* + * File: z_bg_haka_megane.c + * Overlay: ovl_Bg_Haka_Megane + * Description: + */ + #include "z_bg_haka_megane.h" #define ROOM 0x00 #define FLAGS 0x000000B0 -void BgHakaMegane_Init(BgHakaMegane* this, GlobalContext* globalCtx); -void BgHakaMegane_Destroy(BgHakaMegane* this, GlobalContext* globalCtx); -void BgHakaMegane_Update(BgHakaMegane* this, GlobalContext* globalCtx); +static void BgHakaMegane_Init(BgHakaMegane* this, GlobalContext* globalCtx); +static void BgHakaMegane_Destroy(BgHakaMegane* this, GlobalContext* globalCtx); +static void BgHakaMegane_Update(BgHakaMegane* this, GlobalContext* globalCtx); -void func_8087DB24(BgHakaMegane* this, GlobalContext* globalCtx); -void func_8087DBF0(BgHakaMegane* this, GlobalContext* globalCtx); -void func_8087DC64(BgHakaMegane* this, GlobalContext* globalCtx); -void func_8087DC94(BgHakaMegane* this, GlobalContext* globalCtx); +static void func_8087DB24(BgHakaMegane* this, GlobalContext* globalCtx); +static void func_8087DBF0(BgHakaMegane* this, GlobalContext* globalCtx); +static void func_8087DC64(BgHakaMegane* this, GlobalContext* globalCtx); +static void func_8087DC94(BgHakaMegane* this, GlobalContext* globalCtx); const ActorInit Bg_Haka_Megane_InitVars = { @@ -26,23 +32,23 @@ const ActorInit Bg_Haka_Megane_InitVars = NULL, }; -InitChainEntry initChain[] = { +static InitChainEntry initChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -UNK_TYPE D_8087DD54[] = { +static UNK_TYPE collisions[] = { 0x06001830, 0x06001AB8, 0x00000000, 0x06004330, 0x060044D0, 0x00000000, 0x06004780, 0x06004940, 0x00000000, 0x06004B00, 0x00000000, 0x06004CC0, 0x00000000, }; -UNK_TYPE D_8087DD88[] = { +static UNK_TYPE dlists[] = { 0x06001060, 0x06001920, 0x060003F0, 0x060040F0, 0x060043B0, 0x06001120, 0x060045A0, - 0x060047F0, 0x060018F0, 0x060049B0, 0x06003CF0, 0x06004B70, 0x06002ED0, 0x00000000, + 0x060047F0, 0x060018F0, 0x060049B0, 0x06003CF0, 0x06004B70, 0x06002ED0, }; extern UNK_TYPE D_06001250; -void BgHakaMegane_Init(BgHakaMegane* this, GlobalContext* globalCtx) { +static void BgHakaMegane_Init(BgHakaMegane* this, GlobalContext* globalCtx) { Actor* thisx = &this->dyna.actor; Actor_ProcessInitChain(thisx, initChain); @@ -61,25 +67,25 @@ void BgHakaMegane_Init(BgHakaMegane* this, GlobalContext* globalCtx) { } } -void BgHakaMegane_Destroy(BgHakaMegane* this, GlobalContext* globalCtx) { +static void BgHakaMegane_Destroy(BgHakaMegane* this, GlobalContext* globalCtx) { DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId); } -void func_8087DB24(BgHakaMegane* this, GlobalContext* globalCtx) { - Actor* thisx = &this->dyna.actor; - s32 local_c; - u32 collision; +static void func_8087DB24(BgHakaMegane* this, GlobalContext* globalCtx) { + s32 localC; + UNK_TYPE collision; if (Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndex)) { - thisx->draw = (ActorFunc)func_8087DC94; - thisx->objBankIndex = this->objBankIndex; - Actor_SetObjectDependency(globalCtx, thisx); + this->dyna.actor.objBankIndex = this->objBankIndex; + this->dyna.actor.draw = (ActorFunc)func_8087DC94; + Actor_SetObjectDependency(globalCtx, &this->dyna.actor); if (globalCtx->roomCtx.curRoom.showInvisActors) { this->actionFunc = (ActorFunc)func_8087DBF0; - collision = D_8087DD54[thisx->params]; + collision = collisions[this->dyna.actor.params]; if (collision != 0) { - DynaPolyInfo_Alloc(&collision, &local_c); - this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, thisx, local_c); + DynaPolyInfo_Alloc(collision, &localC); + this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, + &this->dyna.actor, localC); } } else { this->actionFunc = (ActorFunc)func_8087DC64; @@ -87,7 +93,7 @@ void func_8087DB24(BgHakaMegane* this, GlobalContext* globalCtx) { } } -void func_8087DBF0(BgHakaMegane* this, GlobalContext* globalCtx) { +static void func_8087DBF0(BgHakaMegane* this, GlobalContext* globalCtx) { Actor* thisx = &this->dyna.actor; if (globalCtx->actorCtx.unk_03 != 0) { thisx->flags |= 0x80; @@ -98,21 +104,21 @@ void func_8087DBF0(BgHakaMegane* this, GlobalContext* globalCtx) { } } -void func_8087DC64(BgHakaMegane* this, GlobalContext* globalCtx) { +static void func_8087DC64(BgHakaMegane* this, GlobalContext* globalCtx) { } -void BgHakaMegane_Update(BgHakaMegane* this, GlobalContext* globalCtx) { +static void BgHakaMegane_Update(BgHakaMegane* this, GlobalContext* globalCtx) { this->actionFunc(this, globalCtx); } -void func_8087DC94(BgHakaMegane* this, GlobalContext* globalCtx) { +static void func_8087DC94(BgHakaMegane* this, GlobalContext* globalCtx) { Actor* thisx = &this->dyna.actor; if ((thisx->flags & 0x80) == 0x80) { - Draw_DListXlu(globalCtx, D_8087DD88[thisx->params]); + Draw_DListXlu(globalCtx, dlists[thisx->params]); } else { - Draw_DListOpa(globalCtx, D_8087DD88[thisx->params]); + Draw_DListOpa(globalCtx, dlists[thisx->params]); } if (thisx->params == 0) { From ea3f70cd68885187b7b910b658240b7ad9c62a89 Mon Sep 17 00:00:00 2001 From: Ethan Roseman Date: Mon, 23 Mar 2020 15:25:23 -0400 Subject: [PATCH 3/5] Formatting --- src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c b/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c index a3d30e0823..b0ac30bc0b 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c +++ b/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c @@ -18,8 +18,7 @@ static void func_8087DBF0(BgHakaMegane* this, GlobalContext* globalCtx); static void func_8087DC64(BgHakaMegane* this, GlobalContext* globalCtx); static void func_8087DC94(BgHakaMegane* this, GlobalContext* globalCtx); -const ActorInit Bg_Haka_Megane_InitVars = -{ +const ActorInit Bg_Haka_Megane_InitVars = { ACTOR_BG_HAKA_MEGANE, ACTORTYPE_PROP, ROOM, @@ -84,8 +83,8 @@ static void func_8087DB24(BgHakaMegane* this, GlobalContext* globalCtx) { collision = collisions[this->dyna.actor.params]; if (collision != 0) { DynaPolyInfo_Alloc(collision, &localC); - this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, - &this->dyna.actor, localC); + this->dyna.dynaPolyId = + DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, localC); } } else { this->actionFunc = (ActorFunc)func_8087DC64; @@ -105,7 +104,6 @@ static void func_8087DBF0(BgHakaMegane* this, GlobalContext* globalCtx) { } static void func_8087DC64(BgHakaMegane* this, GlobalContext* globalCtx) { - } static void BgHakaMegane_Update(BgHakaMegane* this, GlobalContext* globalCtx) { From 82b155529585a3abde70213c7d2bc9b82e3bfc08 Mon Sep 17 00:00:00 2001 From: Ethan Roseman Date: Mon, 23 Mar 2020 17:37:40 -0400 Subject: [PATCH 4/5] PR fix --- src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c b/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c index b0ac30bc0b..5865fb196b 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c +++ b/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c @@ -14,7 +14,7 @@ static void BgHakaMegane_Destroy(BgHakaMegane* this, GlobalContext* globalCtx); static void BgHakaMegane_Update(BgHakaMegane* this, GlobalContext* globalCtx); static void func_8087DB24(BgHakaMegane* this, GlobalContext* globalCtx); -static void func_8087DBF0(BgHakaMegane* this, GlobalContext* globalCtx); + void func_8087DBF0(BgHakaMegane* this, GlobalContext* globalCtx); static void func_8087DC64(BgHakaMegane* this, GlobalContext* globalCtx); static void func_8087DC94(BgHakaMegane* this, GlobalContext* globalCtx); @@ -92,13 +92,13 @@ static void func_8087DB24(BgHakaMegane* this, GlobalContext* globalCtx) { } } -static void func_8087DBF0(BgHakaMegane* this, GlobalContext* globalCtx) { +void func_8087DBF0(BgHakaMegane* this, GlobalContext* globalCtx) { Actor* thisx = &this->dyna.actor; if (globalCtx->actorCtx.unk_03 != 0) { thisx->flags |= 0x80; func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId); } else { - thisx->flags &= -0x81; + thisx->flags &= ~0x80; func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId); } } From 1abc15910fe86f90c1839d3587239fb3bd5156be Mon Sep 17 00:00:00 2001 From: Ethan Roseman Date: Mon, 23 Mar 2020 17:38:22 -0400 Subject: [PATCH 5/5] oopz --- src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c b/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c index 5865fb196b..3264890c58 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c +++ b/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c @@ -14,7 +14,7 @@ static void BgHakaMegane_Destroy(BgHakaMegane* this, GlobalContext* globalCtx); static void BgHakaMegane_Update(BgHakaMegane* this, GlobalContext* globalCtx); static void func_8087DB24(BgHakaMegane* this, GlobalContext* globalCtx); - void func_8087DBF0(BgHakaMegane* this, GlobalContext* globalCtx); +static void func_8087DBF0(BgHakaMegane* this, GlobalContext* globalCtx); static void func_8087DC64(BgHakaMegane* this, GlobalContext* globalCtx); static void func_8087DC94(BgHakaMegane* this, GlobalContext* globalCtx); @@ -92,7 +92,7 @@ static void func_8087DB24(BgHakaMegane* this, GlobalContext* globalCtx) { } } -void func_8087DBF0(BgHakaMegane* this, GlobalContext* globalCtx) { +static void func_8087DBF0(BgHakaMegane* this, GlobalContext* globalCtx) { Actor* thisx = &this->dyna.actor; if (globalCtx->actorCtx.unk_03 != 0) { thisx->flags |= 0x80;