From 18e08125ddd65d453ce86e55ca575a2a73d1a5a3 Mon Sep 17 00:00:00 2001 From: Pan7 Date: Thu, 28 Aug 2014 19:15:54 -0500 Subject: [PATCH] Add ColorIndexForNumber macro replacing '& 0x07' Makes it easier to add more colors. --- code/client/cl_console.c | 4 ++-- code/qcommon/q_shared.h | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/code/client/cl_console.c b/code/client/cl_console.c index a3d4d322..bd6b0ec2 100644 --- a/code/client/cl_console.c +++ b/code/client/cl_console.c @@ -583,8 +583,8 @@ void Con_DrawNotify (void) if ( ( text[x] & 0xff ) == ' ' ) { continue; } - if ( ( (text[x]>>8)&7 ) != currentColor ) { - currentColor = (text[x]>>8)&7; + if ( ColorIndexForNumber( text[x]>>8 ) != currentColor ) { + currentColor = ColorIndexForNumber( text[x]>>8 ); re.SetColor( g_color_table[currentColor] ); } SCR_DrawSmallChar( cl_conXOffset->integer + con.xadjust + (x+1)*SMALLCHAR_WIDTH, v, text[x] & 0xff ); diff --git a/code/qcommon/q_shared.h b/code/qcommon/q_shared.h index 64247a89..baed3f89 100644 --- a/code/qcommon/q_shared.h +++ b/code/qcommon/q_shared.h @@ -403,7 +403,8 @@ extern vec4_t colorDkGrey; #define COLOR_CYAN '5' #define COLOR_MAGENTA '6' #define COLOR_WHITE '7' -#define ColorIndex(c) (((c) - '0') & 0x07) +#define ColorIndexForNumber(c) ((c) & 0x07) +#define ColorIndex(c) (ColorIndexForNumber((c) - '0')) #define S_COLOR_BLACK "^0" #define S_COLOR_RED "^1"