diff --git a/include/JSystem/JGeometry.h b/include/JSystem/JGeometry.h index 72f0cdd34..6a1d20798 100644 --- a/include/JSystem/JGeometry.h +++ b/include/JSystem/JGeometry.h @@ -42,7 +42,7 @@ struct TVec3 { TVec3() {} - TVec3(T x, T y, T z) { set(x, y, z); } + TVec3(const T x, const T y, const T z) { set(x, y, z); } void set(T x_, T y_, T z_) { x = x_; @@ -62,19 +62,27 @@ struct TVec3 : public SVec { TVec3() {} - TVec3(s16 x, s16 y, s16 z) { set(x, y, z); } + TVec3(const s16 x, const s16 y, const s16 z) { set(x, y, z); } void set(s16 x_, s16 y_, s16 z_) { x = x_; y = y_; z = z_; } + + TVec3(const int x, const int y, const int z) { set(x, y, z); } + + void set(int x_, int y_, int z_) { + x = x_; + y = y_; + z = z_; + } }; template <> struct TVec3 : public Vec { TVec3() {} - TVec3(f32 x, f32 y, f32 z) { set(x, y, z); } + TVec3(const f32 x, const f32 y, const f32 z) { set(x, y, z); } TVec3(const Vec& b) { set(b); } operator Vec*() { return (Vec*)&x; } diff --git a/include/JSystem/JParticle/JPADynamicsBlock.h b/include/JSystem/JParticle/JPADynamicsBlock.h index 1f60dc6bd..da0240982 100644 --- a/include/JSystem/JParticle/JPADynamicsBlock.h +++ b/include/JSystem/JParticle/JPADynamicsBlock.h @@ -1,7 +1,7 @@ #ifndef JPADYNAMICSBLOCK_H #define JPADYNAMICSBLOCK_H -#include "JSystem/JParticle/JPAParticle.h" +#include "JSystem/JGeometry.h" struct JPADynamicsBlockData { /* 0x00 */ u32 mFlag; @@ -76,10 +76,10 @@ public: virtual ~JPADynamicsBlockArc() {} virtual u32 getDataFlag() { return mpData->mFlag; } virtual u32 getUseKeyFlag() { return 0; } - virtual void getEmitterScl(JGeometry::TVec3& out) { out = mpData->mEmitterScl; } - virtual void getEmitterRot(JGeometry::TVec3& out) { out = mpData->mEmitterRot; } - virtual void getEmitterTrs(JGeometry::TVec3& out) { out = mpData->mEmitterTrs; } - virtual void getEmitterDir(JGeometry::TVec3& out) { out = mpData->mEmitterDir; } + virtual void getEmitterScl(JGeometry::TVec3& out) { out.set(mpData->mEmitterScl.x, mpData->mEmitterScl.y, mpData->mEmitterScl.z); } + virtual void getEmitterRot(JGeometry::TVec3& out) { out.set(mpData->mEmitterRot.x, mpData->mEmitterRot.y, mpData->mEmitterRot.z); } + virtual void getEmitterTrs(JGeometry::TVec3& out) { out.set(mpData->mEmitterTrs.x, mpData->mEmitterTrs.y, mpData->mEmitterTrs.z); } + virtual void getEmitterDir(JGeometry::TVec3& out) { out.set(mpData->mEmitterDir.x, mpData->mEmitterDir.y, mpData->mEmitterDir.z); } virtual u32 getVolumeType() { return (mpData->mFlag >> 8) & 0x07; } virtual u32 getVolumeSize() { return mpData->mVolumeSize; } virtual f32 getVolumeSweep() { return mpData->mVolumeSweep; } diff --git a/src/JSystem/JParticle/JPAMath.cpp b/src/JSystem/JParticle/JPAMath.cpp index 93b6fa9a8..1f365c9eb 100644 --- a/src/JSystem/JParticle/JPAMath.cpp +++ b/src/JSystem/JParticle/JPAMath.cpp @@ -61,11 +61,8 @@ void JPAGetXYZRotateMtx(s16 x, s16 y, s16 z, Mtx dst) { /* 80259A64-80259B6C .text JPAGetDirMtx__FRCQ29JGeometry8TVec3PA4_f */ void JPAGetDirMtx(const JGeometry::TVec3& dir, Mtx dst) { /* Nonmatching - regalloc */ - JGeometry::TVec3 perp; - perp.x = dir.y; - perp.y = -dir.x; + JGeometry::TVec3 perp(dir.y, -dir.x, 0.0f); f32 z = dir.z; - perp.z = 0.0f; f32 mag = perp.length(); if (mag <= JGeometry::TUtil::epsilon()) { diff --git a/src/d/actor/d_a_demo_item.cpp b/src/d/actor/d_a_demo_item.cpp index 6cf4d5b36..236414a5a 100644 --- a/src/d/actor/d_a_demo_item.cpp +++ b/src/d/actor/d_a_demo_item.cpp @@ -332,7 +332,9 @@ void daDitem_c::set_effect() { continue; } JGeometry::TVec3 rot; - rot.set(angleX, angleY, 0); + rot.x = angleX; + rot.y = angleY; + rot.z = 0; mpEmitters[i]->playCreateParticle(); JGeometry::TVec3 pos; pos.set(current.pos); diff --git a/src/d/actor/d_a_npc_md.cpp b/src/d/actor/d_a_npc_md.cpp index 17d94dffa..e672e2c60 100644 --- a/src/d/actor/d_a_npc_md.cpp +++ b/src/d/actor/d_a_npc_md.cpp @@ -3267,16 +3267,10 @@ void daNpc_Md_c::emitterTrace(JPABaseEmitter* emitter, MtxP mtx, csXyz* angle) { if (emitter == NULL) { return; } - JGeometry::TVec3 pos; - pos.x = mtx[0][3]; - pos.y = mtx[1][3]; - pos.z = mtx[2][3]; + JGeometry::TVec3 pos(mtx[0][3], mtx[1][3], mtx[2][3]); emitter->setGlobalTranslation(pos); if (angle) { - JGeometry::TVec3 rot; - rot.x = angle->x; - rot.y = angle->y; - rot.z = angle->z; + JGeometry::TVec3 rot(angle->x, angle->y, angle->z); emitter->setGlobalRotation(rot); } } @@ -3342,10 +3336,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 rot; - rot.x = mAngle.x; - rot.y = mAngle.y; - rot.z = mAngle.z; + JGeometry::TVec3 rot(mAngle.x, mAngle.y, mAngle.z); emitter->setGlobalRotation(rot); } diff --git a/src/d/actor/d_a_obj_barrel.cpp b/src/d/actor/d_a_obj_barrel.cpp index beaac509d..93defe12f 100644 --- a/src/d/actor/d_a_obj_barrel.cpp +++ b/src/d/actor/d_a_obj_barrel.cpp @@ -476,7 +476,7 @@ void daObjBarrel::Act_c::eff_break() { cXyz pos(current.pos.x, current.pos.y + 50.0f, current.pos.z); JPABaseEmitter* emitter = dComIfGp_particle_set(dPa_name::ID_COMMON_03E5, &pos, NULL, NULL, 0xFF, NULL, -1, &tevStr.mColorK0, &tevStr.mColorK0); if (emitter) { - static const JGeometry::TVec3 em_scl(1.0f, 0.8f, 1.0f); + static JGeometry::TVec3 em_scl(1.0f, 0.8f, 1.0f); emitter->setEmitterScale(em_scl); } daObjEff::Act_c::make_barrel_smoke(&pos); diff --git a/src/d/actor/d_a_pedestal.cpp b/src/d/actor/d_a_pedestal.cpp index 55bc4ec05..7f6a560a3 100644 --- a/src/d/actor/d_a_pedestal.cpp +++ b/src/d/actor/d_a_pedestal.cpp @@ -438,12 +438,7 @@ void daPds_infiniteEcallBack_c::execute(JPABaseEmitter* emitter) { } if (mpAngle != NULL) { - JGeometry::TVec3 rot; - - rot.x = mpAngle->x; - rot.y = mpAngle->y; - rot.z = mpAngle->z; - + JGeometry::TVec3 rot(mpAngle->x, mpAngle->y, mpAngle->z); emitter->setGlobalRotation(rot); } } diff --git a/src/d/actor/d_a_player_particle.inc b/src/d/actor/d_a_player_particle.inc index bdcd324d3..234761e8c 100644 --- a/src/d/actor/d_a_player_particle.inc +++ b/src/d/actor/d_a_player_particle.inc @@ -364,12 +364,8 @@ void daPy_waterDropPcallBack_c::execute(JPABaseEmitter* emitter, JPABaseParticle /* 80129F48-80129F98 .text execute__22daPy_followEcallBack_cFP14JPABaseEmitter */ void daPy_followEcallBack_c::execute(JPABaseEmitter* emitter) { - JGeometry::TVec3 pos(mPos.x, mPos.y, mPos.z); - emitter->setGlobalTranslation(pos); - JGeometry::TVec3 rot; - rot.x = mAngle.x; - rot.y = mAngle.y; - rot.z = mAngle.z; + emitter->setGlobalTranslation(mPos.x, mPos.y, mPos.z); + JGeometry::TVec3 rot(mAngle.x, mAngle.y, mAngle.z); emitter->setGlobalRotation(rot); } diff --git a/src/d/actor/d_a_steam_tag.cpp b/src/d/actor/d_a_steam_tag.cpp index ef8305512..62e47ecaa 100644 --- a/src/d/actor/d_a_steam_tag.cpp +++ b/src/d/actor/d_a_steam_tag.cpp @@ -129,18 +129,21 @@ BOOL daSteamTag_c::execute() { mCreateTimer--; if (mCreateTimer == 0) { if (createEmitter()) { + // TODO: fakematch? debug map indicates TVec3(s16, s16, s16) constructor was used here, but the codegen doesn't match + // JGeometry::TVec3 angle(current.angle.x, current.angle.y, current.angle.z); JGeometry::TVec3 angle; angle.x = current.angle.x; angle.y = current.angle.y; angle.z = current.angle.z; - mpEmitter->setGlobalTranslation(current.pos); + JGeometry::TVec3 pos(current.pos.x, current.pos.y, current.pos.z); + mpEmitter->setGlobalTranslation(pos); mpEmitter->setGlobalRotation(angle); mpEmitter->setGlobalAlpha(getData()->steam_alpha); mpEmitter->playCreateParticle(); mEmitTimer = getData()->emit_time_min + cM_rndF(getData()->emit_time_range); } else { - mCreateTimer = 0x1e; + mCreateTimer = 30; } } } diff --git a/src/d/d_particle.cpp b/src/d/d_particle.cpp index fa35f9a58..3bc9ff029 100644 --- a/src/d/d_particle.cpp +++ b/src/d/d_particle.cpp @@ -224,11 +224,10 @@ dPa_followEcallBack::dPa_followEcallBack(u8 param_1, u8 param_2) { /* 8007B194-8007B288 .text execute__19dPa_followEcallBackFP14JPABaseEmitter */ void dPa_followEcallBack::execute(JPABaseEmitter* emtr) { - /* Nonmatching */ if (field_0x12 == 0 && !(mFlag & 2)) { - emtr->setGlobalTranslation(JGeometry::TVec3(mPos->x, mPos->y, mPos->z)); + emtr->setGlobalTranslation(mPos->x, mPos->y, mPos->z); if (mAngle != NULL) - emtr->setGlobalRotation(*(JGeometry::TVec3*)mAngle); + emtr->setGlobalRotation(JGeometry::TVec3(mAngle->x, mAngle->y, mAngle->z)); } if (emtr->isEnableDeleteEmitter()) { @@ -278,7 +277,6 @@ void dPa_followEcallBack::end() { /* 8007B3B0-8007B444 .text __ct__18dPa_smokeEcallBackFUc */ dPa_smokeEcallBack::dPa_smokeEcallBack(u8 param_1) { - /* Nonmatching */ GXColor local_18 = {0xa0, 0xa0, 0x80, 0xff}; mColor = local_18; mRateOff = param_1; @@ -290,7 +288,6 @@ dPa_smokeEcallBack::dPa_smokeEcallBack(u8 param_1) { /* 8007B4B0-8007B558 .text __ct__18dPa_smokeEcallBackFUcUcUcUc */ dPa_smokeEcallBack::dPa_smokeEcallBack(u8 param_1, u8 param_2, u8 param_3, u8 param_4) { - /* Nonmatching */ GXColor local_28 = {0xa0, 0xa0, 0x80, 0xff}; mColor = local_28; mRateOff = param_1; @@ -442,7 +439,6 @@ dPa_simpleData_c::dPa_simpleData_c() {} /* 8007C460-8007C618 .text executeAfter__19dPa_simpleEcallBackFP14JPABaseEmitter */ void dPa_simpleEcallBack::executeAfter(JPABaseEmitter* param_1) { - /* Nonmatching */ s32 r28 = JPABaseEmitter::emtrInfo.mVolumeEmitCount; if (r28 <= 0) { mCount = 0; @@ -477,7 +473,6 @@ void dPa_simpleEcallBack::executeAfter(JPABaseEmitter* param_1) { /* 8007C674-8007C6EC .text draw__19dPa_simpleEcallBackFP14JPABaseEmitter */ void dPa_simpleEcallBack::draw(JPABaseEmitter* emtr) { - /* Nonmatching */ if (mbIsSmoke) smokeEcallBack(emtr, NULL, -1, (GXColor){ 0xA0, 0xA0, 0x80, 0xFF }); @@ -690,7 +685,6 @@ void dPa_control_c::removeScene() { /* 8007D094-8007D0DC .text calc3D__13dPa_control_cFv */ void dPa_control_c::calc3D() { - /* Nonmatching */ for (u8 i = dPtclGroup_Normal_e; i <= dPtclGroup_Wind_e; i++) mEmitterMng->calc(i); } @@ -703,7 +697,6 @@ void dPa_control_c::calc2D() { /* 8007D124-8007D16C .text calcMenu__13dPa_control_cFv */ void dPa_control_c::calcMenu() { - /* Nonmatching */ for (u8 i = dPtclGroup_2DmenuFore_e; i <= dPtclGroup_2DmenuBack_e; i++) mEmitterMng->calc(i); } @@ -751,7 +744,6 @@ JPABaseEmitter* dPa_control_c::set(u8 groupID, u16 userID, const cXyz* pos, cons /* 8007D378-8007D414 .text setBombSmoke__13dPa_control_cFUsPC4cXyzPC5csXyzPC4cXyzUc */ JPABaseEmitter* dPa_control_c::setBombSmoke(u16 userID, const cXyz* pos, const csXyz* angle, const cXyz* scale, u8 alpha) { - /* Nonmatching */ JPABaseEmitter* emtr = setToonP1(userID, pos, angle, scale, alpha, &mBombSmokeEcallBack, -1, NULL, NULL, NULL); if (emtr != NULL) { if (userID == 0x2009) @@ -861,7 +853,6 @@ JPABaseEmitter* dPa_control_c::setNormalStripes(u16 ptclID, const cXyz* pos, con /* 8007DB34-8007DBC4 .text newSimple__13dPa_control_cFUsUc */ bool dPa_control_c::newSimple(u16 effectID, u8 groupID) { - /* Nonmatching */ if (mNumSimple >= 25) { OSReport("\x1b[43;30m1エミッター登録数オーバー!!\n"); return false; @@ -971,7 +962,6 @@ void dPa_ripplePcallBack::draw(JPABaseEmitter*, JPABaseParticle*) { /* 8007E254-8007E288 .text setup__17dPa_waveEcallBackFP14JPABaseEmitterPC4cXyzPC5csXyzSc */ void dPa_waveEcallBack::setup(JPABaseEmitter* param_1, const cXyz* param_2, const csXyz* param_3, s8 param_4) { - /* Nonmatching */ mpPos = param_2; mpRot = param_3; mVel = 0.0f; @@ -994,8 +984,6 @@ void dPa_waveEcallBack::remove() { /* 8007E2BC-8007E484 .text executeAfter__17dPa_waveEcallBackFP14JPABaseEmitter */ void dPa_waveEcallBack::executeAfter(JPABaseEmitter* emitter) { - /* Nonmatching - regalloc */ - emitter->getEmitterAxis(mRotMtx[0], mRotMtx[1], mRotMtx[2]); if (mState != 0) {