Merge branch 'master' into Mario/entcs
authorMario <mario@smbclan.net>
Sun, 21 Aug 2016 08:01:06 +0000 (18:01 +1000)
committerMario <mario@smbclan.net>
Sun, 21 Aug 2016 08:01:06 +0000 (18:01 +1000)
14 files changed:
qcsrc/client/_all.qh
qcsrc/client/csqcmodel_hooks.qc
qcsrc/client/hud/hud.qc
qcsrc/client/hud/hud.qh
qcsrc/client/hud/panel/scoreboard.qc
qcsrc/client/view.qc
qcsrc/common/ent_cs.qc
qcsrc/common/ent_cs.qh
qcsrc/common/weapons/weapon/arc.qc
qcsrc/common/weapons/weapon/vaporizer.qc
qcsrc/dpdefs/post.qh
qcsrc/dpdefs/pre.qh
qcsrc/server/teamplay.qc
qcsrc/server/teamplay.qh

index 5e5b55e313ae38a9355221fb79aabcb8401c429e..077b5f450a5ff2eee4b0ca4dd52a5aee382c77ee 100644 (file)
@@ -11,3 +11,5 @@
 #include "defs.qh"
 #include "main.qh"
 #include "miscfunctions.qh"
+
+#include <common/ent_cs.qh>
index d6ee5f8f79add97bf2dfded05615e01788260bab..0643bb09d5b37e3bdd7b014f13964959ab837484 100644 (file)
@@ -3,6 +3,7 @@
 #include "player_skeleton.qh"
 #include "weapons/projectile.qh"
 #include <common/animdecide.qh>
+#include <common/ent_cs.qh>
 #include <common/physics/movetypes/movetypes.qh>
 #include <common/viewloc.qh>
 #include <lib/csqcmodel/cl_model.qh>
@@ -192,7 +193,7 @@ void CSQCPlayer_ModelAppearance_Apply(entity this, bool islocalplayer)
        bool isfriend;
        int cm;
        cm = this.forceplayermodels_savecolormap;
-       cm = (cm >= 1024) ? cm : (stof(getplayerkeyvalue(cm - 1, "colors")) + 1024);
+       cm = (cm >= 1024) ? cm : (entcs_GetClientColors(cm - 1) + 1024);
 
        if(teamplay)
                isfriend = (cm == 1024 + 17 * myteam);
@@ -279,7 +280,7 @@ void CSQCPlayer_ModelAppearance_Apply(entity this, bool islocalplayer)
 
        // GLOWMOD AND DEATH FADING
        if(this.colormap > 0)
-               this.glowmod = colormapPaletteColor(((this.colormap >= 1024) ? this.colormap : stof(getplayerkeyvalue(this.colormap - 1, "colors"))) & 0x0F, true) * 2;
+               this.glowmod = colormapPaletteColor(((this.colormap >= 1024) ? this.colormap : entcs_GetClientColors(this.colormap - 1)) & 0x0F, true) * 2;
        else
                this.glowmod = '1 1 1';
 
