d_particle debug improvements (#3010)

This commit is contained in:
Max Roncace
2026-01-02 11:24:40 -05:00
committed by GitHub
parent b3803dfa74
commit 59fa5deb80
7 changed files with 209 additions and 213 deletions
+14 -14
View File
@@ -119,9 +119,9 @@ struct TVec3<s16> {
}
void set(s16 x_, s16 y_, s16 z_) {
x = x_;
y = y_;
z = z_;
x = (s16)x_;
y = (s16)y_;
z = (s16)z_;
}
};
@@ -175,17 +175,17 @@ inline void mulInternal(__REGISTER const f32* a, __REGISTER const f32* b, __REGI
template <>
struct TVec3<f32> : public Vec {
inline TVec3(const Vec& i_vec) {
TVec3(const Vec& i_vec) {
setTVec3f(&i_vec.x, &x);
}
inline TVec3(const TVec3<f32>& i_vec) {
TVec3(const TVec3<f32>& i_vec) {
setTVec3f(&i_vec.x, &x);
}
template<class U>
TVec3(U x, U y, U z) {
set(x, y, z);
set((U)x, (U)y, (U)z);
}
TVec3() {}
@@ -195,9 +195,9 @@ struct TVec3<f32> : public Vec {
template<class U>
void set(const TVec3<U>& other) {
x = other.x;
y = other.y;
z = other.z;
x = (U)other.x;
y = (U)other.y;
z = (U)other.z;
}
void set(const Vec& other) {
@@ -208,9 +208,9 @@ struct TVec3<f32> : public Vec {
template<class U>
void set(U x_, U y_, U z_) {
x = x_;
y = y_;
z = z_;
x = (U)x_;
y = (U)y_;
z = (U)z_;
}
inline void add(const TVec3<f32>& b) {
@@ -359,9 +359,9 @@ struct TVec3<f32> : public Vec {
}
void cross(const TVec3<f32>& a, const TVec3<f32>& b) {
VECCrossProduct(a, b, *this);
PSVECCrossProduct(&a, &b, this);
}
f32 setLength(f32 len) {
f32 sq = squared();
if (sq <= TUtil<f32>::epsilon()) {
+1 -21
View File
@@ -79,8 +79,6 @@ public:
virtual void executeAfter(JPABaseEmitter*) {}
virtual void draw(JPABaseEmitter*) {}
virtual void drawAfter(JPABaseEmitter*) {}
//~JPAEmitterCallBack();
};
enum {
@@ -160,34 +158,16 @@ public:
mGlobalPScl.y = height;
}
void setGlobalParticleScale(const JGeometry::TVec3<f32>& scale) {
mGlobalPScl.set(scale.x, scale.y);
mGlobalPScl.set((f32)scale.x, (f32)scale.y);
}
void setGlobalParticleScale(f32 scaleX, f32 scaleY) {
mGlobalPScl.set(scaleX, scaleY);
}
void getGlobalParticleScale(JGeometry::TVec3<f32>& scale) const {
//TODO: Possible fakematch. Debug and Wii indicate TVec3::set, but using it breaks regalloc
// in dPa_gen_b_light8PcallBack::draw on GCN (where the call to set would normally be
// inlined).
#if PLATFORM_GCN
scale.x = mGlobalPScl.x;
scale.y = mGlobalPScl.y;
scale.z = 1.0f;
#else
scale.set(mGlobalPScl.x, mGlobalPScl.y, 1.0f);
#endif
}
void getGlobalParticleScale(JGeometry::TVec3<f32>* scale) const {
//TODO: Possible fakematch. Debug and Wii indicate TVec3::set, but using it breaks regalloc
// in dPa_gen_b_light8PcallBack::draw on GCN (where the call to set would normally be
// inlined).
#if PLATFORM_GCN
scale->x = mGlobalPScl.x;
scale->y = mGlobalPScl.y;
scale->z = 1.0f;
#else
scale->set(mGlobalPScl.x, mGlobalPScl.y, 1.0f);
#endif
}
void setGlobalScale(const JGeometry::TVec3<f32>& scale) {
mGlobalScl.set(scale);
+44 -32
View File
@@ -18,7 +18,7 @@ class JKRSolidHeap;
class dKy_tevstr_c;
class fopAc_ac_c;
class dPa_levelEcallBack : public JPAEmitterCallBack {
class dPa_levelEcallBack : public JPAEmitterCallBack {
public:
virtual ~dPa_levelEcallBack() { cleanup(); }
virtual void setup(JPABaseEmitter*, const cXyz*, const csXyz*, s8) = 0;
@@ -55,18 +55,17 @@ public:
/* 0x10 */ dPa_simpleData_c* mData;
}; // Size: 0x14
class dPa_modelPcallBack : public JPAParticleCallBack {
public:
virtual ~dPa_modelPcallBack() {}
virtual void draw(JPABaseEmitter*, JPABaseParticle*);
};
class dPa_windPcallBack : public JPAParticleCallBack {
public:
virtual ~dPa_windPcallBack() {}
virtual void execute(JPABaseEmitter*, JPABaseParticle*);
};
class dPa_modelPcallBack : public JPAParticleCallBack {
public:
virtual void draw(JPABaseEmitter*, JPABaseParticle*);
};
class dPa_modelEcallBack : public dPa_levelEcallBack {
public:
struct model_c {
@@ -127,7 +126,9 @@ public:
class dPa_selectTexEcallBack : public dPa_levelEcallBack {
public:
dPa_selectTexEcallBack(u8 param_0) { field_0x4 = param_0; }
dPa_selectTexEcallBack(u8 param_0) {
field_0x4 = (u8)param_0;
}
virtual ~dPa_selectTexEcallBack() {}
virtual void draw(JPABaseEmitter*);
@@ -136,6 +137,20 @@ public:
/* 0x4 */ u8 field_0x4;
};
class dPa_setColorEcallBack : public dPa_levelEcallBack {
public:
dPa_setColorEcallBack(const GXColor& color) { mColor = color; }
virtual ~dPa_setColorEcallBack() {}
virtual void draw(JPABaseEmitter* i_emitter) {
UNUSED(i_emitter);
GXSetTevColor(GX_TEVREG1, mColor);
}
virtual void setup(JPABaseEmitter*, cXyz const*, csXyz const*, s8) {}
/* 0x4 */ GXColor mColor;
};
class dPa_followEcallBack : public dPa_levelEcallBack {
public:
dPa_followEcallBack(u8 param_0 = 0, u8 param_1 = 0);
@@ -149,7 +164,7 @@ public:
void remove() { end(); }
JPABaseEmitter* getEmitter() { return mpEmitter; }
bool isEnd() {
int isEnd() {
return field_0x10 & 1;
}
@@ -171,25 +186,32 @@ public:
class dPa_light8EcallBack : public dPa_levelEcallBack {
public:
virtual ~dPa_light8EcallBack() {}
virtual void draw(JPABaseEmitter*);
virtual void drawAfter(JPABaseEmitter*) { dPa_cleanupGX(); }
virtual void drawAfter(JPABaseEmitter* i_emitter) {
UNUSED(i_emitter);
dPa_cleanupGX();
}
virtual void setup(JPABaseEmitter*, cXyz const*, csXyz const*, s8);
};
class dPa_gen_b_light8EcallBack : public dPa_levelEcallBack {
public:
virtual ~dPa_gen_b_light8EcallBack() {}
virtual void draw(JPABaseEmitter*);
virtual void drawAfter(JPABaseEmitter*) { dPa_cleanupGX(); }
virtual void drawAfter(JPABaseEmitter* i_emitter) {
UNUSED(i_emitter);
dPa_cleanupGX();
}
virtual void setup(JPABaseEmitter*, cXyz const*, csXyz const*, s8);
};
class dPa_gen_d_light8EcallBack : public dPa_levelEcallBack {
public:
virtual ~dPa_gen_d_light8EcallBack() {}
virtual void draw(JPABaseEmitter*);
virtual void drawAfter(JPABaseEmitter*) { dPa_cleanupGX(); }
virtual void drawAfter(JPABaseEmitter* i_emitter) {
UNUSED(i_emitter);
dPa_cleanupGX();
}
virtual void execute(JPABaseEmitter*);
virtual void setup(JPABaseEmitter*, cXyz const*, csXyz const*, s8);
};
@@ -247,17 +269,6 @@ private:
/* 0x14 */ cXyz const* field_0x14;
};
class dPa_setColorEcallBack : public dPa_levelEcallBack {
public:
dPa_setColorEcallBack(const GXColor& color) { mColor = color; }
virtual ~dPa_setColorEcallBack() {}
virtual void draw(JPABaseEmitter*) { GXSetTevColor(GX_TEVREG1, mColor); }
virtual void setup(JPABaseEmitter*, cXyz const*, csXyz const*, s8) {}
/* 0x4 */ GXColor mColor;
};
class dPa_simpleData_c {
public:
~dPa_simpleData_c();
@@ -295,10 +306,10 @@ public:
void onEventMove() { mStatus |= 2; }
void offEventMove() { mStatus &= ~2; }
#endif
bool isEventMove() { return mStatus & 2; }
BOOL isEventMove() { return mStatus & 2; }
void offActive() { mStatus &= (u8)~1; }
bool isActive() { return mStatus & 1; }
BOOL isActive() { return mStatus & 1; }
u16 getNameId() { return mNameId; }
dPa_levelEcallBack* getCallback() { return mCallback; }
@@ -434,7 +445,7 @@ public:
}
static JPAEmitterManager* getEmitterManager() { return mEmitterMng; }
static int getEmitterNum() { return mEmitterMng->getEmitterNumber(); };
int getEmitterNum() { return mEmitterMng->getEmitterNumber(); };
static dPa_light8PcallBack* getLight8PcallBack() {
return &mLight8PcallBack;
@@ -498,10 +509,11 @@ private:
/* 0x019 */ u8 field_0x19;
/* 0x01A */ u8 field_0x1a;
/* 0x01B */ u8 field_0x1b;
#if DEBUG
/* 0x01C */ dPa_simpleEcallBack field_0x1c[48];
#else
/* 0x01C */ dPa_simpleEcallBack field_0x1c[25];
#if DEBUG
u8 unk_0x210[0x1CC];
#endif
#endif
/* 0x210 */ level_c field_0x210;
#if DEBUG
u8 mSceneCount;
+1
View File
@@ -30,6 +30,7 @@
#include "JSystem/J2DGraph/J2DPictureEx.h" // IWYU pragma: export
#include "JSystem/J2DGraph/J2DScreen.h" // IWYU pragma: export
#include "JSystem/J2DGraph/J2DTextBoxEx.h" // IWYU pragma: export
#include "JSystem/JParticle/JPAEmitter.h" // IWYU pragma: export
#include "JSystem/JUtility/JUTFont.h" // IWYU pragma: export
#include "JSystem/JUtility/JUTReport.h" // IWYU pragma: export
+4
View File
@@ -146,6 +146,10 @@ inline void mDoMtx_quat(Mtx m, const Quaternion* q) {
MTXQuat(m, q);
}
inline void cMtx_identity(Mtx mtx) {
mDoMtx_identity(mtx);
}
inline void cMtx_inverse(const Mtx a, Mtx b) {
mDoMtx_inverse(a, b);
}