@@ -17,7 +17,7 @@ VAR(IDF_PERSIST, particleglare, 0, 1, 100);
1717// Automatically stops particles being emitted when paused or in reflective drawing
1818VAR (IDF_PERSIST, emitmillis, 1 , 20 , VAR_MAX);
1919static int lastemitframe = 0 ;
20- static bool emit = false ;
20+ static bool emit = false , canstep = false ;
2121
2222static bool canemitparticles ()
2323{
@@ -70,7 +70,7 @@ struct partrenderer
7070 }
7171
7272 // blend = 0 => remove it
73- void calc (particle *p, int &blend, int &ts, float &size, bool lastpass = true )
73+ void calc (particle *p, int &blend, int &ts, float &size, bool step = true )
7474 {
7575 vec o = p->o ;
7676 if (p->fade <= 5 )
@@ -114,7 +114,7 @@ struct partrenderer
114114 v.z -= physics::gravityvel (&d)*secs;
115115 p->o .add (v);
116116 }
117- if (p->collide && p->o .z < p->val && lastpass )
117+ if (step && p->collide && p->o .z < p->val )
118118 {
119119 if (p->collide >= 0 )
120120 {
@@ -132,7 +132,7 @@ struct partrenderer
132132 }
133133 else p->m .add (vec (p->o ).sub (o));
134134 }
135- game::particletrack (p, type, ts, lastpass );
135+ game::particletrack (p, type, ts, step );
136136 }
137137
138138 const char *debuginfo ()
@@ -273,17 +273,16 @@ struct listrenderer : partrenderer
273273 preload ();
274274 startrender ();
275275 if (tex) glBindTexture (GL_TEXTURE_2D, tex->id );
276- bool lastpass = !reflecting && !refracting;
277276 for (T **prev = &list, *p = list; p; p = *prev)
278277 {
279278 int blend = 255 , ts = 1 ;
280279 float size = 1 ;
281- calc (p, blend, ts, size, lastpass );
280+ calc (p, blend, ts, size, canstep );
282281 if (blend > 0 )
283282 {
284283 renderpart (p, blend, ts, size);
285284
286- if (p->fade > 5 || !lastpass )
285+ if (p->fade > 5 || !canstep )
287286 {
288287 prev = &p->next ;
289288 continue ;
@@ -1145,6 +1144,7 @@ void debugparticles()
11451144
11461145void renderparticles (bool mainpass)
11471146{
1147+ canstep = mainpass;
11481148 // want to debug BEFORE the lastpass render (that would delete particles)
11491149 if (dbgparts && mainpass) loopi (sizeof (parts)/sizeof (parts[0 ])) parts[i]->debuginfo ();
11501150
0 commit comments