index 91dc98fdcb2c32f7efa917bafd3b8912c1574644..f9ac20627518e16b4fbcec3b225b8540a6908e21 100644 (file)
@@ -559,11 +559,11 @@ void HUD_Main()
                {
                        string hud_dock_color = autocvar_hud_dock_color;
                        if(hud_dock_color == "shirt") {
-                               f = stof(getplayerkeyvalue(current_player, "colors"));
+                               f = entcs_GetClientColors(current_player);
                                color = colormapPaletteColor(floor(f / 16), 0);
                        }
                        else if(hud_dock_color == "pants") {
-                               f = stof(getplayerkeyvalue(current_player, "colors"));
+                               f = entcs_GetClientColors(current_player);
                                color = colormapPaletteColor(f % 16, 1);
                        }
                        else
index 7ee177524bea40d90eb5c547183ddba56a7859a4..3aa5d8f8c9071996445568e3d33f0621ba61f27d 100644 (file)
@@ -280,9 +280,9 @@ REGISTER_HUD_PANEL(SCOREBOARD,      Scoreboard_Draw,    scoreboard,     PANEL_CO
                        panel_bg_color = autocvar_hud_panel_bg_color;                                                           \
                } else {                                                                                                    \
                        if (panel_bg_color_str == "shirt") {                                                                    \
-                               panel_bg_color = colormapPaletteColor(floor(stof(getplayerkeyvalue(current_player, "colors")) / 16), 0); \
+                               panel_bg_color = colormapPaletteColor(floor(entcs_GetClientColors(current_player) / 16), 0); \
                        } else if (panel_bg_color_str == "pants") {                                                             \
-                               panel_bg_color = colormapPaletteColor(stof(getplayerkeyvalue(current_player, "colors")) % 16, 1); \
+                               panel_bg_color = colormapPaletteColor(entcs_GetClientColors(current_player) % 16, 1); \
                        } else {                                                                                                \
                                panel_bg_color = stov(panel_bg_color_str);                                                          \
                        }                                                                                                       \
index 9762384faa0d68aca8ae04dc0bee7ff413717a26..22be8b195c34076ec706b9f3680f14d114210605 100644 (file)
@@ -605,7 +605,7 @@ string Scoreboard_GetField(entity pl, PlayerScoreField field)
                        }
                        else if(!teamplay)
                        {
-                               f = stof(getplayerkeyvalue(pl.sv_entnum, "colors"));
+                               f = entcs_GetClientColors(pl.sv_entnum);
                                {
                                        sbt_field_icon0 = "gfx/scoreboard/playercolor_base";
                                        sbt_field_icon1 = "gfx/scoreboard/playercolor_shirt";
index c629ab30c32bdd33987f3f087f465ee88f15a56c..2226200521e27683e51cc5f640324be655ce447c 100644 (file)
@@ -293,7 +293,7 @@ void viewmodel_draw(entity this)
        else if (wasinvehicle) a = 1;
        wasinvehicle = invehicle;
        Weapon wep = activeweapon;
-       int c = stof(getplayerkeyvalue(current_player, "colors"));
+       int c = entcs_GetClientColors(current_player);
        vector g = weaponentity_glowmod(wep, c);
        entity me = CSQCModel_server2csqc(player_localentnum - 1);
        int fx = ((me.csqcmodel_effects & EFMASK_CHEAP)
index 2a7b3f80c485ef413e246028834d20ad38d8156b..41183d85b21d5c505b4becc57bba4f1df396971c 100644 (file)
        PROP(true, skin, \
        { WriteByte(chan, this.skin); }, \
        { this.skin = ReadByte(); }) \
+    \
+    PROP(true, clientcolors, \
+       { WriteByte(chan, this.clientcolors); }, \
+       { this.colormap = ReadByte(); }) \
+    \
+    PROP(true, frags, \
+       { WriteShort(chan, this.frags); }, \
+       { this.frags = ReadShort(); }) \
     \
        /**/
 
index fdaaab2d57c0f37be4345a824a3892a3fdd90e51..1dec53be65e2434a33779b62d1190f5df0f621fa 100644 (file)
@@ -58,10 +58,21 @@ REGISTER_NET_TEMP(CLIENT_ENTCS)
        /**
      * @param i zero indexed player
      */
+    .int frags;
        bool entcs_IsSpectating(int i)
        {
                bool unconnected = !playerslots[i].gotscores;
-               return unconnected || stof(getplayerkeyvalue(i, "frags")) == FRAGS_SPECTATOR;
+               entity e = entcs_receiver(i);
+               return unconnected || ((e) ? e.frags : stof(getplayerkeyvalue(i, "frags"))) == FRAGS_SPECTATOR;
+       }
+
+       /**
+     * @param i zero indexed player
+     */
+       int entcs_GetClientColors(int i)
+       {
+               entity e = entcs_receiver(i);
+               return e ? e.colormap : stof(getplayerkeyvalue(i, "colors"));
        }
 
        /**
@@ -70,7 +81,7 @@ REGISTER_NET_TEMP(CLIENT_ENTCS)
        */
        int entcs_GetTeamColor(int i)
        {
-               return (!teamplay) ? 0 : stof(getplayerkeyvalue(i, "colors")) & 15;
+               return (!teamplay) ? 0 : entcs_GetClientColors(i) & 15;
        }
 
        /**
@@ -97,7 +108,8 @@ REGISTER_NET_TEMP(CLIENT_ENTCS)
        */
        string entcs_GetName(int i)
        {
-               return ColorTranslateRGB(getplayerkeyvalue(i, "name"));
+               entity e = entcs_receiver(i);
+               return e ? ColorTranslateRGB(e.netname) : ColorTranslateRGB(getplayerkeyvalue(i, "name"));
        }
 
     /**
@@ -126,7 +138,7 @@ REGISTER_NET_TEMP(CLIENT_ENTCS)
                       ? '1 1 1'
                           : colormapPaletteColor(((e.colormap >= 1024)
                        ? e.colormap
-                       : stof(getplayerkeyvalue(e.colormap - 1, "colors"))) & 15, true)
+                       : entcs_GetClientColors(e.colormap - 1)) & 15, true)
                ;
        }
 
index 895d2c13b0b009aadbe205c7580fa72ec01fb5e3..1f8b8e7f085e7d6e6484095e3cb4a6cb279dcea5 100644 (file)
@@ -1398,7 +1398,7 @@ NET_HANDLE(ENT_CLIENT_ARC_BEAM, bool isnew)
        {
                this.beam_type = ReadByte();
 
-               vector beamcolor = ((autocvar_cl_arcbeam_teamcolor) ? colormapPaletteColor(stof(getplayerkeyvalue(this.sv_entnum - 1, "colors")) & 0x0F, true) : '1 1 1');
+               vector beamcolor = ((autocvar_cl_arcbeam_teamcolor) ? colormapPaletteColor(entcs_GetClientColors(this.sv_entnum - 1) & 0x0F, true) : '1 1 1');
                switch(this.beam_type)
                {
                        case ARC_BT_MISS:
index 91cf8e9da4353e30556ba7d520d2d1f5015c88a6..d9c215e24b9d0ca5541875eee81f3fb99331c5c2 100644 (file)
@@ -112,7 +112,7 @@ void VaporizerBeam_Draw(entity this)
        //entity e = CSQCModel_server2csqc(this.sv_entnum - 1);
        //if (e == NULL)
        //{
-               rgb = colormapPaletteColor(stof(getplayerkeyvalue(this.sv_entnum - 1, "colors")) & 0x0F, true);
+               rgb = colormapPaletteColor(entcs_GetClientColors(this.sv_entnum - 1) & 0x0F, true);
                //rgb = '1 1 1';
        //}
        //else
index 9419dceea18aafb7f8e75f1063b0ab8a3d79c523..16fd93450332e44fa0952d7003f6c50fb1fc6b03 100644 (file)
@@ -8,6 +8,7 @@
 #undef objerror
 #undef remove
 #undef walkmove
+#undef setcolor
 
 #ifdef MENUQC
        #define NULL (0, null_entity)
index 801b8731bc89bf08bdcf8d5ed52c445763986c3e..63cebbc1acd6e0cd74ece6de92ad524cbac82f1e 100644 (file)
@@ -8,3 +8,4 @@
 #define objerror builtin_objerror
 #define remove builtin_remove
 #define walkmove builtin_walkmove
+#define setcolor builtin_setcolor
index f429628b01a05d1d82541292fbeeb14aa2989cf5..de7f2f992617320717d079bd86ea8c8c68f91ed6 100644 (file)
@@ -158,6 +158,16 @@ string getwelcomemessage(entity this)
        return s;
 }
 
+void setcolor(entity this, int clr)
+{
+#if 0
+       this.clientcolors = clr;
+       this.team = (clr & 15) + 1;
+#else
+       builtin_setcolor(this, clr);
+#endif
+}
+
 void SetPlayerColors(entity pl, float _color)
 {
        /*string s;
index f34c6d59df438b491090956b2e7782153f3f7da3..127ac7a6d30caffc887e9571c40104148813eadb 100644 (file)
@@ -50,3 +50,5 @@ int JoinBestTeam(entity this, bool only_return_best, bool forcebestteam);
 //void() ctf_playerchanged;
 
 void ShufflePlayerOutOfTeam (float source_team);
+
+void setcolor(entity this, int clr);