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

Method create

libs/JSystem/JParticle/JPADynamicsBlock.cpp:186–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

184}
185
186void JPADynamicsBlock::create(JPAEmitterWorkData* work)
187{
188 if (work->mEmitter->checkStatus(JPAEMIT_RateStepEmit)) {
189 s32 emitCount;
190 s32 createCount;
191
192 if (work->mEmitter->checkDynFlag(JPADYN_FixedInterval)) {
193 s32 count;
194 if (getVolumeType() == JPAVOL_Sphere) {
195 count = 4 * getDivNumber() * getDivNumber() + 2;
196 } else {
197 count = getDivNumber();
198 }
199 emitCount = count;
200
201 work->mVolumeEmitIdx = 0;
202 } else {
203 f32 newPtclCount = work->mEmitter->mRate * (getRateRndm() * work->mEmitter->getRandZP() + 1.0f);
204 f32 newEmitCount = work->mEmitter->mEmitCount + newPtclCount;
205 work->mEmitter->mEmitCount = newEmitCount;
206 emitCount = (s32)newEmitCount;
207 work->mEmitter->mEmitCount -= emitCount;
208
209 if (work->mEmitter->checkStatus(JPAEMIT_FirstEmit) && 0.0f < newPtclCount && newPtclCount < 1.0f)
210 emitCount = 1;
211 }
212
213 work->mCreateNumber = emitCount;
214 if (work->mEmitter->checkStatus(JPAEMIT_StopEmitting)) {
215 emitCount = 0;
216 }
217
218 createCount = emitCount;
219 while (createCount > 0) {
220 JPABaseParticle* ptcl = work->mEmitter->createParticle();
221 if (ptcl == NULL)
222 break;
223 createCount--;
224 }
225 }
226
227 if (++work->mEmitter->mRateStepTimer >= (work->mEmitter->mRateStep + 1)) {
228 work->mEmitter->mRateStepTimer -= (work->mEmitter->mRateStep + 1);
229 work->mEmitter->setFlag(JPAEMIT_RateStepEmit);
230 } else {
231 work->mEmitter->clearStatus(JPAEMIT_RateStepEmit);
232 }
233
234 work->mEmitter->clearStatus(JPAEMIT_FirstEmit);
235}

Callers 1

calcMethod · 0.45

Calls 6

checkDynFlagMethod · 0.80
createParticleMethod · 0.80
clearStatusMethod · 0.80
checkStatusMethod · 0.45
getRandZPMethod · 0.45
setFlagMethod · 0.45

Tested by

no test coverage detected