From: terencehill Date: Thu, 26 Aug 2021 16:50:20 +0000 (+0200) Subject: Allow assigning each enemy unique colors in all game modes without teams except duel... X-Git-Tag: xonotic-v0.8.5~354^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5214041311eb0bb3b6ef385a176f0292761be169;p=xonotic%2Fxonotic-data.pk3dir.git Allow assigning each enemy unique colors in all game modes without teams except duel with the new cvar cl_forceplayercolors_unique. It implements #2295 --- diff --git a/qcsrc/client/csqcmodel_hooks.qc b/qcsrc/client/csqcmodel_hooks.qc index 0b38b108b..0f5c919f9 100644 --- a/qcsrc/client/csqcmodel_hooks.qc +++ b/qcsrc/client/csqcmodel_hooks.qc @@ -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; } diff --git a/qcsrc/client/csqcmodel_hooks.qh b/qcsrc/client/csqcmodel_hooks.qh index dd10112d7..16cc29a0b 100644 --- a/qcsrc/client/csqcmodel_hooks.qh +++ b/qcsrc/client/csqcmodel_hooks.qh @@ -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; diff --git a/xonotic-client.cfg b/xonotic-client.cfg index 5ccf96968..1f9bb1e5b 100644 --- a/xonotic-client.cfg +++ b/xonotic-client.cfg @@ -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)"