From 85f67fa4b91d05c0e02997a616caf743a4bd714e Mon Sep 17 00:00:00 2001 From: drumsetmonkey Date: Fri, 20 May 2016 07:33:54 -0400 Subject: Basic particle stack overflow patch --- src/entities.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/entities.cpp') diff --git a/src/entities.cpp b/src/entities.cpp index b9acc20..8299e2c 100644 --- a/src/entities.cpp +++ b/src/entities.cpp @@ -915,15 +915,18 @@ Particles::Particles(float x, float y, float w, float h, float vx, float vy, Col behind = false; bounce = false; index = Texture::getIndex(c); + zOffset = ((rand()%20)-10)/1000.0f; } void Particles::draw(GLfloat*& p) const { - vec2 tc = vec2 {0.25f * index.x, 0.125f * (8-index.y)}; + vec2 tc = vec2(0.25f * this->index.x, 0.125f * (8.0f - this->index.y)); - float z = 0.0; - if (behind) - z = 2.0; + float z = 0.9; + if (behind) + z = 2.0; + + z += zOffset; // lower left *(p++) = loc.x; -- cgit v1.2.3