From 72855d64d8f47c5527825fb8661d75346913f547 Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Sun, 17 Feb 2008 09:56:38 +0000 Subject: [PATCH] particle outside world fix git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@1664 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/renderparticles.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/source/src/renderparticles.cpp b/source/src/renderparticles.cpp index 13223866..8c7c79d5 100644 --- a/source/src/renderparticles.cpp +++ b/source/src/renderparticles.cpp @@ -225,6 +225,8 @@ void particlereset() void newparticle(const vec &o, const vec &d, int fade, int type) { + if(OUTBORD((int)o.x, (int)o.y)) return; + if(!parempty) { particle *ps = new particle[256]; @@ -450,7 +452,17 @@ void render_particles(int time) else { if(pt.gr) p->o.z -= ((lastmillis-p->millis)/3.0f)*time/(pt.gr*10000); - if(pt.type==PT_PART || pt.type==PT_BLOOD) p->o.add(vec(p->d).mul(time/20000.0f)); + if(pt.type==PT_PART || pt.type==PT_BLOOD) + { + p->o.add(vec(p->d).mul(time/20000.0f)); + if(OUTBORD((int)p->o.x, (int)p->o.y)) + { + *pp = p->next; + p->next = parempty; + parempty = p; + continue; + } + } if(pt.type==PT_BLOOD) { sqr *s = S((int)p->o.x, (int)p->o.y);