X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Ftriggers%2Ffunc%2Fpointparticles.qc;h=0cf0615da8e66fae26ea186239ede6f0c28ca7b0;hp=a2502da401295ccf5db61240f3346da114e7de19;hb=87cbf00c7734cf2910502c217b5c5157511ba5ea;hpb=cf1edea8694548556934b5b05f526bc192f576cb diff --git a/qcsrc/common/triggers/func/pointparticles.qc b/qcsrc/common/triggers/func/pointparticles.qc index a2502da40..0cf0615da 100644 --- a/qcsrc/common/triggers/func/pointparticles.qc +++ b/qcsrc/common/triggers/func/pointparticles.qc @@ -9,42 +9,42 @@ bool pointparticles_SendEntity(entity this, entity to, float fl) // optional features to save space fl = fl & 0x0F; - if(self.spawnflags & 2) + if(this.spawnflags & 2) fl |= 0x10; // absolute count on toggle-on - if(self.movedir != '0 0 0' || self.velocity != '0 0 0') + if(this.movedir != '0 0 0' || this.velocity != '0 0 0') fl |= 0x20; // 4 bytes - saves CPU - if(self.waterlevel || self.count != 1) + if(this.waterlevel || this.count != 1) fl |= 0x40; // 4 bytes - obscure features almost never used - if(self.mins != '0 0 0' || self.maxs != '0 0 0') + if(this.mins != '0 0 0' || this.maxs != '0 0 0') fl |= 0x80; // 14 bytes - saves lots of space WriteByte(MSG_ENTITY, fl); if(fl & 2) { - if(self.state) - WriteCoord(MSG_ENTITY, self.impulse); + if(this.state) + WriteCoord(MSG_ENTITY, this.impulse); else WriteCoord(MSG_ENTITY, 0); // off } if(fl & 4) { - WriteCoord(MSG_ENTITY, self.origin_x); - WriteCoord(MSG_ENTITY, self.origin_y); - WriteCoord(MSG_ENTITY, self.origin_z); + WriteCoord(MSG_ENTITY, this.origin_x); + WriteCoord(MSG_ENTITY, this.origin_y); + WriteCoord(MSG_ENTITY, this.origin_z); } if(fl & 1) { - if(self.model != "null") + if(this.model != "null") { - WriteShort(MSG_ENTITY, self.modelindex); + WriteShort(MSG_ENTITY, this.modelindex); if(fl & 0x80) { - WriteCoord(MSG_ENTITY, self.mins_x); - WriteCoord(MSG_ENTITY, self.mins_y); - WriteCoord(MSG_ENTITY, self.mins_z); - WriteCoord(MSG_ENTITY, self.maxs_x); - WriteCoord(MSG_ENTITY, self.maxs_y); - WriteCoord(MSG_ENTITY, self.maxs_z); + WriteCoord(MSG_ENTITY, this.mins_x); + WriteCoord(MSG_ENTITY, this.mins_y); + WriteCoord(MSG_ENTITY, this.mins_z); + WriteCoord(MSG_ENTITY, this.maxs_x); + WriteCoord(MSG_ENTITY, this.maxs_y); + WriteCoord(MSG_ENTITY, this.maxs_z); } } else @@ -52,36 +52,36 @@ bool pointparticles_SendEntity(entity this, entity to, float fl) WriteShort(MSG_ENTITY, 0); if(fl & 0x80) { - WriteCoord(MSG_ENTITY, self.maxs_x); - WriteCoord(MSG_ENTITY, self.maxs_y); - WriteCoord(MSG_ENTITY, self.maxs_z); + WriteCoord(MSG_ENTITY, this.maxs_x); + WriteCoord(MSG_ENTITY, this.maxs_y); + WriteCoord(MSG_ENTITY, this.maxs_z); } } - WriteShort(MSG_ENTITY, self.cnt); - WriteString(MSG_ENTITY, self.mdl); + WriteShort(MSG_ENTITY, this.cnt); + WriteString(MSG_ENTITY, this.mdl); if(fl & 0x20) { - WriteShort(MSG_ENTITY, compressShortVector(self.velocity)); - WriteShort(MSG_ENTITY, compressShortVector(self.movedir)); + WriteShort(MSG_ENTITY, compressShortVector(this.velocity)); + WriteShort(MSG_ENTITY, compressShortVector(this.movedir)); } if(fl & 0x40) { - WriteShort(MSG_ENTITY, self.waterlevel * 16.0); - WriteByte(MSG_ENTITY, self.count * 16.0); + WriteShort(MSG_ENTITY, this.waterlevel * 16.0); + WriteByte(MSG_ENTITY, this.count * 16.0); } - WriteString(MSG_ENTITY, self.noise); - if(self.noise != "") + WriteString(MSG_ENTITY, this.noise); + if(this.noise != "") { - WriteByte(MSG_ENTITY, floor(self.atten * 64)); - WriteByte(MSG_ENTITY, floor(self.volume * 255)); + WriteByte(MSG_ENTITY, floor(this.atten * 64)); + WriteByte(MSG_ENTITY, floor(this.volume * 255)); } - WriteString(MSG_ENTITY, self.bgmscript); - if(self.bgmscript != "") + WriteString(MSG_ENTITY, this.bgmscript); + if(this.bgmscript != "") { - WriteByte(MSG_ENTITY, floor(self.bgmscriptattack * 64)); - WriteByte(MSG_ENTITY, floor(self.bgmscriptdecay * 64)); - WriteByte(MSG_ENTITY, floor(self.bgmscriptsustain * 255)); - WriteByte(MSG_ENTITY, floor(self.bgmscriptrelease * 64)); + WriteByte(MSG_ENTITY, floor(this.bgmscriptattack * 64)); + WriteByte(MSG_ENTITY, floor(this.bgmscriptdecay * 64)); + WriteByte(MSG_ENTITY, floor(this.bgmscriptsustain * 255)); + WriteByte(MSG_ENTITY, floor(this.bgmscriptrelease * 64)); } } return 1; @@ -95,12 +95,12 @@ void pointparticles_use(entity this, entity actor, entity trigger) void pointparticles_think(entity this) { - if(self.origin != self.oldorigin) + if(this.origin != this.oldorigin) { - self.SendFlags |= 4; - self.oldorigin = self.origin; + this.SendFlags |= 4; + this.oldorigin = this.origin; } - self.nextthink = time; + this.nextthink = time; } void pointparticles_reset(entity this) @@ -149,25 +149,25 @@ spawnfunc(func_pointparticles) spawnfunc(func_sparks) { - // self.cnt is the amount of sparks that one burst will spawn - if(self.cnt < 1) { - self.cnt = 25.0; // nice default value + // this.cnt is the amount of sparks that one burst will spawn + if(this.cnt < 1) { + this.cnt = 25.0; // nice default value } - // self.wait is the probability that a sparkthink will spawn a spark shower + // this.wait is the probability that a sparkthink will spawn a spark shower // range: 0 - 1, but 0 makes little sense, so... - if(self.wait < 0.05) { - self.wait = 0.25; // nice default value + if(this.wait < 0.05) { + this.wait = 0.25; // nice default value } - self.count = self.cnt; - self.mins = '0 0 0'; - self.maxs = '0 0 0'; - self.velocity = '0 0 -1'; - self.mdl = "TE_SPARK"; - self.impulse = 10 * self.wait; // by default 2.5/sec - self.wait = 0; - self.cnt = 0; // use mdl + this.count = this.cnt; + this.mins = '0 0 0'; + this.maxs = '0 0 0'; + this.velocity = '0 0 -1'; + this.mdl = "TE_SPARK"; + this.impulse = 10 * this.wait; // by default 2.5/sec + this.wait = 0; + this.cnt = 0; // use mdl spawnfunc_func_pointparticles(this); } @@ -194,20 +194,20 @@ void Draw_PointParticles(entity this) vector p; vector sz; vector o; - o = self.origin; - sz = self.maxs - self.mins; - n = doBGMScript(self); - if(self.absolute == 2) + o = this.origin; + sz = this.maxs - this.mins; + n = doBGMScript(this); + if(this.absolute == 2) { if(n >= 0) - n = self.just_toggled ? self.impulse : 0; + n = this.just_toggled ? this.impulse : 0; else - n = self.impulse * drawframetime; + n = this.impulse * drawframetime; } else { - n *= self.impulse * drawframetime; - if(self.just_toggled) + n *= this.impulse * drawframetime; + if(this.just_toggled) if(n < 1) n = 1; } @@ -216,46 +216,46 @@ void Draw_PointParticles(entity this) fail = 0; for(i = random(); i <= n && fail <= 64*n; ++i) { - p = o + self.mins; + p = o + this.mins; p.x += random() * sz.x; p.y += random() * sz.y; p.z += random() * sz.z; - if(WarpZoneLib_BoxTouchesBrush(p, p, self, world)) + if(WarpZoneLib_BoxTouchesBrush(p, p, this, NULL)) { - if(self.movedir != '0 0 0') + if(this.movedir != '0 0 0') { - traceline(p, p + normalize(self.movedir) * 4096, 0, world); + traceline(p, p + normalize(this.movedir) * 4096, 0, NULL); p = trace_endpos; int eff_num; - if(self.cnt) - eff_num = self.cnt; + if(this.cnt) + eff_num = this.cnt; else - eff_num = _particleeffectnum(self.mdl); - __pointparticles(eff_num, p, trace_plane_normal * vlen(self.movedir) + self.velocity + randomvec() * self.waterlevel, self.count); + eff_num = _particleeffectnum(this.mdl); + __pointparticles(eff_num, p, trace_plane_normal * vlen(this.movedir) + this.velocity + randomvec() * this.waterlevel, this.count); } else { int eff_num; - if(self.cnt) - eff_num = self.cnt; + if(this.cnt) + eff_num = this.cnt; else - eff_num = _particleeffectnum(self.mdl); - __pointparticles(eff_num, p, self.velocity + randomvec() * self.waterlevel, self.count); + eff_num = _particleeffectnum(this.mdl); + __pointparticles(eff_num, p, this.velocity + randomvec() * this.waterlevel, this.count); } - if(self.noise != "") + if(this.noise != "") { - setorigin(self, p); - _sound(self, CH_AMBIENT, self.noise, VOL_BASE * self.volume, self.atten); + setorigin(this, p); + _sound(this, CH_AMBIENT, this.noise, VOL_BASE * this.volume, this.atten); } - self.just_toggled = 0; + this.just_toggled = 0; } - else if(self.absolute) + else if(this.absolute) { ++fail; --i; } } - setorigin(self, o); + setorigin(this, o); } void Ent_PointParticles_Remove(entity this) @@ -378,6 +378,7 @@ NET_HANDLE(ENT_CLIENT_POINTPARTICLES, bool isnew) setsize(this, this.mins, this.maxs); this.solid = SOLID_NOT; this.draw = Draw_PointParticles; + if (isnew) IL_PUSH(g_drawables, this); this.entremove = Ent_PointParticles_Remove; } #endif