summaryrefslogtreecommitdiff
path: root/src/port/interpolation/FrameInterpolation.cpp
diff options
context:
space:
mode:
authorcoco875 <59367621+coco875@users.noreply.github.com>2025-12-23 14:27:27 +0100
committerGitHub <noreply@github.com>2025-12-23 14:27:27 +0100
commitb0582b5c32914a815fe6a2ffc41f3eb9c24a3a2b (patch)
treece9cb3dd7ff839e640deba061e9c21f588ecb4e4 /src/port/interpolation/FrameInterpolation.cpp
parentce92773a602cca246c44dbec9fb87656fedfa323 (diff)
invert condition in menu and some adjustement in interpolation (#611)
* use more unique ptr and fix a shell crash * remove useless mods folder * add even more unique_ptr * Update KoopaTroopaBeach.cpp * restore a throw * Update Game.cpp * automatically create mods folder * fix oob in external by assuming that all 8 player can make sound * better texture loading * add destructor for gameobject * avoid out of bound in audio sample * Update FrameInterpolation.cpp * Update torch * invert condition * adjust interpolation
Diffstat (limited to 'src/port/interpolation/FrameInterpolation.cpp')
-rw-r--r--src/port/interpolation/FrameInterpolation.cpp37
1 files changed, 16 insertions, 21 deletions
diff --git a/src/port/interpolation/FrameInterpolation.cpp b/src/port/interpolation/FrameInterpolation.cpp
index cfc07e50b..1d306964d 100644
--- a/src/port/interpolation/FrameInterpolation.cpp
+++ b/src/port/interpolation/FrameInterpolation.cpp
@@ -54,10 +54,6 @@ static bool invert_matrix(const float m[16], float invOut[16]);
using namespace std;
-extern "C" {
-extern Mat4* gInterpolationMatrix;
-void mtxf_translate(Mat4, Vec3f);
-}
namespace {
@@ -311,15 +307,15 @@ struct InterpolateCtx {
}
void lerp_vec3s(Vec3s* res, Vec3s o, Vec3s n) {
- *res[0] = lerp_s16(o[0], n[0]);
- *res[1] = lerp_s16(o[1], n[1]);
- *res[2] = lerp_s16(o[2], n[2]);
+ (*res)[0] = lerp_s16(o[0], n[0]);
+ (*res)[1] = lerp_s16(o[1], n[1]);
+ (*res)[2] = lerp_s16(o[2], n[2]);
}
void lerp_vec3f(Vec3f* res, Vec3f* o, Vec3f* n) {
- *res[0] = lerp(*o[0], *n[0]);
- *res[1] = lerp(*o[1], *n[1]);
- *res[2] = lerp(*o[2], *n[2]);
+ (*res)[0] = lerp((*o)[0], (*n)[0]);
+ (*res)[1] = lerp((*o)[1], (*n)[1]);
+ (*res)[2] = lerp((*o)[2], (*n)[2]);
}
float interpolate_angle(f32 o, f32 n) {
@@ -370,22 +366,19 @@ struct InterpolateCtx {
}
res = (u16) (w * o + step * n);
}
- if (os / 327 == ns / 327 && (s16) res / 327 != os / 327) {
- int bp = 0;
- }
return res;
}
void interpolate_vecs(Vec3f* res, Vec3f* o, Vec3f* n) {
- *res[0] = interpolate_angle(*o[0], *n[0]);
- *res[1] = interpolate_angle(*o[1], *n[1]);
- *res[2] = interpolate_angle(*o[2], *n[2]);
+ (*res)[0] = interpolate_angle((*o)[0], (*n)[0]);
+ (*res)[1] = interpolate_angle((*o)[1], (*n)[1]);
+ (*res)[2] = interpolate_angle((*o)[2], (*n)[2]);
}
void interpolate_angles(Vec3s* res, Vec3s* o, Vec3s* n) {
- *res[0] = interpolate_angle(*o[0], *n[0]);
- *res[1] = interpolate_angle(*o[1], *n[1]);
- *res[2] = interpolate_angle(*o[2], *n[2]);
+ (*res)[0] = interpolate_angle((*o)[0], (*n)[0]);
+ (*res)[1] = interpolate_angle((*o)[1], (*n)[1]);
+ (*res)[2] = interpolate_angle((*o)[2], (*n)[2]);
}
void interpolate_branch(Path* old_path, Path* new_path) {
@@ -593,6 +586,7 @@ struct InterpolateCtx {
lerp_vec3f(&tmp_vec3f2, (Vec3f*)&old_op.matrix_applytransformations.scale, (Vec3f*)&new_op.matrix_applytransformations.scale);
ApplyMatrixTransformations(*gInterpolationMatrix, *(FVector*)&tmp_vec3f, *(IRotator*)&tmp_vec3s, *(FVector*)&tmp_vec3f2);
+ break;
}
}
}
@@ -724,8 +718,9 @@ void FrameInterpolation_RecordMatrixMult(Mat4* matrix, MtxF* mf, u8 mode) {
}
void FrameInterpolation_ApplyMatrixTransformations(Mat4* matrix, FVector pos, IRotator rot, FVector scale) {
- if (!is_recording)
+ if (!check_if_recording()) {
return;
+ }
append(Op::SetApplyMatrixTransformations).matrix_applytransformations = { matrix, pos, rot, scale };
}
@@ -816,7 +811,7 @@ void FrameInterpolation_RecordMatrixMtxFToMtx(MtxF* src, Mtx* dest) {
if (!check_if_recording()) {
return;
}
- append(Op::MatrixMtxFToMtx).matrix_mtxf_to_mtx = { *src, dest };
+ append(Op::MatrixMtxFToMtx).matrix_mtxf_to_mtx = { .src = *src, .dest = dest };
}
void FrameInterpolation_RecordMatrixToMtx(Mtx* dest, char* file, s32 line) {