aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2007-09-21 10:35:24 +0000
committertma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2007-09-21 10:35:24 +0000
commitef3e7e01a2280c186da589404386ae3364b08a4a (patch)
tree69582b32595f2043903a65dd580572108bc80649
parent8751aa08ae15df6f179acb4315f951d7add6de02 (diff)
downloadioquake3-aero-ef3e7e01a2280c186da589404386ae3364b08a4a.tar.gz
ioquake3-aero-ef3e7e01a2280c186da589404386ae3364b08a4a.zip
* Don't apply colour escape chars on input fields
git-svn-id: svn://svn.icculus.org/quake3/trunk@1184 edf5b092-35ff-0310-97b2-ce42778d08ea
-rw-r--r--code/client/cl_console.c9
-rw-r--r--code/client/cl_keys.c51
-rw-r--r--code/client/cl_scrn.c24
-rw-r--r--code/client/client.h6
-rw-r--r--code/client/keys.h4
5 files changed, 46 insertions, 48 deletions
diff --git a/code/client/cl_console.c b/code/client/cl_console.c
index 9db8c4d..898fce2 100644
--- a/code/client/cl_console.c
+++ b/code/client/cl_console.c
@@ -488,7 +488,7 @@ void Con_DrawInput (void) {
SCR_DrawSmallChar( con.xadjust + 1 * SMALLCHAR_WIDTH, y, ']' );
Field_Draw( &g_consoleField, con.xadjust + 2 * SMALLCHAR_WIDTH, y,
- SCREEN_WIDTH - 3 * SMALLCHAR_WIDTH, qtrue );
+ SCREEN_WIDTH - 3 * SMALLCHAR_WIDTH, qtrue, qtrue );
}
@@ -553,17 +553,17 @@ void Con_DrawNotify (void)
{
if (chat_team)
{
- SCR_DrawBigString (8, v, "say_team:", 1.0f );
+ SCR_DrawBigString (8, v, "say_team:", 1.0f, qfalse );
skip = 10;
}
else
{
- SCR_DrawBigString (8, v, "say:", 1.0f );
+ SCR_DrawBigString (8, v, "say:", 1.0f, qfalse );
skip = 5;
}
Field_BigDraw( &chatField, skip * BIGCHAR_WIDTH, v,
- SCREEN_WIDTH - ( skip + 1 ) * BIGCHAR_WIDTH, qtrue );
+ SCREEN_WIDTH - ( skip + 1 ) * BIGCHAR_WIDTH, qtrue, qtrue );
v += BIGCHAR_HEIGHT;
}
@@ -623,7 +623,6 @@ void Con_DrawSolidConsole( float frac ) {
for (x=0 ; x<i ; x++) {
SCR_DrawSmallChar( cls.glconfig.vidWidth - ( i - x ) * SMALLCHAR_WIDTH,
-
(lines-(SMALLCHAR_HEIGHT+SMALLCHAR_HEIGHT/2)), Q3_VERSION[x] );
}
diff --git a/code/client/cl_keys.c b/code/client/cl_keys.c
index 11354d2..8991d0e 100644
--- a/code/client/cl_keys.c
+++ b/code/client/cl_keys.c
@@ -309,7 +309,8 @@ Handles horizontal scrolling and cursor blinking
x, y, and width are in pixels
===================
*/
-void Field_VariableSizeDraw( field_t *edit, int x, int y, int width, int size, qboolean showCursor ) {
+void Field_VariableSizeDraw( field_t *edit, int x, int y, int width, int size, qboolean showCursor,
+ qboolean noColorEscape ) {
int len;
int drawLen;
int prestep;
@@ -350,47 +351,45 @@ void Field_VariableSizeDraw( field_t *edit, int x, int y, int width, int size, q
float color[4];
color[0] = color[1] = color[2] = color[3] = 1.0;
- SCR_DrawSmallStringExt( x, y, str, color, qfalse );
+ SCR_DrawSmallStringExt( x, y, str, color, qfalse, noColorEscape );
} else {
// draw big string with drop shadow
- SCR_DrawBigString( x, y, str, 1.0 );
+ SCR_DrawBigString( x, y, str, 1.0, noColorEscape );
}
// draw the cursor
- if ( !showCursor ) {
- return;
- }
-
- if ( (int)( cls.realtime >> 8 ) & 1 ) {
- return; // off blink
- }
+ if ( showCursor ) {
+ if ( (int)( cls.realtime >> 8 ) & 1 ) {
+ return; // off blink
+ }
- if ( key_overstrikeMode ) {
- cursorChar = 11;
- } else {
- cursorChar = 10;
- }
+ if ( key_overstrikeMode ) {
+ cursorChar = 11;
+ } else {
+ cursorChar = 10;
+ }
- i = drawLen - Q_PrintStrlen( str );
+ i = drawLen - strlen( str );
- if ( size == SMALLCHAR_WIDTH ) {
- SCR_DrawSmallChar( x + ( edit->cursor - prestep - i ) * size, y, cursorChar );
- } else {
- str[0] = cursorChar;
- str[1] = 0;
- SCR_DrawBigString( x + ( edit->cursor - prestep - i ) * size, y, str, 1.0 );
+ if ( size == SMALLCHAR_WIDTH ) {
+ SCR_DrawSmallChar( x + ( edit->cursor - prestep - i ) * size, y, cursorChar );
+ } else {
+ str[0] = cursorChar;
+ str[1] = 0;
+ SCR_DrawBigString( x + ( edit->cursor - prestep - i ) * size, y, str, 1.0, qfalse );
+ }
}
}
-void Field_Draw( field_t *edit, int x, int y, int width, qboolean showCursor )
+void Field_Draw( field_t *edit, int x, int y, int width, qboolean showCursor, qboolean noColorEscape )
{
- Field_VariableSizeDraw( edit, x, y, width, SMALLCHAR_WIDTH, showCursor );
+ Field_VariableSizeDraw( edit, x, y, width, SMALLCHAR_WIDTH, showCursor, noColorEscape );
}
-void Field_BigDraw( field_t *edit, int x, int y, int width, qboolean showCursor )
+void Field_BigDraw( field_t *edit, int x, int y, int width, qboolean showCursor, qboolean noColorEscape )
{
- Field_VariableSizeDraw( edit, x, y, width, BIGCHAR_WIDTH, showCursor );
+ Field_VariableSizeDraw( edit, x, y, width, BIGCHAR_WIDTH, showCursor, noColorEscape );
}
/*
diff --git a/code/client/cl_scrn.c b/code/client/cl_scrn.c
index 5222e9d..86879f1 100644
--- a/code/client/cl_scrn.c
+++ b/code/client/cl_scrn.c
@@ -196,7 +196,8 @@ to a fixed color.
Coordinates are at 640 by 480 virtual resolution
==================
*/
-void SCR_DrawStringExt( int x, int y, float size, const char *string, float *setColor, qboolean forceColor ) {
+void SCR_DrawStringExt( int x, int y, float size, const char *string, float *setColor, qboolean forceColor,
+ qboolean noColorEscape ) {
vec4_t color;
const char *s;
int xx;
@@ -208,7 +209,7 @@ void SCR_DrawStringExt( int x, int y, float size, const char *string, float *set
s = string;
xx = x;
while ( *s ) {
- if ( Q_IsColorString( s ) ) {
+ if ( !noColorEscape && Q_IsColorString( s ) ) {
s += 2;
continue;
}
@@ -223,7 +224,7 @@ void SCR_DrawStringExt( int x, int y, float size, const char *string, float *set
xx = x;
re.SetColor( setColor );
while ( *s ) {
- if ( Q_IsColorString( s ) ) {
+ if ( !noColorEscape && Q_IsColorString( s ) ) {
if ( !forceColor ) {
Com_Memcpy( color, g_color_table[ColorIndex(*(s+1))], sizeof( color ) );
color[3] = setColor[3];
@@ -240,16 +241,16 @@ void SCR_DrawStringExt( int x, int y, float size, const char *string, float *set
}
-void SCR_DrawBigString( int x, int y, const char *s, float alpha ) {
+void SCR_DrawBigString( int x, int y, const char *s, float alpha, qboolean noColorEscape ) {
float color[4];
color[0] = color[1] = color[2] = 1.0;
color[3] = alpha;
- SCR_DrawStringExt( x, y, BIGCHAR_WIDTH, s, color, qfalse );
+ SCR_DrawStringExt( x, y, BIGCHAR_WIDTH, s, color, qfalse, noColorEscape );
}
-void SCR_DrawBigStringColor( int x, int y, const char *s, vec4_t color ) {
- SCR_DrawStringExt( x, y, BIGCHAR_WIDTH, s, color, qtrue );
+void SCR_DrawBigStringColor( int x, int y, const char *s, vec4_t color, qboolean noColorEscape ) {
+ SCR_DrawStringExt( x, y, BIGCHAR_WIDTH, s, color, qtrue, noColorEscape );
}
@@ -259,11 +260,10 @@ SCR_DrawSmallString[Color]
Draws a multi-colored string with a drop shadow, optionally forcing
to a fixed color.
-
-Coordinates are at 640 by 480 virtual resolution
==================
*/
-void SCR_DrawSmallStringExt( int x, int y, const char *string, float *setColor, qboolean forceColor ) {
+void SCR_DrawSmallStringExt( int x, int y, const char *string, float *setColor, qboolean forceColor,
+ qboolean noColorEscape ) {
vec4_t color;
const char *s;
int xx;
@@ -273,7 +273,7 @@ void SCR_DrawSmallStringExt( int x, int y, const char *string, float *setColor,
xx = x;
re.SetColor( setColor );
while ( *s ) {
- if ( Q_IsColorString( s ) ) {
+ if ( !noColorEscape && Q_IsColorString( s ) ) {
if ( !forceColor ) {
Com_Memcpy( color, g_color_table[ColorIndex(*(s+1))], sizeof( color ) );
color[3] = setColor[3];
@@ -339,7 +339,7 @@ void SCR_DrawDemoRecording( void ) {
pos = FS_FTell( clc.demofile );
sprintf( string, "RECORDING %s: %ik", clc.demoName, pos / 1024 );
- SCR_DrawStringExt( 320 - strlen( string ) * 4, 20, 8, string, g_color_table[7], qtrue );
+ SCR_DrawStringExt( 320 - strlen( string ) * 4, 20, 8, string, g_color_table[7], qtrue, qfalse );
}
diff --git a/code/client/client.h b/code/client/client.h
index a2e682e..d419bd1 100644
--- a/code/client/client.h
+++ b/code/client/client.h
@@ -500,9 +500,9 @@ void SCR_FillRect( float x, float y, float width, float height,
void SCR_DrawPic( float x, float y, float width, float height, qhandle_t hShader );
void SCR_DrawNamedPic( float x, float y, float width, float height, const char *picname );
-void SCR_DrawBigString( int x, int y, const char *s, float alpha ); // draws a string with embedded color control characters with fade
-void SCR_DrawBigStringColor( int x, int y, const char *s, vec4_t color ); // ignores embedded color control characters
-void SCR_DrawSmallStringExt( int x, int y, const char *string, float *setColor, qboolean forceColor );
+void SCR_DrawBigString( int x, int y, const char *s, float alpha, qboolean noColorEscape ); // draws a string with embedded color control characters with fade
+void SCR_DrawBigStringColor( int x, int y, const char *s, vec4_t color, qboolean noColorEscape ); // ignores embedded color control characters
+void SCR_DrawSmallStringExt( int x, int y, const char *string, float *setColor, qboolean forceColor, qboolean noColorEscape );
void SCR_DrawSmallChar( int x, int y, int ch );
diff --git a/code/client/keys.h b/code/client/keys.h
index 851d367..0168468 100644
--- a/code/client/keys.h
+++ b/code/client/keys.h
@@ -33,8 +33,8 @@ extern qkey_t keys[MAX_KEYS];
// NOTE TTimo the declaration of field_t and Field_Clear is now in qcommon/qcommon.h
void Field_KeyDownEvent( field_t *edit, int key );
void Field_CharEvent( field_t *edit, int ch );
-void Field_Draw( field_t *edit, int x, int y, int width, qboolean showCursor );
-void Field_BigDraw( field_t *edit, int x, int y, int width, qboolean showCursor );
+void Field_Draw( field_t *edit, int x, int y, int width, qboolean showCursor, qboolean noColorEscape );
+void Field_BigDraw( field_t *edit, int x, int y, int width, qboolean showCursor, qboolean noColorEscape );
#define COMMAND_HISTORY 32
extern field_t historyEditLines[COMMAND_HISTORY];