From 639c1c59f20f2f48f6244ddf74c66e6c3c60977d Mon Sep 17 00:00:00 2001 From: Oscar Linderholm Date: Sat, 1 Feb 2025 20:11:13 +0100 Subject: [PATCH] Add color 14, 15 and 16. There was a bug in the following client versions that allowed players to use more than the regular colors. - qwcl-1.50 - qwcl-1.55 - qwcl-1.64 - qwcl-2.00 - qwcl-2.10 - glqwcl-1.64 - glqwcl-2.10 The bug was fixed in: - qwcl-2.20 - glqwcl-2.20 Both the software and GL clients correctly restricted colors to the range of 0 - 13 when using the color command. However, the developers forgot to apply this restriction to the bottomcolor and topcolor cvars. The behavior differed slightly between the qwcl and glqwcl clients. In the software version, only two additional colors were available: color 14 (orange) and color 15 (bright red). In the GL version, players could select from the entire palette. This commit aims to reintroduce the most popular colors used during that time: - Orange (color 14, mapped to palette index 232) - Bright red (color 15, mapped to palette index 248) - Black (color 16, mapped to palette index 0) --- help_variables.json | 72 +++++++++++++++++++++++++++++++++++++++++++++ src/cl_cmd.c | 11 ++----- src/sbar.c | 4 +-- src/teamplay.c | 9 ++---- 4 files changed, 78 insertions(+), 18 deletions(-) diff --git a/help_variables.json b/help_variables.json index 658977ccf..02e587852 100644 --- a/help_variables.json +++ b/help_variables.json @@ -651,6 +651,18 @@ { "description": "Blue", "name": "13" + }, + { + "description": "Orange.", + "name": "14" + }, + { + "description": "Bright red.", + "name": "15" + }, + { + "description": "Black.", + "name": "16" } ] }, @@ -4124,6 +4136,18 @@ { "description": "Blue", "name": "13" + }, + { + "description": "Orange.", + "name": "14" + }, + { + "description": "Bright red.", + "name": "15" + }, + { + "description": "Black.", + "name": "16" } ] }, @@ -4236,6 +4260,18 @@ { "description": "Blue", "name": "13" + }, + { + "description": "Orange.", + "name": "14" + }, + { + "description": "Bright red.", + "name": "15" + }, + { + "description": "Black.", + "name": "16" } ] }, @@ -20694,6 +20730,18 @@ { "description": "Blue", "name": "13" + }, + { + "description": "Orange.", + "name": "14" + }, + { + "description": "Bright red.", + "name": "15" + }, + { + "description": "Black.", + "name": "16" } ] }, @@ -20847,6 +20895,18 @@ { "description": "Blue", "name": "13" + }, + { + "description": "Orange.", + "name": "14" + }, + { + "description": "Bright red.", + "name": "15" + }, + { + "description": "Black.", + "name": "16" } ] }, @@ -20932,6 +20992,18 @@ { "description": "Blue.", "name": "13" + }, + { + "description": "Orange.", + "name": "14" + }, + { + "description": "Bright red.", + "name": "15" + }, + { + "description": "Black.", + "name": "16" } ] }, diff --git a/src/cl_cmd.c b/src/cl_cmd.c index 8fe9db4b5..64fdb108c 100644 --- a/src/cl_cmd.c +++ b/src/cl_cmd.c @@ -746,7 +746,7 @@ void CL_Color_f (void) { Com_Printf ("\"color\" is \"%s %s\"\n", Info_ValueForKey (cls.userinfo, "topcolor"), Info_ValueForKey (cls.userinfo, "bottomcolor") ); - Com_Printf ("color <0-13> [0-13]\n"); + Com_Printf ("color <0-16> [0-16]\n"); return; case 2: top = bottom = Q_atoi(Cmd_Argv(1)); @@ -756,13 +756,8 @@ void CL_Color_f (void) { bottom = Q_atoi(Cmd_Argv(2)); } - top &= 15; - top = min(top, 13); - bottom &= 15; - bottom = min(bottom, 13); - - Cvar_SetValue (&topcolor, top); - Cvar_SetValue (&bottomcolor, bottom); + Cvar_SetValue (&topcolor, bound(0, top, 16)); + Cvar_SetValue (&bottomcolor, bound(0, bottom, 16)); } //usage: fullinfo \name\unnamed\topcolor\0\bottomcolor\1, etc diff --git a/src/sbar.c b/src/sbar.c index bfa91ec7a..86cbf7400 100644 --- a/src/sbar.c +++ b/src/sbar.c @@ -441,9 +441,7 @@ void Sbar_DrawNum (int x, int y, int num, int digits, int color) { // this used to be static function int Sbar_ColorForMap (int m) { - m = bound(0, m, 13); - - return 16 * m + 8; + return m == 16 ? 0 : 16 * bound(0, m, 15) + 8; } // HUD -> hexum diff --git a/src/teamplay.c b/src/teamplay.c index 2494532cd..41e3d075b 100644 --- a/src/teamplay.c +++ b/src/teamplay.c @@ -1895,13 +1895,8 @@ void TP_ColorForcing (cvar_t *topcolor, cvar_t *bottomcolor) bottom = atoi(Cmd_Argv(2)); } - top &= 15; - top = min(13, top); - bottom &= 15; - bottom = min(13, bottom); - - Cvar_SetValue(topcolor, top); - Cvar_SetValue(bottomcolor, bottom); + Cvar_SetValue(topcolor, bound(0, top, 16)); + Cvar_SetValue(bottomcolor, bound(0, bottom, 16)); TP_RefreshSkins(); }