From 06b731c494b44e71422231872750acc35445392c Mon Sep 17 00:00:00 2001 From: JoshDuMan <40190173+JoshDuMan@users.noreply.github.com> Date: Wed, 22 Apr 2020 12:18:53 -0400 Subject: [PATCH] Match sys_math.c and one in z_scene_table.c (#90) * Match func_800CA63C * Remove func_800CA63C.s * Match func_8009BEEC? * Remove func_8009BEEC.s --- .../code/sys_math/func_800CA63C.s | 53 -------- .../code/z_scene_table/func_8009BEEC.s | 124 ------------------ src/code/sys_math.c | 6 +- src/code/z_scene_table.c | 6 - 4 files changed, 1 insertion(+), 188 deletions(-) delete mode 100644 asm/non_matchings/code/sys_math/func_800CA63C.s delete mode 100644 asm/non_matchings/code/z_scene_table/func_8009BEEC.s diff --git a/asm/non_matchings/code/sys_math/func_800CA63C.s b/asm/non_matchings/code/sys_math/func_800CA63C.s deleted file mode 100644 index 8b13b39af7..0000000000 --- a/asm/non_matchings/code/sys_math/func_800CA63C.s +++ /dev/null @@ -1,53 +0,0 @@ -glabel func_800CA63C -/* B417DC 800CA63C 2C81000D */ sltiu $at, $a0, 0xd -/* B417E0 800CA640 14200029 */ bnez $at, .L800CA6E8 -/* B417E4 800CA644 00044880 */ sll $t1, $a0, 2 -/* B417E8 800CA648 3C018013 */ lui $at, %hi(sFactorialTbl) -/* B417EC 800CA64C C422D300 */ lwc1 $f2, %lo(sFactorialTbl + 0x30)($at) -/* B417F0 800CA650 2881000D */ slti $at, $a0, 0xd -/* B417F4 800CA654 14200027 */ bnez $at, .L800CA6F4 -/* B417F8 800CA658 2402000D */ li $v0, 13 -/* B417FC 800CA65C 2485FFF4 */ addiu $a1, $a0, -0xc -/* B41800 800CA660 30A50003 */ andi $a1, $a1, 3 -/* B41804 800CA664 10A0000A */ beqz $a1, .L800CA690 -/* B41808 800CA668 24A3000D */ addiu $v1, $a1, 0xd -/* B4180C 800CA66C 44822000 */ mtc1 $v0, $f4 -.L800CA670: -/* B41810 800CA670 24420001 */ addiu $v0, $v0, 1 -/* B41814 800CA674 468021A0 */ cvt.s.w $f6, $f4 -/* B41818 800CA678 46061082 */ mul.s $f2, $f2, $f6 -/* B4181C 800CA67C 5462FFFC */ bnel $v1, $v0, .L800CA670 -/* B41820 800CA680 44822000 */ mtc1 $v0, $f4 -/* B41824 800CA684 248E0001 */ addiu $t6, $a0, 1 -/* B41828 800CA688 11C2001A */ beq $t6, $v0, .L800CA6F4 -/* B4182C 800CA68C 00000000 */ nop -.L800CA690: -/* B41830 800CA690 44824000 */ mtc1 $v0, $f8 -/* B41834 800CA694 244F0001 */ addiu $t7, $v0, 1 -/* B41838 800CA698 448F8000 */ mtc1 $t7, $f16 -/* B4183C 800CA69C 468042A0 */ cvt.s.w $f10, $f8 -/* B41840 800CA6A0 24580002 */ addiu $t8, $v0, 2 -/* B41844 800CA6A4 44982000 */ mtc1 $t8, $f4 -/* B41848 800CA6A8 24590003 */ addiu $t9, $v0, 3 -/* B4184C 800CA6AC 44994000 */ mtc1 $t9, $f8 -/* B41850 800CA6B0 468084A0 */ cvt.s.w $f18, $f16 -/* B41854 800CA6B4 460A1082 */ mul.s $f2, $f2, $f10 -/* B41858 800CA6B8 24420004 */ addiu $v0, $v0, 4 -/* B4185C 800CA6BC 24880001 */ addiu $t0, $a0, 1 -/* B41860 800CA6C0 468021A0 */ cvt.s.w $f6, $f4 -/* B41864 800CA6C4 46121082 */ mul.s $f2, $f2, $f18 -/* B41868 800CA6C8 468042A0 */ cvt.s.w $f10, $f8 -/* B4186C 800CA6CC 46061082 */ mul.s $f2, $f2, $f6 -/* B41870 800CA6D0 00000000 */ nop -/* B41874 800CA6D4 460A1082 */ mul.s $f2, $f2, $f10 -/* B41878 800CA6D8 1502FFED */ bne $t0, $v0, .L800CA690 -/* B4187C 800CA6DC 00000000 */ nop -/* B41880 800CA6E0 03E00008 */ jr $ra -/* B41884 800CA6E4 46001006 */ mov.s $f0, $f2 -.L800CA6E8: -/* B41888 800CA6E8 3C018013 */ lui $at, %hi(sFactorialTbl) -/* B4188C 800CA6EC 00290821 */ addu $at, $at, $t1 -/* B41890 800CA6F0 C422D2D0 */ lwc1 $f2, %lo(sFactorialTbl)($at) -.L800CA6F4: -/* B41894 800CA6F4 03E00008 */ jr $ra -/* B41898 800CA6F8 46001006 */ mov.s $f0, $f2 diff --git a/asm/non_matchings/code/z_scene_table/func_8009BEEC.s b/asm/non_matchings/code/z_scene_table/func_8009BEEC.s deleted file mode 100644 index e3a4107e28..0000000000 --- a/asm/non_matchings/code/z_scene_table/func_8009BEEC.s +++ /dev/null @@ -1,124 +0,0 @@ -.late_rodata -glabel D_8013FF18 - .float 0.6 - -glabel D_8013FF1C - .float 3000.0 - -.text -glabel func_8009BEEC -/* B1308C 8009BEEC 27BDFFC8 */ addiu $sp, $sp, -0x38 -/* B13090 8009BEF0 3C010001 */ lui $at, 1 -/* B13094 8009BEF4 AFBF0024 */ sw $ra, 0x24($sp) -/* B13098 8009BEF8 AFB10020 */ sw $s1, 0x20($sp) -/* B1309C 8009BEFC AFB0001C */ sw $s0, 0x1c($sp) -/* B130A0 8009BF00 00811021 */ addu $v0, $a0, $at -/* B130A4 8009BF04 8C431DE4 */ lw $v1, 0x1de4($v0) -/* B130A8 8009BF08 2401000D */ li $at, 13 -/* B130AC 8009BF0C 00808825 */ move $s1, $a0 -/* B130B0 8009BF10 306E007F */ andi $t6, $v1, 0x7f -/* B130B4 8009BF14 55C1001C */ bnel $t6, $at, .L8009BF88 -/* B130B8 8009BF18 3069003F */ andi $t1, $v1, 0x3f -/* B130BC 8009BF1C 848F07A0 */ lh $t7, 0x7a0($a0) -/* B130C0 8009BF20 24050002 */ li $a1, 2 -/* B130C4 8009BF24 000FC080 */ sll $t8, $t7, 2 -/* B130C8 8009BF28 0098C821 */ addu $t9, $a0, $t8 -/* B130CC 8009BF2C 8F240790 */ lw $a0, 0x790($t9) -/* B130D0 8009BF30 0C024BE2 */ jal Quake_Add -/* B130D4 8009BF34 AFA2002C */ sw $v0, 0x2c($sp) -/* B130D8 8009BF38 00022400 */ sll $a0, $v0, 0x10 -/* B130DC 8009BF3C AFA20034 */ sw $v0, 0x34($sp) -/* B130E0 8009BF40 00042403 */ sra $a0, $a0, 0x10 -/* B130E4 8009BF44 0C024B6B */ jal Quake_SetSpeed -/* B130E8 8009BF48 24052710 */ li $a1, 10000 -/* B130EC 8009BF4C 87B00036 */ lh $s0, 0x36($sp) -/* B130F0 8009BF50 24050004 */ li $a1, 4 -/* B130F4 8009BF54 00003025 */ move $a2, $zero -/* B130F8 8009BF58 00102400 */ sll $a0, $s0, 0x10 -/* B130FC 8009BF5C 00042403 */ sra $a0, $a0, 0x10 -/* B13100 8009BF60 00003825 */ move $a3, $zero -/* B13104 8009BF64 0C024B9C */ jal Quake_SetQuakeValues -/* B13108 8009BF68 AFA00010 */ sw $zero, 0x10($sp) -/* B1310C 8009BF6C 00102400 */ sll $a0, $s0, 0x10 -/* B13110 8009BF70 00042403 */ sra $a0, $a0, 0x10 -/* B13114 8009BF74 0C024B7C */ jal Quake_SetCountdown -/* B13118 8009BF78 2405007F */ li $a1, 127 -/* B1311C 8009BF7C 8FA8002C */ lw $t0, 0x2c($sp) -/* B13120 8009BF80 8D031DE4 */ lw $v1, 0x1de4($t0) -/* B13124 8009BF84 3069003F */ andi $t1, $v1, 0x3f -.L8009BF88: -/* B13128 8009BF88 55200044 */ bnezl $t1, .L8009C09C -/* B1312C 8009BF8C 8FBF0024 */ lw $ra, 0x24($sp) -/* B13130 8009BF90 0C03F66B */ jal Math_Rand_ZeroOne -/* B13134 8009BF94 00000000 */ nop -/* B13138 8009BF98 3C018014 */ lui $at, %hi(D_8013FF18) -/* B1313C 8009BF9C C424FF18 */ lwc1 $f4, %lo(D_8013FF18)($at) -/* B13140 8009BFA0 4600203C */ c.lt.s $f4, $f0 -/* B13144 8009BFA4 00000000 */ nop -/* B13148 8009BFA8 4502003C */ bc1fl .L8009C09C -/* B1314C 8009BFAC 8FBF0024 */ lw $ra, 0x24($sp) -/* B13150 8009BFB0 862A07A0 */ lh $t2, 0x7a0($s1) -/* B13154 8009BFB4 24050003 */ li $a1, 3 -/* B13158 8009BFB8 000A5880 */ sll $t3, $t2, 2 -/* B1315C 8009BFBC 022B6021 */ addu $t4, $s1, $t3 -/* B13160 8009BFC0 0C024BE2 */ jal Quake_Add -/* B13164 8009BFC4 8D840790 */ lw $a0, 0x790($t4) -/* B13168 8009BFC8 0C03F66B */ jal Math_Rand_ZeroOne -/* B1316C 8009BFCC AFA20034 */ sw $v0, 0x34($sp) -/* B13170 8009BFD0 3C018014 */ lui $at, %hi(D_8013FF1C) -/* B13174 8009BFD4 C426FF1C */ lwc1 $f6, %lo(D_8013FF1C)($at) -/* B13178 8009BFD8 3C0146FA */ li $at, 0x46FA0000 # 0.000000 -/* B1317C 8009BFDC 44815000 */ mtc1 $at, $f10 -/* B13180 8009BFE0 46060202 */ mul.s $f8, $f0, $f6 -/* B13184 8009BFE4 87B00036 */ lh $s0, 0x36($sp) -/* B13188 8009BFE8 00102400 */ sll $a0, $s0, 0x10 -/* B1318C 8009BFEC 00042403 */ sra $a0, $a0, 0x10 -/* B13190 8009BFF0 460A4400 */ add.s $f16, $f8, $f10 -/* B13194 8009BFF4 4600848D */ trunc.w.s $f18, $f16 -/* B13198 8009BFF8 44059000 */ mfc1 $a1, $f18 -/* B1319C 8009BFFC 00000000 */ nop -/* B131A0 8009C000 00052C00 */ sll $a1, $a1, 0x10 -/* B131A4 8009C004 0C024B6B */ jal Quake_SetSpeed -/* B131A8 8009C008 00052C03 */ sra $a1, $a1, 0x10 -/* B131AC 8009C00C 0C03F66B */ jal Math_Rand_ZeroOne -/* B131B0 8009C010 00000000 */ nop -/* B131B4 8009C014 3C014120 */ li $at, 0x41200000 # 0.000000 -/* B131B8 8009C018 44812000 */ mtc1 $at, $f4 -/* B131BC 8009C01C 3C014110 */ li $at, 0x41100000 # 0.000000 -/* B131C0 8009C020 44813000 */ mtc1 $at, $f6 -/* B131C4 8009C024 00102400 */ sll $a0, $s0, 0x10 -/* B131C8 8009C028 00042403 */ sra $a0, $a0, 0x10 -/* B131CC 8009C02C 46060202 */ mul.s $f8, $f0, $f6 -/* B131D0 8009C030 00003025 */ move $a2, $zero -/* B131D4 8009C034 00003825 */ move $a3, $zero -/* B131D8 8009C038 AFA00010 */ sw $zero, 0x10($sp) -/* B131DC 8009C03C 46082281 */ sub.s $f10, $f4, $f8 -/* B131E0 8009C040 4600540D */ trunc.w.s $f16, $f10 -/* B131E4 8009C044 44058000 */ mfc1 $a1, $f16 -/* B131E8 8009C048 00000000 */ nop -/* B131EC 8009C04C 00052C00 */ sll $a1, $a1, 0x10 -/* B131F0 8009C050 0C024B9C */ jal Quake_SetQuakeValues -/* B131F4 8009C054 00052C03 */ sra $a1, $a1, 0x10 -/* B131F8 8009C058 0C03F66B */ jal Math_Rand_ZeroOne -/* B131FC 8009C05C 00000000 */ nop -/* B13200 8009C060 3C014240 */ li $at, 0x42400000 # 0.000000 -/* B13204 8009C064 44819000 */ mtc1 $at, $f18 -/* B13208 8009C068 3C014170 */ li $at, 0x41700000 # 0.000000 -/* B1320C 8009C06C 44813000 */ mtc1 $at, $f6 -/* B13210 8009C070 00102400 */ sll $a0, $s0, 0x10 -/* B13214 8009C074 00042403 */ sra $a0, $a0, 0x10 -/* B13218 8009C078 46060102 */ mul.s $f4, $f0, $f6 -/* B1321C 8009C07C 46049201 */ sub.s $f8, $f18, $f4 -/* B13220 8009C080 4600428D */ trunc.w.s $f10, $f8 -/* B13224 8009C084 44055000 */ mfc1 $a1, $f10 -/* B13228 8009C088 00000000 */ nop -/* B1322C 8009C08C 00052C00 */ sll $a1, $a1, 0x10 -/* B13230 8009C090 0C024B7C */ jal Quake_SetCountdown -/* B13234 8009C094 00052C03 */ sra $a1, $a1, 0x10 -/* B13238 8009C098 8FBF0024 */ lw $ra, 0x24($sp) -.L8009C09C: -/* B1323C 8009C09C 8FB0001C */ lw $s0, 0x1c($sp) -/* B13240 8009C0A0 8FB10020 */ lw $s1, 0x20($sp) -/* B13244 8009C0A4 03E00008 */ jr $ra -/* B13248 8009C0A8 27BD0038 */ addiu $sp, $sp, 0x38 - diff --git a/src/code/sys_math.c b/src/code/sys_math.c index 25af276ec2..994f664752 100644 --- a/src/code/sys_math.c +++ b/src/code/sys_math.c @@ -12,13 +12,12 @@ f32 func_800CA540(f32 arg0) { return ret; } -#ifdef NON_MATCHING f32 func_800CA63C(u32 arg0) { f32 ret; s32 i; if (arg0 > 12) { ret = sFactorialTbl[12]; - for (i = 13; i < (s32)arg0; i++) { + for (i = 13; i <= (s32)arg0; i++) { ret *= i; } } else { @@ -26,9 +25,6 @@ f32 func_800CA63C(u32 arg0) { } return ret; } -#else -#pragma GLOBAL_ASM("asm/non_matchings/code/sys_math/func_800CA63C.s") -#endif f32 func_800CA6FC(f32 arg0, s32 arg1) { f32 ret = 1.0f; diff --git a/src/code/z_scene_table.c b/src/code/z_scene_table.c index 381c167a0c..d0e1d88754 100644 --- a/src/code/z_scene_table.c +++ b/src/code/z_scene_table.c @@ -1495,8 +1495,6 @@ void func_8009BC44(GlobalContext* globalCtx) { } // Screen Shake for Ganon's Tower Collapse -#ifdef NON_MATCHING -// regalloc differences void func_8009BEEC(GlobalContext* globalCtx) { s32 var; @@ -1514,10 +1512,6 @@ void func_8009BEEC(GlobalContext* globalCtx) { Quake_SetCountdown(var, 48.0f - (Math_Rand_ZeroOne() * 15.0f)); } } -#else -void func_8009BEEC(GlobalContext* globalCtx); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_scene_table/func_8009BEEC.s") -#endif // Scene Draw Config 38 void func_8009C0AC(GlobalContext* globalCtx) {