diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/cl_console.c | 9 | ||||
-rw-r--r-- | src/client/cl_curl.c | 8 | ||||
-rw-r--r-- | src/client/cl_curl.h | 4 | ||||
-rw-r--r-- | src/client/cl_keys.c | 51 | ||||
-rw-r--r-- | src/client/cl_main.c | 10 | ||||
-rw-r--r-- | src/client/cl_scrn.c | 22 | ||||
-rw-r--r-- | src/client/client.h | 8 | ||||
-rw-r--r-- | src/client/keys.h | 4 | ||||
-rw-r--r-- | src/client/qal.c | 4 | ||||
-rw-r--r-- | src/client/qal.h | 6 | ||||
-rw-r--r-- | src/client/snd_codec.c | 2 | ||||
-rw-r--r-- | src/client/snd_codec_ogg.c | 2 | ||||
-rw-r--r-- | src/client/snd_openal.c | 4 | ||||
-rw-r--r-- | src/game/bg_lib.c | 27 | ||||
-rw-r--r-- | src/game/bg_lib.h | 18 | ||||
-rw-r--r-- | src/qcommon/q_shared.h | 6 |
16 files changed, 88 insertions, 97 deletions
diff --git a/src/client/cl_console.c b/src/client/cl_console.c index 14bc65be..9d2d8e7c 100644 --- a/src/client/cl_console.c +++ b/src/client/cl_console.c @@ -464,7 +464,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 ); } /* @@ -520,7 +520,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] ); } @@ -615,17 +614,17 @@ void Con_DrawConsole( void ) { if( chat_team ) { - SCR_DrawBigString( 8, 232, "Team Say:", 1.0f ); + SCR_DrawBigString( 8, 232, "Team Say:", 1.0f, qfalse ); skip = 11; } else { - SCR_DrawBigString( 8, 232, "Say:", 1.0f ); + SCR_DrawBigString( 8, 232, "Say:", 1.0f, qfalse ); skip = 5; } Field_BigDraw( &chatField, skip * BIGCHAR_WIDTH, 232, - SCREEN_WIDTH - ( skip + 1 ) * BIGCHAR_WIDTH, qtrue ); + SCREEN_WIDTH - ( skip + 1 ) * BIGCHAR_WIDTH, qtrue, qtrue ); } } diff --git a/src/client/cl_curl.c b/src/client/cl_curl.c index d15cbba8..96bd7abc 100644 --- a/src/client/cl_curl.c +++ b/src/client/cl_curl.c @@ -20,11 +20,11 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA =========================================================================== */ -#if USE_CURL +#ifdef USE_CURL #include "client.h" cvar_t *cl_cURLLib; -#if USE_CURL_DLOPEN +#ifdef USE_CURL_DLOPEN #include "../sys/sys_loadlib.h" char* (*qcurl_version)(void); @@ -88,7 +88,7 @@ CL_cURL_Init */ qboolean CL_cURL_Init() { -#if USE_CURL_DLOPEN +#ifdef USE_CURL_DLOPEN if(cURLLib) return qtrue; @@ -156,7 +156,7 @@ CL_cURL_Shutdown void CL_cURL_Shutdown( void ) { CL_cURL_Cleanup(); -#if USE_CURL_DLOPEN +#ifdef USE_CURL_DLOPEN if(cURLLib) { Sys_UnloadLibrary(cURLLib); diff --git a/src/client/cl_curl.h b/src/client/cl_curl.h index 7b3f8929..08aec802 100644 --- a/src/client/cl_curl.h +++ b/src/client/cl_curl.h @@ -37,14 +37,14 @@ extern cvar_t *cl_cURLLib; #define DEFAULT_CURL_LIB "libcurl.so.3" #endif -#if USE_LOCAL_HEADERS +#ifdef USE_LOCAL_HEADERS #include "../libcurl/curl/curl.h" #else #include <curl/curl.h> #endif -#if USE_CURL_DLOPEN +#ifdef USE_CURL_DLOPEN extern char* (*qcurl_version)(void); extern CURL* (*qcurl_easy_init)(void); diff --git a/src/client/cl_keys.c b/src/client/cl_keys.c index 1ce97418..e6e8261c 100644 --- a/src/client/cl_keys.c +++ b/src/client/cl_keys.c @@ -310,7 +310,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; @@ -351,47 +352,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/src/client/cl_main.c b/src/client/cl_main.c index 80c35db1..fc73ad47 100644 --- a/src/client/cl_main.c +++ b/src/client/cl_main.c @@ -736,7 +736,7 @@ CL_ShutdownAll */ void CL_ShutdownAll(void) { -#if USE_CURL +#ifdef USE_CURL CL_cURL_Shutdown(); #endif // clear sounds @@ -1415,7 +1415,7 @@ Called when all downloading has been completed */ void CL_DownloadsComplete( void ) { -#if USE_CURL +#ifdef USE_CURL // if we downloaded with cURL if(clc.cURLUsed) { clc.cURLUsed = qfalse; @@ -1546,7 +1546,7 @@ void CL_NextDownload(void) { *s++ = 0; else s = localName + strlen(localName); // point at the nul byte -#if USE_CURL +#ifdef USE_CURL if(!(cl_allowDownload->integer & DLF_NO_REDIRECT)) { if(clc.sv_allowDownload & DLF_NO_REDIRECT) { Com_Printf("WARNING: server does not " @@ -2162,7 +2162,7 @@ void CL_Frame ( int msec ) { return; } -#if USE_CURL +#ifdef USE_CURL if(clc.downloadCURLM) { CL_cURL_PerformDownload(); // we can't process frames normally when in disconnected @@ -2653,7 +2653,7 @@ void CL_Init( void ) { cl_showMouseRate = Cvar_Get ("cl_showmouserate", "0", 0); cl_allowDownload = Cvar_Get ("cl_allowDownload", "0", CVAR_ARCHIVE); -#if USE_CURL +#ifdef USE_CURL cl_cURLLib = Cvar_Get("cl_cURLLib", DEFAULT_CURL_LIB, CVAR_ARCHIVE); #endif diff --git a/src/client/cl_scrn.c b/src/client/cl_scrn.c index a8d37e22..f5c6cb9b 100644 --- a/src/client/cl_scrn.c +++ b/src/client/cl_scrn.c @@ -197,7 +197,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; @@ -209,7 +210,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; } @@ -224,7 +225,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]; @@ -241,16 +242,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 ); } @@ -260,11 +261,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; @@ -274,7 +274,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]; diff --git a/src/client/client.h b/src/client/client.h index b6a75f55..12d13f9c 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -31,7 +31,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "../cgame/cg_public.h" #include "../game/bg_public.h" -#if USE_CURL +#ifdef USE_CURL #include "cl_curl.h" #endif /* USE_CURL */ @@ -502,9 +502,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/src/client/keys.h b/src/client/keys.h index 3c3fe802..a2d24da5 100644 --- a/src/client/keys.h +++ b/src/client/keys.h @@ -34,8 +34,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]; diff --git a/src/client/qal.c b/src/client/qal.c index 1ff99e39..a3448ba2 100644 --- a/src/client/qal.c +++ b/src/client/qal.c @@ -24,11 +24,11 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // Dynamically loads OpenAL -#if USE_OPENAL +#ifdef USE_OPENAL #include "qal.h" -#if USE_OPENAL_DLOPEN +#ifdef USE_OPENAL_DLOPEN #include "../sys/sys_loadlib.h" diff --git a/src/client/qal.h b/src/client/qal.h index 7747d987..c43f9c13 100644 --- a/src/client/qal.h +++ b/src/client/qal.h @@ -29,12 +29,12 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "../qcommon/q_shared.h" #include "../qcommon/qcommon.h" -#if USE_OPENAL_DLOPEN +#ifdef USE_OPENAL_DLOPEN #define AL_NO_PROTOTYPES #define ALC_NO_PROTOTYPES #endif -#if USE_LOCAL_HEADERS +#ifdef USE_LOCAL_HEADERS #include "../AL/al.h" #include "../AL/alc.h" #else @@ -48,7 +48,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #endif #endif -#if USE_OPENAL_DLOPEN +#ifdef USE_OPENAL_DLOPEN extern LPALENABLE qalEnable; extern LPALDISABLE qalDisable; extern LPALISENABLED qalIsEnabled; diff --git a/src/client/snd_codec.c b/src/client/snd_codec.c index 088236a4..0f947551 100644 --- a/src/client/snd_codec.c +++ b/src/client/snd_codec.c @@ -103,7 +103,7 @@ void S_CodecInit() { codecs = NULL; S_CodecRegister(&wav_codec); -#if USE_CODEC_VORBIS +#ifdef USE_CODEC_VORBIS S_CodecRegister(&ogg_codec); #endif } diff --git a/src/client/snd_codec_ogg.c b/src/client/snd_codec_ogg.c index f13f9a8d..764bbd25 100644 --- a/src/client/snd_codec_ogg.c +++ b/src/client/snd_codec_ogg.c @@ -23,7 +23,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ // OGG support is enabled by this define -#if USE_CODEC_VORBIS +#ifdef USE_CODEC_VORBIS // includes for the Q3 sound system #include "client.h" diff --git a/src/client/snd_openal.c b/src/client/snd_openal.c index 61b250d6..d8ad48c8 100644 --- a/src/client/snd_openal.c +++ b/src/client/snd_openal.c @@ -26,7 +26,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "snd_codec.h" #include "client.h" -#if USE_OPENAL +#ifdef USE_OPENAL #include "qal.h" @@ -1865,7 +1865,7 @@ S_AL_Init */ qboolean S_AL_Init( soundInterface_t *si ) { -#if USE_OPENAL +#ifdef USE_OPENAL qboolean enumsupport, founddev = qfalse; diff --git a/src/game/bg_lib.c b/src/game/bg_lib.c index 8594db44..b007d256 100644 --- a/src/game/bg_lib.c +++ b/src/game/bg_lib.c @@ -25,6 +25,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // compiled for the virtual machine +#ifdef Q3_VM + #include "../qcommon/q_shared.h" /*- @@ -70,10 +72,6 @@ static const char rcsid[] = "$Id$"; #endif /* LIBC_SCCS and not lint */ -#if !defined( Q3_VM ) -typedef int cmp_t(const void *, const void *); -#endif - static char* med3(char *, char *, char *, cmp_t *); static void swapfunc(char *, char *, int, int); @@ -214,10 +212,6 @@ loop: SWAPINIT(a, es); //================================================================================== -// this file is excluded from release builds because of intrinsics - -#if defined ( Q3_VM ) - size_t strlen( const char *string ) { const char *s; @@ -318,10 +312,6 @@ char *strstr( const char *string, const char *strCharSet ) return (char *)0; } -#endif - -#if defined ( Q3_VM ) - int tolower( int c ) { if( c >= 'A' && c <= 'Z' ) @@ -339,8 +329,6 @@ int toupper( int c ) return c; } -#endif - void *memmove( void *dest, const void *src, size_t count ) { int i; @@ -813,7 +801,6 @@ double atan2( double y, double x ) { #endif -#ifdef Q3_VM /* =============== rint @@ -1311,8 +1298,6 @@ float pow( float x, float y ) return s * z; } -#endif - static int randSeed = 0; @@ -1484,8 +1469,6 @@ double _atof( const char **stringPtr ) } -#if defined ( Q3_VM ) - int atoi( const char *string ) { int sign; @@ -1941,11 +1924,7 @@ reswitch: case 'f': AddFloat( &buf_p, *(double *)arg, width, prec ); -#ifdef Q3_VM - arg += 1; // everything is 32 bit in my compiler -#else - arg += 2; -#endif + arg += 1; // everything is 32 bit break; case 's': diff --git a/src/game/bg_lib.h b/src/game/bg_lib.h index 021ebc39..2289af18 100644 --- a/src/game/bg_lib.h +++ b/src/game/bg_lib.h @@ -25,7 +25,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // compiled for the virtual machine // This file is NOT included on native builds -#ifndef BG_LIB_H +#if !defined( BG_LIB_H ) && defined( Q3_VM ) #define BG_LIB_H #ifndef NULL @@ -55,6 +55,22 @@ typedef char * va_list; #define LONG_MAX 2147483647L /* maximum (signed) long value */ #define ULONG_MAX 0xffffffffUL /* maximum unsigned long value */ +#define isalnum(c) (isalpha(c) || isdigit(c)) +#define isalpha(c) (isupper(c) || islower(c)) +#define isascii(c) ((c) > 0 && (c) <= 0x7f) +#define iscntrl(c) (((c) >= 0) && (((c) <= 0x1f) || ((c) == 0x7f))) +#define isdigit(c) ((c) >= '0' && (c) <= '9') +#define isgraph(c) ((c) != ' ' && isprint(c) +#define islower(c) ((c) >= 'a' && (c) <= 'z') +#define isprint(c) ((c) >= ' ' && (c) <= '~') +#define ispunct(c) (((c) > ' ' && (c) <= '~') && !isalnum(c)) +#define isspace(c) ((c) == ' ' || (c) == '\f' || (c) == '\n' || (c) == '\r' || \ + (c) == '\t' || (c) == '\v') +#define isupper(c) ((c) >= 'A' && (c) <= 'Z') +#define isxdigit(c) (isxupper(c) || isxlower(c)) +#define isxlower(c) (isdigit(c) || (c >= 'a' && c <= 'f')) +#define isxupper(c) (isdigit(c) || (c >= 'A' && c <= 'F')) + // Misc functions typedef int cmp_t( const void *, const void * ); void qsort( void *a, size_t n, size_t es, cmp_t *cmp ); diff --git a/src/qcommon/q_shared.h b/src/qcommon/q_shared.h index 74957af4..8c61aa7d 100644 --- a/src/qcommon/q_shared.h +++ b/src/qcommon/q_shared.h @@ -90,11 +90,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA **********************************************************************/ -#ifdef Q3_VM - #include "../game/bg_lib.h" -#else +#ifndef Q3_VM #include <assert.h> #include <math.h> @@ -337,7 +335,7 @@ extern vec4_t colorMdGrey; extern vec4_t colorDkGrey; #define Q_COLOR_ESCAPE '^' -#define Q_IsColorString(p) ( p && *(p) == Q_COLOR_ESCAPE && *((p)+1) && *((p)+1) != Q_COLOR_ESCAPE ) +#define Q_IsColorString(p) ( p && *(p) == Q_COLOR_ESCAPE && *((p)+1) && isalnum(*((p)+1)) ) // ^[0-9a-zA-Z] #define COLOR_BLACK '0' #define COLOR_RED '1' |