MCPcopy Create free account
hub / github.com/JACoders/OpenJK / FX_Add

Function FX_Add

code/cgame/FxUtil.cpp:205–377  ·  view source on GitHub ↗

------------------------- FX_Add Adds all fx to the view -------------------------

Source from the content-addressed store, hash-verified

203// Adds all fx to the view
204//-------------------------
205void FX_Add( bool portal )
206{
207 int i;
208 SEffectList *ef;
209
210 drawnFx = 0;
211 mParticles = 0;
212 mOParticles = 0;
213 mLines = 0;
214 mTails = 0;
215
216 int numFx = activeFx; //but stop when there can't be any more left!
217 for ( i = 0, ef = effectList; i < MAX_EFFECTS && numFx; i++, ef++ )
218 {
219 if ( ef->mEffect != 0)
220 {
221 --numFx;
222 if (portal != ef->mPortal)
223 {
224 continue; //this one does not render in this scene
225 }
226 // Effect is active
227 if ( theFxHelper.mTime > ef->mKillTime )
228 {
229 // Clean up old effects, calling any death effects as needed
230 // this flag just has to be cleared otherwise death effects might not happen correctly
231 ef->mEffect->ClearFlags( FX_KILL_ON_IMPACT );
232 FX_FreeMember( ef );
233 }
234 else
235 {
236 if ( ef->mEffect->Update() == false )
237 {
238 // We've been marked for death
239 FX_FreeMember( ef );
240 continue;
241 }
242 }
243 }
244 }
245 if ( fx_debug.integer == 2 && !portal )
246 {
247 if (theFxHelper.mFrameTime > 100 || theFxHelper.mFrameTime < 5)
248 theFxHelper.Print( "theFxHelper.mFrameTime = %i\n", theFxHelper.mFrameTime );
249 }
250 if ( fx_debug.integer == 1 && !portal )
251 {
252 if ( theFxHelper.mTime > mMaxTime )
253 {
254 // decay pretty harshly when we do it
255 mMax *= 0.9f;
256 mMaxTime = theFxHelper.mTime + 200; // decay 5 times a second if we haven't set a new max
257 }
258 if ( activeFx > mMax )
259 {
260 // but we can never be less that the current activeFx count
261 mMax = activeFx;
262 mMaxTime = theFxHelper.mTime + 4000; // since we just increased the max, hold it for at least 4 seconds

Callers 1

AddScheduledEffectsMethod · 0.70

Calls 5

FX_FreeMemberFunction · 0.70
ClearFlagsMethod · 0.45
UpdateMethod · 0.45
PrintMethod · 0.45
NumScheduledFxMethod · 0.45

Tested by

no test coverage detected