diff --git a/asm/non_matchings/racing/math_util/func_802B4F60.s b/asm/non_matchings/racing/math_util/func_802B4F60.s deleted file mode 100644 index 737f6a13a..000000000 --- a/asm/non_matchings/racing/math_util/func_802B4F60.s +++ /dev/null @@ -1,39 +0,0 @@ -glabel func_802B4F60 -/* 11E570 802B4F60 27BDFF90 */ addiu $sp, $sp, -0x70 -/* 11E574 802B4F64 AFBF0014 */ sw $ra, 0x14($sp) -/* 11E578 802B4F68 AFA40070 */ sw $a0, 0x70($sp) -/* 11E57C 802B4F6C AFA60078 */ sw $a2, 0x78($sp) -/* 11E580 802B4F70 AFA7007C */ sw $a3, 0x7c($sp) -/* 11E584 802B4F74 0C0AD4B6 */ jal vec3f_copy_return -/* 11E588 802B4F78 27A4001C */ addiu $a0, $sp, 0x1c -/* 11E58C 802B4F7C C7AC001C */ lwc1 $f12, 0x1c($sp) -/* 11E590 802B4F80 C7A4003C */ lwc1 $f4, 0x3c($sp) -/* 11E594 802B4F84 C7AE0020 */ lwc1 $f14, 0x20($sp) -/* 11E598 802B4F88 C7A8004C */ lwc1 $f8, 0x4c($sp) -/* 11E59C 802B4F8C 460C2182 */ mul.s $f6, $f4, $f12 -/* 11E5A0 802B4F90 C7A40024 */ lwc1 $f4, 0x24($sp) -/* 11E5A4 802B4F94 C7B2005C */ lwc1 $f18, 0x5c($sp) -/* 11E5A8 802B4F98 460E4282 */ mul.s $f10, $f8, $f14 -/* 11E5AC 802B4F9C 27A4001C */ addiu $a0, $sp, 0x1c -/* 11E5B0 802B4FA0 27A50030 */ addiu $a1, $sp, 0x30 -/* 11E5B4 802B4FA4 46049202 */ mul.s $f8, $f18, $f4 -/* 11E5B8 802B4FA8 460A3400 */ add.s $f16, $f6, $f10 -/* 11E5BC 802B4FAC C7AA006C */ lwc1 $f10, 0x6c($sp) -/* 11E5C0 802B4FB0 46088180 */ add.s $f6, $f16, $f8 -/* 11E5C4 802B4FB4 46065080 */ add.s $f2, $f10, $f6 -/* 11E5C8 802B4FB8 0C0AD90D */ jal mtxf_translate_vec3f_mat4 -/* 11E5CC 802B4FBC E7A2002C */ swc1 $f2, 0x2c($sp) -/* 11E5D0 802B4FC0 C7A2002C */ lwc1 $f2, 0x2c($sp) -/* 11E5D4 802B4FC4 44809000 */ mtc1 $zero, $f18 -/* 11E5D8 802B4FC8 8FBF0014 */ lw $ra, 0x14($sp) -/* 11E5DC 802B4FCC 24020001 */ li $v0, 1 -/* 11E5E0 802B4FD0 4612103E */ c.le.s $f2, $f18 -/* 11E5E4 802B4FD4 00000000 */ nop -/* 11E5E8 802B4FD8 45000003 */ bc1f .L802B4FE8 -/* 11E5EC 802B4FDC 00000000 */ nop -/* 11E5F0 802B4FE0 10000001 */ b .L802B4FE8 -/* 11E5F4 802B4FE4 00001025 */ move $v0, $zero -.L802B4FE8: -/* 11E5F8 802B4FE8 03E00008 */ jr $ra -/* 11E5FC 802B4FEC 27BD0070 */ addiu $sp, $sp, 0x70 - diff --git a/src/racing/math_util.c b/src/racing/math_util.c index 003cac143..f17a52617 100644 --- a/src/racing/math_util.c +++ b/src/racing/math_util.c @@ -14,27 +14,29 @@ s32 D_802B91C0[2] = { 13, 13 }; Vec3f D_802B91C8 = { 0.0f, 0.0f, 0.0f }; - -#ifdef NON_MATCHING -// Nearly matches +// This functions looks similar to a segment of code from func_802A4A0C in skybox_and_splitscreen.c UNUSED s32 func_802B4F60(UNUSED s32 arg0, Vec3f arg1, UNUSED s32 arg2, UNUSED f32 arg3, UNUSED f32 arg4) { Mat4 sp30; f32 sp2C; - UNUSED f32 a; + f32 sp28; Vec3f sp1C; vec3f_copy_return(sp1C, arg1); - sp2C = sp30[3][3] + (((sp1C[0] * sp30[0][3]) + (sp1C[1] * sp30[1][3])) + (sp30[2][3] * sp1C[2])); + sp28 = sp1C[0]; + sp2C = sp1C[1]; + // wut? + if (sp2C && sp2C); + sp2C = ((sp30[0][3] * sp28) + (sp30[1][3] * sp2C) + (sp30[2][3] * sp1C[2])) + sp30[3][3]; + // double wut? + if (sp28 && sp28); mtxf_translate_vec3f_mat4(sp1C, sp30); - if (sp2C >= 0.0f) + if (0.0f >= sp2C) { return 0; + } else { + return 1; } - return 1; } -#else -GLOBAL_ASM("asm/non_matchings/racing/math_util/func_802B4F60.s") -#endif UNUSED void func_802B4FF0() { @@ -371,8 +373,8 @@ void mtxf_s16_rotate_z(Mat4 mat, s16 angle) { } #ifdef MIPS_TO_C -//generated by m2c commit 8267401fa4ef7a38942dcca43353cc1bcc6efabc -UNUSED void func_802B5B14(Vec3f arg0, Vec3s arg1) { +//generated by m2c commit beb457dabfc7a01ec6540a5404a6a05097a13602 on Oct-29-2023 +void func_802B5B14(f32 *arg0, s16 *arg1) { f32 sp70; f32 sp6C; f32 sp68; @@ -1197,5 +1199,54 @@ UNUSED void func_802B8414(uintptr_t arg0, Mat4 arg1, s16 arg2, s16 arg3, s32 arg } } -// unused +#ifdef MIPS_TO_C +//generated by m2c commit beb457dabfc7a01ec6540a5404a6a05097a13602 on Oct-29-2023 +void func_802B8614(Player *arg0) { + f64 sp78; + f64 sp70; + f64 sp68; + f64 sp58; + f64 sp50; + f64 sp48; + f64 sp40; + f64 sp38; + f64 temp_f12; + f64 temp_f14; + f64 temp_f16; + f64 temp_f18; + f64 temp_f20; + f64 temp_f2; + f64 temp_f30; + f64 temp_f4; + f64 temp_f6; + + temp_f6 = (f64) arg0->boundingBoxCorners[1].cornerPos[0]; + sp78 = temp_f6; + sp70 = (f64) arg0->boundingBoxCorners[1].cornerGroundY; + sp68 = (f64) arg0->boundingBoxCorners[1].cornerPos[2]; + temp_f30 = (f64) arg0->boundingBoxCorners[0].cornerPos[0]; + sp58 = (f64) arg0->boundingBoxCorners[0].cornerGroundY; + sp50 = (f64) arg0->boundingBoxCorners[0].cornerPos[2]; + sp48 = (f64) arg0->boundingBoxCorners[3].cornerPos[0]; + sp40 = (f64) arg0->boundingBoxCorners[3].cornerGroundY; + temp_f4 = (f64) arg0->boundingBoxCorners[3].cornerPos[2]; + temp_f2 = sp58 - sp70; + sp38 = temp_f4; + temp_f12 = temp_f4 - sp50; + temp_f14 = sp50 - sp68; + temp_f16 = sp40 - sp58; + temp_f18 = sp48 - temp_f30; + temp_f20 = temp_f30 - temp_f6; + if (0.0 == 0.0) { + arg0->unk_058 = 0.0f; + arg0->unk_060 = 0.0f; + arg0->unk_05C = 1.0f; + return; + } + arg0->unk_058 = (f32) ((f64) (f32) ((temp_f2 * temp_f12) - (temp_f14 * temp_f16)) / 0.0); + arg0->unk_05C = (f32) ((f64) (f32) ((temp_f14 * temp_f18) - (temp_f20 * temp_f12)) / 0.0); + arg0->unk_060 = (f32) ((f64) (f32) ((temp_f20 * temp_f16) - (temp_f2 * temp_f18)) / 0.0); +} +#else GLOBAL_ASM("asm/non_matchings/racing/math_util/func_802B8614.s") +#endif diff --git a/src/racing/math_util.h b/src/racing/math_util.h index 38b20ebe0..87dd2cd40 100644 --- a/src/racing/math_util.h +++ b/src/racing/math_util.h @@ -16,6 +16,7 @@ // Here to appease the pragma gods double fabs(double x); +s32 func_802B4F60(s32, Vec3f, s32, f32, f32); s32 render_set_position(Mat4, s32); f32 func_802B51E8(Vec3f, Vec3f); u32 get_angle_between_points(Vec3f, Vec3f);