summaryrefslogtreecommitdiff
path: root/src
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
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')
-rw-r--r--src/menu_items.c8
-rw-r--r--src/port/interpolation/FrameInterpolation.cpp37
2 files changed, 20 insertions, 25 deletions
diff --git a/src/menu_items.c b/src/menu_items.c
index d8b652aa5..9838fd31e 100644
--- a/src/menu_items.c
+++ b/src/menu_items.c
@@ -10544,7 +10544,7 @@ void func_800AA69C(MenuItem* arg0) {
if (D_8018DEE0[arg0->D_8018DEE0_index].sequenceIndex >= D_800E8440[temp_a0]) {
arg0->subState = 2;
func_8009A594(arg0->D_8018DEE0_index, 0, D_800E83A0[temp_a0]);
- } else if ((gCharacterGridIsSelected[temp_v0] == 0) && (var_a0 != 0)) {
+ } else if ((var_a0 != 0) && (gCharacterGridIsSelected[temp_v0] == 0)) {
arg0->subState = 3;
func_8009A594(arg0->D_8018DEE0_index,
D_800E8460[temp_a0] - D_8018DEE0[arg0->D_8018DEE0_index].sequenceIndex,
@@ -10552,7 +10552,7 @@ void func_800AA69C(MenuItem* arg0) {
}
break;
case 2:
- if ((gCharacterGridIsSelected[temp_v0] == 0) && (var_a0 != 0)) {
+ if ((var_a0 != 0) && (gCharacterGridIsSelected[temp_v0] == 0)) {
arg0->subState = 3;
func_8009A594(arg0->D_8018DEE0_index, 0, gCharacterDeselectAnimation[temp_a0]);
}
@@ -10561,7 +10561,7 @@ void func_800AA69C(MenuItem* arg0) {
if (D_8018DEE0[arg0->D_8018DEE0_index].sequenceIndex >= D_800E8460[temp_a0]) {
arg0->subState = 0;
func_8009A594(arg0->D_8018DEE0_index, 0, D_800E8360[temp_a0]);
- } else if ((gCharacterGridIsSelected[temp_v0] != 0) && (var_a0 != 0)) {
+ } else if ((var_a0 != 0) && (gCharacterGridIsSelected[temp_v0] != 0)) {
arg0->subState = 1;
func_8009A594(arg0->D_8018DEE0_index,
D_800E8460[temp_a0] - D_8018DEE0[arg0->D_8018DEE0_index].sequenceIndex,
@@ -10570,7 +10570,7 @@ void func_800AA69C(MenuItem* arg0) {
break;
case 4:
case 5:
- if ((gCharacterGridIsSelected[temp_v0] != 0) && (var_a0 != 0)) {
+ if ((var_a0 != 0) && (gCharacterGridIsSelected[temp_v0] != 0)) {
arg0->subState = 1;
func_8009A594(arg0->D_8018DEE0_index, 0,
gCharacterCelebrateAnimation[temp_a0]);
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) {