From 3062045acdd81a885a616739a9956222302a9248 Mon Sep 17 00:00:00 2001 From: Tom Overton Date: Fri, 11 Dec 2020 22:14:26 -0800 Subject: [PATCH] En_Stream (vortex) 7/8 matching, 1 equivalent (#512) * EnStream_Init OK * func_80B0B7A0 OK * EnStream_Destroy OK * EnStream_Update OK * Make func_80B0B7A0 take this instead of thisx like other SetupActions * func_80B0BAC8 OK * func_80B0B934 OK * func_80B0B81C not OK, but very close and I give up * EnStream_Draw OK * Delete unused ASM and do a little cleanup * Provide better names for functions * Make the file buildable when NONMATCHING is used * Flip comparisons in EnStream_SuckPlayer as per review * NONMATCHING -> NON_MATCHING * Remove & for function pointers * Type D_06000950 and remove the & in Draw * Remove unnecessary "struct" * Remove unnecessary forward declaration * Make func_80B0B81C take Vec3f*, not PosRot* * Use the generated reloc when NON_MATCHING * Move func_80B0B81C forward declare to the else block --- .../actors/ovl_En_Stream/EnStream_Destroy.s | 4 - .../actors/ovl_En_Stream/EnStream_Draw.s | 100 --------------- .../actors/ovl_En_Stream/EnStream_Init.s | 34 ----- .../actors/ovl_En_Stream/EnStream_Update.s | 14 --- .../actors/ovl_En_Stream/func_80B0B7A0.s | 3 - .../actors/ovl_En_Stream/func_80B0B934.s | 116 ----------------- .../actors/ovl_En_Stream/func_80B0BAC8.s | 22 ---- data/overlays/actors/z_en_stream.data.s | 20 --- spec | 5 +- .../actors/ovl_En_Stream/z_en_stream.c | 119 ++++++++++++++++-- .../actors/ovl_En_Stream/z_en_stream.h | 6 +- 11 files changed, 118 insertions(+), 325 deletions(-) delete mode 100644 asm/non_matchings/overlays/actors/ovl_En_Stream/EnStream_Destroy.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_En_Stream/EnStream_Draw.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_En_Stream/EnStream_Init.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_En_Stream/EnStream_Update.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_En_Stream/func_80B0B7A0.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_En_Stream/func_80B0B934.s delete mode 100644 asm/non_matchings/overlays/actors/ovl_En_Stream/func_80B0BAC8.s delete mode 100644 data/overlays/actors/z_en_stream.data.s diff --git a/asm/non_matchings/overlays/actors/ovl_En_Stream/EnStream_Destroy.s b/asm/non_matchings/overlays/actors/ovl_En_Stream/EnStream_Destroy.s deleted file mode 100644 index 4c70e47747..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_En_Stream/EnStream_Destroy.s +++ /dev/null @@ -1,4 +0,0 @@ -glabel EnStream_Destroy -/* 00070 80B0B810 AFA40000 */ sw $a0, 0x0000($sp) -/* 00074 80B0B814 03E00008 */ jr $ra -/* 00078 80B0B818 AFA50004 */ sw $a1, 0x0004($sp) diff --git a/asm/non_matchings/overlays/actors/ovl_En_Stream/EnStream_Draw.s b/asm/non_matchings/overlays/actors/ovl_En_Stream/EnStream_Draw.s deleted file mode 100644 index 73676ac0a2..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_En_Stream/EnStream_Draw.s +++ /dev/null @@ -1,100 +0,0 @@ -.rdata -glabel D_80B0BCD0 - .asciz "../z_en_stream.c" - .balign 4 - -glabel D_80B0BCE4 - .asciz "../z_en_stream.c" - .balign 4 - -glabel D_80B0BCF8 - .asciz "../z_en_stream.c" - .balign 4 - -.text -glabel EnStream_Draw -/* 003AC 80B0BB4C 27BDFF90 */ addiu $sp, $sp, 0xFF90 ## $sp = FFFFFF90 -/* 003B0 80B0BB50 3C0E0001 */ lui $t6, 0x0001 ## $t6 = 00010000 -/* 003B4 80B0BB54 AFBF003C */ sw $ra, 0x003C($sp) -/* 003B8 80B0BB58 AFB10038 */ sw $s1, 0x0038($sp) -/* 003BC 80B0BB5C AFB00034 */ sw $s0, 0x0034($sp) -/* 003C0 80B0BB60 AFA40070 */ sw $a0, 0x0070($sp) -/* 003C4 80B0BB64 01C57021 */ addu $t6, $t6, $a1 -/* 003C8 80B0BB68 8DCE1DE4 */ lw $t6, 0x1DE4($t6) ## 00011DE4 -/* 003CC 80B0BB6C 00A08825 */ or $s1, $a1, $zero ## $s1 = 00000000 -/* 003D0 80B0BB70 3C0680B1 */ lui $a2, %hi(D_80B0BCD0) ## $a2 = 80B10000 -/* 003D4 80B0BB74 AFAE0068 */ sw $t6, 0x0068($sp) -/* 003D8 80B0BB78 8CA50000 */ lw $a1, 0x0000($a1) ## 00000000 -/* 003DC 80B0BB7C 24C6BCD0 */ addiu $a2, $a2, %lo(D_80B0BCD0) ## $a2 = 80B0BCD0 -/* 003E0 80B0BB80 27A40054 */ addiu $a0, $sp, 0x0054 ## $a0 = FFFFFFE4 -/* 003E4 80B0BB84 24070127 */ addiu $a3, $zero, 0x0127 ## $a3 = 00000127 -/* 003E8 80B0BB88 0C031AB1 */ jal Graph_OpenDisps -/* 003EC 80B0BB8C 00A08025 */ or $s0, $a1, $zero ## $s0 = 00000000 -/* 003F0 80B0BB90 0C024F61 */ jal func_80093D84 -/* 003F4 80B0BB94 8E240000 */ lw $a0, 0x0000($s1) ## 00000000 -/* 003F8 80B0BB98 8E0202D0 */ lw $v0, 0x02D0($s0) ## 000002D0 -/* 003FC 80B0BB9C 3C18DA38 */ lui $t8, 0xDA38 ## $t8 = DA380000 -/* 00400 80B0BBA0 37180003 */ ori $t8, $t8, 0x0003 ## $t8 = DA380003 -/* 00404 80B0BBA4 244F0008 */ addiu $t7, $v0, 0x0008 ## $t7 = 00000008 -/* 00408 80B0BBA8 AE0F02D0 */ sw $t7, 0x02D0($s0) ## 000002D0 -/* 0040C 80B0BBAC AC580000 */ sw $t8, 0x0000($v0) ## 00000000 -/* 00410 80B0BBB0 8E240000 */ lw $a0, 0x0000($s1) ## 00000000 -/* 00414 80B0BBB4 3C0580B1 */ lui $a1, %hi(D_80B0BCE4) ## $a1 = 80B10000 -/* 00418 80B0BBB8 24A5BCE4 */ addiu $a1, $a1, %lo(D_80B0BCE4) ## $a1 = 80B0BCE4 -/* 0041C 80B0BBBC 2406012B */ addiu $a2, $zero, 0x012B ## $a2 = 0000012B -/* 00420 80B0BBC0 0C0346A2 */ jal Matrix_NewMtx -/* 00424 80B0BBC4 AFA20050 */ sw $v0, 0x0050($sp) -/* 00428 80B0BBC8 8FA30050 */ lw $v1, 0x0050($sp) -/* 0042C 80B0BBCC 3C0ADB06 */ lui $t2, 0xDB06 ## $t2 = DB060000 -/* 00430 80B0BBD0 354A0020 */ ori $t2, $t2, 0x0020 ## $t2 = DB060020 -/* 00434 80B0BBD4 AC620004 */ sw $v0, 0x0004($v1) ## 00000004 -/* 00438 80B0BBD8 8E0202D0 */ lw $v0, 0x02D0($s0) ## 000002D0 -/* 0043C 80B0BBDC 8FA90068 */ lw $t1, 0x0068($sp) -/* 00440 80B0BBE0 240B0040 */ addiu $t3, $zero, 0x0040 ## $t3 = 00000040 -/* 00444 80B0BBE4 24590008 */ addiu $t9, $v0, 0x0008 ## $t9 = 00000008 -/* 00448 80B0BBE8 AE1902D0 */ sw $t9, 0x02D0($s0) ## 000002D0 -/* 0044C 80B0BBEC AC4A0000 */ sw $t2, 0x0000($v0) ## 00000000 -/* 00450 80B0BBF0 8E240000 */ lw $a0, 0x0000($s1) ## 00000000 -/* 00454 80B0BBF4 00091880 */ sll $v1, $t1, 2 -/* 00458 80B0BBF8 00691821 */ addu $v1, $v1, $t1 -/* 0045C 80B0BBFC 00031880 */ sll $v1, $v1, 2 -/* 00460 80B0BC00 00093100 */ sll $a2, $t1, 4 -/* 00464 80B0BC04 00033823 */ subu $a3, $zero, $v1 -/* 00468 80B0BC08 240C0040 */ addiu $t4, $zero, 0x0040 ## $t4 = 00000040 -/* 0046C 80B0BC0C 240D0001 */ addiu $t5, $zero, 0x0001 ## $t5 = 00000001 -/* 00470 80B0BC10 240E0040 */ addiu $t6, $zero, 0x0040 ## $t6 = 00000040 -/* 00474 80B0BC14 240F0040 */ addiu $t7, $zero, 0x0040 ## $t7 = 00000040 -/* 00478 80B0BC18 00C93023 */ subu $a2, $a2, $t1 -/* 0047C 80B0BC1C 00063040 */ sll $a2, $a2, 1 -/* 00480 80B0BC20 AFAF0028 */ sw $t7, 0x0028($sp) -/* 00484 80B0BC24 AFAE0024 */ sw $t6, 0x0024($sp) -/* 00488 80B0BC28 AFAD0018 */ sw $t5, 0x0018($sp) -/* 0048C 80B0BC2C AFAC0014 */ sw $t4, 0x0014($sp) -/* 00490 80B0BC30 AFA70020 */ sw $a3, 0x0020($sp) -/* 00494 80B0BC34 AFA3001C */ sw $v1, 0x001C($sp) -/* 00498 80B0BC38 AFAB0010 */ sw $t3, 0x0010($sp) -/* 0049C 80B0BC3C 00002825 */ or $a1, $zero, $zero ## $a1 = 00000000 -/* 004A0 80B0BC40 0C0253D0 */ jal Gfx_TwoTexScroll -/* 004A4 80B0BC44 AFA2004C */ sw $v0, 0x004C($sp) -/* 004A8 80B0BC48 8FA8004C */ lw $t0, 0x004C($sp) -/* 004AC 80B0BC4C 3C0A0600 */ lui $t2, 0x0600 ## $t2 = 06000000 -/* 004B0 80B0BC50 254A0950 */ addiu $t2, $t2, 0x0950 ## $t2 = 06000950 -/* 004B4 80B0BC54 AD020004 */ sw $v0, 0x0004($t0) ## 00000004 -/* 004B8 80B0BC58 8E0202D0 */ lw $v0, 0x02D0($s0) ## 000002D0 -/* 004BC 80B0BC5C 3C19DE00 */ lui $t9, 0xDE00 ## $t9 = DE000000 -/* 004C0 80B0BC60 3C0680B1 */ lui $a2, %hi(D_80B0BCF8) ## $a2 = 80B10000 -/* 004C4 80B0BC64 24580008 */ addiu $t8, $v0, 0x0008 ## $t8 = 00000008 -/* 004C8 80B0BC68 AE1802D0 */ sw $t8, 0x02D0($s0) ## 000002D0 -/* 004CC 80B0BC6C AC4A0004 */ sw $t2, 0x0004($v0) ## 00000004 -/* 004D0 80B0BC70 AC590000 */ sw $t9, 0x0000($v0) ## 00000000 -/* 004D4 80B0BC74 8E250000 */ lw $a1, 0x0000($s1) ## 00000000 -/* 004D8 80B0BC78 24C6BCF8 */ addiu $a2, $a2, %lo(D_80B0BCF8) ## $a2 = 80B0BCF8 -/* 004DC 80B0BC7C 27A40054 */ addiu $a0, $sp, 0x0054 ## $a0 = FFFFFFE4 -/* 004E0 80B0BC80 0C031AD5 */ jal Graph_CloseDisps -/* 004E4 80B0BC84 24070136 */ addiu $a3, $zero, 0x0136 ## $a3 = 00000136 -/* 004E8 80B0BC88 8FBF003C */ lw $ra, 0x003C($sp) -/* 004EC 80B0BC8C 8FB00034 */ lw $s0, 0x0034($sp) -/* 004F0 80B0BC90 8FB10038 */ lw $s1, 0x0038($sp) -/* 004F4 80B0BC94 03E00008 */ jr $ra -/* 004F8 80B0BC98 27BD0070 */ addiu $sp, $sp, 0x0070 ## $sp = 00000000 -/* 004FC 80B0BC9C 00000000 */ nop diff --git a/asm/non_matchings/overlays/actors/ovl_En_Stream/EnStream_Init.s b/asm/non_matchings/overlays/actors/ovl_En_Stream/EnStream_Init.s deleted file mode 100644 index 0578eccc47..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_En_Stream/EnStream_Init.s +++ /dev/null @@ -1,34 +0,0 @@ -.late_rodata -glabel D_80B0BD0C - .float 0.01 - -.text -glabel EnStream_Init -/* 00008 80B0B7A8 27BDFFE8 */ addiu $sp, $sp, 0xFFE8 ## $sp = FFFFFFE8 -/* 0000C 80B0B7AC AFBF0014 */ sw $ra, 0x0014($sp) -/* 00010 80B0B7B0 AFA5001C */ sw $a1, 0x001C($sp) -/* 00014 80B0B7B4 848E001C */ lh $t6, 0x001C($a0) ## 0000001C -/* 00018 80B0B7B8 3C0580B1 */ lui $a1, %hi(D_80B0BCC0) ## $a1 = 80B10000 -/* 0001C 80B0B7BC 24A5BCC0 */ addiu $a1, $a1, %lo(D_80B0BCC0) ## $a1 = 80B0BCC0 -/* 00020 80B0B7C0 31CF00FF */ andi $t7, $t6, 0x00FF ## $t7 = 00000000 -/* 00024 80B0B7C4 AC8F0150 */ sw $t7, 0x0150($a0) ## 00000150 -/* 00028 80B0B7C8 0C01E037 */ jal Actor_ProcessInitChain - -/* 0002C 80B0B7CC AFA40018 */ sw $a0, 0x0018($sp) -/* 00030 80B0B7D0 8FA40018 */ lw $a0, 0x0018($sp) -/* 00034 80B0B7D4 24010001 */ addiu $at, $zero, 0x0001 ## $at = 00000001 -/* 00038 80B0B7D8 3C0580B1 */ lui $a1, %hi(func_80B0BAC8) ## $a1 = 80B10000 -/* 0003C 80B0B7DC 8C820150 */ lw $v0, 0x0150($a0) ## 00000150 -/* 00040 80B0B7E0 10400005 */ beq $v0, $zero, .L80B0B7F8 -/* 00044 80B0B7E4 00000000 */ nop -/* 00048 80B0B7E8 14410003 */ bne $v0, $at, .L80B0B7F8 -/* 0004C 80B0B7EC 3C0180B1 */ lui $at, %hi(D_80B0BD0C) ## $at = 80B10000 -/* 00050 80B0B7F0 C424BD0C */ lwc1 $f4, %lo(D_80B0BD0C)($at) -/* 00054 80B0B7F4 E4840054 */ swc1 $f4, 0x0054($a0) ## 00000054 -.L80B0B7F8: -/* 00058 80B0B7F8 0C2C2DE8 */ jal func_80B0B7A0 -/* 0005C 80B0B7FC 24A5BAC8 */ addiu $a1, $a1, %lo(func_80B0BAC8) ## $a1 = 80B0BAC8 -/* 00060 80B0B800 8FBF0014 */ lw $ra, 0x0014($sp) -/* 00064 80B0B804 27BD0018 */ addiu $sp, $sp, 0x0018 ## $sp = 00000000 -/* 00068 80B0B808 03E00008 */ jr $ra -/* 0006C 80B0B80C 00000000 */ nop diff --git a/asm/non_matchings/overlays/actors/ovl_En_Stream/EnStream_Update.s b/asm/non_matchings/overlays/actors/ovl_En_Stream/EnStream_Update.s deleted file mode 100644 index 7d2e09cb6c..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_En_Stream/EnStream_Update.s +++ /dev/null @@ -1,14 +0,0 @@ -glabel EnStream_Update -/* 00378 80B0BB18 27BDFFE8 */ addiu $sp, $sp, 0xFFE8 ## $sp = FFFFFFE8 -/* 0037C 80B0BB1C AFBF0014 */ sw $ra, 0x0014($sp) -/* 00380 80B0BB20 AFA40018 */ sw $a0, 0x0018($sp) -/* 00384 80B0BB24 8C99014C */ lw $t9, 0x014C($a0) ## 0000014C -/* 00388 80B0BB28 0320F809 */ jalr $ra, $t9 -/* 0038C 80B0BB2C 00000000 */ nop -/* 00390 80B0BB30 8FA40018 */ lw $a0, 0x0018($sp) -/* 00394 80B0BB34 0C00BE52 */ jal func_8002F948 -/* 00398 80B0BB38 240520DD */ addiu $a1, $zero, 0x20DD ## $a1 = 000020DD -/* 0039C 80B0BB3C 8FBF0014 */ lw $ra, 0x0014($sp) -/* 003A0 80B0BB40 27BD0018 */ addiu $sp, $sp, 0x0018 ## $sp = 00000000 -/* 003A4 80B0BB44 03E00008 */ jr $ra -/* 003A8 80B0BB48 00000000 */ nop diff --git a/asm/non_matchings/overlays/actors/ovl_En_Stream/func_80B0B7A0.s b/asm/non_matchings/overlays/actors/ovl_En_Stream/func_80B0B7A0.s deleted file mode 100644 index b3ae8989cd..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_En_Stream/func_80B0B7A0.s +++ /dev/null @@ -1,3 +0,0 @@ -glabel func_80B0B7A0 -/* 00000 80B0B7A0 03E00008 */ jr $ra -/* 00004 80B0B7A4 AC85014C */ sw $a1, 0x014C($a0) ## 0000014C diff --git a/asm/non_matchings/overlays/actors/ovl_En_Stream/func_80B0B934.s b/asm/non_matchings/overlays/actors/ovl_En_Stream/func_80B0B934.s deleted file mode 100644 index c39fd83556..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_En_Stream/func_80B0B934.s +++ /dev/null @@ -1,116 +0,0 @@ -.late_rodata -glabel D_80B0BD10 - .float 10430.378 - -.text -glabel func_80B0B934 -/* 00194 80B0B934 27BDFFB0 */ addiu $sp, $sp, 0xFFB0 ## $sp = FFFFFFB0 -/* 00198 80B0B938 AFBF0024 */ sw $ra, 0x0024($sp) -/* 0019C 80B0B93C AFB10020 */ sw $s1, 0x0020($sp) -/* 001A0 80B0B940 AFB0001C */ sw $s0, 0x001C($sp) -/* 001A4 80B0B944 AFA50054 */ sw $a1, 0x0054($sp) -/* 001A8 80B0B948 8CB01C44 */ lw $s0, 0x1C44($a1) ## 00001C44 -/* 001AC 80B0B94C 00808825 */ or $s1, $a0, $zero ## $s1 = 00000000 -/* 001B0 80B0B950 8E270054 */ lw $a3, 0x0054($s1) ## 00000054 -/* 001B4 80B0B954 26050024 */ addiu $a1, $s0, 0x0024 ## $a1 = 00000024 -/* 001B8 80B0B958 AFA50028 */ sw $a1, 0x0028($sp) -/* 001BC 80B0B95C 24840024 */ addiu $a0, $a0, 0x0024 ## $a0 = 00000024 -/* 001C0 80B0B960 0C2C2E07 */ jal func_80B0B81C -/* 001C4 80B0B964 27A6003C */ addiu $a2, $sp, 0x003C ## $a2 = FFFFFFEC -/* 001C8 80B0B968 1040004F */ beq $v0, $zero, .L80B0BAA8 -/* 001CC 80B0B96C 02202025 */ or $a0, $s1, $zero ## $a0 = 00000000 -/* 001D0 80B0B970 C7A4003C */ lwc1 $f4, 0x003C($sp) -/* 001D4 80B0B974 C7A80044 */ lwc1 $f8, 0x0044($sp) -/* 001D8 80B0B978 3C0142B4 */ lui $at, 0x42B4 ## $at = 42B40000 -/* 001DC 80B0B97C 46042182 */ mul.s $f6, $f4, $f4 -/* 001E0 80B0B980 44819000 */ mtc1 $at, $f18 ## $f18 = 90.00 -/* 001E4 80B0B984 C6300028 */ lwc1 $f16, 0x0028($s1) ## 00000028 -/* 001E8 80B0B988 46084282 */ mul.s $f10, $f8, $f8 -/* 001EC 80B0B98C 46002307 */ neg.s $f12, $f4 -/* 001F0 80B0B990 46004387 */ neg.s $f14, $f8 -/* 001F4 80B0B994 460A3000 */ add.s $f0, $f6, $f10 -/* 001F8 80B0B998 C60A0028 */ lwc1 $f10, 0x0028($s0) ## 00000028 -/* 001FC 80B0B99C 46128181 */ sub.s $f6, $f16, $f18 -/* 00200 80B0B9A0 46000084 */ sqrt.s $f2, $f0 -/* 00204 80B0B9A4 46065401 */ sub.s $f16, $f10, $f6 -/* 00208 80B0B9A8 E7A20038 */ swc1 $f2, 0x0038($sp) -/* 0020C 80B0B9AC 0C03F494 */ jal Math_atan2f -/* 00210 80B0B9B0 E7B00034 */ swc1 $f16, 0x0034($sp) -/* 00214 80B0B9B4 3C014040 */ lui $at, 0x4040 ## $at = 40400000 -/* 00218 80B0B9B8 44816000 */ mtc1 $at, $f12 ## $f12 = 3.00 -/* 0021C 80B0B9BC 3C0180B1 */ lui $at, %hi(D_80B0BD10) ## $at = 80B10000 -/* 00220 80B0B9C0 C432BD10 */ lwc1 $f18, %lo(D_80B0BD10)($at) -/* 00224 80B0B9C4 C7A20038 */ lwc1 $f2, 0x0038($sp) -/* 00228 80B0B9C8 260408AC */ addiu $a0, $s0, 0x08AC ## $a0 = 000008AC -/* 0022C 80B0B9CC 46120282 */ mul.s $f10, $f0, $f18 -/* 00230 80B0B9D0 4602603C */ c.lt.s $f12, $f2 -/* 00234 80B0B9D4 3C063F00 */ lui $a2, 0x3F00 ## $a2 = 3F000000 -/* 00238 80B0B9D8 4600518D */ trunc.w.s $f6, $f10 -/* 0023C 80B0B9DC 44183000 */ mfc1 $t8, $f6 -/* 00240 80B0B9E0 45000008 */ bc1f .L80B0BA04 -/* 00244 80B0B9E4 A61808B0 */ sh $t8, 0x08B0($s0) ## 000008B0 -/* 00248 80B0B9E8 44808000 */ mtc1 $zero, $f16 ## $f16 = 0.00 -/* 0024C 80B0B9EC 44056000 */ mfc1 $a1, $f12 -/* 00250 80B0B9F0 44071000 */ mfc1 $a3, $f2 -/* 00254 80B0B9F4 0C01E0C4 */ jal Math_SmoothScaleMaxMinF - -/* 00258 80B0B9F8 E7B00010 */ swc1 $f16, 0x0010($sp) -/* 0025C 80B0B9FC 10000013 */ beq $zero, $zero, .L80B0BA4C -/* 00260 80B0BA00 44800000 */ mtc1 $zero, $f0 ## $f0 = 0.00 -.L80B0BA04: -/* 00264 80B0BA04 44800000 */ mtc1 $zero, $f0 ## $f0 = 0.00 -/* 00268 80B0BA08 44076000 */ mfc1 $a3, $f12 -/* 0026C 80B0BA0C 3C063F00 */ lui $a2, 0x3F00 ## $a2 = 3F000000 -/* 00270 80B0BA10 E60008AC */ swc1 $f0, 0x08AC($s0) ## 000008AC -/* 00274 80B0BA14 8E250024 */ lw $a1, 0x0024($s1) ## 00000024 -/* 00278 80B0BA18 8FA40028 */ lw $a0, 0x0028($sp) -/* 0027C 80B0BA1C 0C01E0C4 */ jal Math_SmoothScaleMaxMinF - -/* 00280 80B0BA20 E7A00010 */ swc1 $f0, 0x0010($sp) -/* 00284 80B0BA24 3C014040 */ lui $at, 0x4040 ## $at = 40400000 -/* 00288 80B0BA28 44816000 */ mtc1 $at, $f12 ## $f12 = 3.00 -/* 0028C 80B0BA2C 44802000 */ mtc1 $zero, $f4 ## $f4 = 0.00 -/* 00290 80B0BA30 8E25002C */ lw $a1, 0x002C($s1) ## 0000002C -/* 00294 80B0BA34 44076000 */ mfc1 $a3, $f12 -/* 00298 80B0BA38 2604002C */ addiu $a0, $s0, 0x002C ## $a0 = 0000002C -/* 0029C 80B0BA3C 3C063F00 */ lui $a2, 0x3F00 ## $a2 = 3F000000 -/* 002A0 80B0BA40 0C01E0C4 */ jal Math_SmoothScaleMaxMinF - -/* 002A4 80B0BA44 E7A40010 */ swc1 $f4, 0x0010($sp) -/* 002A8 80B0BA48 44800000 */ mtc1 $zero, $f0 ## $f0 = 0.00 -.L80B0BA4C: -/* 002AC 80B0BA4C C7A20034 */ lwc1 $f2, 0x0034($sp) -/* 002B0 80B0BA50 3C063F33 */ lui $a2, 0x3F33 ## $a2 = 3F330000 -/* 002B4 80B0BA54 34C63333 */ ori $a2, $a2, 0x3333 ## $a2 = 3F333333 -/* 002B8 80B0BA58 4602003C */ c.lt.s $f0, $f2 -/* 002BC 80B0BA5C 26040060 */ addiu $a0, $s0, 0x0060 ## $a0 = 00000060 -/* 002C0 80B0BA60 3C05C040 */ lui $a1, 0xC040 ## $a1 = C0400000 -/* 002C4 80B0BA64 45020014 */ bc1fl .L80B0BAB8 -/* 002C8 80B0BA68 8FBF0024 */ lw $ra, 0x0024($sp) -/* 002CC 80B0BA6C 44071000 */ mfc1 $a3, $f2 -/* 002D0 80B0BA70 0C01E0C4 */ jal Math_SmoothScaleMaxMinF - -/* 002D4 80B0BA74 E7A00010 */ swc1 $f0, 0x0010($sp) -/* 002D8 80B0BA78 3C01C28C */ lui $at, 0xC28C ## $at = C28C0000 -/* 002DC 80B0BA7C 44819000 */ mtc1 $at, $f18 ## $f18 = -70.00 -/* 002E0 80B0BA80 C7A80040 */ lwc1 $f8, 0x0040($sp) -/* 002E4 80B0BA84 4612403C */ c.lt.s $f8, $f18 -/* 002E8 80B0BA88 00000000 */ nop -/* 002EC 80B0BA8C 4502000A */ bc1fl .L80B0BAB8 -/* 002F0 80B0BA90 8FBF0024 */ lw $ra, 0x0024($sp) -/* 002F4 80B0BA94 8E190680 */ lw $t9, 0x0680($s0) ## 00000680 -/* 002F8 80B0BA98 3C018000 */ lui $at, 0x8000 ## $at = 80000000 -/* 002FC 80B0BA9C 03214025 */ or $t0, $t9, $at ## $t0 = 80000000 -/* 00300 80B0BAA0 10000004 */ beq $zero, $zero, .L80B0BAB4 -/* 00304 80B0BAA4 AE080680 */ sw $t0, 0x0680($s0) ## 00000680 -.L80B0BAA8: -/* 00308 80B0BAA8 3C0580B1 */ lui $a1, %hi(func_80B0BAC8) ## $a1 = 80B10000 -/* 0030C 80B0BAAC 0C2C2DE8 */ jal func_80B0B7A0 -/* 00310 80B0BAB0 24A5BAC8 */ addiu $a1, $a1, %lo(func_80B0BAC8) ## $a1 = 80B0BAC8 -.L80B0BAB4: -/* 00314 80B0BAB4 8FBF0024 */ lw $ra, 0x0024($sp) -.L80B0BAB8: -/* 00318 80B0BAB8 8FB0001C */ lw $s0, 0x001C($sp) -/* 0031C 80B0BABC 8FB10020 */ lw $s1, 0x0020($sp) -/* 00320 80B0BAC0 03E00008 */ jr $ra -/* 00324 80B0BAC4 27BD0050 */ addiu $sp, $sp, 0x0050 ## $sp = 00000000 diff --git a/asm/non_matchings/overlays/actors/ovl_En_Stream/func_80B0BAC8.s b/asm/non_matchings/overlays/actors/ovl_En_Stream/func_80B0BAC8.s deleted file mode 100644 index 4d363cf710..0000000000 --- a/asm/non_matchings/overlays/actors/ovl_En_Stream/func_80B0BAC8.s +++ /dev/null @@ -1,22 +0,0 @@ -glabel func_80B0BAC8 -/* 00328 80B0BAC8 27BDFFD0 */ addiu $sp, $sp, 0xFFD0 ## $sp = FFFFFFD0 -/* 0032C 80B0BACC AFBF0014 */ sw $ra, 0x0014($sp) -/* 00330 80B0BAD0 AFA40030 */ sw $a0, 0x0030($sp) -/* 00334 80B0BAD4 AFA50034 */ sw $a1, 0x0034($sp) -/* 00338 80B0BAD8 8CA21C44 */ lw $v0, 0x1C44($a1) ## 00001C44 -/* 0033C 80B0BADC 00807825 */ or $t7, $a0, $zero ## $t7 = 00000000 -/* 00340 80B0BAE0 8DE70054 */ lw $a3, 0x0054($t7) ## 00000054 -/* 00344 80B0BAE4 24840024 */ addiu $a0, $a0, 0x0024 ## $a0 = 00000024 -/* 00348 80B0BAE8 27A6001C */ addiu $a2, $sp, 0x001C ## $a2 = FFFFFFEC -/* 0034C 80B0BAEC 0C2C2E07 */ jal func_80B0B81C -/* 00350 80B0BAF0 24450024 */ addiu $a1, $v0, 0x0024 ## $a1 = 00000024 -/* 00354 80B0BAF4 10400004 */ beq $v0, $zero, .L80B0BB08 -/* 00358 80B0BAF8 8FA40030 */ lw $a0, 0x0030($sp) -/* 0035C 80B0BAFC 3C0580B1 */ lui $a1, %hi(func_80B0B934) ## $a1 = 80B10000 -/* 00360 80B0BB00 0C2C2DE8 */ jal func_80B0B7A0 -/* 00364 80B0BB04 24A5B934 */ addiu $a1, $a1, %lo(func_80B0B934) ## $a1 = 80B0B934 -.L80B0BB08: -/* 00368 80B0BB08 8FBF0014 */ lw $ra, 0x0014($sp) -/* 0036C 80B0BB0C 27BD0030 */ addiu $sp, $sp, 0x0030 ## $sp = 00000000 -/* 00370 80B0BB10 03E00008 */ jr $ra -/* 00374 80B0BB14 00000000 */ nop diff --git a/data/overlays/actors/z_en_stream.data.s b/data/overlays/actors/z_en_stream.data.s deleted file mode 100644 index 0f8efa42a9..0000000000 --- a/data/overlays/actors/z_en_stream.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 En_Stream_InitVars - .word 0x01600100, 0x00000010, 0x013B0000, 0x00000158 -.word EnStream_Init -.word EnStream_Destroy -.word EnStream_Update -.word EnStream_Draw -glabel D_80B0BCC0 - .word 0x48500014, 0x00000000, 0x00000000, 0x00000000 - diff --git a/spec b/spec index e1b4a088ac..9b2dd4cc37 100644 --- a/spec +++ b/spec @@ -3007,8 +3007,11 @@ endseg beginseg name "ovl_En_Stream" include "build/src/overlays/actors/ovl_En_Stream/z_en_stream.o" - include "build/data/overlays/actors/z_en_stream.data.o" +#ifdef NON_MATCHING + include "build/src/overlays/actors/ovl_En_Stream/ovl_En_Stream_reloc.o" +#else include "build/data/overlays/actors/z_en_stream.reloc.o" +#endif endseg beginseg diff --git a/src/overlays/actors/ovl_En_Stream/z_en_stream.c b/src/overlays/actors/ovl_En_Stream/z_en_stream.c index 3cb20a752f..aaa33dc93b 100644 --- a/src/overlays/actors/ovl_En_Stream/z_en_stream.c +++ b/src/overlays/actors/ovl_En_Stream/z_en_stream.c @@ -14,10 +14,10 @@ void EnStream_Init(Actor* thisx, GlobalContext* globalCtx); void EnStream_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnStream_Update(Actor* thisx, GlobalContext* globalCtx); void EnStream_Draw(Actor* thisx, GlobalContext* globalCtx); +void EnStream_WaitForPlayer(EnStream* this, GlobalContext* globalCtx); -extern UNK_TYPE D_06000950; +extern Gfx D_06000950[]; -/* const ActorInit En_Stream_InitVars = { ACTOR_EN_STREAM, ACTORTYPE_BG, @@ -29,19 +29,118 @@ const ActorInit En_Stream_InitVars = { (ActorFunc)EnStream_Update, (ActorFunc)EnStream_Draw, }; -*/ -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Stream/func_80B0B7A0.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Stream/EnStream_Init.s") +static InitChainEntry sInitChain[] = { + ICHAIN_VEC3F_DIV1000(scale, 20, ICHAIN_STOP), +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Stream/EnStream_Destroy.s") +void EnStream_SetupAction(EnStream* this, EnStreamActionFunc actionFunc) { + this->actionFunc = actionFunc; +} +void EnStream_Init(Actor* thisx, GlobalContext* globalCtx) { + EnStream* this = THIS; + + this->unk_150 = thisx->params & 0xFF; + Actor_ProcessInitChain(thisx, sInitChain); + if ((this->unk_150 != 0) && (this->unk_150 == 1)) { + thisx->scale.y = 0.01f; + } + EnStream_SetupAction(this, EnStream_WaitForPlayer); +} + +void EnStream_Destroy(Actor* thisx, GlobalContext* globalCtx) { +} + +#ifdef NON_MATCHING +// regalloc differences, checks if the player is range of the vortex +s32 func_80B0B81C(Vec3f* vortexPosRot, Vec3f* playerPosRot, Vec3f* posDifference, f32 vortexYScale) { + s32 ret = 0; + f32 smallConstant = 28; + f32 lowerBounds = 0 * vortexYScale * 50; + f32 upperBounds = 160 * vortexYScale * 50; + f32 xzDist; + + posDifference->x = playerPosRot->x - vortexPosRot->x; + posDifference->y = playerPosRot->y - vortexPosRot->y; + posDifference->z = playerPosRot->z - vortexPosRot->z; + xzDist = sqrtf(SQ(posDifference->x) + SQ(posDifference->z)); + if (lowerBounds <= posDifference->y && posDifference->y <= upperBounds) { + posDifference->y = posDifference->y - lowerBounds; + if (xzDist <= (((75 - smallConstant) * (posDifference->y / (upperBounds - lowerBounds))) + 28)) { + ret = 1; + } + } + if ((posDifference->y <= lowerBounds) && (xzDist <= 28)) { + ret = 2; + } + return ret; +} +#else +s32 func_80B0B81C(Vec3f* vortexPos, Vec3f* playerPos, Vec3f* posDifference, f32 vortexYScale); #pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Stream/func_80B0B81C.s") +#endif -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Stream/func_80B0B934.s") +void EnStream_SuckPlayer(EnStream* this, GlobalContext* globalCtx) { + Player* player = PLAYER; + s32 pad48; + Vec3f posDifference; + f32 xzDist; + f32 yDistWithOffset; + s32 pad30; + s32 pad2C; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Stream/func_80B0BAC8.s") + if (func_80B0B81C(&this->actor.posRot.pos, &player->actor.posRot.pos, &posDifference, this->actor.scale.y) != 0) { + xzDist = sqrtf(SQ(posDifference.x) + SQ(posDifference.z)); + yDistWithOffset = player->actor.posRot.pos.y - (this->actor.posRot.pos.y - 90.0f); + player->windDirection = Math_atan2f(-posDifference.x, -posDifference.z) * 10430.378f; + if (xzDist > 3.0f) { + Math_SmoothScaleMaxMinF(&player->windSpeed, 3.0f, 0.5f, xzDist, 0.0f); + } else { + player->windSpeed = 0.0f; + Math_SmoothScaleMaxMinF(&player->actor.posRot.pos.x, this->actor.posRot.pos.x, 0.5f, 3.0f, 0.0f); + Math_SmoothScaleMaxMinF(&player->actor.posRot.pos.z, this->actor.posRot.pos.z, 0.5f, 3.0f, 0.0f); + } + if (yDistWithOffset > 0.0f) { + Math_SmoothScaleMaxMinF(&player->actor.velocity.y, -3.0f, 0.7f, yDistWithOffset, 0.0f); + if (posDifference.y < -70.0f) { + player->stateFlags2 |= 0x80000000; + } + } + } else { + EnStream_SetupAction(this, EnStream_WaitForPlayer); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Stream/EnStream_Update.s") +void EnStream_WaitForPlayer(EnStream* this, GlobalContext* globalCtx) { + Player* player = PLAYER; + s16 pad; + Vec3f temp; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Stream/EnStream_Draw.s") + if (func_80B0B81C(&this->actor.posRot.pos, &player->actor.posRot.pos, &temp, this->actor.scale.y) != 0) { + EnStream_SetupAction(this, EnStream_SuckPlayer); + } +} + +void EnStream_Update(Actor* thisx, GlobalContext* globalCtx) { + EnStream* this = THIS; + + this->actionFunc(this, globalCtx); + func_8002F948(thisx, NA_SE_EV_WHIRLPOOL - SFX_FLAG); +} + +void EnStream_Draw(Actor* thisx, GlobalContext* globalCtx) { + u32 multipliedFrames; + u32 frames = globalCtx->gameplayFrames; + + OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_stream.c", 295); + func_80093D84(globalCtx->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_stream.c", 299), + G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + multipliedFrames = frames * 20; + gSPSegment(POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, frames * 30, -multipliedFrames, 0x40, 0x40, 1, + multipliedFrames, -multipliedFrames, 0x40, 0x40)); + gSPDisplayList(POLY_XLU_DISP++, D_06000950); + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_stream.c", 310); +} diff --git a/src/overlays/actors/ovl_En_Stream/z_en_stream.h b/src/overlays/actors/ovl_En_Stream/z_en_stream.h index 33faea46a0..652e1f4a55 100644 --- a/src/overlays/actors/ovl_En_Stream/z_en_stream.h +++ b/src/overlays/actors/ovl_En_Stream/z_en_stream.h @@ -6,9 +6,13 @@ struct EnStream; +typedef void (*EnStreamActionFunc)(struct EnStream*, GlobalContext*); + typedef struct EnStream { /* 0x0000 */ Actor actor; - /* 0x014C */ char unk_14C[0xC]; + /* 0x014C */ EnStreamActionFunc actionFunc; + /* 0x0150 */ s32 unk_150; + /* 0x0154 */ char unk_154[0x4]; } EnStream; // size = 0x0158 extern const ActorInit En_Stream_InitVars;