From d3b88e1b1cc371388abe9f34e4880342da136bf6 Mon Sep 17 00:00:00 2001 From: Tom Overton Date: Thu, 13 Aug 2020 21:17:25 -0700 Subject: [PATCH] Ovl_Bg_Spot01_Idomizu OK (#303) * Init OK (with weird goto) * func_808ABB84 matching * BgSpot01Idomizu_Destroy matching * Run ./format.sh * BgSpot01Idomizu_Update matching * Remove Init's goto * BgSpot01Idomizu_Draw matching * Delete BgSpot01Idomizu asm files * Variable naming and cleanup * Update spec * Delete unused ASM * Address review feedback * Fix fake match in Draw caused by not doing dispRefs[4] --- .../BgSpot01Idomizu_Destroy.s | 4 - .../BgSpot01Idomizu_Draw.s | 93 ------------------- .../BgSpot01Idomizu_Init.s | 49 ---------- .../BgSpot01Idomizu_Update.s | 10 -- .../ovl_Bg_Spot01_Idomizu/func_808ABB84.s | 54 ----------- .../actors/z_bg_spot01_idomizu.data.s | 20 ---- .../actors/z_bg_spot01_idomizu.reloc.s | 13 --- spec | 3 +- .../z_bg_spot01_idomizu.c | 64 +++++++++++-- .../z_bg_spot01_idomizu.h | 2 +- undefined_syms.txt | 3 + 11 files changed, 62 insertions(+), 253 deletions(-) delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Idomizu/BgSpot01Idomizu_Destroy.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Idomizu/BgSpot01Idomizu_Draw.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Idomizu/BgSpot01Idomizu_Init.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Idomizu/BgSpot01Idomizu_Update.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Idomizu/func_808ABB84.s delete mode 100644 data/overlays/actors/z_bg_spot01_idomizu.data.s delete mode 100644 data/overlays/actors/z_bg_spot01_idomizu.reloc.s diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Idomizu/BgSpot01Idomizu_Destroy.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Idomizu/BgSpot01Idomizu_Destroy.s deleted file mode 100644 index ab71eafa13..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Idomizu/BgSpot01Idomizu_Destroy.s +++ /dev/null @@ -1,4 +0,0 @@ -glabel BgSpot01Idomizu_Destroy -/* 00098 808ABB78 AFA40000 */ sw $a0, 0x0000($sp) -/* 0009C 808ABB7C 03E00008 */ jr $ra -/* 000A0 808ABB80 AFA50004 */ sw $a1, 0x0004($sp) diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Idomizu/BgSpot01Idomizu_Draw.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Idomizu/BgSpot01Idomizu_Draw.s deleted file mode 100644 index 416ec9bc3f..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Idomizu/BgSpot01Idomizu_Draw.s +++ /dev/null @@ -1,93 +0,0 @@ -.rdata -glabel D_808ABDC0 - .asciz "../z_bg_spot01_idomizu.c" - .balign 4 - -glabel D_808ABDDC - .asciz "../z_bg_spot01_idomizu.c" - .balign 4 - -glabel D_808ABDF8 - .asciz "../z_bg_spot01_idomizu.c" - .balign 4 - -.text -glabel BgSpot01Idomizu_Draw -/* 00178 808ABC58 27BDFF90 */ addiu $sp, $sp, 0xFF90 ## $sp = FFFFFF90 -/* 0017C 808ABC5C AFB10038 */ sw $s1, 0x0038($sp) -/* 00180 808ABC60 00A08825 */ or $s1, $a1, $zero ## $s1 = 00000000 -/* 00184 808ABC64 AFBF003C */ sw $ra, 0x003C($sp) -/* 00188 808ABC68 AFB00034 */ sw $s0, 0x0034($sp) -/* 0018C 808ABC6C AFA40070 */ sw $a0, 0x0070($sp) -/* 00190 808ABC70 8CA50000 */ lw $a1, 0x0000($a1) ## 00000000 -/* 00194 808ABC74 3C06808B */ lui $a2, %hi(D_808ABDC0) ## $a2 = 808B0000 -/* 00198 808ABC78 24C6BDC0 */ addiu $a2, $a2, %lo(D_808ABDC0) ## $a2 = 808ABDC0 -/* 0019C 808ABC7C 27A40058 */ addiu $a0, $sp, 0x0058 ## $a0 = FFFFFFE8 -/* 001A0 808ABC80 240700E4 */ addiu $a3, $zero, 0x00E4 ## $a3 = 000000E4 -/* 001A4 808ABC84 0C031AB1 */ jal Graph_OpenDisps -/* 001A8 808ABC88 00A08025 */ or $s0, $a1, $zero ## $s0 = 00000000 -/* 001AC 808ABC8C 0C024F61 */ jal func_80093D84 -/* 001B0 808ABC90 8E240000 */ lw $a0, 0x0000($s1) ## 00000000 -/* 001B4 808ABC94 8E0202D0 */ lw $v0, 0x02D0($s0) ## 000002D0 -/* 001B8 808ABC98 3C0FDA38 */ lui $t7, 0xDA38 ## $t7 = DA380000 -/* 001BC 808ABC9C 35EF0003 */ ori $t7, $t7, 0x0003 ## $t7 = DA380003 -/* 001C0 808ABCA0 244E0008 */ addiu $t6, $v0, 0x0008 ## $t6 = 00000008 -/* 001C4 808ABCA4 AE0E02D0 */ sw $t6, 0x02D0($s0) ## 000002D0 -/* 001C8 808ABCA8 AC4F0000 */ sw $t7, 0x0000($v0) ## 00000000 -/* 001CC 808ABCAC 8E240000 */ lw $a0, 0x0000($s1) ## 00000000 -/* 001D0 808ABCB0 3C05808B */ lui $a1, %hi(D_808ABDDC) ## $a1 = 808B0000 -/* 001D4 808ABCB4 24A5BDDC */ addiu $a1, $a1, %lo(D_808ABDDC) ## $a1 = 808ABDDC -/* 001D8 808ABCB8 240600E8 */ addiu $a2, $zero, 0x00E8 ## $a2 = 000000E8 -/* 001DC 808ABCBC 0C0346A2 */ jal Matrix_NewMtx -/* 001E0 808ABCC0 AFA20054 */ sw $v0, 0x0054($sp) -/* 001E4 808ABCC4 8FA30054 */ lw $v1, 0x0054($sp) -/* 001E8 808ABCC8 3C19DB06 */ lui $t9, 0xDB06 ## $t9 = DB060000 -/* 001EC 808ABCCC 37390020 */ ori $t9, $t9, 0x0020 ## $t9 = DB060020 -/* 001F0 808ABCD0 AC620004 */ sw $v0, 0x0004($v1) ## 00000004 -/* 001F4 808ABCD4 8E0202D0 */ lw $v0, 0x02D0($s0) ## 000002D0 -/* 001F8 808ABCD8 8E28009C */ lw $t0, 0x009C($s1) ## 0000009C -/* 001FC 808ABCDC 240A007F */ addiu $t2, $zero, 0x007F ## $t2 = 0000007F -/* 00200 808ABCE0 24580008 */ addiu $t8, $v0, 0x0008 ## $t8 = 00000008 -/* 00204 808ABCE4 AE1802D0 */ sw $t8, 0x02D0($s0) ## 000002D0 -/* 00208 808ABCE8 AC590000 */ sw $t9, 0x0000($v0) ## 00000000 -/* 0020C 808ABCEC 8E240000 */ lw $a0, 0x0000($s1) ## 00000000 -/* 00210 808ABCF0 240B0020 */ addiu $t3, $zero, 0x0020 ## $t3 = 00000020 -/* 00214 808ABCF4 240C0020 */ addiu $t4, $zero, 0x0020 ## $t4 = 00000020 -/* 00218 808ABCF8 240D0001 */ addiu $t5, $zero, 0x0001 ## $t5 = 00000001 -/* 0021C 808ABCFC 240E0020 */ addiu $t6, $zero, 0x0020 ## $t6 = 00000020 -/* 00220 808ABD00 240F0020 */ addiu $t7, $zero, 0x0020 ## $t7 = 00000020 -/* 00224 808ABD04 3103007F */ andi $v1, $t0, 0x007F ## $v1 = 00000000 -/* 00228 808ABD08 3107007F */ andi $a3, $t0, 0x007F ## $a3 = 00000000 -/* 0022C 808ABD0C AFA70020 */ sw $a3, 0x0020($sp) -/* 00230 808ABD10 01433023 */ subu $a2, $t2, $v1 -/* 00234 808ABD14 AFA3001C */ sw $v1, 0x001C($sp) -/* 00238 808ABD18 AFAF0028 */ sw $t7, 0x0028($sp) -/* 0023C 808ABD1C AFAE0024 */ sw $t6, 0x0024($sp) -/* 00240 808ABD20 AFAD0018 */ sw $t5, 0x0018($sp) -/* 00244 808ABD24 AFAC0014 */ sw $t4, 0x0014($sp) -/* 00248 808ABD28 AFAB0010 */ sw $t3, 0x0010($sp) -/* 0024C 808ABD2C 00002825 */ or $a1, $zero, $zero ## $a1 = 00000000 -/* 00250 808ABD30 0C0253D0 */ jal Gfx_TwoTexScroll -/* 00254 808ABD34 AFA20050 */ sw $v0, 0x0050($sp) -/* 00258 808ABD38 8FA90050 */ lw $t1, 0x0050($sp) -/* 0025C 808ABD3C 3C0A0600 */ lui $t2, 0x0600 ## $t2 = 06000000 -/* 00260 808ABD40 254A07D0 */ addiu $t2, $t2, 0x07D0 ## $t2 = 060007D0 -/* 00264 808ABD44 AD220004 */ sw $v0, 0x0004($t1) ## 00000004 -/* 00268 808ABD48 8E0202D0 */ lw $v0, 0x02D0($s0) ## 000002D0 -/* 0026C 808ABD4C 3C19DE00 */ lui $t9, 0xDE00 ## $t9 = DE000000 -/* 00270 808ABD50 3C06808B */ lui $a2, %hi(D_808ABDF8) ## $a2 = 808B0000 -/* 00274 808ABD54 24580008 */ addiu $t8, $v0, 0x0008 ## $t8 = 00000008 -/* 00278 808ABD58 AE1802D0 */ sw $t8, 0x02D0($s0) ## 000002D0 -/* 0027C 808ABD5C AC4A0004 */ sw $t2, 0x0004($v0) ## 00000004 -/* 00280 808ABD60 AC590000 */ sw $t9, 0x0000($v0) ## 00000000 -/* 00284 808ABD64 8E250000 */ lw $a1, 0x0000($s1) ## 00000000 -/* 00288 808ABD68 24C6BDF8 */ addiu $a2, $a2, %lo(D_808ABDF8) ## $a2 = 808ABDF8 -/* 0028C 808ABD6C 27A40058 */ addiu $a0, $sp, 0x0058 ## $a0 = FFFFFFE8 -/* 00290 808ABD70 0C031AD5 */ jal Graph_CloseDisps -/* 00294 808ABD74 240700F4 */ addiu $a3, $zero, 0x00F4 ## $a3 = 000000F4 -/* 00298 808ABD78 8FBF003C */ lw $ra, 0x003C($sp) -/* 0029C 808ABD7C 8FB00034 */ lw $s0, 0x0034($sp) -/* 002A0 808ABD80 8FB10038 */ lw $s1, 0x0038($sp) -/* 002A4 808ABD84 03E00008 */ jr $ra -/* 002A8 808ABD88 27BD0070 */ addiu $sp, $sp, 0x0070 ## $sp = 00000000 -/* 002AC 808ABD8C 00000000 */ nop diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Idomizu/BgSpot01Idomizu_Init.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Idomizu/BgSpot01Idomizu_Init.s deleted file mode 100644 index 5f18827d70..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Idomizu/BgSpot01Idomizu_Init.s +++ /dev/null @@ -1,49 +0,0 @@ -.late_rodata -glabel D_808ABE14 - .float -550.0 - -.text -glabel BgSpot01Idomizu_Init -/* 00000 808ABAE0 27BDFFE8 */ addiu $sp, $sp, 0xFFE8 ## $sp = FFFFFFE8 -/* 00004 808ABAE4 AFA5001C */ sw $a1, 0x001C($sp) -/* 00008 808ABAE8 AFBF0014 */ sw $ra, 0x0014($sp) -/* 0000C 808ABAEC 3C05808B */ lui $a1, %hi(D_808ABDB0) ## $a1 = 808B0000 -/* 00010 808ABAF0 24A5BDB0 */ addiu $a1, $a1, %lo(D_808ABDB0) ## $a1 = 808ABDB0 -/* 00014 808ABAF4 0C01E037 */ jal Actor_ProcessInitChain - -/* 00018 808ABAF8 AFA40018 */ sw $a0, 0x0018($sp) -/* 0001C 808ABAFC 3C028016 */ lui $v0, %hi(gSaveContext) -/* 00020 808ABB00 2442E660 */ addiu $v0, %lo(gSaveContext) -/* 00024 808ABB04 944E0EE0 */ lhu $t6, 0x0EE0($v0) ## 8015F540 -/* 00028 808ABB08 8FA40018 */ lw $a0, 0x0018($sp) -/* 0002C 808ABB0C 24010011 */ addiu $at, $zero, 0x0011 ## $at = 00000011 -/* 00030 808ABB10 31CF0080 */ andi $t7, $t6, 0x0080 ## $t7 = 00000000 -/* 00034 808ABB14 15E00008 */ bne $t7, $zero, .L808ABB38 -/* 00038 808ABB18 3C19808B */ lui $t9, %hi(func_808ABB84) ## $t9 = 808B0000 -/* 0003C 808ABB1C 8C580004 */ lw $t8, 0x0004($v0) ## 8015E664 -/* 00040 808ABB20 24020011 */ addiu $v0, $zero, 0x0011 ## $v0 = 00000011 -/* 00044 808ABB24 13000003 */ beq $t8, $zero, .L808ABB34 -/* 00048 808ABB28 00000000 */ nop -/* 0004C 808ABB2C 10000001 */ beq $zero, $zero, .L808ABB34 -/* 00050 808ABB30 24020005 */ addiu $v0, $zero, 0x0005 ## $v0 = 00000005 -.L808ABB34: -/* 00054 808ABB34 14410004 */ bne $v0, $at, .L808ABB48 -.L808ABB38: -/* 00058 808ABB38 3C01808B */ lui $at, %hi(D_808ABE14) ## $at = 808B0000 -/* 0005C 808ABB3C C424BE14 */ lwc1 $f4, %lo(D_808ABE14)($at) -/* 00060 808ABB40 10000005 */ beq $zero, $zero, .L808ABB58 -/* 00064 808ABB44 E4840150 */ swc1 $f4, 0x0150($a0) ## 00000150 -.L808ABB48: -/* 00068 808ABB48 3C014250 */ lui $at, 0x4250 ## $at = 42500000 -/* 0006C 808ABB4C 44813000 */ mtc1 $at, $f6 ## $f6 = 52.00 -/* 00070 808ABB50 00000000 */ nop -/* 00074 808ABB54 E4860150 */ swc1 $f6, 0x0150($a0) ## 00000150 -.L808ABB58: -/* 00078 808ABB58 C4880150 */ lwc1 $f8, 0x0150($a0) ## 00000150 -/* 0007C 808ABB5C 2739BB84 */ addiu $t9, $t9, %lo(func_808ABB84) ## $t9 = 808ABB84 -/* 00080 808ABB60 AC99014C */ sw $t9, 0x014C($a0) ## 0000014C -/* 00084 808ABB64 E4880028 */ swc1 $f8, 0x0028($a0) ## 00000028 -/* 00088 808ABB68 8FBF0014 */ lw $ra, 0x0014($sp) -/* 0008C 808ABB6C 27BD0018 */ addiu $sp, $sp, 0x0018 ## $sp = 00000000 -/* 00090 808ABB70 03E00008 */ jr $ra -/* 00094 808ABB74 00000000 */ nop diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Idomizu/BgSpot01Idomizu_Update.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Idomizu/BgSpot01Idomizu_Update.s deleted file mode 100644 index a3905a9a45..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Idomizu/BgSpot01Idomizu_Update.s +++ /dev/null @@ -1,10 +0,0 @@ -glabel BgSpot01Idomizu_Update -/* 00154 808ABC34 27BDFFE8 */ addiu $sp, $sp, 0xFFE8 ## $sp = FFFFFFE8 -/* 00158 808ABC38 AFBF0014 */ sw $ra, 0x0014($sp) -/* 0015C 808ABC3C 8C99014C */ lw $t9, 0x014C($a0) ## 0000014C -/* 00160 808ABC40 0320F809 */ jalr $ra, $t9 -/* 00164 808ABC44 00000000 */ nop -/* 00168 808ABC48 8FBF0014 */ lw $ra, 0x0014($sp) -/* 0016C 808ABC4C 27BD0018 */ addiu $sp, $sp, 0x0018 ## $sp = 00000000 -/* 00170 808ABC50 03E00008 */ jr $ra -/* 00174 808ABC54 00000000 */ nop diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Idomizu/func_808ABB84.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Idomizu/func_808ABB84.s deleted file mode 100644 index 3ca0eb8077..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Idomizu/func_808ABB84.s +++ /dev/null @@ -1,54 +0,0 @@ -.late_rodata -glabel D_808ABE18 - .float -550.0 - -.text -glabel func_808ABB84 -/* 000A4 808ABB84 3C0E8016 */ lui $t6, %hi(gSaveContext+0xee0) -/* 000A8 808ABB88 95CEF540 */ lhu $t6, %lo(gSaveContext+0xee0)($t6) -/* 000AC 808ABB8C 27BDFFD8 */ addiu $sp, $sp, 0xFFD8 ## $sp = FFFFFFD8 -/* 000B0 808ABB90 AFB00020 */ sw $s0, 0x0020($sp) -/* 000B4 808ABB94 31CF0080 */ andi $t7, $t6, 0x0080 ## $t7 = 00000000 -/* 000B8 808ABB98 00808025 */ or $s0, $a0, $zero ## $s0 = 00000000 -/* 000BC 808ABB9C 11E00004 */ beq $t7, $zero, .L808ABBB0 -/* 000C0 808ABBA0 AFBF0024 */ sw $ra, 0x0024($sp) -/* 000C4 808ABBA4 3C01808B */ lui $at, %hi(D_808ABE18) ## $at = 808B0000 -/* 000C8 808ABBA8 C424BE18 */ lwc1 $f4, %lo(D_808ABE18)($at) -/* 000CC 808ABBAC E4840150 */ swc1 $f4, 0x0150($a0) ## 00000150 -.L808ABBB0: -/* 000D0 808ABBB0 C6060028 */ lwc1 $f6, 0x0028($s0) ## 00000028 -/* 000D4 808ABBB4 8CA807C0 */ lw $t0, 0x07C0($a1) ## 000007C0 -/* 000D8 808ABBB8 3C078013 */ lui $a3, %hi(D_801333E0) -/* 000DC 808ABBBC 4600320D */ trunc.w.s $f8, $f6 -/* 000E0 808ABBC0 8D090028 */ lw $t1, 0x0028($t0) ## 00000028 -/* 000E4 808ABBC4 3C058013 */ lui $a1, %hi(D_801333D4) -/* 000E8 808ABBC8 3C0A8013 */ lui $t2, %hi(D_801333E8) -/* 000EC 808ABBCC 44194000 */ mfc1 $t9, $f8 -/* 000F0 808ABBD0 24E733E0 */ addiu $a3, %lo(D_801333E0) -/* 000F4 808ABBD4 254A33E8 */ addiu $t2, %lo(D_801333E8) -/* 000F8 808ABBD8 A5390002 */ sh $t9, 0x0002($t1) ## 00000002 -/* 000FC 808ABBDC C60A0028 */ lwc1 $f10, 0x0028($s0) ## 00000028 -/* 00100 808ABBE0 C6000150 */ lwc1 $f0, 0x0150($s0) ## 00000150 -/* 00104 808ABBE4 24A533D4 */ addiu $a1, %lo(D_801333D4) -/* 00108 808ABBE8 2404205E */ addiu $a0, $zero, 0x205E ## $a0 = 0000205E -/* 0010C 808ABBEC 460A003C */ c.lt.s $f0, $f10 -/* 00110 808ABBF0 24060004 */ addiu $a2, $zero, 0x0004 ## $a2 = 00000004 -/* 00114 808ABBF4 45020006 */ bc1fl .L808ABC10 -/* 00118 808ABBF8 44050000 */ mfc1 $a1, $f0 -/* 0011C 808ABBFC AFA70010 */ sw $a3, 0x0010($sp) -/* 00120 808ABC00 0C03DCE3 */ jal Audio_PlaySoundGeneral - -/* 00124 808ABC04 AFAA0014 */ sw $t2, 0x0014($sp) -/* 00128 808ABC08 C6000150 */ lwc1 $f0, 0x0150($s0) ## 00000150 -/* 0012C 808ABC0C 44050000 */ mfc1 $a1, $f0 -.L808ABC10: -/* 00130 808ABC10 26040028 */ addiu $a0, $s0, 0x0028 ## $a0 = 00000028 -/* 00134 808ABC14 3C063F80 */ lui $a2, 0x3F80 ## $a2 = 3F800000 -/* 00138 808ABC18 0C01E107 */ jal Math_SmoothScaleMaxF - -/* 0013C 808ABC1C 3C074000 */ lui $a3, 0x4000 ## $a3 = 40000000 -/* 00140 808ABC20 8FBF0024 */ lw $ra, 0x0024($sp) -/* 00144 808ABC24 8FB00020 */ lw $s0, 0x0020($sp) -/* 00148 808ABC28 27BD0028 */ addiu $sp, $sp, 0x0028 ## $sp = 00000000 -/* 0014C 808ABC2C 03E00008 */ jr $ra -/* 00150 808ABC30 00000000 */ nop diff --git a/data/overlays/actors/z_bg_spot01_idomizu.data.s b/data/overlays/actors/z_bg_spot01_idomizu.data.s deleted file mode 100644 index 2566b7f595..0000000000 --- a/data/overlays/actors/z_bg_spot01_idomizu.data.s +++ /dev/null @@ -1,20 +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 purpose registers - -.section .data - -.balign 16 - -glabel Bg_Spot01_Idomizu_InitVars - .word 0x01040100, 0x00000020, 0x00F90000, 0x00000158 -.word BgSpot01Idomizu_Init -.word BgSpot01Idomizu_Destroy -.word BgSpot01Idomizu_Update -.word BgSpot01Idomizu_Draw -glabel D_808ABDB0 - .word 0x48500064, 0x00000000, 0x00000000, 0x00000000 - diff --git a/data/overlays/actors/z_bg_spot01_idomizu.reloc.s b/data/overlays/actors/z_bg_spot01_idomizu.reloc.s deleted file mode 100644 index 707ab0d961..0000000000 --- a/data/overlays/actors/z_bg_spot01_idomizu.reloc.s +++ /dev/null @@ -1,13 +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 purpose registers - -.section .rodata - -.balign 16 - -glabel D_808ABE20 - .incbin "baserom/ovl_Bg_Spot01_Idomizu", 0x340, 0x00000060 diff --git a/spec b/spec index deb435826e..dfb3b85d3b 100644 --- a/spec +++ b/spec @@ -1228,8 +1228,7 @@ endseg beginseg name "ovl_Bg_Spot01_Idomizu" include "build/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.o" - include "build/data/overlays/actors/z_bg_spot01_idomizu.data.o" - include "build/data/overlays/actors/z_bg_spot01_idomizu.reloc.o" + include "build/src/overlays/actors/ovl_Bg_Spot01_Idomizu/ovl_Bg_Spot01_Idomizu_reloc.o" endseg beginseg diff --git a/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.c b/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.c index b7e34e1be1..2a90c8f57a 100644 --- a/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.c +++ b/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.c @@ -17,7 +17,6 @@ void BgSpot01Idomizu_Draw(Actor* thisx, GlobalContext* globalCtx); void func_808ABB84(BgSpot01Idomizu* this, GlobalContext* globalCtx); -/* const ActorInit Bg_Spot01_Idomizu_InitVars = { ACTOR_BG_SPOT01_IDOMIZU, ACTORTYPE_BG, @@ -29,13 +28,64 @@ const ActorInit Bg_Spot01_Idomizu_InitVars = { (ActorFunc)BgSpot01Idomizu_Update, (ActorFunc)BgSpot01Idomizu_Draw, }; -*/ -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Idomizu/BgSpot01Idomizu_Init.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Idomizu/BgSpot01Idomizu_Destroy.s") +static InitChainEntry sInitChain[] = { + ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), +}; + +extern Gfx D_060007D0[]; + +void BgSpot01Idomizu_Init(Actor* thisx, GlobalContext* globalCtx) { + BgSpot01Idomizu* this = THIS; + + Actor_ProcessInitChain(&this->actor, sInitChain); + if (gSaveContext.eventChkInf[6] & 0x80 || LINK_AGE_IN_YEARS == YEARS_ADULT) { + this->waterHeight = -550.0f; + } else { + this->waterHeight = 52.0f; + } + this->actionFunc = func_808ABB84; + this->actor.posRot.pos.y = this->waterHeight; +} + +void BgSpot01Idomizu_Destroy(Actor* thisx, GlobalContext* globalCtx) { +} + +void func_808ABB84(BgSpot01Idomizu* this, GlobalContext* globalCtx) { + if (gSaveContext.eventChkInf[6] & 0x80) { + this->waterHeight = -550.0f; + } + globalCtx->colCtx.stat.colHeader->waterBoxes[0].unk_02 = this->actor.posRot.pos.y; + if (this->waterHeight < this->actor.posRot.pos.y) { + Audio_PlaySoundGeneral(NA_SE_EV_WATER_LEVEL_DOWN - SFX_FLAG, &D_801333D4, 4, &D_801333E0, &D_801333E0, + &D_801333E8); + } + Math_SmoothScaleMaxF(&this->actor.posRot.pos.y, this->waterHeight, 1.0f, 2.0f); +} + +void BgSpot01Idomizu_Update(Actor* thisx, GlobalContext* globalCtx) { + BgSpot01Idomizu* this = THIS; + + this->actionFunc(this, globalCtx); +} + +void BgSpot01Idomizu_Draw(Actor* thisx, GlobalContext* globalCtx) { + u32 frames; + GraphicsContext* gfxCtx; + Gfx* dispRefs[4]; + + gfxCtx = globalCtx->state.gfxCtx; + Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_spot01_idomizu.c", 228); + func_80093D84(globalCtx->state.gfxCtx); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Idomizu/func_808ABB84.s") + gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot01_idomizu.c", 232), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Idomizu/BgSpot01Idomizu_Update.s") + frames = globalCtx->state.frames; + gSPSegment(gfxCtx->polyXlu.p++, 0x08, + Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - frames % 128, frames & 0x7F, 32, 32, 1, + frames % 128, frames & 0x7F, 32, 32)); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Idomizu/BgSpot01Idomizu_Draw.s") + gSPDisplayList(gfxCtx->polyXlu.p++, D_060007D0); + Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_spot01_idomizu.c", 244); +} diff --git a/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.h b/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.h index 7a4409c012..09a44114d0 100644 --- a/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.h +++ b/src/overlays/actors/ovl_Bg_Spot01_Idomizu/z_bg_spot01_idomizu.h @@ -11,7 +11,7 @@ typedef void (*BgSpot01IdomizuActionFunc)(struct BgSpot01Idomizu*, GlobalContext typedef struct BgSpot01Idomizu { /* 0x0000 */ Actor actor; /* 0x014C */ BgSpot01IdomizuActionFunc actionFunc; - /* 0x0150 */ f32 unk_150; + /* 0x0150 */ f32 waterHeight; /* 0x0154 */ char unk_154[0x4]; } BgSpot01Idomizu; // size = 0x0158 diff --git a/undefined_syms.txt b/undefined_syms.txt index 567e615c29..b2f3dcb37a 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -159,6 +159,9 @@ D_06000000 = 0x06000000; // z_door_toki D_06007888 = 0x06007888; +// z_bg_spot01_idomizu +D_060007D0 = 0x060007D0; + // z_bg_spot09_obj D_06008010 = 0x06008010;