/* ================= CG_DrawTourneyScoreboard Draw the oversize scoreboard for tournements ================= */ void CG_DrawTourneyScoreboard( void ) { const char *s; vec4_t color; int min, tens, ones; playerInfo_t *pi; int y; int i; CG_SetScreenPlacement(PLACE_CENTER, PLACE_CENTER); // request more scores regularly if ( cg.scoresRequestTime + 2000 < cg.time ) { cg.scoresRequestTime = cg.time; trap_SendClientCommand( "score" ); } // draw the dialog background color[0] = color[1] = color[2] = 0; color[3] = 1; CG_SetScreenPlacement(PLACE_STRETCH, PLACE_STRETCH); CG_FillRect( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, color ); CG_PopScreenPlacement(); // print the mesage of the day s = CG_ConfigString( CS_MOTD ); if ( !s[0] ) { s = "Scoreboard"; } // print optional title CG_CenterGiantLine( 8, s ); // print server time ones = cg.time / 1000; min = ones / 60; ones %= 60; tens = ones / 10; ones %= 10; s = va("%i:%i%i", min, tens, ones ); CG_CenterGiantLine( 64, s ); // print the two scores y = 160; if ( cgs.gametype >= GT_TEAM ) { // // teamplay scoreboard // CG_DrawString( 8, y, "Red Team", UI_LEFT|UI_DROPSHADOW|UI_GIANTFONT|UI_NOSCALE, NULL ); s = va("%i", cg.teamScores[0] ); CG_DrawString( 632, y, s, UI_RIGHT|UI_DROPSHADOW|UI_GIANTFONT|UI_NOSCALE, NULL ); y += GIANTCHAR_HEIGHT + 16; CG_DrawString( 8, y, "Blue Team", UI_LEFT|UI_DROPSHADOW|UI_GIANTFONT|UI_NOSCALE, NULL ); s = va("%i", cg.teamScores[1] ); CG_DrawString( 632, y, s, UI_RIGHT|UI_DROPSHADOW|UI_GIANTFONT|UI_NOSCALE, NULL ); } else if ( cgs.gametype == GT_TOURNAMENT ) { // // tournament scoreboard // for ( i = 0 ; i < MAX_CLIENTS ; i++ ) { pi = &cgs.playerinfo[i]; if ( !pi->infoValid ) { continue; } if ( pi->team != TEAM_FREE ) { continue; } CG_DrawString( 8, y, pi->name, UI_LEFT|UI_DROPSHADOW|UI_GIANTFONT|UI_NOSCALE, NULL ); s = va("%i", pi->score ); CG_DrawString( 632, y, s, UI_RIGHT|UI_DROPSHADOW|UI_GIANTFONT|UI_NOSCALE, NULL ); y += GIANTCHAR_HEIGHT + 16; } } else { // // free for all scoreboard (players sorted by score) // int style, gap; style = UI_GIANTFONT; gap = GIANTCHAR_HEIGHT + 16; // use smaller font if not all players fit if ( cg.numScores > ( SCREEN_HEIGHT - y ) / gap ) { style = UI_BIGFONT; gap = BIGCHAR_HEIGHT + 4; } for ( i = 0 ; i < cg.numScores; i++ ) { pi = &cgs.playerinfo[ cg.scores[i].playerNum ]; if ( !pi->infoValid ) { continue; } if ( pi->team != TEAM_FREE ) { continue; } CG_DrawString( 8, y, pi->name, UI_LEFT|UI_DROPSHADOW|UI_NOSCALE|style, NULL ); s = va("%i", pi->score ); CG_DrawString( 632, y, s, UI_RIGHT|UI_DROPSHADOW|UI_NOSCALE|style, NULL ); y += gap; if ( y >= SCREEN_HEIGHT ) { break; } } } }
/* ======================================================================================================================================= CG_DrawTourneyScoreboard Draw the oversize scoreboard for tournaments. ======================================================================================================================================= */ void CG_DrawTourneyScoreboard(void) { const char *s; vec4_t color; int min, tens, ones; clientInfo_t *ci; int y; int i; // request more scores regularly if (cg.scoresRequestTime + 2000 < cg.time) { cg.scoresRequestTime = cg.time; trap_SendClientCommand("score"); } // draw the dialog background color[0] = color[1] = color[2] = 0; color[3] = 1; CG_FillRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, color); color[0] = 1; color[1] = 1; color[2] = 1; color[3] = 1; // print the message of the day s = CG_ConfigString(CS_MOTD); if (!s[0]) { s = "Scoreboard"; } // print optional title CG_CenterGiantLine(8, s); // print server time ones = cg.time / 1000; min = ones / 60; ones %= 60; tens = ones / 10; ones %= 10; s = va("%i:%i%i", min, tens, ones); CG_CenterGiantLine(64, s); // print the two scores y = 160; if (cgs.gametype >= GT_TEAM) { // teamplay scoreboard CG_DrawStringExt(8, y, "Red Team", color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0); s = va("%i", cg.teamScores[0]); CG_DrawStringExt(632 - GIANT_WIDTH * strlen(s), y, s, color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0); y += 64; CG_DrawStringExt(8, y, "Blue Team", color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0); s = va("%i", cg.teamScores[1]); CG_DrawStringExt(632 - GIANT_WIDTH * strlen(s), y, s, color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0); } else { // free for all scoreboard for (i = 0; i < MAX_CLIENTS; i++) { ci = &cgs.clientinfo[i]; if (!ci->infoValid) { continue; } if (ci->team != TEAM_FREE) { continue; } CG_DrawStringExt(8, y, ci->name, color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0); s = va("%i", ci->score); CG_DrawStringExt(632 - GIANT_WIDTH * strlen(s), y, s, color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0); y += 64; } } }