From: TimePath Date: Wed, 4 Nov 2015 09:25:42 +0000 (+1100) Subject: Net: register all types X-Git-Tag: xonotic-v0.8.2~1725 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=1d70346809dd33b32864b3832662878077588e4b;p=xonotic%2Fxonotic-data.pk3dir.git Net: register all types --- diff --git a/qcsrc/client/defs.qh b/qcsrc/client/defs.qh index 6325a8ab3..98f25cc90 100644 --- a/qcsrc/client/defs.qh +++ b/qcsrc/client/defs.qh @@ -23,8 +23,8 @@ float dmg_take; #endif // Basic variables -.float enttype; // entity type sent from server -.int sv_entnum; // entity number sent from server +.int enttype; // entity type sent from server +.int sv_entnum; // entity number sent from server .int team; .int team_size; diff --git a/qcsrc/client/effects.qc b/qcsrc/client/effects.qc index 21fa1ce03..348c62c46 100644 --- a/qcsrc/client/effects.qc +++ b/qcsrc/client/effects.qc @@ -98,3 +98,8 @@ void Net_ReadLightningarc() } void Net_ReadArc() { Net_ReadLightningarc(); } +NET_HANDLE(TE_CSQC_ARC, bool isNew) +{ + Net_ReadArc(); + return true; +} diff --git a/qcsrc/client/gibs.qc b/qcsrc/client/gibs.qc index 73d7f0496..675cd40c5 100644 --- a/qcsrc/client/gibs.qc +++ b/qcsrc/client/gibs.qc @@ -158,7 +158,9 @@ void TossGib (string mdlname, vector safeorg, vector org, vector vconst, vector RubbleLimit("gib", autocvar_cl_gibs_maxcount, Gib_Delete); } -REGISTER_NET_TEMP(net_gibsplash, bool isNew) +REGISTER_NET_TEMP(net_gibsplash) + +NET_HANDLE(net_gibsplash, bool isNew) { Net_Accept(net_gibsplash); @@ -172,6 +174,8 @@ REGISTER_NET_TEMP(net_gibsplash, bool isNew) org.z = ReadShort() * 4 + 2; vector vel = decompressShortVector(ReadShort()); + return = true; + float cl_gentle_gibs = autocvar_cl_gentle_gibs; if(cl_gentle_gibs || autocvar_cl_gentle) type |= 0x80; // set gentle bit diff --git a/qcsrc/client/hook.qc b/qcsrc/client/hook.qc index eb5cc8dd1..452189a15 100644 --- a/qcsrc/client/hook.qc +++ b/qcsrc/client/hook.qc @@ -4,7 +4,7 @@ #include "../lib/warpzone/common.qh" entityclass(Hook); -class(Hook) .float HookType; // ENT_CLIENT_* +class(Hook) .entity HookType; // ENT_CLIENT_* class(Hook) .vector origin; class(Hook) .vector velocity; class(Hook) .float HookSilent; @@ -48,10 +48,10 @@ void Draw_GrapplingHook(entity this) switch(self.HookType) { default: - case ENT_CLIENT_HOOK: + case NET_ENT_CLIENT_HOOK: vs = hook_shotorigin[s]; break; - case ENT_CLIENT_ARC_BEAM: + case NET_ENT_CLIENT_ARC_BEAM: vs = lightning_shotorigin[s]; break; } @@ -61,11 +61,11 @@ void Draw_GrapplingHook(entity this) switch(self.HookType) { default: - case ENT_CLIENT_HOOK: + case NET_ENT_CLIENT_HOOK: a = view_origin + view_forward * vs.x + view_right * -vs.y + view_up * vs.z; b = self.origin; break; - case ENT_CLIENT_ARC_BEAM: + case NET_ENT_CLIENT_ARC_BEAM: if(self.HookRange) b = view_origin + view_forward * self.HookRange; else @@ -81,11 +81,11 @@ void Draw_GrapplingHook(entity this) switch(self.HookType) { default: - case ENT_CLIENT_HOOK: + case NET_ENT_CLIENT_HOOK: a = self.velocity; b = self.origin; break; - case ENT_CLIENT_ARC_BEAM: + case NET_ENT_CLIENT_ARC_BEAM: a = self.origin; b = self.velocity; break; @@ -97,7 +97,7 @@ void Draw_GrapplingHook(entity this) switch(self.HookType) { default: - case ENT_CLIENT_HOOK: + case NET_ENT_CLIENT_HOOK: intensity = 1; offset = 0; switch(t) @@ -109,7 +109,7 @@ void Draw_GrapplingHook(entity this) default: tex = "particles/hook_white"; rgb = getcsqcplayercolor(self.sv_entnum); break; } break; - case ENT_CLIENT_ARC_BEAM: // todo + case NET_ENT_CLIENT_ARC_BEAM: // todo intensity = bound(0.2, 1 + Noise_Pink(self, frametime) * 1 + Noise_Burst(self, frametime, 0.03) * 0.3, 2); offset = Noise_Brown(self, frametime) * 10; tex = "particles/lgbeam"; @@ -121,7 +121,7 @@ void Draw_GrapplingHook(entity this) Draw_GrapplingHook_trace_callback_rnd = offset; Draw_GrapplingHook_trace_callback_rgb = rgb; Draw_GrapplingHook_trace_callback_a = intensity; - WarpZone_TraceBox_ThroughZone(a, '0 0 0', '0 0 0', b, ((self.HookType == ENT_CLIENT_HOOK) ? MOVE_NOTHING : MOVE_NORMAL), world, world, Draw_GrapplingHook_trace_callback); + WarpZone_TraceBox_ThroughZone(a, '0 0 0', '0 0 0', b, ((self.HookType == NET_ENT_CLIENT_HOOK) ? MOVE_NOTHING : MOVE_NORMAL), world, world, Draw_GrapplingHook_trace_callback); Draw_GrapplingHook_trace_callback_tex = string_null; atrans = WarpZone_TransformOrigin(WarpZone_trace_transform, a); @@ -129,7 +129,7 @@ void Draw_GrapplingHook(entity this) switch(self.HookType) { default: - case ENT_CLIENT_HOOK: + case NET_ENT_CLIENT_HOOK: if(vlen(trace_endpos - atrans) > 0.5) { setorigin(self, trace_endpos); // hook endpoint! @@ -141,7 +141,7 @@ void Draw_GrapplingHook(entity this) self.drawmask = 0; } break; - case ENT_CLIENT_ARC_BEAM: + case NET_ENT_CLIENT_ARC_BEAM: setorigin(self, a); // beam origin! break; } @@ -149,9 +149,9 @@ void Draw_GrapplingHook(entity this) switch(self.HookType) { default: - case ENT_CLIENT_HOOK: + case NET_ENT_CLIENT_HOOK: break; - case ENT_CLIENT_ARC_BEAM: + case NET_ENT_CLIENT_ARC_BEAM: pointparticles(EFFECT_ARC_LIGHTNING2, trace_endpos, normalize(atrans - trace_endpos), frametime * intensity); // todo: new effect break; } @@ -162,7 +162,7 @@ void Remove_GrapplingHook() sound (self, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM); } -void Ent_ReadHook(float bIsNew, float type) +void Ent_ReadHook(float bIsNew, entity type) {SELFPARAM(); self.HookType = type; @@ -181,10 +181,10 @@ void Ent_ReadHook(float bIsNew, float type) switch(self.HookType) { default: - case ENT_CLIENT_HOOK: + case NET_ENT_CLIENT_HOOK: self.HookRange = 0; break; - case ENT_CLIENT_ARC_BEAM: + case NET_ENT_CLIENT_ARC_BEAM: self.HookRange = ReadCoord(); break; } @@ -213,12 +213,12 @@ void Ent_ReadHook(float bIsNew, float type) switch(self.HookType) { default: - case ENT_CLIENT_HOOK: + case NET_ENT_CLIENT_HOOK: // for the model setmodel(self, MDL_HOOK); self.drawmask = MASK_NORMAL; break; - case ENT_CLIENT_ARC_BEAM: + case NET_ENT_CLIENT_ARC_BEAM: sound (self, CH_SHOTS_SINGLE, SND_LGBEAM_FLY, VOL_BASE, ATTEN_NORM); break; } diff --git a/qcsrc/client/hook.qh b/qcsrc/client/hook.qh index 9e6ee548c..29fd98304 100644 --- a/qcsrc/client/hook.qh +++ b/qcsrc/client/hook.qh @@ -3,6 +3,6 @@ void Draw_CylindricLine(vector from, vector to, float thickness, string texture, float aspect, float shift, vector rgb, float theAlpha, float drawflag, vector vieworg); -void Ent_ReadHook(float bIsNew, float type); +void Ent_ReadHook(float bIsNew, entity type); #endif diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index 6be7fa047..5ffa01e14 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -439,7 +439,6 @@ void Ent_ReadPlayerScore() LOG_INFOF("A CSQC entity changed its owner! (edict: %d, classname: %s)\n", num_for_edict(self), self.classname); isNew = true; Ent_Remove(); - self.enttype = ENT_CLIENT_SCORES; } #endif @@ -784,11 +783,10 @@ void Ent_ScoresInfo(); void CSQC_Ent_Update(float bIsNewEntity) { SELFPARAM(); + this.sourceLocLine = __LINE__; + this.sourceLocFile = __FILE__; int t = ReadByte(); - if(autocvar_developer_csqcentities) - LOG_INFOF("CSQC_Ent_Update(%d) with self=%i self.entnum=%d self.enttype=%d t=%d\n", bIsNewEntity, this, this.entnum, this.enttype, t); - // set up the "time" global for received entities to be correct for interpolation purposes float savetime = time; if(servertime) @@ -825,80 +823,275 @@ void CSQC_Ent_Update(float bIsNewEntity) this.enttype = t; bool done = false; FOREACH(LinkedEntities, it.m_id == t, LAMBDA( - it.m_read(this, bIsNewEntity); - done = true; + this.classname = it.netname; + if (autocvar_developer_csqcentities) + LOG_INFOF("CSQC_Ent_Update(%d) with self=%i {.entnum=%d, .enttype=%d} t=%s (%d)\n", bIsNewEntity, this, this.entnum, this.enttype, it.netname, t); + done = it.m_read(this, bIsNewEntity); break; )); + time = savetime; if (!done) - switch(t) { - #define HANDLE(t) case t: this.classname = #t; this.sourceLocFile = __FILE__; this.sourceLocLine = __LINE__; - HANDLE(ENT_CLIENT_MUTATOR) { - int mutID = ReadMutator(); - if (!MUTATOR_CALLHOOK(CSQC_Ent_Update, mutID, bIsNewEntity)) - error(sprintf("Unknown mutator type in CSQC_Ent_Update (mutID: %d, edict: %d, classname: %s)\n", mutID, num_for_edict(this), this.classname)); - break; - } - HANDLE(ENT_CLIENT_ENTCS) Ent_ReadEntCS(); break; - HANDLE(ENT_CLIENT_SCORES) Ent_ReadPlayerScore(); break; - HANDLE(ENT_CLIENT_TEAMSCORES) Ent_ReadTeamScore(); break; - HANDLE(ENT_CLIENT_POINTPARTICLES) Ent_PointParticles(); break; - HANDLE(ENT_CLIENT_RAINSNOW) Ent_RainOrSnow(); break; - HANDLE(ENT_CLIENT_LASER) Ent_Laser(); break; - HANDLE(ENT_CLIENT_NAGGER) Ent_Nagger(); break; - HANDLE(ENT_CLIENT_ELIMINATEDPLAYERS) Ent_EliminatedPlayers(); break; - HANDLE(ENT_CLIENT_RADARLINK) Ent_RadarLink(); break; - HANDLE(ENT_CLIENT_PROJECTILE) Ent_Projectile(); break; - HANDLE(ENT_CLIENT_DAMAGEINFO) Ent_DamageInfo(bIsNewEntity); break; - HANDLE(ENT_CLIENT_INIT) Ent_Init(); break; - HANDLE(ENT_CLIENT_SCORES_INFO) Ent_ScoresInfo(); break; - HANDLE(ENT_CLIENT_MAPVOTE) Ent_MapVote(); break; - HANDLE(ENT_CLIENT_CLIENTDATA) Ent_ClientData(); break; - HANDLE(ENT_CLIENT_RANDOMSEED) Ent_RandomSeed(); break; - HANDLE(ENT_CLIENT_WALL) Ent_Wall(); break; - HANDLE(ENT_CLIENT_MODELEFFECT) Ent_ModelEffect(bIsNewEntity); break; - HANDLE(ENT_CLIENT_TUBANOTE) Ent_TubaNote(bIsNewEntity); break; - HANDLE(ENT_CLIENT_WARPZONE) WarpZone_Read(bIsNewEntity); break; - HANDLE(ENT_CLIENT_WARPZONE_CAMERA) WarpZone_Camera_Read(bIsNewEntity); break; - HANDLE(ENT_CLIENT_WARPZONE_TELEPORTED) WarpZone_Teleported_Read(bIsNewEntity); break; - HANDLE(ENT_CLIENT_TRIGGER_MUSIC) Ent_ReadTriggerMusic(); break; - HANDLE(ENT_CLIENT_HOOK) Ent_ReadHook(bIsNewEntity, ENT_CLIENT_HOOK); break; - HANDLE(ENT_CLIENT_INVENTORY) Inventory_Read(this); break; - HANDLE(ENT_CLIENT_ARC_BEAM) Ent_ReadArcBeam(bIsNewEntity); break; - HANDLE(ENT_CLIENT_ACCURACY) Ent_ReadAccuracy(); break; - HANDLE(ENT_CLIENT_AUXILIARYXHAIR) Net_AuXair2(bIsNewEntity); break; - HANDLE(ENT_CLIENT_TURRET) ent_turret(); break; - HANDLE(ENT_CLIENT_GENERATOR) ent_generator(); break; - HANDLE(ENT_CLIENT_CONTROLPOINT_ICON) ent_cpicon(this); break; - HANDLE(ENT_CLIENT_MODEL) CSQCModel_Read(bIsNewEntity); break; - HANDLE(ENT_CLIENT_ITEM) ItemRead(bIsNewEntity); break; - HANDLE(ENT_CLIENT_BUMBLE_RAYGUN) bumble_raygun_read(bIsNewEntity); break; - HANDLE(ENT_CLIENT_SPAWNPOINT) Ent_ReadSpawnPoint(bIsNewEntity); break; - HANDLE(ENT_CLIENT_SPAWNEVENT) Ent_ReadSpawnEvent(bIsNewEntity); break; - HANDLE(ENT_CLIENT_NOTIFICATION) Read_Notification(bIsNewEntity); break; - HANDLE(ENT_CLIENT_MINIGAME) ent_read_minigame(); break; - HANDLE(ENT_CLIENT_VIEWLOC) ent_viewloc(); break; - HANDLE(ENT_CLIENT_VIEWLOC_TRIGGER) ent_viewloc_trigger(); break; - HANDLE(ENT_CLIENT_LADDER) ent_func_ladder(); break; - HANDLE(ENT_CLIENT_TRIGGER_PUSH) ent_trigger_push(); break; - HANDLE(ENT_CLIENT_TARGET_PUSH) ent_target_push(); break; - HANDLE(ENT_CLIENT_CONVEYOR) ent_conveyor(); break; - HANDLE(ENT_CLIENT_DOOR) ent_door(); break; - HANDLE(ENT_CLIENT_PLAT) ent_plat(); break; - HANDLE(ENT_CLIENT_SWAMP) ent_swamp(); break; - HANDLE(ENT_CLIENT_CORNER) ent_corner(); break; - HANDLE(ENT_CLIENT_KEYLOCK) ent_keylock(); break; - HANDLE(ENT_CLIENT_TRAIN) ent_train(); break; - HANDLE(ENT_CLIENT_TRIGGER_IMPULSE) ent_trigger_impulse(); break; - #undef HANDLE - default: - //error(strcat(_("unknown entity type in CSQC_Ent_Update: %d\n"), this.enttype)); - error(sprintf("Unknown entity type in CSQC_Ent_Update (enttype: %d, edict: %d, classname: %s)\n", this.enttype, num_for_edict(this), this.classname)); - break; + //error(strcat(_("unknown entity type in CSQC_Ent_Update: %d\n"), this.enttype)); + error(sprintf("Unknown entity type in CSQC_Ent_Update (enttype: %d, edict: %d, classname: %s)\n", this.enttype, num_for_edict(this), this.classname)); } - - time = savetime; } +NET_HANDLE(ENT_CLIENT_ENTCS, bool isnew) +{ + Ent_ReadEntCS(); + return true; +} +NET_HANDLE(ENT_CLIENT_SCORES, bool isnew) +{ + Ent_ReadPlayerScore(); + return true; +} +NET_HANDLE(ENT_CLIENT_TEAMSCORES, bool isnew) +{ + Ent_ReadTeamScore(); + return true; +} +NET_HANDLE(ENT_CLIENT_POINTPARTICLES, bool isnew) +{ + Ent_PointParticles(); + return true; +} +NET_HANDLE(ENT_CLIENT_RAINSNOW, bool isnew) +{ + Ent_RainOrSnow(); + return true; +} +NET_HANDLE(ENT_CLIENT_LASER, bool isnew) +{ + Ent_Laser(); + return true; +} +NET_HANDLE(ENT_CLIENT_NAGGER, bool isnew) +{ + Ent_Nagger(); + return true; +} +NET_HANDLE(ENT_CLIENT_ELIMINATEDPLAYERS, bool isnew) +{ + Ent_EliminatedPlayers(); + return true; +} +NET_HANDLE(ENT_CLIENT_RADARLINK, bool isnew) +{ + Ent_RadarLink(); + return true; +} +NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew) +{ + Ent_Projectile(); + return true; +} +NET_HANDLE(ENT_CLIENT_DAMAGEINFO, bool isnew) +{ + Ent_DamageInfo(isnew); + return true; +} +NET_HANDLE(ENT_CLIENT_INIT, bool isnew) +{ + Ent_Init(); + return true; +} +NET_HANDLE(ENT_CLIENT_SCORES_INFO, bool isnew) +{ + Ent_ScoresInfo(); + return true; +} +NET_HANDLE(ENT_CLIENT_MAPVOTE, bool isnew) +{ + Ent_MapVote(); + return true; +} +NET_HANDLE(ENT_CLIENT_CLIENTDATA, bool isnew) +{ + Ent_ClientData(); + return true; +} +NET_HANDLE(ENT_CLIENT_RANDOMSEED, bool isnew) +{ + Ent_RandomSeed(); + return true; +} +NET_HANDLE(ENT_CLIENT_WALL, bool isnew) +{ + Ent_Wall(); + return true; +} +NET_HANDLE(ENT_CLIENT_MODELEFFECT, bool isnew) +{ + Ent_ModelEffect(isnew); + return true; +} +NET_HANDLE(ENT_CLIENT_TUBANOTE, bool isnew) +{ + Ent_TubaNote(isnew); + return true; +} +NET_HANDLE(ENT_CLIENT_WARPZONE, bool isnew) +{ + WarpZone_Read(isnew); + return true; +} +NET_HANDLE(ENT_CLIENT_WARPZONE_CAMERA, bool isnew) +{ + WarpZone_Camera_Read(isnew); + return true; +} +NET_HANDLE(ENT_CLIENT_WARPZONE_TELEPORTED, bool isnew) +{ + WarpZone_Teleported_Read(isnew); + return true; +} +NET_HANDLE(ENT_CLIENT_TRIGGER_MUSIC, bool isnew) +{ + Ent_ReadTriggerMusic(); + return true; +} +NET_HANDLE(ENT_CLIENT_HOOK, bool isnew) +{ + Ent_ReadHook(isnew, NET_ENT_CLIENT_HOOK); + return true; +} +NET_HANDLE(ENT_CLIENT_INVENTORY, bool isnew) +{ + Inventory_Read(this); + return true; +} +NET_HANDLE(ENT_CLIENT_ARC_BEAM, bool isnew) +{ + Ent_ReadArcBeam(isnew); + return true; +} +NET_HANDLE(ENT_CLIENT_ACCURACY, bool isnew) +{ + Ent_ReadAccuracy(); + return true; +} +NET_HANDLE(ENT_CLIENT_AUXILIARYXHAIR, bool isnew) +{ + Net_AuXair2(isnew); + return true; +} +NET_HANDLE(ENT_CLIENT_TURRET, bool isnew) +{ + ent_turret(); + return true; +} +NET_HANDLE(ENT_CLIENT_GENERATOR, bool isnew) +{ + ent_generator(); + return true; +} +NET_HANDLE(ENT_CLIENT_CONTROLPOINT_ICON, bool isnew) +{ + ent_cpicon(this); + return true; +} +NET_HANDLE(ENT_CLIENT_MODEL, bool isnew) +{ + CSQCModel_Read(isnew); + return true; +} +NET_HANDLE(ENT_CLIENT_ITEM, bool isnew) +{ + ItemRead(isnew); + return true; +} +NET_HANDLE(ENT_CLIENT_BUMBLE_RAYGUN, bool isnew) +{ + bumble_raygun_read(isnew); + return true; +} +NET_HANDLE(ENT_CLIENT_SPAWNPOINT, bool isnew) +{ + Ent_ReadSpawnPoint(isnew); + return true; +} +NET_HANDLE(ENT_CLIENT_SPAWNEVENT, bool isnew) +{ + Ent_ReadSpawnEvent(isnew); + return true; +} +NET_HANDLE(ENT_CLIENT_NOTIFICATION, bool isnew) +{ + Read_Notification(isnew); + return true; +} +NET_HANDLE(ENT_CLIENT_MINIGAME, bool isnew) +{ + ent_read_minigame(); + return true; +} +NET_HANDLE(ENT_CLIENT_VIEWLOC, bool isnew) +{ + ent_viewloc(); + return true; +} +NET_HANDLE(ENT_CLIENT_VIEWLOC_TRIGGER, bool isnew) +{ + ent_viewloc_trigger(); + return true; +} +NET_HANDLE(ENT_CLIENT_LADDER, bool isnew) +{ + ent_func_ladder(); + return true; +} +NET_HANDLE(ENT_CLIENT_TRIGGER_PUSH, bool isnew) +{ + ent_trigger_push(); + return true; +} +NET_HANDLE(ENT_CLIENT_TARGET_PUSH, bool isnew) +{ + ent_target_push(); + return true; +} +NET_HANDLE(ENT_CLIENT_CONVEYOR, bool isnew) +{ + ent_conveyor(); + return true; +} +NET_HANDLE(ENT_CLIENT_DOOR, bool isnew) +{ + ent_door(); + return true; +} +NET_HANDLE(ENT_CLIENT_PLAT, bool isnew) +{ + ent_plat(); + return true; +} +NET_HANDLE(ENT_CLIENT_SWAMP, bool isnew) +{ + ent_swamp(); + return true; +} +NET_HANDLE(ENT_CLIENT_CORNER, bool isnew) +{ + ent_corner(); + return true; +} +NET_HANDLE(ENT_CLIENT_KEYLOCK, bool isnew) +{ + ent_keylock(); + return true; +} +NET_HANDLE(ENT_CLIENT_TRAIN, bool isnew) +{ + ent_train(); + return true; +} +NET_HANDLE(ENT_CLIENT_TRIGGER_IMPULSE, bool isnew) +{ + ent_trigger_impulse(); + return true; +} + // Destructor, but does NOT deallocate the entity by calling remove(). Also // used when an entity changes its type. For an entity that someone interacts // with others, make sure it can no longer do so. @@ -1213,9 +1406,16 @@ void Net_ReadRace() } } -void Net_TeamNagger() +NET_HANDLE(TE_CSQC_RACE, bool isNew) +{ + Net_ReadRace(); + return true; +} + +NET_HANDLE(TE_CSQC_TEAMNAGGER, bool isNew) { teamnagger = 1; + return true; } void Net_ReadPingPLReport() @@ -1231,6 +1431,11 @@ void Net_ReadPingPLReport() playerslots[e].ping_packetloss = pl / 255.0; playerslots[e].ping_movementloss = ml / 255.0; } +NET_HANDLE(TE_CSQC_PINGPLREPORT, bool isNew) +{ + Net_ReadPingPLReport(); + return true; +} void Net_WeaponComplain() { @@ -1252,6 +1457,11 @@ void Net_WeaponComplain() default: Local_Notification(MSG_MULTI, ITEM_WEAPON_UNAVAILABLE, complain_weapon); break; } } +NET_HANDLE(TE_CSQC_WEAPONCOMPLAIN, bool isNew) +{ + Net_WeaponComplain(); + return true; +} // CSQC_Parse_TempEntity : Handles all temporary entity network data in the CSQC layer. // You must ALWAYS first acquire the temporary ID, which is sent as a byte. @@ -1261,56 +1471,17 @@ bool CSQC_Parse_TempEntity() // Acquire TE ID int nTEID = ReadByte(); + FOREACH(TempEntities, it.m_id == nTEID, LAMBDA( + if (autocvar_developer_csqcentities) + LOG_INFOF("CSQC_Parse_TempEntity() nTEID=%s (%d)\n", it.netname, nTEID); + return it.m_read(NULL, true); + )); + if (autocvar_developer_csqcentities) LOG_INFOF("CSQC_Parse_TempEntity() with nTEID=%d\n", nTEID); - FOREACH(TempEntities, it.m_id == nTEID, LAMBDA( - it.m_read(NULL, true); - return true; - )); - switch (nTEID) - { - case TE_CSQC_MUTATOR: - int mutID = ReadMutator(); - if (MUTATOR_CALLHOOK(CSQC_Parse_TempEntity, mutID)) - return true; - case TE_CSQC_TARGET_MUSIC: - Net_TargetMusic(); - return true; - case TE_CSQC_PICTURE: - Net_MapVote_Picture(); - return true; - case TE_CSQC_RACE: - Net_ReadRace(); - return true; - case TE_CSQC_VORTEXBEAMPARTICLE: - Net_ReadVortexBeamParticle(); - return true; - case TE_CSQC_TEAMNAGGER: - Net_TeamNagger(); - return true; - case TE_CSQC_ARC: - Net_ReadArc(); - return true; - case TE_CSQC_PINGPLREPORT: - Net_ReadPingPLReport(); - return true; - case TE_CSQC_WEAPONCOMPLAIN: - Net_WeaponComplain(); - return true; - case TE_CSQC_VEHICLESETUP: - Net_VehicleSetup(); - return true; - case TE_CSQC_SVNOTICE: - cl_notice_read(); - return true; - case TE_CSQC_SHOCKWAVEPARTICLE: - Net_ReadShockwaveParticle(); - return true; - default: - // No special logic for this temporary entity; return 0 so the engine can handle it - return false; - } + // No special logic for this temporary entity; return 0 so the engine can handle it + return false; } string getcommandkey(string text, string command) diff --git a/qcsrc/client/mapvoting.qc b/qcsrc/client/mapvoting.qc index 20ff10058..1acfa8042 100644 --- a/qcsrc/client/mapvoting.qc +++ b/qcsrc/client/mapvoting.qc @@ -866,6 +866,12 @@ void Ent_MapVote() MapVote_UpdateVotes(); } +NET_HANDLE(TE_CSQC_PICTURE, bool isNew) +{ + Net_MapVote_Picture(); + return true; +} + void Net_MapVote_Picture() { int type = ReadByte(); diff --git a/qcsrc/client/mutators/events.qh b/qcsrc/client/mutators/events.qh index 2fbeaaa7c..92f455816 100644 --- a/qcsrc/client/mutators/events.qh +++ b/qcsrc/client/mutators/events.qh @@ -38,30 +38,6 @@ MUTATOR_HOOKABLE(CSQC_ConsoleCommand, EV_CSQC_ConsoleCommand); /* Called when the crosshair is being updated */ MUTATOR_HOOKABLE(UpdateCrosshair, EV_NO_ARGS); -/** - * Called when a temp entity is parsed - * NOTE: hooks MUST start with: - * if (MUTATOR_RETURNVALUE) return; - * if (!ReadMutatorEquals(mutator_argv_int_0, name_of_mutator)) return; - * return = true; - */ -#define EV_CSQC_Parse_TempEntity(i, o) \ - /** mutator id */ i(int, mutator_argv_int_0) \ - /**/ -MUTATOR_HOOKABLE(CSQC_Parse_TempEntity, EV_CSQC_Parse_TempEntity); - -/** - * Called when a shared entity is updated - * if (MUTATOR_RETURNVALUE) return; - * if (!ReadMutatorEquals(mutator_argv_int_0, name_of_mutator)) return; - * return = true; - */ -#define EV_CSQC_Ent_Update(i, o) \ - /** mutator id */ i(int, mutator_argv_int_0) \ - /** bIsNewEntity */ i(bool, mutator_argv_bool_0) \ - /**/ -MUTATOR_HOOKABLE(CSQC_Ent_Update, EV_CSQC_Ent_Update); - /** Called when a projectile is linked with CSQC */ #define EV_Ent_Projectile(i, o) \ /** entity id */ i(entity, __self) \ diff --git a/qcsrc/client/particles.qc b/qcsrc/client/particles.qc index 9fcc4bd53..4c9ff2011 100644 --- a/qcsrc/client/particles.qc +++ b/qcsrc/client/particles.qc @@ -23,3 +23,8 @@ void Net_ReadVortexBeamParticle() else WarpZone_TrailParticles_WithMultiplier(world, particleeffectnum(EFFECT_VORTEX_BEAM), shotorg, endpos, 1, PARTICLES_USEALPHA | PARTICLES_USEFADE); } +NET_HANDLE(TE_CSQC_VORTEXBEAMPARTICLE, bool isNew) +{ + Net_ReadVortexBeamParticle(); + return true; +} diff --git a/qcsrc/common/constants.qh b/qcsrc/common/constants.qh index b08787734..8450fe964 100644 --- a/qcsrc/common/constants.qh +++ b/qcsrc/common/constants.qh @@ -31,28 +31,17 @@ const int AS_INT = 2; const int AS_FLOAT_TRUNCATED = 2; const int AS_FLOAT = 8; -const int TE_CSQC_MUTATOR = 99; -#define MUTATOR_HASH(s) crc16(true, s) -#define WriteMutator(to, s) do { \ - WriteByte(to, TE_CSQC_MUTATOR); \ - WriteLong(to, MUTATOR_HASH(#s)); \ -} while (0) -#define ReadMutator() ReadLong() -#define ReadMutatorEquals(read, s) (read == MUTATOR_HASH(#s)) -const int TE_CSQC_PICTURE = 100; -const int TE_CSQC_RACE = 101; -const int TE_CSQC_VORTEXBEAMPARTICLE = 103; -const int TE_CSQC_ARC = 104; -const int TE_CSQC_TEAMNAGGER = 105; -const int TE_CSQC_PINGPLREPORT = 106; -const int TE_CSQC_TARGET_MUSIC = 107; -const int TE_CSQC_WEAPONCOMPLAIN = 108; -const int TE_CSQC_VORTEX_SCOPE = 109; -const int TE_CSQC_MINELAYER_MAXMINES = 110; -const int TE_CSQC_HAGAR_MAXROCKETS = 111; -const int TE_CSQC_VEHICLESETUP = 112; -const int TE_CSQC_SVNOTICE = 113; -const int TE_CSQC_SHOCKWAVEPARTICLE = 114; +REGISTER_NET_TEMP(TE_CSQC_PICTURE) +REGISTER_NET_TEMP(TE_CSQC_RACE) +REGISTER_NET_TEMP(TE_CSQC_VORTEXBEAMPARTICLE) +REGISTER_NET_TEMP(TE_CSQC_ARC) +REGISTER_NET_TEMP(TE_CSQC_TEAMNAGGER) +REGISTER_NET_TEMP(TE_CSQC_PINGPLREPORT) +REGISTER_NET_TEMP(TE_CSQC_TARGET_MUSIC) +REGISTER_NET_TEMP(TE_CSQC_WEAPONCOMPLAIN) +REGISTER_NET_TEMP(TE_CSQC_VEHICLESETUP) +REGISTER_NET_TEMP(TE_CSQC_SVNOTICE) +REGISTER_NET_TEMP(TE_CSQC_SHOCKWAVEPARTICLE) const int RACE_NET_CHECKPOINT_HIT_QUALIFYING = 0; // byte checkpoint, short time, short recordtime, string recordholder const int RACE_NET_CHECKPOINT_CLEAR = 1; @@ -69,67 +58,57 @@ const int RACE_NET_SERVER_RANKINGS = 11; const int RACE_NET_SERVER_STATUS = 12; const int RANKINGS_CNT = 15; -const int ENT_CLIENT = 0; -const int ENT_CLIENT_DEAD = 1; -const int ENT_CLIENT_ENTCS = 2; -const int ENT_CLIENT_SCORES_INFO = 3; -const int ENT_CLIENT_SCORES = 4; -const int ENT_CLIENT_TEAMSCORES = 5; -const int ENT_CLIENT_POINTPARTICLES = 6; -const int ENT_CLIENT_RAINSNOW = 7; -const int ENT_CLIENT_LASER = 8; -const int ENT_CLIENT_NAGGER = 9; // flags [votecalledvote] -const int ENT_CLIENT_RADARLINK = 11; // flags [startorigin] [endorigin] [startcolor+16*endcolor] -const int ENT_CLIENT_PROJECTILE = 12; - -const int ENT_CLIENT_DAMAGEINFO = 14; - -const int ENT_CLIENT_INIT = 16; -const int ENT_CLIENT_MAPVOTE = 17; -const int ENT_CLIENT_CLIENTDATA = 18; -const int ENT_CLIENT_RANDOMSEED = 19; -const int ENT_CLIENT_WALL = 20; -const int ENT_CLIENT_SPIDERBOT = 21; -const int ENT_CLIENT_MODELEFFECT = 22; -const int ENT_CLIENT_TUBANOTE = 23; -const int ENT_CLIENT_WARPZONE = 24; -const int ENT_CLIENT_WARPZONE_CAMERA = 25; -const int ENT_CLIENT_TRIGGER_MUSIC = 26; -const int ENT_CLIENT_HOOK = 27; -const int ENT_CLIENT_INVENTORY = 28; -const int ENT_CLIENT_ARC_BEAM = 29; // WEAPONTODO: fix numbers -const int ENT_CLIENT_ACCURACY = 30; -const int ENT_CLIENT_SHOWNAMES = 31; -const int ENT_CLIENT_WARPZONE_TELEPORTED = 32; -const int ENT_CLIENT_MODEL = 33; -const int ENT_CLIENT_ITEM = 34; -const int ENT_CLIENT_BUMBLE_RAYGUN = 35; -const int ENT_CLIENT_SPAWNPOINT = 36; -const int ENT_CLIENT_SPAWNEVENT = 37; -const int ENT_CLIENT_NOTIFICATION = 38; -const int ENT_CLIENT_ELIMINATEDPLAYERS = 39; -const int ENT_CLIENT_TURRET = 40; -const int ENT_CLIENT_AUXILIARYXHAIR = 50; -const int ENT_CLIENT_VEHICLE = 60; -const int ENT_CLIENT_LADDER = 61; -const int ENT_CLIENT_TRIGGER_PUSH = 62; -const int ENT_CLIENT_TARGET_PUSH = 63; -const int ENT_CLIENT_CONVEYOR = 64; -const int ENT_CLIENT_DOOR = 65; -const int ENT_CLIENT_TRAIN = 66; -const int ENT_CLIENT_PLAT = 67; -const int ENT_CLIENT_TRIGGER_IMPULSE = 68; -const int ENT_CLIENT_SWAMP = 69; -const int ENT_CLIENT_CORNER = 70; -const int ENT_CLIENT_KEYLOCK = 71; -const int ENT_CLIENT_GENERATOR = 72; -const int ENT_CLIENT_CONTROLPOINT_ICON = 73; - -const int ENT_CLIENT_MINIGAME = 75; -const int ENT_CLIENT_VIEWLOC = 78; -const int ENT_CLIENT_VIEWLOC_TRIGGER = 79; - -const int ENT_CLIENT_MUTATOR = TE_CSQC_MUTATOR; // 99 +REGISTER_NET_LINKED(ENT_CLIENT_ENTCS) +REGISTER_NET_LINKED(ENT_CLIENT_SCORES_INFO) +REGISTER_NET_LINKED(ENT_CLIENT_SCORES) +REGISTER_NET_LINKED(ENT_CLIENT_TEAMSCORES) +REGISTER_NET_LINKED(ENT_CLIENT_POINTPARTICLES) +REGISTER_NET_LINKED(ENT_CLIENT_RAINSNOW) +REGISTER_NET_LINKED(ENT_CLIENT_LASER) +REGISTER_NET_LINKED(ENT_CLIENT_NAGGER) // flags [votecalledvote] +REGISTER_NET_LINKED(ENT_CLIENT_RADARLINK) // flags [startorigin] [endorigin] [startcolor+16*endcolor] +REGISTER_NET_LINKED(ENT_CLIENT_PROJECTILE) +REGISTER_NET_LINKED(ENT_CLIENT_DAMAGEINFO) +REGISTER_NET_LINKED(ENT_CLIENT_INIT) +REGISTER_NET_LINKED(ENT_CLIENT_MAPVOTE) +REGISTER_NET_LINKED(ENT_CLIENT_CLIENTDATA) +REGISTER_NET_LINKED(ENT_CLIENT_RANDOMSEED) +REGISTER_NET_LINKED(ENT_CLIENT_WALL) +REGISTER_NET_LINKED(ENT_CLIENT_MODELEFFECT) +REGISTER_NET_LINKED(ENT_CLIENT_TUBANOTE) +REGISTER_NET_LINKED(ENT_CLIENT_WARPZONE) +REGISTER_NET_LINKED(ENT_CLIENT_WARPZONE_CAMERA) +REGISTER_NET_LINKED(ENT_CLIENT_TRIGGER_MUSIC) +REGISTER_NET_LINKED(ENT_CLIENT_HOOK) +REGISTER_NET_LINKED(ENT_CLIENT_INVENTORY) +REGISTER_NET_LINKED(ENT_CLIENT_ARC_BEAM) // WEAPONTODO: fix numbers +REGISTER_NET_LINKED(ENT_CLIENT_ACCURACY) +REGISTER_NET_LINKED(ENT_CLIENT_WARPZONE_TELEPORTED) +REGISTER_NET_LINKED(ENT_CLIENT_MODEL) +REGISTER_NET_LINKED(ENT_CLIENT_ITEM) +REGISTER_NET_LINKED(ENT_CLIENT_BUMBLE_RAYGUN) +REGISTER_NET_LINKED(ENT_CLIENT_SPAWNPOINT) +REGISTER_NET_LINKED(ENT_CLIENT_SPAWNEVENT) +REGISTER_NET_LINKED(ENT_CLIENT_NOTIFICATION) +REGISTER_NET_LINKED(ENT_CLIENT_ELIMINATEDPLAYERS) +REGISTER_NET_LINKED(ENT_CLIENT_TURRET) +REGISTER_NET_LINKED(ENT_CLIENT_AUXILIARYXHAIR) +REGISTER_NET_LINKED(ENT_CLIENT_LADDER) +REGISTER_NET_LINKED(ENT_CLIENT_TRIGGER_PUSH) +REGISTER_NET_LINKED(ENT_CLIENT_TARGET_PUSH) +REGISTER_NET_LINKED(ENT_CLIENT_CONVEYOR) +REGISTER_NET_LINKED(ENT_CLIENT_DOOR) +REGISTER_NET_LINKED(ENT_CLIENT_TRAIN) +REGISTER_NET_LINKED(ENT_CLIENT_PLAT) +REGISTER_NET_LINKED(ENT_CLIENT_TRIGGER_IMPULSE) +REGISTER_NET_LINKED(ENT_CLIENT_SWAMP) +REGISTER_NET_LINKED(ENT_CLIENT_CORNER) +REGISTER_NET_LINKED(ENT_CLIENT_KEYLOCK) +REGISTER_NET_LINKED(ENT_CLIENT_GENERATOR) +REGISTER_NET_LINKED(ENT_CLIENT_CONTROLPOINT_ICON) +REGISTER_NET_LINKED(ENT_CLIENT_MINIGAME) +REGISTER_NET_LINKED(ENT_CLIENT_VIEWLOC) +REGISTER_NET_LINKED(ENT_CLIENT_VIEWLOC_TRIGGER) const int SPRITERULE_DEFAULT = 0; const int SPRITERULE_TEAMPLAY = 1; diff --git a/qcsrc/common/debug.qh b/qcsrc/common/debug.qh index 0016492a7..7301489f3 100644 --- a/qcsrc/common/debug.qh +++ b/qcsrc/common/debug.qh @@ -3,8 +3,9 @@ .bool debug; .int sv_entnum; -REGISTER_NET_TEMP(net_debug, bool isNew) +REGISTER_NET_TEMP(net_debug) #ifdef CSQC + NET_HANDLE(net_debug, bool isNew) { Net_Accept(net_debug); this.sv_entnum = ReadShort(); @@ -17,6 +18,7 @@ REGISTER_NET_TEMP(net_debug, bool isNew) this.classname = strzone(ReadString()); this.sourceLocFile = strzone(ReadString()); this.sourceLocLine = ReadInt24_t(); + return true; } #endif diff --git a/qcsrc/common/effects/all.qc b/qcsrc/common/effects/all.qc index bc7391922..347a2111b 100644 --- a/qcsrc/common/effects/all.qc +++ b/qcsrc/common/effects/all.qc @@ -1,7 +1,8 @@ #include "all.qh" -REGISTER_NET_TEMP(net_effect, bool isNew) +REGISTER_NET_TEMP(net_effect) #ifdef CSQC +NET_HANDLE(net_effect, bool isNew) { int net_name = (Effects_COUNT >= 255) ? ReadShort() : ReadByte(); @@ -30,6 +31,7 @@ REGISTER_NET_TEMP(net_effect, bool isNew) WarpZone_TrailParticles(world, particleeffectnum(eff), v, vel); else pointparticles(eff, v, vel, eff_cnt); + return true; } #endif diff --git a/qcsrc/common/items/inventory.qh b/qcsrc/common/items/inventory.qh index ead573915..307d60ec0 100644 --- a/qcsrc/common/items/inventory.qh +++ b/qcsrc/common/items/inventory.qh @@ -43,7 +43,7 @@ void Inventory_Write(Inventory data) #ifdef SVQC bool Inventory_Send(entity this, entity to, int sf) { - WriteByte(MSG_ENTITY, ENT_CLIENT_INVENTORY); + WriteHeader(MSG_ENTITY, ENT_CLIENT_INVENTORY); entity e = self.owner; if (/*IS_SPEC(e)*/ (e.classname == "spectator")) e = e.enemy; Inventory data = e.inventory; diff --git a/qcsrc/common/minigames/sv_minigames.qc b/qcsrc/common/minigames/sv_minigames.qc index 403a79d40..73e2a2bb1 100644 --- a/qcsrc/common/minigames/sv_minigames.qc +++ b/qcsrc/common/minigames/sv_minigames.qc @@ -62,7 +62,7 @@ void minigame_rmplayer(entity minigame_session, entity player) // only use on minigame entities or entities with a minigame owner bool minigame_SendEntity(entity this, entity to, int sf) { - WriteByte(MSG_ENTITY, ENT_CLIENT_MINIGAME); + WriteHeader(MSG_ENTITY, ENT_CLIENT_MINIGAME); WriteByte(MSG_ENTITY, sf); if ( sf & MINIG_SF_CREATE ) diff --git a/qcsrc/common/mutators/mutator/casings.qc b/qcsrc/common/mutators/mutator/casings.qc index 5400030b4..2ad32cf32 100644 --- a/qcsrc/common/mutators/mutator/casings.qc +++ b/qcsrc/common/mutators/mutator/casings.qc @@ -9,6 +9,8 @@ REGISTER_MUTATOR(casings, true); +REGISTER_NET_TEMP(casings) + #ifdef SVQC void SpawnCasing(vector vel, float randomvel, vector ang, vector avel, float randomavel, int casingtype, entity casingowner) {SELFPARAM(); @@ -19,8 +21,7 @@ void SpawnCasing(vector vel, float randomvel, vector ang, vector avel, float ran if (!sound_allowed(MSG_BROADCAST, casingowner)) casingtype |= 0x80; - WriteByte(MSG_ALL, SVC_TEMPENTITY); - WriteMutator(MSG_ALL, casings); + WriteHeader(MSG_ALL, casings); WriteByte(MSG_ALL, casingtype); WriteCoord(MSG_ALL, org.x); WriteCoord(MSG_ALL, org.y); @@ -122,12 +123,8 @@ void Casing_Damage(float thisdmg, int hittype, vector org, vector thisforce) self.move_flags &= ~FL_ONGROUND; } -MUTATOR_HOOKFUNCTION(casings, CSQC_Parse_TempEntity) +NET_HANDLE(casings, bool isNew) { - if (MUTATOR_RETURNVALUE) return; - if (!ReadMutatorEquals(mutator_argv_int_0, casings)) return; - return = true; - int _state = ReadByte(); vector org; org_x = ReadCoord(); @@ -138,6 +135,7 @@ MUTATOR_HOOKFUNCTION(casings, CSQC_Parse_TempEntity) ang_x = ReadByte() * 360 / 256; ang_y = ReadByte() * 360 / 256; ang_z = ReadByte() * 360 / 256; + return = true; if (!autocvar_cl_casings) return; diff --git a/qcsrc/common/mutators/mutator/damagetext.qc b/qcsrc/common/mutators/mutator/damagetext.qc index f6e9d5a47..ac451ca54 100644 --- a/qcsrc/common/mutators/mutator/damagetext.qc +++ b/qcsrc/common/mutators/mutator/damagetext.qc @@ -72,6 +72,8 @@ CLASS(DamageText, Object) ENDCLASS(DamageText) #endif +REGISTER_NET_TEMP(damagetext) + #ifdef SVQC AUTOCVAR(sv_damagetext, int, 2, _("<= 0: disabled, >= 1: spectators, >= 2: players, >= 3: all players")); #define SV_DAMAGETEXT_DISABLED() (autocvar_sv_damagetext <= 0 /* disabled */) @@ -94,8 +96,7 @@ MUTATOR_HOOKFUNCTION(damagetext, PlayerDamaged) { (SV_DAMAGETEXT_SPECTATORS_ONLY() && IS_OBSERVER(e)) ) { msg_entity = e; - WriteByte(MSG_ONE, SVC_TEMPENTITY); - WriteMutator(MSG_ONE, damagetext); + WriteHeader(MSG_ONE, damagetext); WriteShort(MSG_ONE, health); WriteShort(MSG_ONE, armor); WriteEntity(MSG_ONE, hit); @@ -108,26 +109,25 @@ MUTATOR_HOOKFUNCTION(damagetext, PlayerDamaged) { #endif #ifdef CSQC -MUTATOR_HOOKFUNCTION(damagetext, CSQC_Parse_TempEntity) { - if (MUTATOR_RETURNVALUE) return false; - if (!ReadMutatorEquals(mutator_argv_int_0, damagetext)) return false; +NET_HANDLE(damagetext, bool isNew) +{ int health = ReadShort(); int armor = ReadShort(); int group = ReadShort(); vector location = vec3(ReadCoord(), ReadCoord(), ReadCoord()); int deathtype = ReadInt24_t(); + return = true; if (autocvar_cl_damagetext) { if (autocvar_cl_damagetext_accumulate_range) { for (entity e = findradius(location, autocvar_cl_damagetext_accumulate_range); e; e = e.chain) { if (e.instanceOfDamageText && e.m_group == group) { DamageText_update(e, location, e.m_damage + health, e.m_armordamage + armor, deathtype); - return true; + return; } } } NEW(DamageText, group, location, health, armor, deathtype); } - return true; } #endif diff --git a/qcsrc/common/mutators/mutator/itemstime.qc b/qcsrc/common/mutators/mutator/itemstime.qc index 5dc9fba67..d6b256af3 100644 --- a/qcsrc/common/mutators/mutator/itemstime.qc +++ b/qcsrc/common/mutators/mutator/itemstime.qc @@ -1,12 +1,13 @@ #ifdef IMPLEMENTATION REGISTER_MUTATOR(itemstime, true); +REGISTER_NET_TEMP(itemstime) + #ifdef SVQC void IT_Write(entity e, int i, float f) { if (!IS_REAL_CLIENT(e)) return; msg_entity = e; - WriteByte(MSG_ONE, SVC_TEMPENTITY); - WriteMutator(MSG_ONE, itemstime); + WriteHeader(MSG_ONE, itemstime); WriteByte(MSG_ONE, i); WriteFloat(MSG_ONE, f); } @@ -15,13 +16,12 @@ void IT_Write(entity e, int i, float f) { #ifdef CSQC float ItemsTime_time[Items_MAX]; float ItemsTime_availableTime[Items_MAX]; -MUTATOR_HOOKFUNCTION(itemstime, CSQC_Parse_TempEntity) { - if (MUTATOR_RETURNVALUE) return false; - if (!ReadMutatorEquals(mutator_argv_int_0, itemstime)) return false; +NET_HANDLE(itemstime, bool isNew) +{ int i = ReadByte(); float f = ReadFloat(); + return = true; ItemsTime_time[i] = f; - return true; } #endif diff --git a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc index 54eec3c9a..7fa9181f2 100644 --- a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc +++ b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc @@ -4,11 +4,13 @@ REGISTER_MUTATOR(waypointsprites, true); +REGISTER_NET_LINKED(waypointsprites) + #ifdef SVQC /** flags origin [team displayrule] [spritename] [spritename2] [spritename3] [lifetime maxdistance hideable] */ bool WaypointSprite_SendEntity(entity this, entity to, float sendflags) { - WriteMutator(MSG_ENTITY, waypointsprites); + WriteHeader(MSG_ENTITY, waypointsprites); sendflags = sendflags & 0x7F; @@ -97,9 +99,7 @@ bool WaypointSprite_SendEntity(entity this, entity to, float sendflags) #ifdef CSQC void Ent_WaypointSprite(); -MUTATOR_HOOKFUNCTION(waypointsprites, CSQC_Ent_Update) { - if (MUTATOR_RETURNVALUE) return false; - if (!ReadMutatorEquals(mutator_argv_int_0, waypointsprites)) return false; +NET_HANDLE(waypointsprites, bool isnew) { Ent_WaypointSprite(); return true; } diff --git a/qcsrc/common/nades/all.qc b/qcsrc/common/nades/all.qc index d56f2805f..7dfae12ac 100644 --- a/qcsrc/common/nades/all.qc +++ b/qcsrc/common/nades/all.qc @@ -49,8 +49,9 @@ void healer_setup(entity e) } #endif // CSQC -REGISTER_NET_LINKED(Nade_Heal, bool isNew) +REGISTER_NET_LINKED(Nade_Heal) #ifdef CSQC +NET_HANDLE(Nade_Heal, bool isNew) { Net_Accept(Nade_Heal); int sf = ReadByte(); @@ -65,6 +66,7 @@ REGISTER_NET_LINKED(Nade_Heal, bool isNew) // this.ltime = time + this.healer_lifetime; healer_setup(this); } + return true; } #endif diff --git a/qcsrc/common/net_notice.qc b/qcsrc/common/net_notice.qc index 317eec109..b409ecd5f 100644 --- a/qcsrc/common/net_notice.qc +++ b/qcsrc/common/net_notice.qc @@ -29,8 +29,7 @@ void sv_notice_join() void sv_notice_to(entity _to, string _notice, float _howlong, float _modal) { msg_entity = _to; - WriteByte(MSG_ONE, SVC_TEMPENTITY); - WriteByte(MSG_ONE, TE_CSQC_SVNOTICE); + WriteHeader(MSG_ONE, TE_CSQC_SVNOTICE); WriteString(MSG_ONE, _notice); WriteLong(MSG_ONE, _howlong); WriteByte(MSG_ONE, _modal); @@ -47,6 +46,11 @@ void sv_notice_toall(string _notice, float _howlong, float _modal) #endif // SVQC #ifdef CSQC +NET_HANDLE(TE_CSQC_SVNOTICE, bool isNew) +{ + cl_notice_read(); + return true; +} void cl_notice_read() { //float _done; diff --git a/qcsrc/common/notifications.qc b/qcsrc/common/notifications.qc index c46988ddd..b5624f506 100644 --- a/qcsrc/common/notifications.qc +++ b/qcsrc/common/notifications.qc @@ -1777,7 +1777,7 @@ bool Net_Write_Notification(entity this, entity client, int sf) { if(Notification_ShouldSend(self.nent_broadcast, client, self.nent_client)) { - WriteByte(MSG_ENTITY, ENT_CLIENT_NOTIFICATION); + WriteHeader(MSG_ENTITY, ENT_CLIENT_NOTIFICATION); WriteByte(MSG_ENTITY, self.nent_net_type); WriteShort(MSG_ENTITY, self.nent_net_name); for(int i = 0; i < self.nent_stringcount; ++i) { WriteString(MSG_ENTITY, self.nent_strings[i]); } diff --git a/qcsrc/common/triggers/func/conveyor.qc b/qcsrc/common/triggers/func/conveyor.qc index 73f22b99b..a8dfafc87 100644 --- a/qcsrc/common/triggers/func/conveyor.qc +++ b/qcsrc/common/triggers/func/conveyor.qc @@ -72,7 +72,7 @@ void conveyor_reset() bool conveyor_send(entity this, entity to, int sf) { - WriteByte(MSG_ENTITY, ENT_CLIENT_CONVEYOR); + WriteHeader(MSG_ENTITY, ENT_CLIENT_CONVEYOR); WriteByte(MSG_ENTITY, sf); if(sf & 1) diff --git a/qcsrc/common/triggers/func/door.qc b/qcsrc/common/triggers/func/door.qc index e2d122816..6eaf2547b 100644 --- a/qcsrc/common/triggers/func/door.qc +++ b/qcsrc/common/triggers/func/door.qc @@ -631,7 +631,7 @@ FIXME: only one sound set available at the time being float door_send(entity to, float sf) {SELFPARAM(); - WriteByte(MSG_ENTITY, ENT_CLIENT_DOOR); + WriteHeader(MSG_ENTITY, ENT_CLIENT_DOOR); WriteByte(MSG_ENTITY, sf); if(sf & SF_TRIGGER_INIT) diff --git a/qcsrc/common/triggers/func/ladder.qc b/qcsrc/common/triggers/func/ladder.qc index c27dd2ce0..b33de95f1 100644 --- a/qcsrc/common/triggers/func/ladder.qc +++ b/qcsrc/common/triggers/func/ladder.qc @@ -20,7 +20,7 @@ void func_ladder_touch() #ifdef SVQC bool func_ladder_send(entity this, entity to, float sf) { - WriteByte(MSG_ENTITY, ENT_CLIENT_LADDER); + WriteHeader(MSG_ENTITY, ENT_CLIENT_LADDER); WriteString(MSG_ENTITY, self.classname); WriteByte(MSG_ENTITY, self.skin); diff --git a/qcsrc/common/triggers/func/plat.qc b/qcsrc/common/triggers/func/plat.qc index fc62341a8..30d3d5681 100644 --- a/qcsrc/common/triggers/func/plat.qc +++ b/qcsrc/common/triggers/func/plat.qc @@ -9,7 +9,7 @@ void plat_delayedinit() float plat_send(entity to, float sf) {SELFPARAM(); - WriteByte(MSG_ENTITY, ENT_CLIENT_PLAT); + WriteHeader(MSG_ENTITY, ENT_CLIENT_PLAT); WriteByte(MSG_ENTITY, sf); if(sf & SF_TRIGGER_INIT) diff --git a/qcsrc/common/triggers/func/pointparticles.qc b/qcsrc/common/triggers/func/pointparticles.qc index 3b37f0f76..d82232d6d 100644 --- a/qcsrc/common/triggers/func/pointparticles.qc +++ b/qcsrc/common/triggers/func/pointparticles.qc @@ -7,7 +7,7 @@ bool pointparticles_SendEntity(entity this, entity to, float fl) { - WriteByte(MSG_ENTITY, ENT_CLIENT_POINTPARTICLES); + WriteHeader(MSG_ENTITY, ENT_CLIENT_POINTPARTICLES); // optional features to save space fl = fl & 0x0F; diff --git a/qcsrc/common/triggers/func/rainsnow.qc b/qcsrc/common/triggers/func/rainsnow.qc index 18c2c0a0f..91dc8bad6 100644 --- a/qcsrc/common/triggers/func/rainsnow.qc +++ b/qcsrc/common/triggers/func/rainsnow.qc @@ -1,7 +1,7 @@ #ifdef SVQC bool rainsnow_SendEntity(entity this, entity to, float sf) { - WriteByte(MSG_ENTITY, ENT_CLIENT_RAINSNOW); + WriteHeader(MSG_ENTITY, ENT_CLIENT_RAINSNOW); WriteByte(MSG_ENTITY, self.state); WriteCoord(MSG_ENTITY, self.origin_x + self.mins_x); WriteCoord(MSG_ENTITY, self.origin_y + self.mins_y); diff --git a/qcsrc/common/triggers/func/train.qc b/qcsrc/common/triggers/func/train.qc index 65414548b..45480686a 100644 --- a/qcsrc/common/triggers/func/train.qc +++ b/qcsrc/common/triggers/func/train.qc @@ -104,7 +104,7 @@ void train_next() #ifdef SVQC float train_send(entity to, float sf) {SELFPARAM(); - WriteByte(MSG_ENTITY, ENT_CLIENT_TRAIN); + WriteHeader(MSG_ENTITY, ENT_CLIENT_TRAIN); WriteByte(MSG_ENTITY, sf); if(sf & SF_TRIGGER_INIT) diff --git a/qcsrc/common/triggers/misc/corner.qc b/qcsrc/common/triggers/misc/corner.qc index ccac77b6c..38dd8f586 100644 --- a/qcsrc/common/triggers/misc/corner.qc +++ b/qcsrc/common/triggers/misc/corner.qc @@ -1,7 +1,7 @@ #ifdef SVQC bool corner_send(entity to, int sf) {SELFPARAM(); - WriteByte(MSG_ENTITY, ENT_CLIENT_CORNER); + WriteHeader(MSG_ENTITY, ENT_CLIENT_CORNER); WriteString(MSG_ENTITY, self.platmovetype); diff --git a/qcsrc/common/triggers/misc/laser.qc b/qcsrc/common/triggers/misc/laser.qc index e1c9cafb0..29a185626 100644 --- a/qcsrc/common/triggers/misc/laser.qc +++ b/qcsrc/common/triggers/misc/laser.qc @@ -124,7 +124,7 @@ void misc_laser_think() bool laser_SendEntity(entity this, entity to, float fl) { - WriteByte(MSG_ENTITY, ENT_CLIENT_LASER); + WriteHeader(MSG_ENTITY, ENT_CLIENT_LASER); fl = fl - (fl & 0xF0); // use that bit to indicate finite length laser if(self.spawnflags & 2) fl |= 0x80; diff --git a/qcsrc/common/triggers/target/music.qc b/qcsrc/common/triggers/target/music.qc index ebecb18e3..c2014bf95 100644 --- a/qcsrc/common/triggers/target/music.qc +++ b/qcsrc/common/triggers/target/music.qc @@ -19,8 +19,7 @@ // when targetname is not set, THIS ONE is default void target_music_sendto(float to, float is) {SELFPARAM(); - WriteByte(to, SVC_TEMPENTITY); - WriteByte(to, TE_CSQC_TARGET_MUSIC); + WriteHeader(to, TE_CSQC_TARGET_MUSIC); WriteShort(to, num_for_edict(self)); WriteByte(to, self.volume * 255.0 * is); WriteByte(to, self.fade_time * 16.0); @@ -88,7 +87,7 @@ void TargetMusic_RestoreGame() // when triggered, it is disabled/enabled for everyone bool trigger_music_SendEntity(entity this, entity to, float sf) { - WriteByte(MSG_ENTITY, ENT_CLIENT_TRIGGER_MUSIC); + WriteHeader(MSG_ENTITY, ENT_CLIENT_TRIGGER_MUSIC); sf &= ~0x80; if(self.cnt) sf |= 0x80; @@ -165,7 +164,7 @@ void TargetMusic_Advance() best = music_target; if(music_trigger) best = music_trigger; - for(e = world; (e = findfloat(e, enttype, ENT_CLIENT_TRIGGER_MUSIC)); ) if(e.noise) + for(e = world; (e = findfloat(e, enttype, NET_ENT_CLIENT_TRIGGER_MUSIC.m_id)); ) if(e.noise) { vol0 = e.lastvol; if(getsoundtime(e, CH_BGM_SINGLE) < 0) @@ -206,6 +205,12 @@ void TargetMusic_Advance() bgmtime = gettime(GETTIME_CDTRACK); } +NET_HANDLE(TE_CSQC_TARGET_MUSIC, bool isNew) +{ + Net_TargetMusic(); + return true; +} + void Net_TargetMusic() { int id = ReadShort(); @@ -216,7 +221,7 @@ void Net_TargetMusic() string noi = ReadString(); entity e; - for(e = world; (e = findfloat(e, enttype, ENT_CLIENT_TRIGGER_MUSIC)); ) + for(e = world; (e = findfloat(e, enttype, NET_ENT_CLIENT_TRIGGER_MUSIC.m_id)); ) { if(e.count == id) break; @@ -224,7 +229,7 @@ void Net_TargetMusic() if(!e) { e = spawn(); - e.enttype = ENT_CLIENT_TRIGGER_MUSIC; + e.enttype = NET_ENT_CLIENT_TRIGGER_MUSIC.m_id; e.count = id; } if(e.noise != noi) diff --git a/qcsrc/common/triggers/trigger/impulse.qc b/qcsrc/common/triggers/trigger/impulse.qc index c40fed3a8..977821d44 100644 --- a/qcsrc/common/triggers/trigger/impulse.qc +++ b/qcsrc/common/triggers/trigger/impulse.qc @@ -133,7 +133,7 @@ in directional and sperical mode. For damper/accelerator mode this is not nesses #ifdef SVQC bool trigger_impulse_send(entity to, int sf) {SELFPARAM(); - WriteByte(MSG_ENTITY, ENT_CLIENT_TRIGGER_IMPULSE); + WriteHeader(MSG_ENTITY, ENT_CLIENT_TRIGGER_IMPULSE); WriteCoord(MSG_ENTITY, self.radius); WriteCoord(MSG_ENTITY, self.strength); diff --git a/qcsrc/common/triggers/trigger/jumppads.qc b/qcsrc/common/triggers/trigger/jumppads.qc index 67659034a..817b50e46 100644 --- a/qcsrc/common/triggers/trigger/jumppads.qc +++ b/qcsrc/common/triggers/trigger/jumppads.qc @@ -317,7 +317,7 @@ void trigger_push_findtarget() #ifdef SVQC float trigger_push_send(entity to, float sf) {SELFPARAM(); - WriteByte(MSG_ENTITY, ENT_CLIENT_TRIGGER_PUSH); + WriteHeader(MSG_ENTITY, ENT_CLIENT_TRIGGER_PUSH); WriteByte(MSG_ENTITY, sf); if(sf & 1) @@ -388,7 +388,7 @@ spawnfunc(trigger_push) bool target_push_send(entity this, entity to, float sf) { - WriteByte(MSG_ENTITY, ENT_CLIENT_TARGET_PUSH); + WriteHeader(MSG_ENTITY, ENT_CLIENT_TARGET_PUSH); WriteByte(MSG_ENTITY, self.cnt); WriteString(MSG_ENTITY, self.targetname); diff --git a/qcsrc/common/triggers/trigger/keylock.qc b/qcsrc/common/triggers/trigger/keylock.qc index 8cef73c7a..fe33e7906 100644 --- a/qcsrc/common/triggers/trigger/keylock.qc +++ b/qcsrc/common/triggers/trigger/keylock.qc @@ -97,7 +97,7 @@ void trigger_keylock_touch() #ifdef SVQC bool trigger_keylock_send(entity to, int sf) {SELFPARAM(); - WriteByte(MSG_ENTITY, ENT_CLIENT_KEYLOCK); + WriteHeader(MSG_ENTITY, ENT_CLIENT_KEYLOCK); WriteInt24_t(MSG_ENTITY, self.itemkeys); WriteByte(MSG_ENTITY, self.height); diff --git a/qcsrc/common/triggers/trigger/swamp.qc b/qcsrc/common/triggers/trigger/swamp.qc index a906fcd31..c50dc1090 100644 --- a/qcsrc/common/triggers/trigger/swamp.qc +++ b/qcsrc/common/triggers/trigger/swamp.qc @@ -95,7 +95,7 @@ void swamp_touch(void) #ifdef SVQC float swamp_send(entity to, float sf) {SELFPARAM(); - WriteByte(MSG_ENTITY, ENT_CLIENT_LADDER); + WriteHeader(MSG_ENTITY, ENT_CLIENT_LADDER); // FIXME: should this really be sent as a ladder? WriteByte(MSG_ENTITY, self.dmg); // can probably get away with using a single byte here WriteByte(MSG_ENTITY, self.swamp_slowdown); diff --git a/qcsrc/common/triggers/trigger/viewloc.qc b/qcsrc/common/triggers/trigger/viewloc.qc index c21fe6b54..cd950a406 100644 --- a/qcsrc/common/triggers/trigger/viewloc.qc +++ b/qcsrc/common/triggers/trigger/viewloc.qc @@ -40,7 +40,7 @@ void viewloc_think() bool trigger_viewloc_send(entity this, entity to, int sf) { // CSQC doesn't need to know our origin (yet), as we're only available for referencing - WriteByte(MSG_ENTITY, ENT_CLIENT_VIEWLOC_TRIGGER); + WriteHeader(MSG_ENTITY, ENT_CLIENT_VIEWLOC_TRIGGER); WriteEntity(MSG_ENTITY, self.enemy); WriteEntity(MSG_ENTITY, self.goalentity); @@ -90,7 +90,7 @@ spawnfunc(trigger_viewlocation) bool viewloc_send(entity this, entity to, int sf) { - WriteByte(MSG_ENTITY, ENT_CLIENT_VIEWLOC); + WriteHeader(MSG_ENTITY, ENT_CLIENT_VIEWLOC); WriteByte(MSG_ENTITY, self.cnt); diff --git a/qcsrc/common/turrets/sv_turrets.qc b/qcsrc/common/turrets/sv_turrets.qc index 33e41cd49..9ab9a3211 100644 --- a/qcsrc/common/turrets/sv_turrets.qc +++ b/qcsrc/common/turrets/sv_turrets.qc @@ -302,7 +302,7 @@ void turrets_setframe(float _frame, float client_only) bool turret_send(entity this, entity to, float sf) { - WriteByte(MSG_ENTITY, ENT_CLIENT_TURRET); + WriteHeader(MSG_ENTITY, ENT_CLIENT_TURRET); WriteByte(MSG_ENTITY, sf); if(sf & TNSF_SETUP) { diff --git a/qcsrc/common/util.qh b/qcsrc/common/util.qh index 5c48e42a8..fac4269d7 100644 --- a/qcsrc/common/util.qh +++ b/qcsrc/common/util.qh @@ -278,11 +278,6 @@ string CCR(string input); #define normal_or_gentle(normal, gentle) (GENTLE ? ((gentle != "") ? gentle : normal) : normal) #endif -// allow writing to also pass through to spectators (like so spectators see the same centerprints as players for example) -#define WRITESPECTATABLE_MSG_ONE_VARNAME(varname,statement) entity varname; varname = msg_entity; FOR_EACH_REALCLIENT(msg_entity) if(msg_entity == varname || (msg_entity.classname == STR_SPECTATOR && msg_entity.enemy == varname)) statement msg_entity = varname -#define WRITESPECTATABLE_MSG_ONE(statement) WRITESPECTATABLE_MSG_ONE_VARNAME(oldmsg_entity, statement) -#define WRITESPECTATABLE(msg,statement) if(msg == MSG_ONE) { WRITESPECTATABLE_MSG_ONE(statement); } else statement float WRITESPECTATABLE_workaround = 0 - vector vec3(float x, float y, float z); #ifndef MENUQC diff --git a/qcsrc/common/vehicles/cl_vehicles.qc b/qcsrc/common/vehicles/cl_vehicles.qc index b24097c03..ff8e7c58d 100644 --- a/qcsrc/common/vehicles/cl_vehicles.qc +++ b/qcsrc/common/vehicles/cl_vehicles.qc @@ -72,6 +72,11 @@ void Net_AuXair2(bool bIsNew) axh.draw2d = AuxiliaryXhair_Draw2D; } +NET_HANDLE(TE_CSQC_VEHICLESETUP, bool isNew) +{ + Net_VehicleSetup(); + return true; +} void Net_VehicleSetup() {SELFPARAM(); int hud_id = ReadByte(); diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc index eb13fae39..7f0537eeb 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qc +++ b/qcsrc/common/vehicles/sv_vehicles.qc @@ -40,7 +40,7 @@ bool vehicle_send(entity to, int sf) bool SendAuxiliaryXhair(entity this, entity to, int sf) { - WriteByte(MSG_ENTITY, ENT_CLIENT_AUXILIARYXHAIR); + WriteHeader(MSG_ENTITY, ENT_CLIENT_AUXILIARYXHAIR); WriteByte(MSG_ENTITY, self.cnt); @@ -87,8 +87,7 @@ void CSQCVehicleSetup(entity own, int vehicle_id) msg_entity = own; - WriteByte(MSG_ONE, SVC_TEMPENTITY); - WriteByte(MSG_ONE, TE_CSQC_VEHICLESETUP); + WriteHeader(MSG_ONE, TE_CSQC_VEHICLESETUP); WriteByte(MSG_ONE, vehicle_id); } diff --git a/qcsrc/common/vehicles/vehicle/bumblebee_weapons.qc b/qcsrc/common/vehicles/vehicle/bumblebee_weapons.qc index d58e88701..944dc53a5 100644 --- a/qcsrc/common/vehicles/vehicle/bumblebee_weapons.qc +++ b/qcsrc/common/vehicles/vehicle/bumblebee_weapons.qc @@ -30,7 +30,7 @@ void bumblebee_fire_cannon(entity _gun, string _tagname, entity _owner) bool bumble_raygun_send(entity this, entity to, float sf) { - WriteByte(MSG_ENTITY, ENT_CLIENT_BUMBLE_RAYGUN); + WriteHeader(MSG_ENTITY, ENT_CLIENT_BUMBLE_RAYGUN); WriteByte(MSG_ENTITY, sf); if(sf & BRG_SETUP) diff --git a/qcsrc/common/weapons/weapon/arc.qc b/qcsrc/common/weapons/weapon/arc.qc index 031fe679d..101029fe3 100644 --- a/qcsrc/common/weapons/weapon/arc.qc +++ b/qcsrc/common/weapons/weapon/arc.qc @@ -132,7 +132,7 @@ spawnfunc(weapon_arc) { weapon_defaultspawnfunc(this, WEP_ARC); } bool W_Arc_Beam_Send(entity this, entity to, int sf) { - WriteByte(MSG_ENTITY, ENT_CLIENT_ARC_BEAM); + WriteHeader(MSG_ENTITY, ENT_CLIENT_ARC_BEAM); // Truncate information when this beam is displayed to the owner client // - The owner client has no use for beam start position or directions, diff --git a/qcsrc/common/weapons/weapon/shockwave.qc b/qcsrc/common/weapons/weapon/shockwave.qc index 49737537b..171bf091f 100644 --- a/qcsrc/common/weapons/weapon/shockwave.qc +++ b/qcsrc/common/weapons/weapon/shockwave.qc @@ -337,8 +337,7 @@ float W_Shockwave_Attack_CheckHit( void W_Shockwave_Send(void) {SELFPARAM(); - WriteByte(MSG_BROADCAST, SVC_TEMPENTITY); - WriteByte(MSG_BROADCAST, TE_CSQC_SHOCKWAVEPARTICLE); + WriteHeader(MSG_BROADCAST, TE_CSQC_SHOCKWAVEPARTICLE); WriteCoord(MSG_BROADCAST, w_shotorg.x); WriteCoord(MSG_BROADCAST, w_shotorg.y); WriteCoord(MSG_BROADCAST, w_shotorg.z); @@ -833,6 +832,12 @@ void Draw_Shockwave(entity this) } } +NET_HANDLE(TE_CSQC_SHOCKWAVEPARTICLE, bool isNew) +{ + Net_ReadShockwaveParticle(); + return true; +} + void Net_ReadShockwaveParticle(void) { entity shockwave; diff --git a/qcsrc/common/weapons/weapon/tuba.qc b/qcsrc/common/weapons/weapon/tuba.qc index 130edaaf5..851f9fcdf 100644 --- a/qcsrc/common/weapons/weapon/tuba.qc +++ b/qcsrc/common/weapons/weapon/tuba.qc @@ -261,7 +261,7 @@ bool W_Tuba_NoteSendEntity(entity this, entity to, int sf) if(!sound_allowed(MSG_ONE, self.realowner)) return false; - WriteByte(MSG_ENTITY, ENT_CLIENT_TUBANOTE); + WriteHeader(MSG_ENTITY, ENT_CLIENT_TUBANOTE); WriteByte(MSG_ENTITY, sf); if(sf & 1) { diff --git a/qcsrc/common/weapons/weapon/vortex.qc b/qcsrc/common/weapons/weapon/vortex.qc index 5a64accc9..705bf6644 100644 --- a/qcsrc/common/weapons/weapon/vortex.qc +++ b/qcsrc/common/weapons/weapon/vortex.qc @@ -67,8 +67,7 @@ spawnfunc(weapon_nex) { spawnfunc_weapon_vortex(this); } void SendCSQCVortexBeamParticle(float charge) { vector v; v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos); - WriteByte(MSG_BROADCAST, SVC_TEMPENTITY); - WriteByte(MSG_BROADCAST, TE_CSQC_VORTEXBEAMPARTICLE); + WriteHeader(MSG_BROADCAST, TE_CSQC_VORTEXBEAMPARTICLE); WriteCoord(MSG_BROADCAST, w_shotorg.x); WriteCoord(MSG_BROADCAST, w_shotorg.y); WriteCoord(MSG_BROADCAST, w_shotorg.z); diff --git a/qcsrc/lib/csqcmodel/sv_model.qc b/qcsrc/lib/csqcmodel/sv_model.qc index 8fcdcfbee..012149887 100644 --- a/qcsrc/lib/csqcmodel/sv_model.qc +++ b/qcsrc/lib/csqcmodel/sv_model.qc @@ -41,7 +41,7 @@ bool CSQCModel_Send(entity to, int sf) unused_float = islocalplayer; unused_float = isnolocalplayer; - WriteByte(MSG_ENTITY, ENT_CLIENT_MODEL); + WriteHeader(MSG_ENTITY, ENT_CLIENT_MODEL); WriteInt24_t(MSG_ENTITY, sf); #define CSQCMODEL_IF(cond) if(cond) { diff --git a/qcsrc/lib/net.qh b/qcsrc/lib/net.qh index 35d5b3853..0acba4e66 100644 --- a/qcsrc/lib/net.qh +++ b/qcsrc/lib/net.qh @@ -57,7 +57,7 @@ .string netname; .int m_id; -.void(entity this, bool isNew)m_read; +.bool(entity this, bool isNew) m_read; #ifdef CSQC #define Net_Accept(classname) \ @@ -72,6 +72,8 @@ if (this) remove(this); \ } \ while (0) + #define NET_HANDLE(id, param) \ + bool Net_Handle_##id(entity this, param) #else #define WriteHeader(to, id) \ do \ @@ -83,8 +85,8 @@ #endif #ifdef CSQC - #define REGISTER_NET_LINKED(id, param) \ - void Ent_Read##id(entity this, param) \ + #define REGISTER_NET_LINKED(id) \ + [[accumulate]] NET_HANDLE(id, bool) \ { \ this = self; \ this.sourceLocFile = __FILE__; \ @@ -94,11 +96,10 @@ { \ make_pure(this); \ this.netname = #id; \ - this.m_read = Ent_Read##id; \ - } \ - [[accumulate]] void Ent_Read##id(entity this, param) + this.m_read = Net_Handle_##id; \ + } #else - #define REGISTER_NET_LINKED(id, param) \ + #define REGISTER_NET_LINKED(id) \ const bool NET_##id##_istemp = false; \ REGISTER(RegisterLinkedEntities, NET, LinkedEntities, id, m_id, new(net_linked_packet)) \ { \ @@ -107,28 +108,27 @@ } #endif -REGISTRY(LinkedEntities, BITS(4)) +REGISTRY(LinkedEntities, BITS(8) - 1) #define LinkedEntities_from(i) _LinkedEntities_from(i, NULL) REGISTER_REGISTRY(RegisterLinkedEntities) REGISTRY_SORT(LinkedEntities, netname, 0) STATIC_INIT(RegisterLinkedEntities_renumber) { for (int i = 0; i < LinkedEntities_COUNT; ++i) - LinkedEntities_from(i).m_id = 100 + i; + LinkedEntities_from(i).m_id = 1 + i; } #ifdef CSQC - #define REGISTER_NET_TEMP(id, param) \ - void Net_Read##id(entity this, param); \ + #define REGISTER_NET_TEMP(id) \ + NET_HANDLE(id, bool); \ REGISTER(RegisterTempEntities, NET, TempEntities, id, m_id, new(net_temp_packet)) \ { \ make_pure(this); \ this.netname = #id; \ - this.m_read = Net_Read##id; \ - } \ - void Net_Read##id(entity this, param) + this.m_read = Net_Handle_##id; \ + } #else - #define REGISTER_NET_TEMP(id, param) \ + #define REGISTER_NET_TEMP(id) \ const bool NET_##id##_istemp = true; \ REGISTER(RegisterTempEntities, NET, TempEntities, id, m_id, new(net_temp_packet)) \ { \ @@ -137,14 +137,14 @@ STATIC_INIT(RegisterLinkedEntities_renumber) } #endif -REGISTRY(TempEntities, BITS(4)) +REGISTRY(TempEntities, 128) #define TempEntities_from(i) _TempEntities_from(i, NULL) REGISTER_REGISTRY(RegisterTempEntities) REGISTRY_SORT(TempEntities, netname, 0) STATIC_INIT(RegisterTempEntities_renumber) { for (int i = 0; i < TempEntities_COUNT; ++i) - TempEntities_from(i).m_id = 115 + i; + TempEntities_from(i).m_id = 100 + i; } #ifndef MENUQC @@ -191,6 +191,11 @@ STATIC_INIT(RegisterTempEntities_renumber) WriteInt24_t(dst, val.y); WriteInt24_t(dst, val.z); } + + // allow writing to also pass through to spectators (like so spectators see the same centerprints as players for example) + #define WRITESPECTATABLE_MSG_ONE_VARNAME(varname,statement) entity varname; varname = msg_entity; FOR_EACH_REALCLIENT(msg_entity) if(msg_entity == varname || (msg_entity.classname == STR_SPECTATOR && msg_entity.enemy == varname)) statement msg_entity = varname + #define WRITESPECTATABLE_MSG_ONE(statement) WRITESPECTATABLE_MSG_ONE_VARNAME(oldmsg_entity, statement) + #define WRITESPECTATABLE(msg,statement) if(msg == MSG_ONE) { WRITESPECTATABLE_MSG_ONE(statement); } else statement float WRITESPECTATABLE_workaround = 0 #endif #endif diff --git a/qcsrc/lib/warpzone/server.qc b/qcsrc/lib/warpzone/server.qc index ec109dad9..268a8aadd 100644 --- a/qcsrc/lib/warpzone/server.qc +++ b/qcsrc/lib/warpzone/server.qc @@ -53,7 +53,7 @@ void WarpZone_TeleportPlayer(entity teleporter, entity player, vector to, vector bool WarpZone_Teleported_Send(entity to, int sf) {SELFPARAM(); - WriteByte(MSG_ENTITY, ENT_CLIENT_WARPZONE_TELEPORTED); + WriteHeader(MSG_ENTITY, ENT_CLIENT_WARPZONE_TELEPORTED); WriteCoord(MSG_ENTITY, self.angles.x); WriteCoord(MSG_ENTITY, self.angles.y); WriteCoord(MSG_ENTITY, self.angles.z); @@ -216,7 +216,7 @@ void WarpZone_Touch (void) bool WarpZone_Send(entity to, int sendflags) {SELFPARAM(); - WriteByte(MSG_ENTITY, ENT_CLIENT_WARPZONE); + WriteHeader(MSG_ENTITY, ENT_CLIENT_WARPZONE); // we must send this flag for clientside to match properly too int f = 0; @@ -271,7 +271,7 @@ bool WarpZone_Send(entity to, int sendflags) bool WarpZone_Camera_Send(entity to, int sendflags) {SELFPARAM(); int f = 0; - WriteByte(MSG_ENTITY, ENT_CLIENT_WARPZONE_CAMERA); + WriteHeader(MSG_ENTITY, ENT_CLIENT_WARPZONE_CAMERA); if(self.warpzone_fadestart) BITSET_ASSIGN(f, 2); diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index a8d59fde1..462d42722 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -50,8 +50,7 @@ void send_CSQC_teamnagger() { - WriteByte(MSG_BROADCAST, SVC_TEMPENTITY); - WriteByte(MSG_BROADCAST, TE_CSQC_TEAMNAGGER); + WriteHeader(MSG_BROADCAST, TE_CSQC_TEAMNAGGER); } bool ClientData_Send(entity this, entity to, int sf) @@ -79,7 +78,7 @@ bool ClientData_Send(entity this, entity to, int sf) if(e.porto_v_angle_held) sf |= 8; // angles held - WriteByte(MSG_ENTITY, ENT_CLIENT_CLIENTDATA); + WriteHeader(MSG_ENTITY, ENT_CLIENT_CLIENTDATA); WriteByte(MSG_ENTITY, sf); if(sf & 2) @@ -631,7 +630,7 @@ void PutClientInServer() // changes and just have a console command to update this? bool ClientInit_SendEntity(entity this, entity to, int sf) { - WriteByte(MSG_ENTITY, ENT_CLIENT_INIT); + WriteHeader(MSG_ENTITY, ENT_CLIENT_INIT); WriteByte(MSG_ENTITY, g_nexball_meter_period * 32); WriteInt24_t(MSG_ENTITY, compressShotOrigin(hook_shotorigin[0])); WriteInt24_t(MSG_ENTITY, compressShotOrigin(hook_shotorigin[1])); diff --git a/qcsrc/server/command/vote.qc b/qcsrc/server/command/vote.qc index d7c829871..dd131f3a6 100644 --- a/qcsrc/server/command/vote.qc +++ b/qcsrc/server/command/vote.qc @@ -27,7 +27,7 @@ bool Nagger_SendEntity(entity this, entity to, float sendflags) { int nags, i, f, b; entity e; - WriteByte(MSG_ENTITY, ENT_CLIENT_NAGGER); + WriteHeader(MSG_ENTITY, ENT_CLIENT_NAGGER); // bits: // 1 = ready diff --git a/qcsrc/server/controlpoint.qc b/qcsrc/server/controlpoint.qc index ceeb4f185..74494b7ee 100644 --- a/qcsrc/server/controlpoint.qc +++ b/qcsrc/server/controlpoint.qc @@ -6,7 +6,7 @@ bool cpicon_send(entity this, entity to, int sf) { - WriteByte(MSG_ENTITY, ENT_CLIENT_CONTROLPOINT_ICON); + WriteHeader(MSG_ENTITY, ENT_CLIENT_CONTROLPOINT_ICON); WriteByte(MSG_ENTITY, sf); if(sf & CPSF_SETUP) { diff --git a/qcsrc/server/csqceffects.qc b/qcsrc/server/csqceffects.qc index a26fa97aa..248d88536 100644 --- a/qcsrc/server/csqceffects.qc +++ b/qcsrc/server/csqceffects.qc @@ -6,8 +6,7 @@ void te_csqc_lightningarc(vector from,vector to) { - WriteByte(MSG_BROADCAST, SVC_TEMPENTITY); - WriteByte(MSG_BROADCAST, TE_CSQC_ARC); + WriteHeader(MSG_BROADCAST, TE_CSQC_ARC); WriteCoord(MSG_BROADCAST, from.x); WriteCoord(MSG_BROADCAST, from.y); diff --git a/qcsrc/server/ent_cs.qc b/qcsrc/server/ent_cs.qc index f69ea7a67..9c98e7d99 100644 --- a/qcsrc/server/ent_cs.qc +++ b/qcsrc/server/ent_cs.qc @@ -19,7 +19,7 @@ float entcs_customize() bool entcs_send(entity this, entity to, int sf) { - WriteByte(MSG_ENTITY, ENT_CLIENT_ENTCS); + WriteHeader(MSG_ENTITY, ENT_CLIENT_ENTCS); WriteByte(MSG_ENTITY, sf); if(sf & BIT(0)) WriteByte(MSG_ENTITY, num_for_edict(self.owner) - 1); diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index efd59e940..343be952c 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -26,7 +26,7 @@ bool Damage_DamageInfo_SendEntity(entity this, entity to, int sf) { - WriteByte(MSG_ENTITY, ENT_CLIENT_DAMAGEINFO); + WriteHeader(MSG_ENTITY, ENT_CLIENT_DAMAGEINFO); WriteShort(MSG_ENTITY, self.projectiledeathtype); WriteCoord(MSG_ENTITY, floor(self.origin.x)); WriteCoord(MSG_ENTITY, floor(self.origin.y)); diff --git a/qcsrc/server/g_hook.qc b/qcsrc/server/g_hook.qc index f95115a2c..b3e8ec985 100644 --- a/qcsrc/server/g_hook.qc +++ b/qcsrc/server/g_hook.qc @@ -106,7 +106,7 @@ void GrapplingHook_Stop() .vector hook_start, hook_end; bool GrapplingHookSend(entity this, entity to, int sf) { - WriteByte(MSG_ENTITY, ENT_CLIENT_HOOK); + WriteHeader(MSG_ENTITY, ENT_CLIENT_HOOK); sf = sf & 0x7F; if(sound_allowed(MSG_BROADCAST, self.realowner)) sf |= 0x80; diff --git a/qcsrc/server/g_models.qc b/qcsrc/server/g_models.qc index eecb046b6..5a361a7a8 100644 --- a/qcsrc/server/g_models.qc +++ b/qcsrc/server/g_models.qc @@ -90,7 +90,7 @@ bool g_clientmodel_genericsendentity(entity this, entity to, int sf) if(self.lodmodelindex1) sf |= 0x80; - WriteByte(MSG_ENTITY, ENT_CLIENT_WALL); + WriteHeader(MSG_ENTITY, ENT_CLIENT_WALL); WriteByte(MSG_ENTITY, sf); if(sf & BIT(0)) diff --git a/qcsrc/server/g_violence.qc b/qcsrc/server/g_violence.qc index d59c4b4da..688fa1d19 100644 --- a/qcsrc/server/g_violence.qc +++ b/qcsrc/server/g_violence.qc @@ -2,7 +2,7 @@ .int state; -REGISTER_NET_TEMP(net_gibsplash, bool isNew) +REGISTER_NET_TEMP(net_gibsplash) bool Violence_GibSplash_SendEntity(entity this, entity to, int sf) { diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 25220f3af..bfeebf576 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -54,8 +54,7 @@ void PingPLReport_Think() e = edict_num(self.cnt + 1); if(IS_REAL_CLIENT(e)) { - WriteByte(MSG_BROADCAST, SVC_TEMPENTITY); - WriteByte(MSG_BROADCAST, TE_CSQC_PINGPLREPORT); + WriteHeader(MSG_BROADCAST, TE_CSQC_PINGPLREPORT); WriteByte(MSG_BROADCAST, self.cnt); WriteShort(MSG_BROADCAST, max(1, e.ping)); WriteByte(MSG_BROADCAST, ceil(e.ping_packetloss * 255)); @@ -72,8 +71,7 @@ void PingPLReport_Think() } else { - WriteByte(MSG_BROADCAST, SVC_TEMPENTITY); - WriteByte(MSG_BROADCAST, TE_CSQC_PINGPLREPORT); + WriteHeader(MSG_BROADCAST, TE_CSQC_PINGPLREPORT); WriteByte(MSG_BROADCAST, self.cnt); WriteShort(MSG_BROADCAST, 0); WriteByte(MSG_BROADCAST, 0); @@ -515,7 +513,7 @@ void detect_maptype() entity randomseed; bool RandomSeed_Send(entity this, entity to, int sf) { - WriteByte(MSG_ENTITY, ENT_CLIENT_RANDOMSEED); + WriteHeader(MSG_ENTITY, ENT_CLIENT_RANDOMSEED); WriteShort(MSG_ENTITY, self.cnt); return true; } diff --git a/qcsrc/server/generator.qc b/qcsrc/server/generator.qc index 2a1c0b2f8..e6c746a75 100644 --- a/qcsrc/server/generator.qc +++ b/qcsrc/server/generator.qc @@ -2,7 +2,7 @@ bool generator_send(entity this, entity to, int sf) { - WriteByte(MSG_ENTITY, ENT_CLIENT_GENERATOR); + WriteHeader(MSG_ENTITY, ENT_CLIENT_GENERATOR); WriteByte(MSG_ENTITY, sf); if(sf & GSF_SETUP) { diff --git a/qcsrc/server/mapvoting.qc b/qcsrc/server/mapvoting.qc index 5a9f7e076..ed17d86e8 100644 --- a/qcsrc/server/mapvoting.qc +++ b/qcsrc/server/mapvoting.qc @@ -264,8 +264,7 @@ void MapVote_Init() void MapVote_SendPicture(float id) {SELFPARAM(); msg_entity = self; - WriteByte(MSG_ONE, SVC_TEMPENTITY); - WriteByte(MSG_ONE, TE_CSQC_PICTURE); + WriteHeader(MSG_ONE, TE_CSQC_PICTURE); WriteByte(MSG_ONE, id); WritePicture(MSG_ONE, strcat(mapvote_screenshot_dirs[mapvote_maps_screenshot_dir[id]], "/", mapvote_maps[id]), 3072); } @@ -349,7 +348,7 @@ bool MapVote_SendEntity(entity this, entity to, int sf) if(sf & 1) sf &= ~2; // if we send 1, we don't need to also send 2 - WriteByte(MSG_ENTITY, ENT_CLIENT_MAPVOTE); + WriteHeader(MSG_ENTITY, ENT_CLIENT_MAPVOTE); WriteByte(MSG_ENTITY, sf); if(sf & 1) diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index a21864f07..cb7c66f02 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -1158,7 +1158,7 @@ bool EliminatedPlayers_SendEntity(entity this, entity to, float sendflags) { float i, f, b; entity e; - WriteByte(MSG_ENTITY, ENT_CLIENT_ELIMINATEDPLAYERS); + WriteHeader(MSG_ENTITY, ENT_CLIENT_ELIMINATEDPLAYERS); WriteByte(MSG_ENTITY, sendflags); if(sendflags & 1) @@ -1603,7 +1603,7 @@ vector gettaginfo_relative(entity e, float tag) bool modeleffect_SendEntity(entity this, entity to, int sf) { float f; - WriteByte(MSG_ENTITY, ENT_CLIENT_MODELEFFECT); + WriteHeader(MSG_ENTITY, ENT_CLIENT_MODELEFFECT); f = 0; if(self.velocity != '0 0 0') diff --git a/qcsrc/server/mutators/mutator/gamemode_onslaught.qc b/qcsrc/server/mutators/mutator/gamemode_onslaught.qc index bd4bb7af6..aa9969a11 100644 --- a/qcsrc/server/mutators/mutator/gamemode_onslaught.qc +++ b/qcsrc/server/mutators/mutator/gamemode_onslaught.qc @@ -384,7 +384,7 @@ void onslaught_updatelinks() bool ons_Link_Send(entity this, entity to, int sendflags) { - WriteByte(MSG_ENTITY, ENT_CLIENT_RADARLINK); + WriteHeader(MSG_ENTITY, ENT_CLIENT_RADARLINK); WriteByte(MSG_ENTITY, sendflags); if(sendflags & 1) { diff --git a/qcsrc/server/race.qc b/qcsrc/server/race.qc index fe7606a39..3d6e9e85e 100644 --- a/qcsrc/server/race.qc +++ b/qcsrc/server/race.qc @@ -165,8 +165,7 @@ void race_SendNextCheckpoint(entity e, float spec) // qualifying only if(!spec) msg_entity = e; WRITESPECTATABLE_MSG_ONE({ - WriteByte(MSG_ONE, SVC_TEMPENTITY); - WriteByte(MSG_ONE, TE_CSQC_RACE); + WriteHeader(MSG_ONE, TE_CSQC_RACE); if(spec) { WriteByte(MSG_ONE, RACE_NET_CHECKPOINT_NEXT_SPEC_QUALIFYING); @@ -184,8 +183,7 @@ void race_SendNextCheckpoint(entity e, float spec) // qualifying only void race_send_recordtime(float msg) { // send the server best time - WriteByte(msg, SVC_TEMPENTITY); - WriteByte(msg, TE_CSQC_RACE); + WriteHeader(msg, TE_CSQC_RACE); WriteByte(msg, RACE_NET_SERVER_RECORD); WriteInt24_t(msg, race_readTime(GetMapname(), 1)); } @@ -194,8 +192,7 @@ void race_send_recordtime(float msg) void race_send_speedaward(float msg) { // send the best speed of the round - WriteByte(msg, SVC_TEMPENTITY); - WriteByte(msg, TE_CSQC_RACE); + WriteHeader(msg, TE_CSQC_RACE); WriteByte(msg, RACE_NET_SPEED_AWARD); WriteInt24_t(msg, floor(speedaward_speed+0.5)); WriteString(msg, speedaward_holder); @@ -204,8 +201,7 @@ void race_send_speedaward(float msg) void race_send_speedaward_alltimebest(float msg) { // send the best speed - WriteByte(msg, SVC_TEMPENTITY); - WriteByte(msg, TE_CSQC_RACE); + WriteHeader(msg, TE_CSQC_RACE); WriteByte(msg, RACE_NET_SPEED_AWARD_BEST); WriteInt24_t(msg, floor(speedaward_alltimebest+0.5)); WriteString(msg, speedaward_alltimebest_holder); @@ -213,8 +209,7 @@ void race_send_speedaward_alltimebest(float msg) void race_SendRankings(float pos, float prevpos, float del, float msg) { - WriteByte(msg, SVC_TEMPENTITY); - WriteByte(msg, TE_CSQC_RACE); + WriteHeader(msg, TE_CSQC_RACE); WriteByte(msg, RACE_NET_SERVER_RANKINGS); WriteShort(msg, pos); WriteShort(msg, prevpos); @@ -235,8 +230,7 @@ void race_SendStatus(float id, entity e) msg = MSG_ALL; msg_entity = e; WRITESPECTATABLE_MSG_ONE_VARNAME(dummy3, { - WriteByte(msg, SVC_TEMPENTITY); - WriteByte(msg, TE_CSQC_RACE); + WriteHeader(msg, TE_CSQC_RACE); WriteByte(msg, RACE_NET_SERVER_STATUS); WriteShort(msg, id); WriteString(msg, e.netname); @@ -447,8 +441,7 @@ void race_SendTime(entity e, float cp, float t, float tvalid) if(g_race_qualifying) { WRITESPECTATABLE_MSG_ONE_VARNAME(dummy1, { - WriteByte(MSG_ONE, SVC_TEMPENTITY); - WriteByte(MSG_ONE, TE_CSQC_RACE); + WriteHeader(MSG_ONE, TE_CSQC_RACE); WriteByte(MSG_ONE, RACE_NET_CHECKPOINT_HIT_QUALIFYING); WriteByte(MSG_ONE, race_CheckpointNetworkID(cp)); // checkpoint the player now is at WriteInt24_t(MSG_ONE, t); // time to that intermediate @@ -476,8 +469,7 @@ void race_SendTime(entity e, float cp, float t, float tvalid) { msg_entity = e; WRITESPECTATABLE_MSG_ONE_VARNAME(dummy2, { - WriteByte(MSG_ONE, SVC_TEMPENTITY); - WriteByte(MSG_ONE, TE_CSQC_RACE); + WriteHeader(MSG_ONE, TE_CSQC_RACE); WriteByte(MSG_ONE, RACE_NET_CHECKPOINT_HIT_RACE); WriteByte(MSG_ONE, race_CheckpointNetworkID(cp)); // checkpoint the player now is at if(e == oth) @@ -503,8 +495,7 @@ void race_SendTime(entity e, float cp, float t, float tvalid) { msg_entity = oth; WRITESPECTATABLE_MSG_ONE_VARNAME(dummy3, { - WriteByte(MSG_ONE, SVC_TEMPENTITY); - WriteByte(MSG_ONE, TE_CSQC_RACE); + WriteHeader(MSG_ONE, TE_CSQC_RACE); WriteByte(MSG_ONE, RACE_NET_CHECKPOINT_HIT_RACE_BY_OPPONENT); WriteByte(MSG_ONE, race_CheckpointNetworkID(cp)); // checkpoint the player now is at if(e == oth) @@ -537,8 +528,7 @@ void race_ClearTime(entity e) msg_entity = e; WRITESPECTATABLE_MSG_ONE({ - WriteByte(MSG_ONE, SVC_TEMPENTITY); - WriteByte(MSG_ONE, TE_CSQC_RACE); + WriteHeader(MSG_ONE, TE_CSQC_RACE); WriteByte(MSG_ONE, RACE_NET_CHECKPOINT_CLEAR); // next }); } @@ -1100,8 +1090,7 @@ void race_ImposePenaltyTime(entity pl, float penalty, string reason) { msg_entity = pl; WRITESPECTATABLE_MSG_ONE({ - WriteByte(MSG_ONE, SVC_TEMPENTITY); - WriteByte(MSG_ONE, TE_CSQC_RACE); + WriteHeader(MSG_ONE, TE_CSQC_RACE); WriteByte(MSG_ONE, RACE_NET_PENALTY_QUALIFYING); WriteShort(MSG_ONE, TIME_ENCODE(penalty)); WriteString(MSG_ONE, reason); @@ -1115,8 +1104,7 @@ void race_ImposePenaltyTime(entity pl, float penalty, string reason) { msg_entity = pl; WRITESPECTATABLE_MSG_ONE_VARNAME(dummy, { - WriteByte(MSG_ONE, SVC_TEMPENTITY); - WriteByte(MSG_ONE, TE_CSQC_RACE); + WriteHeader(MSG_ONE, TE_CSQC_RACE); WriteByte(MSG_ONE, RACE_NET_PENALTY_RACE); WriteShort(MSG_ONE, TIME_ENCODE(penalty)); WriteString(MSG_ONE, reason); diff --git a/qcsrc/server/scores.qc b/qcsrc/server/scores.qc index 8e4ae3040..356b03ccd 100644 --- a/qcsrc/server/scores.qc +++ b/qcsrc/server/scores.qc @@ -58,7 +58,7 @@ bool TeamScore_SendEntity(entity this, entity to, float sendflags) { float i, p, longflags; - WriteByte(MSG_ENTITY, ENT_CLIENT_TEAMSCORES); + WriteHeader(MSG_ENTITY, ENT_CLIENT_TEAMSCORES); WriteByte(MSG_ENTITY, self.team - 1); longflags = 0; @@ -187,7 +187,7 @@ void ScoreInfo_SetLabel_TeamScore(float i, string label, float scoreflags) bool ScoreInfo_SendEntity(entity this, entity to, int sf) { float i; - WriteByte(MSG_ENTITY, ENT_CLIENT_SCORES_INFO); + WriteHeader(MSG_ENTITY, ENT_CLIENT_SCORES_INFO); WriteInt24_t(MSG_ENTITY, MapInfo_LoadedGametype); for(i = 0; i < MAX_SCORE; ++i) { @@ -232,7 +232,7 @@ bool PlayerScore_SendEntity(entity this, entity to, float sendflags) { float i, p, longflags; - WriteByte(MSG_ENTITY, ENT_CLIENT_SCORES); + WriteHeader(MSG_ENTITY, ENT_CLIENT_SCORES); WriteByte(MSG_ENTITY, num_for_edict(self.owner)); longflags = 0; diff --git a/qcsrc/server/spawnpoints.qc b/qcsrc/server/spawnpoints.qc index ecd7497d9..36b08008e 100644 --- a/qcsrc/server/spawnpoints.qc +++ b/qcsrc/server/spawnpoints.qc @@ -12,7 +12,7 @@ bool SpawnPoint_Send(entity this, entity to, int sf) { - WriteByte(MSG_ENTITY, ENT_CLIENT_SPAWNPOINT); + WriteHeader(MSG_ENTITY, ENT_CLIENT_SPAWNPOINT); WriteByte(MSG_ENTITY, self.team); WriteShort(MSG_ENTITY, self.origin.x); @@ -26,7 +26,7 @@ bool SpawnEvent_Send(entity this, entity to, int sf) { float send; - WriteByte(MSG_ENTITY, ENT_CLIENT_SPAWNEVENT); + WriteHeader(MSG_ENTITY, ENT_CLIENT_SPAWNEVENT); if(autocvar_g_spawn_alloweffects) { diff --git a/qcsrc/server/t_items.qc b/qcsrc/server/t_items.qc index c2088a984..5174943c6 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -252,7 +252,7 @@ bool ItemSend(entity this, entity to, int sf) else sf &= ~ISF_DROP; - WriteByte(MSG_ENTITY, ENT_CLIENT_ITEM); + WriteHeader(MSG_ENTITY, ENT_CLIENT_ITEM); WriteByte(MSG_ENTITY, sf); //WriteByte(MSG_ENTITY, self.cnt); diff --git a/qcsrc/server/weapons/accuracy.qc b/qcsrc/server/weapons/accuracy.qc index 019bcda49..211ef8cec 100644 --- a/qcsrc/server/weapons/accuracy.qc +++ b/qcsrc/server/weapons/accuracy.qc @@ -15,7 +15,7 @@ int accuracy_byte(float n, float d) bool accuracy_send(entity this, entity to, int sf) { - WriteByte(MSG_ENTITY, ENT_CLIENT_ACCURACY); + WriteHeader(MSG_ENTITY, ENT_CLIENT_ACCURACY); entity a = this.owner; if (IS_SPEC(a)) a = a.enemy; diff --git a/qcsrc/server/weapons/csqcprojectile.qc b/qcsrc/server/weapons/csqcprojectile.qc index 1e254b804..dfee55136 100644 --- a/qcsrc/server/weapons/csqcprojectile.qc +++ b/qcsrc/server/weapons/csqcprojectile.qc @@ -34,7 +34,7 @@ bool CSQCProjectile_SendEntity(entity this, entity to, int sf) if(self.gravity != 0) sf |= 0x10; - WriteByte(MSG_ENTITY, ENT_CLIENT_PROJECTILE); + WriteHeader(MSG_ENTITY, ENT_CLIENT_PROJECTILE); WriteByte(MSG_ENTITY, sf); if(sf & 1) diff --git a/qcsrc/server/weapons/selection.qc b/qcsrc/server/weapons/selection.qc index b7eb2fe09..48a2d966e 100644 --- a/qcsrc/server/weapons/selection.qc +++ b/qcsrc/server/weapons/selection.qc @@ -12,8 +12,7 @@ void Send_WeaponComplain(entity e, float wpn, float type) { msg_entity = e; - WriteByte(MSG_ONE, SVC_TEMPENTITY); - WriteByte(MSG_ONE, TE_CSQC_WEAPONCOMPLAIN); + WriteHeader(MSG_ONE, TE_CSQC_WEAPONCOMPLAIN); WriteByte(MSG_ONE, wpn); WriteByte(MSG_ONE, type); }