Skip to content

Commit

Permalink
Add color 14, 15 and 16.
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
osm committed Feb 19, 2025
1 parent baab4df commit 639c1c5
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 18 deletions.
72 changes: 72 additions & 0 deletions help_variables.json
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,18 @@
{
"description": "Blue",
"name": "13"
},
{
"description": "Orange.",
"name": "14"
},
{
"description": "Bright red.",
"name": "15"
},
{
"description": "Black.",
"name": "16"
}
]
},
Expand Down Expand Up @@ -4124,6 +4136,18 @@
{
"description": "Blue",
"name": "13"
},
{
"description": "Orange.",
"name": "14"
},
{
"description": "Bright red.",
"name": "15"
},
{
"description": "Black.",
"name": "16"
}
]
},
Expand Down Expand Up @@ -4236,6 +4260,18 @@
{
"description": "Blue",
"name": "13"
},
{
"description": "Orange.",
"name": "14"
},
{
"description": "Bright red.",
"name": "15"
},
{
"description": "Black.",
"name": "16"
}
]
},
Expand Down Expand Up @@ -20694,6 +20730,18 @@
{
"description": "Blue",
"name": "13"
},
{
"description": "Orange.",
"name": "14"
},
{
"description": "Bright red.",
"name": "15"
},
{
"description": "Black.",
"name": "16"
}
]
},
Expand Down Expand Up @@ -20847,6 +20895,18 @@
{
"description": "Blue",
"name": "13"
},
{
"description": "Orange.",
"name": "14"
},
{
"description": "Bright red.",
"name": "15"
},
{
"description": "Black.",
"name": "16"
}
]
},
Expand Down Expand Up @@ -20932,6 +20992,18 @@
{
"description": "Blue.",
"name": "13"
},
{
"description": "Orange.",
"name": "14"
},
{
"description": "Bright red.",
"name": "15"
},
{
"description": "Black.",
"name": "16"
}
]
},
Expand Down
11 changes: 3 additions & 8 deletions src/cl_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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
Expand Down
4 changes: 1 addition & 3 deletions src/sbar.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 2 additions & 7 deletions src/teamplay.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit 639c1c5

Please sign in to comment.