Clean up JGeometry::TVec3 jank/fakematches

It seems the const parameters might not be necessary after all, and these can be matched with (f32)/(s16) casts in set(T, T, T) instead.
This commit is contained in:
LagoLunatic
2026-05-22 15:08:59 -04:00
parent 02b81a670b
commit 98956b312d
5 changed files with 10 additions and 29 deletions
+5 -5
View File
@@ -57,7 +57,7 @@ template <>
struct TVec3<s16> : public SVec {
TVec3() {}
TVec3(const SVec& b) { set(b); }
TVec3(const s16 x, const s16 y, const s16 z) { set(x, y, z); }
TVec3(s16 x, s16 y, s16 z) { set(x, y, z); }
void set(const SVec& vec) {
x = vec.x;
@@ -82,7 +82,7 @@ template <>
struct TVec3<f32> : public Vec {
TVec3() {}
TVec3(const f32 x, const f32 y, const f32 z) { set((f32)x, (f32)y, (f32)z); }
TVec3(f32 x, f32 y, f32 z) { set(x, y, z); }
TVec3(const Vec& b) { set(b); }
@@ -91,9 +91,9 @@ struct TVec3<f32> : public Vec {
template<typename f32>
void set(const TVec3<f32>& other) {
x = (f32)other.x;
y = (f32)other.y;
z = (f32)other.z;
x = other.x;
y = other.y;
z = other.z;
}
void set(const Vec& vec) {
+2 -8
View File
@@ -5998,10 +5998,7 @@ void daNpc_Md_c::emitterTrace(JPABaseEmitter* emitter, MtxP mtx, csXyz* angle) {
JGeometry::TVec3<f32> pos(mtx[0][3], mtx[1][3], mtx[2][3]);
emitter->setGlobalTranslation(pos);
if (angle) {
JGeometry::TVec3<s16> rot;
rot.z = angle->z;
rot.y = angle->y;
rot.x = angle->x;
JGeometry::TVec3<s16> rot(angle->x, angle->y, angle->z);
emitter->setGlobalRotation(rot);
}
}
@@ -6069,10 +6066,7 @@ static BOOL daNpc_Md_IsDelete(daNpc_Md_c* i_this) {
/* 0001114C-0001119C .text execute__26daNpc_Md_followEcallBack_cFP14JPABaseEmitter */
void daNpc_Md_followEcallBack_c::execute(JPABaseEmitter* emitter) {
emitter->setGlobalTranslation(mPos.x, mPos.y, mPos.z);
JGeometry::TVec3<s16> rot;
rot.z = mAngle.z;
rot.y = mAngle.y;
rot.x = mAngle.x;
JGeometry::TVec3<s16> rot(mAngle.x, mAngle.y, mAngle.z);
emitter->setGlobalRotation(rot);
}
+2 -4
View File
@@ -77,8 +77,7 @@ void daPy_swimTailEcallBack_c::execute(JPABaseEmitter* emitter) {
if (field_0x20 != NULL) {
emitter->setGlobalTranslation(mPos.x, mPos.y, mPos.z);
JGeometry::TVec3<s16> rot(0, 0, 0);
rot.y = field_0x20->y;
JGeometry::TVec3<s16> rot(0, field_0x20->y, 0);
emitter->setGlobalRotation(rot);
}else {
JGeometry::TVec3<f32> sp20;
@@ -381,8 +380,7 @@ void daPy_waterDropPcallBack_c::execute(JPABaseEmitter* emitter, JPABaseParticle
/* 80129F48-80129F98 .text execute__22daPy_followEcallBack_cFP14JPABaseEmitter */
void daPy_followEcallBack_c::execute(JPABaseEmitter* emitter) {
emitter->setGlobalTranslation(mPos.x, mPos.y, mPos.z);
JGeometry::TVec3<s16> rot;
rot.set(mAngle.x, mAngle.y, mAngle.z);
JGeometry::TVec3<s16> rot(mAngle.x, mAngle.y, mAngle.z);
emitter->setGlobalRotation(rot);
}
-8
View File
@@ -131,15 +131,7 @@ BOOL daSteamTag_c::execute() {
mCreateTimer--;
if (mCreateTimer == 0) {
if (createEmitter()) {
// TODO: Fakematch? The demo debug map indicates TVec3(s16, s16, s16) constructor
// was used here, but just doing that doesn't match for either the demo or retail.
// Assigning x/y/z with 3 individual assignments matches for retail, but doesn't
// match for the demo. However, first using the TVec3(s16, s16, s16) ctor and then
// *also* assigning x/y/z separately matches for both demo and retail.
JGeometry::TVec3<s16> angle(current.angle.x, current.angle.y, current.angle.z);
angle.x = current.angle.x;
angle.y = current.angle.y;
angle.z = current.angle.z;
JGeometry::TVec3<f32> pos(current.pos.x, current.pos.y, current.pos.z);
mpEmitter->setGlobalTranslation(pos);
mpEmitter->setGlobalRotation(angle);
+1 -4
View File
@@ -1049,10 +1049,7 @@ void dPa_waveEcallBack::executeAfter(JPABaseEmitter* emitter) {
}
f32 speed = mVelFade1 * vel * mVelFade2;
JGeometry::TVec3<s16> rot;
rot.x = 0;
rot.y = mpRot->y;
rot.z = 0;
JGeometry::TVec3<s16> rot(0, mpRot->y, 0);
emitter->setGlobalRotation(rot);
if (std::fabsf(speed - mVel) > mVelSpeed) {