From 3ac0cab7a7a47a07b71755c59bab24e0b70088bd Mon Sep 17 00:00:00 2001 From: tma Date: Thu, 23 Aug 2007 00:22:20 +0000 Subject: * (bug 3076) Map cycle breaks on empty or bot only servers (misanthropia) * (bug 3303) Removal of never compiled code from cgame drawing functions (beast ) * (bug 3297) Add missing limit to Q3 UI server info (beast ) * (bug 3029) Fix to shader hash table being overpopulated (identified by Stefan "#@" Langer ) git-svn-id: svn://svn.icculus.org/quake3/trunk@1129 edf5b092-35ff-0310-97b2-ce42778d08ea --- code/cgame/cg_draw.c | 54 +---------------------------- code/game/g_main.c | 25 ++++++++------ code/q3_ui/ui_serverinfo.c | 5 +-- code/renderer/tr_shader.c | 84 ++++++++++++++++++---------------------------- 4 files changed, 52 insertions(+), 116 deletions(-) (limited to 'code') diff --git a/code/cgame/cg_draw.c b/code/cgame/cg_draw.c index 59219ef..b4fe564 100644 --- a/code/cgame/cg_draw.c +++ b/code/cgame/cg_draw.c @@ -530,9 +530,7 @@ static void CG_DrawStatusBar( void ) { vec4_t hcolor; vec3_t angles; vec3_t origin; -#ifdef MISSIONPACK - qhandle_t handle; -#endif + static float colors[4][4] = { // { 0.2, 1.0, 0.2, 1.0 } , { 1.0, 0.2, 0.2, 1.0 }, {0.5, 0.5, 0.5, 1} }; { 1.0f, 0.69f, 0.0f, 1.0f }, // normal @@ -580,20 +578,6 @@ static void CG_DrawStatusBar( void ) { CG_Draw3DModel( 370 + CHAR_WIDTH*3 + TEXT_ICON_SPACE, 432, ICON_SIZE, ICON_SIZE, cgs.media.armorModel, 0, origin, angles ); } -#ifdef MISSIONPACK - if( cgs.gametype == GT_HARVESTER ) { - origin[0] = 90; - origin[1] = 0; - origin[2] = -10; - angles[YAW] = ( cg.time & 2047 ) * 360 / 2048.0; - if( cg.snap->ps.persistant[PERS_TEAM] == TEAM_BLUE ) { - handle = cgs.media.redCubeModel; - } else { - handle = cgs.media.blueCubeModel; - } - CG_Draw3DModel( 640 - (TEXT_ICON_SPACE + ICON_SIZE), 416, ICON_SIZE, ICON_SIZE, handle, 0, origin, angles ); - } -#endif // // ammo // @@ -663,29 +647,6 @@ static void CG_DrawStatusBar( void ) { } } -#ifdef MISSIONPACK - // - // cubes - // - if( cgs.gametype == GT_HARVESTER ) { - value = ps->generic1; - if( value > 99 ) { - value = 99; - } - trap_R_SetColor( colors[0] ); - CG_DrawField (640 - (CHAR_WIDTH*2 + TEXT_ICON_SPACE + ICON_SIZE), 432, 2, value); - trap_R_SetColor( NULL ); - // if we didn't draw a 3D icon, draw a 2D icon for armor - if ( !cg_draw3dIcons.integer && cg_drawIcons.integer ) { - if( cg.snap->ps.persistant[PERS_TEAM] == TEAM_BLUE ) { - handle = cgs.media.redCubeIcon; - } else { - handle = cgs.media.blueCubeIcon; - } - CG_DrawPic( 640 - (TEXT_ICON_SPACE + ICON_SIZE), 432, ICON_SIZE, ICON_SIZE, handle ); - } - } -#endif } #endif @@ -1122,19 +1083,6 @@ static float CG_DrawScores( float y ) { } } -#ifdef MISSIONPACK - if ( cgs.gametype == GT_1FCTF ) { - // Display flag status - item = BG_FindItemForPowerup( PW_NEUTRALFLAG ); - - if (item) { - y1 = y - BIGCHAR_HEIGHT - 8; - if( cgs.flagStatus >= 0 && cgs.flagStatus <= 3 ) { - CG_DrawPic( x, y1-4, w, BIGCHAR_HEIGHT+8, cgs.media.flagShader[cgs.flagStatus] ); - } - } - } -#endif if ( cgs.gametype >= GT_CTF ) { v = cgs.capturelimit; } else { diff --git a/code/game/g_main.c b/code/game/g_main.c index 62f3e86..f369ffc 100644 --- a/code/game/g_main.c +++ b/code/game/g_main.c @@ -1189,7 +1189,7 @@ wait 10 seconds before going on. ================= */ void CheckIntermissionExit( void ) { - int ready, notReady; + int ready, notReady, playerCount; int i; gclient_t *cl; int readyMask; @@ -1202,6 +1202,7 @@ void CheckIntermissionExit( void ) { ready = 0; notReady = 0; readyMask = 0; + playerCount = 0; for (i=0 ; i< g_maxclients.integer ; i++) { cl = level.clients + i; if ( cl->pers.connected != CON_CONNECTED ) { @@ -1211,6 +1212,7 @@ void CheckIntermissionExit( void ) { continue; } + playerCount++; if ( cl->readyToExit ) { ready++; if ( i < 16 ) { @@ -1236,16 +1238,19 @@ void CheckIntermissionExit( void ) { return; } - // if nobody wants to go, clear timer - if ( !ready ) { - level.readyToExit = qfalse; - return; - } + // only test ready status when there are real players present + if ( playerCount > 0 ) { + // if nobody wants to go, clear timer + if ( !ready ) { + level.readyToExit = qfalse; + return; + } - // if everyone wants to go, go now - if ( !notReady ) { - ExitLevel(); - return; + // if everyone wants to go, go now + if ( !notReady ) { + ExitLevel(); + return; + } } // the first person to ready starts the ten second timeout diff --git a/code/q3_ui/ui_serverinfo.c b/code/q3_ui/ui_serverinfo.c index 065b957..8cde1cc 100644 --- a/code/q3_ui/ui_serverinfo.c +++ b/code/q3_ui/ui_serverinfo.c @@ -128,11 +128,11 @@ static void ServerInfo_MenuDraw( void ) const char *s; char key[MAX_INFO_KEY]; char value[MAX_INFO_VALUE]; - int y; + int i = 0, y; y = SCREEN_HEIGHT/2 - s_serverinfo.numlines*(SMALLCHAR_HEIGHT)/2 - 20; s = s_serverinfo.info; - while ( s ) { + while ( s && i < s_serverinfo.numlines ) { Info_NextPair( &s, key, value ); if ( !key[0] ) { break; @@ -144,6 +144,7 @@ static void ServerInfo_MenuDraw( void ) UI_DrawString(SCREEN_WIDTH*0.50 + 8,y,value,UI_LEFT|UI_SMALLFONT,text_color_normal); y += SMALLCHAR_HEIGHT; + i++; } Menu_Draw( &s_serverinfo.menu ); diff --git a/code/renderer/tr_shader.c b/code/renderer/tr_shader.c index 7e4fc2a..edcf2bc 100644 --- a/code/renderer/tr_shader.c +++ b/code/renderer/tr_shader.c @@ -2866,27 +2866,27 @@ static void ScanAndLoadShaderFiles( void ) char **shaderFiles; char *buffers[MAX_SHADER_FILES]; char *p; - int numShaders; + int numShaderFiles; int i; char *oldp, *token, *hashMem; int shaderTextHashTableSizes[MAX_SHADERTEXT_HASH], hash, size; long sum = 0; // scan for shader files - shaderFiles = ri.FS_ListFiles( "scripts", ".shader", &numShaders ); + shaderFiles = ri.FS_ListFiles( "scripts", ".shader", &numShaderFiles ); - if ( !shaderFiles || !numShaders ) + if ( !shaderFiles || !numShaderFiles ) { ri.Printf( PRINT_WARNING, "WARNING: no shader files found\n" ); return; } - if ( numShaders > MAX_SHADER_FILES ) { - numShaders = MAX_SHADER_FILES; + if ( numShaderFiles > MAX_SHADER_FILES ) { + numShaderFiles = MAX_SHADER_FILES; } // load and parse shader files - for ( i = 0; i < numShaders; i++ ) + for ( i = 0; i < numShaderFiles; i++ ) { char filename[MAX_QPATH]; @@ -2899,16 +2899,16 @@ static void ScanAndLoadShaderFiles( void ) } // build single large buffer - s_shaderText = ri.Hunk_Alloc( sum + numShaders*2, h_low ); + s_shaderText = ri.Hunk_Alloc( sum + numShaderFiles*2, h_low ); + s_shaderText[ 0 ] = '\0'; // free in reverse order, so the temp files are all dumped - for ( i = numShaders - 1; i >= 0 ; i-- ) { - strcat( s_shaderText, "\n" ); + for ( i = numShaderFiles - 1; i >= 0 ; i-- ) { p = &s_shaderText[strlen(s_shaderText)]; strcat( s_shaderText, buffers[i] ); ri.FS_FreeFile( buffers[i] ); - buffers[i] = p; COM_Compress(p); + strcat( s_shaderText, "\n" ); } // free up memory @@ -2916,28 +2916,19 @@ static void ScanAndLoadShaderFiles( void ) Com_Memset(shaderTextHashTableSizes, 0, sizeof(shaderTextHashTableSizes)); size = 0; - // - for ( i = 0; i < numShaders; i++ ) { - // pointer to the first shader file - p = buffers[i]; - // look for label - while ( 1 ) { - token = COM_ParseExt( &p, qtrue ); - if ( token[0] == 0 ) { - break; - } - hash = generateHashValue(token, MAX_SHADERTEXT_HASH); - shaderTextHashTableSizes[hash]++; - size++; - SkipBracedSection(&p); - // if we passed the pointer to the next shader file - if ( i < numShaders - 1 ) { - if ( p > buffers[i+1] ) { - break; - } - } + p = s_shaderText; + // look for shader names + while ( 1 ) { + token = COM_ParseExt( &p, qtrue ); + if ( token[0] == 0 ) { + break; } + + hash = generateHashValue(token, MAX_SHADERTEXT_HASH); + shaderTextHashTableSizes[hash]++; + size++; + SkipBracedSection(&p); } size += MAX_SHADERTEXT_HASH; @@ -2950,29 +2941,20 @@ static void ScanAndLoadShaderFiles( void ) } Com_Memset(shaderTextHashTableSizes, 0, sizeof(shaderTextHashTableSizes)); - // - for ( i = 0; i < numShaders; i++ ) { - // pointer to the first shader file - p = buffers[i]; - // look for label - while ( 1 ) { - oldp = p; - token = COM_ParseExt( &p, qtrue ); - if ( token[0] == 0 ) { - break; - } - - hash = generateHashValue(token, MAX_SHADERTEXT_HASH); - shaderTextHashTable[hash][shaderTextHashTableSizes[hash]++] = oldp; - SkipBracedSection(&p); - // if we passed the pointer to the next shader file - if ( i < numShaders - 1 ) { - if ( p > buffers[i+1] ) { - break; - } - } + p = s_shaderText; + // look for shader names + while ( 1 ) { + oldp = p; + token = COM_ParseExt( &p, qtrue ); + if ( token[0] == 0 ) { + break; } + + hash = generateHashValue(token, MAX_SHADERTEXT_HASH); + shaderTextHashTable[hash][shaderTextHashTableSizes[hash]++] = oldp; + + SkipBracedSection(&p); } return; -- cgit v1.2.3