Index: code/client/cl_console.c =================================================================== --- code/client/cl_console.c (revision 737) +++ code/client/cl_console.c (working copy) @@ -533,8 +533,8 @@ if ( ( text[x] & 0xff ) == ' ' ) { continue; } - if ( ( (text[x]>>8)&7 ) != currentColor ) { - currentColor = (text[x]>>8)&7; + if ( (text[x]>>8) != currentColor ) { + currentColor = (text[x]>>8); re.SetColor( g_color_table[currentColor] ); } SCR_DrawSmallChar( cl_conXOffset->integer + con.xadjust + (x+1)*SMALLCHAR_WIDTH, v, text[x] & 0xff ); @@ -672,8 +672,8 @@ continue; } - if ( ( (text[x]>>8)&7 ) != currentColor ) { - currentColor = (text[x]>>8)&7; + if ( (text[x]>>8) != currentColor ) { + currentColor = (text[x]>>8); 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 737) +++ code/qcommon/q_math.c (working copy) @@ -47,19 +47,74 @@ 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] = - { - {0.0, 0.0, 0.0, 1.0}, - {1.0, 0.0, 0.0, 1.0}, - {0.0, 1.0, 0.0, 1.0}, - {1.0, 1.0, 0.0, 1.0}, - {0.0, 0.0, 1.0, 1.0}, - {0.0, 1.0, 1.0, 1.0}, - {1.0, 0.0, 1.0, 1.0}, - {1.0, 1.0, 1.0, 1.0}, - }; +const vec4_t g_color_table[MAX_CCODES] = +{ + {0.00000f, 0.00000f, 0.00000f, 1.00000f}, // 0 iD colours + {1.00000f, 0.00000f, 0.00000f, 1.00000f}, // 1 | + {0.00000f, 1.00000f, 0.00000f, 1.00000f}, // 2 v + {1.00000f, 1.00000f, 0.00000f, 1.00000f}, // 3 + {0.00000f, 0.00000f, 1.00000f, 1.00000f}, // 4 + {0.00000f, 1.00000f, 1.00000f, 1.00000f}, // 5 + {1.00000f, 0.00000f, 1.00000f, 1.00000f}, // 6 ^ + {1.00000f, 1.00000f, 1.00000f, 1.00000f}, // 7 | + {1.00000f, 0.50000f, 0.00000f, 1.00000f}, // 8 + {0.60000f, 0.60000f, 1.00000f, 1.00000f}, // 9 + {1.00000f, 0.00000f, 0.00000f, 1.00000f}, // a Rainbow + {1.00000f, 0.13239f, 0.00000f, 1.00000f}, // A | + {1.00000f, 0.26795f, 0.00000f, 1.00000f}, // b | + {1.00000f, 0.37829f, 0.00000f, 1.00000f}, // B v + {1.00000f, 0.50000f, 0.00000f, 1.00000f}, // c + {1.00000f, 0.60633f, 0.00000f, 1.00000f}, // C + {1.00000f, 0.73205f, 0.00000f, 1.00000f}, // d + {1.00000f, 0.84990f, 0.00000f, 1.00000f}, // D + {1.00000f, 1.00000f, 0.00000f, 1.00000f}, // e + {0.86761f, 1.00000f, 0.00000f, 1.00000f}, // E + {0.73205f, 1.00000f, 0.00000f, 1.00000f}, // f + {0.62171f, 1.00000f, 0.00000f, 1.00000f}, // F + {0.50000f, 1.00000f, 0.00000f, 1.00000f}, // g + {0.39367f, 1.00000f, 0.00000f, 1.00000f}, // G + {0.26795f, 1.00000f, 0.00000f, 1.00000f}, // h + {0.15010f, 1.00000f, 0.00000f, 1.00000f}, // H + {0.00000f, 1.00000f, 0.00000f, 1.00000f}, // i + {0.00000f, 1.00000f, 0.13239f, 1.00000f}, // I + {0.00000f, 1.00000f, 0.26795f, 1.00000f}, // j + {0.00000f, 1.00000f, 0.37829f, 1.00000f}, // J + {0.00000f, 1.00000f, 0.50000f, 1.00000f}, // k + {0.00000f, 1.00000f, 0.60633f, 1.00000f}, // K + {0.00000f, 1.00000f, 0.73205f, 1.00000f}, // l + {0.00000f, 1.00000f, 0.84990f, 1.00000f}, // L + {0.00000f, 1.00000f, 1.00000f, 1.00000f}, // m + {0.00000f, 0.86761f, 1.00000f, 1.00000f}, // M + {0.00000f, 0.73205f, 1.00000f, 1.00000f}, // n + {0.00000f, 0.62171f, 1.00000f, 1.00000f}, // N + {0.00000f, 0.50000f, 1.00000f, 1.00000f}, // o + {0.00000f, 0.39367f, 1.00000f, 1.00000f}, // O + {0.00000f, 0.26795f, 1.00000f, 1.00000f}, // p + {0.00000f, 0.15010f, 1.00000f, 1.00000f}, // P + {0.00000f, 0.00000f, 1.00000f, 1.00000f}, // q + {0.13239f, 0.00000f, 1.00000f, 1.00000f}, // Q + {0.26795f, 0.00000f, 1.00000f, 1.00000f}, // r + {0.37829f, 0.00000f, 1.00000f, 1.00000f}, // R + {0.50000f, 0.00000f, 1.00000f, 1.00000f}, // s + {0.60633f, 0.00000f, 1.00000f, 1.00000f}, // S + {0.73205f, 0.00000f, 1.00000f, 1.00000f}, // t + {0.84990f, 0.00000f, 1.00000f, 1.00000f}, // T + {1.00000f, 0.00000f, 1.00000f, 1.00000f}, // u + {1.00000f, 0.00000f, 0.86761f, 1.00000f}, // U + {1.00000f, 0.00000f, 0.73205f, 1.00000f}, // v + {1.00000f, 0.00000f, 0.62171f, 1.00000f}, // V + {1.00000f, 0.00000f, 0.50000f, 1.00000f}, // w ^ + {1.00000f, 0.00000f, 0.39367f, 1.00000f}, // W | + {1.00000f, 0.00000f, 0.26795f, 1.00000f}, // x | + {1.00000f, 0.00000f, 0.15010f, 1.00000f}, // X Rainbow + {0.75000f, 0.75000f, 0.75000f, 1.00000f}, // y Grey + {0.50000f, 0.50000f, 0.50000f, 1.00000f}, // Y | + {0.25000f, 0.25000f, 0.25000f, 1.00000f}, // z Grey + {1.00000f, 0.50000f, 1.00000f, 1.00000f}, // Z +}; + vec3_t bytedirs[NUMVERTEXNORMALS] = { {-0.525731f, 0.000000f, 0.850651f}, {-0.442863f, 0.238856f, 0.864188f}, Index: code/qcommon/q_shared.c =================================================================== --- code/qcommon/q_shared.c (revision 737) +++ code/qcommon/q_shared.c (working copy) @@ -560,7 +560,20 @@ } } +//Returns the index in g_color_table[] corresponding to the colour code. +int ColorIndex( char ccode ) { + if ( ccode >= '0' && ccode <= '9' ) { + return (ccode - '0'); + } else if ( ccode >= 'a' && ccode <= 'z' ) { + return (2 * (ccode - 'a') + 10); + } else if ( ccode >= 'A' && ccode <= 'Z' ) { + return (2 * (ccode - 'A') + 11); + } else { + return 7; + } +} + /* ================= SkipBracedSection Index: code/qcommon/q_shared.h =================================================================== --- code/qcommon/q_shared.h (revision 737) +++ code/qcommon/q_shared.h (working copy) @@ -61,6 +61,7 @@ #pragma warning(disable : 4711) // selected for automatic inline expansion #pragma warning(disable : 4220) // varargs matches remaining parameters //#pragma intrinsic( memset, memcpy ) +#pragma warning(disable : 4996) //shane strncpy should replace with strncpy_s #endif //Ignore __attribute__ on non-gcc platforms @@ -341,8 +342,10 @@ #define COLOR_CYAN '5' #define COLOR_MAGENTA '6' #define COLOR_WHITE '7' -#define ColorIndex(c) ( ( (c) - '0' ) & 7 ) +#define MAX_CCODES 62 +int ColorIndex( char ccode ); + #define S_COLOR_BLACK "^0" #define S_COLOR_RED "^1" #define S_COLOR_GREEN "^2" @@ -352,7 +355,7 @@ #define S_COLOR_MAGENTA "^6" #define S_COLOR_WHITE "^7" -extern vec4_t g_color_table[8]; +extern const vec4_t g_color_table[MAX_CCODES]; #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