diff options
| author | MegaMech <MegaMech@users.noreply.github.com> | 2025-06-15 22:17:24 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-15 22:17:24 -0600 |
| commit | 9fe391a2a4617cdb6ce3b2ab743183756f2ca9bd (patch) | |
| tree | ef05cdebfde9874e3a4fd890b391d37232786d4b /src/engine/Matrix.cpp | |
| parent | 547d651cc470503867a4e2e060536ca768dbb1ec (diff) | |
Fix More Interpolation (#220)
* Fix SetTextMatrix Interpolation (flashing text)
* Interpolate pause menu item box
* Interp mtxf_translation_x_y_rotate_z_scale_x_y
* Fix billboarding for freecam
* Fix menus battle mode back to grand prix bug
* Fix snow interp
* interp star clouds
Diffstat (limited to 'src/engine/Matrix.cpp')
| -rw-r--r-- | src/engine/Matrix.cpp | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/engine/Matrix.cpp b/src/engine/Matrix.cpp index 671489413..b55a9b89f 100644 --- a/src/engine/Matrix.cpp +++ b/src/engine/Matrix.cpp @@ -35,8 +35,8 @@ void AddMatrixFixed(std::vector<Mtx>& stack, s32 flags) { } // Used in func_80095BD0 -Mtx* SetTextMatrix(f32 arg1, f32 arg2, f32 arg3, f32 arg4) { - Mat4 mf; +void SetTextMatrix(Mat4 mf, f32 x, f32 y, f32 arg3, f32 arg4) { + FrameInterpolation_Record_SetTextMatrix((Mat4*)&mf, x, y, arg3, arg4); mf[0][0] = arg3; mf[0][1] = 0.0f; mf[0][2] = 0.0f; @@ -49,15 +49,25 @@ Mtx* SetTextMatrix(f32 arg1, f32 arg2, f32 arg3, f32 arg4) { mf[2][1] = 0.0f; mf[2][2] = 1.0f; mf[2][3] = 0.0f; - mf[3][0] = arg1; - mf[3][1] = arg2; + mf[3][0] = x; + mf[3][1] = y; mf[3][2] = 0.0f; mf[3][3] = 1.0f; - Mtx* mtx = GetMatrix(gWorldInstance.Mtx.Effects); - FrameInterpolation_RecordMatrixMtxFToMtx((MtxF*)mf, mtx); - guMtxF2L(mf, mtx); +} + +// AddMatrix but with custom gfx ptr arg and flags are predefined +Gfx* AddTextMatrix(Gfx* displayListHead, Mat4 mtx) { + // Push a new matrix to the stack + gWorldInstance.Mtx.Effects.emplace_back(); + + // Convert to a fixed-point matrix + FrameInterpolation_RecordMatrixMtxFToMtx((MtxF*)mtx, &gWorldInstance.Mtx.Effects.back()); + guMtxF2L(mtx, &gWorldInstance.Mtx.Effects.back()); + + // Load the matrix + gSPMatrix(displayListHead++, &gWorldInstance.Mtx.Effects.back(), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - return mtx; + return displayListHead; } void ApplyMatrixTransformations(Mat4 mtx, FVector pos, IRotator rot, FVector scale) { |
