]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Net: register all types
authorTimePath <andrew.hardaker1995@gmail.com>
Wed, 4 Nov 2015 09:25:42 +0000 (20:25 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Wed, 4 Nov 2015 09:51:20 +0000 (20:51 +1100)
69 files changed:
qcsrc/client/defs.qh
qcsrc/client/effects.qc
qcsrc/client/gibs.qc
qcsrc/client/hook.qc
qcsrc/client/hook.qh
qcsrc/client/main.qc
qcsrc/client/mapvoting.qc
qcsrc/client/mutators/events.qh
qcsrc/client/particles.qc
qcsrc/common/constants.qh
qcsrc/common/debug.qh
qcsrc/common/effects/all.qc
qcsrc/common/items/inventory.qh
qcsrc/common/minigames/sv_minigames.qc
qcsrc/common/mutators/mutator/casings.qc
qcsrc/common/mutators/mutator/damagetext.qc
qcsrc/common/mutators/mutator/itemstime.qc
qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc
qcsrc/common/nades/all.qc
qcsrc/common/net_notice.qc
qcsrc/common/notifications.qc
qcsrc/common/triggers/func/conveyor.qc
qcsrc/common/triggers/func/door.qc
qcsrc/common/triggers/func/ladder.qc
qcsrc/common/triggers/func/plat.qc
qcsrc/common/triggers/func/pointparticles.qc
qcsrc/common/triggers/func/rainsnow.qc
qcsrc/common/triggers/func/train.qc
qcsrc/common/triggers/misc/corner.qc
qcsrc/common/triggers/misc/laser.qc
qcsrc/common/triggers/target/music.qc
qcsrc/common/triggers/trigger/impulse.qc
qcsrc/common/triggers/trigger/jumppads.qc
qcsrc/common/triggers/trigger/keylock.qc
qcsrc/common/triggers/trigger/swamp.qc
qcsrc/common/triggers/trigger/viewloc.qc
qcsrc/common/turrets/sv_turrets.qc
qcsrc/common/util.qh
qcsrc/common/vehicles/cl_vehicles.qc
qcsrc/common/vehicles/sv_vehicles.qc
qcsrc/common/vehicles/vehicle/bumblebee_weapons.qc
qcsrc/common/weapons/weapon/arc.qc
qcsrc/common/weapons/weapon/shockwave.qc
qcsrc/common/weapons/weapon/tuba.qc
qcsrc/common/weapons/weapon/vortex.qc
qcsrc/lib/csqcmodel/sv_model.qc
qcsrc/lib/net.qh
qcsrc/lib/warpzone/server.qc
qcsrc/server/cl_client.qc
qcsrc/server/command/vote.qc
qcsrc/server/controlpoint.qc
qcsrc/server/csqceffects.qc
qcsrc/server/ent_cs.qc
qcsrc/server/g_damage.qc
qcsrc/server/g_hook.qc
qcsrc/server/g_models.qc
qcsrc/server/g_violence.qc
qcsrc/server/g_world.qc
qcsrc/server/generator.qc
qcsrc/server/mapvoting.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/mutators/mutator/gamemode_onslaught.qc
qcsrc/server/race.qc
qcsrc/server/scores.qc
qcsrc/server/spawnpoints.qc
qcsrc/server/t_items.qc
qcsrc/server/weapons/accuracy.qc
qcsrc/server/weapons/csqcprojectile.qc
qcsrc/server/weapons/selection.qc

index 6325a8ab3c6651481938e9999f23ecc5f63aae5c..98f25cc9037772d9d3a158407109af1fb63e7fe1 100644 (file)
@@ -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;
 
index 21fa1ce037137e187a35bd29ed70e42b0eb757e2..348c62c466d6bab47c376e4db63ba47fea0e4ac5 100644 (file)
@@ -98,3 +98,8 @@ void Net_ReadLightningarc()
 
 }
 void Net_ReadArc() { Net_ReadLightningarc(); }
