Implement some JPA inlines

This commit is contained in:
LagoLunatic
2026-08-22 16:43:46 -04:00
parent d64d8116fc
commit 863f0b22ed
6 changed files with 87 additions and 75 deletions
+12 -5
View File
@@ -320,11 +320,12 @@ public:
f32 getFrame() { return mTick.getFrame(); }
void drawEmitterCallBack() { drawCB(); }
void drawCB() { if (mpEmitterCallBack != NULL) mpEmitterCallBack->draw(this); }
void calcEmitterGlobalTranslation(JGeometry::TVec3<f32>& out) { calcEmitterGlobalPosition(out); }
// TODO
void calcEmitterGlobalTranslation(JGeometry::TVec3<f32>&) {}
void drawCB() {}
void drawEmitterCallBack() {}
void getgReRDirection(JGeometry::TVec3<f32>&) {}
void setEmitterRotation(const JGeometry::TVec3<s16>&) {}
static JPAEmitterInfo emtrInfo;
@@ -344,6 +345,9 @@ public:
s32 getCurrentCreateNumber() const {
return emtrInfo.mVolumeEmitCount;
}
void getgReRDirection(JGeometry::TVec3<f32>& out) {
out.set(emtrInfo.mgReRDir);
}
static f32 getAspect() { return emtrInfo.mAspect; }
static f32 getFovy() { return emtrInfo.mFovy; }
@@ -358,7 +362,10 @@ private:
mpEmitterCallBack->execute(this);
}
public:
private:
friend class JPAEmitterManager;
friend class JPABaseParticle;
/* 0x000 */ VolumeFunc mVolumeFunc;
/* 0x00C */ JGeometry::TVec3<f32> mEmitterScale;
/* 0x018 */ JGeometry::TVec3<f32> mEmitterTranslation;
+10 -4
View File
@@ -65,7 +65,6 @@ public:
void getLocalPosition(JGeometry::TVec3<f32>& out) const { out.set(mLocalPosition); }
void getGlobalPosition(JGeometry::TVec3<f32>& out) const { out.set(mGlobalPosition); }
void getVelVec(JGeometry::TVec3<f32>& out) const { out.set(mVelocity); }
s32 getAge() const { return mCurFrame; } // TODO: Not sure about this one, especially the cast to s32; this could also be mCurNormTime?
void calcCB(JPABaseEmitter* emtr) { if (mpCallBack2 != NULL) mpCallBack2->execute(emtr, this); }
void drawCB(JPABaseEmitter* emtr) { if (mpCallBack2 != NULL) mpCallBack2->draw(emtr, this); }
void setCallBackPtr(JPACallBackBase2<JPABaseEmitter*, JPABaseParticle*>* cb) { mpCallBack2 = cb; }
@@ -78,12 +77,19 @@ public:
bool isInvisibleParticle() { return checkStatus(JPAPtclStts_Invisible); }
void setInvisibleParticleFlag() { setStatus(JPAPtclStts_Invisible); }
// TODO: this implementation (cast f32 -> int) is too small to match the size in the debug map (0x38)
// debug size could be matched by casting f32 -> int -> f32, but that doesn't actually match the code
int getAge() const { return (int)mCurFrame; }
// TODO: does this get mCurNormTime instead of mLifeTime...?
void getLifeTime() const {}
JPADrawParams* getDrawParamPPtr() { return &mDrawParams; }
void getDrawParamCPtr() {}
// TODO
void getWidth() {}
void getHeight() {}
void getLifeTime() const {}
public:
/* 0x00 */ JSULink<JPABaseParticle> mLink;
@@ -97,9 +103,9 @@ public:
/* 0x64 */ JGeometry::TVec3<f32> mFieldAccel;
/* 0x70 */ f32 mAirResist;
/* 0x74 */ f32 mMoment;
/* 0x78 */ f32 mCurFrame;
/* 0x78 */ f32 mCurFrame; // mAge?
/* 0x7C */ f32 mLifeTime;
/* 0x80 */ f32 mCurNormTime;
/* 0x80 */ f32 mCurNormTime; // mTime?
/* 0x84 */ f32 mFieldDrag;
/* 0x88 */ f32 mDrag;
/* 0x8C */ JPADrawParams mDrawParams;
+51 -52
View File
@@ -85,7 +85,7 @@ void JPADrawExecGenPrjTexMtx::exec(const JPADrawContext* pDC) {
f32 transY = tick * pDC->pbsp->getTexScrollTransY() + pDC->pbsp->getTexStaticTransY();
f32 scaleX = tick * pDC->pbsp->getTexScrollScaleX() + pDC->pbsp->getTexStaticScaleX();
f32 scaleY = tick * pDC->pbsp->getTexScrollScaleY() + pDC->pbsp->getTexStaticScaleY();
s32 angle = 0x8000 * (tick * pDC->pbsp->getTexScrollRotate());
int angle = 0x8000 * (tick * pDC->pbsp->getTexScrollRotate());
f32 sin = JMASSin(angle);
f32 cos = JMASCos(angle);
@@ -126,14 +126,14 @@ void JPADrawExecGenIdtMtx::exec(const JPADrawContext* pDC) {
/* 8025FFB0-802602F0 .text exec__20JPADrawExecSetTexMtxFPC14JPADrawContext */
void JPADrawExecSetTexMtx::exec(const JPADrawContext* pDC) {
s32 tick = pDC->pbe->getFrame();
int tick = pDC->pbe->getFrame();
f32 tilingX = 0.5f * pDC->pbsp->getTilingX();
f32 tilingY = 0.5f * pDC->pbsp->getTilingY();
f32 transX = tick * pDC->pbsp->getTexScrollTransX() + pDC->pbsp->getTexStaticTransX();
f32 transY = tick * pDC->pbsp->getTexScrollTransY() + pDC->pbsp->getTexStaticTransY();
f32 scaleX = tick * pDC->pbsp->getTexScrollScaleX() + pDC->pbsp->getTexStaticScaleX();
f32 scaleY = tick * pDC->pbsp->getTexScrollScaleY() + pDC->pbsp->getTexStaticScaleY();
s32 angle = 0x8000 * (tick * pDC->pbsp->getTexScrollRotate());
int angle = 0x8000 * (tick * pDC->pbsp->getTexScrollRotate());
f32 sin = JMASSin(angle);
f32 cos = JMASCos(angle);
@@ -250,14 +250,14 @@ void JPADrawExecRegisterPrmAEnv::exec(const JPADrawContext* pDC, JPABaseParticle
/* 80260858-80260B68 .text exec__20JPADrawExecSetTexMtxFPC14JPADrawContextP15JPABaseParticle */
void JPADrawExecSetTexMtx::exec(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
s32 tick = ptcl->getAge();
int tick = ptcl->getAge();
f32 tilingX = 0.5f * pDC->pbsp->getTilingX();
f32 tilingY = 0.5f * pDC->pbsp->getTilingY();
f32 transX = tick * pDC->pbsp->getTexScrollTransX() + pDC->pbsp->getTexStaticTransX();
f32 transY = tick * pDC->pbsp->getTexScrollTransY() + pDC->pbsp->getTexStaticTransY();
f32 scaleX = tick * pDC->pbsp->getTexScrollScaleX() + pDC->pbsp->getTexStaticScaleX();
f32 scaleY = tick * pDC->pbsp->getTexScrollScaleY() + pDC->pbsp->getTexStaticScaleY();
s32 angle = 0x8000 * (tick * pDC->pbsp->getTexScrollRotate());
int angle = 0x8000 * (tick * pDC->pbsp->getTexScrollRotate());
f32 sin = JMASSin(angle);
f32 cos = JMASCos(angle);
@@ -302,7 +302,7 @@ void JPADrawExecBillBoard::exec(const JPADrawContext* pDC, JPABaseParticle* ptcl
JGeometry::TVec3<f32> pt;
ptcl->getGlobalPosition(pt);
MTXMultVec(JPADrawContext::pcb->mDrawMtxPtr, pt, &pt);
MTXMultVec(JPADrawContext::pcb->mDrawMtxPtr, &pt, &pt);
GXBegin(GX_QUADS, GX_VTXFMT0, 4);
GXPosition3f32(-scaleX + pt.x, +scaleY + pt.y, pt.z);
@@ -336,7 +336,7 @@ void JPADrawExecRotBillBoard::exec(const JPADrawContext* pDC, JPABaseParticle* p
JGeometry::TVec3<f32> pt;
ptcl->getGlobalPosition(pt);
MTXMultVec(JPADrawContext::pcb->mDrawMtxPtr, pt, &pt);
MTXMultVec(JPADrawContext::pcb->mDrawMtxPtr, &pt, &pt);
GXBegin(GX_QUADS, GX_VTXFMT0, 4);
GXPosition3f32((x0 * cos - y0 * sin) + pt.x, (x0 * sin + y0 * cos) + pt.y, pt.z);
@@ -373,7 +373,7 @@ void JPADrawExecYBillBoard::exec(const JPADrawContext* pDC, JPABaseParticle* ptc
JGeometry::TVec3<f32> pos;
ptcl->getGlobalPosition(pos);
MTXMultVecSR(JPADrawContext::pcb->mDrawMtxPtr, pos, &pos);
MTXMultVecSR(JPADrawContext::pcb->mDrawMtxPtr, &pos, &pos);
GXBegin(GX_QUADS, GX_VTXFMT0, 4);
GXPosition3f32(pt[0].x + pos.x, pt[0].y + pos.y, pt[0].z + pos.z);
@@ -410,7 +410,7 @@ void JPADrawExecRotYBillBoard::exec(const JPADrawContext* pDC, JPABaseParticle*
JGeometry::TVec3<f32> pos;
ptcl->getGlobalPosition(pos);
MTXMultVecSR(JPADrawContext::pcb->mDrawMtxPtr, pos, &pos);
MTXMultVecSR(JPADrawContext::pcb->mDrawMtxPtr, &pos, &pos);
GXBegin(GX_QUADS, GX_VTXFMT0, 4);
GXPosition3f32(pt[0].x + pos.x, pt[0].y + pos.y, pt[0].z + pos.z);
@@ -442,7 +442,7 @@ void dirTypePosInv(JPABaseParticle* ptcl, JPABaseEmitter* emtr, JGeometry::TVec3
/* 802613C4-802613E8 .text dirTypeEmtrDir__FP15JPABaseParticleP14JPABaseEmitterRQ29JGeometry8TVec3<f> */
void dirTypeEmtrDir(JPABaseParticle* ptcl, JPABaseEmitter* emtr, JGeometry::TVec3<f32>& out) {
out.set(JPABaseEmitter::emtrInfo.mgReRDir);
emtr->getgReRDirection(out);
}
/* 802613E8-802614A8 .text dirTypePrevPtcl__FP15JPABaseParticleP14JPABaseEmitterRQ29JGeometry8TVec3<f> */
@@ -453,7 +453,7 @@ void dirTypePrevPtcl(JPABaseParticle* ptcl, JPABaseEmitter* emtr, JGeometry::TVe
if (prev != NULL) {
prev->getObject()->getGlobalPosition(out);
} else {
emtr->calcEmitterGlobalPosition(out);
emtr->calcEmitterGlobalTranslation(out);
}
out.x -= pos.x;
out.y -= pos.y;
@@ -877,7 +877,7 @@ void JPADrawExecDirBillBoard::exec(const JPADrawContext* pDC, JPABaseParticle* p
if (dir.isZero())
return;
dir.normalize();
MTXMultVecSR(JPADrawContext::pcb->mDrawMtxPtr, dir, &dir);
MTXMultVecSR(JPADrawContext::pcb->mDrawMtxPtr, &dir, &dir);
JPADrawParams* params = ptcl->getDrawParamPPtr();
f32 dirY = dir.y;
@@ -908,7 +908,7 @@ void JPADrawExecDirBillBoard::exec(const JPADrawContext* pDC, JPABaseParticle* p
JGeometry::TVec3<f32> pos;
ptcl->getGlobalPosition(pos);
MTXMultVec(JPADrawContext::pcb->mDrawMtxPtr, pos, &pos);
MTXMultVec(JPADrawContext::pcb->mDrawMtxPtr, &pos, &pos);
GXBegin(GX_QUADS, GX_VTXFMT0, 4);
GXPosition3f32(p0.x + pos.x, p0.y + pos.y, pos.z);
@@ -1327,24 +1327,24 @@ void JPADrawCalcColorEnv::calc(const JPADrawContext* pDC) {
/* 802647E0-8026486C .text calc__30JPADrawCalcColorAnmFrameNormalFPC14JPADrawContext */
void JPADrawCalcColorAnmFrameNormal::calc(const JPADrawContext* pDC) {
s32 tick = pDC->pbe->getFrame();
s32 frame = (tick < pDC->pbsp->getColorRegAnmMaxFrm()) ? tick : pDC->pbsp->getColorRegAnmMaxFrm();
int tick = pDC->pbe->getFrame();
int frame = (tick < pDC->pbsp->getColorRegAnmMaxFrm()) ? tick : pDC->pbsp->getColorRegAnmMaxFrm();
JPADrawContext::pcb->mColorAnmFrame = frame;
}
/* 8026486C-802648E0 .text calc__30JPADrawCalcColorAnmFrameRepeatFPC14JPADrawContext */
void JPADrawCalcColorAnmFrameRepeat::calc(const JPADrawContext* pDC) {
f32 tick = pDC->pbe->getFrame();
s32 frame = ((u32)tick) % (pDC->pbsp->getColorRegAnmMaxFrm() + 1);
int frame = ((u32)tick) % (pDC->pbsp->getColorRegAnmMaxFrm() + 1);
JPADrawContext::pcb->mColorAnmFrame = frame;
}
/* 802648E0-8026495C .text calc__31JPADrawCalcColorAnmFrameReverseFPC14JPADrawContext */
void JPADrawCalcColorAnmFrameReverse::calc(const JPADrawContext* pDC) {
s32 tick = pDC->pbe->getFrame();
s32 maxFrame = pDC->pbsp->getColorRegAnmMaxFrm();
s32 odd = (tick / maxFrame) & 1; // whether we're on an even or odd loop
s32 frame = tick % maxFrame;
int tick = pDC->pbe->getFrame();
int maxFrame = pDC->pbsp->getColorRegAnmMaxFrm();
int odd = (tick / maxFrame) & 1; // whether we're on an even or odd loop
int frame = tick % maxFrame;
JPADrawContext::pcb->mColorAnmFrame = frame + (odd * maxFrame) - 2 * (odd * frame);
}
@@ -1360,23 +1360,23 @@ void JPADrawCalcColorAnmFrameRandom::calc(const JPADrawContext* pDC) {
/* 8026497C-80264A34 .text calc__32JPADrawCalcTextureAnmIndexNormalFPC14JPADrawContext */
void JPADrawCalcTextureAnmIndexNormal::calc(const JPADrawContext* pDC) {
s32 tick = pDC->pbe->getFrame();
s32 idx = ((pDC->pbsp->getTextureAnmKeyNum() - 1) < tick) ? pDC->pbsp->getTextureAnmKeyNum() - 1 : tick;
int tick = pDC->pbe->getFrame();
int idx = ((pDC->pbsp->getTextureAnmKeyNum() - 1) < tick) ? pDC->pbsp->getTextureAnmKeyNum() - 1 : tick;
pDC->mpDraw->mTexIdx = pDC->pTexIdx[pDC->pbsp->getTextureIndex(idx)];
}
/* 80264A34-80264AD0 .text calc__32JPADrawCalcTextureAnmIndexRepeatFPC14JPADrawContext */
void JPADrawCalcTextureAnmIndexRepeat::calc(const JPADrawContext* pDC) {
s32 tick = pDC->pbe->getFrame();
int tick = pDC->pbe->getFrame();
pDC->mpDraw->mTexIdx = pDC->pTexIdx[pDC->pbsp->getTextureIndex(tick % pDC->pbsp->getTextureAnmKeyNum())];
}
/* 80264AD0-80264B80 .text calc__33JPADrawCalcTextureAnmIndexReverseFPC14JPADrawContext */
void JPADrawCalcTextureAnmIndexReverse::calc(const JPADrawContext* pDC) {
s32 tick = pDC->pbe->getFrame();
s32 maxFrame = pDC->pbsp->getTextureAnmKeyNum() - 1;
s32 odd = (tick / maxFrame) & 1; // whether we're on an even or odd loop
s32 frame = tick % maxFrame;
int tick = pDC->pbe->getFrame();
int maxFrame = pDC->pbsp->getTextureAnmKeyNum() - 1;
int odd = (tick / maxFrame) & 1; // whether we're on an even or odd loop
int frame = tick % maxFrame;
pDC->mpDraw->mTexIdx = pDC->pTexIdx[pDC->pbsp->getTextureIndex(frame + (odd * maxFrame) - 2 * (odd * frame))];
}
@@ -1392,8 +1392,7 @@ void JPADrawCalcTextureAnmIndexRandom::calc(const JPADrawContext* pDC) {
/* 80264C10-80264C4C .text exec__19JPADrawExecCallBackFPC14JPADrawContext */
void JPADrawExecCallBack::exec(const JPADrawContext* pDC) {
if (pDC->pbe->mpEmitterCallBack != NULL)
pDC->pbe->mpEmitterCallBack->draw(pDC->pbe);
pDC->pbe->drawEmitterCallBack();
}
/* 80264C4C-80264C88 .text exec__19JPADrawExecCallBackFPC14JPADrawContextP15JPABaseParticle */
@@ -1512,43 +1511,43 @@ void JPADrawCalcColorCopyFromEmitter::calc(const JPADrawContext* pDC, JPABasePar
/* 802657E8-80265880 .text calc__30JPADrawCalcColorAnmFrameNormalFPC14JPADrawContextP15JPABaseParticle */
void JPADrawCalcColorAnmFrameNormal::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
s32 frame = (ptcl->getAge() < pDC->pbsp->getColorRegAnmMaxFrm()) ? ptcl->getAge() : pDC->pbsp->getColorRegAnmMaxFrm();
int frame = (ptcl->getAge() < pDC->pbsp->getColorRegAnmMaxFrm()) ? ptcl->getAge() : pDC->pbsp->getColorRegAnmMaxFrm();
JPADrawContext::pcb->mColorAnmFrame = frame;
}
/* 80265880-80265918 .text calc__30JPADrawCalcColorAnmFrameRepeatFPC14JPADrawContextP15JPABaseParticle */
void JPADrawCalcColorAnmFrameRepeat::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
JPADrawParams* params = ptcl->getDrawParamPPtr();
s32 tick = ptcl->getAge();
s32 frame = ((params->mLoopOffset & pDC->pbsp->getColLoopOffset()) + tick) % (pDC->pbsp->getColorRegAnmMaxFrm() + 1);
int tick = ptcl->getAge();
int frame = ((params->mLoopOffset & pDC->pbsp->getColLoopOffset()) + tick) % (pDC->pbsp->getColorRegAnmMaxFrm() + 1);
JPADrawContext::pcb->mColorAnmFrame = frame;
}
/* 80265918-802659C4 .text calc__31JPADrawCalcColorAnmFrameReverseFPC14JPADrawContextP15JPABaseParticle */
void JPADrawCalcColorAnmFrameReverse::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
JPADrawParams* params = ptcl->getDrawParamPPtr();
s32 loopOffset = pDC->pbsp->getColLoopOffset();
int loopOffset = pDC->pbsp->getColLoopOffset();
loopOffset = params->mLoopOffset & loopOffset;
s32 maxFrame = pDC->pbsp->getColorRegAnmMaxFrm();
s32 t = loopOffset + ptcl->getAge();
s32 odd = (t / maxFrame) & 1;
s32 frame = t % maxFrame;
int maxFrame = pDC->pbsp->getColorRegAnmMaxFrm();
int t = loopOffset + ptcl->getAge();
int odd = (t / maxFrame) & 1;
int frame = t % maxFrame;
JPADrawContext::pcb->mColorAnmFrame = frame + (odd * maxFrame) - 2 * (odd * frame);
}
/* 802659C4-80265A90 .text calc__29JPADrawCalcColorAnmFrameMergeFPC14JPADrawContextP15JPABaseParticle */
void JPADrawCalcColorAnmFrameMerge::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
JPADrawParams* params = ptcl->getDrawParamPPtr();
s32 start = params->mLoopOffset & pDC->pbsp->getColLoopOffset();
s32 maxFrame = pDC->pbsp->getColorRegAnmMaxFrm() + 1;
s32 frame = (s32)(start + maxFrame * ptcl->mCurNormTime) % maxFrame;
int start = params->mLoopOffset & pDC->pbsp->getColLoopOffset();
int maxFrame = pDC->pbsp->getColorRegAnmMaxFrm() + 1;
int frame = (int)(start + maxFrame * ptcl->mCurNormTime) % maxFrame;
JPADrawContext::pcb->mColorAnmFrame = frame;
}
/* 80265A90-80265B14 .text calc__30JPADrawCalcColorAnmFrameRandomFPC14JPADrawContextP15JPABaseParticle */
void JPADrawCalcColorAnmFrameRandom::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
JPADrawParams* params = ptcl->getDrawParamPPtr();
s32 frame = (params->mLoopOffset & pDC->pbsp->getColLoopOffset()) % (pDC->pbsp->getColorRegAnmMaxFrm() + 1);
int frame = (params->mLoopOffset & pDC->pbsp->getColLoopOffset()) % (pDC->pbsp->getColorRegAnmMaxFrm() + 1);
JPADrawContext::pcb->mColorAnmFrame = frame;
}
@@ -1605,14 +1604,14 @@ void JPADrawCalcAlphaFlickMultSin::calc(const JPADrawContext* pDC, JPABasePartic
/* 80266048-80266100 .text calc__32JPADrawCalcTextureAnmIndexNormalFPC14JPADrawContextP15JPABaseParticle */
void JPADrawCalcTextureAnmIndexNormal::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
JPADrawParams* params = ptcl->getDrawParamPPtr();
s32 idx = ((pDC->pbsp->getTextureAnmKeyNum() - 1) < (s32)ptcl->getAge()) ? (pDC->pbsp->getTextureAnmKeyNum() - 1) : ptcl->getAge();
int idx = ((pDC->pbsp->getTextureAnmKeyNum() - 1) < (int)ptcl->getAge()) ? (pDC->pbsp->getTextureAnmKeyNum() - 1) : ptcl->getAge();
params->mTexIdx = pDC->pTexIdx[pDC->pbsp->getTextureIndex(idx)];
}
/* 80266100-802661B4 .text calc__32JPADrawCalcTextureAnmIndexRepeatFPC14JPADrawContextP15JPABaseParticle */
void JPADrawCalcTextureAnmIndexRepeat::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
JPADrawParams* params = ptcl->getDrawParamPPtr();
s32 tick = ptcl->getAge();
int tick = ptcl->getAge();
params->mTexIdx =
pDC->pTexIdx[pDC->pbsp->getTextureIndex(((params->mLoopOffset & pDC->pbsp->getTexLoopOffset()) + tick) % pDC->pbsp->getTextureAnmKeyNum())];
}
@@ -1620,28 +1619,28 @@ void JPADrawCalcTextureAnmIndexRepeat::calc(const JPADrawContext* pDC, JPABasePa
/* 802661B4-80266284 .text calc__33JPADrawCalcTextureAnmIndexReverseFPC14JPADrawContextP15JPABaseParticle */
void JPADrawCalcTextureAnmIndexReverse::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
JPADrawParams* params = ptcl->getDrawParamPPtr();
s32 loopOffset = pDC->pbsp->getTexLoopOffset();
int loopOffset = pDC->pbsp->getTexLoopOffset();
loopOffset = params->mLoopOffset & loopOffset;
s32 maxFrame = pDC->pbsp->getTextureAnmKeyNum() - 1;
s32 t = loopOffset + ptcl->getAge();
s32 odd = (t / maxFrame) & 1;
s32 frame = t % maxFrame;
int maxFrame = pDC->pbsp->getTextureAnmKeyNum() - 1;
int t = loopOffset + ptcl->getAge();
int odd = (t / maxFrame) & 1;
int frame = t % maxFrame;
params->mTexIdx = pDC->pTexIdx[pDC->pbsp->getTextureIndex(frame + (odd * maxFrame) - 2 * (odd * frame))];
}
/* 80266284-8026636C .text calc__31JPADrawCalcTextureAnmIndexMergeFPC14JPADrawContextP15JPABaseParticle */
void JPADrawCalcTextureAnmIndexMerge::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
JPADrawParams* params = ptcl->getDrawParamPPtr();
s32 maxFrame = pDC->pbsp->getTextureAnmKeyNum();
s32 start = params->mLoopOffset & pDC->pbsp->getTexLoopOffset();
s32 frame = (s32)(start + maxFrame * ptcl->mCurNormTime) % maxFrame;
int maxFrame = pDC->pbsp->getTextureAnmKeyNum();
int start = params->mLoopOffset & pDC->pbsp->getTexLoopOffset();
int frame = (int)(start + maxFrame * ptcl->mCurNormTime) % maxFrame;
params->mTexIdx = pDC->pTexIdx[pDC->pbsp->getTextureIndex(frame)];
}
/* 8026636C-8026640C .text calc__32JPADrawCalcTextureAnmIndexRandomFPC14JPADrawContextP15JPABaseParticle */
void JPADrawCalcTextureAnmIndexRandom::calc(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
JPADrawParams* params = ptcl->getDrawParamPPtr();
s32 start = params->mLoopOffset & pDC->pbsp->getTexLoopOffset();
int start = params->mLoopOffset & pDC->pbsp->getTexLoopOffset();
params->mTexIdx = pDC->pTexIdx[pDC->pbsp->getTextureIndex(start % pDC->pbsp->getTextureAnmKeyNum())];
}
+9 -9
View File
@@ -207,7 +207,7 @@ void JPABaseEmitter::calcEmitterInfo() {
Mtx mtxScale, mtxRot, mtx;
MTXScale(mtxScale, mEmitterScale.x, mEmitterScale.y, mEmitterScale.z);
JPAGetXYZRotateMtx((mEmitterRot.x << 14) / 0x5a, (mEmitterRot.y << 14) / 0x5a, (mEmitterRot.z << 14) / 0x5a, mtxRot);
JPAGetXYZRotateMtx((mEmitterRot.x * 0x4000) / 90, (mEmitterRot.y * 0x4000) / 90, (mEmitterRot.z * 0x4000) / 90, mtxRot);
MTXScale(mtx, mGlobalDynamicsScale.x, mGlobalDynamicsScale.y, mGlobalDynamicsScale.z);
MTXConcat(mGlobalRotation, mtx, mtx);
@@ -250,7 +250,7 @@ void JPABaseEmitter::calc() {
/* 8025D3C0-8025D5D4 .text calcCreatePtcls__14JPABaseEmitterFv */
void JPABaseEmitter::calcCreatePtcls() {
if (checkStatus(JPAEmtrStts_RateStepEmit)) {
s32 emitCount = 0;
int emitCount = 0;
if (checkEmDataFlag(JPADynFlag_FixedInterval)) {
emitCount = (mVolumeType == 1) ?
(mDivNumber + 1) * (mDivNumber - 1) * 4 + 6 : // Sphere
@@ -274,7 +274,7 @@ void JPABaseEmitter::calcCreatePtcls() {
if (checkStatus(JPAEmtrStts_StopEmit))
emitCount = 0;
for (s32 i = 0; i < emitCount; i++) {
for (int i = 0; i < emitCount; i++) {
JPABaseParticle* ptcl = createParticle();
if (ptcl == NULL)
break;
@@ -292,8 +292,8 @@ void JPABaseEmitter::calcCreatePtcls() {
/* 8025D5D4-8025D670 .text createChildren__14JPABaseEmitterFP15JPABaseParticle */
void JPABaseEmitter::createChildren(JPABaseParticle* ptcl) {
s32 num = getEmitterDataBlockInfoPtr()->getSweepShape()->getRate();
for (s32 i = 0; i < num; i++) {
int num = getEmitterDataBlockInfoPtr()->getSweepShape()->getRate();
for (int i = 0; i < num; i++) {
JPABaseParticle * chld = getPtclFromVacList();
if (chld == NULL)
break;
@@ -368,14 +368,14 @@ void JPABaseEmitter::calcChild() {
/* 8025D8CC-8025DA90 .text calcKey__14JPABaseEmitterFv */
void JPABaseEmitter::calcKey() {
for (s32 i = 0; i < getEmitterDataBlockInfoPtr()->getKeyNum(); i++) {
for (int i = 0; i < getEmitterDataBlockInfoPtr()->getKeyNum(); i++) {
JPAKeyBlock* key = getEmitterDataBlockInfoPtr()->getKey()[i];
f32 tick = mTick.getFrame();
const f32* dataPtr = key->getKeyDataPtr();
u32 dataNum = key->getNumber();
if (key->isLoopEnable()) {
s32 tickMax = (s32)(dataPtr[(dataNum - 1) * 4]) + 1;
s32 numLoops = (s32)tick / tickMax;
int tickMax = (int)(dataPtr[(dataNum - 1) * 4]) + 1;
int numLoops = (int)tick / tickMax;
tick -= numLoops * tickMax;
}
f32 value = JPAGetKeyFrameValue(tick, dataNum, dataPtr);
@@ -474,7 +474,7 @@ void JPABaseEmitter::calcEmitterGlobalPosition(JGeometry::TVec3<float>& dst) {
void JPABaseEmitter::calcgReRDirection() {
// gReR = globalRotation emitterRotation
Mtx mtx;
JPAGetXYZRotateMtx((mEmitterRot.x << 14) / 0x5a, (mEmitterRot.y << 14) / 0x5a, (mEmitterRot.z << 14) / 0x5a, mtx);
JPAGetXYZRotateMtx((mEmitterRot.x * 0x4000) / 90, (mEmitterRot.y * 0x4000) / 90, (mEmitterRot.z * 0x4000) / 90, mtx);
MTXConcat(mGlobalRotation, mtx, mtx);
MTXMultVec(mtx, mEmitterDir, emtrInfo.mgReRDir);
}
+2 -2
View File
@@ -44,7 +44,7 @@ void JPABaseField::loadFieldData(JPAFieldData* data, JPAFieldBlock* block) {
void JPABaseField::calcVel(JPAFieldData* data, JPABaseParticle* ptcl) {
JGeometry::TVec3<f32> vel = data->mVel;
if (!(ptcl->mStatus & 0x04)) {
if (!ptcl->checkStatus(JPAPtlcStts_Child)) {
f32 fadeAffect = calcFadeAffect(data, ptcl->mCurNormTime);
vel.scale(fadeAffect);
}
@@ -295,7 +295,7 @@ void JPAConvectionField::calc(JPAFieldData* data, JPABaseParticle* ptcl) {
/* 8025B3CC-8025B50C .text calc__14JPARandomFieldFP12JPAFieldDataP15JPABaseParticle */
void JPARandomField::calc(JPAFieldData* data, JPABaseParticle* ptcl) {
s32 frame = ptcl->getAge();
int frame = ptcl->getAge();
if (frame != 0) {
if (data->mCycle == 0)
return;
+3 -3
View File
@@ -1274,7 +1274,7 @@ void dPa_trackEcallBack::execute(JPABaseEmitter* emitter) {
}
emitter->setGlobalAlpha(local_38);
}
for (JSULink<JPABaseParticle>* link = emitter->mActiveParticles.getFirst(); link;) {
for (JSULink<JPABaseParticle>* link = emitter->getParticleList()->getFirst(); link;) {
JSULink<JPABaseParticle>* next = link->getNext();
JPABaseParticle* particle = link->getObject();
JGeometry::TVec3<f32> local_2c;
@@ -1288,7 +1288,7 @@ void dPa_trackEcallBack::execute(JPABaseEmitter* emitter) {
/* 8007F3BC-8007F62C .text draw__18dPa_trackEcallBackFP14JPABaseEmitter */
void dPa_trackEcallBack::draw(JPABaseEmitter* emitter) {
/* Nonmatching - regalloc, instruction order */
u32 r28 = emitter->mActiveParticles.getNumLinks();
u32 r28 = emitter->getParticleList()->getNumLinks();
if (r28 < 6) {
return;
}
@@ -1304,7 +1304,7 @@ void dPa_trackEcallBack::draw(JPABaseEmitter* emitter) {
local_bc[1][3] = mExTransY * emitter->getFrame();
GXLoadTexMtxImm(local_bc, GX_TEXMTX1, GX_MTX2x4);
GXSetTexCoordGen(GX_TEXCOORD1, GX_TG_MTX2x4, GX_TG_TEX0, GX_TEXMTX1);
JSULink<JPABaseParticle>* link = emitter->mActiveParticles.getFirst();
JSULink<JPABaseParticle>* link = emitter->getParticleList()->getFirst();
u32 i = 0;
f32 f31 = 0.0f;
for (; i < r28; i++) {