MCPcopy Create free account
hub / github.com/doldecomp/mkdd / init_c

Method init_c

libs/JSystem/JParticle/JPAParticle.cpp:113–193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111}
112
113void JPABaseParticle::init_c(JPAEmitterWorkData *workData, JPABaseParticle* particle)
114{
115 JPABaseEmitter *emitter = workData->mEmitter;
116 JPAChildShape *childShape = workData->mResource->getCsp();
117 mAge = -1;
118 mLifeTime = childShape->getLife();
119 mTime = 0.0f;
120 initStatus(4);
121 mLocalPosition.set(particle->mLocalPosition);
122
123 f32 posRndm = childShape->getPosRndm();
124 if (posRndm != 0.0f) {
125 JGeometry::TVec3f randVec;
126 randVec.set(emitter->getRandZH(), emitter->getRandZH(), emitter->getRandZH());
127 randVec.setLength(posRndm * emitter->getRandF32());
128 mLocalPosition.add(randVec);
129 }
130
131 if (emitter->checkDynFlag(JPADYN_FollowEmtrChld)) {
132 setStatus(0x20);
133 }
134
135 mOffsetPosition.set(particle->mOffsetPosition);
136
137 f32 randLen = childShape->getBaseVel() * (1.0f + childShape->getBaseVelRndm() * emitter->getRandZP());
138 JGeometry::TVec3f randVec2;
139 randVec2.set(emitter->getRandZP(), emitter->getRandZP(), emitter->getRandZP());
140 randVec2.setLength(randLen);
141 mVelType1.scaleAdd(childShape->getVelInhRate(), particle->mVelType1, randVec2);
142 mVelType0.scale(childShape->getVelInhRate(), particle->mVelType2);
143 mMoment = particle->mMoment;
144
145 if (childShape->isFieldAffected()) {
146 mDrag = particle->mDrag;
147 } else {
148 setStatus(0x40);
149 mDrag = 1.0f;
150 }
151
152 _78 = particle->_78;
153 mVelType2.set(mVelType0);
154
155 f32 factor = mMoment * mDrag;
156 mVelocity.set(factor * (mVelType1.x + mVelType2.x), factor * (mVelType1.y + mVelType2.y), factor * (mVelType1.z + mVelType2.z));
157 mBaseAxis.set(particle->mBaseAxis);
158
159 if (childShape->isScaleInherited()) {
160 mParticleScaleX = mScaleOut = particle->mParticleScaleX * childShape->getScaleInhRate();
161 mParticleScaleY = mAlphaWaveRandom = particle->mParticleScaleY * childShape->getScaleInhRate();
162 } else {
163 mParticleScaleX = mScaleOut = mParticleScaleY = mAlphaWaveRandom = 1.0f;
164 }
165
166 if (childShape->isColorInherited()) {
167 mPrmClr.r = particle->mPrmClr.r * childShape->getColorInhRate();
168 mPrmClr.g = particle->mPrmClr.g * childShape->getColorInhRate();
169 mPrmClr.b = particle->mPrmClr.b * childShape->getColorInhRate();
170

Callers 1

createChildMethod · 0.80

Calls 15

setStatusFunction · 0.85
COLOR_MULTIFunction · 0.85
getCspMethod · 0.80
getLifeMethod · 0.80
getPosRndmMethod · 0.80
setLengthMethod · 0.80
checkDynFlagMethod · 0.80
getBaseVelMethod · 0.80
getBaseVelRndmMethod · 0.80
scaleAddMethod · 0.80
getVelInhRateMethod · 0.80
isFieldAffectedMethod · 0.80

Tested by

no test coverage detected