From 8049dec3393c4ade687dbdfd84d3ccde73168ab0 Mon Sep 17 00:00:00 2001 From: EllipticEllipsis Date: Thu, 26 May 2022 04:24:39 +0100 Subject: `sys_matrix` OK, documented, rename some other mathematics functions (#787) * Import data and bss, add some name options * Decomp rest of stack functions, remove RSPMatrix, split header * sys_matrix OK (thanks Tharo) Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com> * pragma weaks in sinf and cosf, change documentation change mcros to use 0x8000 * Rename sinf and cosf * Correct initialisation of sMtxFClear * More minor cleanup * Rename stack functions * Matrix_InsertMatrix -> Matrix_Mult * The big transpose rename * Fix MirRay_DrawReflectedBeam * Matrix_InsertTranslation -> Matrix_Translate * Matrix_Insert.Rotation_s -> Matrix_Rotate$1S + RotateY -> RotateYS * Matrix_Insert(.)Rotation_f -> Matrix_Rotate$1F * Matrix_RotateStateAroundXAxis -> Matrix_RotateXFApply Matrix_SetStateXRotation -> Matrix_RotateXFNew * Matrix_MultiplyVector3fByState -> Matrix_MultVec3f * Matrix_MultiplyVector3fXZByCurrentState -> Matrix_MultVec3fXZ * Matrix_GetStateTranslation -> Matrix_MultZero * Matrix_GetStateTranslationAndScaled(.) -> Matrix_MultVec$1 * Matrix_FromRSPMatrix -> Matrix_MtxToMtxF * Matrix_MultiplyVector3fByMatrix -> Matrix_MultVec3fExt * Matrix_TransposeXYZ -> Matrix_Transpose * Matrix_ToRSPMatrix -> Matrix_MtxFToMtx * Matrix_AppendToPolyOpaDisp -> Matrix_MtxFToNewMtx and document the conversion functions * Matrix_NormalizeXYZ -> Matrix_ReplaceRotation * Matrix_InsertRotationAroundUnitVector_f -> Matrix_RotateAxisF and S * Matrix_InsertRotation -> Matrix_RotateZYX * Document the last functions * Small cleanup * Matrix_JointPosition -> Matrix_TranslateRotateZYX * Matrix_SetStateRotationAndTranslation -> Matrix_SetTranslateRotateYXZ * func_8018219C -> Matrix_MtxFToYXZRot * func_801822C4 -> Matrix_MtxFToZYXRot * Fix files * Format * Review 1 * Renames * Fix warning in EnDragon * Format * Convert `mode` to an actual enum * Add enums, typedefs, externs to sys_matrix header * Review * One more * More review * Fix function names * Format * Fix names * Format * Review * engineer's review * Fix build * Format * Fix again Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com> --- src/boot_O2/boot_80086760.c | 4 ++-- src/boot_O2/mtxuty-cvt.c | 13 +++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'src/boot_O2') diff --git a/src/boot_O2/boot_80086760.c b/src/boot_O2/boot_80086760.c index 3c75bcd3f..398a1e41a 100644 --- a/src/boot_O2/boot_80086760.c +++ b/src/boot_O2/boot_80086760.c @@ -14,11 +14,11 @@ extern f32 func_80086D18(f32 x); s32 gUseAtanContFrac; /** - * Tangent function computed using libultra __sinf and __cosf + * Tangent function computed using libultra sinf and cosf */ // Math_FTanF f32 func_80086760(f32 x) { - return __sinf(x) / __cosf(x); + return sinf(x) / cosf(x); } // Unused diff --git a/src/boot_O2/mtxuty-cvt.c b/src/boot_O2/mtxuty-cvt.c index 221dbf554..2c1634392 100644 --- a/src/boot_O2/mtxuty-cvt.c +++ b/src/boot_O2/mtxuty-cvt.c @@ -1,18 +1,19 @@ #include "global.h" -void MtxConv_F2L(MatrixInternal* m1, MtxF* m2) { +void MtxConv_F2L(Mtx* mtx, MtxF* mf) { s32 i; s32 j; for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) { - s32 value = (m2->mf[i][j] * 0x10000); - m1->intPart[i][j] = value >> 16; - m1->fracPart[i][j] = value; + s32 value = (mf->mf[i][j] * 0x10000); + + mtx->intPart[i][j] = value >> 16; + mtx->fracPart[i][j] = value; } } } -void MtxConv_L2F(MtxF* m1, MatrixInternal* m2) { - guMtxL2F(m1, (Mtx*)m2); +void MtxConv_L2F(MtxF* mtx, Mtx* mf) { + guMtxL2F(mtx, mf); } -- cgit v1.2.3