diff options
author | Tim Angus <tim@ngus.net> | 2005-12-11 16:41:27 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2005-12-11 16:41:27 +0000 |
commit | 65b823bf367034c204d370a6a73965a196072153 (patch) | |
tree | b7473da41151546fad6252ec70ca14b92b77046d | |
parent | d28c9b3a4178a8d653dc479d385f60969c241bdb (diff) |
* Added trap_FS_GetFileList to cgame, so it's not longer necessary to hack
around it not being there
* Removed Q3 console notify code and improved cgame rendered notify area
* Sorted out pain blend texture coordinates
-rw-r--r-- | src/cgame/cg_draw.c | 73 | ||||
-rw-r--r-- | src/cgame/cg_local.h | 14 | ||||
-rw-r--r-- | src/cgame/cg_main.c | 58 | ||||
-rw-r--r-- | src/cgame/cg_particles.c | 26 | ||||
-rw-r--r-- | src/cgame/cg_public.h | 9 | ||||
-rw-r--r-- | src/cgame/cg_servercmds.c | 9 | ||||
-rw-r--r-- | src/cgame/cg_syscalls.asm | 2 | ||||
-rw-r--r-- | src/cgame/cg_syscalls.c | 10 | ||||
-rw-r--r-- | src/cgame/cg_trails.c | 29 | ||||
-rw-r--r-- | src/cgame/cg_view.c | 2 | ||||
-rw-r--r-- | src/client/cl_cgame.c | 17 | ||||
-rw-r--r-- | src/client/cl_console.c | 130 | ||||
-rw-r--r-- | src/client/client.h | 1 | ||||
-rw-r--r-- | src/game/bg_public.h | 3 | ||||
-rw-r--r-- | src/game/g_main.c | 35 | ||||
-rw-r--r-- | src/qcommon/cmd.c | 13 | ||||
-rw-r--r-- | src/qcommon/q_shared.h | 1 | ||||
-rw-r--r-- | src/qcommon/qcommon.h | 1 |
18 files changed, 180 insertions, 253 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index 126ad511..88d54293 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -3231,8 +3231,30 @@ static void CG_Draw2D( void ) CG_DrawCenterString( ); } -#define PAINBLEND_BORDER_W 0.15f -#define PAINBLEND_BORDER_H 0.07f +/* +=============== +CG_ScalePainBlendTCs +=============== +*/ +static void CG_ScalePainBlendTCs( float* s1, float *t1, float *s2, float *t2 ) +{ + *s1 -= 0.5f; + *t1 -= 0.5f; + *s2 -= 0.5f; + *t2 -= 0.5f; + + *s1 *= cg_painBlendZoom.value; + *t1 *= cg_painBlendZoom.value; + *s2 *= cg_painBlendZoom.value; + *t2 *= cg_painBlendZoom.value; + + *s1 += 0.5f; + *t1 += 0.5f; + *s2 += 0.5f; + *t2 += 0.5f; +} + +#define PAINBLEND_BORDER 0.15f /* =============== @@ -3246,6 +3268,7 @@ static void CG_PainBlend( void ) float damageAsFracOfMax; qhandle_t shader = cgs.media.viewBloodShader; float x, y, w, h; + float s1, t1, s2, t2; damage = cg.lastHealth - cg.snap->ps.stats[ STAT_HEALTH ]; @@ -3293,39 +3316,39 @@ static void CG_PainBlend( void ) //left x = 0.0f; y = 0.0f; - w = PAINBLEND_BORDER_W * 640.0f; h = 480.0f; + w = PAINBLEND_BORDER * 640.0f; h = 480.0f; CG_AdjustFrom640( &x, &y, &w, &h ); - trap_R_DrawStretchPic( x, y, w, h, - cg_painBlendZoom.value, cg_painBlendZoom.value, - cg_painBlendZoom.value + PAINBLEND_BORDER_W, 1.0f - cg_painBlendZoom.value, - shader ); + s1 = 0.0f; t1 = 0.0f; + s2 = PAINBLEND_BORDER; t2 = 1.0f; + CG_ScalePainBlendTCs( &s1, &t1, &s2, &t2 ); + trap_R_DrawStretchPic( x, y, w, h, s1, t1, s2, t2, shader ); //right - x = 640.0f - ( PAINBLEND_BORDER_W * 640.0f ); y = 0.0f; - w = PAINBLEND_BORDER_W * 640.0f; h = 480.0f; + x = 640.0f - ( PAINBLEND_BORDER * 640.0f ); y = 0.0f; + w = PAINBLEND_BORDER * 640.0f; h = 480.0f; CG_AdjustFrom640( &x, &y, &w, &h ); - trap_R_DrawStretchPic( x, y, w, h, - 1.0f - cg_painBlendZoom.value - PAINBLEND_BORDER_W, cg_painBlendZoom.value, - 1.0f - cg_painBlendZoom.value, 1.0f - cg_painBlendZoom.value, - shader ); + s1 = 1.0f - PAINBLEND_BORDER; t1 = 0.0f; + s2 = 1.0f; t2 =1.0f; + CG_ScalePainBlendTCs( &s1, &t1, &s2, &t2 ); + trap_R_DrawStretchPic( x, y, w, h, s1, t1, s2, t2, shader ); //top - x = PAINBLEND_BORDER_W * 640.0f; y = 0.0f; - w = 640.0f - ( 2 * PAINBLEND_BORDER_W * 640.0f ); h = PAINBLEND_BORDER_H * 480.0f; + x = PAINBLEND_BORDER * 640.0f; y = 0.0f; + w = 640.0f - ( 2 * PAINBLEND_BORDER * 640.0f ); h = PAINBLEND_BORDER * 480.0f; CG_AdjustFrom640( &x, &y, &w, &h ); - trap_R_DrawStretchPic( x, y, w, h, - cg_painBlendZoom.value + PAINBLEND_BORDER_W, cg_painBlendZoom.value, - 1.0f - cg_painBlendZoom.value - PAINBLEND_BORDER_W, cg_painBlendZoom.value + PAINBLEND_BORDER_H, - shader ); + s1 = PAINBLEND_BORDER; t1 = 0.0f; + s2 = 1.0f - PAINBLEND_BORDER; t2 = PAINBLEND_BORDER; + CG_ScalePainBlendTCs( &s1, &t1, &s2, &t2 ); + trap_R_DrawStretchPic( x, y, w, h, s1, t1, s2, t2, shader ); //bottom - x = PAINBLEND_BORDER_W * 640.0f; y = 480.0f - ( PAINBLEND_BORDER_H * 480.0f ); - w = 640.0f - ( 2 * PAINBLEND_BORDER_W * 640.0f ); h = PAINBLEND_BORDER_H * 480.0f; + x = PAINBLEND_BORDER * 640.0f; y = 480.0f - ( PAINBLEND_BORDER * 480.0f ); + w = 640.0f - ( 2 * PAINBLEND_BORDER * 640.0f ); h = PAINBLEND_BORDER * 480.0f; CG_AdjustFrom640( &x, &y, &w, &h ); - trap_R_DrawStretchPic( x, y, w, h, - cg_painBlendZoom.value + PAINBLEND_BORDER_W, 1.0f - cg_painBlendZoom.value - PAINBLEND_BORDER_H, - 1.0f - cg_painBlendZoom.value - PAINBLEND_BORDER_W, 1.0f - cg_painBlendZoom.value, - shader ); + s1 = PAINBLEND_BORDER; t1 = 1.0f - PAINBLEND_BORDER; + s2 = 1.0f - PAINBLEND_BORDER; t2 = 1.0f; + CG_ScalePainBlendTCs( &s1, &t1, &s2, &t2 ); + trap_R_DrawStretchPic( x, y, w, h, s1, t1, s2, t2, shader ); trap_R_SetColor( NULL ); } diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index 15e226f7..b88d8d0c 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -191,6 +191,8 @@ typedef struct attachment_s //====================================================================== //particle system stuff +#define MAX_PARTICLE_FILES 128 + #define MAX_PS_SHADER_FRAMES 32 #define MAX_PS_MODELS 8 #define MAX_EJECTORS_PER_SYSTEM 4 @@ -291,7 +293,7 @@ typedef struct baseParticle_s pLerpValues_t radius; pLerpValues_t alpha; pLerpValues_t rotation; - + qboolean dynamicLight; pLerpValues_t dLightRadius; byte dLightColor[ 3 ]; @@ -429,6 +431,8 @@ typedef struct particle_s //====================================================================== //trail system stuff +#define MAX_TRAIL_FILES 128 + #define MAX_BEAMS_PER_SYSTEM 4 #define MAX_BASETRAIL_SYSTEMS 64 @@ -1121,7 +1125,6 @@ typedef struct char consoleText[ MAX_CONSOLE_TEXT ]; consoleLine_t consoleLines[ MAX_CONSOLE_LINES ]; int numConsoleLines; - qboolean consoleValid; particleSystem_t *poisonCloudPS; @@ -1503,7 +1506,6 @@ extern vmCvar_t cg_debugRandom; const char *CG_ConfigString( int index ); const char *CG_Argv( int arg ); -void CG_TAUIConsole( const char *text ); void QDECL CG_Printf( const char *msg, ... ); void QDECL CG_Error( const char *msg, ... ); @@ -1521,7 +1523,8 @@ void CG_SetScoreSelection( void *menu ); void CG_BuildSpectatorString( void ); qboolean CG_FileExists( char *filename ); -void CG_RemoveConsoleLine( void ); +void CG_RemoveNotifyLine( void ); +void CG_AddNotifyText( void ); // @@ -1839,6 +1842,7 @@ void trap_Cvar_VariableStringBuffer( const char *var_name, char *buffer int trap_Argc( void ); void trap_Argv( int n, char *buffer, int bufferLength ); void trap_Args( char *buffer, int bufferLength ); +void trap_LiteralArgs( char *buffer, int bufferLength ); // filesystem access // returns length of file @@ -1847,6 +1851,8 @@ void trap_FS_Read( void *buffer, int len, fileHandle_t f ); void trap_FS_Write( const void *buffer, int len, fileHandle_t f ); void trap_FS_FCloseFile( fileHandle_t f ); void trap_FS_Seek( fileHandle_t f, long offset, fsOrigin_t origin ); // fsOrigin_t +int trap_FS_GetFileList( const char *path, const char *extension, + char *listbuf, int bufsize ); // add commands to the local console as if they were typed in // for map changing, etc. The command is not executed immediately, diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index 33febb02..a64d736a 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -60,6 +60,10 @@ long vmMain( long command, long arg0, long arg1, long arg2, long arg3, case CG_CONSOLE_COMMAND: return CG_ConsoleCommand( ); + case CG_CONSOLE_TEXT: + CG_AddNotifyText( ); + return 0; + case CG_DRAW_ACTIVE_FRAME: CG_DrawActiveFrame( arg0, arg1, arg2 ); return 0; @@ -330,7 +334,7 @@ static cvarTable_t cvarTable[ ] = { &cg_painBlendDownRate, "cg_painBlendDownRate", "0.5", 0 }, { &cg_painBlendMax, "cg_painBlendMax", "0.7", 0 }, { &cg_painBlendScale, "cg_painBlendScale", "7.0", 0 }, - { &cg_painBlendZoom, "cg_painBlendZoom", "0.18", 0 }, + { &cg_painBlendZoom, "cg_painBlendZoom", "0.65", 0 }, { &ui_currentClass, "ui_currentClass", "0", 0 }, { &ui_carriage, "ui_carriage", "", 0 }, @@ -470,7 +474,12 @@ int CG_LastAttacker( void ) return cg.snap->ps.persistant[ PERS_ATTACKER ]; } -void CG_RemoveConsoleLine( void ) +/* +================= +CG_RemoveNotifyLine +================= +*/ +void CG_RemoveNotifyLine( void ) { int i, offset, totalLength; @@ -491,20 +500,31 @@ void CG_RemoveConsoleLine( void ) cg.numConsoleLines--; } -//TA: team arena UI based console -void CG_TAUIConsole( const char *text ) +/* +================= +CG_AddNotifyText +================= +*/ +void CG_AddNotifyText( void ) { - if( cg.numConsoleLines == MAX_CONSOLE_LINES ) - CG_RemoveConsoleLine( ); + char buffer[ BIG_INFO_STRING ]; - if( cg.consoleValid ) + trap_LiteralArgs( buffer, BIG_INFO_STRING ); + + if( !buffer[ 0 ] ) { - strcat( cg.consoleText, text ); - cg.consoleLines[ cg.numConsoleLines ].time = cg.time; - cg.consoleLines[ cg.numConsoleLines ].length = strlen( text ); - cg.numConsoleLines++; + cg.consoleText[ 0 ] = '\0'; + cg.numConsoleLines = 0; + return; } + if( cg.numConsoleLines == MAX_CONSOLE_LINES ) + CG_RemoveNotifyLine( ); + + Q_strcat( cg.consoleText, MAX_CONSOLE_TEXT, buffer ); + cg.consoleLines[ cg.numConsoleLines ].time = cg.time; + cg.consoleLines[ cg.numConsoleLines ].length = strlen( buffer ); + cg.numConsoleLines++; } void QDECL CG_Printf( const char *msg, ... ) @@ -516,8 +536,6 @@ void QDECL CG_Printf( const char *msg, ... ) vsprintf( text, msg, argptr ); va_end( argptr ); - CG_TAUIConsole( text ); - trap_Print( text ); } @@ -553,18 +571,6 @@ void QDECL Com_Printf( const char *msg, ... ) { vsprintf (text, msg, argptr); va_end (argptr); - //TA: team arena UI based console - if( cg.numConsoleLines == MAX_CONSOLE_LINES ) - CG_RemoveConsoleLine( ); - - if( cg.consoleValid ) - { - strcat( cg.consoleText, text ); - cg.consoleLines[ cg.numConsoleLines ].time = cg.time; - cg.consoleLines[ cg.numConsoleLines ].length = strlen( text ); - cg.numConsoleLines++; - } - CG_Printf ("%s", text); } @@ -1791,8 +1797,6 @@ void CG_Init( int serverMessageNum, int serverCommandSequence, int clientNum ) trap_S_ClearLoopingSounds( qtrue ); - cg.consoleValid = qtrue; - trap_Cvar_Set( "ui_loading", "0" ); } diff --git a/src/cgame/cg_particles.c b/src/cgame/cg_particles.c index e3b01e84..e256f397 100644 --- a/src/cgame/cg_particles.c +++ b/src/cgame/cg_particles.c @@ -1699,8 +1699,10 @@ Load particle systems from .particle files */ void CG_LoadParticleSystems( void ) { - int i, j; - const char *s[ MAX_PARTICLE_FILES ]; + int i, j, numFiles, fileLen; + char fileList[ MAX_PARTICLE_FILES * MAX_QPATH ]; + char fileName[ MAX_QPATH ]; + char *filePtr; //clear out the old numBaseParticleSystems = 0; @@ -1727,17 +1729,17 @@ void CG_LoadParticleSystems( void ) //and bring in the new - for( i = 0; i < MAX_PARTICLE_FILES; i++ ) - { - s[ i ] = CG_ConfigString( CS_PARTICLE_FILES + i ); + numFiles = trap_FS_GetFileList( "scripts", ".particle", + fileList, MAX_PARTICLE_FILES * MAX_QPATH ); + filePtr = fileList; - if( strlen( s[ i ] ) > 0 ) - { - CG_Printf( "...loading '%s'\n", s[ i ] ); - CG_ParseParticleFile( s[ i ] ); - } - else - break; + for( i = 0; i < numFiles; i++, filePtr += fileLen + 1 ) + { + fileLen = strlen( filePtr ); + strcpy( fileName, "scripts/" ); + strcat( fileName, filePtr ); + CG_Printf( "...loading '%s'\n", fileName ); + CG_ParseParticleFile( fileName ); } //connect any child systems to their psHandle diff --git a/src/cgame/cg_public.h b/src/cgame/cg_public.h index ac68c9f7..aa0298a2 100644 --- a/src/cgame/cg_public.h +++ b/src/cgame/cg_public.h @@ -165,6 +165,8 @@ typedef enum CG_R_ADDPOLYSTOSCENE, CG_R_INPVS, CG_FS_SEEK, + CG_FS_GETFILELIST, + CG_LITERAL_ARGS, CG_MEMSET = 100, CG_MEMCPY, @@ -228,8 +230,13 @@ typedef enum CG_MOUSE_EVENT, // void (*CG_MouseEvent)( int dx, int dy ); - CG_EVENT_HANDLING + CG_EVENT_HANDLING, // void (*CG_EventHandling)(int type); + + CG_CONSOLE_TEXT + // void (*CG_ConsoleText)( void ); + // pass text that has been printed to the console to cgame + // use Cmd_Argc() / Cmd_Argv() to read it } cgameExport_t; //---------------------------------------------- diff --git a/src/cgame/cg_servercmds.c b/src/cgame/cg_servercmds.c index 4411998d..a2970c3c 100644 --- a/src/cgame/cg_servercmds.c +++ b/src/cgame/cg_servercmds.c @@ -1035,15 +1035,6 @@ static void CG_ServerCommand( void ) return; } - //enable G_Printfs from the server to appear in the TA console - if( !strcmp( cmd, "gprintf" ) ) - { - if( trap_Argc( ) == 2 ) - CG_TAUIConsole( CG_Argv( 1 ) ); - - return; - } - //the server has triggered a menu if( !strcmp( cmd, "servermenu" ) ) { diff --git a/src/cgame/cg_syscalls.asm b/src/cgame/cg_syscalls.asm index 9da1dade..ffa14c64 100644 --- a/src/cgame/cg_syscalls.asm +++ b/src/cgame/cg_syscalls.asm @@ -90,6 +90,8 @@ equ trap_GetEntityToken -87 equ trap_R_AddPolysToScene -88 equ trap_R_inPVS -89 equ trap_FS_Seek -90 +equ trap_FS_GetFileList -91 +equ trap_LiteralArgs -92 equ memset -101 equ memcpy -102 diff --git a/src/cgame/cg_syscalls.c b/src/cgame/cg_syscalls.c index bf9924f9..65a5e9c4 100644 --- a/src/cgame/cg_syscalls.c +++ b/src/cgame/cg_syscalls.c @@ -93,6 +93,11 @@ void trap_Args( char *buffer, int bufferLength ) syscall( CG_ARGS, buffer, bufferLength ); } +void trap_LiteralArgs( char *buffer, int bufferLength ) +{ + syscall( CG_LITERAL_ARGS, buffer, bufferLength ); +} + int trap_FS_FOpenFile( const char *qpath, fileHandle_t *f, fsMode_t mode ) { return syscall( CG_FS_FOPENFILE, qpath, f, mode ); @@ -118,6 +123,11 @@ void trap_FS_Seek( fileHandle_t f, long offset, fsOrigin_t origin ) syscall( CG_FS_SEEK, f, offset, origin ); } +int trap_FS_GetFileList( const char *path, const char *extension, char *listbuf, int bufsize ) +{ + return syscall( CG_FS_GETFILELIST, path, extension, listbuf, bufsize ); +} + void trap_SendConsoleCommand( const char *text ) { syscall( CG_SENDCONSOLECOMMAND, text ); diff --git a/src/cgame/cg_trails.c b/src/cgame/cg_trails.c index 9cc4ef1f..c8943ed8 100644 --- a/src/cgame/cg_trails.c +++ b/src/cgame/cg_trails.c @@ -1139,8 +1139,10 @@ Load trail system templates */ void CG_LoadTrailSystems( void ) { - int i; - /*const char *s[ MAX_TRAIL_FILES ];*/ + int i, numFiles, fileLen; + char fileList[ MAX_TRAIL_FILES * MAX_QPATH ]; + char fileName[ MAX_QPATH ]; + char *filePtr; //clear out the old numBaseTrailSystems = 0; @@ -1159,19 +1161,18 @@ void CG_LoadTrailSystems( void ) } //and bring in the new -/* for( i = 0; i < MAX_TRAIL_FILES; i++ ) - { - s[ i ] = CG_ConfigString( CS_TRAIL_FILES + i ); + numFiles = trap_FS_GetFileList( "scripts", ".trail", + fileList, MAX_TRAIL_FILES * MAX_QPATH ); + filePtr = fileList; - if( strlen( s[ i ] ) > 0 ) - { - CG_Printf( "...loading '%s'\n", s[ i ] ); - CG_ParseTrailFile( s[ i ] ); - } - else - break; - }*/ - CG_Printf( "trail.trail: %d\n", CG_ParseTrailFile( "scripts/trail.trail" ) ); + for( i = 0; i < numFiles; i++, filePtr += fileLen + 1 ) + { + fileLen = strlen( filePtr ); + strcpy( fileName, "scripts/" ); + strcat( fileName, filePtr ); + CG_Printf( "...loading '%s'\n", fileName ); + CG_ParseTrailFile( fileName ); + } } /* diff --git a/src/cgame/cg_view.c b/src/cgame/cg_view.c index 35eb91a2..edfc9896 100644 --- a/src/cgame/cg_view.c +++ b/src/cgame/cg_view.c @@ -1294,7 +1294,7 @@ void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView, qboolean demo //remove expired console lines if( cg.consoleLines[ 0 ].time + cg_consoleLatency.integer < cg.time && cg_consoleLatency.integer > 0 ) - CG_RemoveConsoleLine( ); + CG_RemoveNotifyLine( ); // update audio positions trap_S_Respatialize( cg.snap->ps.clientNum, cg.refdef.vieworg, cg.refdef.viewaxis, inwater ); diff --git a/src/client/cl_cgame.c b/src/client/cl_cgame.c index 87099923..38293518 100644 --- a/src/client/cl_cgame.c +++ b/src/client/cl_cgame.c @@ -444,6 +444,9 @@ long CL_CgameSystemCalls( long *args ) { case CG_ARGS: Cmd_ArgsBuffer( VMA(1), args[2] ); return 0; + case CG_LITERAL_ARGS: + Cmd_LiteralArgsBuffer( VMA(1), args[2] ); + return 0; case CG_FS_FOPENFILE: return FS_FOpenFileByMode( VMA(1), VMA(2), args[3] ); case CG_FS_READ: @@ -457,6 +460,8 @@ long CL_CgameSystemCalls( long *args ) { return 0; case CG_FS_SEEK: return FS_Seek( args[1], args[2], args[3] ); + case CG_FS_GETFILELIST: + return FS_GetFileList( VMA(1), VMA(2), VMA(3), args[4] ); case CG_SENDCONSOLECOMMAND: Cbuf_AddText( VMA(1) ); return 0; @@ -785,6 +790,18 @@ qboolean CL_GameCommand( void ) { return VM_Call( cgvm, CG_CONSOLE_COMMAND ); } +/* +==================== +CL_GameConsoleText +==================== +*/ +void CL_GameConsoleText( void ) { + if ( !cgvm ) { + return; + } + + VM_Call( cgvm, CG_CONSOLE_TEXT ); +} /* diff --git a/src/client/cl_console.c b/src/client/cl_console.c index 350dc604..27deb623 100644 --- a/src/client/cl_console.c +++ b/src/client/cl_console.c @@ -49,8 +49,6 @@ typedef struct { int vislines; // in scanlines - int times[NUM_CON_TIMES]; // cls.realtime time the line was generated - // for transparent notify lines vec4_t color; } console_t; @@ -59,7 +57,6 @@ extern console_t con; console_t con; cvar_t *con_conspeed; -cvar_t *con_notifytime; #define DEFAULT_CONSOLE_WIDTH 78 @@ -81,7 +78,6 @@ void Con_ToggleConsole_f (void) { Field_Clear( &g_consoleField ); g_consoleField.widthInChars = g_console_field_width; - Con_ClearNotify (); cls.keyCatchers ^= KEYCATCH_CONSOLE; } @@ -230,11 +226,8 @@ Con_ClearNotify ================ */ void Con_ClearNotify( void ) { - int i; - - for ( i = 0 ; i < NUM_CON_TIMES ; i++ ) { - con.times[i] = 0; - } + Cmd_TokenizeString( NULL ); + CL_GameConsoleText( ); } @@ -296,8 +289,6 @@ void Con_CheckResize (void) oldtotallines) * oldwidth + j]; } } - - Con_ClearNotify (); } con.current = con.totallines - 1; @@ -313,7 +304,6 @@ Con_Init void Con_Init (void) { int i; - con_notifytime = Cvar_Get ("con_notifytime", "3", 0); con_conspeed = Cvar_Get ("scr_conspeed", "3", 0); Field_Clear( &g_consoleField ); @@ -342,15 +332,6 @@ void Con_Linefeed (qboolean skipnotify) { int i; - // mark time for transparent overlay - if (con.current >= 0) - { - if (skipnotify) - con.times[con.current % NUM_CON_TIMES] = 0; - else - con.times[con.current % NUM_CON_TIMES] = cls.realtime; - } - con.x = 0; if (con.display == con.current) con.display++; @@ -373,7 +354,6 @@ void CL_ConsolePrint( char *txt ) { int c, l; int color; qboolean skipnotify = qfalse; // NERVE - SMF - int prev; // NERVE - SMF // TTimo - prefix for text that shows up in console but not in notify // backported from RTCW @@ -397,6 +377,12 @@ void CL_ConsolePrint( char *txt ) { con.initialized = qtrue; } + if( !skipnotify && !( cls.keyCatchers & KEYCATCH_CONSOLE ) ) { + // feed the text to cgame + Cmd_TokenizeString( txt ); + CL_GameConsoleText( ); + } + color = ColorIndex(COLOR_WHITE); while ( (c = *txt) != 0 ) { @@ -441,21 +427,6 @@ void CL_ConsolePrint( char *txt ) { break; } } - - - // mark time for transparent overlay - if (con.current >= 0) { - // NERVE - SMF - if ( skipnotify ) { - prev = con.current % NUM_CON_TIMES - 1; - if ( prev < 0 ) - prev = NUM_CON_TIMES - 1; - con.times[prev] = 0; - } - else - // -NERVE - SMF - con.times[con.current % NUM_CON_TIMES] = cls.realtime; - } } @@ -492,85 +463,6 @@ void Con_DrawInput (void) { SCREEN_WIDTH - 3 * SMALLCHAR_WIDTH, qtrue ); } - -/* -================ -Con_DrawNotify - -Draws the last few lines of output transparently over the game top -================ -*/ -void Con_DrawNotify (void) -{ - int x, v; - short *text; - int i; - int time; - int skip; - int currentColor; - - currentColor = 7; - re.SetColor( g_color_table[currentColor] ); - - v = 0; - for (i= con.current-NUM_CON_TIMES+1 ; i<=con.current ; i++) - { - if (i < 0) - continue; - time = con.times[i % NUM_CON_TIMES]; - if (time == 0) - continue; - time = cls.realtime - time; - if (time > con_notifytime->value*1000) - continue; - text = con.text + (i % con.totallines)*con.linewidth; - - if (cl.snap.ps.pm_type != PM_INTERMISSION && cls.keyCatchers & (KEYCATCH_UI | KEYCATCH_CGAME) ) { - continue; - } - - for (x = 0 ; x < con.linewidth ; x++) { - if ( ( text[x] & 0xff ) == ' ' ) { - continue; - } - if ( ( (text[x]>>8)&7 ) != currentColor ) { - currentColor = (text[x]>>8)&7; - re.SetColor( g_color_table[currentColor] ); - } - SCR_DrawSmallChar( cl_conXOffset->integer + con.xadjust + (x+1)*SMALLCHAR_WIDTH, v, text[x] & 0xff ); - } - - v += SMALLCHAR_HEIGHT; - } - - re.SetColor( NULL ); - - if (cls.keyCatchers & (KEYCATCH_UI | KEYCATCH_CGAME) ) { - return; - } - - // draw the chat line - if ( cls.keyCatchers & KEYCATCH_MESSAGE ) - { - if (chat_team) - { - SCR_DrawBigString (8, v, "say_team:", 1.0f ); - skip = 11; - } - else - { - SCR_DrawBigString (8, v, "say:", 1.0f ); - skip = 5; - } - - Field_BigDraw( &chatField, skip * BIGCHAR_WIDTH, v, - SCREEN_WIDTH - ( skip + 1 ) * BIGCHAR_WIDTH, qtrue ); - - v += BIGCHAR_HEIGHT; - } - -} - /* ================ Con_DrawSolidConsole @@ -707,11 +599,6 @@ void Con_DrawConsole( void ) { if ( con.displayFrac ) { Con_DrawSolidConsole( con.displayFrac ); - } else { - // draw notify lines - if ( cls.state == CA_ACTIVE ) { - Con_DrawNotify (); - } } } @@ -780,7 +667,6 @@ void Con_Close( void ) { return; } Field_Clear( &g_consoleField ); - Con_ClearNotify (); cls.keyCatchers &= ~KEYCATCH_CONSOLE; con.finalFrac = 0; // none visible con.displayFrac = 0; diff --git a/src/client/client.h b/src/client/client.h index dab92159..eff15d51 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -497,6 +497,7 @@ void CIN_CloseAllVideos(void); void CL_InitCGame( void ); void CL_ShutdownCGame( void ); qboolean CL_GameCommand( void ); +void CL_GameConsoleText( void ); void CL_CGameRendering( stereoFrame_t stereo ); void CL_SetCGameTime( void ); void CL_FirstSnapshot( void ); diff --git a/src/game/bg_public.h b/src/game/bg_public.h index 883d1a54..2b713951 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -83,9 +83,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define CS_PLAYERS (CS_PARTICLE_SYSTEMS+MAX_GAME_PARTICLE_SYSTEMS) #define CS_PRECACHES (CS_PLAYERS+MAX_CLIENTS) #define CS_LOCATIONS (CS_PRECACHES+MAX_CLIENTS) -#define CS_PARTICLE_FILES (CS_LOCATIONS+MAX_LOCATIONS) -#define CS_MAX (CS_PARTICLE_FILES+MAX_PARTICLE_FILES) +#define CS_MAX (CS_LOCATIONS+MAX_LOCATIONS) #if (CS_MAX) > MAX_CONFIGSTRINGS #error overflow: (CS_MAX) > MAX_CONFIGSTRINGS diff --git a/src/game/g_main.c b/src/game/g_main.c index d1dbb845..bc3513a5 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -269,18 +269,11 @@ void QDECL G_Printf( const char *fmt, ... ) { va_list argptr; char text[ 1024 ]; - char clientText[ 1048 ]; va_start( argptr, fmt ); vsprintf( text, fmt, argptr ); va_end( argptr ); - if( !g_dedicated.integer ) - { - Com_sprintf( clientText, 1048, "gprintf \"%s\"", text ); - G_SendCommandFromServer( -1, clientText ); - } - trap_Printf( text ); } @@ -434,33 +427,6 @@ void G_UpdateCvars( void ) } -/* -=============== -G_GenerateParticleFileList - -Make a list of particle files for each client to parse since fsr -the client does not have trap_FS_GetFileList -=============== -*/ -static void G_GenerateParticleFileList( void ) -{ - int i, numFiles, fileLen; - char fileList[ MAX_PARTICLE_FILES * MAX_QPATH ]; - char fileName[ MAX_QPATH ]; - char *filePtr; - - numFiles = trap_FS_GetFileList( "scripts", ".particle", fileList, MAX_PARTICLE_FILES * MAX_QPATH ); - filePtr = fileList; - - for( i = 0; i < numFiles; i++, filePtr += fileLen + 1 ) - { - fileLen = strlen( filePtr ); - strcpy( fileName, "scripts/" ); - strcat( fileName, filePtr ); - trap_SetConfigstring( CS_PARTICLE_FILES + i, fileName ); - } -} - typedef struct gameElements_s { buildable_t buildables[ BA_NUM_BUILDABLES ]; @@ -655,7 +621,6 @@ void G_InitGame( int levelTime, int randomSeed, int restart ) BG_InitClassOverrides( ); BG_InitBuildableOverrides( ); G_InitDamageLocations( ); - G_GenerateParticleFileList( ); G_InitMapRotations( ); G_InitSpawnQueue( &level.alienSpawnQueue ); G_InitSpawnQueue( &level.humanSpawnQueue ); diff --git a/src/qcommon/cmd.c b/src/qcommon/cmd.c index eb52e3f6..2968f708 100644 --- a/src/qcommon/cmd.c +++ b/src/qcommon/cmd.c @@ -416,6 +416,18 @@ void Cmd_ArgsBuffer( char *buffer, int bufferLength ) { /* ============ +Cmd_LiteralArgsBuffer + +The interpreted versions use this because +they can't have pointers returned to them +============ +*/ +void Cmd_LiteralArgsBuffer( char *buffer, int bufferLength ) { + Q_strncpyz( buffer, cmd_cmd, bufferLength ); +} + +/* +============ Cmd_Cmd Retrieve the unmodified command string @@ -451,6 +463,7 @@ void Cmd_TokenizeString( const char *text_in ) { // clear previous args cmd_argc = 0; + cmd_cmd[ 0 ] = '\0'; if ( !text_in ) { return; diff --git a/src/qcommon/q_shared.h b/src/qcommon/q_shared.h index 1c392f2c..737b9f0e 100644 --- a/src/qcommon/q_shared.h +++ b/src/qcommon/q_shared.h @@ -918,7 +918,6 @@ typedef enum { #define MAX_SOUNDS 256 // so they cannot be blindly increased #define MAX_GAME_SHADERS 64 #define MAX_GAME_PARTICLE_SYSTEMS 64 -#define MAX_PARTICLE_FILES 128 //FIXME #define MAX_CONFIGSTRINGS 1024 diff --git a/src/qcommon/qcommon.h b/src/qcommon/qcommon.h index c0c3925e..11c332ce 100644 --- a/src/qcommon/qcommon.h +++ b/src/qcommon/qcommon.h @@ -410,6 +410,7 @@ void Cmd_ArgvBuffer( int arg, char *buffer, int bufferLength ); char *Cmd_Args (void); char *Cmd_ArgsFrom( int arg ); void Cmd_ArgsBuffer( char *buffer, int bufferLength ); +void Cmd_LiteralArgsBuffer( char *buffer, int bufferLength ); char *Cmd_Cmd (void); // The functions that execute commands get their parameters with these // functions. Cmd_Argv () will return an empty string, not a NULL |