| 1 |
/* |
| 2 |
=========================================================================== |
| 3 |
Copyright (C) 1999-2005 Id Software, Inc. |
| 4 |
|
| 5 |
This file is part of Quake III Arena source code. |
| 6 |
|
| 7 |
Quake III Arena source code is free software; you can redistribute it |
| 8 |
and/or modify it under the terms of the GNU General Public License as |
| 9 |
published by the Free Software Foundation; either version 2 of the License, |
| 10 |
or (at your option) any later version. |
| 11 |
|
| 12 |
Quake III Arena source code is distributed in the hope that it will be |
| 13 |
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
GNU General Public License for more details. |
| 16 |
|
| 17 |
You should have received a copy of the GNU General Public License |
| 18 |
along with Quake III Arena source code; if not, write to the Free Software |
| 19 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 |
=========================================================================== |
| 21 |
*/ |
| 22 |
// |
| 23 |
// cg_scoreboard -- draw the scoreboard on top of the game screen |
| 24 |
#include "cg_local.h" |
| 25 |
|
| 26 |
|
| 27 |
#define SCOREBOARD_X (0) |
| 28 |
|
| 29 |
#define SB_HEADER 86 |
| 30 |
#define SB_TOP (SB_HEADER+32) |
| 31 |
|
| 32 |
// Where the status bar starts, so we don't overwrite it |
| 33 |
#define SB_STATUSBAR 420 |
| 34 |
|
| 35 |
#define SB_NORMAL_HEIGHT 40 |
| 36 |
#define SB_INTER_HEIGHT 16 // interleaved height |
| 37 |
|
| 38 |
#define SB_MAXCLIENTS_NORMAL ((SB_STATUSBAR - SB_TOP) / SB_NORMAL_HEIGHT) |
| 39 |
#define SB_MAXCLIENTS_INTER ((SB_STATUSBAR - SB_TOP) / SB_INTER_HEIGHT - 1) |
| 40 |
|
| 41 |
// Used when interleaved |
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
#define SB_LEFT_BOTICON_X (SCOREBOARD_X+0) |
| 46 |
#define SB_LEFT_HEAD_X (SCOREBOARD_X+32) |
| 47 |
#define SB_RIGHT_BOTICON_X (SCOREBOARD_X+64) |
| 48 |
#define SB_RIGHT_HEAD_X (SCOREBOARD_X+96) |
| 49 |
// Normal |
| 50 |
#define SB_BOTICON_X (SCOREBOARD_X+32) |
| 51 |
#define SB_HEAD_X (SCOREBOARD_X+64) |
| 52 |
|
| 53 |
#define SB_SCORELINE_X 112 |
| 54 |
|
| 55 |
#define SB_RATING_WIDTH (6 * BIGCHAR_WIDTH) // width 6 |
| 56 |
#define SB_SCORE_X (SB_SCORELINE_X + BIGCHAR_WIDTH) // width 6 |
| 57 |
#define SB_RATING_X (SB_SCORELINE_X + 6 * BIGCHAR_WIDTH) // width 6 |
| 58 |
#define SB_PING_X (SB_SCORELINE_X + 12 * BIGCHAR_WIDTH + 8) // width 5 |
| 59 |
#define SB_TIME_X (SB_SCORELINE_X + 17 * BIGCHAR_WIDTH + 8) // width 5 |
| 60 |
#define SB_NAME_X (SB_SCORELINE_X + 22 * BIGCHAR_WIDTH) // width 15 |
| 61 |
|
| 62 |
// The new and improved score board |
| 63 |
// |
| 64 |
// In cases where the number of clients is high, the score board heads are interleaved |
| 65 |
// here's the layout |
| 66 |
|
| 67 |
// |
| 68 |
// 0 32 80 112 144 240 320 400 <-- pixel position |
| 69 |
// bot head bot head score ping time name |
| 70 |
// |
| 71 |
// wins/losses are drawn on bot icon now |
| 72 |
|
| 73 |
static qboolean localClient; // true if local client has been displayed |
| 74 |
|
| 75 |
|
| 76 |
/* |
| 77 |
================= |
| 78 |
CG_DrawScoreboard |
| 79 |
================= |
| 80 |
*/ |
| 81 |
static void CG_DrawClientScore( int y, score_t *score, float *color, float fade, qboolean largeFormat ) { |
| 82 |
char string[1024]; |
| 83 |
vec3_t headAngles; |
| 84 |
clientInfo_t *ci; |
| 85 |
int iconx, headx; |
| 86 |
|
| 87 |
if ( score->client < 0 || score->client >= cgs.maxclients ) { |
| 88 |
Com_Printf( "Bad score->client: %i\n", score->client ); |
| 89 |
return; |
| 90 |
} |
| 91 |
|
| 92 |
ci = &cgs.clientinfo[score->client]; |
| 93 |
|
| 94 |
iconx = SB_BOTICON_X + (SB_RATING_WIDTH / 2); |
| 95 |
headx = SB_HEAD_X + (SB_RATING_WIDTH / 2); |
| 96 |
|
| 97 |
// draw the handicap or bot skill marker (unless player has flag) |
| 98 |
if ( ci->powerups & ( 1 << PW_NEUTRALFLAG ) ) { |
| 99 |
if( largeFormat ) { |
| 100 |
CG_DrawFlagModel( iconx, y - ( 32 - BIGCHAR_HEIGHT ) / 2, 32, 32, TEAM_FREE, qfalse ); |
| 101 |
} |
| 102 |
else { |
| 103 |
CG_DrawFlagModel( iconx, y, 16, 16, TEAM_FREE, qfalse ); |
| 104 |
} |
| 105 |
} else if ( ci->powerups & ( 1 << PW_REDFLAG ) ) { |
| 106 |
if( largeFormat ) { |
| 107 |
CG_DrawFlagModel( iconx, y - ( 32 - BIGCHAR_HEIGHT ) / 2, 32, 32, TEAM_RED, qfalse ); |
| 108 |
} |
| 109 |
else { |
| 110 |
CG_DrawFlagModel( iconx, y, 16, 16, TEAM_RED, qfalse ); |
| 111 |
} |
| 112 |
} else if ( ci->powerups & ( 1 << PW_BLUEFLAG ) ) { |
| 113 |
if( largeFormat ) { |
| 114 |
CG_DrawFlagModel( iconx, y - ( 32 - BIGCHAR_HEIGHT ) / 2, 32, 32, TEAM_BLUE, qfalse ); |
| 115 |
} |
| 116 |
else { |
| 117 |
CG_DrawFlagModel( iconx, y, 16, 16, TEAM_BLUE, qfalse ); |
| 118 |
} |
| 119 |
} else { |
| 120 |
if ( ci->botSkill > 0 && ci->botSkill <= 5 ) { |
| 121 |
if ( cg_drawIcons.integer ) { |
| 122 |
if( largeFormat ) { |
| 123 |
CG_DrawPic( iconx, y - ( 32 - BIGCHAR_HEIGHT ) / 2, 32, 32, cgs.media.botSkillShaders[ ci->botSkill - 1 ] ); |
| 124 |
} |
| 125 |
else { |
| 126 |
CG_DrawPic( iconx, y, 16, 16, cgs.media.botSkillShaders[ ci->botSkill - 1 ] ); |
| 127 |
} |
| 128 |
} |
| 129 |
} else if ( ci->handicap < 100 ) { |
| 130 |
Com_sprintf( string, sizeof( string ), "%i", ci->handicap ); |
| 131 |
if ( cgs.gametype == GT_TOURNAMENT ) |
| 132 |
CG_DrawSmallStringColor( iconx, y - SMALLCHAR_HEIGHT/2, string, color ); |
| 133 |
else |
| 134 |
CG_DrawSmallStringColor( iconx, y, string, color ); |
| 135 |
} |
| 136 |
|
| 137 |
// draw the wins / losses |
| 138 |
if ( cgs.gametype == GT_TOURNAMENT ) { |
| 139 |
Com_sprintf( string, sizeof( string ), "%i/%i", ci->wins, ci->losses ); |
| 140 |
if( ci->handicap < 100 && !ci->botSkill ) { |
| 141 |
CG_DrawSmallStringColor( iconx, y + SMALLCHAR_HEIGHT/2, string, color ); |
| 142 |
} |
| 143 |
else { |
| 144 |
CG_DrawSmallStringColor( iconx, y, string, color ); |
| 145 |
} |
| 146 |
} |
| 147 |
} |
| 148 |
|
| 149 |
// draw the face |
| 150 |
VectorClear( headAngles ); |
| 151 |
headAngles[YAW] = 180; |
| 152 |
if( largeFormat ) { |
| 153 |
CG_DrawHead( headx, y - ( ICON_SIZE - BIGCHAR_HEIGHT ) / 2, ICON_SIZE, ICON_SIZE, |
| 154 |
score->client, headAngles ); |
| 155 |
} |
| 156 |
else { |
| 157 |
CG_DrawHead( headx, y, 16, 16, score->client, headAngles ); |
| 158 |
} |
| 159 |
|
| 160 |
#ifdef MISSIONPACK |
| 161 |
// draw the team task |
| 162 |
if ( ci->teamTask != TEAMTASK_NONE ) { |
| 163 |
if (ci->isDead) { |
| 164 |
CG_DrawPic( headx + 48, y, 16, 16, cgs.media.deathShader ); |
| 165 |
} |
| 166 |
else if ( ci->teamTask == TEAMTASK_OFFENSE ) { |
| 167 |
CG_DrawPic( headx + 48, y, 16, 16, cgs.media.assaultShader ); |
| 168 |
} |
| 169 |
else if ( ci->teamTask == TEAMTASK_DEFENSE ) { |
| 170 |
CG_DrawPic( headx + 48, y, 16, 16, cgs.media.defendShader ); |
| 171 |
} |
| 172 |
} |
| 173 |
#endif |
| 174 |
// draw the score line |
| 175 |
if ( score->ping == -1 ) { |
| 176 |
Com_sprintf(string, sizeof(string), |
| 177 |
" connecting %s", ci->name); |
| 178 |
} else if ( ci->team == TEAM_SPECTATOR ) { |
| 179 |
Com_sprintf(string, sizeof(string), |
| 180 |
" SPECT %3i %4i %s", score->ping, score->time, ci->name); |
| 181 |
} else { |
| 182 |
/*if(cgs.gametype == GT_LMS) |
| 183 |
Com_sprintf(string, sizeof(string), |
| 184 |
"%5i %4i %4i %s *%i*", score->score, score->ping, score->time, ci->name, ci->isDead); |
| 185 |
else*/ |
| 186 |
/*if(ci->isDead) |
| 187 |
Com_sprintf(string, sizeof(string), |
| 188 |
"%5i %4i %4i %s *DEAD*", score->score, score->ping, score->time, ci->name); |
| 189 |
else*/ |
| 190 |
Com_sprintf(string, sizeof(string), |
| 191 |
"%5i %4i %4i %s", score->score, score->ping, score->time, ci->name); |
| 192 |
} |
| 193 |
|
| 194 |
// highlight your position |
| 195 |
if ( score->client == cg.snap->ps.clientNum ) { |
| 196 |
float hcolor[4]; |
| 197 |
int rank; |
| 198 |
|
| 199 |
localClient = qtrue; |
| 200 |
|
| 201 |
if ( ( cg.snap->ps.persistant[PERS_TEAM] == TEAM_SPECTATOR ) || |
| 202 |
( ( cgs.gametype >= GT_TEAM ) && |
| 203 |
( cgs.ffa_gt != 1 ) ) ) { |
| 204 |
// Sago: I think this means that it doesn't matter if two players are tied in team game - only team score counts |
| 205 |
rank = -1; |
| 206 |
} else { |
| 207 |
rank = cg.snap->ps.persistant[PERS_RANK] & ~RANK_TIED_FLAG; |
| 208 |
} |
| 209 |
if ( rank == 0 ) { |
| 210 |
hcolor[0] = 0; |
| 211 |
hcolor[1] = 0; |
| 212 |
hcolor[2] = 0.7f; |
| 213 |
} else if ( rank == 1 ) { |
| 214 |
hcolor[0] = 0.7f; |
| 215 |
hcolor[1] = 0; |
| 216 |
hcolor[2] = 0; |
| 217 |
} else if ( rank == 2 ) { |
| 218 |
hcolor[0] = 0.7f; |
| 219 |
hcolor[1] = 0.7f; |
| 220 |
hcolor[2] = 0; |
| 221 |
} else { |
| 222 |
hcolor[0] = 0.7f; |
| 223 |
hcolor[1] = 0.7f; |
| 224 |
hcolor[2] = 0.7f; |
| 225 |
} |
| 226 |
|
| 227 |
hcolor[3] = fade * 0.7; |
| 228 |
CG_FillRect( SB_SCORELINE_X + BIGCHAR_WIDTH + (SB_RATING_WIDTH / 2), y, |
| 229 |
640 - SB_SCORELINE_X - BIGCHAR_WIDTH, BIGCHAR_HEIGHT+1, hcolor ); |
| 230 |
} |
| 231 |
|
| 232 |
CG_DrawBigString( SB_SCORELINE_X + (SB_RATING_WIDTH / 2), y, string, fade ); |
| 233 |
|
| 234 |
// add the "ready" marker for intermission exiting |
| 235 |
if ( cg.snap->ps.stats[ STAT_CLIENTS_READY ] & ( 1 << score->client ) ) { |
| 236 |
CG_DrawBigStringColor( iconx, y, "READY", color ); |
| 237 |
} else |
| 238 |
if(cgs.gametype == GT_LMS) { |
| 239 |
CG_DrawBigStringColor( iconx-50, y, va("*%i*",ci->isDead), color ); |
| 240 |
} else |
| 241 |
if(ci->isDead) { |
| 242 |
CG_DrawBigStringColor( iconx-60, y, "DEAD", color ); |
| 243 |
} |
| 244 |
} |
| 245 |
|
| 246 |
/* |
| 247 |
================= |
| 248 |
CG_TeamScoreboard |
| 249 |
================= |
| 250 |
*/ |
| 251 |
static int CG_TeamScoreboard( int y, team_t team, float fade, int maxClients, int lineHeight ) { |
| 252 |
int i; |
| 253 |
score_t *score; |
| 254 |
float color[4]; |
| 255 |
int count; |
| 256 |
clientInfo_t *ci; |
| 257 |
|
| 258 |
color[0] = color[1] = color[2] = 1.0; |
| 259 |
color[3] = fade; |
| 260 |
|
| 261 |
count = 0; |
| 262 |
for ( i = 0 ; i < cg.numScores && count < maxClients ; i++ ) { |
| 263 |
score = &cg.scores[i]; |
| 264 |
ci = &cgs.clientinfo[ score->client ]; |
| 265 |
|
| 266 |
if ( team != ci->team ) { |
| 267 |
continue; |
| 268 |
} |
| 269 |
|
| 270 |
CG_DrawClientScore( y + lineHeight * count, score, color, fade, lineHeight == SB_NORMAL_HEIGHT ); |
| 271 |
|
| 272 |
count++; |
| 273 |
} |
| 274 |
|
| 275 |
return count; |
| 276 |
} |
| 277 |
|
| 278 |
/* |
| 279 |
================= |
| 280 |
CG_DrawScoreboard |
| 281 |
|
| 282 |
Draw the normal in-game scoreboard |
| 283 |
================= |
| 284 |
*/ |
| 285 |
qboolean CG_DrawOldScoreboard( void ) { |
| 286 |
int x, y, w, i, n1, n2; |
| 287 |
float fade; |
| 288 |
float *fadeColor; |
| 289 |
char *s; |
| 290 |
int maxClients; |
| 291 |
int lineHeight; |
| 292 |
int topBorderSize, bottomBorderSize; |
| 293 |
|
| 294 |
// don't draw amuthing if the menu or console is up |
| 295 |
if ( cg_paused.integer ) { |
| 296 |
cg.deferredPlayerLoading = 0; |
| 297 |
return qfalse; |
| 298 |
} |
| 299 |
|
| 300 |
if ( cgs.gametype == GT_SINGLE_PLAYER && cg.predictedPlayerState.pm_type == PM_INTERMISSION ) { |
| 301 |
cg.deferredPlayerLoading = 0; |
| 302 |
return qfalse; |
| 303 |
} |
| 304 |
|
| 305 |
// don't draw scoreboard during death while warmup up |
| 306 |
if ( cg.warmup && !cg.showScores ) { |
| 307 |
return qfalse; |
| 308 |
} |
| 309 |
|
| 310 |
if ( cg.showScores || cg.predictedPlayerState.pm_type == PM_DEAD || |
| 311 |
cg.predictedPlayerState.pm_type == PM_INTERMISSION ) { |
| 312 |
fade = 1.0; |
| 313 |
fadeColor = colorWhite; |
| 314 |
} else { |
| 315 |
fadeColor = CG_FadeColor( cg.scoreFadeTime, FADE_TIME ); |
| 316 |
|
| 317 |
if ( !fadeColor ) { |
| 318 |
// next time scoreboard comes up, don't print killer |
| 319 |
cg.deferredPlayerLoading = 0; |
| 320 |
cg.killerName[0] = 0; |
| 321 |
return qfalse; |
| 322 |
} |
| 323 |
fade = *fadeColor; |
| 324 |
} |
| 325 |
|
| 326 |
|
| 327 |
// fragged by ... line |
| 328 |
if ( cg.killerName[0] ) { |
| 329 |
s = va("Fragged by %s", cg.killerName ); |
| 330 |
w = CG_DrawStrlen( s ) * BIGCHAR_WIDTH; |
| 331 |
x = ( SCREEN_WIDTH - w ) / 2; |
| 332 |
y = 40; |
| 333 |
CG_DrawBigString( x, y, s, fade ); |
| 334 |
} |
| 335 |
|
| 336 |
// current rank |
| 337 |
if ( cgs.gametype < GT_TEAM || cgs.ffa_gt == 1) { |
| 338 |
if (cg.snap->ps.persistant[PERS_TEAM] != TEAM_SPECTATOR ) { |
| 339 |
s = va("%s place with %i", |
| 340 |
CG_PlaceString( cg.snap->ps.persistant[PERS_RANK] + 1 ), |
| 341 |
cg.snap->ps.persistant[PERS_SCORE] ); |
| 342 |
w = CG_DrawStrlen( s ) * BIGCHAR_WIDTH; |
| 343 |
x = ( SCREEN_WIDTH - w ) / 2; |
| 344 |
y = 60; |
| 345 |
CG_DrawBigString( x, y, s, fade ); |
| 346 |
} |
| 347 |
} else { |
| 348 |
if ( cg.teamScores[0] == cg.teamScores[1] ) { |
| 349 |
s = va("Teams are tied at %i", cg.teamScores[0] ); |
| 350 |
} else if ( cg.teamScores[0] >= cg.teamScores[1] ) { |
| 351 |
s = va("Red leads %i to %i",cg.teamScores[0], cg.teamScores[1] ); |
| 352 |
} else { |
| 353 |
s = va("Blue leads %i to %i",cg.teamScores[1], cg.teamScores[0] ); |
| 354 |
} |
| 355 |
|
| 356 |
w = CG_DrawStrlen( s ) * BIGCHAR_WIDTH; |
| 357 |
x = ( SCREEN_WIDTH - w ) / 2; |
| 358 |
y = 60; |
| 359 |
CG_DrawBigString( x, y, s, fade ); |
| 360 |
} |
| 361 |
|
| 362 |
// scoreboard |
| 363 |
y = SB_HEADER; |
| 364 |
|
| 365 |
CG_DrawPic( SB_SCORE_X + (SB_RATING_WIDTH / 2), y, 64, 32, cgs.media.scoreboardScore ); |
| 366 |
CG_DrawPic( SB_PING_X - (SB_RATING_WIDTH / 2), y, 64, 32, cgs.media.scoreboardPing ); |
| 367 |
CG_DrawPic( SB_TIME_X - (SB_RATING_WIDTH / 2), y, 64, 32, cgs.media.scoreboardTime ); |
| 368 |
CG_DrawPic( SB_NAME_X - (SB_RATING_WIDTH / 2), y, 64, 32, cgs.media.scoreboardName ); |
| 369 |
|
| 370 |
y = SB_TOP; |
| 371 |
|
| 372 |
// If there are more than SB_MAXCLIENTS_NORMAL, use the interleaved scores |
| 373 |
if ( cg.numScores > SB_MAXCLIENTS_NORMAL ) { |
| 374 |
maxClients = SB_MAXCLIENTS_INTER; |
| 375 |
lineHeight = SB_INTER_HEIGHT; |
| 376 |
topBorderSize = 8; |
| 377 |
bottomBorderSize = 16; |
| 378 |
} else { |
| 379 |
maxClients = SB_MAXCLIENTS_NORMAL; |
| 380 |
lineHeight = SB_NORMAL_HEIGHT; |
| 381 |
topBorderSize = 16; |
| 382 |
bottomBorderSize = 16; |
| 383 |
} |
| 384 |
|
| 385 |
localClient = qfalse; |
| 386 |
|
| 387 |
if ( cgs.gametype >= GT_TEAM && cgs.ffa_gt!=1) { |
| 388 |
// |
| 389 |
// teamplay scoreboard |
| 390 |
// |
| 391 |
y += lineHeight/2; |
| 392 |
|
| 393 |
if ( cg.teamScores[0] >= cg.teamScores[1] ) { |
| 394 |
n1 = CG_TeamScoreboard( y, TEAM_RED, fade, maxClients, lineHeight ); |
| 395 |
CG_DrawTeamBackground( 0, y - topBorderSize, 640, n1 * lineHeight + bottomBorderSize, 0.33f, TEAM_RED ); |
| 396 |
y += (n1 * lineHeight) + BIGCHAR_HEIGHT; |
| 397 |
maxClients -= n1; |
| 398 |
n2 = CG_TeamScoreboard( y, TEAM_BLUE, fade, maxClients, lineHeight ); |
| 399 |
CG_DrawTeamBackground( 0, y - topBorderSize, 640, n2 * lineHeight + bottomBorderSize, 0.33f, TEAM_BLUE ); |
| 400 |
y += (n2 * lineHeight) + BIGCHAR_HEIGHT; |
| 401 |
maxClients -= n2; |
| 402 |
} else { |
| 403 |
n1 = CG_TeamScoreboard( y, TEAM_BLUE, fade, maxClients, lineHeight ); |
| 404 |
CG_DrawTeamBackground( 0, y - topBorderSize, 640, n1 * lineHeight + bottomBorderSize, 0.33f, TEAM_BLUE ); |
| 405 |
y += (n1 * lineHeight) + BIGCHAR_HEIGHT; |
| 406 |
maxClients -= n1; |
| 407 |
n2 = CG_TeamScoreboard( y, TEAM_RED, fade, maxClients, lineHeight ); |
| 408 |
CG_DrawTeamBackground( 0, y - topBorderSize, 640, n2 * lineHeight + bottomBorderSize, 0.33f, TEAM_RED ); |
| 409 |
y += (n2 * lineHeight) + BIGCHAR_HEIGHT; |
| 410 |
maxClients -= n2; |
| 411 |
} |
| 412 |
n1 = CG_TeamScoreboard( y, TEAM_SPECTATOR, fade, maxClients, lineHeight ); |
| 413 |
y += (n1 * lineHeight) + BIGCHAR_HEIGHT; |
| 414 |
|
| 415 |
} else { |
| 416 |
// |
| 417 |
// free for all scoreboard |
| 418 |
// |
| 419 |
n1 = CG_TeamScoreboard( y, TEAM_FREE, fade, maxClients, lineHeight ); |
| 420 |
y += (n1 * lineHeight) + BIGCHAR_HEIGHT; |
| 421 |
n2 = CG_TeamScoreboard( y, TEAM_SPECTATOR, fade, maxClients - n1, lineHeight ); |
| 422 |
y += (n2 * lineHeight) + BIGCHAR_HEIGHT; |
| 423 |
} |
| 424 |
|
| 425 |
if (!localClient) { |
| 426 |
// draw local client at the bottom |
| 427 |
for ( i = 0 ; i < cg.numScores ; i++ ) { |
| 428 |
if ( cg.scores[i].client == cg.snap->ps.clientNum ) { |
| 429 |
CG_DrawClientScore( y, &cg.scores[i], fadeColor, fade, lineHeight == SB_NORMAL_HEIGHT ); |
| 430 |
break; |
| 431 |
} |
| 432 |
} |
| 433 |
} |
| 434 |
|
| 435 |
// load any models that have been deferred |
| 436 |
if ( ++cg.deferredPlayerLoading > 10 ) { |
| 437 |
CG_LoadDeferredPlayers(); |
| 438 |
} |
| 439 |
|
| 440 |
return qtrue; |
| 441 |
} |
| 442 |
|
| 443 |
//================================================================================ |
| 444 |
|
| 445 |
/* |
| 446 |
================ |
| 447 |
CG_CenterGiantLine |
| 448 |
================ |
| 449 |
*/ |
| 450 |
static void CG_CenterGiantLine( float y, const char *string ) { |
| 451 |
float x; |
| 452 |
vec4_t color; |
| 453 |
|
| 454 |
color[0] = 1; |
| 455 |
color[1] = 1; |
| 456 |
color[2] = 1; |
| 457 |
color[3] = 1; |
| 458 |
|
| 459 |
x = 0.5 * ( 640 - GIANT_WIDTH * CG_DrawStrlen( string ) ); |
| 460 |
|
| 461 |
CG_DrawStringExt( x, y, string, color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0 ); |
| 462 |
} |
| 463 |
|
| 464 |
/* |
| 465 |
================= |
| 466 |
CG_DrawTourneyScoreboard |
| 467 |
|
| 468 |
Draw the oversize scoreboard for tournements |
| 469 |
================= |
| 470 |
*/ |
| 471 |
void CG_DrawOldTourneyScoreboard( void ) { |
| 472 |
const char *s; |
| 473 |
vec4_t color; |
| 474 |
int min, tens, ones; |
| 475 |
clientInfo_t *ci; |
| 476 |
int y; |
| 477 |
int i; |
| 478 |
|
| 479 |
// request more scores regularly |
| 480 |
if ( cg.scoresRequestTime + 2000 < cg.time ) { |
| 481 |
cg.scoresRequestTime = cg.time; |
| 482 |
trap_SendClientCommand( "score" ); |
| 483 |
} |
| 484 |
|
| 485 |
// draw the dialog background |
| 486 |
color[0] = color[1] = color[2] = 0; |
| 487 |
color[3] = 1; |
| 488 |
CG_FillRect( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, color ); |
| 489 |
|
| 490 |
color[0] = 1; |
| 491 |
color[1] = 1; |
| 492 |
color[2] = 1; |
| 493 |
color[3] = 1; |
| 494 |
|
| 495 |
// print the mesage of the day |
| 496 |
s = CG_ConfigString( CS_MOTD ); |
| 497 |
if ( !s[0] ) { |
| 498 |
s = "Scoreboard"; |
| 499 |
} |
| 500 |
|
| 501 |
// print optional title |
| 502 |
CG_CenterGiantLine( 8, s ); |
| 503 |
|
| 504 |
// print server time |
| 505 |
ones = cg.time / 1000; |
| 506 |
min = ones / 60; |
| 507 |
ones %= 60; |
| 508 |
tens = ones / 10; |
| 509 |
ones %= 10; |
| 510 |
s = va("%i:%i%i", min, tens, ones ); |
| 511 |
|
| 512 |
CG_CenterGiantLine( 64, s ); |
| 513 |
|
| 514 |
|
| 515 |
// print the two scores |
| 516 |
|
| 517 |
y = 160; |
| 518 |
if ( cgs.gametype >= GT_TEAM && cgs.ffa_gt!=1) { |
| 519 |
// |
| 520 |
// teamplay scoreboard |
| 521 |
// |
| 522 |
CG_DrawStringExt( 8, y, "Red Team", color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0 ); |
| 523 |
s = va("%i", cg.teamScores[0] ); |
| 524 |
CG_DrawStringExt( 632 - GIANT_WIDTH * strlen(s), y, s, color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0 ); |
| 525 |
|
| 526 |
y += 64; |
| 527 |
|
| 528 |
CG_DrawStringExt( 8, y, "Blue Team", color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0 ); |
| 529 |
s = va("%i", cg.teamScores[1] ); |
| 530 |
CG_DrawStringExt( 632 - GIANT_WIDTH * strlen(s), y, s, color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0 ); |
| 531 |
} else { |
| 532 |
// |
| 533 |
// free for all scoreboard |
| 534 |
// |
| 535 |
for ( i = 0 ; i < MAX_CLIENTS ; i++ ) { |
| 536 |
ci = &cgs.clientinfo[i]; |
| 537 |
if ( !ci->infoValid ) { |
| 538 |
continue; |
| 539 |
} |
| 540 |
if ( ci->team != TEAM_FREE ) { |
| 541 |
continue; |
| 542 |
} |
| 543 |
|
| 544 |
CG_DrawStringExt( 8, y, ci->name, color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0 ); |
| 545 |
s = va("%i", ci->score ); |
| 546 |
CG_DrawStringExt( 632 - GIANT_WIDTH * strlen(s), y, s, color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0 ); |
| 547 |
y += 64; |
| 548 |
} |
| 549 |
} |
| 550 |
|
| 551 |
|
| 552 |
} |
| 553 |
|