From 56b108afea2862190f6874447ff0b91e73157013 Mon Sep 17 00:00:00 2001 From: terencehill Date: Sun, 10 Oct 2021 15:04:41 +0200 Subject: [PATCH] Allow enabling cl_forceplayercolors only in team games and Duel --- qcsrc/client/csqcmodel_hooks.qc | 31 ++++++++++++++----- .../xonotic/dialog_settings_game_model.qc | 4 ++- xonotic-client.cfg | 2 +- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/qcsrc/client/csqcmodel_hooks.qc b/qcsrc/client/csqcmodel_hooks.qc index 1d4fec3f1..252c5032d 100644 --- a/qcsrc/client/csqcmodel_hooks.qc +++ b/qcsrc/client/csqcmodel_hooks.qc @@ -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) diff --git a/qcsrc/menu/xonotic/dialog_settings_game_model.qc b/qcsrc/menu/xonotic/dialog_settings_game_model.qc index bd60d490f..c63248740 100644 --- a/qcsrc/menu/xonotic/dialog_settings_game_model.qc +++ b/qcsrc/menu/xonotic/dialog_settings_game_model.qc @@ -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); diff --git a/xonotic-client.cfg b/xonotic-client.cfg index 1f9bb1e5b..7b6f34b6f 100644 --- a/xonotic-client.cfg +++ b/xonotic-client.cfg @@ -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)" -- 2.39.2