mirror of
https://github.com/zeldaret/tww.git
synced 2026-07-10 22:31:52 -04:00
Fix JPABaseParticle position members being out of order
This commit is contained in:
@@ -39,9 +39,10 @@ public:
|
||||
|
||||
~JPABaseParticle() {}
|
||||
JPABaseParticle() : mLink(this), mCurFrame(0.0f) {}
|
||||
void setOffsetPosition(f32 x, f32 y, f32 z) { mGlobalPosition.set(x, y, z); }
|
||||
void setOffsetPosition(const JGeometry::TVec3<f32>& pos) { mGlobalPosition.set(pos); }
|
||||
void getOffsetPosition(JGeometry::TVec3<f32>& out) const { out.set(mPosition); } // XXX: something about this is wrong
|
||||
void setOffsetPosition(f32 x, f32 y, f32 z) { mOffsetPosition.set(x, y, z); }
|
||||
void setOffsetPosition(const JGeometry::TVec3<f32>& pos) { mOffsetPosition.set(pos); }
|
||||
void getOffsetPosition(JGeometry::TVec3<f32>& out) const { out.set(mOffsetPosition); }
|
||||
void getLocalPosition(JGeometry::TVec3<f32>& out) const { out.set(mLocalPosition); }
|
||||
void getGlobalPosition(JGeometry::TVec3<f32>& out) const { out.set(mGlobalPosition); }
|
||||
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); }
|
||||
@@ -59,16 +60,15 @@ public:
|
||||
void getDrawParamPPtr() {}
|
||||
void getHeight() {}
|
||||
void getLifeTime() const {}
|
||||
void getLocalPosition(JGeometry::TVec3<f32>&) const {}
|
||||
void getVelVec(JGeometry::TVec3<f32>&) const {}
|
||||
void getWidth() {}
|
||||
void setDeleteParticleFlag() {}
|
||||
|
||||
public:
|
||||
/* 0x00 */ JSULink<JPABaseParticle> mLink;
|
||||
/* 0x10 */ JGeometry::TVec3<f32> mGlobalPosition;
|
||||
/* 0x10 */ JGeometry::TVec3<f32> mOffsetPosition;
|
||||
/* 0x1C */ JGeometry::TVec3<f32> mLocalPosition;
|
||||
/* 0x28 */ JGeometry::TVec3<f32> mPosition;
|
||||
/* 0x28 */ JGeometry::TVec3<f32> mGlobalPosition;
|
||||
/* 0x34 */ JGeometry::TVec3<f32> mVelocity;
|
||||
/* 0x40 */ JGeometry::TVec3<f32> mBaseVel;
|
||||
/* 0x4C */ JGeometry::TVec3<f32> mAccel;
|
||||
|
||||
@@ -290,7 +290,7 @@ void JPADrawExecBillBoard::exec(const JPADrawContext* pDC, JPABaseParticle* ptcl
|
||||
scaleY *= (JPADrawContext::pcb->mGlobalScaleY + JPADrawContext::pcb->mPivotY);
|
||||
|
||||
JGeometry::TVec3<f32> pt;
|
||||
pt.set(ptcl->mPosition);
|
||||
ptcl->getGlobalPosition(pt);
|
||||
MTXMultVec(JPADrawContext::pcb->mDrawMtxPtr, pt, &pt);
|
||||
|
||||
GXBegin(GX_QUADS, GX_VTXFMT0, 4);
|
||||
@@ -323,7 +323,7 @@ void JPADrawExecRotBillBoard::exec(const JPADrawContext* pDC, JPABaseParticle* p
|
||||
f32 y1 = -ptcl->mScaleY * (JPADrawContext::pcb->mGlobalScaleY - JPADrawContext::pcb->mPivotY);
|
||||
|
||||
JGeometry::TVec3<f32> pt;
|
||||
pt.set(ptcl->mPosition);
|
||||
ptcl->getGlobalPosition(pt);
|
||||
MTXMultVec(JPADrawContext::pcb->mDrawMtxPtr, pt, &pt);
|
||||
|
||||
GXBegin(GX_QUADS, GX_VTXFMT0, 4);
|
||||
@@ -355,12 +355,12 @@ void dirTypeVel(JPABaseParticle* ptcl, JPABaseEmitter* emtr, JGeometry::TVec3<f3
|
||||
|
||||
/* 80261368-80261384 .text dirTypePos__FP15JPABaseParticleP14JPABaseEmitterRQ29JGeometry8TVec3<f> */
|
||||
void dirTypePos(JPABaseParticle* ptcl, JPABaseEmitter* emtr, JGeometry::TVec3<f32>& out) {
|
||||
out.set(ptcl->mLocalPosition);
|
||||
ptcl->getLocalPosition(out);
|
||||
}
|
||||
|
||||
/* 80261384-802613C4 .text dirTypePosInv__FP15JPABaseParticleP14JPABaseEmitterRQ29JGeometry8TVec3<f> */
|
||||
void dirTypePosInv(JPABaseParticle* ptcl, JPABaseEmitter* emtr, JGeometry::TVec3<f32>& out) {
|
||||
out.set(ptcl->mLocalPosition);
|
||||
ptcl->getLocalPosition(out);
|
||||
out.negate();
|
||||
}
|
||||
|
||||
@@ -372,10 +372,10 @@ void dirTypeEmtrDir(JPABaseParticle* ptcl, JPABaseEmitter* emtr, JGeometry::TVec
|
||||
/* 802613E8-802614A8 .text dirTypePrevPtcl__FP15JPABaseParticleP14JPABaseEmitterRQ29JGeometry8TVec3<f> */
|
||||
void dirTypePrevPtcl(JPABaseParticle* ptcl, JPABaseEmitter* emtr, JGeometry::TVec3<f32>& out) {
|
||||
JGeometry::TVec3<f32> pos;
|
||||
pos.set(ptcl->mPosition);
|
||||
ptcl->getGlobalPosition(pos);
|
||||
JSULink<JPABaseParticle>* prev = ptcl->getLinkBufferPtr()->getPrev();
|
||||
if (prev != NULL) {
|
||||
out.set(prev->getObject()->mPosition);
|
||||
prev->getObject()->getGlobalPosition(out);
|
||||
} else {
|
||||
emtr->calcEmitterGlobalPosition(out);
|
||||
}
|
||||
@@ -541,9 +541,9 @@ void JPADrawExecRotation::exec(const JPADrawContext* pDC, JPABaseParticle* ptcl)
|
||||
JPADrawContext::pcb->mRotTypeFunc(sin, cos, rotMtx);
|
||||
|
||||
MTXMultVecArray(rotMtx, pt, pt, ARRAY_SIZE(pt));
|
||||
f32 x = ptcl->mPosition.x;
|
||||
f32 y = ptcl->mPosition.y;
|
||||
f32 z = ptcl->mPosition.z;
|
||||
f32 x = ptcl->mGlobalPosition.x;
|
||||
f32 y = ptcl->mGlobalPosition.y;
|
||||
f32 z = ptcl->mGlobalPosition.z;
|
||||
|
||||
GXBegin(GX_QUADS, GX_VTXFMT0, 4);
|
||||
GXPosition3f32(pt[0].x + x, pt[0].y + y, pt[0].z + z);
|
||||
@@ -589,9 +589,9 @@ void JPADrawExecRotationCross::exec(const JPADrawContext* pDC, JPABaseParticle*
|
||||
JPADrawContext::pcb->mRotTypeFunc(sin, cos, rotMtx);
|
||||
|
||||
MTXMultVecArray(rotMtx, pt, pt, ARRAY_SIZE(pt));
|
||||
f32 x = ptcl->mPosition.x;
|
||||
f32 y = ptcl->mPosition.y;
|
||||
f32 z = ptcl->mPosition.z;
|
||||
f32 x = ptcl->mGlobalPosition.x;
|
||||
f32 y = ptcl->mGlobalPosition.y;
|
||||
f32 z = ptcl->mGlobalPosition.z;
|
||||
|
||||
GXBegin(GX_QUADS, GX_VTXFMT0, 8);
|
||||
GXPosition3f32(pt[0].x + x, pt[0].y + y, pt[0].z + z);
|
||||
@@ -619,7 +619,7 @@ void JPADrawExecPoint::exec(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
|
||||
return;
|
||||
|
||||
JGeometry::TVec3<f32> pos;
|
||||
pos.set(ptcl->mPosition);
|
||||
ptcl->getGlobalPosition(pos);
|
||||
GXBegin(GX_POINTS, GX_VTXFMT0, 1);
|
||||
GXPosition3f32(pos.x, pos.y, pos.z);
|
||||
GXTexCoord2f32(0.0f, 0.0f);
|
||||
@@ -634,7 +634,7 @@ void JPADrawExecLine::exec(const JPADrawContext* pDC, JPABaseParticle* ptcl) {
|
||||
JGeometry::TVec3<f32> pt0;
|
||||
JGeometry::TVec3<f32> vel;
|
||||
|
||||
pt0.set(ptcl->mPosition);
|
||||
ptcl->getGlobalPosition(pt0);
|
||||
vel.set(ptcl->mVelocity);
|
||||
if (!vel.isZero()) {
|
||||
vel.normalize();
|
||||
|
||||
@@ -134,7 +134,7 @@ void JPAAirField::calc(JPAFieldData* data, JPABaseParticle* ptcl) {
|
||||
if (data->mSttFlag & 0x01) {
|
||||
JGeometry::TVec3<f32> vel;
|
||||
if (data->mSttFlag & 0x02) {
|
||||
vel.sub(ptcl->mPosition, data->mWork0);
|
||||
vel.sub(ptcl->mGlobalPosition, data->mWork0);
|
||||
} else {
|
||||
vel.sub(ptcl->mLocalPosition, data->mWork0);
|
||||
}
|
||||
@@ -169,7 +169,7 @@ void JPAMagnetField::preCalc(JPAFieldData* data) {
|
||||
/* 8025A788-8025A8AC .text calc__14JPAMagnetFieldFP12JPAFieldDataP15JPABaseParticle */
|
||||
void JPAMagnetField::calc(JPAFieldData* data, JPABaseParticle* ptcl) {
|
||||
if (data->mSttFlag & 0x02) {
|
||||
data->mVel.sub(data->mWork0, ptcl->mPosition);
|
||||
data->mVel.sub(data->mWork0, ptcl->mGlobalPosition);
|
||||
} else {
|
||||
data->mVel.sub(data->mWork0, ptcl->mLocalPosition);
|
||||
}
|
||||
@@ -192,7 +192,7 @@ void JPANewtonField::preCalc(JPAFieldData* data) {
|
||||
/* 8025A954-8025ABB8 .text calc__14JPANewtonFieldFP12JPAFieldDataP15JPABaseParticle */
|
||||
void JPANewtonField::calc(JPAFieldData* data, JPABaseParticle* ptcl) {
|
||||
if (data->mSttFlag & 0x02) {
|
||||
data->mVel.sub(data->mWork0, ptcl->mPosition);
|
||||
data->mVel.sub(data->mWork0, ptcl->mGlobalPosition);
|
||||
} else {
|
||||
data->mVel.sub(data->mWork0, ptcl->mLocalPosition);
|
||||
}
|
||||
@@ -413,7 +413,7 @@ void JPAFieldManager::calc(JPABaseParticle* ptcl) {
|
||||
for (JSULink<JPAFieldData>* link = mList.getFirst(); link != NULL; link = link->getNext()) {
|
||||
JPAFieldData* data = link->getObject();
|
||||
if (data->mSttFlag & 0x80) {
|
||||
if (!data->mpBaseField->isItinRange(data, ptcl->mPosition.squared(data->mPos)))
|
||||
if (!data->mpBaseField->isItinRange(data, ptcl->mGlobalPosition.squared(data->mPos)))
|
||||
continue;
|
||||
}
|
||||
data->mpBaseField->calc(data, ptcl);
|
||||
|
||||
@@ -26,7 +26,7 @@ void JPABaseParticle::initParticle() {
|
||||
if ((emtr->mDataFlag & 0x08) != 0)
|
||||
setStatus(0x20);
|
||||
|
||||
mGlobalPosition.set(emtrInfo.mEmitterGlobalCenter);
|
||||
mOffsetPosition.set(emtrInfo.mEmitterGlobalCenter);
|
||||
|
||||
if (emtr->mInitialVelOmni)
|
||||
velOmni.setLength(emtrInfo.mVelOmni, emtr->mInitialVelOmni);
|
||||
@@ -82,10 +82,10 @@ void JPABaseParticle::initParticle() {
|
||||
mLifeTime = emtr->mLifeTime * (1.0f - emtr->mLifeTimeRndm * emtr->getRandomF());
|
||||
mCurNormTime = 0.0f;
|
||||
|
||||
mPosition.set(
|
||||
mGlobalPosition.x + mLocalPosition.x * emtrInfo.mPublicScale.x,
|
||||
mGlobalPosition.y + mLocalPosition.y * emtrInfo.mPublicScale.y,
|
||||
mGlobalPosition.z + mLocalPosition.z * emtrInfo.mPublicScale.z
|
||||
mGlobalPosition.set(
|
||||
mOffsetPosition.x + mLocalPosition.x * emtrInfo.mPublicScale.x,
|
||||
mOffsetPosition.y + mLocalPosition.y * emtrInfo.mPublicScale.y,
|
||||
mOffsetPosition.z + mLocalPosition.z * emtrInfo.mPublicScale.z
|
||||
);
|
||||
|
||||
setCallBackPtr(emtr->mpParticleCallBack);
|
||||
@@ -139,7 +139,7 @@ void JPABaseParticle::initChild(JPABaseParticle* parent) {
|
||||
if (emtr->checkEmDataFlag(0x10))
|
||||
setStatus(0x20);
|
||||
|
||||
mGlobalPosition.set(parent->mGlobalPosition);
|
||||
mOffsetPosition.set(parent->mOffsetPosition);
|
||||
mLocalPosition.set(parent->mLocalPosition);
|
||||
|
||||
f32 posRndm = sweep->getPosRndm();
|
||||
@@ -175,7 +175,7 @@ void JPABaseParticle::incFrame() {
|
||||
void JPABaseParticle::calcVelocity() {
|
||||
mFieldVel.zero();
|
||||
if (checkStatus(0x20))
|
||||
mGlobalPosition.set(JPABaseEmitter::emtrInfo.mEmitterGlobalCenter);
|
||||
mOffsetPosition.set(JPABaseEmitter::emtrInfo.mEmitterGlobalCenter);
|
||||
mBaseVel.add(mAccel);
|
||||
if (!checkStatus(0x40))
|
||||
JPABaseEmitter::emtrInfo.mpCurEmitter->mFieldManager.calc(this);
|
||||
@@ -196,10 +196,10 @@ void JPABaseParticle::calcVelocity() {
|
||||
void JPABaseParticle::calcPosition() {
|
||||
mLocalPosition.add(mVelocity);
|
||||
|
||||
mPosition.set(
|
||||
mLocalPosition.x * JPABaseEmitter::emtrInfo.mPublicScale.x + mGlobalPosition.x,
|
||||
mLocalPosition.y * JPABaseEmitter::emtrInfo.mPublicScale.y + mGlobalPosition.y,
|
||||
mLocalPosition.z * JPABaseEmitter::emtrInfo.mPublicScale.z + mGlobalPosition.z
|
||||
mGlobalPosition.set(
|
||||
mLocalPosition.x * JPABaseEmitter::emtrInfo.mPublicScale.x + mOffsetPosition.x,
|
||||
mLocalPosition.y * JPABaseEmitter::emtrInfo.mPublicScale.y + mOffsetPosition.y,
|
||||
mLocalPosition.z * JPABaseEmitter::emtrInfo.mPublicScale.z + mOffsetPosition.z
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -245,7 +245,7 @@ namespace daBomb2 {
|
||||
JSUPtrLink* next = link->getNext();
|
||||
|
||||
JPABaseParticle* ptcl = (JPABaseParticle*)link->getObjectPtr();
|
||||
ptcl->mGlobalPosition.set(x, y, z);
|
||||
ptcl->setOffsetPosition(x, y, z);
|
||||
|
||||
link = next;
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ void daBomb_fuseSparksEcallBack::execute(JPABaseEmitter* emitter) {
|
||||
JSUPtrLink* next = link->getNext();
|
||||
|
||||
JPABaseParticle* ptcl = (JPABaseParticle*)link->getObjectPtr();
|
||||
ptcl->mGlobalPosition.set(x, y, z);
|
||||
ptcl->setOffsetPosition(x, y, z);
|
||||
|
||||
link = next;
|
||||
}
|
||||
|
||||
@@ -118,10 +118,10 @@ void daPy_swimTailEcallBack_c::execute(JPABaseEmitter* emitter) {
|
||||
JSULink<JPABaseParticle>* nextLink = link->getNext();
|
||||
JPABaseParticle* particle = link->getObject();
|
||||
|
||||
JGeometry::TVec3<f32> sp14;
|
||||
particle->getGlobalPosition(sp14);
|
||||
getMaxWaterY(&sp14);
|
||||
particle->setOffsetPosition(sp14);
|
||||
JGeometry::TVec3<f32> offsetPos;
|
||||
particle->getOffsetPosition(offsetPos);
|
||||
getMaxWaterY(&offsetPos);
|
||||
particle->setOffsetPosition(offsetPos);
|
||||
|
||||
link = nextLink;
|
||||
}
|
||||
@@ -370,7 +370,7 @@ void daPy_fanSwingEcallBack_c::execute(JPABaseEmitter* emitter) {
|
||||
void daPy_waterDropPcallBack_c::execute(JPABaseEmitter* emitter, JPABaseParticle* ptcl) {
|
||||
if (field_0x4) {
|
||||
JGeometry::TVec3<f32> ptclPos;
|
||||
ptcl->getOffsetPosition(ptclPos);
|
||||
ptcl->getGlobalPosition(ptclPos);
|
||||
|
||||
cXyz pos(ptclPos.x, ptclPos.y + 25.0f, ptclPos.z);
|
||||
mGndChk.SetPos(&pos);
|
||||
|
||||
+10
-9
@@ -107,9 +107,9 @@ void dPa_J3DmodelEmitter_c::draw() {
|
||||
}
|
||||
|
||||
// TODO: all the math
|
||||
mtx1[0][3] = ptcl->mPosition.x;
|
||||
mtx1[1][3] = ptcl->mPosition.y;
|
||||
mtx1[2][3] = ptcl->mPosition.z;
|
||||
mtx1[0][3] = ptcl->mGlobalPosition.x;
|
||||
mtx1[1][3] = ptcl->mGlobalPosition.y;
|
||||
mtx1[2][3] = ptcl->mGlobalPosition.z;
|
||||
g_env_light.setLightTevColorType(model, &tevStr);
|
||||
|
||||
if (field_0x1c != NULL && field_0x20 != NULL) {
|
||||
@@ -409,12 +409,13 @@ void dPa_smokeEcallBack::end() {
|
||||
|
||||
/* 8007BBD8-8007BC84 .text dPa_setWindPower__FP15JPABaseParticle */
|
||||
void dPa_setWindPower(JPABaseParticle* ptcl) {
|
||||
/* Nonmatching */
|
||||
cXyz pos(ptcl->mGlobalPosition);
|
||||
JGeometry::TVec3<f32> offsetPos;
|
||||
cXyz wind;
|
||||
f32 pow;
|
||||
dKyw_get_AllWind_vec(&pos, &wind, &pow);
|
||||
ptcl->mGlobalPosition.add(pos, wind * (pow * 8.0f));
|
||||
ptcl->getOffsetPosition(offsetPos);
|
||||
dKyw_get_AllWind_vec((cXyz*)&offsetPos, &wind, &pow);
|
||||
offsetPos += wind * (pow * 8.0f);
|
||||
ptcl->setOffsetPosition(offsetPos);
|
||||
}
|
||||
|
||||
/* 8007BC84-8007BCB4 .text execute__18dPa_smokePcallBackFP14JPABaseEmitterP15JPABaseParticle */
|
||||
@@ -963,9 +964,9 @@ void dPa_singleRippleEcallBack::draw(JPABaseEmitter*) {
|
||||
void dPa_ripplePcallBack::execute(JPABaseEmitter* param_1, JPABaseParticle* ptcl) {
|
||||
/* Nonmatching */
|
||||
f32 height;
|
||||
cXyz pos(ptcl->mPosition.x, ptcl->mPosition.y, ptcl->mPosition.z);
|
||||
cXyz pos(ptcl->mGlobalPosition.x, ptcl->mGlobalPosition.y, ptcl->mGlobalPosition.z);
|
||||
if (fopAcM_getWaterY(&pos, &height)) {
|
||||
ptcl->mGlobalPosition.y = height;
|
||||
ptcl->mOffsetPosition.y = height;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user