diff options
Diffstat (limited to 'src/cgame')
-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 |
10 files changed, 139 insertions, 93 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 ); |