+NET_HANDLE(TE_CSQC_ARC, bool isNew)
+{
+       Net_ReadArc();
+       return true;
+}
index 73d7f04968e9a5ff44c88efb8402d7a8994d71b3..675cd40c5efb5dfd6bd77babc1b48954b3a80bc3 100644 (file)
@@ -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
index eb5cc8dd1e3a7cb4700048ae7cc8db2cfbc46fbe..452189a1584c9cf60f91170e10c53c86365a39f0 100644 (file)
@@ -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;
                }
index 9e6ee548cfab5ae0a97a169b213c9596d497ff85..29fd983043773a5f433ca1b0fe975ee5ec5aeaf3 100644 (file)
@@ -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
index 6be7fa0474e2a158379fe6bbdf58f494995d2660..5ffa01e142ede845310abcb71d596bb3749c7df8 100644 (file)
@@ -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)
index 20ff100580faf5ef32f720dc4c8f0394feb996e1..1acfa8042c11c0a23ac84771570607ea42965aee 100644 (file)
@@ -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();
index 2fbeaaa7c15299b35ecf853ac4bfb137c8e0fd58..92f4558163156d02df204aa3a87648e66f8b7db3 100644 (file)
@@ -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) \
index 9fcc4bd53b77c82af422bc84654b88499d9bdc71..4c9ff2011ffb91e4d1c52821c610c0caf951093e 100644 (file)
@@ -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;
+}
index b0878773463fd3c6575d93258d7525d4bc981f92..8450fe964c967b912f4897e40e7edc7825648456 100644 (file)
@@ -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;
index 0016492a7a574230ca742516c81de6c36ebaf1e0..7301489f32093d0c34232bb32fc0b30a6adb4cb8 100644 (file)
@@ -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
 
index bc739192245ce8beadc88a30fec8a04d3811bc19..347a2111b563f4ebdb4e18de5e561ed1eb956306 100644 (file)
@@ -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
 
index ead573915e1ed8cbacb82af35286b8e67d681f4a..307d60ec0ab5b045dc6f524ab66e23a23e9d451f 100644 (file)
@@ -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;
index 403a79d4090314e1f05508adaa67fc02d7494cdf..73e2a2bb1d1567d1d13b208ac81731797b1cd2c5 100644 (file)
@@ -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 )
index 5400030b428c4ebe542240ac793ce2bd9e320c87..2ad32cf32801d059f57e4bb774dac41071f84731 100644 (file)
@@ -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;
 
index f6e9d5a471bf4440e2ad14ad1fd6ddc12cca0375..ac451ca54a411b2fb8e2d047ebc3c4c8aa4d4c87 100644 (file)
@@ -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
 
index 5dc9fba674d06eaf46576ce326d72de15c461f7c..d6b256af3ccd349a9c42f67c286d791ccb78b911 100644 (file)
@@ -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
 
index 54eec3c9afa721095767f64ae14bfaa30f8f0f64..7fa9181f2060f7b659e1e7e0b5bb00948706f5e3 100644 (file)
@@ -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;
 }
index d56f2805fccceaace94d6d37e2d02a54a84da941..7dfae12ac432b692ce17b2cfe9e1323cf7c1f593 100644 (file)
@@ -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
 
index 317eec1094ebafa189b35575bab5d693f18779fa..b409ecd5ff3ffb110e1b875622b6e38d37a655cb 100644 (file)
@@ -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;
index c46988dddecbd2ffde3d9f10e589af1c485d9522..b5624f5068791ee291d5dd1f774023173051a25a 100644 (file)
@@ -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]); }
index 73f22b99b69a7a8129b767597c62772cea0c6a1b..a8dfafc874299f81758e7671f276d581da325490 100644 (file)
@@ -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)
index e2d12281680c236888ecda11f3fe47e5fe4decab..6eaf2547b9f77627682e02db932349fc80da2544 100644 (file)
@@ -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)
index c27dd2ce08604e576c642d855d03fbbc2af67a67..b33de95f11b8e684d08aa3971009432814d240d5 100644 (file)
@@ -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);
index fc62341a85a3a09b65b158d09d6e4d2fce92cf40..30d3d5681b63e64a000bf11589bcbc56a86e58e3 100644 (file)
@@ -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)
index 3b37f0f76f4489f9c2869e83a0bf1e5779d437ab..d82232d6d2333f3d12a72bd1740aa8d4512cfe01 100644 (file)
@@ -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;
index 18c2c0a0fb91c9cb9adecb5fc5bb5a253530e93b..91dc8bad6afdbba97de195cf3fe75fde12805dc3 100644 (file)
@@ -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);
index 65414548b2e27f3926e41d5d4c3ad6416db7c568..45480686a5164358d5b04ba2645443b117cbe085 100644 (file)
@@ -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)
index ccac77b6c9c402b7340c68ad12263531a066a486..38dd8f5865212794e429f2d55882df6236a62790 100644 (file)
@@ -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);
 
