codemp/cgame/cg_scoreboard.c

Go to the documentation of this file.
00001 // Copyright (C) 1999-2000 Id Software, Inc.
00002 //
00003 // cg_scoreboard -- draw the scoreboard on top of the game screen
00004 #include "cg_local.h"
00005 #include "../ui/ui_shared.h"
00006 #include "../game/bg_saga.h"
00007 
00008 #define SCOREBOARD_X            (0)
00009 
00010 #define SB_HEADER                       86
00011 #define SB_TOP                          (SB_HEADER+32)
00012 
00013 // Where the status bar starts, so we don't overwrite it
00014 #define SB_STATUSBAR            420
00015 
00016 #define SB_NORMAL_HEIGHT        25
00017 #define SB_INTER_HEIGHT         15 // interleaved height
00018 
00019 #define SB_MAXCLIENTS_NORMAL  ((SB_STATUSBAR - SB_TOP) / SB_NORMAL_HEIGHT)
00020 #define SB_MAXCLIENTS_INTER   ((SB_STATUSBAR - SB_TOP) / SB_INTER_HEIGHT - 1)
00021 
00022 // Used when interleaved
00023 
00024 
00025 
00026 #define SB_LEFT_BOTICON_X       (SCOREBOARD_X+0)
00027 #define SB_LEFT_HEAD_X          (SCOREBOARD_X+32)
00028 #define SB_RIGHT_BOTICON_X      (SCOREBOARD_X+64)
00029 #define SB_RIGHT_HEAD_X         (SCOREBOARD_X+96)
00030 // Normal
00031 #define SB_BOTICON_X            (SCOREBOARD_X+32)
00032 #define SB_HEAD_X                       (SCOREBOARD_X+64)
00033 
00034 #define SB_SCORELINE_X          100
00035 #define SB_SCORELINE_WIDTH      (640 - SB_SCORELINE_X * 2)
00036 
00037 #define SB_RATING_WIDTH     0 // (6 * BIGCHAR_WIDTH)
00038 #define SB_NAME_X                       (SB_SCORELINE_X)
00039 #define SB_SCORE_X                      (SB_SCORELINE_X + .55 * SB_SCORELINE_WIDTH)
00040 #define SB_PING_X                       (SB_SCORELINE_X + .70 * SB_SCORELINE_WIDTH)
00041 #define SB_TIME_X                       (SB_SCORELINE_X + .85 * SB_SCORELINE_WIDTH)
00042 
00043 // The new and improved score board
00044 //
00045 // In cases where the number of clients is high, the score board heads are interleaved
00046 // here's the layout
00047 
00048 //
00049 //      0   32   80  112  144   240  320  400   <-- pixel position
00050 //  bot head bot head score ping time name
00051 //  
00052 //  wins/losses are drawn on bot icon now
00053 
00054 static qboolean localClient; // true if local client has been displayed
00055 
00056 
00057                                                          /*
00058 =================
00059 CG_DrawScoreboard
00060 =================
00061 */
00062 static void CG_DrawClientScore( int y, score_t *score, float *color, float fade, qboolean largeFormat ) 
00063 {
00064         //vec3_t        headAngles;
00065         clientInfo_t    *ci;
00066         int iconx, headx;
00067         float           scale;
00068 
00069         if ( largeFormat )
00070         {
00071                 scale = 1.0f;
00072         }
00073         else
00074         {
00075                 scale = 0.75f;
00076         }
00077 
00078         if ( score->client < 0 || score->client >= cgs.maxclients ) {
00079                 Com_Printf( "Bad score->client: %i\n", score->client );
00080                 return;
00081         }
00082         
00083         ci = &cgs.clientinfo[score->client];
00084 
00085         iconx = SB_BOTICON_X + (SB_RATING_WIDTH / 2);
00086         headx = SB_HEAD_X + (SB_RATING_WIDTH / 2);
00087 
00088         // draw the handicap or bot skill marker (unless player has flag)
00089         if ( ci->powerups & ( 1 << PW_NEUTRALFLAG ) )
00090         {
00091                 if( largeFormat )
00092                 {
00093                         CG_DrawFlagModel( iconx, y - ( 32 - BIGCHAR_HEIGHT ) / 2, 32, 32, TEAM_FREE, qfalse );
00094                 }
00095                 else
00096                 {
00097                         CG_DrawFlagModel( iconx, y, 16, 16, TEAM_FREE, qfalse );
00098                 }
00099         }
00100         else if ( ci->powerups & ( 1 << PW_REDFLAG ) )
00101         {
00102                 if( largeFormat )
00103                 {
00104                         CG_DrawFlagModel( iconx*cgs.screenXScale, y*cgs.screenYScale, 32*cgs.screenXScale, 32*cgs.screenYScale, TEAM_RED, qfalse );
00105                 }
00106                 else
00107                 {
00108                         CG_DrawFlagModel( iconx*cgs.screenXScale, y*cgs.screenYScale, 32*cgs.screenXScale, 32*cgs.screenYScale, TEAM_RED, qfalse );
00109                 }
00110         }
00111         else if ( ci->powerups & ( 1 << PW_BLUEFLAG ) )
00112         {
00113                 if( largeFormat )
00114                 {
00115                         CG_DrawFlagModel( iconx*cgs.screenXScale, y*cgs.screenYScale, 32*cgs.screenXScale, 32*cgs.screenYScale, TEAM_BLUE, qfalse );
00116                 }
00117                 else
00118                 {
00119                         CG_DrawFlagModel( iconx*cgs.screenXScale, y*cgs.screenYScale, 32*cgs.screenXScale, 32*cgs.screenYScale, TEAM_BLUE, qfalse );
00120                 }
00121         }
00122         else if (cgs.gametype == GT_POWERDUEL &&
00123                 (ci->duelTeam == DUELTEAM_LONE || ci->duelTeam == DUELTEAM_DOUBLE))
00124         {
00125                 if (ci->duelTeam == DUELTEAM_LONE)
00126                 {
00127                         CG_DrawPic ( iconx, y, 32, 32, trap_R_RegisterShaderNoMip ( "gfx/mp/pduel_icon_lone" ) );
00128                 }
00129                 else
00130                 {
00131                         CG_DrawPic ( iconx, y, 32, 32, trap_R_RegisterShaderNoMip ( "gfx/mp/pduel_icon_double" ) );
00132                 }
00133         }
00134         else if (cgs.gametype == GT_SIEGE)
00135         { //try to draw the shader for this class on the scoreboard
00136                 if (ci->siegeIndex != -1)
00137                 {
00138                         siegeClass_t *scl = &bgSiegeClasses[ci->siegeIndex];
00139 
00140                         if (scl->classShader)
00141                         {
00142                                 CG_DrawPic (iconx, y, largeFormat?24:12, largeFormat?24:12, scl->classShader);
00143                         }
00144                 }
00145         }
00146         else
00147         {
00148                 // draw the wins / losses
00149                 /*
00150                 if ( cgs.gametype == GT_DUEL || cgs.gametype == GT_POWERDUEL ) 
00151                 {
00152                         CG_DrawSmallStringColor( iconx, y + SMALLCHAR_HEIGHT/2, va("%i/%i", ci->wins, ci->losses ), color );
00153                 }
00154                 */
00155                 //rww - in duel, we now show wins/losses in place of "frags". This is because duel now defaults to 1 kill per round.
00156         }
00157 
00158         // highlight your position
00159         if ( score->client == cg.snap->ps.clientNum ) 
00160         {
00161                 float   hcolor[4];
00162                 int             rank;
00163 
00164                 localClient = qtrue;
00165 
00166                 if ( cg.snap->ps.persistant[PERS_TEAM] == TEAM_SPECTATOR 
00167                         || cgs.gametype >= GT_TEAM ) {
00168                         rank = -1;
00169                 } else {
00170                         rank = cg.snap->ps.persistant[PERS_RANK] & ~RANK_TIED_FLAG;
00171                 }
00172                 if ( rank == 0 ) {
00173                         hcolor[0] = 0;
00174                         hcolor[1] = 0;
00175                         hcolor[2] = 0.7f;
00176                 } else if ( rank == 1 ) {
00177                         hcolor[0] = 0.7f;
00178                         hcolor[1] = 0;
00179                         hcolor[2] = 0;
00180                 } else if ( rank == 2 ) {
00181                         hcolor[0] = 0.7f;
00182                         hcolor[1] = 0.7f;
00183                         hcolor[2] = 0;
00184                 } else {
00185                         hcolor[0] = 0.7f;
00186                         hcolor[1] = 0.7f;
00187                         hcolor[2] = 0.7f;
00188                 }
00189 
00190                 hcolor[3] = fade * 0.7;
00191                 CG_FillRect( SB_SCORELINE_X - 5, y + 2, 640 - SB_SCORELINE_X * 2 + 10, largeFormat?SB_NORMAL_HEIGHT:SB_INTER_HEIGHT, hcolor );
00192         }
00193 
00194         CG_Text_Paint (SB_NAME_X, y, 0.9f * scale, colorWhite, ci->name,0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM );
00195 
00196         if ( score->ping != -1 )
00197         {
00198                 if ( ci->team != TEAM_SPECTATOR || cgs.gametype == GT_DUEL || cgs.gametype == GT_POWERDUEL )
00199                 {
00200                         if (cgs.gametype == GT_DUEL || cgs.gametype == GT_POWERDUEL)
00201                         {
00202                                 CG_Text_Paint (SB_SCORE_X, y, 1.0f * scale, colorWhite, va("%i/%i", ci->wins, ci->losses),0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_SMALL );
00203                         }
00204                         else
00205                         {
00206                                 CG_Text_Paint (SB_SCORE_X, y, 1.0f * scale, colorWhite, va("%i", score->score),0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_SMALL );
00207                         }
00208                 }
00209 
00210                 CG_Text_Paint (SB_PING_X, y, 1.0f * scale, colorWhite, va("%i", score->ping),0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_SMALL );       
00211                 CG_Text_Paint (SB_TIME_X, y, 1.0f * scale, colorWhite, va("%i", score->time),0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_SMALL );               
00212         }
00213         else
00214         {
00215                 CG_Text_Paint (SB_SCORE_X, y, 1.0f * scale, colorWhite, "-",0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_SMALL );
00216                 CG_Text_Paint (SB_PING_X, y, 1.0f * scale, colorWhite, "-",0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_SMALL ); 
00217                 CG_Text_Paint (SB_TIME_X, y, 1.0f * scale, colorWhite, "-",0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_SMALL );
00218         }
00219 
00220         // add the "ready" marker for intermission exiting
00221         if ( cg.snap->ps.stats[ STAT_CLIENTS_READY ] & ( 1 << score->client ) ) 
00222         {
00223                 CG_Text_Paint (SB_NAME_X - 64, y + 2, 0.7f * scale, colorWhite, CG_GetStringEdString("MP_INGAME", "READY"),0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM );
00224         }
00225 }
00226 
00227 /*
00228 =================
00229 CG_TeamScoreboard
00230 =================
00231 */
00232 static int CG_TeamScoreboard( int y, team_t team, float fade, int maxClients, int lineHeight, qboolean countOnly ) 
00233 {
00234         int             i;
00235         score_t *score;
00236         float   color[4];
00237         int             count;
00238         clientInfo_t    *ci;
00239 
00240         color[0] = color[1] = color[2] = 1.0;
00241         color[3] = fade;
00242 
00243         count = 0;
00244         for ( i = 0 ; i < cg.numScores && count < maxClients ; i++ ) {
00245                 score = &cg.scores[i];
00246                 ci = &cgs.clientinfo[ score->client ];
00247 
00248                 if ( team != ci->team ) {
00249                         continue;
00250                 }
00251 
00252                 if ( !countOnly )
00253                 {
00254                         CG_DrawClientScore( y + lineHeight * count, score, color, fade, lineHeight == SB_NORMAL_HEIGHT );
00255                 }
00256 
00257                 count++;
00258         }
00259 
00260         return count;
00261 }
00262 
00263 int     CG_GetClassCount(team_t team,int siegeClass )
00264 {
00265         int i = 0;
00266         int count = 0;
00267         clientInfo_t    *ci;
00268         siegeClass_t *scl;
00269 
00270         for ( i = 0 ; i < cgs.maxclients ; i++ )
00271         {
00272                 ci = &cgs.clientinfo[ i ];
00273 
00274                 if ((!ci->infoValid) || ( team != ci->team ))
00275                 {
00276                         continue;
00277                 }
00278 
00279                 scl = &bgSiegeClasses[ci->siegeIndex];
00280 
00281                 // Correct class?
00282                 if ( siegeClass != scl->classShader )
00283                 {
00284                         continue;
00285                 }
00286 
00287                 count++;
00288         }
00289 
00290         return count;
00291 
00292 }
00293 
00294 int CG_GetTeamNonScoreCount(team_t team)
00295 {
00296         int i = 0,count=0;
00297         clientInfo_t    *ci;
00298 
00299         for ( i = 0 ; i < cgs.maxclients ; i++ )
00300         {
00301                 ci = &cgs.clientinfo[ i ];
00302 
00303                 if ( (!ci->infoValid) || (team != ci->team && team != ci->siegeDesiredTeam) )
00304                 {
00305                         continue;
00306                 }
00307 
00308                 count++;
00309         }
00310 
00311         return count;
00312 }
00313 
00314 int CG_GetTeamCount(team_t team, int maxClients)
00315 {
00316         int i = 0;
00317         int count = 0;
00318         clientInfo_t    *ci;
00319         score_t *score;
00320 
00321         for ( i = 0 ; i < cg.numScores && count < maxClients ; i++ )
00322         {
00323                 score = &cg.scores[i];
00324                 ci = &cgs.clientinfo[ score->client ];
00325 
00326                 if ( team != ci->team )
00327                 {
00328                         continue;
00329                 }
00330 
00331                 count++;
00332         }
00333 
00334         return count;
00335 
00336 }
00337 /*
00338 =================
00339 CG_DrawScoreboard
00340 
00341 Draw the normal in-game scoreboard
00342 =================
00343 */
00344 int cg_siegeWinTeam = 0;
00345 qboolean CG_DrawOldScoreboard( void ) {
00346         int             x, y, w, i, n1, n2;
00347         float   fade;
00348         float   *fadeColor;
00349         char    *s;
00350         int maxClients;
00351         int lineHeight;
00352         int topBorderSize, bottomBorderSize;
00353 
00354         // don't draw amuthing if the menu or console is up
00355         if ( cg_paused.integer ) {
00356                 cg.deferredPlayerLoading = 0;
00357                 return qfalse;
00358         }
00359 
00360         // don't draw scoreboard during death while warmup up
00361         if ( cg.warmup && !cg.showScores ) {
00362                 return qfalse;
00363         }
00364 
00365         if ( cg.showScores || cg.predictedPlayerState.pm_type == PM_DEAD ||
00366                  cg.predictedPlayerState.pm_type == PM_INTERMISSION ) {
00367                 fade = 1.0;
00368                 fadeColor = colorWhite;
00369         } else {
00370                 fadeColor = CG_FadeColor( cg.scoreFadeTime, FADE_TIME );
00371                 
00372                 if ( !fadeColor ) {
00373                         // next time scoreboard comes up, don't print killer
00374                         cg.deferredPlayerLoading = 0;
00375                         cg.killerName[0] = 0;
00376                         return qfalse;
00377                 }
00378                 fade = *fadeColor;
00379         }
00380 
00381         // fragged by ... line
00382         // or if in intermission and duel, prints the winner of the duel round
00383         if ((cgs.gametype == GT_DUEL || cgs.gametype == GT_POWERDUEL) && cgs.duelWinner != -1 &&
00384                 cg.predictedPlayerState.pm_type == PM_INTERMISSION)
00385         {
00386                 s = va("%s^7 %s", cgs.clientinfo[cgs.duelWinner].name, CG_GetStringEdString("MP_INGAME", "DUEL_WINS") );
00387                 /*w = CG_DrawStrlen( s ) * BIGCHAR_WIDTH;
00388                 x = ( SCREEN_WIDTH - w ) / 2;
00389                 y = 40;
00390                 CG_DrawBigString( x, y, s, fade );
00391                 */
00392                 x = ( SCREEN_WIDTH ) / 2;
00393                 y = 40;
00394                 CG_Text_Paint ( x - CG_Text_Width ( s, 1.0f, FONT_MEDIUM ) / 2, y, 1.0f, colorWhite, s, 0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM );
00395         }
00396         else if ((cgs.gametype == GT_DUEL || cgs.gametype == GT_POWERDUEL) && cgs.duelist1 != -1 && cgs.duelist2 != -1 &&
00397                 cg.predictedPlayerState.pm_type == PM_INTERMISSION)
00398         {
00399                 if (cgs.gametype == GT_POWERDUEL && cgs.duelist3 != -1)
00400                 {
00401                         s = va("%s^7 %s %s^7 %s %s", cgs.clientinfo[cgs.duelist1].name, CG_GetStringEdString("MP_INGAME", "SPECHUD_VERSUS"), cgs.clientinfo[cgs.duelist2].name, CG_GetStringEdString("MP_INGAME", "AND"), cgs.clientinfo[cgs.duelist3].name );
00402                 }
00403                 else
00404                 {
00405                         s = va("%s^7 %s %s", cgs.clientinfo[cgs.duelist1].name, CG_GetStringEdString("MP_INGAME", "SPECHUD_VERSUS"), cgs.clientinfo[cgs.duelist2].name );
00406                 }
00407                 /*w = CG_DrawStrlen( s ) * BIGCHAR_WIDTH;
00408                 x = ( SCREEN_WIDTH - w ) / 2;
00409                 y = 40;
00410                 CG_DrawBigString( x, y, s, fade );
00411                 */
00412                 x = ( SCREEN_WIDTH ) / 2;
00413                 y = 40;
00414                 CG_Text_Paint ( x - CG_Text_Width ( s, 1.0f, FONT_MEDIUM ) / 2, y, 1.0f, colorWhite, s, 0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM );
00415         }
00416         else if ( cg.killerName[0] ) {
00417                 s = va("%s %s", CG_GetStringEdString("MP_INGAME", "KILLEDBY"), cg.killerName );
00418                 /*w = CG_DrawStrlen( s ) * BIGCHAR_WIDTH;
00419                 x = ( SCREEN_WIDTH - w ) / 2;
00420                 y = 40;
00421                 CG_DrawBigString( x, y, s, fade );
00422                 */
00423                 x = ( SCREEN_WIDTH ) / 2;
00424                 y = 40;
00425                 CG_Text_Paint ( x - CG_Text_Width ( s, 1.0f, FONT_MEDIUM ) / 2, y, 1.0f, colorWhite, s, 0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM );
00426         }
00427 
00428         // current rank
00429         if (cgs.gametype == GT_POWERDUEL)
00430         { //do nothing?
00431         }
00432         else if ( cgs.gametype < GT_TEAM) {
00433                 if (cg.snap->ps.persistant[PERS_TEAM] != TEAM_SPECTATOR ) 
00434                 {
00435                         char sPlace[256];
00436                         char sOf[256];
00437                         char sWith[256];
00438 
00439                         trap_SP_GetStringTextString("MP_INGAME_PLACE",  sPlace, sizeof(sPlace));
00440                         trap_SP_GetStringTextString("MP_INGAME_OF",             sOf,    sizeof(sOf));
00441                         trap_SP_GetStringTextString("MP_INGAME_WITH",   sWith,  sizeof(sWith));
00442 
00443                         s = va("%s %s (%s %i) %s %i",
00444                                 CG_PlaceString( cg.snap->ps.persistant[PERS_RANK] + 1 ),
00445                                 sPlace,
00446                                 sOf,
00447                                 cg.numScores,
00448                                 sWith,
00449                                 cg.snap->ps.persistant[PERS_SCORE] );
00450                         w = CG_DrawStrlen( s ) * BIGCHAR_WIDTH;
00451                         x = ( SCREEN_WIDTH ) / 2;
00452                         y = 60;
00453                         //CG_DrawBigString( x, y, s, fade );
00454                         UI_DrawProportionalString(x, y, s, UI_CENTER|UI_DROPSHADOW, colorTable[CT_WHITE]);
00455                 }
00456         }
00457         else if (cgs.gametype != GT_SIEGE)
00458         {
00459                 if ( cg.teamScores[0] == cg.teamScores[1] ) {
00460                         s = va("%s %i", CG_GetStringEdString("MP_INGAME", "TIEDAT"), cg.teamScores[0] );
00461                 } else if ( cg.teamScores[0] >= cg.teamScores[1] ) {
00462                         s = va("%s, %i / %i", CG_GetStringEdString("MP_INGAME", "RED_LEADS"), cg.teamScores[0], cg.teamScores[1] );
00463                 } else {
00464                         s = va("%s, %i / %i", CG_GetStringEdString("MP_INGAME", "BLUE_LEADS"), cg.teamScores[1], cg.teamScores[0] );
00465                 }
00466 
00467                 x = ( SCREEN_WIDTH ) / 2;
00468                 y = 60;
00469                 
00470                 CG_Text_Paint ( x - CG_Text_Width ( s, 1.0f, FONT_MEDIUM ) / 2, y, 1.0f, colorWhite, s, 0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM );
00471         }
00472         else if (cgs.gametype == GT_SIEGE && (cg_siegeWinTeam == 1 || cg_siegeWinTeam == 2))
00473         {
00474                 if (cg_siegeWinTeam == 1)
00475                 {
00476                         s = va("%s", CG_GetStringEdString("MP_INGAME", "SIEGETEAM1WIN") );
00477                 }
00478                 else
00479                 {
00480                         s = va("%s", CG_GetStringEdString("MP_INGAME", "SIEGETEAM2WIN") );
00481                 }
00482 
00483                 x = ( SCREEN_WIDTH ) / 2;
00484                 y = 60;
00485                 
00486                 CG_Text_Paint ( x - CG_Text_Width ( s, 1.0f, FONT_MEDIUM ) / 2, y, 1.0f, colorWhite, s, 0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM );
00487         }
00488 
00489         // scoreboard
00490         y = SB_HEADER;
00491 
00492         CG_DrawPic ( SB_SCORELINE_X - 40, y - 5, SB_SCORELINE_WIDTH + 80, 40, trap_R_RegisterShaderNoMip ( "gfx/menus/menu_buttonback.tga" ) );
00493 
00494         CG_Text_Paint ( SB_NAME_X, y, 1.0f, colorWhite, CG_GetStringEdString("MP_INGAME", "NAME"),0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM );
00495         if (cgs.gametype == GT_DUEL || cgs.gametype == GT_POWERDUEL)
00496         {
00497                 char sWL[100];
00498                 trap_SP_GetStringTextString("MP_INGAME_W_L", sWL,       sizeof(sWL));
00499 
00500                 CG_Text_Paint ( SB_SCORE_X, y, 1.0f, colorWhite, sWL, 0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM );
00501         }
00502         else
00503         {
00504                 CG_Text_Paint ( SB_SCORE_X, y, 1.0f, colorWhite, CG_GetStringEdString("MP_INGAME", "SCORE"), 0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM );
00505         }
00506         CG_Text_Paint ( SB_PING_X, y, 1.0f, colorWhite, CG_GetStringEdString("MP_INGAME", "PING"), 0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM );
00507         CG_Text_Paint ( SB_TIME_X, y, 1.0f, colorWhite, CG_GetStringEdString("MP_INGAME", "TIME"), 0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM );
00508 
00509         y = SB_TOP;
00510 
00511         // If there are more than SB_MAXCLIENTS_NORMAL, use the interleaved scores
00512         if ( cg.numScores > SB_MAXCLIENTS_NORMAL ) {
00513                 maxClients = SB_MAXCLIENTS_INTER;
00514                 lineHeight = SB_INTER_HEIGHT;
00515                 topBorderSize = 8;
00516                 bottomBorderSize = 16;
00517         } else {
00518                 maxClients = SB_MAXCLIENTS_NORMAL;
00519                 lineHeight = SB_NORMAL_HEIGHT;
00520                 topBorderSize = 8;
00521                 bottomBorderSize = 8;
00522         }
00523 
00524         localClient = qfalse;
00525 
00526 
00527         //I guess this should end up being able to display 19 clients at once.
00528         //In a team game, if there are 9 or more clients on the team not in the lead,
00529         //we only want to show 10 of the clients on the team in the lead, so that we
00530         //have room to display the clients in the lead on the losing team.
00531 
00532         //I guess this can be accomplished simply by printing the first teams score with a maxClients
00533         //value passed in related to how many players are on both teams.
00534         if ( cgs.gametype >= GT_TEAM ) {
00535                 //
00536                 // teamplay scoreboard
00537                 //
00538                 y += lineHeight/2;
00539 
00540                 if ( cg.teamScores[0] >= cg.teamScores[1] ) {
00541                         int team1MaxCl = CG_GetTeamCount(TEAM_RED, maxClients);
00542                         int team2MaxCl = CG_GetTeamCount(TEAM_BLUE, maxClients);
00543 
00544                         if (team1MaxCl > 10 && (team1MaxCl+team2MaxCl) > maxClients)
00545                         {
00546                                 team1MaxCl -= team2MaxCl;
00547                                 //subtract as many as you have to down to 10, once we get there
00548                                 //we just set it to 10
00549 
00550                                 if (team1MaxCl < 10)
00551                                 {
00552                                         team1MaxCl = 10;
00553                                 }
00554                         }
00555 
00556                         team2MaxCl = (maxClients-team1MaxCl); //team2 can display however many is left over after team1's display
00557 
00558                         n1 = CG_TeamScoreboard( y, TEAM_RED, fade, team1MaxCl, lineHeight, qtrue );
00559                         CG_DrawTeamBackground( SB_SCORELINE_X - 5, y - topBorderSize, 640 - SB_SCORELINE_X * 2 + 10, n1 * lineHeight + bottomBorderSize, 0.33f, TEAM_RED );
00560                         CG_TeamScoreboard( y, TEAM_RED, fade, team1MaxCl, lineHeight, qfalse );
00561                         y += (n1 * lineHeight) + BIGCHAR_HEIGHT;
00562 
00563                         //maxClients -= n1;
00564 
00565                         n2 = CG_TeamScoreboard( y, TEAM_BLUE, fade, team2MaxCl, lineHeight, qtrue );
00566                         CG_DrawTeamBackground( SB_SCORELINE_X - 5, y - topBorderSize, 640 - SB_SCORELINE_X * 2 + 10, n2 * lineHeight + bottomBorderSize, 0.33f, TEAM_BLUE );
00567                         CG_TeamScoreboard( y, TEAM_BLUE, fade, team2MaxCl, lineHeight, qfalse );
00568                         y += (n2 * lineHeight) + BIGCHAR_HEIGHT;
00569 
00570                         //maxClients -= n2;
00571 
00572                         maxClients -= (team1MaxCl+team2MaxCl);
00573                 } else {
00574                         int team1MaxCl = CG_GetTeamCount(TEAM_BLUE, maxClients);
00575                         int team2MaxCl = CG_GetTeamCount(TEAM_RED, maxClients);
00576 
00577                         if (team1MaxCl > 10 && (team1MaxCl+team2MaxCl) > maxClients)
00578                         {
00579                                 team1MaxCl -= team2MaxCl;
00580                                 //subtract as many as you have to down to 10, once we get there
00581                                 //we just set it to 10
00582 
00583                                 if (team1MaxCl < 10)
00584                                 {
00585                                         team1MaxCl = 10;
00586                                 }
00587                         }
00588 
00589                         team2MaxCl = (maxClients-team1MaxCl); //team2 can display however many is left over after team1's display
00590 
00591                         n1 = CG_TeamScoreboard( y, TEAM_BLUE, fade, team1MaxCl, lineHeight, qtrue );
00592                         CG_DrawTeamBackground( SB_SCORELINE_X - 5, y - topBorderSize, 640 - SB_SCORELINE_X * 2 + 10, n1 * lineHeight + bottomBorderSize, 0.33f, TEAM_BLUE );
00593                         CG_TeamScoreboard( y, TEAM_BLUE, fade, team1MaxCl, lineHeight, qfalse );
00594                         y += (n1 * lineHeight) + BIGCHAR_HEIGHT;
00595 
00596                         //maxClients -= n1;
00597 
00598                         n2 = CG_TeamScoreboard( y, TEAM_RED, fade, team2MaxCl, lineHeight, qtrue );
00599                         CG_DrawTeamBackground( SB_SCORELINE_X - 5, y - topBorderSize, 640 - SB_SCORELINE_X * 2 + 10, n2 * lineHeight + bottomBorderSize, 0.33f, TEAM_RED );
00600                         CG_TeamScoreboard( y, TEAM_RED, fade, team2MaxCl, lineHeight, qfalse );
00601                         y += (n2 * lineHeight) + BIGCHAR_HEIGHT;
00602 
00603                         //maxClients -= n2;
00604 
00605                         maxClients -= (team1MaxCl+team2MaxCl);
00606                 }
00607                 n1 = CG_TeamScoreboard( y, TEAM_SPECTATOR, fade, maxClients, lineHeight, qfalse );
00608                 y += (n1 * lineHeight) + BIGCHAR_HEIGHT;
00609 
00610         } else {
00611                 //
00612                 // free for all scoreboard
00613                 //
00614                 n1 = CG_TeamScoreboard( y, TEAM_FREE, fade, maxClients, lineHeight, qfalse );
00615                 y += (n1 * lineHeight) + BIGCHAR_HEIGHT;
00616                 n2 = CG_TeamScoreboard( y, TEAM_SPECTATOR, fade, maxClients - n1, lineHeight, qfalse );
00617                 y += (n2 * lineHeight) + BIGCHAR_HEIGHT;
00618         }
00619 
00620         if (!localClient) {
00621                 // draw local client at the bottom
00622                 for ( i = 0 ; i < cg.numScores ; i++ ) {
00623                         if ( cg.scores[i].client == cg.snap->ps.clientNum ) {
00624                                 CG_DrawClientScore( y, &cg.scores[i], fadeColor, fade, lineHeight == SB_NORMAL_HEIGHT );
00625                                 break;
00626                         }
00627                 }
00628         }
00629 
00630         // load any models that have been deferred
00631         if ( ++cg.deferredPlayerLoading > 10 ) {
00632                 CG_LoadDeferredPlayers();
00633         }
00634 
00635         return qtrue;
00636 }
00637 
00638 //================================================================================
00639