From a62f436d2287e557e0d4b4bab0995cce44ecc3bd Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Mon, 13 Apr 2026 19:44:46 -0400 Subject: [PATCH] TVec3 inline fixes, d_a_obj_gtaki OK, JPAConvectionField::calc cleanup --- configure.py | 2 +- include/JSystem/JGeometry.h | 21 ++++-------- src/JSystem/JParticle/JPAField.cpp | 52 +++++++----------------------- src/c/c_damagereaction.cpp | 8 ++--- src/d/actor/d_a_obj_gtaki.cpp | 18 ++++------- src/d/d_particle.cpp | 2 +- 6 files changed, 30 insertions(+), 73 deletions(-) diff --git a/configure.py b/configure.py index fc8fe1558..ddd8311ad 100755 --- a/configure.py +++ b/configure.py @@ -1707,7 +1707,7 @@ config.libs = [ ActorRel(Matching, "d_a_obj_gnndemotakie"), ActorRel(NonMatching, "d_a_obj_gnndemotakis"), ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_obj_gong"), - ActorRel(MatchingFor("D44J01"), "d_a_obj_gtaki"), + ActorRel(Matching, "d_a_obj_gtaki"), ActorRel(NonMatching, "d_a_obj_hami2"), ActorRel(Matching, "d_a_obj_hami3"), ActorRel(Matching, "d_a_obj_hami4"), diff --git a/include/JSystem/JGeometry.h b/include/JSystem/JGeometry.h index e452126b2..ca42f8628 100644 --- a/include/JSystem/JGeometry.h +++ b/include/JSystem/JGeometry.h @@ -85,7 +85,7 @@ template <> struct TVec3 : public Vec { TVec3() {} - TVec3(const f32 x, const f32 y, const f32 z) { set(x, y, z); } + TVec3(const f32 x, const f32 y, const f32 z) { set((f32)x, (f32)y, (f32)z); } TVec3(const Vec& b) { set(b); } @@ -94,9 +94,9 @@ struct TVec3 : public Vec { template void set(const TVec3& other) { - x = other.x; - y = other.y; - z = other.z; + x = (f32)other.x; + y = (f32)other.y; + z = (f32)other.z; } void set(const Vec& vec) { @@ -107,9 +107,9 @@ struct TVec3 : public Vec { template void set(f32 x_, f32 y_, f32 z_) { - x = x_; - y = y_; - z = z_; + x = (f32)x_; + y = (f32)y_; + z = (f32)z_; } void zero() { x = y = z = 0.0f; } @@ -212,13 +212,6 @@ struct TVec3 : public Vec { ); } - void cross_hack(const TVec3& a, const TVec3& b) { - // obviously fake - x = a.y * b.z - a.z * b.y; - y = a.z * b.x - a.x * b.z; - z = a.x * b.y - a.y * b.x; - } - f32 setLength(f32 len) { f32 sq = squared(); if (sq <= TUtil::epsilon()) { diff --git a/src/JSystem/JParticle/JPAField.cpp b/src/JSystem/JParticle/JPAField.cpp index 841fedba9..0c3cf695b 100644 --- a/src/JSystem/JParticle/JPAField.cpp +++ b/src/JSystem/JParticle/JPAField.cpp @@ -260,59 +260,29 @@ void JPAConvectionField::preCalc(JPAFieldData* data) { /* 8025B114-8025B3CC .text calc__18JPAConvectionFieldFP12JPAFieldDataP15JPABaseParticle */ void JPAConvectionField::calc(JPAFieldData* data, JPABaseParticle* ptcl) { - /* Nonmatching - regalloc, maybe related to cross_hack fake inline? */ + /* Nonmatching - fpr regalloc */ - JGeometry::TVec3 axisX, axisZ; - - // axisX.scale(data->mWork0.dot(ptcl->mLocalPosition), data->mWork0); - // axisZ.scale(data->mWork2.dot(ptcl->mLocalPosition), data->mWork2); + JGeometry::TVec3 axisX; + JGeometry::TVec3 axisZ; f32 dot0 = data->mWork0.dot(ptcl->mLocalPosition); - - // f32 f3 = data->mWork0.x * dot0; - // f32 f4 = data->mWork0.y * dot0; - // f32 f5 = data->mWork0.z * dot0; - // axisX.set(f3, f4, f5); - - // axisX.set(data->mWork0.x * dot0, data->mWork0.y * dot0, data->mWork0.z * dot0); - axisX.set(data->mWork0); - // axisX.set(data->mWork0.x, data->mWork0.y, data->mWork0.z); axisX.scale(dot0); - // axisX.scale(dot0, data->mWork0); - - // axisX.scale(data->mWork0.dot(ptcl->mLocalPosition), data->mWork0); - f32 dot2 = data->mWork2.dot(ptcl->mLocalPosition); - - f32 f1 = data->mWork2.x * dot2; - f32 f2 = data->mWork2.y * dot2; - f32 f0 = data->mWork2.z * dot2; - axisZ.set(f1, f2, f0); - - // axisZ.set(data->mWork2.x * dot2, data->mWork2.y * dot2, data->mWork2.z * dot2); - - // axisZ.set(data->mWork2); - // axisZ.scale(dot2); - - // axisZ.scale(dot2, data->mWork2); - - // axisZ.scale(data->mWork2.dot(ptcl->mLocalPosition), data->mWork2); + axisZ.set(data->mWork2); + axisZ.scale(dot2); JGeometry::TVec3 newPos; + JGeometry::TVec3 newPos2; newPos.add(axisX, axisZ); + newPos2.setLength(newPos, data->mVal1); - newPos.setLength(newPos, data->mVal1); - - JGeometry::TVec3 delta, axisY; - delta.sub(ptcl->mLocalPosition, newPos); - axisY.cross_hack(data->mWork1, newPos); // fake inline - // axisY.cross(data->mWork1, newPos); - // axisY.cross(newPos, data->mWork1); - // data->mVel.cross_hack(axisY, delta); // fake inline + JGeometry::TVec3 delta; + JGeometry::TVec3 axisY; + delta.sub(ptcl->mLocalPosition, newPos2); + axisY.cross(data->mWork1, newPos2); data->mVel.cross(axisY, delta); - // data->mVel.cross(delta, axisY); data->mVel.setLength(data->mMag); if (data->mVal2 != 0.0f) { diff --git a/src/c/c_damagereaction.cpp b/src/c/c_damagereaction.cpp index 5e59d4ac8..639d77c6c 100644 --- a/src/c/c_damagereaction.cpp +++ b/src/c/c_damagereaction.cpp @@ -546,11 +546,9 @@ void enemy_fire(enemyfire* ef) { ef->mpFlameEmitters[i]->setDirection(ef->mDirection); JGeometry::TVec3 scale; - scale.set( - ef->mParticleScale[i], - ef->mFlameScaleY * ef->mParticleScale[i], - ef->mParticleScale[i] - ); + scale.x = ef->mParticleScale[i]; + scale.z = ef->mParticleScale[i]; + scale.y = ef->mFlameScaleY * ef->mParticleScale[i]; ef->mpFlameEmitters[i]->setGlobalParticleScale(scale); if (ef->mHitboxFlameIdx == numFlamesLeft) { diff --git a/src/d/actor/d_a_obj_gtaki.cpp b/src/d/actor/d_a_obj_gtaki.cpp index c1672066e..10476f853 100644 --- a/src/d/actor/d_a_obj_gtaki.cpp +++ b/src/d/actor/d_a_obj_gtaki.cpp @@ -65,15 +65,12 @@ void daObjGtaki_c::setDummyTexture() { /* 00000280-00000484 .text CreateHeap__12daObjGtaki_cFv */ BOOL daObjGtaki_c::CreateHeap() { - J3DModelData* modelData; - J3DAnmTextureSRTKey* btk; - - modelData = (J3DModelData*)dComIfG_getObjectRes("Gtaki", GTAKI_BDL_GTAKI); + J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("Gtaki", GTAKI_BDL_GTAKI); JUT_ASSERT(DEMO_SELECT(265, 267), modelData != NULL); mpModel = mDoExt_J3DModel__create(modelData, 0, 0x11020203); if(mpModel == NULL) return FALSE; - btk = static_cast(dComIfG_getObjectRes("Gtaki", GTAKI_BTK_GTAKI)); + J3DAnmTextureSRTKey* btk = static_cast(dComIfG_getObjectRes("Gtaki", GTAKI_BTK_GTAKI)); JUT_ASSERT(DEMO_SELECT(275, 277), btk != NULL); mBtkAnm.init(modelData, btk, true, J3DFrameCtrl::EMode_LOOP, 1.0, 0, -1, false, 0); setDummyTexture(); @@ -95,13 +92,12 @@ BOOL daObjGtaki_c::CreateHeap() { void daObjGtaki_c::set_effect() { JPABaseEmitter* emitter = dComIfGp_particle_setP1(dPa_name::ID_AK_SN_GANONFALLSSPLASH00, ¤t.pos, NULL, NULL, 0xff, NULL, -1, NULL, NULL, NULL); if(emitter != NULL){ - JGeometry::TVec3 gd_scale; - gd_scale.set(scale.x, scale.y, scale.z); - emitter->setGlobalDynamicsScale(gd_scale); + JGeometry::TVec3 p_scale; + p_scale.set(scale.x, scale.y, scale.z); + emitter->setGlobalDynamicsScale(p_scale); - JGeometry::TVec3 gp_scale; - gp_scale.set(scale.x, scale.x, scale.x); - emitter->setGlobalParticleScale(gp_scale); + p_scale.set(scale.x, scale.x, scale.x); + emitter->setGlobalParticleScale(p_scale); emitter->setGlobalPrmColor(mTevStr.mColorC0.r, mTevStr.mColorC0.g, mTevStr.mColorC0.b); } diff --git a/src/d/d_particle.cpp b/src/d/d_particle.cpp index 1d10a8396..19fa9b715 100644 --- a/src/d/d_particle.cpp +++ b/src/d/d_particle.cpp @@ -92,7 +92,7 @@ void dPa_J3DmodelEmitter_c::draw() { vel.normalize(); } JGeometry::TVec3 tmp; - tmp.cross_hack(params->mAxis, vel); // fake inline + tmp.cross(params->mAxis, vel); if (tmp.isZero()) { tmp.set(0.0f, 0.0f, 1.0f); } else {