From 612980f90cab73253f83e3f0f9d87bfb08af32e8 Mon Sep 17 00:00:00 2001 From: i82orbom Date: Sat, 5 Sep 2020 00:28:45 +0200 Subject: [PATCH] Decompiles z_bg_spot01_objects2.c (#357) * Starts z_bg_spot01_objects2 * z_bg_spot01_objects2.c almost finished * Finishes z_bg_spot01_objects2.c * Removes unused asm * PR comments and rebased to master * Addresses PR comments #2 Co-authored-by: i82orbom Co-authored-by: i82orbom --- .../BgSpot01Objects2_Destroy.s | 4 - .../BgSpot01Objects2_Init.s | 92 ------------- .../BgSpot01Objects2_Update.s | 10 -- .../ovl_Bg_Spot01_Objects2/func_808AC22C.s | 37 ----- .../ovl_Bg_Spot01_Objects2/func_808AC2BC.s | 130 ------------------ .../ovl_Bg_Spot01_Objects2/func_808AC474.s | 4 - .../ovl_Bg_Spot01_Objects2/func_808AC4A4.s | 17 --- .../actors/z_bg_spot01_objects2.data.s | 22 --- .../actors/z_bg_spot01_objects2.reloc.s | 13 -- spec | 3 +- .../z_bg_spot01_objects2.c | 115 ++++++++++++++-- .../z_bg_spot01_objects2.h | 5 +- undefined_syms.txt | 4 + 13 files changed, 111 insertions(+), 345 deletions(-) delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/BgSpot01Objects2_Destroy.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/BgSpot01Objects2_Init.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/BgSpot01Objects2_Update.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/func_808AC22C.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/func_808AC2BC.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/func_808AC474.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/func_808AC4A4.s delete mode 100644 data/overlays/actors/z_bg_spot01_objects2.data.s delete mode 100644 data/overlays/actors/z_bg_spot01_objects2.reloc.s diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/BgSpot01Objects2_Destroy.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/BgSpot01Objects2_Destroy.s deleted file mode 100644 index af8ebfeb09..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/BgSpot01Objects2_Destroy.s +++ /dev/null @@ -1,4 +0,0 @@ -glabel BgSpot01Objects2_Destroy -/* 000E0 808AC220 AFA40000 */ sw $a0, 0x0000($sp) -/* 000E4 808AC224 03E00008 */ jr $ra -/* 000E8 808AC228 AFA50004 */ sw $a1, 0x0004($sp) diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/BgSpot01Objects2_Init.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/BgSpot01Objects2_Init.s deleted file mode 100644 index a3740aaf3e..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/BgSpot01Objects2_Init.s +++ /dev/null @@ -1,92 +0,0 @@ -.rdata -glabel D_808AC530 - .asciz "-----------------------------バンク設定ありませんでした." - .balign 4 - - -.late_rodata -glabel jtbl_808AC58C -.word L808AC17C -.word L808AC17C -.word L808AC17C -.word L808AC188 -.word L808AC194 - -glabel jtbl_808AC5A0 -.word L808AC448 -.word L808AC448 -.word L808AC448 -.word L808AC394 -.word L808AC368 -.word 0x00000000, 0x00000000, 0x00000000 - -.text -glabel BgSpot01Objects2_Init -/* 00000 808AC140 27BDFFE0 */ addiu $sp, $sp, 0xFFE0 ## $sp = FFFFFFE0 -/* 00004 808AC144 AFBF001C */ sw $ra, 0x001C($sp) -/* 00008 808AC148 AFB00018 */ sw $s0, 0x0018($sp) -/* 0000C 808AC14C 848E001C */ lh $t6, 0x001C($a0) ## 0000001C -/* 00010 808AC150 00808025 */ or $s0, $a0, $zero ## $s0 = 00000000 -/* 00014 808AC154 00A03025 */ or $a2, $a1, $zero ## $a2 = 00000000 -/* 00018 808AC158 31CF0007 */ andi $t7, $t6, 0x0007 ## $t7 = 00000000 -/* 0001C 808AC15C 2DE10005 */ sltiu $at, $t7, 0x0005 -/* 00020 808AC160 1020000E */ beq $at, $zero, .L808AC19C -/* 00024 808AC164 000F7880 */ sll $t7, $t7, 2 -/* 00028 808AC168 3C01808B */ lui $at, %hi(jtbl_808AC58C) ## $at = 808B0000 -/* 0002C 808AC16C 002F0821 */ addu $at, $at, $t7 -/* 00030 808AC170 8C2FC58C */ lw $t7, %lo(jtbl_808AC58C)($at) -/* 00034 808AC174 01E00008 */ jr $t7 -/* 00038 808AC178 00000000 */ nop -glabel L808AC17C -/* 0003C 808AC17C 24180180 */ addiu $t8, $zero, 0x0180 ## $t8 = 00000180 -/* 00040 808AC180 10000006 */ beq $zero, $zero, .L808AC19C -/* 00044 808AC184 AE180178 */ sw $t8, 0x0178($s0) ## 00000178 -glabel L808AC188 -/* 00048 808AC188 24190181 */ addiu $t9, $zero, 0x0181 ## $t9 = 00000181 -/* 0004C 808AC18C 10000003 */ beq $zero, $zero, .L808AC19C -/* 00050 808AC190 AE190178 */ sw $t9, 0x0178($s0) ## 00000178 -glabel L808AC194 -/* 00054 808AC194 24080180 */ addiu $t0, $zero, 0x0180 ## $t0 = 00000180 -/* 00058 808AC198 AE080178 */ sw $t0, 0x0178($s0) ## 00000178 -.L808AC19C: -/* 0005C 808AC19C 8E020178 */ lw $v0, 0x0178($s0) ## 00000178 -/* 00060 808AC1A0 3C010001 */ lui $at, 0x0001 ## $at = 00010000 -/* 00064 808AC1A4 342117A4 */ ori $at, $at, 0x17A4 ## $at = 000117A4 -/* 00068 808AC1A8 0440000F */ bltz $v0, .L808AC1E8 -/* 0006C 808AC1AC 00C12021 */ addu $a0, $a2, $at -/* 00070 808AC1B0 00022C00 */ sll $a1, $v0, 16 -/* 00074 808AC1B4 0C02604B */ jal Object_GetIndex - ## ObjectIndex -/* 00078 808AC1B8 00052C03 */ sra $a1, $a1, 16 -/* 0007C 808AC1BC A202017C */ sb $v0, 0x017C($s0) ## 0000017C -/* 00080 808AC1C0 8209017C */ lb $t1, 0x017C($s0) ## 0000017C -/* 00084 808AC1C4 3C04808B */ lui $a0, %hi(D_808AC530) ## $a0 = 808B0000 -/* 00088 808AC1C8 05210009 */ bgez $t1, .L808AC1F0 -/* 0008C 808AC1CC 00000000 */ nop -/* 00090 808AC1D0 0C00084C */ jal osSyncPrintf - -/* 00094 808AC1D4 2484C530 */ addiu $a0, $a0, %lo(D_808AC530) ## $a0 = 808AC530 -/* 00098 808AC1D8 0C00B55C */ jal Actor_Kill - -/* 0009C 808AC1DC 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000 -/* 000A0 808AC1E0 1000000B */ beq $zero, $zero, .L808AC210 -/* 000A4 808AC1E4 8FBF001C */ lw $ra, 0x001C($sp) -.L808AC1E8: -/* 000A8 808AC1E8 0C00B55C */ jal Actor_Kill - -/* 000AC 808AC1EC 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000 -.L808AC1F0: -/* 000B0 808AC1F0 3C0A808B */ lui $t2, %hi(func_808AC2BC) ## $t2 = 808B0000 -/* 000B4 808AC1F4 254AC2BC */ addiu $t2, $t2, %lo(func_808AC2BC) ## $t2 = 808AC2BC -/* 000B8 808AC1F8 3C05808B */ lui $a1, %hi(D_808AC500) ## $a1 = 808B0000 -/* 000BC 808AC1FC AE0A0164 */ sw $t2, 0x0164($s0) ## 00000164 -/* 000C0 808AC200 24A5C500 */ addiu $a1, $a1, %lo(D_808AC500) ## $a1 = 808AC500 -/* 000C4 808AC204 0C01E037 */ jal Actor_ProcessInitChain - -/* 000C8 808AC208 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000 -/* 000CC 808AC20C 8FBF001C */ lw $ra, 0x001C($sp) -.L808AC210: -/* 000D0 808AC210 8FB00018 */ lw $s0, 0x0018($sp) -/* 000D4 808AC214 27BD0020 */ addiu $sp, $sp, 0x0020 ## $sp = 00000000 -/* 000D8 808AC218 03E00008 */ jr $ra -/* 000DC 808AC21C 00000000 */ nop diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/BgSpot01Objects2_Update.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/BgSpot01Objects2_Update.s deleted file mode 100644 index 90e14b3884..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/BgSpot01Objects2_Update.s +++ /dev/null @@ -1,10 +0,0 @@ -glabel BgSpot01Objects2_Update -/* 00340 808AC480 27BDFFE8 */ addiu $sp, $sp, 0xFFE8 ## $sp = FFFFFFE8 -/* 00344 808AC484 AFBF0014 */ sw $ra, 0x0014($sp) -/* 00348 808AC488 8C990164 */ lw $t9, 0x0164($a0) ## 00000164 -/* 0034C 808AC48C 0320F809 */ jalr $ra, $t9 -/* 00350 808AC490 00000000 */ nop -/* 00354 808AC494 8FBF0014 */ lw $ra, 0x0014($sp) -/* 00358 808AC498 27BD0018 */ addiu $sp, $sp, 0x0018 ## $sp = 00000000 -/* 0035C 808AC49C 03E00008 */ jr $ra -/* 00360 808AC4A0 00000000 */ nop diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/func_808AC22C.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/func_808AC22C.s deleted file mode 100644 index 59d41af124..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/func_808AC22C.s +++ /dev/null @@ -1,37 +0,0 @@ -glabel func_808AC22C -/* 000EC 808AC22C 000670C0 */ sll $t6, $a2, 3 -/* 000F0 808AC230 008E7821 */ addu $t7, $a0, $t6 -/* 000F4 808AC234 8DE80004 */ lw $t0, 0x0004($t7) ## 00000004 -/* 000F8 808AC238 3C0A8016 */ lui $t2, %hi(gSegments) -/* 000FC 808AC23C 3C0100FF */ lui $at, 0x00FF ## $at = 00FF0000 -/* 00100 808AC240 0008C100 */ sll $t8, $t0, 4 -/* 00104 808AC244 0018CF02 */ srl $t9, $t8, 28 -/* 00108 808AC248 00194880 */ sll $t1, $t9, 2 -/* 0010C 808AC24C 01495021 */ addu $t2, $t2, $t1 -/* 00110 808AC250 8D4A6FA8 */ lw $t2, %lo(gSegments)($t2) -/* 00114 808AC254 3421FFFF */ ori $at, $at, 0xFFFF ## $at = 00FFFFFF -/* 00118 808AC258 00076880 */ sll $t5, $a3, 2 -/* 0011C 808AC25C 01A76823 */ subu $t5, $t5, $a3 -/* 00120 808AC260 01015824 */ and $t3, $t0, $at -/* 00124 808AC264 000D6840 */ sll $t5, $t5, 1 -/* 00128 808AC268 014B6021 */ addu $t4, $t2, $t3 -/* 0012C 808AC26C 018D1821 */ addu $v1, $t4, $t5 -/* 00130 808AC270 3C018000 */ lui $at, 0x8000 ## $at = 80000000 -/* 00134 808AC274 00611821 */ addu $v1, $v1, $at -/* 00138 808AC278 846E0000 */ lh $t6, 0x0000($v1) ## 00000000 -/* 0013C 808AC27C 00001025 */ or $v0, $zero, $zero ## $v0 = 00000000 -/* 00140 808AC280 448E2000 */ mtc1 $t6, $f4 ## $f4 = 0.00 -/* 00144 808AC284 00000000 */ nop -/* 00148 808AC288 468021A0 */ cvt.s.w $f6, $f4 -/* 0014C 808AC28C E4A60000 */ swc1 $f6, 0x0000($a1) ## 00000000 -/* 00150 808AC290 846F0002 */ lh $t7, 0x0002($v1) ## 00000002 -/* 00154 808AC294 448F4000 */ mtc1 $t7, $f8 ## $f8 = 0.00 -/* 00158 808AC298 00000000 */ nop -/* 0015C 808AC29C 468042A0 */ cvt.s.w $f10, $f8 -/* 00160 808AC2A0 E4AA0004 */ swc1 $f10, 0x0004($a1) ## 00000004 -/* 00164 808AC2A4 84780004 */ lh $t8, 0x0004($v1) ## 00000004 -/* 00168 808AC2A8 44988000 */ mtc1 $t8, $f16 ## $f16 = 0.00 -/* 0016C 808AC2AC 00000000 */ nop -/* 00170 808AC2B0 468084A0 */ cvt.s.w $f18, $f16 -/* 00174 808AC2B4 03E00008 */ jr $ra -/* 00178 808AC2B8 E4B20008 */ swc1 $f18, 0x0008($a1) ## 00000008 diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/func_808AC2BC.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/func_808AC2BC.s deleted file mode 100644 index 5675736577..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/func_808AC2BC.s +++ /dev/null @@ -1,130 +0,0 @@ -.rdata -glabel D_808AC56C - .asciz "-----バンク切り換え成功!!\n" - .balign 4 - -.text -glabel func_808AC2BC -/* 0017C 808AC2BC 27BDFFA8 */ addiu $sp, $sp, 0xFFA8 ## $sp = FFFFFFA8 -/* 00180 808AC2C0 AFB00034 */ sw $s0, 0x0034($sp) -/* 00184 808AC2C4 3C010001 */ lui $at, 0x0001 ## $at = 00010000 -/* 00188 808AC2C8 00808025 */ or $s0, $a0, $zero ## $s0 = 00000000 -/* 0018C 808AC2CC AFB10038 */ sw $s1, 0x0038($sp) -/* 00190 808AC2D0 342117A4 */ ori $at, $at, 0x17A4 ## $at = 000117A4 -/* 00194 808AC2D4 00A08825 */ or $s1, $a1, $zero ## $s1 = 00000000 -/* 00198 808AC2D8 AFBF003C */ sw $ra, 0x003C($sp) -/* 0019C 808AC2DC AFA00054 */ sw $zero, 0x0054($sp) -/* 001A0 808AC2E0 00A12021 */ addu $a0, $a1, $at -/* 001A4 808AC2E4 0C026062 */ jal Object_IsLoaded - -/* 001A8 808AC2E8 8205017C */ lb $a1, 0x017C($s0) ## 0000017C -/* 001AC 808AC2EC 1040005C */ beq $v0, $zero, .L808AC460 -/* 001B0 808AC2F0 3C04808B */ lui $a0, %hi(D_808AC56C) ## $a0 = 808B0000 -/* 001B4 808AC2F4 0C00084C */ jal osSyncPrintf - -/* 001B8 808AC2F8 2484C56C */ addiu $a0, $a0, %lo(D_808AC56C) ## $a0 = 808AC56C -/* 001BC 808AC2FC 820E017C */ lb $t6, 0x017C($s0) ## 0000017C -/* 001C0 808AC300 3C190001 */ lui $t9, 0x0001 ## $t9 = 00010000 -/* 001C4 808AC304 3C018000 */ lui $at, 0x8000 ## $at = 80000000 -/* 001C8 808AC308 000E7900 */ sll $t7, $t6, 4 -/* 001CC 808AC30C 01EE7821 */ addu $t7, $t7, $t6 -/* 001D0 808AC310 000F7880 */ sll $t7, $t7, 2 -/* 001D4 808AC314 022FC021 */ addu $t8, $s1, $t7 -/* 001D8 808AC318 0338C821 */ addu $t9, $t9, $t8 -/* 001DC 808AC31C 8F3917B4 */ lw $t9, 0x17B4($t9) ## 000117B4 -/* 001E0 808AC320 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000 -/* 001E4 808AC324 24050001 */ addiu $a1, $zero, 0x0001 ## $a1 = 00000001 -/* 001E8 808AC328 03214021 */ addu $t0, $t9, $at -/* 001EC 808AC32C 3C018016 */ lui $at, %hi(gSegments+0x18) -/* 001F0 808AC330 AC286FC0 */ sw $t0, %lo(gSegments+0x18)($at) -/* 001F4 808AC334 8209017C */ lb $t1, 0x017C($s0) ## 0000017C -/* 001F8 808AC338 0C010D20 */ jal DynaPolyInfo_SetActorMove - -/* 001FC 808AC33C A209001E */ sb $t1, 0x001E($s0) ## 0000001E -/* 00200 808AC340 860A001C */ lh $t2, 0x001C($s0) ## 0000001C -/* 00204 808AC344 314B0007 */ andi $t3, $t2, 0x0007 ## $t3 = 00000000 -/* 00208 808AC348 2D610005 */ sltiu $at, $t3, 0x0005 -/* 0020C 808AC34C 1020003E */ beq $at, $zero, .L808AC448 -/* 00210 808AC350 000B5880 */ sll $t3, $t3, 2 -/* 00214 808AC354 3C01808B */ lui $at, %hi(jtbl_808AC5A0) ## $at = 808B0000 -/* 00218 808AC358 002B0821 */ addu $at, $at, $t3 -/* 0021C 808AC35C 8C2BC5A0 */ lw $t3, %lo(jtbl_808AC5A0)($at) -/* 00220 808AC360 01600008 */ jr $t3 -/* 00224 808AC364 00000000 */ nop -glabel L808AC368 -/* 00228 808AC368 3C040600 */ lui $a0, 0x0600 ## $a0 = 06000000 -/* 0022C 808AC36C 24841A38 */ addiu $a0, $a0, 0x1A38 ## $a0 = 06001A38 -/* 00230 808AC370 0C010620 */ jal DynaPolyInfo_Alloc - -/* 00234 808AC374 27A50054 */ addiu $a1, $sp, 0x0054 ## $a1 = FFFFFFFC -/* 00238 808AC378 02202025 */ or $a0, $s1, $zero ## $a0 = 00000000 -/* 0023C 808AC37C 26250810 */ addiu $a1, $s1, 0x0810 ## $a1 = 00000810 -/* 00240 808AC380 02003025 */ or $a2, $s0, $zero ## $a2 = 00000000 -/* 00244 808AC384 0C00FA9D */ jal DynaPolyInfo_RegisterActor - ## DynaPolyInfo_setActor -/* 00248 808AC388 8FA70054 */ lw $a3, 0x0054($sp) -/* 0024C 808AC38C 1000002E */ beq $zero, $zero, .L808AC448 -/* 00250 808AC390 AE02014C */ sw $v0, 0x014C($s0) ## 0000014C -glabel L808AC394 -/* 00254 808AC394 3C040600 */ lui $a0, 0x0600 ## $a0 = 06000000 -/* 00258 808AC398 24841C58 */ addiu $a0, $a0, 0x1C58 ## $a0 = 06001C58 -/* 0025C 808AC39C 0C010620 */ jal DynaPolyInfo_Alloc - -/* 00260 808AC3A0 27A50054 */ addiu $a1, $sp, 0x0054 ## $a1 = FFFFFFFC -/* 00264 808AC3A4 02202025 */ or $a0, $s1, $zero ## $a0 = 00000000 -/* 00268 808AC3A8 26250810 */ addiu $a1, $s1, 0x0810 ## $a1 = 00000810 -/* 0026C 808AC3AC 02003025 */ or $a2, $s0, $zero ## $a2 = 00000000 -/* 00270 808AC3B0 0C00FA9D */ jal DynaPolyInfo_RegisterActor - ## DynaPolyInfo_setActor -/* 00274 808AC3B4 8FA70054 */ lw $a3, 0x0054($sp) -/* 00278 808AC3B8 AE02014C */ sw $v0, 0x014C($s0) ## 0000014C -/* 0027C 808AC3BC 3C0C8016 */ lui $t4, %hi(gSaveContext+0x10) -/* 00280 808AC3C0 8D8CE670 */ lw $t4, %lo(gSaveContext+0x10)($t4) -/* 00284 808AC3C4 3C040001 */ lui $a0, 0x0001 ## $a0 = 00010000 -/* 00288 808AC3C8 00912021 */ addu $a0, $a0, $s1 -/* 0028C 808AC3CC 1580001E */ bne $t4, $zero, .L808AC448 -/* 00290 808AC3D0 27A50040 */ addiu $a1, $sp, 0x0040 ## $a1 = FFFFFFE8 -/* 00294 808AC3D4 8606001C */ lh $a2, 0x001C($s0) ## 0000001C -/* 00298 808AC3D8 8C841E08 */ lw $a0, 0x1E08($a0) ## 00011E08 -/* 0029C 808AC3DC 00003825 */ or $a3, $zero, $zero ## $a3 = 00000000 -/* 002A0 808AC3E0 00063203 */ sra $a2, $a2, 8 -/* 002A4 808AC3E4 0C22B08B */ jal func_808AC22C -/* 002A8 808AC3E8 30C600FF */ andi $a2, $a2, 0x00FF ## $a2 = 00000000 -/* 002AC 808AC3EC C7A40040 */ lwc1 $f4, 0x0040($sp) -/* 002B0 808AC3F0 C7A60044 */ lwc1 $f6, 0x0044($sp) -/* 002B4 808AC3F4 C7A80048 */ lwc1 $f8, 0x0048($sp) -/* 002B8 808AC3F8 E7A40010 */ swc1 $f4, 0x0010($sp) -/* 002BC 808AC3FC E7A60014 */ swc1 $f6, 0x0014($sp) -/* 002C0 808AC400 E7A80018 */ swc1 $f8, 0x0018($sp) -/* 002C4 808AC404 860D0030 */ lh $t5, 0x0030($s0) ## 00000030 -/* 002C8 808AC408 26241C24 */ addiu $a0, $s1, 0x1C24 ## $a0 = 00001C24 -/* 002CC 808AC40C 02002825 */ or $a1, $s0, $zero ## $a1 = 00000000 -/* 002D0 808AC410 AFAD001C */ sw $t5, 0x001C($sp) -/* 002D4 808AC414 860E0032 */ lh $t6, 0x0032($s0) ## 00000032 -/* 002D8 808AC418 02203025 */ or $a2, $s1, $zero ## $a2 = 00000000 -/* 002DC 808AC41C 240701BC */ addiu $a3, $zero, 0x01BC ## $a3 = 000001BC -/* 002E0 808AC420 AFAE0020 */ sw $t6, 0x0020($sp) -/* 002E4 808AC424 860F0034 */ lh $t7, 0x0034($s0) ## 00000034 -/* 002E8 808AC428 AFAF0024 */ sw $t7, 0x0024($sp) -/* 002EC 808AC42C 8618001C */ lh $t8, 0x001C($s0) ## 0000001C -/* 002F0 808AC430 0018CA03 */ sra $t9, $t8, 8 -/* 002F4 808AC434 332800FF */ andi $t0, $t9, 0x00FF ## $t0 = 00000000 -/* 002F8 808AC438 00084A00 */ sll $t1, $t0, 8 -/* 002FC 808AC43C 252A0001 */ addiu $t2, $t1, 0x0001 ## $t2 = 00000001 -/* 00300 808AC440 0C00C916 */ jal Actor_SpawnAsChild - -/* 00304 808AC444 AFAA0028 */ sw $t2, 0x0028($sp) -glabel L808AC448 -.L808AC448: -/* 00308 808AC448 3C0B808B */ lui $t3, %hi(func_808AC4A4) ## $t3 = 808B0000 -/* 0030C 808AC44C 3C0C808B */ lui $t4, %hi(func_808AC474) ## $t4 = 808B0000 -/* 00310 808AC450 256BC4A4 */ addiu $t3, $t3, %lo(func_808AC4A4) ## $t3 = 808AC4A4 -/* 00314 808AC454 258CC474 */ addiu $t4, $t4, %lo(func_808AC474) ## $t4 = 808AC474 -/* 00318 808AC458 AE0B0134 */ sw $t3, 0x0134($s0) ## 00000134 -/* 0031C 808AC45C AE0C0164 */ sw $t4, 0x0164($s0) ## 00000164 -.L808AC460: -/* 00320 808AC460 8FBF003C */ lw $ra, 0x003C($sp) -/* 00324 808AC464 8FB00034 */ lw $s0, 0x0034($sp) -/* 00328 808AC468 8FB10038 */ lw $s1, 0x0038($sp) -/* 0032C 808AC46C 03E00008 */ jr $ra -/* 00330 808AC470 27BD0058 */ addiu $sp, $sp, 0x0058 ## $sp = 00000000 diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/func_808AC474.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/func_808AC474.s deleted file mode 100644 index 96054b4529..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/func_808AC474.s +++ /dev/null @@ -1,4 +0,0 @@ -glabel func_808AC474 -/* 00334 808AC474 AFA40000 */ sw $a0, 0x0000($sp) -/* 00338 808AC478 03E00008 */ jr $ra -/* 0033C 808AC47C AFA50004 */ sw $a1, 0x0004($sp) diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/func_808AC4A4.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/func_808AC4A4.s deleted file mode 100644 index a2c6e5892d..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/func_808AC4A4.s +++ /dev/null @@ -1,17 +0,0 @@ -glabel func_808AC4A4 -/* 00364 808AC4A4 27BDFFE8 */ addiu $sp, $sp, 0xFFE8 ## $sp = FFFFFFE8 -/* 00368 808AC4A8 AFBF0014 */ sw $ra, 0x0014($sp) -/* 0036C 808AC4AC 00803825 */ or $a3, $a0, $zero ## $a3 = 00000000 -/* 00370 808AC4B0 84EE001C */ lh $t6, 0x001C($a3) ## 0000001C -/* 00374 808AC4B4 00A02025 */ or $a0, $a1, $zero ## $a0 = 00000000 -/* 00378 808AC4B8 3C05808B */ lui $a1, %hi(D_808AC510) ## $a1 = 808B0000 -/* 0037C 808AC4BC 31CF0007 */ andi $t7, $t6, 0x0007 ## $t7 = 00000000 -/* 00380 808AC4C0 000FC080 */ sll $t8, $t7, 2 -/* 00384 808AC4C4 00B82821 */ addu $a1, $a1, $t8 -/* 00388 808AC4C8 0C00D498 */ jal Gfx_DrawDListOpa - -/* 0038C 808AC4CC 8CA5C510 */ lw $a1, %lo(D_808AC510)($a1) -/* 00390 808AC4D0 8FBF0014 */ lw $ra, 0x0014($sp) -/* 00394 808AC4D4 27BD0018 */ addiu $sp, $sp, 0x0018 ## $sp = 00000000 -/* 00398 808AC4D8 03E00008 */ jr $ra -/* 0039C 808AC4DC 00000000 */ nop diff --git a/data/overlays/actors/z_bg_spot01_objects2.data.s b/data/overlays/actors/z_bg_spot01_objects2.data.s deleted file mode 100644 index 96cf1dbe05..0000000000 --- a/data/overlays/actors/z_bg_spot01_objects2.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 purpose registers - -.section .data - -.balign 16 - -glabel Bg_Spot01_Objects2_InitVars - .word 0x019D0100, 0x00000010, 0x00010000, 0x00000180 -.word BgSpot01Objects2_Init -.word BgSpot01Objects2_Destroy -.word BgSpot01Objects2_Update -.word 0x00000000 -glabel D_808AC500 - .word 0xB0F43200, 0xB0F807D0, 0xB0FC05DC, 0x48500064 -glabel D_808AC510 - .word 0x06001EB0, 0x06002780, 0x06003078, 0x06001228, 0x06001528, 0x00000000, 0x00000000, 0x00000000 - diff --git a/data/overlays/actors/z_bg_spot01_objects2.reloc.s b/data/overlays/actors/z_bg_spot01_objects2.reloc.s deleted file mode 100644 index 8bab4f37c5..0000000000 --- a/data/overlays/actors/z_bg_spot01_objects2.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_808AC5C0 - .incbin "baserom/ovl_Bg_Spot01_Objects2", 0x480, 0x000000A0 diff --git a/spec b/spec index aded6c85ef..a3dcafed8e 100644 --- a/spec +++ b/spec @@ -1229,8 +1229,7 @@ endseg beginseg name "ovl_Bg_Spot01_Objects2" include "build/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.o" - include "build/data/overlays/actors/z_bg_spot01_objects2.data.o" - include "build/data/overlays/actors/z_bg_spot01_objects2.reloc.o" + include "build/src/overlays/actors/ovl_Bg_Spot01_Objects2/ovl_Bg_Spot01_Objects2_reloc.o" endseg beginseg diff --git a/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.c b/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.c index d9dddc98a6..b284edd1e7 100644 --- a/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.c +++ b/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.c @@ -14,12 +14,10 @@ void BgSpot01Objects2_Init(Actor* thisx, GlobalContext* globalCtx); void BgSpot01Objects2_Destroy(Actor* thisx, GlobalContext* globalCtx); void BgSpot01Objects2_Update(Actor* thisx, GlobalContext* globalCtx); -// func_808AC22C void func_808AC2BC(BgSpot01Objects2* this, GlobalContext* globalCtx); void func_808AC474(BgSpot01Objects2* this, GlobalContext* globalCtx); -void func_808AC4A4(BgSpot01Objects2* this, GlobalContext* globalCtx); +void func_808AC4A4(Actor* thisx, GlobalContext* globalCtx); -/* const ActorInit Bg_Spot01_Objects2_InitVars = { ACTOR_BG_SPOT01_OBJECTS2, ACTORTYPE_BG, @@ -31,17 +29,112 @@ const ActorInit Bg_Spot01_Objects2_InitVars = { (ActorFunc)BgSpot01Objects2_Update, NULL, }; -*/ -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/BgSpot01Objects2_Init.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/BgSpot01Objects2_Destroy.s") +static InitChainEntry sInitChain[] = { + ICHAIN_F32(uncullZoneForward, 12800, ICHAIN_CONTINUE), + ICHAIN_F32(uncullZoneScale, 2000, ICHAIN_CONTINUE), + ICHAIN_F32(uncullZoneDownward, 1500, ICHAIN_CONTINUE), + ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/func_808AC22C.s") +Gfx* D_808AC510[] = { 0x06001EB0, 0x06002780, 0x06003078, 0x06001228, 0x06001528 }; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/func_808AC2BC.s") +extern UNK_TYPE D_06001A38; +extern UNK_TYPE D_06001C58; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/func_808AC474.s") +void BgSpot01Objects2_Init(Actor* thisx, GlobalContext* globalCtx) { + BgSpot01Objects2* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/BgSpot01Objects2_Update.s") + switch (this->dyna.actor.params & 7) { + case 0: + case 1: + case 2: + this->objectId = OBJECT_SPOT01_MATOYA; + break; + case 3: + this->objectId = OBJECT_SPOT01_MATOYAB; + break; + case 4: + this->objectId = OBJECT_SPOT01_MATOYA; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Objects2/func_808AC4A4.s") + if (this->objectId >= 0) { + this->objBankIndex = Object_GetIndex(&globalCtx->objectCtx, this->objectId); + if (this->objBankIndex < 0) { + // There was no bank setting. + osSyncPrintf("-----------------------------バンク設定ありませんでした."); + Actor_Kill(&this->dyna.actor); + return; + } + } else { + Actor_Kill(&this->dyna.actor); + } + this->actionFunc = func_808AC2BC; + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); +} + +void BgSpot01Objects2_Destroy(Actor* thisx, GlobalContext* globalCtx) { +} + +s32 func_808AC22C(Path* pathList, Vec3f* pos, s32 path, s32 waypoint) { + Vec3s* pointPos = &((Vec3s*)SEGMENTED_TO_VIRTUAL((pathList + path)->points))[waypoint]; + + pos->x = pointPos->x; + pos->y = pointPos->y; + pos->z = pointPos->z; + return 0; +} + +void func_808AC2BC(BgSpot01Objects2* this, GlobalContext* globalCtx) { + s32 sp54; + Actor* thisx = &this->dyna.actor; + s32 pad; + Vec3f position; + + sp54 = 0; + if (Object_IsLoaded(&globalCtx->objectCtx, this->objBankIndex)) { + // ---- Successful bank switching!! + osSyncPrintf("-----バンク切り換え成功!!\n"); + gSegments[6] = VIRTUAL_TO_PHYSICAL(globalCtx->objectCtx.status[this->objBankIndex].segment); + + this->dyna.actor.objBankIndex = this->objBankIndex; + DynaPolyInfo_SetActorMove(&this->dyna, DPM_PLAYER); + + switch (this->dyna.actor.params & 7) { + case 4: // Shooting gallery + DynaPolyInfo_Alloc(&D_06001A38, &sp54); + this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, thisx, sp54); + break; + case 3: // Shooting Gallery, spawns Carpenter Sabooro during the day + DynaPolyInfo_Alloc(&D_06001C58, &sp54); + this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, thisx, sp54); + if (gSaveContext.nightFlag == 0) { + func_808AC22C(globalCtx->setupPathList, &position, ((s32)thisx->params >> 8) & 0xFF, 0); + Actor_SpawnAsChild(&globalCtx->actorCtx, thisx, globalCtx, ACTOR_EN_DAIKU_KAKARIKO, position.x, + position.y, position.z, thisx->posRot.rot.x, thisx->posRot.rot.y, + thisx->posRot.rot.z, ((((s32)thisx->params >> 8) & 0xFF) << 8) + 1); + } + break; + case 0: // Potion Shop Poster + case 1: // Shooting gallery Poster + case 2: // Bazaar Poster + break; + } + + this->dyna.actor.draw = func_808AC4A4; + this->actionFunc = func_808AC474; + } +} + +void func_808AC474(BgSpot01Objects2* this, GlobalContext* globalCtx) { +} + +void BgSpot01Objects2_Update(Actor* thisx, GlobalContext* globalCtx) { + BgSpot01Objects2* this = THIS; + + this->actionFunc(this, globalCtx); +} + +void func_808AC4A4(Actor* thisx, GlobalContext* globalCtx) { + Gfx_DrawDListOpa(globalCtx, D_808AC510[thisx->params & 7]); +} diff --git a/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.h b/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.h index 436d2ab482..f19ff5e22a 100644 --- a/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.h +++ b/src/overlays/actors/ovl_Bg_Spot01_Objects2/z_bg_spot01_objects2.h @@ -9,12 +9,11 @@ struct BgSpot01Objects2; typedef void (*BgSpot01Objects2ActionFunc)(struct BgSpot01Objects2*, GlobalContext*); typedef struct BgSpot01Objects2 { - /* 0x0000 */ Actor actor; - /* 0x014C */ char unk_14C[0x18]; + /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ BgSpot01Objects2ActionFunc actionFunc; /* 0x0168 */ char unk_168[0x10]; /* 0x0178 */ s32 objectId; - /* 0x0179 */ char unk_179[0x4]; + /* 0x017C */ s8 objBankIndex; } BgSpot01Objects2; // size = 0x0180 extern const ActorInit Bg_Spot01_Objects2_InitVars; diff --git a/undefined_syms.txt b/undefined_syms.txt index c302bae50e..644671f925 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -162,6 +162,10 @@ D_06007888 = 0x06007888; // z_bg_spot01_idomizu D_060007D0 = 0x060007D0; +// z_bg_spot01_objects2 +D_06001A38 = 0x06001A38; +D_06001C58 = 0x06001C58; + // z_bg_spot09_obj D_06008010 = 0x06008010;