From 2ce770e77b986f2eeb9c94046f01fb91183607d9 Mon Sep 17 00:00:00 2001 From: div0 Date: Thu, 16 Apr 2009 11:03:40 +0000 Subject: [PATCH] remove pointparticles glow_color (does not work anyway) git-svn-id: svn://svn.icculus.org/nexuiz/trunk@6503 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/qcsrc/client/particles.qc | 55 +++++++++++++++++++-------------- data/qcsrc/server/g_triggers.qc | 26 +++++++--------- 2 files changed, 43 insertions(+), 38 deletions(-) diff --git a/data/qcsrc/client/particles.qc b/data/qcsrc/client/particles.qc index 878e1b318..dee3f47e9 100644 --- a/data/qcsrc/client/particles.qc +++ b/data/qcsrc/client/particles.qc @@ -42,12 +42,11 @@ float PointInBrush(entity brush, vector point) .vector velocity; // particle velocity .float waterlevel; // direction jitter .float count; // count multiplier -.float glow_color; // palette color .float impulse; // density .string noise; // sound .float atten; .float volume; -.float absolute; +.float absolute; // 1 = count per second is absolute, 2 = only spawn at toggle .vector movedir; // trace direction .string bgmscript; .float bgmscriptdecay; @@ -163,12 +162,22 @@ void Draw_PointParticles() vector o; o = self.origin; sz = self.maxs - self.mins; - n = self.impulse * drawframetime; - n *= PointparticlesScript(self); + n = PointparticlesScript(self); + if(self.absolute == 2) + { + n = self.just_toggled ? self.impulse : 0; + } + else + { + n *= self.impulse * drawframetime; + if(self.just_toggled) + if(n < 1) + n = 1; + } if(n == 0) return; fail = 0; - for(i = random(); (self.just_toggled || i <= n) && fail <= 64*n; ++i) + for(i = random(); i <= n && fail <= 64*n; ++i) { p = o + self.mins; p_x += random() * sz_x; @@ -180,10 +189,12 @@ void Draw_PointParticles() { traceline(p, p + normalize(self.movedir) * 4096, 0, world); p = trace_endpos; - pointparticles(self.cnt, p, trace_plane_normal * vlen(self.movedir) + self.velocity + randomvec() * self.waterlevel, self.count, self.glow_color); + pointparticles(self.cnt, p, trace_plane_normal * vlen(self.movedir) + self.velocity + randomvec() * self.waterlevel, self.count); } else - pointparticles(self.cnt, p, self.velocity + randomvec() * self.waterlevel, self.count, self.glow_color); + { + pointparticles(self.cnt, p, self.velocity + randomvec() * self.waterlevel, self.count); + } if(self.noise != "") { self.origin = p; @@ -270,34 +281,26 @@ void Ent_PointParticles() { self.waterlevel = ReadShort() / 16.0; self.count = ReadByte() / 16.0; - self.glow_color = ReadByte(); } else { - self.waterlevel = self.glow_color = 0; + self.waterlevel = 0; self.count = 1; } if(self.noise) strunzone(self.noise); if(self.bgmscript) strunzone(self.bgmscript); - if(f & 0x10) + self.noise = strzone(ReadString()); + if(self.noise != "") { - self.noise = strzone(ReadString()); - if(self.noise != "") - { - self.atten = ReadByte() / 64.0; - self.volume = ReadByte() / 255.0; - } - self.bgmscript = strzone(ReadString()); - if(self.bgmscript != "") - self.bgmscriptdecay = ReadByte() / 255.0; - PointparticlesScript_InitEntity(self); - } - else - { - self.noise = self.bgmscript = string_null; + self.atten = ReadByte() / 64.0; + self.volume = ReadByte() / 255.0; } + self.bgmscript = strzone(ReadString()); + if(self.bgmscript != "") + self.bgmscriptdecay = ReadByte() / 255.0; + PointparticlesScript_InitEntity(self); } if(f & 2) @@ -310,6 +313,9 @@ void Ent_PointParticles() } } + if(f & 0x10) + self.absolute = 2; + setorigin(self, self.origin); setsize(self, self.mins, self.maxs); self.solid = SOLID_NOT; @@ -317,6 +323,7 @@ void Ent_PointParticles() self.entremove = Ent_PointParticles_Remove; } +.float glow_color; // palette index void Draw_Rain() { te_particlerain(self.origin + self.mins, self.origin + self.maxs, self.velocity, self.count * drawframetime, self.glow_color); diff --git a/data/qcsrc/server/g_triggers.qc b/data/qcsrc/server/g_triggers.qc index 8f0fe9e1a..fe2908cc4 100644 --- a/data/qcsrc/server/g_triggers.qc +++ b/data/qcsrc/server/g_triggers.qc @@ -562,11 +562,11 @@ float pointparticles_SendEntity(entity to, float fl) // optional features to save space fl = fl & 0x0F; - if(self.noise || self.bgmscript) - fl |= 0x10; // 2 bytes + if(self.spawnflags & 1) + fl |= 0x10; // absolute count on toggle-on if(self.movedir != '0 0 0' || self.velocity != '0 0 0') fl |= 0x20; // 4 bytes - saves CPU - if(self.glow_color || self.waterlevel || self.count != 1) + if(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 @@ -620,20 +620,16 @@ float pointparticles_SendEntity(entity to, float fl) { WriteShort(MSG_ENTITY, self.waterlevel * 16.0); WriteByte(MSG_ENTITY, self.count * 16.0); - WriteByte(MSG_ENTITY, self.glow_color); } - if(fl & 0x10) + WriteString(MSG_ENTITY, self.noise); + if(self.noise != "") { - WriteString(MSG_ENTITY, self.noise); - if(self.noise != "") - { - WriteByte(MSG_ENTITY, floor(self.atten * 64)); - WriteByte(MSG_ENTITY, floor(self.volume * 255)); - } - WriteString(MSG_ENTITY, self.bgmscript); - if(self.bgmscript != "") - WriteByte(MSG_ENTITY, floor(self.bgmscriptdecay * 255)); + WriteByte(MSG_ENTITY, floor(self.atten * 64)); + WriteByte(MSG_ENTITY, floor(self.volume * 255)); } + WriteString(MSG_ENTITY, self.bgmscript); + if(self.bgmscript != "") + WriteByte(MSG_ENTITY, floor(self.bgmscriptdecay * 255)); } return 1; } @@ -677,6 +673,8 @@ void spawnfunc_func_pointparticles() self.volume = 1; if(!self.count) self.count = 1; + if(!self.impulse) + self.impulse = 1; if(!self.modelindex) { -- 2.39.2