Good day,
Again a short modification. This time it is mLy's friendly request.
The request:To extend text color scheme at least to 16 colors.
How the color scheme in Q3 works & our suggestions.We have ASCII char table (
this one).
Find the '0' character. The difference between '0' and typed color character is divided by colors count. The residue of division is the color number.
Before patch we have 8 colors.
Now when you know the logic you may decide for how much colors we should extend the scheme.
I think the maximum is 31-32.. I'm not sure since it still requires checking.
Also you may suggest new colors here as well.
In patch I just made them transparent. I don't have any clue what colors we need. I'm fine with current ones.
Current implementation for 1.1:I did all the colors from
Wolfenstein wiki as it was suggested by Torhu.
Seems non-alphabetic characters could be used too, ioQuake won't let you. That is restriction of ioQuake. I don't want to modify it. But if you
really need it - say it and maybe I'll take a closer look to ioQuake source. But before doing it - just try to use other colors from that scheme - maybe they will fit your needs as well.
The patch text for 1.1 version for discussion (1.0 patch is not supported from now on):
- Code: Select all
Index: code/client/cl_console.c
===================================================================
--- code/client/cl_console.c (revision 263)
+++ code/client/cl_console.c (working copy)
@@ -545,8 +545,8 @@
if ( ( text[x] & 0xff ) == ' ' ) {
continue;
}
- if ( ( (text[x]>>8)&7 ) != currentColor ) {
- currentColor = (text[x]>>8)&7;
+ if ( ( (text[x]>>8)&Q_COLORS_COUNT ) != currentColor ) {
+ currentColor = (text[x]>>8)&Q_COLORS_COUNT;
re.SetColor( g_color_table[currentColor] );
}
SCR_DrawSmallChar( cl_conXOffset->integer + con.xadjust + (x+1)*SMALLCHAR_WIDTH, v, text[x] & 0xff );
@@ -681,8 +681,8 @@
continue;
}
- if ( ( (text[x]>>8)&7 ) != currentColor ) {
- currentColor = (text[x]>>8)&7;
+ if ( ( (text[x]>>8)&Q_COLORS_COUNT ) != currentColor ) {
+ currentColor = (text[x]>>8)&Q_COLORS_COUNT;
re.SetColor( g_color_table[currentColor] );
}
SCR_DrawSmallChar( con.xadjust + (x+1)*SMALLCHAR_WIDTH, y, text[x] & 0xff );
Index: code/qcommon/q_math.c
===================================================================
--- code/qcommon/q_math.c (revision 263)
+++ code/qcommon/q_math.c (working copy)
@@ -49,7 +49,7 @@
vec4_t colorMdGrey = {0.5, 0.5, 0.5, 1};
vec4_t colorDkGrey = {0.25, 0.25, 0.25, 1};
-vec4_t g_color_table[8] =
+vec4_t g_color_table[Q_COLORS_COUNT+1] =
{
{0.0, 0.0, 0.0, 1.0},
{1.0, 0.0, 0.0, 1.0},
@@ -59,6 +59,33 @@
{0.0, 1.0, 1.0, 1.0},
{1.0, 0.0, 1.0, 1.0},
{1.0, 1.0, 1.0, 1.0},
+
+ {1.0, 0.5, 0.0, 1.0},
+ {0.5, 0.5, 0.5, 1.0},
+ {0.75, 0.75, 0.75, 1.0},
+ {0.75, 0.75, 0.75, 1.0},
+ {0.0, 0.5, 0.0, 1.0},
+ {0.5, 0.5, 0.0, 1.0},
+ {0.0, 0.0, 0.5, 1.0},
+ {0.5, 0.0, 0.0, 1.0},
+
+ {0.5, 0.25, 0.0, 1.0},
+ {1.0, 0.6, 0.1, 1.0},
+ {0.0, 0.5, 0.5, 1.0},
+ {0.5, 0.0, 0.5, 1.0},
+ {0.0, 0.5, 1.0, 1.0},
+ {0.5, 0.0, 1.0, 1.0},
+ {0.2, 0.6, 0.8, 1.0},
+ {0.8, 1.0, 0.8, 1.0},
+
+ {0.0, 0.4, 0.2, 1.0},
+ {1.0, 0.0, 0.2, 1.0},
+ {0.7, 0.1, 0.1, 1.0},
+ {0.6, 0.2, 0.0, 1.0},
+ {0.8, 0.6, 0.2, 1.0},
+ {0.6, 0.6, 0.2, 1.0},
+ {1.0, 1.0, 0.75, 1.0},
+ {1.0, 1.0, 0.5, 1.0},
};
Index: code/qcommon/q_shared.h
===================================================================
--- code/qcommon/q_shared.h (revision 263)
+++ code/qcommon/q_shared.h (working copy)
@@ -419,6 +419,8 @@
#define Q_COLOR_ESCAPE '^'
#define Q_IsColorString(p) ( p && *(p) == Q_COLOR_ESCAPE && *((p)+1) && isalnum(*((p)+1)) ) // ^[0-9a-zA-Z]
+#define Q_COLORS_COUNT 31
+
#define COLOR_BLACK '0'
#define COLOR_RED '1'
#define COLOR_GREEN '2'
@@ -427,7 +429,7 @@
#define COLOR_CYAN '5'
#define COLOR_MAGENTA '6'
#define COLOR_WHITE '7'
-#define ColorIndex(c) ( ( (c) - '0' ) & 7 )
+#define ColorIndex(c) ( ( (c) - '0' ) & Q_COLORS_COUNT )
#define S_COLOR_BLACK "^0"
#define S_COLOR_RED "^1"
@@ -438,7 +440,7 @@
#define S_COLOR_MAGENTA "^6"
#define S_COLOR_WHITE "^7"
-extern vec4_t g_color_table[8];
+extern vec4_t g_color_table[Q_COLORS_COUNT+1];
#define MAKERGB( v, r, g, b ) v[0]=r;v[1]=g;v[2]=b
#define MAKERGBA( v, r, g, b, a ) v[0]=r;v[1]=g;v[2]=b;v[3]=a
Can we use it now in 1.0 as we did with demo stuff?Unfortanutely the answer is no.
Yeah, for the first look it seems that we have to replace only binary things, but no - cgame&ui QVMs are affected as well - with scoreboard and player nick name.
So we need to replace default pak0.pk3 file on each server we want to use new color scheme (or make servers unpure but that will cause cheaters wave).
Yeah, I'm disappointed about this too.That is the reason why I haven't released new patch for 1.0.
The patch files:ExtendColors.1.0.patchExtendColors1.1.patchOne more note - I understand that everyone has its own colors he wants to see, but please don't do a simple posts like "dark purple is must have!". Maybe you can just put your request in one big spoiled post with pictures or color lists..
That way we sooner came to final conclusion how many colors we should add and which those colors are.
Current solution is to use the scheme suggested by Torhu. I feel fine with it.
Yeah, there should be other more complicated way to do the thing.. But I don't want to do it. As I said I'm not using colors very often and I'm fine with current ones.
Thanks for attention!
Have a good day!
"You should know that the lies won't hide your flaws/No sense in hiding all of yours/You gave up on your dreams along the way" (c) "Fake it" by Seether
P.S. English isn't my native language.