From f3edd3ee7721bf8c71479de2ea23aab440639bc2 Mon Sep 17 00:00:00 2001 From: Ethan Roseman Date: Tue, 7 Jul 2020 06:39:06 -0400 Subject: [PATCH] Decompiled ovl_En_Si (#239) * Decompiled ovl_En_Si * Description * Update src/overlays/actors/ovl_En_Si/z_en_si.c Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com> * Update src/overlays/actors/ovl_En_Si/z_en_si.c Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com> * Update src/overlays/actors/ovl_En_Si/z_en_si.c Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com> Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com> --- .../overlays/actors/ovl_En_Si/EnSi_Destroy.s | 12 -- .../overlays/actors/ovl_En_Si/EnSi_Draw.s | 25 ---- .../overlays/actors/ovl_En_Si/EnSi_Init.s | 40 ------ .../overlays/actors/ovl_En_Si/EnSi_Update.s | 31 ----- .../overlays/actors/ovl_En_Si/func_80AFB748.s | 10 -- .../overlays/actors/ovl_En_Si/func_80AFB768.s | 86 ------------ .../overlays/actors/ovl_En_Si/func_80AFB89C.s | 49 ------- .../overlays/actors/ovl_En_Si/func_80AFB950.s | 41 ------ data/overlays/actors/z_en_si.data.s | 23 ---- data/overlays/actors/z_en_si.reloc.s | 13 -- include/variables.h | 1 + include/z64.h | 2 +- spec | 3 +- src/overlays/actors/ovl_En_Si/z_en_si.c | 125 ++++++++++++++++-- src/overlays/actors/ovl_En_Si/z_en_si.h | 3 +- 15 files changed, 120 insertions(+), 344 deletions(-) delete mode 100644 asm/non_matchings/overlays/actors/ovl_En_Si/EnSi_Destroy.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_En_Si/EnSi_Draw.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_En_Si/EnSi_Init.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_En_Si/EnSi_Update.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_En_Si/func_80AFB748.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_En_Si/func_80AFB768.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_En_Si/func_80AFB89C.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_En_Si/func_80AFB950.s delete mode 100644 data/overlays/actors/z_en_si.data.s delete mode 100644 data/overlays/actors/z_en_si.reloc.s diff --git a/asm/non_matchings/overlays/actors/ovl_En_Si/EnSi_Destroy.s b/asm/non_matchings/overlays/actors/ovl_En_Si/EnSi_Destroy.s deleted file mode 100644 index 43c1fb4994..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_En_Si/EnSi_Destroy.s +++ /dev/null @@ -1,12 +0,0 @@ -glabel EnSi_Destroy -/* 00090 80AFB720 27BDFFE8 */ addiu $sp, $sp, 0xFFE8 ## $sp = FFFFFFE8 -/* 00094 80AFB724 00803025 */ or $a2, $a0, $zero ## $a2 = 00000000 -/* 00098 80AFB728 AFBF0014 */ sw $ra, 0x0014($sp) -/* 0009C 80AFB72C 00A02025 */ or $a0, $a1, $zero ## $a0 = 00000000 -/* 000A0 80AFB730 0C0170EB */ jal Collider_DestroyCylinder - -/* 000A4 80AFB734 24C50150 */ addiu $a1, $a2, 0x0150 ## $a1 = 00000150 -/* 000A8 80AFB738 8FBF0014 */ lw $ra, 0x0014($sp) -/* 000AC 80AFB73C 27BD0018 */ addiu $sp, $sp, 0x0018 ## $sp = 00000000 -/* 000B0 80AFB740 03E00008 */ jr $ra -/* 000B4 80AFB744 00000000 */ nop diff --git a/asm/non_matchings/overlays/actors/ovl_En_Si/EnSi_Draw.s b/asm/non_matchings/overlays/actors/ovl_En_Si/EnSi_Draw.s deleted file mode 100644 index 413ea52ed5..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_En_Si/EnSi_Draw.s +++ /dev/null @@ -1,25 +0,0 @@ -glabel EnSi_Draw -/* 003C4 80AFBA54 27BDFFE8 */ addiu $sp, $sp, 0xFFE8 ## $sp = FFFFFFE8 -/* 003C8 80AFBA58 AFBF0014 */ sw $ra, 0x0014($sp) -/* 003CC 80AFBA5C AFA5001C */ sw $a1, 0x001C($sp) -/* 003D0 80AFBA60 8C8F014C */ lw $t7, 0x014C($a0) ## 0000014C -/* 003D4 80AFBA64 3C0E80B0 */ lui $t6, %hi(func_80AFB950) ## $t6 = 80B00000 -/* 003D8 80AFBA68 25CEB950 */ addiu $t6, $t6, %lo(func_80AFB950) ## $t6 = 80AFB950 -/* 003DC 80AFBA6C 11CF000A */ beq $t6, $t7, .L80AFBA98 -/* 003E0 80AFBA70 00003025 */ or $a2, $zero, $zero ## $a2 = 00000000 -/* 003E4 80AFBA74 0C00BB60 */ jal func_8002ED80 -/* 003E8 80AFBA78 AFA40018 */ sw $a0, 0x0018($sp) -/* 003EC 80AFBA7C 8FA40018 */ lw $a0, 0x0018($sp) -/* 003F0 80AFBA80 8FA5001C */ lw $a1, 0x001C($sp) -/* 003F4 80AFBA84 0C00BAF3 */ jal func_8002EBCC -/* 003F8 80AFBA88 00003025 */ or $a2, $zero, $zero ## $a2 = 00000000 -/* 003FC 80AFBA8C 8FA4001C */ lw $a0, 0x001C($sp) -/* 00400 80AFBA90 0C01A528 */ jal func_800694A0 -/* 00404 80AFBA94 24050074 */ addiu $a1, $zero, 0x0074 ## $a1 = 00000074 -.L80AFBA98: -/* 00408 80AFBA98 8FBF0014 */ lw $ra, 0x0014($sp) -/* 0040C 80AFBA9C 27BD0018 */ addiu $sp, $sp, 0x0018 ## $sp = 00000000 -/* 00410 80AFBAA0 03E00008 */ jr $ra -/* 00414 80AFBAA4 00000000 */ nop -/* 00418 80AFBAA8 00000000 */ nop -/* 0041C 80AFBAAC 00000000 */ nop diff --git a/asm/non_matchings/overlays/actors/ovl_En_Si/EnSi_Init.s b/asm/non_matchings/overlays/actors/ovl_En_Si/EnSi_Init.s deleted file mode 100644 index 97e76b9f68..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_En_Si/EnSi_Init.s +++ /dev/null @@ -1,40 +0,0 @@ -glabel EnSi_Init -/* 00000 80AFB690 27BDFFD8 */ addiu $sp, $sp, 0xFFD8 ## $sp = FFFFFFD8 -/* 00004 80AFB694 AFB00018 */ sw $s0, 0x0018($sp) -/* 00008 80AFB698 00808025 */ or $s0, $a0, $zero ## $s0 = 00000000 -/* 0000C 80AFB69C AFA5002C */ sw $a1, 0x002C($sp) -/* 00010 80AFB6A0 00A02025 */ or $a0, $a1, $zero ## $a0 = 00000000 -/* 00014 80AFB6A4 AFBF001C */ sw $ra, 0x001C($sp) -/* 00018 80AFB6A8 26050150 */ addiu $a1, $s0, 0x0150 ## $a1 = 00000150 -/* 0001C 80AFB6AC 0C0170D9 */ jal Collider_InitCylinder - -/* 00020 80AFB6B0 AFA50020 */ sw $a1, 0x0020($sp) -/* 00024 80AFB6B4 3C0780B0 */ lui $a3, %hi(D_80AFBAB0) ## $a3 = 80B00000 -/* 00028 80AFB6B8 8FA50020 */ lw $a1, 0x0020($sp) -/* 0002C 80AFB6BC 24E7BAB0 */ addiu $a3, $a3, %lo(D_80AFBAB0) ## $a3 = 80AFBAB0 -/* 00030 80AFB6C0 8FA4002C */ lw $a0, 0x002C($sp) -/* 00034 80AFB6C4 0C01712B */ jal Collider_SetCylinder - -/* 00038 80AFB6C8 02003025 */ or $a2, $s0, $zero ## $a2 = 00000000 -/* 0003C 80AFB6CC 3C0680B0 */ lui $a2, %hi(D_80AFBADC) ## $a2 = 80B00000 -/* 00040 80AFB6D0 24C6BADC */ addiu $a2, $a2, %lo(D_80AFBADC) ## $a2 = 80AFBADC -/* 00044 80AFB6D4 26040098 */ addiu $a0, $s0, 0x0098 ## $a0 = 00000098 -/* 00048 80AFB6D8 0C0187BF */ jal func_80061EFC -/* 0004C 80AFB6DC 00002825 */ or $a1, $zero, $zero ## $a1 = 00000000 -/* 00050 80AFB6E0 3C053CCC */ lui $a1, 0x3CCC ## $a1 = 3CCC0000 -/* 00054 80AFB6E4 34A5CCCD */ ori $a1, $a1, 0xCCCD ## $a1 = 3CCCCCCD -/* 00058 80AFB6E8 0C00B58B */ jal Actor_SetScale - -/* 0005C 80AFB6EC 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000 -/* 00060 80AFB6F0 3C014228 */ lui $at, 0x4228 ## $at = 42280000 -/* 00064 80AFB6F4 44812000 */ mtc1 $at, $f4 ## $f4 = 42.00 -/* 00068 80AFB6F8 3C0E80B0 */ lui $t6, %hi(func_80AFB768) ## $t6 = 80B00000 -/* 0006C 80AFB6FC 25CEB768 */ addiu $t6, $t6, %lo(func_80AFB768) ## $t6 = 80AFB768 -/* 00070 80AFB700 A200019C */ sb $zero, 0x019C($s0) ## 0000019C -/* 00074 80AFB704 AE0E014C */ sw $t6, 0x014C($s0) ## 0000014C -/* 00078 80AFB708 E60400BC */ swc1 $f4, 0x00BC($s0) ## 000000BC -/* 0007C 80AFB70C 8FBF001C */ lw $ra, 0x001C($sp) -/* 00080 80AFB710 8FB00018 */ lw $s0, 0x0018($sp) -/* 00084 80AFB714 27BD0028 */ addiu $sp, $sp, 0x0028 ## $sp = 00000000 -/* 00088 80AFB718 03E00008 */ jr $ra -/* 0008C 80AFB71C 00000000 */ nop diff --git a/asm/non_matchings/overlays/actors/ovl_En_Si/EnSi_Update.s b/asm/non_matchings/overlays/actors/ovl_En_Si/EnSi_Update.s deleted file mode 100644 index 7c8676c57f..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_En_Si/EnSi_Update.s +++ /dev/null @@ -1,31 +0,0 @@ -glabel EnSi_Update -/* 00354 80AFB9E4 27BDFFD8 */ addiu $sp, $sp, 0xFFD8 ## $sp = FFFFFFD8 -/* 00358 80AFB9E8 AFBF0024 */ sw $ra, 0x0024($sp) -/* 0035C 80AFB9EC AFB00020 */ sw $s0, 0x0020($sp) -/* 00360 80AFB9F0 00808025 */ or $s0, $a0, $zero ## $s0 = 00000000 -/* 00364 80AFB9F4 0C00B638 */ jal Actor_MoveForward - -/* 00368 80AFB9F8 AFA5002C */ sw $a1, 0x002C($sp) -/* 0036C 80AFB9FC 44800000 */ mtc1 $zero, $f0 ## $f0 = 0.00 -/* 00370 80AFBA00 240E0004 */ addiu $t6, $zero, 0x0004 ## $t6 = 00000004 -/* 00374 80AFBA04 AFAE0014 */ sw $t6, 0x0014($sp) -/* 00378 80AFBA08 44060000 */ mfc1 $a2, $f0 -/* 0037C 80AFBA0C 44070000 */ mfc1 $a3, $f0 -/* 00380 80AFBA10 8FA4002C */ lw $a0, 0x002C($sp) -/* 00384 80AFBA14 02002825 */ or $a1, $s0, $zero ## $a1 = 00000000 -/* 00388 80AFBA18 0C00B92D */ jal func_8002E4B4 -/* 0038C 80AFBA1C E7A00010 */ swc1 $f0, 0x0010($sp) -/* 00390 80AFBA20 8E19014C */ lw $t9, 0x014C($s0) ## 0000014C -/* 00394 80AFBA24 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000 -/* 00398 80AFBA28 8FA5002C */ lw $a1, 0x002C($sp) -/* 0039C 80AFBA2C 0320F809 */ jalr $ra, $t9 -/* 003A0 80AFBA30 00000000 */ nop -/* 003A4 80AFBA34 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000 -/* 003A8 80AFBA38 0C00B56E */ jal Actor_SetHeight - -/* 003AC 80AFBA3C 3C054180 */ lui $a1, 0x4180 ## $a1 = 41800000 -/* 003B0 80AFBA40 8FBF0024 */ lw $ra, 0x0024($sp) -/* 003B4 80AFBA44 8FB00020 */ lw $s0, 0x0020($sp) -/* 003B8 80AFBA48 27BD0028 */ addiu $sp, $sp, 0x0028 ## $sp = 00000000 -/* 003BC 80AFBA4C 03E00008 */ jr $ra -/* 003C0 80AFBA50 00000000 */ nop diff --git a/asm/non_matchings/overlays/actors/ovl_En_Si/func_80AFB748.s b/asm/non_matchings/overlays/actors/ovl_En_Si/func_80AFB748.s deleted file mode 100644 index c50fbf2bb8..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_En_Si/func_80AFB748.s +++ /dev/null @@ -1,10 +0,0 @@ -glabel func_80AFB748 -/* 000B8 80AFB748 AFA50004 */ sw $a1, 0x0004($sp) -/* 000BC 80AFB74C 90820161 */ lbu $v0, 0x0161($a0) ## 00000161 -/* 000C0 80AFB750 304E0002 */ andi $t6, $v0, 0x0002 ## $t6 = 00000000 -/* 000C4 80AFB754 11C00002 */ beq $t6, $zero, .L80AFB760 -/* 000C8 80AFB758 304FFFFD */ andi $t7, $v0, 0xFFFD ## $t7 = 00000000 -/* 000CC 80AFB75C A08F0161 */ sb $t7, 0x0161($a0) ## 00000161 -.L80AFB760: -/* 000D0 80AFB760 03E00008 */ jr $ra -/* 000D4 80AFB764 00001025 */ or $v0, $zero, $zero ## $v0 = 00000000 diff --git a/asm/non_matchings/overlays/actors/ovl_En_Si/func_80AFB768.s b/asm/non_matchings/overlays/actors/ovl_En_Si/func_80AFB768.s deleted file mode 100644 index 246d5724fb..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_En_Si/func_80AFB768.s +++ /dev/null @@ -1,86 +0,0 @@ -glabel func_80AFB768 -/* 000D8 80AFB768 27BDFFD0 */ addiu $sp, $sp, 0xFFD0 ## $sp = FFFFFFD0 -/* 000DC 80AFB76C AFBF0024 */ sw $ra, 0x0024($sp) -/* 000E0 80AFB770 AFB10020 */ sw $s1, 0x0020($sp) -/* 000E4 80AFB774 AFB0001C */ sw $s0, 0x001C($sp) -/* 000E8 80AFB778 8CAE1C44 */ lw $t6, 0x1C44($a1) ## 00001C44 -/* 000EC 80AFB77C 00A08825 */ or $s1, $a1, $zero ## $s1 = 00000000 -/* 000F0 80AFB780 24012000 */ addiu $at, $zero, 0x2000 ## $at = 00002000 -/* 000F4 80AFB784 AFAE002C */ sw $t6, 0x002C($sp) -/* 000F8 80AFB788 8C8F0004 */ lw $t7, 0x0004($a0) ## 00000004 -/* 000FC 80AFB78C 00808025 */ or $s0, $a0, $zero ## $s0 = 00000000 -/* 00100 80AFB790 3C053E80 */ lui $a1, 0x3E80 ## $a1 = 3E800000 -/* 00104 80AFB794 31F82000 */ andi $t8, $t7, 0x2000 ## $t8 = 00000000 -/* 00108 80AFB798 17010005 */ bne $t8, $at, .L80AFB7B0 -/* 0010C 80AFB79C 3C063ECC */ lui $a2, 0x3ECC ## $a2 = 3ECC0000 -/* 00110 80AFB7A0 3C1980B0 */ lui $t9, %hi(func_80AFB89C) ## $t9 = 80B00000 -/* 00114 80AFB7A4 2739B89C */ addiu $t9, $t9, %lo(func_80AFB89C) ## $t9 = 80AFB89C -/* 00118 80AFB7A8 10000037 */ beq $zero, $zero, .L80AFB888 -/* 0011C 80AFB7AC AC99014C */ sw $t9, 0x014C($a0) ## 0000014C -.L80AFB7B0: -/* 00120 80AFB7B0 44802000 */ mtc1 $zero, $f4 ## $f4 = 0.00 -/* 00124 80AFB7B4 26040050 */ addiu $a0, $s0, 0x0050 ## $a0 = 00000050 -/* 00128 80AFB7B8 34C6CCCD */ ori $a2, $a2, 0xCCCD ## $a2 = 3ECCCCCD -/* 0012C 80AFB7BC 3C073F80 */ lui $a3, 0x3F80 ## $a3 = 3F800000 -/* 00130 80AFB7C0 0C01E0C4 */ jal Math_SmoothScaleMaxMinF - -/* 00134 80AFB7C4 E7A40010 */ swc1 $f4, 0x0010($sp) -/* 00138 80AFB7C8 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000 -/* 0013C 80AFB7CC 0C00B58B */ jal Actor_SetScale - -/* 00140 80AFB7D0 8E050050 */ lw $a1, 0x0050($s0) ## 00000050 -/* 00144 80AFB7D4 860800B6 */ lh $t0, 0x00B6($s0) ## 000000B6 -/* 00148 80AFB7D8 02202025 */ or $a0, $s1, $zero ## $a0 = 00000000 -/* 0014C 80AFB7DC 25090400 */ addiu $t1, $t0, 0x0400 ## $t1 = 00000400 -/* 00150 80AFB7E0 0C023A62 */ jal func_8008E988 -/* 00154 80AFB7E4 A60900B6 */ sh $t1, 0x00B6($s0) ## 000000B6 -/* 00158 80AFB7E8 14400027 */ bne $v0, $zero, .L80AFB888 -/* 0015C 80AFB7EC 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000 -/* 00160 80AFB7F0 0C2BEDD2 */ jal func_80AFB748 -/* 00164 80AFB7F4 02202825 */ or $a1, $s1, $zero ## $a1 = 00000000 -/* 00168 80AFB7F8 92030163 */ lbu $v1, 0x0163($s0) ## 00000163 -/* 0016C 80AFB7FC 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000 -/* 00170 80AFB800 26050150 */ addiu $a1, $s0, 0x0150 ## $a1 = 00000150 -/* 00174 80AFB804 306A0001 */ andi $t2, $v1, 0x0001 ## $t2 = 00000000 -/* 00178 80AFB808 11400012 */ beq $t2, $zero, .L80AFB854 -/* 0017C 80AFB80C 306BFFFE */ andi $t3, $v1, 0xFFFE ## $t3 = 00000000 -/* 00180 80AFB810 A20B0163 */ sb $t3, 0x0163($s0) ## 00000163 -/* 00184 80AFB814 02202025 */ or $a0, $s1, $zero ## $a0 = 00000000 -/* 00188 80AFB818 0C021344 */ jal Item_Give -/* 0018C 80AFB81C 24050071 */ addiu $a1, $zero, 0x0071 ## $a1 = 00000071 -/* 00190 80AFB820 8FAD002C */ lw $t5, 0x002C($sp) -/* 00194 80AFB824 240C000A */ addiu $t4, $zero, 0x000A ## $t4 = 0000000A -/* 00198 80AFB828 02202025 */ or $a0, $s1, $zero ## $a0 = 00000000 -/* 0019C 80AFB82C 240500B4 */ addiu $a1, $zero, 0x00B4 ## $a1 = 000000B4 -/* 001A0 80AFB830 00003025 */ or $a2, $zero, $zero ## $a2 = 00000000 -/* 001A4 80AFB834 0C042DA0 */ jal func_8010B680 -/* 001A8 80AFB838 A5AC0110 */ sh $t4, 0x0110($t5) ## 00000110 -/* 001AC 80AFB83C 0C03D719 */ jal func_800F5C64 -/* 001B0 80AFB840 24040039 */ addiu $a0, $zero, 0x0039 ## $a0 = 00000039 -/* 001B4 80AFB844 3C0E80B0 */ lui $t6, %hi(func_80AFB950) ## $t6 = 80B00000 -/* 001B8 80AFB848 25CEB950 */ addiu $t6, $t6, %lo(func_80AFB950) ## $t6 = 80AFB950 -/* 001BC 80AFB84C 1000000E */ beq $zero, $zero, .L80AFB888 -/* 001C0 80AFB850 AE0E014C */ sw $t6, 0x014C($s0) ## 0000014C -.L80AFB854: -/* 001C4 80AFB854 0C0189B7 */ jal Collider_CylinderUpdate - -/* 001C8 80AFB858 AFA50028 */ sw $a1, 0x0028($sp) -/* 001CC 80AFB85C 3C010001 */ lui $at, 0x0001 ## $at = 00010000 -/* 001D0 80AFB860 34211E60 */ ori $at, $at, 0x1E60 ## $at = 00011E60 -/* 001D4 80AFB864 02218021 */ addu $s0, $s1, $at -/* 001D8 80AFB868 02002825 */ or $a1, $s0, $zero ## $a1 = 00000000 -/* 001DC 80AFB86C 02202025 */ or $a0, $s1, $zero ## $a0 = 00000000 -/* 001E0 80AFB870 0C01767D */ jal CollisionCheck_SetAC - ## CollisionCheck_setAC -/* 001E4 80AFB874 8FA60028 */ lw $a2, 0x0028($sp) -/* 001E8 80AFB878 02202025 */ or $a0, $s1, $zero ## $a0 = 00000000 -/* 001EC 80AFB87C 02002825 */ or $a1, $s0, $zero ## $a1 = 00000000 -/* 001F0 80AFB880 0C017713 */ jal CollisionCheck_SetOC - ## CollisionCheck_setOT -/* 001F4 80AFB884 8FA60028 */ lw $a2, 0x0028($sp) -.L80AFB888: -/* 001F8 80AFB888 8FBF0024 */ lw $ra, 0x0024($sp) -/* 001FC 80AFB88C 8FB0001C */ lw $s0, 0x001C($sp) -/* 00200 80AFB890 8FB10020 */ lw $s1, 0x0020($sp) -/* 00204 80AFB894 03E00008 */ jr $ra -/* 00208 80AFB898 27BD0030 */ addiu $sp, $sp, 0x0030 ## $sp = 00000000 diff --git a/asm/non_matchings/overlays/actors/ovl_En_Si/func_80AFB89C.s b/asm/non_matchings/overlays/actors/ovl_En_Si/func_80AFB89C.s deleted file mode 100644 index 367cf4fa93..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_En_Si/func_80AFB89C.s +++ /dev/null @@ -1,49 +0,0 @@ -glabel func_80AFB89C -/* 0020C 80AFB89C 27BDFFD0 */ addiu $sp, $sp, 0xFFD0 ## $sp = FFFFFFD0 -/* 00210 80AFB8A0 AFBF0024 */ sw $ra, 0x0024($sp) -/* 00214 80AFB8A4 AFB00020 */ sw $s0, 0x0020($sp) -/* 00218 80AFB8A8 AFA50034 */ sw $a1, 0x0034($sp) -/* 0021C 80AFB8AC 8CAF1C44 */ lw $t7, 0x1C44($a1) ## 00001C44 -/* 00220 80AFB8B0 44802000 */ mtc1 $zero, $f4 ## $f4 = 0.00 -/* 00224 80AFB8B4 00808025 */ or $s0, $a0, $zero ## $s0 = 00000000 -/* 00228 80AFB8B8 3C063ECC */ lui $a2, 0x3ECC ## $a2 = 3ECC0000 -/* 0022C 80AFB8BC 34C6CCCD */ ori $a2, $a2, 0xCCCD ## $a2 = 3ECCCCCD -/* 00230 80AFB8C0 24840050 */ addiu $a0, $a0, 0x0050 ## $a0 = 00000050 -/* 00234 80AFB8C4 3C053E80 */ lui $a1, 0x3E80 ## $a1 = 3E800000 -/* 00238 80AFB8C8 3C073F80 */ lui $a3, 0x3F80 ## $a3 = 3F800000 -/* 0023C 80AFB8CC AFAF002C */ sw $t7, 0x002C($sp) -/* 00240 80AFB8D0 0C01E0C4 */ jal Math_SmoothScaleMaxMinF - -/* 00244 80AFB8D4 E7A40010 */ swc1 $f4, 0x0010($sp) -/* 00248 80AFB8D8 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000 -/* 0024C 80AFB8DC 0C00B58B */ jal Actor_SetScale - -/* 00250 80AFB8E0 8E050050 */ lw $a1, 0x0050($s0) ## 00000050 -/* 00254 80AFB8E4 861800B6 */ lh $t8, 0x00B6($s0) ## 000000B6 -/* 00258 80AFB8E8 8E080004 */ lw $t0, 0x0004($s0) ## 00000004 -/* 0025C 80AFB8EC 24012000 */ addiu $at, $zero, 0x2000 ## $at = 00002000 -/* 00260 80AFB8F0 27190400 */ addiu $t9, $t8, 0x0400 ## $t9 = 00000400 -/* 00264 80AFB8F4 31092000 */ andi $t1, $t0, 0x2000 ## $t1 = 00000000 -/* 00268 80AFB8F8 11210010 */ beq $t1, $at, .L80AFB93C -/* 0026C 80AFB8FC A61900B6 */ sh $t9, 0x00B6($s0) ## 000000B6 -/* 00270 80AFB900 8FA40034 */ lw $a0, 0x0034($sp) -/* 00274 80AFB904 0C021344 */ jal Item_Give -/* 00278 80AFB908 24050071 */ addiu $a1, $zero, 0x0071 ## $a1 = 00000071 -/* 0027C 80AFB90C 8FAB002C */ lw $t3, 0x002C($sp) -/* 00280 80AFB910 240A000A */ addiu $t2, $zero, 0x000A ## $t2 = 0000000A -/* 00284 80AFB914 240500B4 */ addiu $a1, $zero, 0x00B4 ## $a1 = 000000B4 -/* 00288 80AFB918 A56A0110 */ sh $t2, 0x0110($t3) ## 00000110 -/* 0028C 80AFB91C 8FA40034 */ lw $a0, 0x0034($sp) -/* 00290 80AFB920 0C042DA0 */ jal func_8010B680 -/* 00294 80AFB924 00003025 */ or $a2, $zero, $zero ## $a2 = 00000000 -/* 00298 80AFB928 0C03D719 */ jal func_800F5C64 -/* 0029C 80AFB92C 24040039 */ addiu $a0, $zero, 0x0039 ## $a0 = 00000039 -/* 002A0 80AFB930 3C0C80B0 */ lui $t4, %hi(func_80AFB950) ## $t4 = 80B00000 -/* 002A4 80AFB934 258CB950 */ addiu $t4, $t4, %lo(func_80AFB950) ## $t4 = 80AFB950 -/* 002A8 80AFB938 AE0C014C */ sw $t4, 0x014C($s0) ## 0000014C -.L80AFB93C: -/* 002AC 80AFB93C 8FBF0024 */ lw $ra, 0x0024($sp) -/* 002B0 80AFB940 8FB00020 */ lw $s0, 0x0020($sp) -/* 002B4 80AFB944 27BD0030 */ addiu $sp, $sp, 0x0030 ## $sp = 00000000 -/* 002B8 80AFB948 03E00008 */ jr $ra -/* 002BC 80AFB94C 00000000 */ nop diff --git a/asm/non_matchings/overlays/actors/ovl_En_Si/func_80AFB950.s b/asm/non_matchings/overlays/actors/ovl_En_Si/func_80AFB950.s deleted file mode 100644 index 5e9014a83a..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_En_Si/func_80AFB950.s +++ /dev/null @@ -1,41 +0,0 @@ -glabel func_80AFB950 -/* 002C0 80AFB950 27BDFFE0 */ addiu $sp, $sp, 0xFFE0 ## $sp = FFFFFFE0 -/* 002C4 80AFB954 AFBF0014 */ sw $ra, 0x0014($sp) -/* 002C8 80AFB958 AFA40020 */ sw $a0, 0x0020($sp) -/* 002CC 80AFB95C 8CAE1C44 */ lw $t6, 0x1C44($a1) ## 00001C44 -/* 002D0 80AFB960 24A420D8 */ addiu $a0, $a1, 0x20D8 ## $a0 = 000020D8 -/* 002D4 80AFB964 0C042F6F */ jal func_8010BDBC -/* 002D8 80AFB968 AFAE001C */ sw $t6, 0x001C($sp) -/* 002DC 80AFB96C 24010002 */ addiu $at, $zero, 0x0002 ## $at = 00000002 -/* 002E0 80AFB970 10410005 */ beq $v0, $at, .L80AFB988 -/* 002E4 80AFB974 8FA40020 */ lw $a0, 0x0020($sp) -/* 002E8 80AFB978 8FB8001C */ lw $t8, 0x001C($sp) -/* 002EC 80AFB97C 240F000A */ addiu $t7, $zero, 0x000A ## $t7 = 0000000A -/* 002F0 80AFB980 10000014 */ beq $zero, $zero, .L80AFB9D4 -/* 002F4 80AFB984 A70F0110 */ sh $t7, 0x0110($t8) ## 00000110 -.L80AFB988: -/* 002F8 80AFB988 8482001C */ lh $v0, 0x001C($a0) ## 0000001C -/* 002FC 80AFB98C 3C098016 */ lui $t1, %hi(gSaveContext) -/* 00300 80AFB990 3C0D8012 */ lui $t5, %hi(D_8012724C) -/* 00304 80AFB994 30431F00 */ andi $v1, $v0, 0x1F00 ## $v1 = 00000000 -/* 00308 80AFB998 00031A03 */ sra $v1, $v1, 8 -/* 0030C 80AFB99C 306B0003 */ andi $t3, $v1, 0x0003 ## $t3 = 00000000 -/* 00310 80AFB9A0 000B6080 */ sll $t4, $t3, 2 -/* 00314 80AFB9A4 0003C883 */ sra $t9, $v1, 2 -/* 00318 80AFB9A8 00194080 */ sll $t0, $t9, 2 -/* 0031C 80AFB9AC 01AC6821 */ addu $t5, $t5, $t4 -/* 00320 80AFB9B0 2529E660 */ addiu $t1, %lo(gSaveContext) -/* 00324 80AFB9B4 8DAD724C */ lw $t5, %lo(D_8012724C)($t5) -/* 00328 80AFB9B8 01092821 */ addu $a1, $t0, $t1 -/* 0032C 80AFB9BC 8CAF0E9C */ lw $t7, 0x0E9C($a1) ## 00000E9C -/* 00330 80AFB9C0 304A00FF */ andi $t2, $v0, 0x00FF ## $t2 = 00000000 -/* 00334 80AFB9C4 01AA7004 */ sllv $t6, $t2, $t5 -/* 00338 80AFB9C8 01EEC025 */ or $t8, $t7, $t6 ## $t8 = 0000000A -/* 0033C 80AFB9CC 0C00B55C */ jal Actor_Kill - -/* 00340 80AFB9D0 ACB80E9C */ sw $t8, 0x0E9C($a1) ## 00000E9C -.L80AFB9D4: -/* 00344 80AFB9D4 8FBF0014 */ lw $ra, 0x0014($sp) -/* 00348 80AFB9D8 27BD0020 */ addiu $sp, $sp, 0x0020 ## $sp = 00000000 -/* 0034C 80AFB9DC 03E00008 */ jr $ra -/* 00350 80AFB9E0 00000000 */ nop diff --git a/data/overlays/actors/z_en_si.data.s b/data/overlays/actors/z_en_si.data.s deleted file mode 100644 index d8db0a05cd..0000000000 --- a/data/overlays/actors/z_en_si.data.s +++ /dev/null @@ -1,23 +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 D_80AFBAB0 - .word 0x0A00093D, 0x10010000, 0x00000000, 0x00000000, 0x00000000, 0x00000090, 0x00000000, 0x00050100, 0x00140012, 0x00020000, 0x00000000 -glabel D_80AFBADC - .word 0x00000000, 0x00000000, 0xFF000000 -glabel En_Si_InitVars - .word 0x019C0700, 0x00000201, 0x00240000, 0x000001A0 -.word EnSi_Init -.word EnSi_Destroy -.word EnSi_Update -.word EnSi_Draw -.word 0x00000000, 0x00000000 - diff --git a/data/overlays/actors/z_en_si.reloc.s b/data/overlays/actors/z_en_si.reloc.s deleted file mode 100644 index dcf4893fac..0000000000 --- a/data/overlays/actors/z_en_si.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_80AFBB10 - .incbin "baserom/ovl_En_Si", 0x480, 0x00000070 diff --git a/include/variables.h b/include/variables.h index 534458b2fc..1bf3472459 100644 --- a/include/variables.h +++ b/include/variables.h @@ -461,6 +461,7 @@ extern u32 gUpgradeNegMasks[8]; extern u8 gEquipShifts[4]; extern u8 gUpgradeShifts[8]; extern u16 gUpgradeCapacities[8][4]; +extern u32 D_8012724C[4]; extern u32 gItemIcons[0x82]; extern u8 gItemSlots[56]; extern void (*gSceneCmdHandlers[26])(GlobalContext*, SceneCmd*); diff --git a/include/z64.h b/include/z64.h index 7040e145e9..6d7b1c4cc6 100644 --- a/include/z64.h +++ b/include/z64.h @@ -142,7 +142,7 @@ typedef struct { /* 0x0E88 */ s32 tempCollectFlags; } fw; /* 0x0E8C */ char unk_E8C[0x0010]; - /* 0x0E9C */ u8 gsFlags[24]; + /* 0x0E9C */ u32 gsFlags[6]; /* 0x0EB4 */ char unk_EB4[0x0010]; /* 0x0EC4 */ s32 unk_EC4; /* 0x0EC8 */ char unk_EC8[0x000C]; diff --git a/spec b/spec index 85ed62bad3..84b3170c8c 100644 --- a/spec +++ b/spec @@ -3174,8 +3174,7 @@ endseg beginseg name "ovl_En_Si" include "build/src/overlays/actors/ovl_En_Si/z_en_si.o" - include "build/data/overlays/actors/z_en_si.data.o" - include "build/data/overlays/actors/z_en_si.reloc.o" + include "build/src/overlays/actors/ovl_En_Si/ovl_En_Si_reloc.o" endseg beginseg diff --git a/src/overlays/actors/ovl_En_Si/z_en_si.c b/src/overlays/actors/ovl_En_Si/z_en_si.c index 1ce48b8ee6..0cb0a6a602 100644 --- a/src/overlays/actors/ovl_En_Si/z_en_si.c +++ b/src/overlays/actors/ovl_En_Si/z_en_si.c @@ -1,3 +1,9 @@ +/* + * File: z_en_si.c + * Overlay: En_Si + * Description: + */ + #include "z_en_si.h" #define FLAGS 0x00000201 @@ -8,12 +14,22 @@ void EnSi_Init(Actor* thisx, GlobalContext* globalCtx); void EnSi_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnSi_Update(Actor* thisx, GlobalContext* globalCtx); void EnSi_Draw(Actor* thisx, GlobalContext* globalCtx); + s32 func_80AFB748(EnSi* this, GlobalContext* globalCtx); void func_80AFB768(EnSi* this, GlobalContext* globalCtx); void func_80AFB89C(EnSi* this, GlobalContext* globalCtx); void func_80AFB950(EnSi* this, GlobalContext* globalCtx); -/* +static ColliderCylinderInit sCylinderInit = { + { COLTYPE_UNK10, 0x00, 0x09, 0x3D, 0x10, COLSHAPE_CYLINDER }, + { 0x00, { 0x00000000, 0x00, 0x00 }, { 0x00000090, 0x00, 0x00 }, 0x00, 0x05, 0x01 }, + { 20, 18, 2, { 0, 0, 0 } }, +}; + +static CollisionCheckInfoInit2 D_80AFBADC = { + 0x00, 0x0000, 0x0000, 0x0000, 0xFF, +}; + const ActorInit En_Si_InitVars = { ACTOR_EN_SI, ACTORTYPE_ITEMACTION, @@ -25,19 +41,108 @@ const ActorInit En_Si_InitVars = { (ActorFunc)EnSi_Update, (ActorFunc)EnSi_Draw, }; -*/ -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Si/EnSi_Init.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Si/EnSi_Destroy.s") +void EnSi_Init(Actor* thisx, GlobalContext* globalCtx) { + EnSi* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Si/func_80AFB748.s") + Collider_InitCylinder(globalCtx, &this->collider); + Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + func_80061EFC(&this->actor.colChkInfo, NULL, &D_80AFBADC); + Actor_SetScale(&this->actor, 0.025f); + this->unk_19C = 0; + this->actionFunc = func_80AFB768; + this->actor.shape.unk_08 = 42.0f; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Si/func_80AFB768.s") +void EnSi_Destroy(Actor* thisx, GlobalContext* globalCtx) { + EnSi* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Si/func_80AFB89C.s") + Collider_DestroyCylinder(globalCtx, &this->collider); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Si/func_80AFB950.s") +s32 func_80AFB748(EnSi* this, GlobalContext* globalCtx) { + if (this->collider.base.acFlags & 0x2) { + this->collider.base.acFlags &= ~0x2; + } + return 0; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Si/EnSi_Update.s") +void func_80AFB768(EnSi* this, GlobalContext* globalCtx) { + Player* player = PLAYER; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Si/EnSi_Draw.s") + if ((this->actor.flags & 0x2000) == 0x2000) { + this->actionFunc = func_80AFB89C; + } else { + Math_SmoothScaleMaxMinF(&this->actor.scale.x, 0.25f, 0.4f, 1.0f, 0.0f); + Actor_SetScale(&this->actor, this->actor.scale.x); + this->actor.shape.rot.y += 0x400; + + if (func_8008E988(globalCtx) == 0) { + func_80AFB748(this, globalCtx); + + if (this->collider.base.maskB & 0x1) { + this->collider.base.maskB &= ~0x1; + Item_Give(globalCtx, ITEM_SKULL_TOKEN); + player->actor.freeze = 10; + func_8010B680(globalCtx, 0xB4, 0); + func_800F5C64(0x39); + this->actionFunc = func_80AFB950; + } else { + Collider_CylinderUpdate(&this->actor, &this->collider); + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider); + } + } + } +} + +void func_80AFB89C(EnSi* this, GlobalContext* globalCtx) { + Player* player = PLAYER; + + Math_SmoothScaleMaxMinF(&this->actor.scale.x, 0.25f, 0.4f, 1.0f, 0.0f); + Actor_SetScale(&this->actor, this->actor.scale.x); + this->actor.shape.rot.y += 0x400; + + if ((this->actor.flags & 0x2000) != 0x2000) { + Item_Give(globalCtx, ITEM_SKULL_TOKEN); + player->actor.freeze = 10; + func_8010B680(globalCtx, 0xB4, 0); + func_800F5C64(0x39); + this->actionFunc = func_80AFB950; + } +} + +void func_80AFB950(EnSi* this, GlobalContext* globalCtx) { + Player* player = PLAYER; + s32 temp; + s16 params; + + if (func_8010BDBC(&globalCtx->msgCtx) != 2) { + player->actor.freeze = 10; + } else { + params = this->actor.params; + temp = (params & 0x1F00) >> 8; + gSaveContext.gsFlags[temp >> 2] |= (params & 0xFF) << D_8012724C[temp & 3]; + + Actor_Kill(&this->actor); + } +} + +void EnSi_Update(Actor* thisx, GlobalContext* globalCtx) { + EnSi* this = THIS; + + Actor_MoveForward(&this->actor); + func_8002E4B4(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + this->actionFunc(this, globalCtx); + Actor_SetHeight(&this->actor, 16.0f); +} + +void EnSi_Draw(Actor* thisx, GlobalContext* globalCtx) { + EnSi* this = THIS; + + if (this->actionFunc != func_80AFB950) { + func_8002ED80(&this->actor, globalCtx, 0); + func_8002EBCC(&this->actor, globalCtx, 0); + func_800694A0(globalCtx, 0x74); + } +} diff --git a/src/overlays/actors/ovl_En_Si/z_en_si.h b/src/overlays/actors/ovl_En_Si/z_en_si.h index 6116f26aa4..3273c906b8 100644 --- a/src/overlays/actors/ovl_En_Si/z_en_si.h +++ b/src/overlays/actors/ovl_En_Si/z_en_si.h @@ -11,7 +11,8 @@ typedef void (*EnSiActionFunc)(struct EnSi*, GlobalContext*); typedef struct EnSi { /* 0x0000 */ Actor actor; /* 0x014C */ EnSiActionFunc actionFunc; - /* 0x0150 */ char unk_150[0x50]; + /* 0x0150 */ ColliderCylinder collider; + /* 0x019C */ u8 unk_19C; } EnSi; // size = 0x01A0 extern const ActorInit En_Si_InitVars;