From 90188416602be3691f4381a0fad40c3850a6e213 Mon Sep 17 00:00:00 2001 From: Ethan Roseman Date: Sun, 20 Sep 2020 12:14:32 -0400 Subject: [PATCH] Decompiled ovl_Bg_Spot18_Shutter (#395) * Decompiled ovl_Bg_Spot18_Shutter * formatting * PR fix --- .../BgSpot18Shutter_Destroy.s | 14 -- .../BgSpot18Shutter_Draw.s | 15 --- .../BgSpot18Shutter_Init.s | 121 ----------------- .../BgSpot18Shutter_Update.s | 10 -- .../ovl_Bg_Spot18_Shutter/func_808B95AC.s | 4 - .../ovl_Bg_Spot18_Shutter/func_808B95B8.s | 28 ---- .../ovl_Bg_Spot18_Shutter/func_808B9618.s | 36 ----- .../ovl_Bg_Spot18_Shutter/func_808B9698.s | 38 ------ .../ovl_Bg_Spot18_Shutter/func_808B971C.s | 63 --------- .../actors/z_bg_spot18_shutter.data.s | 20 --- .../actors/z_bg_spot18_shutter.reloc.s | 13 -- spec | 3 +- .../z_bg_spot18_shutter.c | 126 ++++++++++++++++-- .../z_bg_spot18_shutter.h | 6 +- undefined_syms.txt | 3 + 15 files changed, 123 insertions(+), 377 deletions(-) delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/BgSpot18Shutter_Destroy.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/BgSpot18Shutter_Draw.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/BgSpot18Shutter_Init.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/BgSpot18Shutter_Update.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/func_808B95AC.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/func_808B95B8.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/func_808B9618.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/func_808B9698.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/func_808B971C.s delete mode 100644 data/overlays/actors/z_bg_spot18_shutter.data.s delete mode 100644 data/overlays/actors/z_bg_spot18_shutter.reloc.s diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/BgSpot18Shutter_Destroy.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/BgSpot18Shutter_Destroy.s deleted file mode 100644 index 47977c4093..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/BgSpot18Shutter_Destroy.s +++ /dev/null @@ -1,14 +0,0 @@ -glabel BgSpot18Shutter_Destroy -/* 001AC 808B957C 27BDFFE8 */ addiu $sp, $sp, 0xFFE8 ## $sp = FFFFFFE8 -/* 001B0 808B9580 AFA40018 */ sw $a0, 0x0018($sp) -/* 001B4 808B9584 8FAE0018 */ lw $t6, 0x0018($sp) -/* 001B8 808B9588 AFBF0014 */ sw $ra, 0x0014($sp) -/* 001BC 808B958C 00A02025 */ or $a0, $a1, $zero ## $a0 = 00000000 -/* 001C0 808B9590 24A50810 */ addiu $a1, $a1, 0x0810 ## $a1 = 00000810 -/* 001C4 808B9594 0C00FB56 */ jal DynaPolyInfo_Free - ## DynaPolyInfo_delReserve -/* 001C8 808B9598 8DC6014C */ lw $a2, 0x014C($t6) ## 0000014C -/* 001CC 808B959C 8FBF0014 */ lw $ra, 0x0014($sp) -/* 001D0 808B95A0 27BD0018 */ addiu $sp, $sp, 0x0018 ## $sp = 00000000 -/* 001D4 808B95A4 03E00008 */ jr $ra -/* 001D8 808B95A8 00000000 */ nop diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/BgSpot18Shutter_Draw.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/BgSpot18Shutter_Draw.s deleted file mode 100644 index cf3d77590a..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/BgSpot18Shutter_Draw.s +++ /dev/null @@ -1,15 +0,0 @@ -glabel BgSpot18Shutter_Draw -/* 0044C 808B981C 27BDFFE8 */ addiu $sp, $sp, 0xFFE8 ## $sp = FFFFFFE8 -/* 00450 808B9820 AFA40018 */ sw $a0, 0x0018($sp) -/* 00454 808B9824 00A02025 */ or $a0, $a1, $zero ## $a0 = 00000000 -/* 00458 808B9828 AFBF0014 */ sw $ra, 0x0014($sp) -/* 0045C 808B982C 3C050600 */ lui $a1, 0x0600 ## $a1 = 06000000 -/* 00460 808B9830 0C00D498 */ jal Gfx_DrawDListOpa - -/* 00464 808B9834 24A50420 */ addiu $a1, $a1, 0x0420 ## $a1 = 06000420 -/* 00468 808B9838 8FBF0014 */ lw $ra, 0x0014($sp) -/* 0046C 808B983C 27BD0018 */ addiu $sp, $sp, 0x0018 ## $sp = 00000000 -/* 00470 808B9840 03E00008 */ jr $ra -/* 00474 808B9844 00000000 */ nop -/* 00478 808B9848 00000000 */ nop -/* 0047C 808B984C 00000000 */ nop diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/BgSpot18Shutter_Init.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/BgSpot18Shutter_Init.s deleted file mode 100644 index e26ad944c0..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/BgSpot18Shutter_Init.s +++ /dev/null @@ -1,121 +0,0 @@ -glabel BgSpot18Shutter_Init -/* 00000 808B93D0 27BDFFC8 */ addiu $sp, $sp, 0xFFC8 ## $sp = FFFFFFC8 -/* 00004 808B93D4 AFBF001C */ sw $ra, 0x001C($sp) -/* 00008 808B93D8 AFB00018 */ sw $s0, 0x0018($sp) -/* 0000C 808B93DC AFA5003C */ sw $a1, 0x003C($sp) -/* 00010 808B93E0 848E001C */ lh $t6, 0x001C($a0) ## 0000001C -/* 00014 808B93E4 00808025 */ or $s0, $a0, $zero ## $s0 = 00000000 -/* 00018 808B93E8 AFA00028 */ sw $zero, 0x0028($sp) -/* 0001C 808B93EC 000E7A03 */ sra $t7, $t6, 8 -/* 00020 808B93F0 31F80001 */ andi $t8, $t7, 0x0001 ## $t8 = 00000000 -/* 00024 808B93F4 AFB8002C */ sw $t8, 0x002C($sp) -/* 00028 808B93F8 0C010D20 */ jal DynaPolyInfo_SetActorMove - -/* 0002C 808B93FC 00002825 */ or $a1, $zero, $zero ## $a1 = 00000000 -/* 00030 808B9400 3C05808C */ lui $a1, %hi(D_808B9870) ## $a1 = 808C0000 -/* 00034 808B9404 24A59870 */ addiu $a1, $a1, %lo(D_808B9870) ## $a1 = 808B9870 -/* 00038 808B9408 0C01E037 */ jal Actor_ProcessInitChain - -/* 0003C 808B940C 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000 -/* 00040 808B9410 8FB9002C */ lw $t9, 0x002C($sp) -/* 00044 808B9414 3C038016 */ lui $v1, %hi(gSaveContext) -/* 00048 808B9418 24010011 */ addiu $at, $zero, 0x0011 ## $at = 00000011 -/* 0004C 808B941C 1720002D */ bne $t9, $zero, .L808B94D4 -/* 00050 808B9420 2463E660 */ addiu $v1, %lo(gSaveContext) -/* 00054 808B9424 3C038016 */ lui $v1, %hi(gSaveContext) -/* 00058 808B9428 2463E660 */ addiu $v1, %lo(gSaveContext) -/* 0005C 808B942C 8C680004 */ lw $t0, 0x0004($v1) ## 8015E664 -/* 00060 808B9430 24020011 */ addiu $v0, $zero, 0x0011 ## $v0 = 00000011 -/* 00064 808B9434 11000003 */ beq $t0, $zero, .L808B9444 -/* 00068 808B9438 00000000 */ nop -/* 0006C 808B943C 10000001 */ beq $zero, $zero, .L808B9444 -/* 00070 808B9440 24020005 */ addiu $v0, $zero, 0x0005 ## $v0 = 00000005 -.L808B9444: -/* 00074 808B9444 54410012 */ bnel $v0, $at, .L808B9490 -/* 00078 808B9448 8605001C */ lh $a1, 0x001C($s0) ## 0000001C -/* 0007C 808B944C 94690F18 */ lhu $t1, 0x0F18($v1) ## 8015F578 -/* 00080 808B9450 3C0C808C */ lui $t4, %hi(func_808B9618) ## $t4 = 808C0000 -/* 00084 808B9454 3C014334 */ lui $at, 0x4334 ## $at = 43340000 -/* 00088 808B9458 312A0200 */ andi $t2, $t1, 0x0200 ## $t2 = 00000000 -/* 0008C 808B945C 11400009 */ beq $t2, $zero, .L808B9484 -/* 00090 808B9460 258C9618 */ addiu $t4, $t4, %lo(func_808B9618) ## $t4 = 808B9618 -/* 00094 808B9464 C6040028 */ lwc1 $f4, 0x0028($s0) ## 00000028 -/* 00098 808B9468 44813000 */ mtc1 $at, $f6 ## $f6 = 180.00 -/* 0009C 808B946C 3C0B808C */ lui $t3, %hi(func_808B95AC) ## $t3 = 808C0000 -/* 000A0 808B9470 256B95AC */ addiu $t3, $t3, %lo(func_808B95AC) ## $t3 = 808B95AC -/* 000A4 808B9474 46062200 */ add.s $f8, $f4, $f6 -/* 000A8 808B9478 AE0B0164 */ sw $t3, 0x0164($s0) ## 00000164 -/* 000AC 808B947C 10000030 */ beq $zero, $zero, .L808B9540 -/* 000B0 808B9480 E6080028 */ swc1 $f8, 0x0028($s0) ## 00000028 -.L808B9484: -/* 000B4 808B9484 1000002E */ beq $zero, $zero, .L808B9540 -/* 000B8 808B9488 AE0C0164 */ sw $t4, 0x0164($s0) ## 00000164 -/* 000BC 808B948C 8605001C */ lh $a1, 0x001C($s0) ## 0000001C -.L808B9490: -/* 000C0 808B9490 8FA4003C */ lw $a0, 0x003C($sp) -/* 000C4 808B9494 0C00B2D0 */ jal Flags_GetSwitch - -/* 000C8 808B9498 30A5003F */ andi $a1, $a1, 0x003F ## $a1 = 00000000 -/* 000CC 808B949C 1040000A */ beq $v0, $zero, .L808B94C8 -/* 000D0 808B94A0 3C0E808C */ lui $t6, %hi(func_808B95B8) ## $t6 = 808C0000 -/* 000D4 808B94A4 3C014334 */ lui $at, 0x4334 ## $at = 43340000 -/* 000D8 808B94A8 44818000 */ mtc1 $at, $f16 ## $f16 = 180.00 -/* 000DC 808B94AC C60A0028 */ lwc1 $f10, 0x0028($s0) ## 00000028 -/* 000E0 808B94B0 3C0D808C */ lui $t5, %hi(func_808B95AC) ## $t5 = 808C0000 -/* 000E4 808B94B4 25AD95AC */ addiu $t5, $t5, %lo(func_808B95AC) ## $t5 = 808B95AC -/* 000E8 808B94B8 46105480 */ add.s $f18, $f10, $f16 -/* 000EC 808B94BC AE0D0164 */ sw $t5, 0x0164($s0) ## 00000164 -/* 000F0 808B94C0 1000001F */ beq $zero, $zero, .L808B9540 -/* 000F4 808B94C4 E6120028 */ swc1 $f18, 0x0028($s0) ## 00000028 -.L808B94C8: -/* 000F8 808B94C8 25CE95B8 */ addiu $t6, $t6, %lo(func_808B95B8) ## $t6 = 808B95B8 -/* 000FC 808B94CC 1000001C */ beq $zero, $zero, .L808B9540 -/* 00100 808B94D0 AE0E0164 */ sw $t6, 0x0164($s0) ## 00000164 -.L808B94D4: -/* 00104 808B94D4 946F0F18 */ lhu $t7, 0x0F18($v1) ## 00000F18 -/* 00108 808B94D8 3C08808C */ lui $t0, %hi(func_808B9618) ## $t0 = 808C0000 -/* 0010C 808B94DC 25089618 */ addiu $t0, $t0, %lo(func_808B9618) ## $t0 = 808B9618 -/* 00110 808B94E0 31F80200 */ andi $t8, $t7, 0x0200 ## $t8 = 00000000 -/* 00114 808B94E4 53000016 */ beql $t8, $zero, .L808B9540 -/* 00118 808B94E8 AE080164 */ sw $t0, 0x0164($s0) ## 00000164 -/* 0011C 808B94EC 0C01DE0D */ jal Math_Coss - ## coss? -/* 00120 808B94F0 86040032 */ lh $a0, 0x0032($s0) ## 00000032 -/* 00124 808B94F4 3C0142FA */ lui $at, 0x42FA ## $at = 42FA0000 -/* 00128 808B94F8 44813000 */ mtc1 $at, $f6 ## $f6 = 125.00 -/* 0012C 808B94FC C6040024 */ lwc1 $f4, 0x0024($s0) ## 00000024 -/* 00130 808B9500 86040032 */ lh $a0, 0x0032($s0) ## 00000032 -/* 00134 808B9504 46003202 */ mul.s $f8, $f6, $f0 -/* 00138 808B9508 46082280 */ add.s $f10, $f4, $f8 -/* 0013C 808B950C 0C01DE1C */ jal Math_Sins - ## sins? -/* 00140 808B9510 E60A0024 */ swc1 $f10, 0x0024($s0) ## 00000024 -/* 00144 808B9514 3C0142FA */ lui $at, 0x42FA ## $at = 42FA0000 -/* 00148 808B9518 44819000 */ mtc1 $at, $f18 ## $f18 = 125.00 -/* 0014C 808B951C C610002C */ lwc1 $f16, 0x002C($s0) ## 0000002C -/* 00150 808B9520 3C19808C */ lui $t9, %hi(func_808B95AC) ## $t9 = 808C0000 -/* 00154 808B9524 46009182 */ mul.s $f6, $f18, $f0 -/* 00158 808B9528 273995AC */ addiu $t9, $t9, %lo(func_808B95AC) ## $t9 = 808B95AC -/* 0015C 808B952C AE190164 */ sw $t9, 0x0164($s0) ## 00000164 -/* 00160 808B9530 46068101 */ sub.s $f4, $f16, $f6 -/* 00164 808B9534 10000002 */ beq $zero, $zero, .L808B9540 -/* 00168 808B9538 E604002C */ swc1 $f4, 0x002C($s0) ## 0000002C -/* 0016C 808B953C AE080164 */ sw $t0, 0x0164($s0) ## 00000164 -.L808B9540: -/* 00170 808B9540 3C040600 */ lui $a0, 0x0600 ## $a0 = 06000000 -/* 00174 808B9544 24840534 */ addiu $a0, $a0, 0x0534 ## $a0 = 06000534 -/* 00178 808B9548 0C010620 */ jal DynaPolyInfo_Alloc - -/* 0017C 808B954C 27A50028 */ addiu $a1, $sp, 0x0028 ## $a1 = FFFFFFF0 -/* 00180 808B9550 8FA4003C */ lw $a0, 0x003C($sp) -/* 00184 808B9554 02003025 */ or $a2, $s0, $zero ## $a2 = 00000000 -/* 00188 808B9558 8FA70028 */ lw $a3, 0x0028($sp) -/* 0018C 808B955C 0C00FA9D */ jal DynaPolyInfo_RegisterActor - ## DynaPolyInfo_setActor -/* 00190 808B9560 24850810 */ addiu $a1, $a0, 0x0810 ## $a1 = 00000810 -/* 00194 808B9564 AE02014C */ sw $v0, 0x014C($s0) ## 0000014C -/* 00198 808B9568 8FBF001C */ lw $ra, 0x001C($sp) -/* 0019C 808B956C 8FB00018 */ lw $s0, 0x0018($sp) -/* 001A0 808B9570 27BD0038 */ addiu $sp, $sp, 0x0038 ## $sp = 00000000 -/* 001A4 808B9574 03E00008 */ jr $ra -/* 001A8 808B9578 00000000 */ nop diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/BgSpot18Shutter_Update.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/BgSpot18Shutter_Update.s deleted file mode 100644 index b512af4b17..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/BgSpot18Shutter_Update.s +++ /dev/null @@ -1,10 +0,0 @@ -glabel BgSpot18Shutter_Update -/* 00428 808B97F8 27BDFFE8 */ addiu $sp, $sp, 0xFFE8 ## $sp = FFFFFFE8 -/* 0042C 808B97FC AFBF0014 */ sw $ra, 0x0014($sp) -/* 00430 808B9800 8C990164 */ lw $t9, 0x0164($a0) ## 00000164 -/* 00434 808B9804 0320F809 */ jalr $ra, $t9 -/* 00438 808B9808 00000000 */ nop -/* 0043C 808B980C 8FBF0014 */ lw $ra, 0x0014($sp) -/* 00440 808B9810 27BD0018 */ addiu $sp, $sp, 0x0018 ## $sp = 00000000 -/* 00444 808B9814 03E00008 */ jr $ra -/* 00448 808B9818 00000000 */ nop diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/func_808B95AC.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/func_808B95AC.s deleted file mode 100644 index 1bf5301379..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/func_808B95AC.s +++ /dev/null @@ -1,4 +0,0 @@ -glabel func_808B95AC -/* 001DC 808B95AC AFA40000 */ sw $a0, 0x0000($sp) -/* 001E0 808B95B0 03E00008 */ jr $ra -/* 001E4 808B95B4 AFA50004 */ sw $a1, 0x0004($sp) diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/func_808B95B8.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/func_808B95B8.s deleted file mode 100644 index 2d21d16c20..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/func_808B95B8.s +++ /dev/null @@ -1,28 +0,0 @@ -glabel func_808B95B8 -/* 001E8 808B95B8 27BDFFE8 */ addiu $sp, $sp, 0xFFE8 ## $sp = FFFFFFE8 -/* 001EC 808B95BC AFA40018 */ sw $a0, 0x0018($sp) -/* 001F0 808B95C0 8FAE0018 */ lw $t6, 0x0018($sp) -/* 001F4 808B95C4 AFBF0014 */ sw $ra, 0x0014($sp) -/* 001F8 808B95C8 AFA5001C */ sw $a1, 0x001C($sp) -/* 001FC 808B95CC 00A02025 */ or $a0, $a1, $zero ## $a0 = 00000000 -/* 00200 808B95D0 85C5001C */ lh $a1, 0x001C($t6) ## 0000001C -/* 00204 808B95D4 0C00B2D0 */ jal Flags_GetSwitch - -/* 00208 808B95D8 30A5003F */ andi $a1, $a1, 0x003F ## $a1 = 00000000 -/* 0020C 808B95DC 1040000A */ beq $v0, $zero, .L808B9608 -/* 00210 808B95E0 8FA40018 */ lw $a0, 0x0018($sp) -/* 00214 808B95E4 0C00B56E */ jal Actor_SetHeight - -/* 00218 808B95E8 3C05428C */ lui $a1, 0x428C ## $a1 = 428C0000 -/* 0021C 808B95EC 8FA4001C */ lw $a0, 0x001C($sp) -/* 00220 808B95F0 0C020120 */ jal func_80080480 -/* 00224 808B95F4 8FA50018 */ lw $a1, 0x0018($sp) -/* 00228 808B95F8 8FB80018 */ lw $t8, 0x0018($sp) -/* 0022C 808B95FC 3C0F808C */ lui $t7, %hi(func_808B9698) ## $t7 = 808C0000 -/* 00230 808B9600 25EF9698 */ addiu $t7, $t7, %lo(func_808B9698) ## $t7 = 808B9698 -/* 00234 808B9604 AF0F0164 */ sw $t7, 0x0164($t8) ## 00000164 -.L808B9608: -/* 00238 808B9608 8FBF0014 */ lw $ra, 0x0014($sp) -/* 0023C 808B960C 27BD0018 */ addiu $sp, $sp, 0x0018 ## $sp = 00000000 -/* 00240 808B9610 03E00008 */ jr $ra -/* 00244 808B9614 00000000 */ nop diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/func_808B9618.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/func_808B9618.s deleted file mode 100644 index e6ac094f75..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/func_808B9618.s +++ /dev/null @@ -1,36 +0,0 @@ -glabel func_808B9618 -/* 00248 808B9618 3C0E8016 */ lui $t6, %hi(gSaveContext+0xf18) -/* 0024C 808B961C 95CEF578 */ lhu $t6, %lo(gSaveContext+0xf18)($t6) -/* 00250 808B9620 27BDFFE0 */ addiu $sp, $sp, 0xFFE0 ## $sp = FFFFFFE0 -/* 00254 808B9624 AFBF001C */ sw $ra, 0x001C($sp) -/* 00258 808B9628 31CF0200 */ andi $t7, $t6, 0x0200 ## $t7 = 00000000 -/* 0025C 808B962C AFA50024 */ sw $a1, 0x0024($sp) -/* 00260 808B9630 11E00015 */ beq $t7, $zero, .L808B9688 -/* 00264 808B9634 00803825 */ or $a3, $a0, $zero ## $a3 = 00000000 -/* 00268 808B9638 3C05428C */ lui $a1, 0x428C ## $a1 = 428C0000 -/* 0026C 808B963C 0C00B56E */ jal Actor_SetHeight - -/* 00270 808B9640 AFA70020 */ sw $a3, 0x0020($sp) -/* 00274 808B9644 8FA70020 */ lw $a3, 0x0020($sp) -/* 00278 808B9648 3C0A808C */ lui $t2, %hi(func_808B971C) ## $t2 = 808C0000 -/* 0027C 808B964C 3C09808C */ lui $t1, %hi(func_808B9698) ## $t1 = 808C0000 -/* 00280 808B9650 84F8001C */ lh $t8, 0x001C($a3) ## 0000001C -/* 00284 808B9654 254A971C */ addiu $t2, $t2, %lo(func_808B971C) ## $t2 = 808B971C -/* 00288 808B9658 2405107D */ addiu $a1, $zero, 0x107D ## $a1 = 0000107D -/* 0028C 808B965C 0018CA03 */ sra $t9, $t8, 8 -/* 00290 808B9660 33280001 */ andi $t0, $t9, 0x0001 ## $t0 = 00000000 -/* 00294 808B9664 15000004 */ bne $t0, $zero, .L808B9678 -/* 00298 808B9668 2406008C */ addiu $a2, $zero, 0x008C ## $a2 = 0000008C -/* 0029C 808B966C 25299698 */ addiu $t1, $t1, %lo(func_808B9698) ## $t1 = 808B9698 -/* 002A0 808B9670 10000005 */ beq $zero, $zero, .L808B9688 -/* 002A4 808B9674 ACE90164 */ sw $t1, 0x0164($a3) ## 00000164 -.L808B9678: -/* 002A8 808B9678 ACEA0164 */ sw $t2, 0x0164($a3) ## 00000164 -/* 002AC 808B967C AFA00010 */ sw $zero, 0x0010($sp) -/* 002B0 808B9680 0C02003E */ jal func_800800F8 -/* 002B4 808B9684 8FA40024 */ lw $a0, 0x0024($sp) -.L808B9688: -/* 002B8 808B9688 8FBF001C */ lw $ra, 0x001C($sp) -/* 002BC 808B968C 27BD0020 */ addiu $sp, $sp, 0x0020 ## $sp = 00000000 -/* 002C0 808B9690 03E00008 */ jr $ra -/* 002C4 808B9694 00000000 */ nop diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/func_808B9698.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/func_808B9698.s deleted file mode 100644 index 4596db2bb7..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/func_808B9698.s +++ /dev/null @@ -1,38 +0,0 @@ -glabel func_808B9698 -/* 002C8 808B9698 27BDFFE8 */ addiu $sp, $sp, 0xFFE8 ## $sp = FFFFFFE8 -/* 002CC 808B969C AFBF0014 */ sw $ra, 0x0014($sp) -/* 002D0 808B96A0 AFA5001C */ sw $a1, 0x001C($sp) -/* 002D4 808B96A4 00803825 */ or $a3, $a0, $zero ## $a3 = 00000000 -/* 002D8 808B96A8 3C014334 */ lui $at, 0x4334 ## $at = 43340000 -/* 002DC 808B96AC 44813000 */ mtc1 $at, $f6 ## $f6 = 180.00 -/* 002E0 808B96B0 C4E4000C */ lwc1 $f4, 0x000C($a3) ## 0000000C -/* 002E4 808B96B4 3C063FB8 */ lui $a2, 0x3FB8 ## $a2 = 3FB80000 -/* 002E8 808B96B8 34C651EC */ ori $a2, $a2, 0x51EC ## $a2 = 3FB851EC -/* 002EC 808B96BC 46062200 */ add.s $f8, $f4, $f6 -/* 002F0 808B96C0 AFA70018 */ sw $a3, 0x0018($sp) -/* 002F4 808B96C4 24840028 */ addiu $a0, $a0, 0x0028 ## $a0 = 00000028 -/* 002F8 808B96C8 44054000 */ mfc1 $a1, $f8 -/* 002FC 808B96CC 0C01DE80 */ jal Math_ApproxF - -/* 00300 808B96D0 00000000 */ nop -/* 00304 808B96D4 1040000A */ beq $v0, $zero, .L808B9700 -/* 00308 808B96D8 8FA70018 */ lw $a3, 0x0018($sp) -/* 0030C 808B96DC 00E02025 */ or $a0, $a3, $zero ## $a0 = 00000000 -/* 00310 808B96E0 24052893 */ addiu $a1, $zero, 0x2893 ## $a1 = 00002893 -/* 00314 808B96E4 0C00BE0A */ jal Audio_PlayActorSound2 - -/* 00318 808B96E8 AFA70018 */ sw $a3, 0x0018($sp) -/* 0031C 808B96EC 8FA70018 */ lw $a3, 0x0018($sp) -/* 00320 808B96F0 3C0E808C */ lui $t6, %hi(func_808B95AC) ## $t6 = 808C0000 -/* 00324 808B96F4 25CE95AC */ addiu $t6, $t6, %lo(func_808B95AC) ## $t6 = 808B95AC -/* 00328 808B96F8 10000004 */ beq $zero, $zero, .L808B970C -/* 0032C 808B96FC ACEE0164 */ sw $t6, 0x0164($a3) ## 00000164 -.L808B9700: -/* 00330 808B9700 00E02025 */ or $a0, $a3, $zero ## $a0 = 00000000 -/* 00334 808B9704 0C00BE5D */ jal func_8002F974 -/* 00338 808B9708 2405201E */ addiu $a1, $zero, 0x201E ## $a1 = 0000201E -.L808B970C: -/* 0033C 808B970C 8FBF0014 */ lw $ra, 0x0014($sp) -/* 00340 808B9710 27BD0018 */ addiu $sp, $sp, 0x0018 ## $sp = 00000000 -/* 00344 808B9714 03E00008 */ jr $ra -/* 00348 808B9718 00000000 */ nop diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/func_808B971C.s b/asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/func_808B971C.s deleted file mode 100644 index 076597848f..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/func_808B971C.s +++ /dev/null @@ -1,63 +0,0 @@ -glabel func_808B971C -/* 0034C 808B971C 27BDFFD0 */ addiu $sp, $sp, 0xFFD0 ## $sp = FFFFFFD0 -/* 00350 808B9720 AFB00018 */ sw $s0, 0x0018($sp) -/* 00354 808B9724 00808025 */ or $s0, $a0, $zero ## $s0 = 00000000 -/* 00358 808B9728 AFBF001C */ sw $ra, 0x001C($sp) -/* 0035C 808B972C AFA50034 */ sw $a1, 0x0034($sp) -/* 00360 808B9730 0C01DE1C */ jal Math_Sins - ## sins? -/* 00364 808B9734 84840032 */ lh $a0, 0x0032($a0) ## 00000032 -/* 00368 808B9738 E7A0002C */ swc1 $f0, 0x002C($sp) -/* 0036C 808B973C 0C01DE0D */ jal Math_Coss - ## coss? -/* 00370 808B9740 86040032 */ lh $a0, 0x0032($s0) ## 00000032 -/* 00374 808B9744 3C0142FA */ lui $at, 0x42FA ## $at = 42FA0000 -/* 00378 808B9748 44813000 */ mtc1 $at, $f6 ## $f6 = 125.00 -/* 0037C 808B974C 46000086 */ mov.s $f2, $f0 -/* 00380 808B9750 C6040008 */ lwc1 $f4, 0x0008($s0) ## 00000008 -/* 00384 808B9754 46023202 */ mul.s $f8, $f6, $f2 -/* 00388 808B9758 46000005 */ abs.s $f0, $f0 -/* 0038C 808B975C 26040024 */ addiu $a0, $s0, 0x0024 ## $a0 = 00000024 -/* 00390 808B9760 44060000 */ mfc1 $a2, $f0 -/* 00394 808B9764 46082280 */ add.s $f10, $f4, $f8 -/* 00398 808B9768 44055000 */ mfc1 $a1, $f10 -/* 0039C 808B976C 0C01DE80 */ jal Math_ApproxF - -/* 003A0 808B9770 00000000 */ nop -/* 003A4 808B9774 3C0142FA */ lui $at, 0x42FA ## $at = 42FA0000 -/* 003A8 808B9778 C7A2002C */ lwc1 $f2, 0x002C($sp) -/* 003AC 808B977C 44819000 */ mtc1 $at, $f18 ## $f18 = 125.00 -/* 003B0 808B9780 C6100010 */ lwc1 $f16, 0x0010($s0) ## 00000010 -/* 003B4 808B9784 46001005 */ abs.s $f0, $f2 -/* 003B8 808B9788 46029182 */ mul.s $f6, $f18, $f2 -/* 003BC 808B978C 30430001 */ andi $v1, $v0, 0x0001 ## $v1 = 00000000 -/* 003C0 808B9790 44060000 */ mfc1 $a2, $f0 -/* 003C4 808B9794 AFA30024 */ sw $v1, 0x0024($sp) -/* 003C8 808B9798 2604002C */ addiu $a0, $s0, 0x002C ## $a0 = 0000002C -/* 003CC 808B979C 46068101 */ sub.s $f4, $f16, $f6 -/* 003D0 808B97A0 44052000 */ mfc1 $a1, $f4 -/* 003D4 808B97A4 0C01DE80 */ jal Math_ApproxF - -/* 003D8 808B97A8 00000000 */ nop -/* 003DC 808B97AC 8FA30024 */ lw $v1, 0x0024($sp) -/* 003E0 808B97B0 24052893 */ addiu $a1, $zero, 0x2893 ## $a1 = 00002893 -/* 003E4 808B97B4 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000 -/* 003E8 808B97B8 00621824 */ and $v1, $v1, $v0 -/* 003EC 808B97BC 10600007 */ beq $v1, $zero, .L808B97DC -/* 003F0 808B97C0 00000000 */ nop -/* 003F4 808B97C4 0C00BE0A */ jal Audio_PlayActorSound2 - -/* 003F8 808B97C8 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000 -/* 003FC 808B97CC 3C0E808C */ lui $t6, %hi(func_808B95AC) ## $t6 = 808C0000 -/* 00400 808B97D0 25CE95AC */ addiu $t6, $t6, %lo(func_808B95AC) ## $t6 = 808B95AC -/* 00404 808B97D4 10000003 */ beq $zero, $zero, .L808B97E4 -/* 00408 808B97D8 AE0E0164 */ sw $t6, 0x0164($s0) ## 00000164 -.L808B97DC: -/* 0040C 808B97DC 0C00BE5D */ jal func_8002F974 -/* 00410 808B97E0 2405201E */ addiu $a1, $zero, 0x201E ## $a1 = 0000201E -.L808B97E4: -/* 00414 808B97E4 8FBF001C */ lw $ra, 0x001C($sp) -/* 00418 808B97E8 8FB00018 */ lw $s0, 0x0018($sp) -/* 0041C 808B97EC 27BD0030 */ addiu $sp, $sp, 0x0030 ## $sp = 00000000 -/* 00420 808B97F0 03E00008 */ jr $ra -/* 00424 808B97F4 00000000 */ nop diff --git a/data/overlays/actors/z_bg_spot18_shutter.data.s b/data/overlays/actors/z_bg_spot18_shutter.data.s deleted file mode 100644 index 740733c40f..0000000000 --- a/data/overlays/actors/z_bg_spot18_shutter.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_Spot18_Shutter_InitVars - .word 0x01C40600, 0x00000030, 0x00AF0000, 0x00000168 -.word BgSpot18Shutter_Init -.word BgSpot18Shutter_Destroy -.word BgSpot18Shutter_Update -.word BgSpot18Shutter_Draw -glabel D_808B9870 - .word 0x48500064, 0x00000000, 0x00000000, 0x00000000 - diff --git a/data/overlays/actors/z_bg_spot18_shutter.reloc.s b/data/overlays/actors/z_bg_spot18_shutter.reloc.s deleted file mode 100644 index 8e0a9bd514..0000000000 --- a/data/overlays/actors/z_bg_spot18_shutter.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_808B9880 - .incbin "baserom/ovl_Bg_Spot18_Shutter", 0x4B0, 0x00000090 diff --git a/spec b/spec index ee1c561437..a568c07fae 100644 --- a/spec +++ b/spec @@ -1363,8 +1363,7 @@ endseg beginseg name "ovl_Bg_Spot18_Shutter" include "build/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.o" - include "build/data/overlays/actors/z_bg_spot18_shutter.data.o" - include "build/data/overlays/actors/z_bg_spot18_shutter.reloc.o" + include "build/src/overlays/actors/ovl_Bg_Spot18_Shutter/ovl_Bg_Spot18_Shutter_reloc.o" endseg beginseg diff --git a/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.c b/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.c index 967bfea161..8a266d7577 100644 --- a/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.c +++ b/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.c @@ -1,3 +1,9 @@ +/* + * File: z_bg_spot18_shutter.c + * Overlay: Bg_Spot18_Shutter + * Description: + */ + #include "z_bg_spot18_shutter.h" #define FLAGS 0x00000030 @@ -9,7 +15,12 @@ void BgSpot18Shutter_Destroy(Actor* thisx, GlobalContext* globalCtx); void BgSpot18Shutter_Update(Actor* thisx, GlobalContext* globalCtx); void BgSpot18Shutter_Draw(Actor* thisx, GlobalContext* globalCtx); -/* +void func_808B95AC(BgSpot18Shutter* this, GlobalContext* globalCtx); +void func_808B95B8(BgSpot18Shutter* this, GlobalContext* globalCtx); +void func_808B9618(BgSpot18Shutter* this, GlobalContext* globalCtx); +void func_808B9698(BgSpot18Shutter* this, GlobalContext* globalCtx); +void func_808B971C(BgSpot18Shutter* this, GlobalContext* globalCtx); + const ActorInit Bg_Spot18_Shutter_InitVars = { ACTOR_BG_SPOT18_SHUTTER, ACTORTYPE_PROP, @@ -21,21 +32,114 @@ const ActorInit Bg_Spot18_Shutter_InitVars = { (ActorFunc)BgSpot18Shutter_Update, (ActorFunc)BgSpot18Shutter_Draw, }; -*/ -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/BgSpot18Shutter_Init.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/BgSpot18Shutter_Destroy.s") +static InitChainEntry sInitChain[] = { + ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/func_808B95AC.s") +extern Gfx D_06000420[]; +extern UNK_TYPE D_06000534; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/func_808B95B8.s") +void BgSpot18Shutter_Init(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + BgSpot18Shutter* this = THIS; + s32 param = (this->dyna.actor.params >> 8) & 1; + s32 localC = 0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/func_808B9618.s") + DynaPolyInfo_SetActorMove(&this->dyna, DPM_UNK); + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/func_808B9698.s") + if (param == 0) { + if (LINK_AGE_IN_YEARS == YEARS_ADULT) { + if (gSaveContext.infTable[16] & 0x200) { + this->actionFunc = func_808B95AC; + this->dyna.actor.posRot.pos.y += 180.0f; + } else { + this->actionFunc = func_808B9618; + } + } else { + if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { + this->actionFunc = func_808B95AC; + this->dyna.actor.posRot.pos.y += 180.0f; + } else { + this->actionFunc = func_808B95B8; + } + } + } else { + if (gSaveContext.infTable[16] & 0x200) { + this->dyna.actor.posRot.pos.x += 125.0f * Math_Coss(this->dyna.actor.posRot.rot.y); + this->dyna.actor.posRot.pos.z -= 125.0f * Math_Sins(this->dyna.actor.posRot.rot.y); + this->actionFunc = func_808B95AC; + } else { + this->actionFunc = func_808B9618; + } + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/func_808B971C.s") + DynaPolyInfo_Alloc(&D_06000534, &localC); + this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, localC); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/BgSpot18Shutter_Update.s") +void BgSpot18Shutter_Destroy(Actor* thisx, GlobalContext* globalCtx) { + BgSpot18Shutter* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot18_Shutter/BgSpot18Shutter_Draw.s") + DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId); +} + +void func_808B95AC(BgSpot18Shutter* this, GlobalContext* globalCtx) { +} + +void func_808B95B8(BgSpot18Shutter* this, GlobalContext* globalCtx) { + if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { + Actor_SetHeight(&this->dyna.actor, 70.0f); + func_80080480(globalCtx, this); + this->actionFunc = func_808B9698; + } +} + +void func_808B9618(BgSpot18Shutter* this, GlobalContext* globalCtx) { + if (gSaveContext.infTable[16] & 0x200) { + Actor_SetHeight(&this->dyna.actor, 70.0f); + if (((this->dyna.actor.params >> 8) & 1) == 0) { + this->actionFunc = func_808B9698; + } else { + this->actionFunc = func_808B971C; + func_800800F8(globalCtx, 0x107D, 0x8C, &this->dyna.actor, 0); + } + } +} + +void func_808B9698(BgSpot18Shutter* this, GlobalContext* globalCtx) { + if (Math_ApproxF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y + 180.0f, 1.44f)) { + Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_STONEDOOR_STOP); + this->actionFunc = func_808B95AC; + } else { + func_8002F974(&this->dyna.actor, NA_SE_EV_STONE_STATUE_OPEN - SFX_FLAG); + } +} + +void func_808B971C(BgSpot18Shutter* this, GlobalContext* globalCtx) { + f32 sin = Math_Sins(this->dyna.actor.posRot.rot.y); + f32 cos = Math_Coss(this->dyna.actor.posRot.rot.y); + s32 flag = + Math_ApproxF(&this->dyna.actor.posRot.pos.x, this->dyna.actor.initPosRot.pos.x + (125.0f * cos), fabsf(cos)) & + 1; + flag &= + Math_ApproxF(&this->dyna.actor.posRot.pos.z, this->dyna.actor.initPosRot.pos.z - (125.0f * sin), fabsf(sin)); + + if (flag) { + Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_STONEDOOR_STOP); + this->actionFunc = func_808B95AC; + } else { + func_8002F974(&this->dyna.actor, NA_SE_EV_STONE_STATUE_OPEN - SFX_FLAG); + } +} + +void BgSpot18Shutter_Update(Actor* thisx, GlobalContext* globalCtx) { + BgSpot18Shutter* this = THIS; + + this->actionFunc(this, globalCtx); +} + +void BgSpot18Shutter_Draw(Actor* thisx, GlobalContext* globalCtx) { + Gfx_DrawDListOpa(globalCtx, D_06000420); +} diff --git a/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.h b/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.h index 773f9d345d..003174c0ba 100644 --- a/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.h +++ b/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.h @@ -6,9 +6,11 @@ struct BgSpot18Shutter; +typedef void (*BgSpot18ShutterActionFunc)(struct BgSpot18Shutter*, GlobalContext*); + typedef struct BgSpot18Shutter { - /* 0x0000 */ Actor actor; - /* 0x014C */ char unk_14C[0x1C]; + /* 0x0000 */ DynaPolyActor dyna; + /* 0x0164 */ BgSpot18ShutterActionFunc actionFunc; } BgSpot18Shutter; // size = 0x0168 extern const ActorInit Bg_Spot18_Shutter_InitVars; diff --git a/undefined_syms.txt b/undefined_syms.txt index 8ea77292ad..8d8a98b4ee 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -321,6 +321,9 @@ D_0600238C = 0x0600238C; D_06000368 = 0x06000368; D_06000150 = 0x06000150; +// z_bg_spot18_shutter +D_06000534 = 0x06000534; + // z_bg_umajump D_06001438 = 0x06001438; D_06001220 = 0x06001220;