]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Allow enabling cl_forceplayercolors only in team games and Duel
authorterencehill <piuntn@gmail.com>
Sun, 10 Oct 2021 13:04:41 +0000 (15:04 +0200)
committerterencehill <piuntn@gmail.com>
Sun, 10 Oct 2021 13:04:41 +0000 (15:04 +0200)
qcsrc/client/csqcmodel_hooks.qc
qcsrc/menu/xonotic/dialog_settings_game_model.qc
xonotic-client.cfg

index 1d4fec3f1f2649bf1595660a4fcd00adb00d0123..252c5032dee4f7687dd5af0d3bc04e6673274393 100644 (file)
@@ -234,17 +234,35 @@ void CSQCPlayer_ModelAppearance_Apply(entity this, bool islocalplayer)
        if(MUTATOR_CALLHOOK(ForcePlayercolors_Skip, this, islocalplayer))
                goto skipforcecolors;
 
+       bool forceplayercolors_enabled = false;
+       #define fpc autocvar_cl_forceplayercolors
+       if (ISGAMETYPE(DUEL))
+       {
+               if ((myteam != NUM_SPECTATOR) && (fpc == 1 || fpc == 2 || fpc == 3 || fpc == 5))
+                       forceplayercolors_enabled = true;
+       }
+       else if (teamplay)
+       {
+               if ((team_count == 2) && (myteam != NUM_SPECTATOR) && (fpc == 2 || fpc == 4 || fpc == 5))
+                       forceplayercolors_enabled = true;
+       }
+       else
+       {
+               if (fpc == 1 || fpc == 2)
+                       forceplayercolors_enabled = true;
+       }
+
        // forceplayercolors too
        if(teamplay)
        {
                // own team's color is never forced
-               int forcecolor_friend = 0;
-               int forcecolor_enemy = 0;
+               int forcecolor_friend = 0, forcecolor_enemy = 0;
                entity tm;
 
                if(autocvar_cl_forcemyplayercolors)
                        forcecolor_friend = 1024 + autocvar_cl_forcemyplayercolors;
-               if(autocvar_cl_forceplayercolors == 2 && team_count == 2 && myteam != NUM_SPECTATOR)
+
+               if(forceplayercolors_enabled)
                        forcecolor_enemy = 1024 + autocvar__cl_color;
 
                if(forcecolor_enemy && !forcecolor_friend)
@@ -295,11 +313,8 @@ void CSQCPlayer_ModelAppearance_Apply(entity this, bool islocalplayer)
                        int c2 = (c1 + 1 + q) % 15;
                        this.colormap = 1024 + (c1 << 4) + c2;
                }
-               else if(autocvar_cl_forceplayercolors && (autocvar_cl_forceplayercolors != 3 || ISGAMETYPE(DUEL)))
-               {
-                       if (!ISGAMETYPE(DUEL) || myteam != NUM_SPECTATOR)
-                               this.colormap = player_localnum + 1;
-               }
+               else if(forceplayercolors_enabled)
+                       this.colormap = player_localnum + 1;
        }
 
        LABEL(skipforcecolors)
index bd60d490f2036e75362f7218336bb25000f8ed2c..c63248740b67cc2a3b1d1d4b01223d66da3723c5 100644 (file)
@@ -52,10 +52,12 @@ void XonoticGameModelSettingsTab_fill(entity me)
        me.TR(me);
                me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Force player colors to mine")));
                me.TD(me, 1, 2, e = makeXonoticTextSlider_T("cl_forceplayercolors",
-                       _("Warning: selecting 'Always' your team's color may be the same as the enemy team")));
+                       _("Warning: if enabled in team games your team's color may be the same as the enemy team")));
                        e.addValue(e, _("Never"), "0");
                        e.addValue(e, _("Except in team games"), "1");
                        e.addValue(e, _("Only in Duel"), "3");
+                       e.addValue(e, _("Only in team games"), "4");
+                       e.addValue(e, _("In team games and Duel"), "5");
                        e.addValue(e, _("Always"), "2");
                        e.configureXonoticTextSliderValues(e);
        me.TR(me);
index 1f9bb1e5b05c41f406a006da3b0e302de9d89e81..7b6f34b6f4c4c02a8f3335dc19231583211d4d1a 100644 (file)
@@ -753,7 +753,7 @@ 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 (if cl_forceplayercolors_unique is 0), 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: always, 3: only in Duel, 4: only in game modes with 2 teams, 5: in team games and 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)"