WriteString(MSG_ENTITY, self.model);
- trigger_common_write(true);
+ trigger_common_write(self, true);
WriteCoord(MSG_ENTITY, self.pos1_x);
WriteCoord(MSG_ENTITY, self.pos1_y);
{SELFPARAM();
WriteHeader(MSG_ENTITY, ENT_CLIENT_LADDER);
- int f = 0;
- if(self.warpzone_isboxy)
- BITSET_ASSIGN(f, 1);
- if(self.origin != '0 0 0')
- BITSET_ASSIGN(f, 4);
- WriteByte(MSG_ENTITY, f);
-
- // we need THESE to render the warpzone (and cull properly)...
- if(f & 4)
- {
- WriteCoord(MSG_ENTITY, self.origin.x);
- WriteCoord(MSG_ENTITY, self.origin.y);
- WriteCoord(MSG_ENTITY, self.origin.z);
- }
-
- WriteShort(MSG_ENTITY, self.modelindex);
- 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);
- WriteByte(MSG_ENTITY, bound(1, self.scale * 16, 255));
-
WriteString(MSG_ENTITY, self.classname);
WriteByte(MSG_ENTITY, self.skin);
WriteCoord(MSG_ENTITY, self.speed);
- trigger_common_write(false);
+ trigger_common_write(self, false);
return true;
}
void func_ladder_init()
{
- //self.mdl = self.model;
- string m = self.model;
- WarpZoneLib_ExactTrigger_Init();
- if(m != "")
- {
- precache_model(m);
- _setmodel(self, m); // no precision needed
- }
- setorigin(self, self.origin);
- if(self.scale)
- setsize(self, self.mins * self.scale, self.maxs * self.scale);
- else
- setsize(self, self.mins, self.maxs);
self.touch = func_ladder_touch;
- BITSET_ASSIGN(self.effects, EF_NODEPTHTEST);
+ trigger_init(self);
func_ladder_link();
}
NET_HANDLE(ENT_CLIENT_LADDER, bool isnew)
{
- int f = ReadByte();
- self.warpzone_isboxy = (f & 1);
- if(f & 4)
- {
- self.origin_x = ReadCoord();
- self.origin_y = ReadCoord();
- self.origin_z = ReadCoord();
- }
- else
- self.origin = '0 0 0';
-
- self.modelindex = ReadShort();
- self.mins_x = ReadCoord();
- self.mins_y = ReadCoord();
- self.mins_z = ReadCoord();
- self.maxs_x = ReadCoord();
- self.maxs_y = ReadCoord();
- self.maxs_z = ReadCoord();
- self.scale = ReadByte() / 16;
self.classname = strzone(ReadString());
self.skin = ReadByte();
self.speed = ReadCoord();
WriteString(MSG_ENTITY, self.model);
- trigger_common_write(true);
+ trigger_common_write(self, true);
WriteCoord(MSG_ENTITY, self.pos1_x);
WriteCoord(MSG_ENTITY, self.pos1_y);
WriteString(MSG_ENTITY, self.model);
- trigger_common_write(true);
+ trigger_common_write(self, true);
WriteString(MSG_ENTITY, self.curvetarget);
{
WriteHeader(MSG_ENTITY, ENT_CLIENT_TRIGGER_IMPULSE);
- WriteInt24_t(MSG_ENTITY, self.spawnflags);
- WriteCoord(MSG_ENTITY, self.radius);
- WriteCoord(MSG_ENTITY, self.strength);
- WriteByte(MSG_ENTITY, self.falloff);
- WriteByte(MSG_ENTITY, self.active);
+ WriteInt24_t(MSG_ENTITY, this.spawnflags);
+ WriteCoord(MSG_ENTITY, this.radius);
+ WriteCoord(MSG_ENTITY, this.strength);
+ WriteByte(MSG_ENTITY, this.falloff);
+ WriteByte(MSG_ENTITY, this.active);
- trigger_common_write(true);
+ trigger_common_write(this, true);
return true;
}
void trigger_impulse_link()
{
- Net_LinkEntity(self, 0, false, trigger_impulse_send);
+ trigger_link(self, trigger_impulse_send);
}
spawnfunc(trigger_impulse)
{
self.active = ACTIVE_ACTIVE;
- EXACTTRIGGER_INIT;
+ trigger_init(self);
+
if(self.radius)
{
if(!self.strength) self.strength = 2000 * autocvar_g_triggerimpulse_radial_multiplier;
float trigger_push_send(entity this, entity to, float sf)
{
WriteHeader(MSG_ENTITY, ENT_CLIENT_TRIGGER_PUSH);
- WriteByte(MSG_ENTITY, sf);
- if(sf & 1)
- {
- WriteByte(MSG_ENTITY, self.team);
- WriteInt24_t(MSG_ENTITY, self.spawnflags);
- WriteByte(MSG_ENTITY, self.active);
- WriteCoord(MSG_ENTITY, self.height);
+ WriteByte(MSG_ENTITY, self.team);
+ WriteInt24_t(MSG_ENTITY, self.spawnflags);
+ WriteByte(MSG_ENTITY, self.active);
+ WriteCoord(MSG_ENTITY, self.height);
- trigger_common_write(true);
- }
-
- if(sf & 2)
- {
- WriteByte(MSG_ENTITY, self.team);
- WriteByte(MSG_ENTITY, self.active);
- }
+ trigger_common_write(self, true);
return true;
}
void trigger_push_link()
{
- BITSET_ASSIGN(self.effects, EF_NODEPTHTEST);
- Net_LinkEntity(self, false, 0, trigger_push_send);
+ trigger_link(self, trigger_push_send);
}
/*
{
SetMovedir(self);
- EXACTTRIGGER_INIT;
+ trigger_init(self);
self.active = ACTIVE_ACTIVE;
self.use = trigger_push_use;
NET_HANDLE(ENT_CLIENT_TRIGGER_PUSH, bool isnew)
{
make_pure(this);
- float sf = ReadByte();
- if(sf & 1)
- {
- self.classname = "jumppad";
- int mytm = ReadByte(); if(mytm) { self.team = mytm - 1; }
- self.spawnflags = ReadInt24_t();
- self.active = ReadByte();
- self.height = ReadCoord();
-
- trigger_common_read(true);
-
- self.entremove = trigger_remove_generic;
- self.solid = SOLID_TRIGGER;
- //self.draw = trigger_draw_generic;
- self.move_touch = trigger_push_touch;
- self.drawmask = MASK_NORMAL;
- self.move_time = time;
- defer(self, 0.25, trigger_push_findtarget);
- }
+ self.classname = "jumppad";
+ int mytm = ReadByte(); if(mytm) { self.team = mytm - 1; }
+ self.spawnflags = ReadInt24_t();
+ self.active = ReadByte();
+ self.height = ReadCoord();
+
+ trigger_common_read(true);
+
+ self.entremove = trigger_remove_generic;
+ self.solid = SOLID_TRIGGER;
+ //self.draw = trigger_draw_generic;
+ self.move_touch = trigger_push_touch;
+ self.drawmask = MASK_NORMAL;
+ self.move_time = time;
+ defer(self, 0.25, trigger_push_findtarget);
- if(sf & 2)
- {
- self.team = ReadByte();
- self.active = ReadByte();
- }
return true;
}
WriteInt24_t(MSG_ENTITY, self.itemkeys);
WriteByte(MSG_ENTITY, self.height);
- trigger_common_write(true);
+ trigger_common_write(self, true);
return true;
}
{
WriteHeader(MSG_ENTITY, ENT_CLIENT_SWAMP);
- WriteByte(MSG_ENTITY, self.dmg); // can probably get away with using a single byte here
- WriteByte(MSG_ENTITY, self.swamp_slowdown);
- WriteByte(MSG_ENTITY, self.swamp_interval);
+ WriteByte(MSG_ENTITY, this.dmg); // can probably get away with using a single byte here
+ WriteByte(MSG_ENTITY, this.swamp_slowdown);
+ WriteByte(MSG_ENTITY, this.swamp_interval);
- trigger_common_write(false);
+ trigger_common_write(this, false);
return true;
}
void swamp_link()
{SELFPARAM();
- Net_LinkEntity(self, false, 0, swamp_send);
+ trigger_link(self, swamp_send);
}
/*QUAKED spawnfunc_trigger_swamp (.5 .5 .5) ?
spawnfunc(trigger_swamp)
{
// Init stuff
- EXACTTRIGGER_INIT;
+ trigger_init(self);
self.touch = swamp_touch;
// Setup default keys, if missing
}
#ifdef SVQC
-float trigger_teleport_send(entity to, float sf)
-{SELFPARAM();
+float trigger_teleport_send(entity this, entity to, float sf)
+{
WriteHeader(MSG_ENTITY, ENT_CLIENT_TRIGGER_TELEPORT);
- int f = 0;
- if(self.warpzone_isboxy)
- BITSET_ASSIGN(f, 1);
- if(self.origin != '0 0 0')
- BITSET_ASSIGN(f, 4);
- WriteByte(MSG_ENTITY, f);
-
- if(f & 4)
- {
- WriteCoord(MSG_ENTITY, self.origin.x);
- WriteCoord(MSG_ENTITY, self.origin.y);
- WriteCoord(MSG_ENTITY, self.origin.z);
- }
+ WriteByte(MSG_ENTITY, this.team);
+ WriteInt24_t(MSG_ENTITY, this.spawnflags);
+ WriteByte(MSG_ENTITY, this.active);
+ WriteCoord(MSG_ENTITY, this.speed);
- WriteShort(MSG_ENTITY, self.modelindex);
- 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);
- WriteByte(MSG_ENTITY, bound(1, self.scale * 16, 255));
- WriteByte(MSG_ENTITY, self.team);
- WriteInt24_t(MSG_ENTITY, self.spawnflags);
- WriteByte(MSG_ENTITY, self.active);
- WriteCoord(MSG_ENTITY, self.speed);
-
- trigger_common_write(true);
+ trigger_common_write(this, true);
return true;
}
void trigger_teleport_link(entity this)
{
- this.SendEntity = trigger_teleport_send;
- this.SendFlags = 0xFFFFFF;
+ trigger_link(this, trigger_teleport_send);
}
spawnfunc(trigger_teleport)
{
self.angles = '0 0 0';
- string m = self.model;
- WarpZoneLib_ExactTrigger_Init();
- if(m != "")
- {
- precache_model(m);
- _setmodel(self, m); // no precision needed
- }
- setorigin(self, self.origin);
- if(self.scale)
- setsize(self, self.mins * self.scale, self.maxs * self.scale);
- else
- setsize(self, self.mins, self.maxs);
-
self.active = ACTIVE_ACTIVE;
- BITSET_ASSIGN(self.effects, EF_NODEPTHTEST);
+ trigger_init(self);
self.use = trigger_teleport_use;
// this must be called to spawn the teleport waypoints for bots
#elif defined(CSQC)
NET_HANDLE(ENT_CLIENT_TRIGGER_TELEPORT, bool isnew)
{
- int f = ReadByte();
- self.warpzone_isboxy = (f & 1);
- if(f & 4)
- {
- self.origin_x = ReadCoord();
- self.origin_y = ReadCoord();
- self.origin_z = ReadCoord();
- }
- else
- self.origin = '0 0 0';
-
- self.modelindex = ReadShort();
- self.mins_x = ReadCoord();
- self.mins_y = ReadCoord();
- self.mins_z = ReadCoord();
- self.maxs_x = ReadCoord();
- self.maxs_y = ReadCoord();
- self.maxs_z = ReadCoord();
- self.scale = ReadByte() / 16;
self.classname = "trigger_teleport";
int mytm = ReadByte(); if(mytm) { self.team = mytm - 1; }
self.spawnflags = ReadInt24_t();
}
#ifdef SVQC
-void trigger_common_write(bool withtarget)
-{SELFPARAM();
- WriteByte(MSG_ENTITY, self.warpzone_isboxy);
- WriteByte(MSG_ENTITY, self.scale);
- if(withtarget)
- {
- WriteString(MSG_ENTITY, self.target);
- WriteString(MSG_ENTITY, self.target2);
- WriteString(MSG_ENTITY, self.target3);
- WriteString(MSG_ENTITY, self.target4);
- WriteString(MSG_ENTITY, self.targetname);
- WriteString(MSG_ENTITY, self.killtarget);
+void trigger_init(entity this)
+{
+ string m = this.model;
+ WITH(entity, self, this, WarpZoneLib_ExactTrigger_Init());
+ if(m != "")
+ {
+ precache_model(m);
+ _setmodel(this, m); // no precision needed
}
+ setorigin(this, this.origin);
+ if(this.scale)
+ setsize(this, this.mins * this.scale, this.maxs * this.scale);
+ else
+ setsize(this, this.mins, this.maxs);
- WriteCoord(MSG_ENTITY, self.origin_x);
- WriteCoord(MSG_ENTITY, self.origin_y);
- WriteCoord(MSG_ENTITY, self.origin_z);
+ BITSET_ASSIGN(this.effects, EF_NODEPTHTEST);
+}
- 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);
+void trigger_link(entity this, bool(entity this, entity to, int sendflags) sendfunc)
+{
+ this.SendEntity = SendEntity_self;
+ this.SendEntity3 = sendfunc;
+ this.SendFlags = 0xFFFFFF;
+}
- WriteCoord(MSG_ENTITY, self.movedir_x);
- WriteCoord(MSG_ENTITY, self.movedir_y);
- WriteCoord(MSG_ENTITY, self.movedir_z);
+void trigger_common_write(entity this, bool withtarget)
+{
+ int f = 0;
+ if(this.warpzone_isboxy)
+ BITSET_ASSIGN(f, 1);
+ if(this.origin != '0 0 0')
+ BITSET_ASSIGN(f, 4);
+ WriteByte(MSG_ENTITY, f);
- WriteCoord(MSG_ENTITY, self.angles_x);
- WriteCoord(MSG_ENTITY, self.angles_y);
- WriteCoord(MSG_ENTITY, self.angles_z);
+ if(withtarget)
+ {
+ WriteString(MSG_ENTITY, this.target);
+ WriteString(MSG_ENTITY, this.target2);
+ WriteString(MSG_ENTITY, this.target3);
+ WriteString(MSG_ENTITY, this.target4);
+ WriteString(MSG_ENTITY, this.targetname);
+ WriteString(MSG_ENTITY, this.killtarget);
+ }
+
+ if(f & 4)
+ {
+ WriteCoord(MSG_ENTITY, this.origin.x);
+ WriteCoord(MSG_ENTITY, this.origin.y);
+ WriteCoord(MSG_ENTITY, this.origin.z);
+ }
+
+ WriteShort(MSG_ENTITY, this.modelindex);
+ 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);
+ WriteByte(MSG_ENTITY, bound(1, this.scale * 16, 255));
+
+ WriteCoord(MSG_ENTITY, this.movedir_x);
+ WriteCoord(MSG_ENTITY, this.movedir_y);
+ WriteCoord(MSG_ENTITY, this.movedir_z);
+
+ WriteCoord(MSG_ENTITY, this.angles_x);
+ WriteCoord(MSG_ENTITY, this.angles_y);
+ WriteCoord(MSG_ENTITY, this.angles_z);
}
#elif defined(CSQC)
void trigger_common_read(bool withtarget)
{SELFPARAM();
- self.warpzone_isboxy = ReadByte();
- self.scale = ReadByte();
+ int f = ReadByte();
+ self.warpzone_isboxy = (f & 1);
if(withtarget)
{
self.killtarget = strzone(ReadString());
}
- self.origin_x = ReadCoord();
- self.origin_y = ReadCoord();
- self.origin_z = ReadCoord();
+ if(f & 4)
+ {
+ self.origin_x = ReadCoord();
+ self.origin_y = ReadCoord();
+ self.origin_z = ReadCoord();
+ }
+ else
+ self.origin = '0 0 0';
setorigin(self, self.origin);
+ self.modelindex = ReadShort();
self.mins_x = ReadCoord();
self.mins_y = ReadCoord();
self.mins_z = ReadCoord();
self.maxs_x = ReadCoord();
self.maxs_y = ReadCoord();
self.maxs_z = ReadCoord();
+ self.scale = ReadByte() / 16;
setsize(self, self.mins, self.maxs);
self.movedir_x = ReadCoord();
// used elsewhere (will fix)
#ifdef SVQC
-void trigger_common_write(bool withtarget);
+void trigger_common_write(entity this, bool withtarget);
string trigger_magicear_processmessage_forallears(entity source, float teamsay, entity privatesay, string msgin);