fl |= 0x80; // 14 bytes - saves lots of space
WriteByte(MSG_ENTITY, fl);
if(fl & 2)
{
fl |= 0x80; // 14 bytes - saves lots of space
WriteByte(MSG_ENTITY, fl);
if(fl & 2)
{
- 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);
- 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);
- 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);
+ WriteShort(MSG_ENTITY, this.cnt);
+ WriteString(MSG_ENTITY, this.mdl);
- WriteShort(MSG_ENTITY, compressShortVector(self.velocity));
- WriteShort(MSG_ENTITY, compressShortVector(self.movedir));
+ WriteShort(MSG_ENTITY, compressShortVector(this.velocity));
+ WriteShort(MSG_ENTITY, compressShortVector(this.movedir));
- 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);
- 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));
-void pointparticles_use()
-{SELFPARAM();
- self.state = !self.state;
- self.SendFlags |= 2;
+void pointparticles_use(entity this, entity actor, entity trigger)
+{
+ this.state = !this.state;
+ this.SendFlags |= 2;
- if(self.model != "")
- _setmodel(self, self.model);
- if(self.noise != "")
- precache_sound (self.noise);
+ if(this.model != "") { precache_model(this.model); _setmodel(this, this.model); }
+ if(this.noise != "") precache_sound(this.noise);
+ if(this.mdl != "") this.cnt = 0; // use a good handler
- if(!self.bgmscriptsustain)
- self.bgmscriptsustain = 1;
- else if(self.bgmscriptsustain < 0)
- self.bgmscriptsustain = 0;
+ if(!this.bgmscriptsustain) this.bgmscriptsustain = 1;
+ else if(this.bgmscriptsustain < 0) this.bgmscriptsustain = 0;
- if(!self.atten)
- self.atten = ATTEN_NORM;
- else if(self.atten < 0)
- self.atten = 0;
- if(!self.volume)
- self.volume = 1;
- if(!self.count)
- self.count = 1;
- if(!self.impulse)
- self.impulse = 1;
+ if(!this.atten) this.atten = ATTEN_NORM;
+ else if(this.atten < 0) this.atten = 0;
+ if(!this.volume) this.volume = 1;
+ if(!this.count) this.count = 1;
+ if(!this.impulse) this.impulse = 1;
- setorigin(self, self.origin + self.mins);
- setsize(self, '0 0 0', self.maxs - self.mins);
+ setorigin(this, this.origin + this.mins);
+ setsize(this, '0 0 0', this.maxs - this.mins);
- Net_LinkEntity(self, (self.spawnflags & 4), 0, pointparticles_SendEntity);
+ Net_LinkEntity(this, (this.spawnflags & 4), 0, pointparticles_SendEntity);
- // 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.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
- if(WarpZoneLib_BoxTouchesBrush(p, p, self, world))
+ if(WarpZoneLib_BoxTouchesBrush(p, p, this, NULL))
- traceline(p, p + normalize(self.movedir) * 4096, 0, world);
+ traceline(p, p + normalize(this.movedir) * 4096, 0, NULL);
- __pointparticles(self.cnt, p, trace_plane_normal * vlen(self.movedir) + self.velocity + randomvec() * self.waterlevel, self.count);
+ int eff_num;
+ if(this.cnt)
+ eff_num = this.cnt;
+ else
+ eff_num = _particleeffectnum(this.mdl);
+ __pointparticles(eff_num, p, trace_plane_normal * vlen(this.movedir) + this.velocity + randomvec() * this.waterlevel, this.count);
- __pointparticles(self.cnt, p, self.velocity + randomvec() * self.waterlevel, self.count);
+ int eff_num;
+ if(this.cnt)
+ eff_num = this.cnt;
+ else
+ eff_num = _particleeffectnum(this.mdl);
+ __pointparticles(eff_num, p, this.velocity + randomvec() * this.waterlevel, this.count);
- 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);
-void Ent_PointParticles_Remove()
-{SELFPARAM();
- if(self.noise)
- strunzone(self.noise);
- self.noise = string_null;
- if(self.bgmscript)
- strunzone(self.bgmscript);
- self.bgmscript = string_null;
+void Ent_PointParticles_Remove(entity this)
+{
+ if(this.noise)
+ strunzone(this.noise);
+ this.noise = string_null;
+ if(this.bgmscript)
+ strunzone(this.bgmscript);
+ this.bgmscript = string_null;
+ if(this.mdl)
+ strunzone(this.mdl);
+ this.mdl = string_null;
- self.origin_x = ReadCoord();
- self.origin_y = ReadCoord();
- self.origin_z = ReadCoord();
+ this.origin_x = ReadCoord();
+ this.origin_y = ReadCoord();
+ this.origin_z = ReadCoord();
- self.mins_x = ReadCoord();
- self.mins_y = ReadCoord();
- self.mins_z = ReadCoord();
- self.maxs_x = ReadCoord();
- self.maxs_y = ReadCoord();
- self.maxs_z = ReadCoord();
+ this.mins_x = ReadCoord();
+ this.mins_y = ReadCoord();
+ this.mins_z = ReadCoord();
+ this.maxs_x = ReadCoord();
+ this.maxs_y = ReadCoord();
+ this.maxs_z = ReadCoord();
- self.mins = '0 0 0';
- self.maxs_x = ReadCoord();
- self.maxs_y = ReadCoord();
- self.maxs_z = ReadCoord();
+ this.mins = '0 0 0';
+ this.maxs_x = ReadCoord();
+ this.maxs_y = ReadCoord();
+ this.maxs_z = ReadCoord();
- self.velocity = decompressShortVector(ReadShort());
- self.movedir = decompressShortVector(ReadShort());
+ this.velocity = decompressShortVector(ReadShort());
+ this.movedir = decompressShortVector(ReadShort());
- self.bgmscriptattack = ReadByte() / 64.0;
- self.bgmscriptdecay = ReadByte() / 64.0;
- self.bgmscriptsustain = ReadByte() / 255.0;
- self.bgmscriptrelease = ReadByte() / 64.0;
+ this.bgmscriptattack = ReadByte() / 64.0;
+ this.bgmscriptdecay = ReadByte() / 64.0;
+ this.bgmscriptsustain = ReadByte() / 255.0;
+ this.bgmscriptrelease = ReadByte() / 64.0;
- v = self.maxs - self.mins;
- self.impulse *= -v.x * v.y * v.z / 262144; // relative: particles per 64^3 cube
+ v = this.maxs - this.mins;
+ this.impulse *= -v.x * v.y * v.z / 262144; // relative: particles per 64^3 cube
- setorigin(self, self.origin);
- setsize(self, self.mins, self.maxs);
- self.solid = SOLID_NOT;
- self.draw = Draw_PointParticles;
- self.entremove = Ent_PointParticles_Remove;
+ setorigin(this, this.origin);
+ 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;