#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;
}
void Net_ReadArc() { Net_ReadLightningarc(); }
+NET_HANDLE(TE_CSQC_ARC, bool isNew)
+{
+ Net_ReadArc();
+ return true;
+}
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);
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
#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;
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;
}
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
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;
switch(self.HookType)
{
default:
- case ENT_CLIENT_HOOK:
+ case NET_ENT_CLIENT_HOOK:
intensity = 1;
offset = 0;
switch(t)
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";
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);
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!
self.drawmask = 0;
}
break;
- case ENT_CLIENT_ARC_BEAM:
+ case NET_ENT_CLIENT_ARC_BEAM:
setorigin(self, a); // beam origin!
break;
}
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;
}
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;
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;
}
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;
}
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
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
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)
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.
}
}
-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()
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()
{
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.
// 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)
MapVote_UpdateVotes();
}
+NET_HANDLE(TE_CSQC_PICTURE, bool isNew)
+{
+ Net_MapVote_Picture();
+ return true;
+}
+
void Net_MapVote_Picture()
{
int type = ReadByte();
/* 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) \
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;
+}
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;
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;
.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();
this.classname = strzone(ReadString());
this.sourceLocFile = strzone(ReadString());
this.sourceLocLine = ReadInt24_t();
+ return true;
}
#endif
#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();
WarpZone_TrailParticles(world, particleeffectnum(eff), v, vel);
else
pointparticles(eff, v, vel, eff_cnt);
+ return true;
}
#endif
#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;
// 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 )
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();
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);
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();
ang_x = ReadByte() * 360 / 256;
ang_y = ReadByte() * 360 / 256;
ang_z = ReadByte() * 360 / 256;
+ return = true;
if (!autocvar_cl_casings) return;
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 */)
(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);
#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
#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);
}
#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
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;
#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;
}
}
#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();
// this.ltime = time + this.healer_lifetime;
healer_setup(this);
}
+ return true;
}
#endif
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);
#endif // SVQC
#ifdef CSQC
+NET_HANDLE(TE_CSQC_SVNOTICE, bool isNew)
+{
+ cl_notice_read();
+ return true;
+}
void cl_notice_read()
{
//float _done;
{
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]); }
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)
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)
#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);
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)
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;
#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);
#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)
#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);
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;
// 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);
// 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;
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)
bgmtime = gettime(GETTIME_CDTRACK);
}
+NET_HANDLE(TE_CSQC_TARGET_MUSIC, bool isNew)
+{
+ Net_TargetMusic();
+ return true;
+}
+
void Net_TargetMusic()
{
int id = ReadShort();
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;
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)
#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);
#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)
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);
#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);
#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);
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);
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);
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)
{
#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
axh.draw2d = AuxiliaryXhair_Draw2D;
}
+NET_HANDLE(TE_CSQC_VEHICLESETUP, bool isNew)
+{
+ Net_VehicleSetup();
+ return true;
+}
void Net_VehicleSetup()
{SELFPARAM();
int hud_id = ReadByte();
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);
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);
}
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)
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,
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);
}
}
+NET_HANDLE(TE_CSQC_SHOCKWAVEPARTICLE, bool isNew)
+{
+ Net_ReadShockwaveParticle();
+ return true;
+}
+
void Net_ReadShockwaveParticle(void)
{
entity shockwave;
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)
{
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);
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) {
.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) \
if (this) remove(this); \
} \
while (0)
+ #define NET_HANDLE(id, param) \
+ bool Net_Handle_##id(entity this, param)
#else
#define WriteHeader(to, id) \
do \
#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__; \
{ \
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)) \
{ \
}
#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)) \
{ \
}
#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
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
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);
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;
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);
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)
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)
// 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]));
{
int nags, i, f, b;
entity e;
- WriteByte(MSG_ENTITY, ENT_CLIENT_NAGGER);
+ WriteHeader(MSG_ENTITY, ENT_CLIENT_NAGGER);
// bits:
// 1 = ready
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)
{
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);
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);
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));
.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;
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))
.int state;
-REGISTER_NET_TEMP(net_gibsplash, bool isNew)
+REGISTER_NET_TEMP(net_gibsplash)
bool Violence_GibSplash_SendEntity(entity this, entity to, int sf)
{
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));
}
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);
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;
}
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)
{
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);
}
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)
{
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)
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')
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)
{
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);
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));
}
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);
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);
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);
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);
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
{
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)
{
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)
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
});
}
{
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);
{
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);
{
float i, p, longflags;
- WriteByte(MSG_ENTITY, ENT_CLIENT_TEAMSCORES);
+ WriteHeader(MSG_ENTITY, ENT_CLIENT_TEAMSCORES);
WriteByte(MSG_ENTITY, self.team - 1);
longflags = 0;
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)
{
{
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;
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);
{
float send;
- WriteByte(MSG_ENTITY, ENT_CLIENT_SPAWNEVENT);
+ WriteHeader(MSG_ENTITY, ENT_CLIENT_SPAWNEVENT);
if(autocvar_g_spawn_alloweffects)
{
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);
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;
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)
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);
}