From 34c73dda62f973aaa940ffc7c8165cc645324c28 Mon Sep 17 00:00:00 2001 From: i82orbom Date: Tue, 4 Aug 2020 20:30:46 +0200 Subject: [PATCH] Decompiles z_bg_ingate (#301) * Decompiles z_bg_ingate * BgIngate_SetupAction * BgIngate_Init * BgIngate_Destroy * BgIngate_Update * func_80892990 * func_80892890 * BgIngate_Draw Removes unused asm's Formats z_bg_ingate.c * Addresses PR comments * Fixes usage of cutscene id instead of regular scene * Addresses PR comments --- .gitignore | 1 + .../actors/ovl_Bg_Ingate/BgIngate_Destroy.s | 14 --- .../actors/ovl_Bg_Ingate/BgIngate_Draw.s | 67 ------------- .../actors/ovl_Bg_Ingate/BgIngate_Init.s | 80 ---------------- .../ovl_Bg_Ingate/BgIngate_SetupAction.s | 3 - .../actors/ovl_Bg_Ingate/BgIngate_Update.s | 10 -- .../actors/ovl_Bg_Ingate/func_80892890.s | 72 -------------- .../actors/ovl_Bg_Ingate/func_80892990.s | 4 - data/overlays/actors/z_bg_ingate.data.s | 18 ---- data/overlays/actors/z_bg_ingate.reloc.s | 13 --- spec | 3 +- .../actors/ovl_Bg_Ingate/z_bg_ingate.c | 95 +++++++++++++++++-- undefined_syms.txt | 4 + 13 files changed, 91 insertions(+), 293 deletions(-) delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Ingate/BgIngate_Destroy.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Ingate/BgIngate_Draw.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Ingate/BgIngate_Init.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Ingate/BgIngate_SetupAction.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Ingate/BgIngate_Update.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Ingate/func_80892890.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_Bg_Ingate/func_80892990.s delete mode 100644 data/overlays/actors/z_bg_ingate.data.s delete mode 100644 data/overlays/actors/z_bg_ingate.reloc.s diff --git a/.gitignore b/.gitignore index 2bcfa41d3a..9d9356c463 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ venv/ # Project-specific ignores build/ +expected/ notes/ baserom/ docs/doxygen/ diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Ingate/BgIngate_Destroy.s b/asm/non_matchings/overlays/actors/ovl_Bg_Ingate/BgIngate_Destroy.s deleted file mode 100644 index 75299446cf..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Ingate/BgIngate_Destroy.s +++ /dev/null @@ -1,14 +0,0 @@ -glabel BgIngate_Destroy -/* 00120 80892860 27BDFFE8 */ addiu $sp, $sp, 0xFFE8 ## $sp = FFFFFFE8 -/* 00124 80892864 AFA40018 */ sw $a0, 0x0018($sp) -/* 00128 80892868 8FAE0018 */ lw $t6, 0x0018($sp) -/* 0012C 8089286C AFBF0014 */ sw $ra, 0x0014($sp) -/* 00130 80892870 00A02025 */ or $a0, $a1, $zero ## $a0 = 00000000 -/* 00134 80892874 24A50810 */ addiu $a1, $a1, 0x0810 ## $a1 = 00000810 -/* 00138 80892878 0C00FB56 */ jal DynaPolyInfo_Free - ## DynaPolyInfo_delReserve -/* 0013C 8089287C 8DC6014C */ lw $a2, 0x014C($t6) ## 0000014C -/* 00140 80892880 8FBF0014 */ lw $ra, 0x0014($sp) -/* 00144 80892884 27BD0018 */ addiu $sp, $sp, 0x0018 ## $sp = 00000000 -/* 00148 80892888 03E00008 */ jr $ra -/* 0014C 8089288C 00000000 */ nop diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Ingate/BgIngate_Draw.s b/asm/non_matchings/overlays/actors/ovl_Bg_Ingate/BgIngate_Draw.s deleted file mode 100644 index d52ecd3779..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Ingate/BgIngate_Draw.s +++ /dev/null @@ -1,67 +0,0 @@ -.rdata -glabel D_80892AB0 - .asciz "../z_bg_ingate.c" - .balign 4 - -glabel D_80892AC4 - .asciz "../z_bg_ingate.c" - .balign 4 - -glabel D_80892AD8 - .asciz "../z_bg_ingate.c" - .balign 4 - -.text -glabel BgIngate_Draw -/* 00280 808929C0 27BDFFC0 */ addiu $sp, $sp, 0xFFC0 ## $sp = FFFFFFC0 -/* 00284 808929C4 AFBF001C */ sw $ra, 0x001C($sp) -/* 00288 808929C8 AFB00018 */ sw $s0, 0x0018($sp) -/* 0028C 808929CC AFA40040 */ sw $a0, 0x0040($sp) -/* 00290 808929D0 AFA50044 */ sw $a1, 0x0044($sp) -/* 00294 808929D4 8CA50000 */ lw $a1, 0x0000($a1) ## 00000000 -/* 00298 808929D8 3C068089 */ lui $a2, %hi(D_80892AB0) ## $a2 = 80890000 -/* 0029C 808929DC 24C62AB0 */ addiu $a2, $a2, %lo(D_80892AB0) ## $a2 = 80892AB0 -/* 002A0 808929E0 27A4002C */ addiu $a0, $sp, 0x002C ## $a0 = FFFFFFEC -/* 002A4 808929E4 240700F0 */ addiu $a3, $zero, 0x00F0 ## $a3 = 000000F0 -/* 002A8 808929E8 0C031AB1 */ jal Graph_OpenDisps -/* 002AC 808929EC 00A08025 */ or $s0, $a1, $zero ## $s0 = 00000000 -/* 002B0 808929F0 8FAF0044 */ lw $t7, 0x0044($sp) -/* 002B4 808929F4 0C024F46 */ jal func_80093D18 -/* 002B8 808929F8 8DE40000 */ lw $a0, 0x0000($t7) ## 00000000 -/* 002BC 808929FC 8E0202C0 */ lw $v0, 0x02C0($s0) ## 000002C0 -/* 002C0 80892A00 3C19DA38 */ lui $t9, 0xDA38 ## $t9 = DA380000 -/* 002C4 80892A04 37390003 */ ori $t9, $t9, 0x0003 ## $t9 = DA380003 -/* 002C8 80892A08 24580008 */ addiu $t8, $v0, 0x0008 ## $t8 = 00000008 -/* 002CC 80892A0C AE1802C0 */ sw $t8, 0x02C0($s0) ## 000002C0 -/* 002D0 80892A10 AC590000 */ sw $t9, 0x0000($v0) ## 00000000 -/* 002D4 80892A14 8FA80044 */ lw $t0, 0x0044($sp) -/* 002D8 80892A18 3C058089 */ lui $a1, %hi(D_80892AC4) ## $a1 = 80890000 -/* 002DC 80892A1C 24A52AC4 */ addiu $a1, $a1, %lo(D_80892AC4) ## $a1 = 80892AC4 -/* 002E0 80892A20 8D040000 */ lw $a0, 0x0000($t0) ## 00000000 -/* 002E4 80892A24 240600F5 */ addiu $a2, $zero, 0x00F5 ## $a2 = 000000F5 -/* 002E8 80892A28 0C0346A2 */ jal Matrix_NewMtx -/* 002EC 80892A2C AFA20028 */ sw $v0, 0x0028($sp) -/* 002F0 80892A30 8FA30028 */ lw $v1, 0x0028($sp) -/* 002F4 80892A34 3C0B0600 */ lui $t3, 0x0600 ## $t3 = 06000000 -/* 002F8 80892A38 256B1040 */ addiu $t3, $t3, 0x1040 ## $t3 = 06001040 -/* 002FC 80892A3C AC620004 */ sw $v0, 0x0004($v1) ## 00000004 -/* 00300 80892A40 8E0202C0 */ lw $v0, 0x02C0($s0) ## 000002C0 -/* 00304 80892A44 3C0ADE00 */ lui $t2, 0xDE00 ## $t2 = DE000000 -/* 00308 80892A48 3C068089 */ lui $a2, %hi(D_80892AD8) ## $a2 = 80890000 -/* 0030C 80892A4C 24490008 */ addiu $t1, $v0, 0x0008 ## $t1 = 00000008 -/* 00310 80892A50 AE0902C0 */ sw $t1, 0x02C0($s0) ## 000002C0 -/* 00314 80892A54 AC4B0004 */ sw $t3, 0x0004($v0) ## 00000004 -/* 00318 80892A58 AC4A0000 */ sw $t2, 0x0000($v0) ## 00000000 -/* 0031C 80892A5C 8FAC0044 */ lw $t4, 0x0044($sp) -/* 00320 80892A60 24C62AD8 */ addiu $a2, $a2, %lo(D_80892AD8) ## $a2 = 80892AD8 -/* 00324 80892A64 27A4002C */ addiu $a0, $sp, 0x002C ## $a0 = FFFFFFEC -/* 00328 80892A68 240700FA */ addiu $a3, $zero, 0x00FA ## $a3 = 000000FA -/* 0032C 80892A6C 0C031AD5 */ jal Graph_CloseDisps -/* 00330 80892A70 8D850000 */ lw $a1, 0x0000($t4) ## 00000000 -/* 00334 80892A74 8FBF001C */ lw $ra, 0x001C($sp) -/* 00338 80892A78 8FB00018 */ lw $s0, 0x0018($sp) -/* 0033C 80892A7C 27BD0040 */ addiu $sp, $sp, 0x0040 ## $sp = 00000000 -/* 00340 80892A80 03E00008 */ jr $ra -/* 00344 80892A84 00000000 */ nop -/* 00348 80892A88 00000000 */ nop -/* 0034C 80892A8C 00000000 */ nop diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Ingate/BgIngate_Init.s b/asm/non_matchings/overlays/actors/ovl_Bg_Ingate/BgIngate_Init.s deleted file mode 100644 index 6c47ce52a0..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Ingate/BgIngate_Init.s +++ /dev/null @@ -1,80 +0,0 @@ -glabel BgIngate_Init -/* 00008 80892748 27BDFFD0 */ addiu $sp, $sp, 0xFFD0 ## $sp = FFFFFFD0 -/* 0000C 8089274C AFBF001C */ sw $ra, 0x001C($sp) -/* 00010 80892750 AFB00018 */ sw $s0, 0x0018($sp) -/* 00014 80892754 AFA50034 */ sw $a1, 0x0034($sp) -/* 00018 80892758 00808025 */ or $s0, $a0, $zero ## $s0 = 00000000 -/* 0001C 8089275C AFA00024 */ sw $zero, 0x0024($sp) -/* 00020 80892760 0C010D20 */ jal DynaPolyInfo_SetActorMove - -/* 00024 80892764 00002825 */ or $a1, $zero, $zero ## $a1 = 00000000 -/* 00028 80892768 3C040600 */ lui $a0, 0x0600 ## $a0 = 06000000 -/* 0002C 8089276C 248411B8 */ addiu $a0, $a0, 0x11B8 ## $a0 = 060011B8 -/* 00030 80892770 0C010620 */ jal DynaPolyInfo_Alloc - -/* 00034 80892774 27A50024 */ addiu $a1, $sp, 0x0024 ## $a1 = FFFFFFF4 -/* 00038 80892778 8FA40034 */ lw $a0, 0x0034($sp) -/* 0003C 8089277C 02003025 */ or $a2, $s0, $zero ## $a2 = 00000000 -/* 00040 80892780 8FA70024 */ lw $a3, 0x0024($sp) -/* 00044 80892784 0C00FA9D */ jal DynaPolyInfo_RegisterActor - ## DynaPolyInfo_setActor -/* 00048 80892788 24850810 */ addiu $a1, $a0, 0x0810 ## $a1 = 00000810 -/* 0004C 8089278C AE02014C */ sw $v0, 0x014C($s0) ## 0000014C -/* 00050 80892790 8FAE0034 */ lw $t6, 0x0034($sp) -/* 00054 80892794 3C028016 */ lui $v0, %hi(gSaveContext) -/* 00058 80892798 24010063 */ addiu $at, $zero, 0x0063 ## $at = 00000063 -/* 0005C 8089279C 85CF00A4 */ lh $t7, 0x00A4($t6) ## 000000A4 -/* 00060 808927A0 2442E660 */ addiu $v0, %lo(gSaveContext) -/* 00064 808927A4 15E1000E */ bne $t7, $at, .L808927E0 -/* 00068 808927A8 00000000 */ nop -/* 0006C 808927AC 8C580004 */ lw $t8, 0x0004($v0) ## 8015E664 -/* 00070 808927B0 1700000B */ bne $t8, $zero, .L808927E0 -/* 00074 808927B4 00000000 */ nop -/* 00078 808927B8 94590ED6 */ lhu $t9, 0x0ED6($v0) ## 8015F536 -/* 0007C 808927BC 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000 -/* 00080 808927C0 3C053DCC */ lui $a1, 0x3DCC ## $a1 = 3DCC0000 -/* 00084 808927C4 33280100 */ andi $t0, $t9, 0x0100 ## $t0 = 00000000 -/* 00088 808927C8 11000009 */ beq $t0, $zero, .L808927F0 -/* 0008C 808927CC 00000000 */ nop -/* 00090 808927D0 8C490008 */ lw $t1, 0x0008($v0) ## 8015E668 -/* 00094 808927D4 3401FFF0 */ ori $at, $zero, 0xFFF0 ## $at = 0000FFF0 -/* 00098 808927D8 11210005 */ beq $t1, $at, .L808927F0 -/* 0009C 808927DC 00000000 */ nop -.L808927E0: -/* 000A0 808927E0 0C00B55C */ jal Actor_Kill - -/* 000A4 808927E4 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000 -/* 000A8 808927E8 10000019 */ beq $zero, $zero, .L80892850 -/* 000AC 808927EC 8FBF001C */ lw $ra, 0x001C($sp) -.L808927F0: -/* 000B0 808927F0 0C00B58B */ jal Actor_SetScale - -/* 000B4 808927F4 34A5CCCD */ ori $a1, $a1, 0xCCCD ## $a1 = 0000CCCD -/* 000B8 808927F8 860A001C */ lh $t2, 0x001C($s0) ## 0000001C -/* 000BC 808927FC 3C028016 */ lui $v0, %hi(gSaveContext) -/* 000C0 80892800 2442E660 */ addiu $v0, %lo(gSaveContext) -/* 000C4 80892804 314B0001 */ andi $t3, $t2, 0x0001 ## $t3 = 00000000 -/* 000C8 80892808 1160000D */ beq $t3, $zero, .L80892840 -/* 000CC 8089280C 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000 -/* 000D0 80892810 944C13FA */ lhu $t4, 0x13FA($v0) ## 8015FA5A -/* 000D4 80892814 24010006 */ addiu $at, $zero, 0x0006 ## $at = 00000006 -/* 000D8 80892818 8FAE0034 */ lw $t6, 0x0034($sp) -/* 000DC 8089281C 318D000F */ andi $t5, $t4, 0x000F ## $t5 = 00000000 -/* 000E0 80892820 15A10007 */ bne $t5, $at, .L80892840 -/* 000E4 80892824 3C058089 */ lui $a1, %hi(func_80892890) ## $a1 = 80890000 -/* 000E8 80892828 A5C01D74 */ sh $zero, 0x1D74($t6) ## 00001D74 -/* 000EC 8089282C 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000 -/* 000F0 80892830 0C2249D0 */ jal BgIngate_SetupAction -/* 000F4 80892834 24A52890 */ addiu $a1, $a1, %lo(func_80892890) ## $a1 = 80892890 -/* 000F8 80892838 10000005 */ beq $zero, $zero, .L80892850 -/* 000FC 8089283C 8FBF001C */ lw $ra, 0x001C($sp) -.L80892840: -/* 00100 80892840 3C058089 */ lui $a1, %hi(func_80892990) ## $a1 = 80890000 -/* 00104 80892844 0C2249D0 */ jal BgIngate_SetupAction -/* 00108 80892848 24A52990 */ addiu $a1, $a1, %lo(func_80892990) ## $a1 = 80892990 -/* 0010C 8089284C 8FBF001C */ lw $ra, 0x001C($sp) -.L80892850: -/* 00110 80892850 8FB00018 */ lw $s0, 0x0018($sp) -/* 00114 80892854 27BD0030 */ addiu $sp, $sp, 0x0030 ## $sp = 00000000 -/* 00118 80892858 03E00008 */ jr $ra -/* 0011C 8089285C 00000000 */ nop diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Ingate/BgIngate_SetupAction.s b/asm/non_matchings/overlays/actors/ovl_Bg_Ingate/BgIngate_SetupAction.s deleted file mode 100644 index 71dae2c96d..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Ingate/BgIngate_SetupAction.s +++ /dev/null @@ -1,3 +0,0 @@ -glabel BgIngate_SetupAction -/* 00000 80892740 03E00008 */ jr $ra -/* 00004 80892744 AC850164 */ sw $a1, 0x0164($a0) ## 00000164 diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Ingate/BgIngate_Update.s b/asm/non_matchings/overlays/actors/ovl_Bg_Ingate/BgIngate_Update.s deleted file mode 100644 index 9e6d96fc43..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Ingate/BgIngate_Update.s +++ /dev/null @@ -1,10 +0,0 @@ -glabel BgIngate_Update -/* 0025C 8089299C 27BDFFE8 */ addiu $sp, $sp, 0xFFE8 ## $sp = FFFFFFE8 -/* 00260 808929A0 AFBF0014 */ sw $ra, 0x0014($sp) -/* 00264 808929A4 8C990164 */ lw $t9, 0x0164($a0) ## 00000164 -/* 00268 808929A8 0320F809 */ jalr $ra, $t9 -/* 0026C 808929AC 00000000 */ nop -/* 00270 808929B0 8FBF0014 */ lw $ra, 0x0014($sp) -/* 00274 808929B4 27BD0018 */ addiu $sp, $sp, 0x0018 ## $sp = 00000000 -/* 00278 808929B8 03E00008 */ jr $ra -/* 0027C 808929BC 00000000 */ nop diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Ingate/func_80892890.s b/asm/non_matchings/overlays/actors/ovl_Bg_Ingate/func_80892890.s deleted file mode 100644 index 7a066d6ce5..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Ingate/func_80892890.s +++ /dev/null @@ -1,72 +0,0 @@ -glabel func_80892890 -/* 00150 80892890 27BDFFE8 */ addiu $sp, $sp, 0xFFE8 ## $sp = FFFFFFE8 -/* 00154 80892894 AFBF0014 */ sw $ra, 0x0014($sp) -/* 00158 80892898 94A21D74 */ lhu $v0, 0x1D74($a1) ## 00001D74 -/* 0015C 8089289C 00803025 */ or $a2, $a0, $zero ## $a2 = 00000000 -/* 00160 808928A0 3C058089 */ lui $a1, %hi(func_80892990) ## $a1 = 80890000 -/* 00164 808928A4 28410032 */ slti $at, $v0, 0x0032 -/* 00168 808928A8 54200010 */ bnel $at, $zero, .L808928EC -/* 0016C 808928AC 2841000A */ slti $at, $v0, 0x000A -/* 00170 808928B0 848E001C */ lh $t6, 0x001C($a0) ## 0000001C -/* 00174 808928B4 24024000 */ addiu $v0, $zero, 0x4000 ## $v0 = 00004000 -/* 00178 808928B8 31CF0002 */ andi $t7, $t6, 0x0002 ## $t7 = 00000000 -/* 0017C 808928BC 55E00003 */ bnel $t7, $zero, .L808928CC -/* 00180 808928C0 84D80032 */ lh $t8, 0x0032($a2) ## 00000032 -/* 00184 808928C4 2402C000 */ addiu $v0, $zero, 0xC000 ## $v0 = FFFFC000 -/* 00188 808928C8 84D80032 */ lh $t8, 0x0032($a2) ## 00000032 -.L808928CC: -/* 0018C 808928CC 00C02025 */ or $a0, $a2, $zero ## $a0 = 00000000 -/* 00190 808928D0 24A52990 */ addiu $a1, $a1, %lo(func_80892990) ## $a1 = 80892990 -/* 00194 808928D4 0302C821 */ addu $t9, $t8, $v0 -/* 00198 808928D8 0C2249D0 */ jal BgIngate_SetupAction -/* 0019C 808928DC A4D900B6 */ sh $t9, 0x00B6($a2) ## 000000B6 -/* 001A0 808928E0 10000028 */ beq $zero, $zero, .L80892984 -/* 001A4 808928E4 8FBF0014 */ lw $ra, 0x0014($sp) -/* 001A8 808928E8 2841000A */ slti $at, $v0, 0x000A -.L808928EC: -/* 001AC 808928EC 14200024 */ bne $at, $zero, .L80892980 -/* 001B0 808928F0 2444FFF6 */ addiu $a0, $v0, 0xFFF6 ## $a0 = FFFFFFF6 -/* 001B4 808928F4 00042400 */ sll $a0, $a0, 16 -/* 001B8 808928F8 00042403 */ sra $a0, $a0, 16 -/* 001BC 808928FC 00800821 */ addu $at, $a0, $zero -/* 001C0 80892900 00042080 */ sll $a0, $a0, 2 -/* 001C4 80892904 00812023 */ subu $a0, $a0, $at -/* 001C8 80892908 000420C0 */ sll $a0, $a0, 3 -/* 001CC 8089290C 00812021 */ addu $a0, $a0, $at -/* 001D0 80892910 00042100 */ sll $a0, $a0, 4 -/* 001D4 80892914 00042400 */ sll $a0, $a0, 16 -/* 001D8 80892918 00042403 */ sra $a0, $a0, 16 -/* 001DC 8089291C 28814001 */ slti $at, $a0, 0x4001 -/* 001E0 80892920 14200002 */ bne $at, $zero, .L8089292C -/* 001E4 80892924 00000000 */ nop -/* 001E8 80892928 24044000 */ addiu $a0, $zero, 0x4000 ## $a0 = 00004000 -.L8089292C: -/* 001EC 8089292C 0C01DE1C */ jal Math_Sins - ## sins? -/* 001F0 80892930 AFA60018 */ sw $a2, 0x0018($sp) -/* 001F4 80892934 3C014680 */ lui $at, 0x4680 ## $at = 46800000 -/* 001F8 80892938 44812000 */ mtc1 $at, $f4 ## $f4 = 16384.00 -/* 001FC 8089293C 8FA60018 */ lw $a2, 0x0018($sp) -/* 00200 80892940 46040182 */ mul.s $f6, $f0, $f4 -/* 00204 80892944 84C9001C */ lh $t1, 0x001C($a2) ## 0000001C -/* 00208 80892948 312A0002 */ andi $t2, $t1, 0x0002 ## $t2 = 00000000 -/* 0020C 8089294C 4600320D */ trunc.w.s $f8, $f6 -/* 00210 80892950 44034000 */ mfc1 $v1, $f8 -/* 00214 80892954 00000000 */ nop -/* 00218 80892958 00031400 */ sll $v0, $v1, 16 -/* 0021C 8089295C 15400005 */ bne $t2, $zero, .L80892974 -/* 00220 80892960 00021403 */ sra $v0, $v0, 16 -/* 00224 80892964 00601025 */ or $v0, $v1, $zero ## $v0 = 00000000 -/* 00228 80892968 00021023 */ subu $v0, $zero, $v0 -/* 0022C 8089296C 00021400 */ sll $v0, $v0, 16 -/* 00230 80892970 00021403 */ sra $v0, $v0, 16 -.L80892974: -/* 00234 80892974 84CB0032 */ lh $t3, 0x0032($a2) ## 00000032 -/* 00238 80892978 01626021 */ addu $t4, $t3, $v0 -/* 0023C 8089297C A4CC00B6 */ sh $t4, 0x00B6($a2) ## 000000B6 -.L80892980: -/* 00240 80892980 8FBF0014 */ lw $ra, 0x0014($sp) -.L80892984: -/* 00244 80892984 27BD0018 */ addiu $sp, $sp, 0x0018 ## $sp = 00000000 -/* 00248 80892988 03E00008 */ jr $ra -/* 0024C 8089298C 00000000 */ nop diff --git a/asm/non_matchings/overlays/actors/ovl_Bg_Ingate/func_80892990.s b/asm/non_matchings/overlays/actors/ovl_Bg_Ingate/func_80892990.s deleted file mode 100644 index 89dd66aacf..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_Bg_Ingate/func_80892990.s +++ /dev/null @@ -1,4 +0,0 @@ -glabel func_80892990 -/* 00250 80892990 AFA40000 */ sw $a0, 0x0000($sp) -/* 00254 80892994 03E00008 */ jr $ra -/* 00258 80892998 AFA50004 */ sw $a1, 0x0004($sp) diff --git a/data/overlays/actors/z_bg_ingate.data.s b/data/overlays/actors/z_bg_ingate.data.s deleted file mode 100644 index 27c3af5296..0000000000 --- a/data/overlays/actors/z_bg_ingate.data.s +++ /dev/null @@ -1,18 +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_Ingate_InitVars - .word 0x01400600, 0x00000000, 0x01290000, 0x00000168 -.word BgIngate_Init -.word BgIngate_Destroy -.word BgIngate_Update -.word BgIngate_Draw - diff --git a/data/overlays/actors/z_bg_ingate.reloc.s b/data/overlays/actors/z_bg_ingate.reloc.s deleted file mode 100644 index 1cf6f1b9eb..0000000000 --- a/data/overlays/actors/z_bg_ingate.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_80892AF0 - .incbin "baserom/ovl_Bg_Ingate", 0x3B0, 0x00000070 diff --git a/spec b/spec index 02ec3e8586..d1e15b096e 100644 --- a/spec +++ b/spec @@ -957,8 +957,7 @@ endseg beginseg name "ovl_Bg_Ingate" include "build/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.o" - include "build/data/overlays/actors/z_bg_ingate.data.o" - include "build/data/overlays/actors/z_bg_ingate.reloc.o" + include "build/src/overlays/actors/ovl_Bg_Ingate/ovl_Bg_Ingate_reloc.o" endseg beginseg diff --git a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c index 629249aff0..2f0cca4f57 100644 --- a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c +++ b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c @@ -16,9 +16,8 @@ void BgIngate_Update(Actor* thisx, GlobalContext* globalCtx); void BgIngate_Draw(Actor* thisx, GlobalContext* globalCtx); void func_80892890(BgIngate* this, GlobalContext* globalCtx); -void func_80892990(BgIngate* this, GlobalContext* globalCtx); +void BgIngate_DoNothing(BgIngate* this, GlobalContext* globalCtx); -/* const ActorInit Bg_Ingate_InitVars = { ACTOR_BG_INGATE, ACTORTYPE_PROP, @@ -30,17 +29,93 @@ const ActorInit Bg_Ingate_InitVars = { (ActorFunc)BgIngate_Update, (ActorFunc)BgIngate_Draw, }; -*/ -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ingate/BgIngate_SetupAction.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ingate/BgIngate_Init.s") +extern UNK_TYPE D_060011B8; +extern Gfx D_06001040[]; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ingate/BgIngate_Destroy.s") +void BgIngate_SetupAction(BgIngate* this, BgIngateActionFunc actionFunc) { + this->actionFunc = actionFunc; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ingate/func_80892890.s") +void BgIngate_Init(Actor* thisx, GlobalContext* globalCtx) { + BgIngate* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ingate/func_80892990.s") + s32 pad; + s32 sp32 = 0; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ingate/BgIngate_Update.s") + DynaPolyInfo_SetActorMove(&this->dyna, 0); + DynaPolyInfo_Alloc(&D_060011B8, &sp32); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ingate/BgIngate_Draw.s") + this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, sp32); + + if ((globalCtx->sceneNum != SCENE_SPOT20 || LINK_IS_CHILD) || + (((gSaveContext.eventChkInf[1] & 0x100)) && (gSaveContext.cutsceneIndex != 0xFFF0))) { + Actor_Kill(&this->dyna.actor); + return; + } + + Actor_SetScale(&this->dyna.actor, 0.1f); + if (((this->dyna.actor.params & 1) != 0) && ((gSaveContext.eventInf[0] & 0xF) == 6)) { + globalCtx->csCtx.frames = 0; + BgIngate_SetupAction(this, func_80892890); + } else { + BgIngate_SetupAction(this, BgIngate_DoNothing); + } +} + +void BgIngate_Destroy(Actor* thisx, GlobalContext* globalCtx) { + BgIngate* this = THIS; + + DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId); +} + +void func_80892890(BgIngate* this, GlobalContext* globalCtx) { + s32 phi0; + s16 phi1; + s16 csFrames; + + if (globalCtx->csCtx.frames >= 50) { + phi0 = 0x4000; + if ((this->dyna.actor.params & 2) == 0) { + phi0 = -0x4000; + } + this->dyna.actor.shape.rot.y = this->dyna.actor.posRot.rot.y + phi0; + BgIngate_SetupAction(this, &BgIngate_DoNothing); + } else if (globalCtx->csCtx.frames >= 10) { + csFrames = globalCtx->csCtx.frames - 10; + csFrames *= 400; + phi1 = csFrames; + if (csFrames > 0x4000) { + csFrames = 0x4000; + } + csFrames = (Math_Sins(csFrames) * 16384.0f); + phi1 = csFrames; + if ((this->dyna.actor.params & 2) == 0) { + phi1 = -phi1; + } + this->dyna.actor.shape.rot.y = this->dyna.actor.posRot.rot.y + phi1; + } +} + +void BgIngate_DoNothing(BgIngate* this, GlobalContext* globalCtx) {} + +void BgIngate_Update(Actor* thisx, GlobalContext* globalCtx) { + BgIngate* this = THIS; + + this->actionFunc(this, globalCtx); +} + +void BgIngate_Draw(Actor* thisx, GlobalContext* globalCtx) { + GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + Gfx* dispRefs[4]; + + Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_ingate.c", 240); + + func_80093D18(globalCtx->state.gfxCtx); + + gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_ingate.c", 245), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + + gSPDisplayList(gfxCtx->polyOpa.p++, D_06001040); + Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_ingate.c", 250); +} diff --git a/undefined_syms.txt b/undefined_syms.txt index e6148ea833..567e615c29 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -801,3 +801,7 @@ D_060108B8 = 0x060108B8; D_0600FE40 = 0x0600FE40; D_0400CD80 = 0x0400CD80; D_040184B0 = 0x040184B0; + +// z_bg_ingate +D_060011B8 = 0x060011B8; +D_06001040 = 0x06001040; \ No newline at end of file