Skip to content

Commit

Permalink
Add checkScaleOne inline
Browse files Browse the repository at this point in the history
  • Loading branch information
LagoLunatic committed Jun 29, 2024
1 parent c56933f commit f4a2e2f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
8 changes: 8 additions & 0 deletions include/dolphin/mtx/vec.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ inline f32 C_VECSquareMag(const Vec* v) {
return v->x * v->x + v->y * v->y + v->z * v->z;
}

inline BOOL checkScaleOne(Vec v) {
if (v.x == 1.0f && v.y == 1.0f && v.z == 1.0f) {
return TRUE;
} else {
return FALSE;
}
}

/* When compiling in debug mode, use C implementations */
#if 0
#define VECAdd C_VECAdd
Expand Down
18 changes: 2 additions & 16 deletions src/JSystem/J3DGraphAnimator/J3DJoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,8 @@ void J3DMtxCalcBasic::calcTransform(u16 param_0, const J3DTransformInfo& info) {
J3DSys::mCurrentS.x *= info.mScale.x;
J3DSys::mCurrentS.y *= info.mScale.y;
J3DSys::mCurrentS.z *= info.mScale.z;
Vec tmp = J3DSys::mCurrentS;
s32 var1;
if (tmp.x == 1.0f && tmp.y == 1.0f && tmp.z == 1.0f) {
var1 = 1;
} else {
var1 = 0;
}
s32 r29;
if (var1) {
if (checkScaleOne(J3DSys::mCurrentS)) {
j3dSys.getModel()->setScaleFlag(param_0, 1);
r29 = 1;
} else {
Expand Down Expand Up @@ -112,15 +105,8 @@ void J3DMtxCalcSoftimage::calcTransform(u16 param_0, const J3DTransformInfo& inf
J3DSys::mCurrentS.x = J3DSys::mCurrentS.x * info.mScale.x;
J3DSys::mCurrentS.y = J3DSys::mCurrentS.y * info.mScale.y;
J3DSys::mCurrentS.z = J3DSys::mCurrentS.z * info.mScale.z;
Vec tmp = J3DSys::mCurrentS;
s32 var1;
if (tmp.x == 1.0f && tmp.y == 1.0f && tmp.z == 1.0f) {
var1 = 1;
} else {
var1 = 0;
}
s32 var2;
if (var1) {
if (checkScaleOne(J3DSys::mCurrentS)) {
j3dSys.getModel()->setScaleFlag(param_0, 1);
var2 = 1;
} else {
Expand Down

0 comments on commit f4a2e2f

Please sign in to comment.