From 0df9efc608a567dcbff2f81680174626a43e78aa Mon Sep 17 00:00:00 2001 From: Mario Date: Sat, 17 Feb 2018 23:36:12 +1000 Subject: [PATCH] Make ReadVector/WriteVector more commonly used --- qcsrc/client/main.qc | 9 +-- qcsrc/client/teamradar.qc | 8 +-- qcsrc/client/wall.qc | 16 ++---- qcsrc/client/weapons/projectile.qc | 8 +-- qcsrc/common/debug.qh | 6 +- qcsrc/common/effects/all.qc | 19 ++----- qcsrc/common/effects/qc/casings.qc | 9 +-- qcsrc/common/effects/qc/damageeffects.qc | 9 +-- qcsrc/common/effects/qc/globalsound.qc | 18 ++---- qcsrc/common/effects/qc/lightningarc.qc | 18 ++---- qcsrc/common/effects/qc/modeleffects.qc | 16 ++---- .../gamemode/onslaught/cl_controlpoint.qc | 4 +- .../gamemode/onslaught/cl_generator.qc | 4 +- .../gamemodes/gamemode/onslaught/onslaught.qc | 4 +- .../gamemode/onslaught/sv_controlpoint.qc | 4 +- .../gamemode/onslaught/sv_generator.qc | 4 +- .../gamemode/onslaught/sv_onslaught.qc | 12 +--- qcsrc/common/mutators/mutator/nades/net.qc | 16 ++---- .../mutator/waypoints/waypointsprites.qc | 8 +-- qcsrc/common/t_items.qc | 16 ++---- qcsrc/common/triggers/func/conveyor.qc | 32 +++-------- qcsrc/common/triggers/func/door.qc | 56 +++++-------------- qcsrc/common/triggers/func/plat.qc | 24 ++------ qcsrc/common/triggers/func/pointparticles.qc | 32 +++-------- qcsrc/common/triggers/func/rainsnow.qc | 18 ++---- qcsrc/common/triggers/func/train.qc | 32 +++-------- qcsrc/common/triggers/misc/corner.qc | 8 +-- qcsrc/common/triggers/misc/laser.qc | 16 ++---- qcsrc/common/triggers/misc/teleport_dest.qc | 8 +-- qcsrc/common/triggers/target/music.qc | 32 +++-------- qcsrc/common/triggers/trigger/jumppads.qc | 16 ++---- qcsrc/common/triggers/trigger/viewloc.qc | 16 ++---- qcsrc/common/triggers/triggers.qc | 16 ++---- qcsrc/common/turrets/cl_turrets.qc | 12 +--- qcsrc/common/turrets/sv_turrets.qc | 12 +--- qcsrc/common/vehicles/cl_vehicles.qc | 4 +- qcsrc/common/vehicles/sv_vehicles.qc | 4 +- .../vehicles/vehicle/bumblebee_weapons.qc | 16 ++---- qcsrc/common/weapons/all.qc | 9 +-- qcsrc/common/weapons/weapon/arc.qc | 28 ++++------ qcsrc/common/weapons/weapon/hook.qc | 8 +-- qcsrc/common/weapons/weapon/shockwave.qc | 12 ++-- qcsrc/common/weapons/weapon/tuba.qc | 8 +-- qcsrc/common/weapons/weapon/vaporizer.qc | 12 ++-- qcsrc/common/weapons/weapon/vortex.qc | 13 ++--- qcsrc/lib/csqcmodel/common.qh | 12 +--- qcsrc/lib/warpzone/client.qc | 53 +++++------------- qcsrc/lib/warpzone/server.qc | 4 +- qcsrc/server/g_hook.qc | 8 +-- qcsrc/server/g_models.qc | 16 ++---- qcsrc/server/spawnpoints.qc | 8 +-- qcsrc/server/weapons/csqcprojectile.qc | 8 +-- 52 files changed, 195 insertions(+), 566 deletions(-) diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index 609e03775..f0b8aac6c 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -697,10 +697,7 @@ void Spawn_PreDraw(entity this) NET_HANDLE(ENT_CLIENT_SPAWNPOINT, bool is_new) { float teamnum = (ReadByte() - 1); - vector spn_origin; - spn_origin.x = ReadCoord(); - spn_origin.y = ReadCoord(); - spn_origin.z = ReadCoord(); + vector spn_origin = ReadVector(); this.team = (teamnum + 1); @@ -757,9 +754,7 @@ NET_HANDLE(ENT_CLIENT_SPAWNEVENT, bool is_new) if(entnum) { - this.origin_x = ReadCoord(); - this.origin_y = ReadCoord(); - this.origin_z = ReadCoord(); + this.origin = ReadVector(); if(is_new) { diff --git a/qcsrc/client/teamradar.qc b/qcsrc/client/teamradar.qc index 7f1654de0..d8264f429 100644 --- a/qcsrc/client/teamradar.qc +++ b/qcsrc/client/teamradar.qc @@ -208,17 +208,13 @@ NET_HANDLE(ENT_CLIENT_RADARLINK, bool isnew) if(sendflags & 1) { - this.origin_x = ReadCoord(); - this.origin_y = ReadCoord(); - this.origin_z = ReadCoord(); + this.origin = ReadVector(); setorigin(this, this.origin); } if(sendflags & 2) { - this.velocity_x = ReadCoord(); - this.velocity_y = ReadCoord(); - this.velocity_z = ReadCoord(); + this.velocity = ReadVector(); } if(sendflags & 4) diff --git a/qcsrc/client/wall.qc b/qcsrc/client/wall.qc index a0d66d719..b57280954 100644 --- a/qcsrc/client/wall.qc +++ b/qcsrc/client/wall.qc @@ -143,9 +143,7 @@ NET_HANDLE(ENT_CLIENT_WALL, bool isnew) if(f & 2) { - this.origin_x = ReadCoord(); - this.origin_y = ReadCoord(); - this.origin_z = ReadCoord(); + this.origin = ReadVector(); setorigin(this, this.origin); } @@ -181,12 +179,8 @@ NET_HANDLE(ENT_CLIENT_WALL, bool isnew) this.scale = ReadShort() / 256.0; if(f & 0x20) { - this.mins_x = ReadCoord(); - this.mins_y = ReadCoord(); - this.mins_z = ReadCoord(); - this.maxs_x = ReadCoord(); - this.maxs_y = ReadCoord(); - this.maxs_z = ReadCoord(); + this.mins = ReadVector(); + this.maxs = ReadVector(); } else this.mins = this.maxs = '0 0 0'; @@ -211,9 +205,7 @@ NET_HANDLE(ENT_CLIENT_WALL, bool isnew) this.bgmscriptdecay = ReadByte() / 64.0; this.bgmscriptsustain = ReadByte() / 255.0; this.bgmscriptrelease = ReadByte() / 64.0; - this.movedir_x = ReadCoord(); - this.movedir_y = ReadCoord(); - this.movedir_z = ReadCoord(); + this.movedir = ReadVector(); this.lip = ReadByte() / 255.0; } this.fade_start = ReadByte(); diff --git a/qcsrc/client/weapons/projectile.qc b/qcsrc/client/weapons/projectile.qc index 3d2d32d9a..089c7df11 100644 --- a/qcsrc/client/weapons/projectile.qc +++ b/qcsrc/client/weapons/projectile.qc @@ -236,15 +236,11 @@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew) if (f & 1) { - this.origin_x = ReadCoord(); - this.origin_y = ReadCoord(); - this.origin_z = ReadCoord(); + this.origin = ReadVector(); setorigin(this, this.origin); if (this.count & 0x80) { - this.velocity_x = ReadCoord(); - this.velocity_y = ReadCoord(); - this.velocity_z = ReadCoord(); + this.velocity = ReadVector(); if (f & 0x10) this.gravity = ReadCoord(); else diff --git a/qcsrc/common/debug.qh b/qcsrc/common/debug.qh index 0200883b8..2d0c4e911 100644 --- a/qcsrc/common/debug.qh +++ b/qcsrc/common/debug.qh @@ -16,9 +16,7 @@ REGISTER_NET_TEMP(net_debug) Net_Accept(net_debug); this.sv_entnum = ReadShort(); if (ReadByte()) make_pure(this); - this.origin_x = ReadCoord(); - this.origin_y = ReadCoord(); - this.origin_z = ReadCoord(); + this.origin = ReadVector(); setorigin(this, this.origin); this.debug = true; // identify server entities by this this.classname = strzone(ReadString()); @@ -40,7 +38,7 @@ REGISTER_NET_TEMP(net_debug) o = (this.absmin + this.absmax) / 2; if (this.tag_entity) o += this.tag_entity.origin; - WriteCoord(channel, o.x); WriteCoord(channel, o.y); WriteCoord(channel, o.z); + WriteVector(channel, o); WriteString(channel, this.classname); WriteString(channel, this.sourceLoc); return true; diff --git a/qcsrc/common/effects/all.qc b/qcsrc/common/effects/all.qc index af41054e3..252f91337 100644 --- a/qcsrc/common/effects/all.qc +++ b/qcsrc/common/effects/all.qc @@ -11,18 +11,11 @@ NET_HANDLE(net_effect, bool isNew) vector vel = '0 0 0'; int eff_cnt = 1; bool eff_trail = eff.eent_eff_trail; - vector v; - v_x = ReadCoord(); - v_y = ReadCoord(); - v_z = ReadCoord(); + vector v = ReadVector(); bool use_vel = ReadByte(); if(use_vel) - { - vel_x = ReadCoord(); - vel_y = ReadCoord(); - vel_z = ReadCoord(); - } + vel = ReadVector(); if(!eff_trail) eff_cnt = ReadByte(); @@ -44,17 +37,13 @@ bool Net_Write_Effect(entity this, entity client, int sf) (Effects_COUNT >= 255) ? WriteShort(channel, this.m_id) : WriteByte(channel, this.m_id); - WriteCoord(channel, this.eent_net_location_x); - WriteCoord(channel, this.eent_net_location_y); - WriteCoord(channel, this.eent_net_location_z); + WriteVector(channel, this.eent_net_location); // attempt to save a tiny bit more bandwidth by not sending velocity if it isn't set if(this.eent_net_velocity) { WriteByte(channel, true); - WriteCoord(channel, this.eent_net_velocity_x); - WriteCoord(channel, this.eent_net_velocity_y); - WriteCoord(channel, this.eent_net_velocity_z); + WriteVector(channel, this.eent_net_velocity); } else { WriteByte(channel, false); } diff --git a/qcsrc/common/effects/qc/casings.qc b/qcsrc/common/effects/qc/casings.qc index 60f963302..2abf2122c 100644 --- a/qcsrc/common/effects/qc/casings.qc +++ b/qcsrc/common/effects/qc/casings.qc @@ -20,9 +20,7 @@ void SpawnCasing(vector vel, float randomvel, vector ang, vector avel, float ran WriteHeader(MSG_ALL, casings); WriteByte(MSG_ALL, casingtype); - WriteCoord(MSG_ALL, org.x); - WriteCoord(MSG_ALL, org.y); - WriteCoord(MSG_ALL, org.z); + WriteVector(MSG_ALL, org); WriteShort(MSG_ALL, compressShortVector(vel)); // actually compressed velocity WriteByte(MSG_ALL, ang.x * 256 / 360); WriteByte(MSG_ALL, ang.y * 256 / 360); @@ -123,10 +121,7 @@ void Casing_Damage(entity this, float thisdmg, int hittype, vector org, vector t NET_HANDLE(casings, bool isNew) { int _state = ReadByte(); - vector org; - org_x = ReadCoord(); - org_y = ReadCoord(); - org_z = ReadCoord(); + vector org = ReadVector(); vector vel = decompressShortVector(ReadShort()); vector ang; ang_x = ReadByte() * 360 / 256; diff --git a/qcsrc/common/effects/qc/damageeffects.qc b/qcsrc/common/effects/qc/damageeffects.qc index c85d66eeb..1fc64d1d2 100644 --- a/qcsrc/common/effects/qc/damageeffects.qc +++ b/qcsrc/common/effects/qc/damageeffects.qc @@ -6,11 +6,10 @@ REGISTER_NET_LINKED(ENT_CLIENT_DAMAGEINFO) bool Damage_DamageInfo_SendEntity(entity this, entity to, int sf) { + vector org = vec3(floor(this.origin.x), floor(this.origin.y), floor(this.origin.z)); WriteHeader(MSG_ENTITY, ENT_CLIENT_DAMAGEINFO); WriteShort(MSG_ENTITY, this.projectiledeathtype); - WriteCoord(MSG_ENTITY, floor(this.origin.x)); - WriteCoord(MSG_ENTITY, floor(this.origin.y)); - WriteCoord(MSG_ENTITY, floor(this.origin.z)); + WriteVector(MSG_ENTITY, org); WriteByte(MSG_ENTITY, bound(1, this.dmg, 255)); WriteByte(MSG_ENTITY, bound(0, this.dmg_radius, 255)); WriteByte(MSG_ENTITY, bound(1, this.dmg_edge, 255)); @@ -187,9 +186,7 @@ NET_HANDLE(ENT_CLIENT_DAMAGEINFO, bool isNew) w_issilent = (w_deathtype & 0x8000); w_deathtype = (w_deathtype & 0x7FFF); - w_org.x = ReadCoord(); - w_org.y = ReadCoord(); - w_org.z = ReadCoord(); + w_org = ReadVector(); thedamage = ReadByte(); rad = ReadByte(); diff --git a/qcsrc/common/effects/qc/globalsound.qc b/qcsrc/common/effects/qc/globalsound.qc index 874c64d53..4875a40ee 100644 --- a/qcsrc/common/effects/qc/globalsound.qc +++ b/qcsrc/common/effects/qc/globalsound.qc @@ -42,9 +42,7 @@ WriteByte(channel, floor(_atten * 64)); entcs_force_origin(from); vector o = from.origin + 0.5 * (from.mins + from.maxs); - WriteCoord(channel, o.x); - WriteCoord(channel, o.y); - WriteCoord(channel, o.z); + WriteVector(channel, o); } /** @@ -79,9 +77,7 @@ WriteByte(channel, floor(_atten * 64)); entcs_force_origin(from); vector o = from.origin + 0.5 * (from.mins + from.maxs); - WriteCoord(channel, o.x); - WriteCoord(channel, o.y); - WriteCoord(channel, o.z); + WriteVector(channel, o); } #endif @@ -97,10 +93,7 @@ int chan = ReadSByte(); float vol = ReadByte() / 255; float atten = ReadByte() / 64; - vector o; - o.x = ReadCoord(); - o.y = ReadCoord(); - o.z = ReadCoord(); + vector o = ReadVector(); // TODO: is this really what we want to be doing? Footsteps that follow the player at head height? if (who == player_currententnum) e = findfloat(NULL, entnum, who); // play at camera position for full volume else if (e) e.origin = o; @@ -129,10 +122,7 @@ int chan = ReadSByte(); float vol = ReadByte() / 255; float atten = ReadByte() / 64; - vector o; - o.x = ReadCoord(); - o.y = ReadCoord(); - o.z = ReadCoord(); + vector o = ReadVector(); if (who == player_currententnum) e = findfloat(NULL, entnum, who); // play at camera position for full volume else if (e) e.origin = o; if (e) diff --git a/qcsrc/common/effects/qc/lightningarc.qc b/qcsrc/common/effects/qc/lightningarc.qc index 6388575b7..80a1c98a8 100644 --- a/qcsrc/common/effects/qc/lightningarc.qc +++ b/qcsrc/common/effects/qc/lightningarc.qc @@ -8,12 +8,8 @@ REGISTER_NET_TEMP(TE_CSQC_ARC) { WriteHeader(MSG_BROADCAST, TE_CSQC_ARC); - WriteCoord(MSG_BROADCAST, from.x); - WriteCoord(MSG_BROADCAST, from.y); - WriteCoord(MSG_BROADCAST, from.z); - WriteCoord(MSG_BROADCAST, to.x); - WriteCoord(MSG_BROADCAST, to.y); - WriteCoord(MSG_BROADCAST, to.z); + WriteVector(MSG_BROADCAST, from); + WriteVector(MSG_BROADCAST, to); } #elif defined(CSQC) @@ -89,14 +85,8 @@ void b_make(vector s,vector e, string t,float l,float z) NET_HANDLE(TE_CSQC_ARC, bool isNew) { - vector from; - from.x = ReadCoord(); - from.y = ReadCoord(); - from.z = ReadCoord(); - vector to; - to.x = ReadCoord(); - to.y = ReadCoord(); - to.z = ReadCoord(); + vector from = ReadVector(); + vector to = ReadVector(); return = true; if (autocvar_cl_effects_lightningarc_simple) diff --git a/qcsrc/common/effects/qc/modeleffects.qc b/qcsrc/common/effects/qc/modeleffects.qc index 1b70daee2..26b3ec9f5 100644 --- a/qcsrc/common/effects/qc/modeleffects.qc +++ b/qcsrc/common/effects/qc/modeleffects.qc @@ -23,14 +23,10 @@ bool modeleffect_SendEntity(entity this, entity to, int sf) WriteShort(MSG_ENTITY, this.modelindex); WriteByte(MSG_ENTITY, this.skin); WriteByte(MSG_ENTITY, this.frame); - WriteCoord(MSG_ENTITY, this.origin.x); - WriteCoord(MSG_ENTITY, this.origin.y); - WriteCoord(MSG_ENTITY, this.origin.z); + WriteVector(MSG_ENTITY, this.origin); if(f & 1) { - WriteCoord(MSG_ENTITY, this.velocity.x); - WriteCoord(MSG_ENTITY, this.velocity.y); - WriteCoord(MSG_ENTITY, this.velocity.z); + WriteVector(MSG_ENTITY, this.velocity); } if(f & 2) { @@ -124,15 +120,11 @@ NET_HANDLE(ENT_CLIENT_MODELEFFECT, bool isnew) e.skin = ReadByte(); e.frame = ReadByte(); e.frame1time = time; - e.origin_x = ReadCoord(); - e.origin_y = ReadCoord(); - e.origin_z = ReadCoord(); + e.origin = ReadVector(); setorigin(e, e.origin); if(f & 1) { - e.velocity_x = ReadCoord(); - e.velocity_y = ReadCoord(); - e.velocity_z = ReadCoord(); + e.velocity = ReadVector(); } if(f & 2) { diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/cl_controlpoint.qc b/qcsrc/common/gamemodes/gamemode/onslaught/cl_controlpoint.qc index ee348fdbc..a03e5b335 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/cl_controlpoint.qc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/cl_controlpoint.qc @@ -162,9 +162,7 @@ NET_HANDLE(ENT_CLIENT_CONTROLPOINT_ICON, bool isnew) if(sf & CPSF_SETUP) { - this.origin_x = ReadCoord(); - this.origin_y = ReadCoord(); - this.origin_z = ReadCoord(); + this.origin = ReadVector(); setorigin(this, this.origin); this.health = ReadByte(); diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/cl_generator.qc b/qcsrc/common/gamemodes/gamemode/onslaught/cl_generator.qc index ac7a066ab..a3374bf91 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/cl_generator.qc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/cl_generator.qc @@ -192,9 +192,7 @@ NET_HANDLE(ENT_CLIENT_GENERATOR, bool isnew) if(sf & GSF_SETUP) { - this.origin_x = ReadCoord(); - this.origin_y = ReadCoord(); - this.origin_z = ReadCoord(); + this.origin = ReadVector(); setorigin(this, this.origin); this.health = ReadByte(); diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc b/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc index ae4d7a491..80d6a6be2 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc @@ -9,9 +9,7 @@ REGISTER_NET_LINKED(ENT_ONSCAMERA) entity generator_camera; NET_HANDLE(ENT_ONSCAMERA, bool isnew) { - this.origin_x = ReadCoord(); - this.origin_y = ReadCoord(); - this.origin_z = ReadCoord(); + this.origin = ReadVector(); setorigin(this, this.origin); this.angles_x = ReadAngle(); diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/sv_controlpoint.qc b/qcsrc/common/gamemodes/gamemode/onslaught/sv_controlpoint.qc index 0941833de..d3b6d5c7f 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/sv_controlpoint.qc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/sv_controlpoint.qc @@ -10,9 +10,7 @@ bool cpicon_send(entity this, entity to, int sf) WriteByte(MSG_ENTITY, sf); if(sf & CPSF_SETUP) { - WriteCoord(MSG_ENTITY, this.origin_x); - WriteCoord(MSG_ENTITY, this.origin_y); - WriteCoord(MSG_ENTITY, this.origin_z); + WriteVector(MSG_ENTITY, this.origin); WriteByte(MSG_ENTITY, this.health); WriteByte(MSG_ENTITY, this.max_health); diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/sv_generator.qc b/qcsrc/common/gamemodes/gamemode/onslaught/sv_generator.qc index 1b1619bc4..ac0596f2e 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/sv_generator.qc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/sv_generator.qc @@ -6,9 +6,7 @@ bool generator_send(entity this, entity to, int sf) WriteByte(MSG_ENTITY, sf); if(sf & GSF_SETUP) { - WriteCoord(MSG_ENTITY, this.origin_x); - WriteCoord(MSG_ENTITY, this.origin_y); - WriteCoord(MSG_ENTITY, this.origin_z); + WriteVector(MSG_ENTITY, this.origin); WriteByte(MSG_ENTITY, this.health); WriteByte(MSG_ENTITY, this.max_health); diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc b/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc index 0a2aeb11c..2637aeef2 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc @@ -38,9 +38,7 @@ bool clientcamera_send(entity this, entity to, int sf) { WriteHeader(MSG_ENTITY, ENT_ONSCAMERA); - WriteCoord(MSG_ENTITY, this.origin_x); - WriteCoord(MSG_ENTITY, this.origin_y); - WriteCoord(MSG_ENTITY, this.origin_z); + WriteVector(MSG_ENTITY, this.origin); WriteAngle(MSG_ENTITY, this.angles_x); WriteAngle(MSG_ENTITY, this.angles_y); @@ -272,15 +270,11 @@ bool ons_Link_Send(entity this, entity to, int sendflags) WriteByte(MSG_ENTITY, sendflags); if(sendflags & 1) { - WriteCoord(MSG_ENTITY, this.goalentity.origin_x); - WriteCoord(MSG_ENTITY, this.goalentity.origin_y); - WriteCoord(MSG_ENTITY, this.goalentity.origin_z); + WriteVector(MSG_ENTITY, this.goalentity.origin); } if(sendflags & 2) { - WriteCoord(MSG_ENTITY, this.enemy.origin_x); - WriteCoord(MSG_ENTITY, this.enemy.origin_y); - WriteCoord(MSG_ENTITY, this.enemy.origin_z); + WriteVector(MSG_ENTITY, this.enemy.origin); } if(sendflags & 4) { diff --git a/qcsrc/common/mutators/mutator/nades/net.qc b/qcsrc/common/mutators/mutator/nades/net.qc index 498d878d2..a691b866f 100644 --- a/qcsrc/common/mutators/mutator/nades/net.qc +++ b/qcsrc/common/mutators/mutator/nades/net.qc @@ -50,13 +50,9 @@ NET_HANDLE(Nade_Orb, bool isNew) Net_Accept(Nade_Orb); int sf = ReadByte(); if (sf & 1) { - this.origin_x = ReadCoord(); - this.origin_y = ReadCoord(); - this.origin_z = ReadCoord(); + this.origin = ReadVector(); setorigin(this, this.origin); - this.colormod_x = ReadCoord(); - this.colormod_y = ReadCoord(); - this.colormod_z = ReadCoord(); + this.colormod = ReadVector(); this.orb_lifetime = ReadByte(); this.orb_radius = ReadShort(); this.ltime = time + ReadByte()/10.0; @@ -74,13 +70,9 @@ bool orb_send(entity this, entity to, int sf) WriteHeader(channel, Nade_Orb); WriteByte(channel, sf); if (sf & 1) { - WriteCoord(channel, this.origin.x); - WriteCoord(channel, this.origin.y); - WriteCoord(channel, this.origin.z); + WriteVector(channel, this.origin); - WriteCoord(channel, this.colormod.x); - WriteCoord(channel, this.colormod.y); - WriteCoord(channel, this.colormod.z); + WriteVector(channel, this.colormod); WriteByte(channel, this.orb_lifetime); //WriteByte(MSG_ENTITY, this.ltime - time + 1); diff --git a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc index 7b3d2abb6..be5b40c14 100644 --- a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc +++ b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc @@ -47,9 +47,7 @@ bool WaypointSprite_SendEntity(entity this, entity to, float sendflags) if (sendflags & 64) { - WriteCoord(MSG_ENTITY, this.origin.x); - WriteCoord(MSG_ENTITY, this.origin.y); - WriteCoord(MSG_ENTITY, this.origin.z); + WriteVector(MSG_ENTITY, this.origin); } if (sendflags & 1) @@ -159,9 +157,7 @@ void Ent_WaypointSprite(entity this, bool isnew) if (sendflags & 64) { // unfortunately, this needs to be exact (for the 3D display) - this.origin_x = ReadCoord(); - this.origin_y = ReadCoord(); - this.origin_z = ReadCoord(); + this.origin = ReadVector(); setorigin(this, this.origin); } diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index b5a939e50..86da4a95b 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -158,9 +158,7 @@ NET_HANDLE(ENT_CLIENT_ITEM, bool isnew) if(sf & ISF_LOCATION) { - this.origin_x = ReadCoord(); - this.origin_y = ReadCoord(); - this.origin_z = ReadCoord(); + this.origin = ReadVector(); setorigin(this, this.origin); this.oldorigin = this.origin; } @@ -267,9 +265,7 @@ NET_HANDLE(ENT_CLIENT_ITEM, bool isnew) this.pushable = true; //this.angles = '0 0 0'; set_movetype(this, MOVETYPE_TOSS); - this.velocity_x = ReadCoord(); - this.velocity_y = ReadCoord(); - this.velocity_z = ReadCoord(); + this.velocity = ReadVector(); setorigin(this, this.oldorigin); if(!this.move_time) @@ -311,9 +307,7 @@ bool ItemSend(entity this, entity to, int sf) //WriteByte(MSG_ENTITY, this.cnt); if(sf & ISF_LOCATION) { - WriteCoord(MSG_ENTITY, this.origin.x); - WriteCoord(MSG_ENTITY, this.origin.y); - WriteCoord(MSG_ENTITY, this.origin.z); + WriteVector(MSG_ENTITY, this.origin); } if(sf & ISF_ANGLES) @@ -356,9 +350,7 @@ bool ItemSend(entity this, entity to, int sf) if(sf & ISF_DROP) { - WriteCoord(MSG_ENTITY, this.velocity.x); - WriteCoord(MSG_ENTITY, this.velocity.y); - WriteCoord(MSG_ENTITY, this.velocity.z); + WriteVector(MSG_ENTITY, this.velocity); } return true; diff --git a/qcsrc/common/triggers/func/conveyor.qc b/qcsrc/common/triggers/func/conveyor.qc index 6adbcc65f..1802a75db 100644 --- a/qcsrc/common/triggers/func/conveyor.qc +++ b/qcsrc/common/triggers/func/conveyor.qc @@ -85,20 +85,12 @@ bool conveyor_send(entity this, entity to, int sf) if(sf & 1) { WriteByte(MSG_ENTITY, this.warpzone_isboxy); - WriteCoord(MSG_ENTITY, this.origin_x); - WriteCoord(MSG_ENTITY, this.origin_y); - WriteCoord(MSG_ENTITY, this.origin_z); + WriteVector(MSG_ENTITY, this.origin); - 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); + WriteVector(MSG_ENTITY, this.mins); + WriteVector(MSG_ENTITY, this.maxs); - WriteCoord(MSG_ENTITY, this.movedir_x); - WriteCoord(MSG_ENTITY, this.movedir_y); - WriteCoord(MSG_ENTITY, this.movedir_z); + WriteVector(MSG_ENTITY, this.movedir); WriteByte(MSG_ENTITY, this.speed); WriteByte(MSG_ENTITY, this.state); @@ -174,22 +166,14 @@ NET_HANDLE(ENT_CLIENT_CONVEYOR, bool isnew) if(sf & 1) { this.warpzone_isboxy = ReadByte(); - this.origin_x = ReadCoord(); - this.origin_y = ReadCoord(); - this.origin_z = ReadCoord(); + this.origin = ReadVector(); setorigin(this, this.origin); - this.mins_x = ReadCoord(); - this.mins_y = ReadCoord(); - this.mins_z = ReadCoord(); - this.maxs_x = ReadCoord(); - this.maxs_y = ReadCoord(); - this.maxs_z = ReadCoord(); + this.mins = ReadVector(); + this.maxs = ReadVector(); setsize(this, this.mins, this.maxs); - this.movedir_x = ReadCoord(); - this.movedir_y = ReadCoord(); - this.movedir_z = ReadCoord(); + this.movedir = ReadVector(); this.speed = ReadByte(); this.state = ReadByte(); diff --git a/qcsrc/common/triggers/func/door.qc b/qcsrc/common/triggers/func/door.qc index 48c91ec97..f768717c6 100644 --- a/qcsrc/common/triggers/func/door.qc +++ b/qcsrc/common/triggers/func/door.qc @@ -628,16 +628,10 @@ float door_send(entity this, entity to, float sf) trigger_common_write(this, true); - WriteCoord(MSG_ENTITY, this.pos1_x); - WriteCoord(MSG_ENTITY, this.pos1_y); - WriteCoord(MSG_ENTITY, this.pos1_z); - WriteCoord(MSG_ENTITY, this.pos2_x); - WriteCoord(MSG_ENTITY, this.pos2_y); - WriteCoord(MSG_ENTITY, this.pos2_z); + WriteVector(MSG_ENTITY, this.pos1); + WriteVector(MSG_ENTITY, this.pos2); - WriteCoord(MSG_ENTITY, this.size_x); - WriteCoord(MSG_ENTITY, this.size_y); - WriteCoord(MSG_ENTITY, this.size_z); + WriteVector(MSG_ENTITY, this.size); WriteShort(MSG_ENTITY, this.wait); WriteShort(MSG_ENTITY, this.speed); @@ -653,16 +647,10 @@ float door_send(entity this, entity to, float sf) if(sf & SF_TRIGGER_UPDATE) { - WriteCoord(MSG_ENTITY, this.origin_x); - WriteCoord(MSG_ENTITY, this.origin_y); - WriteCoord(MSG_ENTITY, this.origin_z); - - WriteCoord(MSG_ENTITY, this.pos1_x); - WriteCoord(MSG_ENTITY, this.pos1_y); - WriteCoord(MSG_ENTITY, this.pos1_z); - WriteCoord(MSG_ENTITY, this.pos2_x); - WriteCoord(MSG_ENTITY, this.pos2_y); - WriteCoord(MSG_ENTITY, this.pos2_z); + WriteVector(MSG_ENTITY, this.origin); + + WriteVector(MSG_ENTITY, this.pos1); + WriteVector(MSG_ENTITY, this.pos2); } return true; @@ -798,22 +786,10 @@ NET_HANDLE(ENT_CLIENT_DOOR, bool isnew) trigger_common_read(this, true); - vector v; - - v.x = ReadCoord(); - v.y = ReadCoord(); - v.z = ReadCoord(); - this.pos1 = v; - - v.x = ReadCoord(); - v.y = ReadCoord(); - v.z = ReadCoord(); - this.pos2 = v; + this.pos1 = ReadVector(); + this.pos2 = ReadVector(); - v.x = ReadCoord(); - v.y = ReadCoord(); - v.z = ReadCoord(); - this.size = v; + this.size = ReadVector(); this.wait = ReadShort(); this.speed = ReadShort(); @@ -841,17 +817,11 @@ NET_HANDLE(ENT_CLIENT_DOOR, bool isnew) if(sf & SF_TRIGGER_UPDATE) { - this.origin_x = ReadCoord(); - this.origin_y = ReadCoord(); - this.origin_z = ReadCoord(); + this.origin = ReadVector(); setorigin(this, this.origin); - this.pos1_x = ReadCoord(); - this.pos1_y = ReadCoord(); - this.pos1_z = ReadCoord(); - this.pos2_x = ReadCoord(); - this.pos2_y = ReadCoord(); - this.pos2_z = ReadCoord(); + this.pos1 = ReadVector(); + this.pos2 = ReadVector(); } return true; } diff --git a/qcsrc/common/triggers/func/plat.qc b/qcsrc/common/triggers/func/plat.qc index 36b4eefff..9f97a1cea 100644 --- a/qcsrc/common/triggers/func/plat.qc +++ b/qcsrc/common/triggers/func/plat.qc @@ -26,16 +26,10 @@ float plat_send(entity this, entity to, float sf) trigger_common_write(this, true); - WriteCoord(MSG_ENTITY, this.pos1_x); - WriteCoord(MSG_ENTITY, this.pos1_y); - WriteCoord(MSG_ENTITY, this.pos1_z); - WriteCoord(MSG_ENTITY, this.pos2_x); - WriteCoord(MSG_ENTITY, this.pos2_y); - WriteCoord(MSG_ENTITY, this.pos2_z); + WriteVector(MSG_ENTITY, this.pos1); + WriteVector(MSG_ENTITY, this.pos2); - WriteCoord(MSG_ENTITY, this.size_x); - WriteCoord(MSG_ENTITY, this.size_y); - WriteCoord(MSG_ENTITY, this.size_z); + WriteVector(MSG_ENTITY, this.size); WriteAngle(MSG_ENTITY, this.mangle_x); WriteAngle(MSG_ENTITY, this.mangle_y); @@ -138,16 +132,10 @@ NET_HANDLE(ENT_CLIENT_PLAT, bool isnew) trigger_common_read(this, true); - this.pos1_x = ReadCoord(); - this.pos1_y = ReadCoord(); - this.pos1_z = ReadCoord(); - this.pos2_x = ReadCoord(); - this.pos2_y = ReadCoord(); - this.pos2_z = ReadCoord(); + this.pos1 = ReadVector(); + this.pos2 = ReadVector(); - this.size_x = ReadCoord(); - this.size_y = ReadCoord(); - this.size_z = ReadCoord(); + this.size = ReadVector(); this.mangle_x = ReadAngle(); this.mangle_y = ReadAngle(); diff --git a/qcsrc/common/triggers/func/pointparticles.qc b/qcsrc/common/triggers/func/pointparticles.qc index a0773f249..54fe212ae 100644 --- a/qcsrc/common/triggers/func/pointparticles.qc +++ b/qcsrc/common/triggers/func/pointparticles.qc @@ -29,9 +29,7 @@ bool pointparticles_SendEntity(entity this, entity to, float fl) } if(fl & 4) { - WriteCoord(MSG_ENTITY, this.origin_x); - WriteCoord(MSG_ENTITY, this.origin_y); - WriteCoord(MSG_ENTITY, this.origin_z); + WriteVector(MSG_ENTITY, this.origin); } if(fl & 1) { @@ -40,12 +38,8 @@ bool pointparticles_SendEntity(entity this, entity to, float fl) WriteShort(MSG_ENTITY, this.modelindex); if(fl & 0x80) { - 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); + WriteVector(MSG_ENTITY, this.mins); + WriteVector(MSG_ENTITY, this.maxs); } } else @@ -53,9 +47,7 @@ bool pointparticles_SendEntity(entity this, entity to, float fl) WriteShort(MSG_ENTITY, 0); if(fl & 0x80) { - WriteCoord(MSG_ENTITY, this.maxs_x); - WriteCoord(MSG_ENTITY, this.maxs_y); - WriteCoord(MSG_ENTITY, this.maxs_z); + WriteVector(MSG_ENTITY, this.maxs); } } WriteShort(MSG_ENTITY, this.cnt); @@ -286,9 +278,7 @@ NET_HANDLE(ENT_CLIENT_POINTPARTICLES, bool isnew) } if(f & 4) { - this.origin_x = ReadCoord(); - this.origin_y = ReadCoord(); - this.origin_z = ReadCoord(); + this.origin = ReadVector(); } if(f & 1) { @@ -297,19 +287,13 @@ NET_HANDLE(ENT_CLIENT_POINTPARTICLES, bool isnew) { if(this.modelindex) { - this.mins_x = ReadCoord(); - this.mins_y = ReadCoord(); - this.mins_z = ReadCoord(); - this.maxs_x = ReadCoord(); - this.maxs_y = ReadCoord(); - this.maxs_z = ReadCoord(); + this.mins = ReadVector(); + this.maxs = ReadVector(); } else { this.mins = '0 0 0'; - this.maxs_x = ReadCoord(); - this.maxs_y = ReadCoord(); - this.maxs_z = ReadCoord(); + this.maxs = ReadVector(); } } else diff --git a/qcsrc/common/triggers/func/rainsnow.qc b/qcsrc/common/triggers/func/rainsnow.qc index c8b4e2924..1817a9ce9 100644 --- a/qcsrc/common/triggers/func/rainsnow.qc +++ b/qcsrc/common/triggers/func/rainsnow.qc @@ -4,14 +4,12 @@ REGISTER_NET_LINKED(ENT_CLIENT_RAINSNOW) #ifdef SVQC bool rainsnow_SendEntity(entity this, entity to, float sf) { + vector myorg = this.origin + this.mins; + vector mysize = this.maxs - this.mins; WriteHeader(MSG_ENTITY, ENT_CLIENT_RAINSNOW); WriteByte(MSG_ENTITY, this.state); - WriteCoord(MSG_ENTITY, this.origin_x + this.mins_x); - WriteCoord(MSG_ENTITY, this.origin_y + this.mins_y); - WriteCoord(MSG_ENTITY, this.origin_z + this.mins_z); - WriteCoord(MSG_ENTITY, this.maxs_x - this.mins_x); - WriteCoord(MSG_ENTITY, this.maxs_y - this.mins_y); - WriteCoord(MSG_ENTITY, this.maxs_z - this.mins_z); + WriteVector(MSG_ENTITY, myorg); + WriteVector(MSG_ENTITY, mysize); WriteShort(MSG_ENTITY, compressShortVector(this.dest)); WriteShort(MSG_ENTITY, this.count); WriteByte(MSG_ENTITY, this.cnt); @@ -116,12 +114,8 @@ void Draw_Snow(entity this) NET_HANDLE(ENT_CLIENT_RAINSNOW, bool isnew) { this.impulse = ReadByte(); // Rain, Snow, or Whatever - this.origin_x = ReadCoord(); - this.origin_y = ReadCoord(); - this.origin_z = ReadCoord(); - this.maxs_x = ReadCoord(); - this.maxs_y = ReadCoord(); - this.maxs_z = ReadCoord(); + this.origin = ReadVector(); + this.maxs = ReadVector(); this.velocity = decompressShortVector(ReadShort()); this.count = ReadShort() * 10; this.glow_color = ReadByte(); // color diff --git a/qcsrc/common/triggers/func/train.qc b/qcsrc/common/triggers/func/train.qc index c5a6e3d03..ead086708 100644 --- a/qcsrc/common/triggers/func/train.qc +++ b/qcsrc/common/triggers/func/train.qc @@ -157,20 +157,12 @@ float train_send(entity this, entity to, float sf) WriteString(MSG_ENTITY, this.curvetarget); - WriteCoord(MSG_ENTITY, this.pos1_x); - WriteCoord(MSG_ENTITY, this.pos1_y); - WriteCoord(MSG_ENTITY, this.pos1_z); - WriteCoord(MSG_ENTITY, this.pos2_x); - WriteCoord(MSG_ENTITY, this.pos2_y); - WriteCoord(MSG_ENTITY, this.pos2_z); + WriteVector(MSG_ENTITY, this.pos1); + WriteVector(MSG_ENTITY, this.pos2); - WriteCoord(MSG_ENTITY, this.size_x); - WriteCoord(MSG_ENTITY, this.size_y); - WriteCoord(MSG_ENTITY, this.size_z); + WriteVector(MSG_ENTITY, this.size); - WriteCoord(MSG_ENTITY, this.view_ofs_x); - WriteCoord(MSG_ENTITY, this.view_ofs_y); - WriteCoord(MSG_ENTITY, this.view_ofs_z); + WriteVector(MSG_ENTITY, this.view_ofs); WriteAngle(MSG_ENTITY, this.mangle_x); WriteAngle(MSG_ENTITY, this.mangle_y); @@ -304,20 +296,12 @@ NET_HANDLE(ENT_CLIENT_TRAIN, bool isnew) this.curvetarget = strzone(ReadString()); - this.pos1_x = ReadCoord(); - this.pos1_y = ReadCoord(); - this.pos1_z = ReadCoord(); - this.pos2_x = ReadCoord(); - this.pos2_y = ReadCoord(); - this.pos2_z = ReadCoord(); + this.pos1 = ReadVector(); + this.pos2 = ReadVector(); - this.size_x = ReadCoord(); - this.size_y = ReadCoord(); - this.size_z = ReadCoord(); + this.size = ReadVector(); - this.view_ofs_x = ReadCoord(); - this.view_ofs_y = ReadCoord(); - this.view_ofs_z = ReadCoord(); + this.view_ofs = ReadVector(); this.mangle_x = ReadAngle(); this.mangle_y = ReadAngle(); diff --git a/qcsrc/common/triggers/misc/corner.qc b/qcsrc/common/triggers/misc/corner.qc index dcc44710f..6c9093318 100644 --- a/qcsrc/common/triggers/misc/corner.qc +++ b/qcsrc/common/triggers/misc/corner.qc @@ -8,9 +8,7 @@ bool corner_send(entity this, entity to, int sf) WriteString(MSG_ENTITY, this.platmovetype); - WriteCoord(MSG_ENTITY, this.origin_x); - WriteCoord(MSG_ENTITY, this.origin_y); - WriteCoord(MSG_ENTITY, this.origin_z); + WriteVector(MSG_ENTITY, this.origin); WriteString(MSG_ENTITY, this.target); WriteString(MSG_ENTITY, this.target2); @@ -64,9 +62,7 @@ NET_HANDLE(ENT_CLIENT_CORNER, bool isnew) { this.platmovetype = strzone(ReadString()); - this.origin_x = ReadCoord(); - this.origin_y = ReadCoord(); - this.origin_z = ReadCoord(); + this.origin = ReadVector(); setorigin(this, this.origin); this.target = strzone(ReadString()); diff --git a/qcsrc/common/triggers/misc/laser.qc b/qcsrc/common/triggers/misc/laser.qc index 45bd21fd1..3d5ef42d8 100644 --- a/qcsrc/common/triggers/misc/laser.qc +++ b/qcsrc/common/triggers/misc/laser.qc @@ -137,9 +137,7 @@ bool laser_SendEntity(entity this, entity to, float fl) WriteByte(MSG_ENTITY, fl); if(fl & 1) { - WriteCoord(MSG_ENTITY, this.origin_x); - WriteCoord(MSG_ENTITY, this.origin_y); - WriteCoord(MSG_ENTITY, this.origin_z); + WriteVector(MSG_ENTITY, this.origin); } if(fl & 8) { @@ -160,9 +158,7 @@ bool laser_SendEntity(entity this, entity to, float fl) { if(fl & 0x80) { - WriteCoord(MSG_ENTITY, this.enemy.origin_x); - WriteCoord(MSG_ENTITY, this.enemy.origin_y); - WriteCoord(MSG_ENTITY, this.enemy.origin_z); + WriteVector(MSG_ENTITY, this.enemy.origin); } else { @@ -331,9 +327,7 @@ NET_HANDLE(ENT_CLIENT_LASER, bool isnew) if(f & 1) { - this.origin_x = ReadCoord(); - this.origin_y = ReadCoord(); - this.origin_z = ReadCoord(); + this.origin = ReadVector(); setorigin(this, this.origin); } if(f & 8) @@ -361,9 +355,7 @@ NET_HANDLE(ENT_CLIENT_LASER, bool isnew) { if(f & 0x80) { - this.velocity_x = ReadCoord(); - this.velocity_y = ReadCoord(); - this.velocity_z = ReadCoord(); + this.velocity = ReadVector(); } else { diff --git a/qcsrc/common/triggers/misc/teleport_dest.qc b/qcsrc/common/triggers/misc/teleport_dest.qc index 3f5203806..40c7d46c4 100644 --- a/qcsrc/common/triggers/misc/teleport_dest.qc +++ b/qcsrc/common/triggers/misc/teleport_dest.qc @@ -13,9 +13,7 @@ bool teleport_dest_send(entity this, entity to, int sf) WriteByte(MSG_ENTITY, this.cnt); WriteCoord(MSG_ENTITY, this.speed); WriteString(MSG_ENTITY, this.targetname); - WriteCoord(MSG_ENTITY, this.origin_x); - WriteCoord(MSG_ENTITY, this.origin_y); - WriteCoord(MSG_ENTITY, this.origin_z); + WriteVector(MSG_ENTITY, this.origin); WriteAngle(MSG_ENTITY, this.mangle_x); WriteAngle(MSG_ENTITY, this.mangle_y); @@ -78,9 +76,7 @@ NET_HANDLE(ENT_CLIENT_TELEPORT_DEST, bool isnew) this.cnt = ReadByte(); this.speed = ReadCoord(); this.targetname = strzone(ReadString()); - this.origin_x = ReadCoord(); - this.origin_y = ReadCoord(); - this.origin_z = ReadCoord(); + this.origin = ReadVector(); this.mangle_x = ReadAngle(); this.mangle_y = ReadAngle(); diff --git a/qcsrc/common/triggers/target/music.qc b/qcsrc/common/triggers/target/music.qc index 1f8cb00cb..7ec335138 100644 --- a/qcsrc/common/triggers/target/music.qc +++ b/qcsrc/common/triggers/target/music.qc @@ -103,28 +103,20 @@ bool trigger_music_SendEntity(entity this, entity to, float sf) WriteByte(MSG_ENTITY, sf); if(sf & 4) { - WriteCoord(MSG_ENTITY, this.origin.x); - WriteCoord(MSG_ENTITY, this.origin.y); - WriteCoord(MSG_ENTITY, this.origin.z); + WriteVector(MSG_ENTITY, this.origin); } if(sf & 1) { if(this.model != "null") { 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); + WriteVector(MSG_ENTITY, this.mins); + WriteVector(MSG_ENTITY, this.maxs); } else { WriteShort(MSG_ENTITY, 0); - WriteCoord(MSG_ENTITY, this.maxs.x); - WriteCoord(MSG_ENTITY, this.maxs.y); - WriteCoord(MSG_ENTITY, this.maxs.z); + WriteVector(MSG_ENTITY, this.maxs); } WriteByte(MSG_ENTITY, this.volume * 255.0); WriteByte(MSG_ENTITY, this.fade_time * 16.0); @@ -280,28 +272,20 @@ NET_HANDLE(ENT_CLIENT_TRIGGER_MUSIC, bool isnew) int f = ReadByte(); if(f & 4) { - this.origin_x = ReadCoord(); - this.origin_y = ReadCoord(); - this.origin_z = ReadCoord(); + this.origin = ReadVector(); } if(f & 1) { this.modelindex = ReadShort(); if(this.modelindex) { - this.mins_x = ReadCoord(); - this.mins_y = ReadCoord(); - this.mins_z = ReadCoord(); - this.maxs_x = ReadCoord(); - this.maxs_y = ReadCoord(); - this.maxs_z = ReadCoord(); + this.mins = ReadVector(); + this.maxs = ReadVector(); } else { this.mins = '0 0 0'; - this.maxs_x = ReadCoord(); - this.maxs_y = ReadCoord(); - this.maxs_z = ReadCoord(); + this.maxs = ReadVector(); } this.volume = ReadByte() / 255.0; diff --git a/qcsrc/common/triggers/trigger/jumppads.qc b/qcsrc/common/triggers/trigger/jumppads.qc index 9e40cfd40..fde6e1fb9 100644 --- a/qcsrc/common/triggers/trigger/jumppads.qc +++ b/qcsrc/common/triggers/trigger/jumppads.qc @@ -472,9 +472,7 @@ float trigger_push_send(entity this, entity to, float sf) WriteByte(MSG_ENTITY, this.active); WriteCoord(MSG_ENTITY, this.height); - WriteCoord(MSG_ENTITY, this.movedir_x); - WriteCoord(MSG_ENTITY, this.movedir_y); - WriteCoord(MSG_ENTITY, this.movedir_z); + WriteVector(MSG_ENTITY, this.movedir); trigger_common_write(this, true); @@ -537,9 +535,7 @@ bool target_push_send(entity this, entity to, float sf) WriteByte(MSG_ENTITY, this.cnt); WriteString(MSG_ENTITY, this.targetname); - WriteCoord(MSG_ENTITY, this.origin_x); - WriteCoord(MSG_ENTITY, this.origin_y); - WriteCoord(MSG_ENTITY, this.origin_z); + WriteVector(MSG_ENTITY, this.origin); WriteAngle(MSG_ENTITY, this.angles_x); WriteAngle(MSG_ENTITY, this.angles_y); @@ -595,9 +591,7 @@ NET_HANDLE(ENT_CLIENT_TRIGGER_PUSH, bool isnew) this.active = ReadByte(); this.height = ReadCoord(); - this.movedir_x = ReadCoord(); - this.movedir_y = ReadCoord(); - this.movedir_z = ReadCoord(); + this.movedir = ReadVector(); trigger_common_read(this, true); @@ -626,9 +620,7 @@ NET_HANDLE(ENT_CLIENT_TARGET_PUSH, bool isnew) this.classname = "push_target"; this.cnt = ReadByte(); this.targetname = strzone(ReadString()); - this.origin_x = ReadCoord(); - this.origin_y = ReadCoord(); - this.origin_z = ReadCoord(); + this.origin = ReadVector(); this.angles_x = ReadAngle(); this.angles_y = ReadAngle(); diff --git a/qcsrc/common/triggers/trigger/viewloc.qc b/qcsrc/common/triggers/trigger/viewloc.qc index 50bf3d05e..8b985795d 100644 --- a/qcsrc/common/triggers/trigger/viewloc.qc +++ b/qcsrc/common/triggers/trigger/viewloc.qc @@ -76,9 +76,7 @@ bool trigger_viewloc_send(entity this, entity to, int sf) WriteEntity(MSG_ENTITY, this.enemy); WriteEntity(MSG_ENTITY, this.goalentity); - WriteCoord(MSG_ENTITY, this.origin_x); - WriteCoord(MSG_ENTITY, this.origin_y); - WriteCoord(MSG_ENTITY, this.origin_z); + WriteVector(MSG_ENTITY, this.origin); return true; } @@ -125,9 +123,7 @@ bool viewloc_send(entity this, entity to, int sf) WriteByte(MSG_ENTITY, this.cnt); - WriteCoord(MSG_ENTITY, this.origin_x); - WriteCoord(MSG_ENTITY, this.origin_y); - WriteCoord(MSG_ENTITY, this.origin_z); + WriteVector(MSG_ENTITY, this.origin); WriteAngle(MSG_ENTITY, this.angles_x); WriteAngle(MSG_ENTITY, this.angles_y); @@ -178,9 +174,7 @@ NET_HANDLE(ENT_CLIENT_VIEWLOC_TRIGGER, bool isnew) this.enemy = findfloat(NULL, entnum, point1); this.goalentity = findfloat(NULL, entnum, point2); - this.origin_x = ReadCoord(); - this.origin_y = ReadCoord(); - this.origin_z = ReadCoord(); + this.origin = ReadVector(); return = true; @@ -200,9 +194,7 @@ NET_HANDLE(ENT_CLIENT_VIEWLOC, bool isnew) { this.cnt = ReadByte(); - this.origin_x = ReadCoord(); - this.origin_y = ReadCoord(); - this.origin_z = ReadCoord(); + this.origin = ReadVector(); setorigin(this, this.origin); this.movedir_x = ReadAngle(); diff --git a/qcsrc/common/triggers/triggers.qc b/qcsrc/common/triggers/triggers.qc index 6d8c5bb7e..fbd20c840 100644 --- a/qcsrc/common/triggers/triggers.qc +++ b/qcsrc/common/triggers/triggers.qc @@ -102,12 +102,8 @@ void trigger_common_write(entity this, bool withtarget) WriteVector(MSG_ENTITY, this.angles); 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); + WriteVector(MSG_ENTITY, this.mins); + WriteVector(MSG_ENTITY, this.maxs); WriteByte(MSG_ENTITY, bound(1, this.scale * 16, 255)); } @@ -162,12 +158,8 @@ void trigger_common_read(entity this, bool withtarget) this.angles = '0 0 0'; this.modelindex = ReadShort(); - this.mins_x = ReadCoord(); - this.mins_y = ReadCoord(); - this.mins_z = ReadCoord(); - this.maxs_x = ReadCoord(); - this.maxs_y = ReadCoord(); - this.maxs_z = ReadCoord(); + this.mins = ReadVector(); + this.maxs = ReadVector(); this.scale = ReadByte() / 16; setsize(this, this.mins, this.maxs); } diff --git a/qcsrc/common/turrets/cl_turrets.qc b/qcsrc/common/turrets/cl_turrets.qc index a57719b82..ba7b5d01b 100644 --- a/qcsrc/common/turrets/cl_turrets.qc +++ b/qcsrc/common/turrets/cl_turrets.qc @@ -361,9 +361,7 @@ NET_HANDLE(ENT_CLIENT_TURRET, bool isnew) { this.m_id = ReadByte(); - this.origin_x = ReadCoord(); - this.origin_y = ReadCoord(); - this.origin_z = ReadCoord(); + this.origin = ReadVector(); setorigin(this, this.origin); this.angles_x = ReadAngle(); @@ -397,14 +395,10 @@ NET_HANDLE(ENT_CLIENT_TURRET, bool isnew) if(sf & TNSF_MOVE) { - this.origin_x = ReadShort(); - this.origin_y = ReadShort(); - this.origin_z = ReadShort(); + this.origin = ReadVector(); setorigin(this, this.origin); - this.velocity_x = ReadShort(); - this.velocity_y = ReadShort(); - this.velocity_z = ReadShort(); + this.velocity = ReadVector(); this.angles_y = ReadShort(); diff --git a/qcsrc/common/turrets/sv_turrets.qc b/qcsrc/common/turrets/sv_turrets.qc index 21da98a48..2a7c41c98 100644 --- a/qcsrc/common/turrets/sv_turrets.qc +++ b/qcsrc/common/turrets/sv_turrets.qc @@ -313,9 +313,7 @@ bool turret_send(entity this, entity to, float sf) { WriteByte(MSG_ENTITY, this.m_id); - WriteCoord(MSG_ENTITY, this.origin_x); - WriteCoord(MSG_ENTITY, this.origin_y); - WriteCoord(MSG_ENTITY, this.origin_z); + WriteVector(MSG_ENTITY, this.origin); WriteAngle(MSG_ENTITY, this.angles_x); WriteAngle(MSG_ENTITY, this.angles_y); @@ -335,13 +333,9 @@ bool turret_send(entity this, entity to, float sf) if(sf & TNSF_MOVE) { - WriteShort(MSG_ENTITY, rint(this.origin_x)); - WriteShort(MSG_ENTITY, rint(this.origin_y)); - WriteShort(MSG_ENTITY, rint(this.origin_z)); + WriteVector(MSG_ENTITY, this.origin); - WriteShort(MSG_ENTITY, rint(this.velocity_x)); - WriteShort(MSG_ENTITY, rint(this.velocity_y)); - WriteShort(MSG_ENTITY, rint(this.velocity_z)); + WriteVector(MSG_ENTITY, this.velocity); WriteShort(MSG_ENTITY, rint(this.angles_y)); } diff --git a/qcsrc/common/vehicles/cl_vehicles.qc b/qcsrc/common/vehicles/cl_vehicles.qc index b2f87821e..51ac4bee4 100644 --- a/qcsrc/common/vehicles/cl_vehicles.qc +++ b/qcsrc/common/vehicles/cl_vehicles.qc @@ -70,9 +70,7 @@ NET_HANDLE(ENT_CLIENT_AUXILIARYXHAIR, bool isnew) if(sf & 2) { - axh.origin_x = ReadCoord(); - axh.origin_y = ReadCoord(); - axh.origin_z = ReadCoord(); + axh.origin = ReadVector(); } if(sf & 4) diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc index 63d662923..dc217bb35 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qc +++ b/qcsrc/common/vehicles/sv_vehicles.qc @@ -9,9 +9,7 @@ bool SendAuxiliaryXhair(entity this, entity to, int sf) if(sf & 2) { - WriteCoord(MSG_ENTITY, this.origin_x); - WriteCoord(MSG_ENTITY, this.origin_y); - WriteCoord(MSG_ENTITY, this.origin_z); + WriteVector(MSG_ENTITY, this.origin); } if(sf & 4) diff --git a/qcsrc/common/vehicles/vehicle/bumblebee_weapons.qc b/qcsrc/common/vehicles/vehicle/bumblebee_weapons.qc index fa05c6a6f..5f4068a7d 100644 --- a/qcsrc/common/vehicles/vehicle/bumblebee_weapons.qc +++ b/qcsrc/common/vehicles/vehicle/bumblebee_weapons.qc @@ -27,16 +27,12 @@ bool bumble_raygun_send(entity this, entity to, float sf) if(sf & BRG_START) { - WriteCoord(MSG_ENTITY, this.hook_start_x); - WriteCoord(MSG_ENTITY, this.hook_start_y); - WriteCoord(MSG_ENTITY, this.hook_start_z); + WriteVector(MSG_ENTITY, this.hook_start); } if(sf & BRG_END) { - WriteCoord(MSG_ENTITY, this.hook_end_x); - WriteCoord(MSG_ENTITY, this.hook_end_y); - WriteCoord(MSG_ENTITY, this.hook_end_z); + WriteVector(MSG_ENTITY, this.hook_end); } return true; @@ -75,17 +71,13 @@ NET_HANDLE(ENT_CLIENT_BUMBLE_RAYGUN, bool isnew) if(sf & BRG_START) { - this.origin_x = ReadCoord(); - this.origin_y = ReadCoord(); - this.origin_z = ReadCoord(); + this.origin = ReadVector(); setorigin(this, this.origin); } if(sf & BRG_END) { - this.bumble_origin_x = ReadCoord(); - this.bumble_origin_y = ReadCoord(); - this.bumble_origin_z = ReadCoord(); + this.bumble_origin = ReadVector(); } return true; } diff --git a/qcsrc/common/weapons/all.qc b/qcsrc/common/weapons/all.qc index e430ec2e7..6aed090db 100644 --- a/qcsrc/common/weapons/all.qc +++ b/qcsrc/common/weapons/all.qc @@ -554,10 +554,7 @@ REGISTER_NET_TEMP(wframe) #ifdef CSQC NET_HANDLE(wframe, bool isNew) { - vector a; - a.x = ReadCoord(); - a.y = ReadCoord(); - a.z = ReadCoord(); + vector a = ReadVector(); int slot = ReadByte(); bool restartanim = ReadByte(); entity wepent = viewmodels[slot]; @@ -590,9 +587,7 @@ void wframe_send(entity actor, entity weaponentity, vector a, bool restartanim) int channel = MSG_ONE; msg_entity = actor; WriteHeader(channel, wframe); - WriteCoord(channel, a.x); - WriteCoord(channel, a.y); - WriteCoord(channel, a.z); + WriteVector(channel, a); WriteByte(channel, weaponslot(weaponentity.weaponentity_fld)); WriteByte(channel, restartanim); WriteByte(channel, weaponentity.state); diff --git a/qcsrc/common/weapons/weapon/arc.qc b/qcsrc/common/weapons/weapon/arc.qc index 7169fae42..6a115baf1 100644 --- a/qcsrc/common/weapons/weapon/arc.qc +++ b/qcsrc/common/weapons/weapon/arc.qc @@ -30,21 +30,17 @@ bool W_Arc_Beam_Send(entity this, entity to, int sf) } if(sf & ARC_SF_START) // starting location { - WriteCoord(MSG_ENTITY, this.beam_start.x); - WriteCoord(MSG_ENTITY, this.beam_start.y); - WriteCoord(MSG_ENTITY, this.beam_start.z); + WriteVector(MSG_ENTITY, this.beam_start); } if(sf & ARC_SF_WANTDIR) // want/aim direction { - WriteCoord(MSG_ENTITY, this.beam_wantdir.x); - WriteCoord(MSG_ENTITY, this.beam_wantdir.y); - WriteCoord(MSG_ENTITY, this.beam_wantdir.z); + WriteVector(MSG_ENTITY, this.beam_wantdir); } if(sf & ARC_SF_BEAMDIR) // beam direction { - WriteCoord(MSG_ENTITY, this.beam_dir.x); - WriteCoord(MSG_ENTITY, this.beam_dir.y); - WriteCoord(MSG_ENTITY, this.beam_dir.z); + WriteAngle(MSG_ENTITY, this.beam_dir.x); + WriteAngle(MSG_ENTITY, this.beam_dir.y); + WriteAngle(MSG_ENTITY, this.beam_dir.z); } if(sf & ARC_SF_BEAMTYPE) // beam type { @@ -1227,9 +1223,7 @@ NET_HANDLE(ENT_CLIENT_ARC_BEAM, bool isnew) if(sf & ARC_SF_START) // starting location { - this.origin_x = ReadCoord(); - this.origin_y = ReadCoord(); - this.origin_z = ReadCoord(); + this.origin = ReadVector(); } else if(this.beam_usevieworigin) // infer the location from player location { @@ -1249,16 +1243,14 @@ NET_HANDLE(ENT_CLIENT_ARC_BEAM, bool isnew) if(sf & ARC_SF_WANTDIR) // want/aim direction { - this.v_angle_x = ReadCoord(); - this.v_angle_y = ReadCoord(); - this.v_angle_z = ReadCoord(); + this.v_angle = ReadVector(); } if(sf & ARC_SF_BEAMDIR) // beam direction { - this.angles_x = ReadCoord(); - this.angles_y = ReadCoord(); - this.angles_z = ReadCoord(); + this.angles_x = ReadAngle(); + this.angles_y = ReadAngle(); + this.angles_z = ReadAngle(); } if(sf & ARC_SF_BEAMTYPE) // beam type diff --git a/qcsrc/common/weapons/weapon/hook.qc b/qcsrc/common/weapons/weapon/hook.qc index e04376b2f..8d569d04e 100644 --- a/qcsrc/common/weapons/weapon/hook.qc +++ b/qcsrc/common/weapons/weapon/hook.qc @@ -466,16 +466,12 @@ NET_HANDLE(ENT_CLIENT_HOOK, bool bIsNew) } if(sf & 2) { - this.origin_x = ReadCoord(); - this.origin_y = ReadCoord(); - this.origin_z = ReadCoord(); + this.origin = ReadVector(); setorigin(this, this.origin); } if(sf & 4) { - this.velocity_x = ReadCoord(); - this.velocity_y = ReadCoord(); - this.velocity_z = ReadCoord(); + this.velocity = ReadVector(); } InterpolateOrigin_Note(this); diff --git a/qcsrc/common/weapons/weapon/shockwave.qc b/qcsrc/common/weapons/weapon/shockwave.qc index 7c775be2f..e9d55b242 100644 --- a/qcsrc/common/weapons/weapon/shockwave.qc +++ b/qcsrc/common/weapons/weapon/shockwave.qc @@ -257,12 +257,8 @@ float W_Shockwave_Attack_CheckHit( void W_Shockwave_Send(entity actor) { WriteHeader(MSG_BROADCAST, TE_CSQC_SHOCKWAVEPARTICLE); - WriteCoord(MSG_BROADCAST, w_shotorg.x); - WriteCoord(MSG_BROADCAST, w_shotorg.y); - WriteCoord(MSG_BROADCAST, w_shotorg.z); - WriteCoord(MSG_BROADCAST, w_shotdir.x); - WriteCoord(MSG_BROADCAST, w_shotdir.y); - WriteCoord(MSG_BROADCAST, w_shotdir.z); + WriteVector(MSG_BROADCAST, w_shotorg); + WriteVector(MSG_BROADCAST, w_shotdir); WriteShort(MSG_BROADCAST, WEP_CVAR(shockwave, blast_distance)); WriteByte(MSG_BROADCAST, bound(0, WEP_CVAR(shockwave, blast_spread_max), 255)); WriteByte(MSG_BROADCAST, bound(0, WEP_CVAR(shockwave, blast_spread_min), 255)); @@ -766,8 +762,8 @@ void Net_ReadShockwaveParticle() shockwave.draw = Draw_Shockwave; IL_PUSH(g_drawables, shockwave); - shockwave.sw_shotorg_x = ReadCoord(); shockwave.sw_shotorg_y = ReadCoord(); shockwave.sw_shotorg_z = ReadCoord(); - shockwave.sw_shotdir_x = ReadCoord(); shockwave.sw_shotdir_y = ReadCoord(); shockwave.sw_shotdir_z = ReadCoord(); + shockwave.sw_shotorg = ReadVector(); + shockwave.sw_shotdir = ReadVector(); shockwave.sw_distance = ReadShort(); shockwave.sw_spread_max = ReadByte(); diff --git a/qcsrc/common/weapons/weapon/tuba.qc b/qcsrc/common/weapons/weapon/tuba.qc index 5d9abce33..eb7808089 100644 --- a/qcsrc/common/weapons/weapon/tuba.qc +++ b/qcsrc/common/weapons/weapon/tuba.qc @@ -223,9 +223,7 @@ bool W_Tuba_NoteSendEntity(entity this, entity to, int sf) } if (sf & 2) { - WriteCoord(MSG_ENTITY, this.origin.x); - WriteCoord(MSG_ENTITY, this.origin.y); - WriteCoord(MSG_ENTITY, this.origin.z); + WriteVector(MSG_ENTITY, this.origin); } return true; } @@ -553,9 +551,7 @@ NET_HANDLE(ENT_CLIENT_TUBANOTE, bool isNew) } if (f & 2) { - this.enemy.origin_x = ReadCoord(); - this.enemy.origin_y = ReadCoord(); - this.enemy.origin_z = ReadCoord(); + this.enemy.origin = ReadVector(); setorigin(this.enemy, this.enemy.origin); if (this.enemy.enemy) { setorigin(this.enemy.enemy, this.enemy.origin); diff --git a/qcsrc/common/weapons/weapon/vaporizer.qc b/qcsrc/common/weapons/weapon/vaporizer.qc index 7dae1b3f7..06562f68a 100644 --- a/qcsrc/common/weapons/weapon/vaporizer.qc +++ b/qcsrc/common/weapons/weapon/vaporizer.qc @@ -7,12 +7,8 @@ void SendCSQCVaporizerBeamParticle(entity player, int hit) { vector v; v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos); WriteHeader(MSG_BROADCAST, TE_CSQC_VAPORBEAMPARTICLE); - WriteCoord(MSG_BROADCAST, w_shotorg.x); - WriteCoord(MSG_BROADCAST, w_shotorg.y); - WriteCoord(MSG_BROADCAST, w_shotorg.z); - WriteCoord(MSG_BROADCAST, v.x); - WriteCoord(MSG_BROADCAST, v.y); - WriteCoord(MSG_BROADCAST, v.z); + WriteVector(MSG_BROADCAST, w_shotorg); + WriteVector(MSG_BROADCAST, v); WriteByte(MSG_BROADCAST, hit); WriteByte(MSG_BROADCAST, etof(player)); WriteByte(MSG_BROADCAST, player.team); @@ -82,8 +78,8 @@ NET_HANDLE(TE_CSQC_VAPORBEAMPARTICLE, bool isNew) if (isNew) IL_PUSH(g_drawables, this); this.drawmask = MASK_NORMAL; - this.vorg1_x = ReadCoord(); this.vorg1_y = ReadCoord(); this.vorg1_z = ReadCoord(); - this.vorg2_x = ReadCoord(); this.vorg2_y = ReadCoord(); this.vorg2_z = ReadCoord(); + this.vorg1 = ReadVector(); + this.vorg2 = ReadVector(); this.cnt = ReadByte(); int myowner = ReadByte(); this.owner = playerslots[myowner - 1]; diff --git a/qcsrc/common/weapons/weapon/vortex.qc b/qcsrc/common/weapons/weapon/vortex.qc index 7e5da5c5a..8c590bf6e 100644 --- a/qcsrc/common/weapons/weapon/vortex.qc +++ b/qcsrc/common/weapons/weapon/vortex.qc @@ -38,21 +38,16 @@ void SendCSQCVortexBeamParticle(float charge) { vector v; v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos); WriteHeader(MSG_BROADCAST, TE_CSQC_VORTEXBEAMPARTICLE); - WriteCoord(MSG_BROADCAST, w_shotorg.x); - WriteCoord(MSG_BROADCAST, w_shotorg.y); - WriteCoord(MSG_BROADCAST, w_shotorg.z); - WriteCoord(MSG_BROADCAST, v.x); - WriteCoord(MSG_BROADCAST, v.y); - WriteCoord(MSG_BROADCAST, v.z); + WriteVector(MSG_BROADCAST, w_shotorg); + WriteVector(MSG_BROADCAST, v); WriteByte(MSG_BROADCAST, bound(0, 255 * charge, 255)); } #elif defined(CSQC) NET_HANDLE(TE_CSQC_VORTEXBEAMPARTICLE, bool isNew) { - vector shotorg, endpos; float charge; - shotorg.x = ReadCoord(); shotorg.y = ReadCoord(); shotorg.z = ReadCoord(); - endpos.x = ReadCoord(); endpos.y = ReadCoord(); endpos.z = ReadCoord(); + vector shotorg = ReadVector(); + vector endpos = ReadVector(); charge = ReadByte() / 255.0; pointparticles(EFFECT_VORTEX_MUZZLEFLASH, shotorg, normalize(endpos - shotorg) * 1000, 1); diff --git a/qcsrc/lib/csqcmodel/common.qh b/qcsrc/lib/csqcmodel/common.qh index 37b88997e..f8375d09e 100644 --- a/qcsrc/lib/csqcmodel/common.qh +++ b/qcsrc/lib/csqcmodel/common.qh @@ -66,15 +66,9 @@ const int CSQCMODEL_PROPERTY_SIZE = BIT(15); #define ALLPROPERTIES_COMMON \ CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_FRAME, int, ReadByte, WriteByte, frame) \ CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_MODELINDEX, int, ReadShort, WriteShort, modelindex) \ - CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_ORIGIN, float, ReadCoord, WriteCoord, origin_x) \ - CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_ORIGIN, float, ReadCoord, WriteCoord, origin_y) \ - CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_ORIGIN, float, ReadCoord, WriteCoord, origin_z) \ - CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_SIZE, float, ReadShort, WriteShort, mins_x) \ - CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_SIZE, float, ReadShort, WriteShort, mins_y) \ - CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_SIZE, float, ReadShort, WriteShort, mins_z) \ - CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_SIZE, float, ReadShort, WriteShort, maxs_x) \ - CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_SIZE, float, ReadShort, WriteShort, maxs_y) \ - CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_SIZE, float, ReadShort, WriteShort, maxs_z) \ + CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_ORIGIN, vector, ReadVector, WriteVector, origin) \ + CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_SIZE, vector, ReadVector, WriteVector, mins) \ + CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_SIZE, vector, ReadVector, WriteVector, maxs) \ CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_PITCHROLL, float, ReadAngle, WriteAngle, angles_x) \ CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_YAW, float, ReadAngle, WriteAngle, angles_y) \ CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_PITCHROLL, float, ReadAngle, WriteAngle, angles_z) \ diff --git a/qcsrc/lib/warpzone/client.qc b/qcsrc/lib/warpzone/client.qc index 15a3ca4c3..3a6765e9d 100644 --- a/qcsrc/lib/warpzone/client.qc +++ b/qcsrc/lib/warpzone/client.qc @@ -42,32 +42,18 @@ NET_HANDLE(ENT_CLIENT_WARPZONE, bool isnew) this.warpzone_isboxy = (f & 1); if(f & 4) { - this.origin_x = ReadCoord(); - this.origin_y = ReadCoord(); - this.origin_z = ReadCoord(); + this.origin = ReadVector(); } else this.origin = '0 0 0'; this.modelindex = ReadShort(); - this.mins_x = ReadCoord(); - this.mins_y = ReadCoord(); - this.mins_z = ReadCoord(); - this.maxs_x = ReadCoord(); - this.maxs_y = ReadCoord(); - this.maxs_z = ReadCoord(); + this.mins = ReadVector(); + this.maxs = ReadVector(); this.scale = ReadByte() / 16; - this.enemy.oldorigin_x = ReadCoord(); - this.enemy.oldorigin_y = ReadCoord(); - this.enemy.oldorigin_z = ReadCoord(); - this.enemy.avelocity_x = ReadCoord(); - this.enemy.avelocity_y = ReadCoord(); - this.enemy.avelocity_z = ReadCoord(); - this.oldorigin_x = ReadCoord(); - this.oldorigin_y = ReadCoord(); - this.oldorigin_z = ReadCoord(); - this.avelocity_x = ReadCoord(); - this.avelocity_y = ReadCoord(); - this.avelocity_z = ReadCoord(); + this.enemy.oldorigin = ReadVector(); + this.enemy.avelocity = ReadVector(); + this.oldorigin = ReadVector(); + this.avelocity = ReadVector(); if(f & 2) { @@ -104,26 +90,16 @@ NET_HANDLE(ENT_CLIENT_WARPZONE_CAMERA, bool isnew) int f = ReadByte(); if(f & 4) { - this.origin_x = ReadCoord(); - this.origin_y = ReadCoord(); - this.origin_z = ReadCoord(); + this.origin = ReadVector(); } else this.origin = '0 0 0'; this.modelindex = ReadShort(); - this.mins_x = ReadCoord(); - this.mins_y = ReadCoord(); - this.mins_z = ReadCoord(); - this.maxs_x = ReadCoord(); - this.maxs_y = ReadCoord(); - this.maxs_z = ReadCoord(); + this.mins = ReadVector(); + this.maxs = ReadVector(); this.scale = ReadByte() / 16; - this.oldorigin_x = ReadCoord(); - this.oldorigin_y = ReadCoord(); - this.oldorigin_z = ReadCoord(); - this.avelocity_x = ReadCoord(); - this.avelocity_y = ReadCoord(); - this.avelocity_z = ReadCoord(); + this.oldorigin = ReadVector(); + this.avelocity = ReadVector(); if(f & 2) { @@ -157,10 +133,7 @@ void CL_RotateMoves(vector ang) = #638; NET_HANDLE(ENT_CLIENT_WARPZONE_TELEPORTED, bool isnew) { this.classname = "warpzone_teleported"; - vector v; - v.x = ReadCoord(); - v.y = ReadCoord(); - v.z = ReadCoord(); + vector v = ReadVector(); return = true; if (!isnew) return; this.warpzone_transform = v; diff --git a/qcsrc/lib/warpzone/server.qc b/qcsrc/lib/warpzone/server.qc index 936d075da..8246e106d 100644 --- a/qcsrc/lib/warpzone/server.qc +++ b/qcsrc/lib/warpzone/server.qc @@ -61,9 +61,7 @@ void WarpZone_TeleportPlayer(entity teleporter, entity player, vector to, vector bool WarpZone_Teleported_Send(entity this, entity to, int sf) { WriteHeader(MSG_ENTITY, ENT_CLIENT_WARPZONE_TELEPORTED); - WriteCoord(MSG_ENTITY, this.angles.x); - WriteCoord(MSG_ENTITY, this.angles.y); - WriteCoord(MSG_ENTITY, this.angles.z); + WriteVector(MSG_ENTITY, this.angles); return true; } #endif diff --git a/qcsrc/server/g_hook.qc b/qcsrc/server/g_hook.qc index 7c21c45dd..0d732e0ca 100644 --- a/qcsrc/server/g_hook.qc +++ b/qcsrc/server/g_hook.qc @@ -140,15 +140,11 @@ bool GrapplingHookSend(entity this, entity to, int sf) } if(sf & 2) { - WriteCoord(MSG_ENTITY, this.hook_start.x); - WriteCoord(MSG_ENTITY, this.hook_start.y); - WriteCoord(MSG_ENTITY, this.hook_start.z); + WriteVector(MSG_ENTITY, this.hook_start); } if(sf & 4) { - WriteCoord(MSG_ENTITY, this.hook_end.x); - WriteCoord(MSG_ENTITY, this.hook_end.y); - WriteCoord(MSG_ENTITY, this.hook_end.z); + WriteVector(MSG_ENTITY, this.hook_end); } return true; } diff --git a/qcsrc/server/g_models.qc b/qcsrc/server/g_models.qc index 539522f2d..1026e3aa7 100644 --- a/qcsrc/server/g_models.qc +++ b/qcsrc/server/g_models.qc @@ -106,9 +106,7 @@ bool g_clientmodel_genericsendentity(entity this, entity to, int sf) if(sf & BIT(1)) { - WriteCoord(MSG_ENTITY, this.origin.x); - WriteCoord(MSG_ENTITY, this.origin.y); - WriteCoord(MSG_ENTITY, this.origin.z); + WriteVector(MSG_ENTITY, this.origin); } if(sf & BIT(2)) @@ -137,12 +135,8 @@ bool g_clientmodel_genericsendentity(entity this, entity to, int sf) WriteShort(MSG_ENTITY, floor(this.scale * 256)); if(sf & 0x20) { - 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); + WriteVector(MSG_ENTITY, this.mins); + WriteVector(MSG_ENTITY, this.maxs); } WriteString(MSG_ENTITY, this.bgmscript); if(this.bgmscript != "") @@ -151,9 +145,7 @@ bool g_clientmodel_genericsendentity(entity this, entity to, int sf) WriteByte(MSG_ENTITY, floor(this.bgmscriptdecay * 64)); WriteByte(MSG_ENTITY, floor(this.bgmscriptsustain * 255)); WriteByte(MSG_ENTITY, floor(this.bgmscriptrelease * 64)); - WriteCoord(MSG_ENTITY, this.movedir.x); - WriteCoord(MSG_ENTITY, this.movedir.y); - WriteCoord(MSG_ENTITY, this.movedir.z); + WriteVector(MSG_ENTITY, this.movedir); WriteByte(MSG_ENTITY, floor(this.lip * 255)); } WriteByte(MSG_ENTITY, this.fade_start); diff --git a/qcsrc/server/spawnpoints.qc b/qcsrc/server/spawnpoints.qc index 9f91739c1..9164b4feb 100644 --- a/qcsrc/server/spawnpoints.qc +++ b/qcsrc/server/spawnpoints.qc @@ -17,9 +17,7 @@ bool SpawnPoint_Send(entity this, entity to, int sf) WriteHeader(MSG_ENTITY, ENT_CLIENT_SPAWNPOINT); WriteByte(MSG_ENTITY, this.team); - WriteCoord(MSG_ENTITY, this.origin.x); - WriteCoord(MSG_ENTITY, this.origin.y); - WriteCoord(MSG_ENTITY, this.origin.z); + WriteVector(MSG_ENTITY, this.origin); return true; } @@ -33,9 +31,7 @@ bool SpawnEvent_Send(entity this, entity to, int sf) if(autocvar_g_spawn_alloweffects) { WriteByte(MSG_ENTITY, etof(this.owner)); - WriteCoord(MSG_ENTITY, this.owner.origin.x); - WriteCoord(MSG_ENTITY, this.owner.origin.y); - WriteCoord(MSG_ENTITY, this.owner.origin.z); + WriteVector(MSG_ENTITY, this.owner.origin); send = true; } else if((to == this.owner) || (IS_SPEC(to) && (to.enemy == this.owner)) ) diff --git a/qcsrc/server/weapons/csqcprojectile.qc b/qcsrc/server/weapons/csqcprojectile.qc index d426e2f61..5352b40cd 100644 --- a/qcsrc/server/weapons/csqcprojectile.qc +++ b/qcsrc/server/weapons/csqcprojectile.qc @@ -42,15 +42,11 @@ bool CSQCProjectile_SendEntity(entity this, entity to, int sf) if(sf & 1) { - WriteCoord(MSG_ENTITY, this.origin.x); - WriteCoord(MSG_ENTITY, this.origin.y); - WriteCoord(MSG_ENTITY, this.origin.z); + WriteVector(MSG_ENTITY, this.origin); if(sf & 0x80) { - WriteCoord(MSG_ENTITY, this.velocity.x); - WriteCoord(MSG_ENTITY, this.velocity.y); - WriteCoord(MSG_ENTITY, this.velocity.z); + WriteVector(MSG_ENTITY, this.velocity); if(sf & 0x10) WriteCoord(MSG_ENTITY, this.gravity); } -- 2.39.2