index e1c9cafb058b13830daa095668337178621f7217..29a18562688a9d4e44a154436abcb6277828e952 100644 (file)
@@ -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;
index ebecb18e317e3da64b8999a4624914722d298a0a..c2014bf95ba0bbe515ef14cf5b591a7fc8314887 100644 (file)
@@ -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)
index c40fed3a8387bc1da25a54f180de0efdafa3c197..977821d44d7689b37b8cc3f3d9788ee104a7d90c 100644 (file)
@@ -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);
index 67659034afea854e158e3221021bc657129aeb1f..817b50e46662c80e8e908e7b3c30b7117ddeee6c 100644 (file)
@@ -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);
index 8cef73c7ae500b241c3b2e3fc74ee5b5fe7ea6ed..fe33e790655cc18b867e31219527f1cfcacea01c 100644 (file)
@@ -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);
index a906fcd313d53f21eaac86df915fd429bf418491..c50dc1090c3a7c5e95b72459e5c9ae7b67d72020 100644 (file)
@@ -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);
index c21fe6b5484b2e935fabe09ebf0d0282bbe9665b..cd950a4068352060477ad7b93304de4f96cd2ac4 100644 (file)
@@ -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);
 
index 33e41cd497f982e2bc15e0564b47498ce8d1b8bb..9ab9a32118c7e81e70c8daff361741c38473ab15 100644 (file)
@@ -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)
        {
index 5c48e42a8a62d1235bd6e4385fce4f19d1bb9e1f..fac4269d7d2489f4991998ff82aec6e2bf6cd4d3 100644 (file)
@@ -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
index b24097c03303a11f7fa30168c155c4214b8a6999..ff8e7c58d6d62f2b46c8773b9e7151ab20c1e531 100644 (file)
@@ -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();
index eb13fae3924c154d698d94919edb6c5019de3161..7f0537eeb502583fdcdd16ab8ebb74e423e9a359 100644 (file)
@@ -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);
 }
 
