]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Allow assigning each enemy unique colors in all game modes without teams except duel... 927/head
authorterencehill <piuntn@gmail.com>
Thu, 26 Aug 2021 16:50:20 +0000 (18:50 +0200)
committerterencehill <piuntn@gmail.com>
Thu, 26 Aug 2021 16:50:20 +0000 (18:50 +0200)
qcsrc/client/csqcmodel_hooks.qc
qcsrc/client/csqcmodel_hooks.qh
xonotic-client.cfg

index 0b38b108bdc5e8c63a57c1fb86ac300f0f80e584..0f5c919f9b02886feceb9774f9bd6f05a404d5a7 100644 (file)
@@ -279,10 +279,22 @@ void CSQCPlayer_ModelAppearance_Apply(entity this, bool islocalplayer)
                                this.colormap = forcecolor_enemy;
                }
        }
-       else
+       else // if(!teamplay)
        {
                if(autocvar_cl_forcemyplayercolors && islocalplayer)
                        this.colormap = 1024 + autocvar_cl_forcemyplayercolors;
+               else if (autocvar_cl_forceuniqueplayercolors && !islocalplayer && !ISGAMETYPE(DUEL))
+               {
+                       // Assign each enemy unique colors
+                       // pick colors from 0 to 14 since 15 is the rainbow color
+                       // pl01 0 1, pl02 1 2, ..., pl14 13 14, pl15 14 0
+                       // pl16 0 2, pl17 1 3, ..., pl29 13  0, pl30 14 1
+                       int num = this.entnum - 1;
+                       int c1 = num % 15;
+                       int q = floor(num / 15);
+                       int c2 = (c1 + 1 + q) % 15;
+                       this.colormap = 1024 + (c1 << 4) + c2;
+               }
                else if(autocvar_cl_forceplayercolors && (autocvar_cl_forceplayercolors != 3 || ISGAMETYPE(DUEL)))
                        this.colormap = player_localnum + 1;
        }
index dd10112d73634822347de0df314d3e0ff290aace..16cc29a0b06b10da56bb51174145dde8cd95df79 100644 (file)
@@ -7,6 +7,7 @@ float autocvar_cl_loddistance1 = 768;
 float autocvar_cl_loddistance2 = 2048;
 bool autocvar_cl_forceplayermodels;
 bool autocvar_cl_forceplayercolors;
+bool autocvar_cl_forceuniqueplayercolors;
 string autocvar_cl_forcemyplayermodel;
 int autocvar_cl_forcemyplayerskin;
 int autocvar_cl_forcemyplayercolors;
index 5ccf96968d677c25ab8da2c774280b2e240cf1b4..1f9bb1e5b05c41f406a006da3b0e302de9d89e81 100644 (file)
@@ -753,7 +753,8 @@ set cl_accuracy_data_receive 0 "1 receive weapon accuracy data statistics at the
 set developer_csqcentities 0 "csqc entity spam"
 
 seta cl_forceplayermodels 0 "make everyone look like your own model (requires server to have sv_defaultcharacter 0)"
-seta cl_forceplayercolors 0 "make enemies look like your own color (requires server to have sv_defaultcharacter 0); 1: in all game modes without teams, 2: even in game modes with 2 teams, 3: only in Duel"
+seta cl_forceplayercolors 0 "make enemies look like your own color (requires server to have sv_defaultcharacter 0); 1: in all game modes without teams (if cl_forceplayercolors_unique is 0), 2: even in game modes with 2 teams, 3: only in Duel"
+seta cl_forceuniqueplayercolors 0 "assign each enemy unique colors in all game modes without teams except duel (requires server to have sv_defaultcharacter 0)"
 seta cl_forcemyplayermodel "" "set to the model file name you want to show yourself as (does not affect how enemies look with cl_forceplayermodels)"
 seta cl_forcemyplayerskin 0 "set to the skin number you want to show yourself as (does not affect how enemies look with cl_forceplayermodels)"
 seta cl_forcemyplayercolors 0 "set to the color value (encoding is same as _cl_color) for your own player model (ignored in teamplay; does not affect how enemies look with cl_forceplayermodels)"