Skip to content

Commit

Permalink
fix arithmetic exception with particle destruction
Browse files Browse the repository at this point in the history
  • Loading branch information
voidanix committed Jul 27, 2020
1 parent 326acad commit 4fe5ed6
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/engine/renderparticles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1237,10 +1237,7 @@ void create(int type, int color, int fade, const vec &p, float size, float blend
{
if(camera1->o.dist(p) > maxparticledistance) return;
float collidez = collide ? p.z - raycube(p, vec(0, 0, -1), collide >= 0 ? COLLIDERADIUS : max(p.z, 0.0f), RAY_CLIPMAT) + (collide >= 0 ? COLLIDEERROR : 0) : -1;
int fmin = 1;
int fmax = fade*3;
int f = fmin + rnd(fmax); //help deallocater by using fade distribution rather than random
newparticle(p, vec(0, 0, 0), f, type, color, size, blend, grav, collide, pl)->val = collidez;
newparticle(p, vec(0, 0, 0), fade, type, color, size, blend, grav, collide, pl)->val = collidez;
}

void regularcreate(int type, int color, int fade, const vec &p, float size, float blend, int grav, int collide, physent *pl, int delay)
Expand Down

0 comments on commit 4fe5ed6

Please sign in to comment.