index d58e88701e5c41ac8c911cee3667a02bf892a486..944dc53a52593f6f9921ad825e97dccccb22c678 100644 (file)
@@ -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)
index 031fe679d531e6deff7d652c60a6ad62a16e7f44..101029fe3dc2ebde5fed432f5538eacc95b31a6d 100644 (file)
@@ -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,
index 49737537b04ffb23842567e09fe84eb00afd3411..171bf091f750f8c0f5ab1b64c56a9c98516b7b94 100644 (file)
@@ -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;
index 130edaaf58bef62debd1a9dc3e66b9804b1c0e1d..851f9fcdf2ad4cdc7238b1bfc96ee56083bba98a 100644 (file)
@@ -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)
        {
index 5a64accc9c68899192a0b6a1ba3e051993c7113d..705bf66443bbffbde919e40177c5d1288e87038d 100644 (file)
@@ -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);
index 8fcdcfbee675d4e0a399dc3e95eb12f291fa8114..012149887fb5bd4f0a1f356791c7945b1a33ef9a 100644 (file)
@@ -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) {
index 35d5b38530fce4b929f50b182e988359955a2771..0acba4e66c06287277ab359d583070295322a1b6 100644 (file)
@@ -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__; \
                { \
                        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)) \
                { \
@@ -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
 
index ec109dad9ede37e953ec75de5e111729bbd439a3..268a8aadda2b1f84e0e138e1fcceff1d04bf9bd5 100644 (file)
@@ -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);
index a8d59fde17656cb6d896a2cdd7d7f598f20fe24e..462d42722697c889e463c75ea7764e23c2320d07 100644 (file)
@@ -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]));
index d7c8298719506139b476140f7f93df4cf1eec717..dd131f3a6410bee532d5fa4ad265fb59f8b12f96 100644 (file)
@@ -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
index ceeb4f185b3fd846af054373f3c70ae5e7aa7c93..74494b7ee9c400e61562c83e0782cf6df97df643 100644 (file)
@@ -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)
        {
index a26fa97aa8da334189dbc6c4e79e97416da6780c..248d885366d266e01af6e7bf8d217f6d696b6fad 100644 (file)
@@ -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);
index f69ea7a67022d781583bd76d17091c32aceb0386..9c98e7d99f2ed32ccf7dc631f204bd6ebf3bcfe8 100644 (file)
@@ -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);
index efd59e940ba9dbf2a38064aacbba42cd9863a2d3..343be952ca39fa97bfd0b8e20dda2103781eaa94 100644 (file)
@@ -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));
index f95115a2ca465a8f8fbe01679da18eed973229a6..b3e8ec985394b951f7acd4017625b776ca0c8ced 100644 (file)
@@ -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;
index eecb046b63f9974ae3c6ec7177835fc2981a1848..5a361a7a86fa19c858cc9fb0f00514ef11aef804 100644 (file)
@@ -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))
index d59c4b4da9587b94022598ae77382f2e7815cce1..688fa1d1970418359782b7af91d6f8fc0a59e507 100644 (file)
@@ -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)
 {
index 25220f3aff1e62fc873718048cdb62edff4f13e3..bfeebf5762d6caf49ac9eaed7f2be7c00c0bdc25 100644 (file)
@@ -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;
 }
index 2a1c0b2f861ab34b1035e0087880e97d67c5849c..e6c746a751c747da906b3673a9a0ed4ff5256dc2 100644 (file)
@@ -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)
        {
index 5a9f7e0765c85e5a66e6d4ada2da8048b02fd597..ed17d86e8e2a26ddc97cf47bde011cbc65649766 100644 (file)
@@ -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)
index a21864f07ec57a2c352b4f3b2afba6ae37cf17c7..cb7c66f02125d59a46fa37622668c7b0c88ca5ae 100644 (file)
@@ -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')
index bd4bb7af6a1a3bec5878ed6c5458067b91733034..aa9969a115d277e97438d29c464fa26cfdd5d94d 100644 (file)
@@ -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)
        {
index fe7606a39ba1ebba3dbe87b009a8ded4669289b5..3d6e9e85e80eacdfd3bf2371af6dcdcbf46a5afb 100644 (file)
@@ -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);
index 8e4ae304033dcf93f22ccb0314d62bbd0dd88959..356b03ccdc03c5dc3cc52fbc91b36bf6f6560e90 100644 (file)
@@ -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;
index ecd7497d998bb66dec3572d0b0790f926b8220a5..36b08008e8b7dedfa643c1b931a60187c18a7e82 100644 (file)
@@ -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)
        {
index c2088a9844ff72504c958cf83bae1b33a5c724ac..5174943c61d01ca606175a072f26b319938c9074 100644 (file)
@@ -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);
index 019bcda4958ac006b1766f2fd9a0a1eab5dec7f3..211ef8cec090682aeaf040286f54018f8ff27376 100644 (file)
@@ -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;
index 1e254b804e13e2b2c28bc73db985d237ba733a79..dfee551368a4863a3718d60d7ca7fa090a0db19c 100644 (file)
@@ -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)
index b7eb2fe097e0e169d3cf6a1f9177c0292701dc6c..48a2d966e7bfe6ebe7932acffecedd240acd80dd 100644 (file)
@@ -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);
 }