Implement some more JPAEmitter inlines

This commit is contained in:
LagoLunatic
2026-05-26 22:18:04 -04:00
parent 2dced07761
commit bafd8aba62
10 changed files with 44 additions and 38 deletions
+6 -3
View File
@@ -307,6 +307,7 @@ public:
bool isZDraw() { return mDraw.isZDraw(); }
bool isChildDraw() { return mDraw.isChildDraw(); }
MtxP getCamMtxPtr() { return mDraw.getCamMtxPtr(); }
void loadTexture(u8 texNo, GXTexMapID map) { mDraw.loadTexture(texNo, map); }
f32 getRandomF() { return mRandomSeed.get_ufloat_1(); }
f32 getRandomRF() { f32 x = mRandomSeed.get_ufloat_1(); return x + x - 1.0f; }
@@ -316,15 +317,14 @@ public:
u32 getUserWork() { return mUserData; }
void setUserWork(u32 work) { mUserData = work; }
f32 getFrame() { return mTick.getFrame(); }
// TODO
void calcEmitterGlobalTranslation(JGeometry::TVec3<f32>&) {}
void drawCB() {}
void drawEmitterCallBack() {}
void getCurrentCreateNumber() const {}
f32 getFrame() { return mTick.getFrame(); }
void getgReRDirection(JGeometry::TVec3<f32>&) {}
void isContinuousParticle() {}
void loadTexture(u8, GXTexMapID) {}
void setEmitterRotation(const JGeometry::TVec3<s16>&) {}
static JPAEmitterInfo emtrInfo;
@@ -341,6 +341,9 @@ public:
// Same as above comment, this implementation could be fake.
vec.set(emtrInfo.mEmitterGlobalRot[0][1], emtrInfo.mEmitterGlobalRot[1][1], emtrInfo.mEmitterGlobalRot[2][1]);
}
s32 getCurrentCreateNumber() const {
return emtrInfo.mVolumeEmitCount;
}
static f32 getAspect() { return emtrInfo.mAspect; }
static f32 getFovy() { return emtrInfo.mFovy; }
+8 -8
View File
@@ -80,7 +80,7 @@ void JPADrawExecGenPrjTexMtx::exec(const JPADrawContext* pDC) {
f32 fovy = JPABaseEmitter::getFovy();
C_MTXLightPerspective(projMtx, fovy, aspect, 0.5f, -0.5f, 0.5f, 0.5f);
f32 tick = pDC->pbe->mTick.getFrame();
f32 tick = pDC->pbe->getFrame();
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();
@@ -126,7 +126,7 @@ void JPADrawExecGenIdtMtx::exec(const JPADrawContext* pDC) {
/* 8025FFB0-802602F0 .text exec__20JPADrawExecSetTexMtxFPC14JPADrawContext */
void JPADrawExecSetTexMtx::exec(const JPADrawContext* pDC) {
s32 tick = pDC->pbe->mTick.getFrame();
s32 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();
@@ -747,21 +747,21 @@ void JPADrawCalcColorEnv::calc(const JPADrawContext* pDC) {
/* 802647E0-8026486C .text calc__30JPADrawCalcColorAnmFrameNormalFPC14JPADrawContext */
void JPADrawCalcColorAnmFrameNormal::calc(const JPADrawContext* pDC) {
s32 tick = pDC->pbe->mTick.getFrame();
s32 tick = pDC->pbe->getFrame();
s32 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->mTick.getFrame();
f32 tick = pDC->pbe->getFrame();
s32 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->mTick.getFrame();
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;
@@ -780,20 +780,20 @@ void JPADrawCalcColorAnmFrameRandom::calc(const JPADrawContext* pDC) {
/* 8026497C-80264A34 .text calc__32JPADrawCalcTextureAnmIndexNormalFPC14JPADrawContext */
void JPADrawCalcTextureAnmIndexNormal::calc(const JPADrawContext* pDC) {
s32 tick = pDC->pbe->mTick.getFrame();
s32 tick = pDC->pbe->getFrame();
s32 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->mTick.getFrame();
s32 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->mTick.getFrame();
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;
+1 -1
View File
@@ -26,7 +26,7 @@ void JPABaseParticle::initParticle() {
mFieldDrag = 1.0f;
mDrag = 1.0f;
MTXMultVec(emtrInfo.mEmitterGlobalSR, emtrInfo.mVolumePos, mLocalPosition);
if ((emtr->mDataFlag & JPADynFlag_FollowEmtr) != 0)
if (emtr->checkEmDataFlag(JPADynFlag_FollowEmtr))
setStatus(JPAPtclStts_UNK_20);
mOffsetPosition.set(emtrInfo.mEmitterGlobalCenter);
+5 -5
View File
@@ -716,20 +716,20 @@ BOOL himo2_bg_check(himo2_class* i_this) {
NULL
);
if (pJVar5 != NULL) {
pJVar5->mSpread = 0.2f;
pJVar5->mVolumeSweep = 0.15f;
pJVar5->setSpread(0.2f);
pJVar5->setVolumeSweep(0.15f);
}
} else {
local_38.x = local_38.x + 0x4000;
pJVar5 = dComIfGp_particle_set(dPa_name::ID_AK_JN_ELEMENTHIBANA00, &actor->current.pos, &local_38);
if (pJVar5 != NULL) {
pJVar5->mInitialVelAxis = 15.0f;
pJVar5->setAwayFromAxisSpeed(15.0f);
}
dKy_Sound_set(actor->current.pos, 100, fopAcM_GetID(actor), 5);
}
if (pJVar5 != NULL) {
pJVar5->mRate = 8.0f;
pJVar5->mMaxFrame = 1;
pJVar5->setRate(8.0f);
pJVar5->setMaxFrame(1);
}
}
return true;
+1 -1
View File
@@ -323,7 +323,7 @@ BOOL daNpc_Fa1_c::_execute() {
setPointLightParam();
}
if (isLinkMode() && mpEmitter != NULL) {
mpEmitter->mRate = 1.0f;
mpEmitter->setRate(1.0f);
}
dComIfGp_att_LookRequest(this, 400.0f, 300.0f, -300.0f, 0x6000, 1);
return TRUE;
+2 -2
View File
@@ -169,8 +169,8 @@ void daObjOspbox::Act_c::eff_break() {
NULL,
-1, &tevStr.mColorK0, &tevStr.mColorK0, &particle_scale);
if (emitter != NULL) {
emitter->mLifeTime = 0x1E;
emitter->mInitialVelAxis = 30.0f;
emitter->setLifeTime(30);
emitter->setAwayFromAxisSpeed(30.0f);
}
}
+3 -3
View File
@@ -9976,13 +9976,13 @@ void daPy_lk_c::setCollision() {
NULL
);
if (emitter1 != NULL) {
emitter1->mGlobalParticleScale.x = dVar27;
emitter1->setGlobalParticleWidthScale(dVar27);
}
if (emitter2 != NULL) {
emitter2->mGlobalParticleScale.x = dVar27;
emitter2->setGlobalParticleWidthScale(dVar27);
}
if (emitter3 != NULL) {
emitter3->mGlobalParticleScale.x = dVar27;
emitter3->setGlobalParticleWidthScale(dVar27);
}
}
}
+7 -4
View File
@@ -656,10 +656,13 @@ void daPy_lk_c::setWaterRipple() {
simpleAnmPlay(mpSuimenMunyaBtk);
JPABaseEmitter* emitter = m3280.getEmitter();
if (emitter != NULL && ((emitter->mGlobalParticleScale.x < 0.8f && checkNoResetFlg0(daPyFlg0_UNK80)) || (emitter->mGlobalParticleScale.x > 0.8f && !checkNoResetFlg0(daPyFlg0_UNK80)))) {
m3280.remove();
emitter = dComIfGp_particle_setShipTail(dPa_name::ID_AK_JN_HAMON00, &current.pos, NULL, NULL, 0xFF, &m3280);
if (emitter != NULL) {
JGeometry::TVec3<f32> ptcl_scale;
emitter->getGlobalParticleScale(ptcl_scale);
if ((ptcl_scale.x < 0.8f && checkNoResetFlg0(daPyFlg0_UNK80)) || (ptcl_scale.x > 0.8f && !checkNoResetFlg0(daPyFlg0_UNK80))) {
m3280.remove();
emitter = dComIfGp_particle_setShipTail(dPa_name::ID_AK_JN_HAMON00, &current.pos, NULL, NULL, 0xFF, &m3280);
}
}
if (emitter != NULL) {
+1 -1
View File
@@ -5949,7 +5949,7 @@ void dMeter_arwMove(sub_meter_class* i_Meter) {
f32 x = i_Meter->field_0x29b0[1].mPosCenter.x - 320.0f;
f32 y = i_Meter->field_0x29b0[1].mPosCenter.y - 240.0f;
i_Meter->field_0x2f24[i]->setGlobalTranslation(x, y, 0.0f);
i_Meter->field_0x2f24[i]->mGlobalPrmColor.a = i_Meter->field_0x2940[i].mNowAlpha;
i_Meter->field_0x2f24[i]->setGlobalAlpha(i_Meter->field_0x2940[i].mNowAlpha);
}
}
}
+10 -10
View File
@@ -350,7 +350,7 @@ void dPa_smokeEcallBack::setup(JPABaseEmitter* param_1, const cXyz* param_2, con
dPa_followEcallBack::setup(param_1, param_2, param_3, param_4);
field_0x14 = param_4;
param_1->setParticleCallBackPtr(dPa_control_c::getSmokePcallback());
param_1->mUserData = mWindOff;
param_1->setUserWork(mWindOff);
}
/* 8007B73C-8007B804 .text initiateLighting__FR11_GXColorS10R8_GXColorR8_GXColor */
@@ -395,11 +395,11 @@ void smokeEcallBack(JPABaseEmitter* emtr, dKy_tevstr_c* tevStr, s8, GXColor colo
} else {
initiateLighting(tevStr->mColorC0, tevStr->mColorK0, color);
}
color.a = emtr->mGlobalPrmColor.a;
color.a = emtr->getGlobalAlpha();
GXSetNumTexGens(2);
GXSetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY);
GXSetTexCoordGen(GX_TEXCOORD1, GX_TG_SRTG, GX_TG_COLOR0, GX_IDENTITY);
emtr->mDraw.loadTexture(1, GX_TEXMAP1);
emtr->loadTexture(1, GX_TEXMAP1);
GXSetNumTevStages(3);
GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_C0, GX_CC_KONST, GX_CC_TEXC, GX_CC_ZERO);
GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true, GX_TEVPREV);
@@ -449,7 +449,7 @@ void dPa_setWindPower(JPABaseParticle* ptcl) {
/* 8007BC84-8007BCB4 .text execute__18dPa_smokePcallBackFP14JPABaseEmitterP15JPABaseParticle */
void dPa_smokePcallBack::execute(JPABaseEmitter* emtr, JPABaseParticle* ptcl) {
if (emtr->mUserData == 0)
if (emtr->getUserWork() == 0)
dPa_setWindPower(ptcl);
}
@@ -460,7 +460,7 @@ void dPa_smokePcallBack::draw(JPABaseEmitter* emtr, JPABaseParticle* ptcl) {
/* 8007C380-8007C3B0 .text draw__22dPa_selectTexEcallBackFP14JPABaseEmitter */
void dPa_selectTexEcallBack::draw(JPABaseEmitter* emtr) {
emtr->mDraw.loadTexture(mTexNo, GX_TEXMAP0);
emtr->loadTexture(mTexNo, GX_TEXMAP0);
}
/* 8007C3B0-8007C420 .text __ct__19dPa_simpleEcallBackFv */
@@ -474,7 +474,7 @@ dPa_simpleData_c::dPa_simpleData_c() {}
/* 8007C460-8007C618 .text executeAfter__19dPa_simpleEcallBackFP14JPABaseEmitter */
void dPa_simpleEcallBack::executeAfter(JPABaseEmitter* param_1) {
s32 r28 = JPABaseEmitter::emtrInfo.mVolumeEmitCount;
s32 r28 = param_1->getCurrentCreateNumber();
if (r28 <= 0) {
mCount = 0;
} else {
@@ -510,7 +510,7 @@ void dPa_simpleEcallBack::draw(JPABaseEmitter* emtr) {
if (mbIsSmoke)
smokeEcallBack(emtr, NULL, -1, (GXColor){ 0xA0, 0xA0, 0x80, 0xFF });
if (emtr->mGroupID == dPa_control_c::dPtclGroup_Projection_e)
if (emtr->getGroupID() == dPa_control_c::dPtclGroup_Projection_e)
GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_A0);
}
@@ -538,8 +538,8 @@ JPABaseEmitter* dPa_simpleEcallBack::createEmitter(JPAEmitterManager* manager) {
if (!mpBaseEmitter) {
return mpBaseEmitter;
}
mpBaseEmitter->mpEmitterCallBack = this;
mpBaseEmitter->mMaxFrame = 0;
mpBaseEmitter->setEmitterCallBackPtr(this);
mpBaseEmitter->setMaxFrame(0);
mpBaseEmitter->stopCreateParticle();
}
return mpBaseEmitter;
@@ -765,7 +765,7 @@ JPABaseEmitter* dPa_control_c::set(u8 groupID, u16 userID, const cXyz* pos, cons
emtr->setGlobalScale(tmp2);
}
emtr->mGlobalPrmColor.a = alpha;
emtr->setGlobalAlpha(alpha);
if (pCallBack != NULL) {
emtr->setEmitterCallBackPtr(pCallBack);
pCallBack->setup(emtr, pos, angle, setupInfo);