From aa41744f7388c6fdcfd07e60326cf1f2010b2929 Mon Sep 17 00:00:00 2001 From: div0 Date: Thu, 16 Apr 2009 09:58:22 +0000 Subject: [PATCH] more fixes for pointparticles bgm script git-svn-id: svn://svn.icculus.org/nexuiz/trunk@6501 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/qcsrc/client/particles.qc | 22 +++++++++++++++------- data/qcsrc/server/g_triggers.qc | 4 +++- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/data/qcsrc/client/particles.qc b/data/qcsrc/client/particles.qc index 6dca2fad2..75c701ec2 100644 --- a/data/qcsrc/client/particles.qc +++ b/data/qcsrc/client/particles.qc @@ -76,7 +76,6 @@ void PointparticlesScript_Init() .float scriptline; .float scriptline0; -.float scriptstate; .float scriptvelocity; .float scripttime; .float switchedon; @@ -124,30 +123,38 @@ float PointparticlesScript(entity e) if(t < e.scripttime) { e.scriptline = e.scriptline0; - e.scriptstate = 0; + e.scripttime = 0; tokenize_sane(bufstr_get(pointparticles_scriptbuf, e.scriptline)); } if(argv(0) != e.bgmscript) { - e.scriptstate = 0; // end of script, will revert to beginning later + // end of script, will revert to beginning later } else if(t >= stof(argv(1))) { // time code reached! e.scriptvelocity = stof(argv(2)); if(e.scriptvelocity > 0) + { e.switchedon = TRUE; - e.scripttime = stof(argv(1)); + e.scripttime = stof(argv(1)); + } + else + e.scripttime = 0; e.scriptline += 1; } - if(e.scriptstate) + if(e.scripttime) { if(e.bgmscriptdecay >= 1) - return (e.scriptstate == 2); + { + return e.switchedon; + } else + { return pow(0.5, (t - e.scripttime) * (e.bgmscriptdecay / (1 - e.bgmscriptdecay))) * e.scriptvelocity; + } } else return 0; @@ -272,7 +279,8 @@ void Ent_PointParticles() } else { - self.waterlevel = self.count = self.glow_color = 0; + self.waterlevel = self.glow_color = 0; + self.count = 1; } if(self.noise) strunzone(self.noise); diff --git a/data/qcsrc/server/g_triggers.qc b/data/qcsrc/server/g_triggers.qc index 2b51502a3..8f0fe9e1a 100644 --- a/data/qcsrc/server/g_triggers.qc +++ b/data/qcsrc/server/g_triggers.qc @@ -566,7 +566,7 @@ float pointparticles_SendEntity(entity to, float fl) fl |= 0x10; // 2 bytes if(self.movedir != '0 0 0' || self.velocity != '0 0 0') fl |= 0x20; // 4 bytes - saves CPU - if(self.glow_color || self.waterlevel || self.glow_color) + if(self.glow_color || self.waterlevel || self.count != 1) fl |= 0x40; // 4 bytes - obscure features almost never used if(self.mins != '0 0 0' || self.maxs != '0 0 0') fl |= 0x80; // 14 bytes - saves lots of space @@ -675,6 +675,8 @@ void spawnfunc_func_pointparticles() self.atten = 0; if(!self.volume) self.volume = 1; + if(!self.count) + self.count = 1; if(!self.modelindex) { -- 2.39.2