/* ================= CG_Cinematic_f ================= */ void CG_Cinematic_f( void ) { char arg[MAX_QPATH]; char s[6]; float x, y, width, height; int bits = CIN_system; Com_DPrintf("CG_Cinematic_f\n"); CG_StopCinematic_f(); trap_Argv( 1, arg, sizeof( arg ) ); trap_Argv( 2, s, sizeof( s ) ); if (s[0] == '1' || Q_stricmp(arg,"demoend.roq")==0 || Q_stricmp(arg,"end.roq")==0) { bits |= CIN_hold; } if (s[0] == '2') { bits |= CIN_loop; } //trap_S_StopAllSounds(); x = 0; y = 0; width = SCREEN_WIDTH; height = SCREEN_HEIGHT; CG_SetScreenPlacement( PLACE_CENTER, PLACE_CENTER ); CG_AdjustFrom640( &x, &y, &width, &height ); cg.cinematicHandle = trap_CIN_PlayCinematic( arg, x, y, width, height, bits ); }
/* ================= 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_DrawScoreboard Draw the normal in-game scoreboard ================= */ qboolean CG_DrawOldScoreboard( void ) { int y, i, n1, n2; float fade; float *fadeColor; char *s; int maxPlayers; int lineHeight; int topBorderSize, bottomBorderSize; CG_SetScreenPlacement(PLACE_CENTER, PLACE_CENTER); // don't draw amuthing if the menu or console is up if ( cg_paused.integer ) { return qfalse; } if ( cgs.gametype == GT_SINGLE_PLAYER && cg.cur_lc && cg.cur_lc->predictedPlayerState.pm_type == PM_INTERMISSION ) { return qfalse; } // don't draw scoreboard during death while warmup up if ( cg.warmup && cg.cur_lc && !cg.cur_lc->showScores ) { return qfalse; } if ( !cg.cur_lc || cg.cur_lc->showScores || cg.cur_lc->predictedPlayerState.pm_type == PM_DEAD || cg.cur_lc->predictedPlayerState.pm_type == PM_INTERMISSION ) { fade = 1.0; fadeColor = colorWhite; } else { fadeColor = CG_FadeColor( cg.cur_lc->scoreFadeTime, FADE_TIME ); if ( !fadeColor ) { // next time scoreboard comes up, don't print killer cg.cur_lc->killerName[0] = 0; return qfalse; } // ZTM: FIXME?: to actually fade, should be fade=fadeColor[3] and later CG_DrawString should use fadeColor fade = *fadeColor; } // fragged by ... line if ( cg.cur_lc && cg.cur_lc->killerName[0] ) { s = va("Fragged by %s", cg.cur_lc->killerName ); y = SB_HEADER - 6 - CG_DrawStringLineHeight( UI_BIGFONT ) * 2; CG_DrawString( SCREEN_WIDTH / 2, y, s, UI_CENTER|UI_DROPSHADOW|UI_BIGFONT, NULL ); } // current rank if ( cgs.gametype < GT_TEAM) { if (cg.cur_ps && cg.cur_ps->persistant[PERS_TEAM] != TEAM_SPECTATOR ) { s = va("%s place with %i", CG_PlaceString( cg.cur_ps->persistant[PERS_RANK] + 1 ), cg.cur_ps->persistant[PERS_SCORE] ); y = SB_HEADER - 6 - CG_DrawStringLineHeight( UI_BIGFONT ); CG_DrawString( SCREEN_WIDTH / 2, y, s, UI_CENTER|UI_DROPSHADOW|UI_BIGFONT, NULL ); } } else { if ( cg.teamScores[0] == cg.teamScores[1] ) { s = va("Teams are tied at %i", cg.teamScores[0] ); } else if ( cg.teamScores[0] >= cg.teamScores[1] ) { s = va("Red leads %i to %i",cg.teamScores[0], cg.teamScores[1] ); } else { s = va("Blue leads %i to %i",cg.teamScores[1], cg.teamScores[0] ); } y = SB_HEADER - 6 - CG_DrawStringLineHeight( UI_BIGFONT ); CG_DrawString( SCREEN_WIDTH / 2, y, s, UI_CENTER|UI_DROPSHADOW|UI_BIGFONT, NULL ); } // scoreboard y = SB_HEADER; CG_DrawPic( SB_SCORE_X + (SB_RATING_WIDTH / 2), y, 64, 32, cgs.media.scoreboardScore ); CG_DrawPic( SB_PING_X - (SB_RATING_WIDTH / 2), y, 64, 32, cgs.media.scoreboardPing ); CG_DrawPic( SB_TIME_X - (SB_RATING_WIDTH / 2), y, 64, 32, cgs.media.scoreboardTime ); CG_DrawPic( SB_NAME_X - (SB_RATING_WIDTH / 2), y, 64, 32, cgs.media.scoreboardName ); y = SB_TOP; // If there are more than SB_MAXPLAYERS_NORMAL, use the interleaved scores if ( cg.numScores > SB_MAXPLAYERS_NORMAL ) { maxPlayers = SB_MAXPLAYERS_INTER; lineHeight = SB_INTER_HEIGHT; topBorderSize = 8; bottomBorderSize = 16; } else { maxPlayers = SB_MAXPLAYERS_NORMAL; lineHeight = SB_NORMAL_HEIGHT; topBorderSize = 16; bottomBorderSize = 16; } localPlayer = qfalse; if ( cgs.gametype >= GT_TEAM ) { // // teamplay scoreboard // y += lineHeight/2; if ( cg.teamScores[0] >= cg.teamScores[1] ) { n1 = CG_TeamScoreboard( y, TEAM_RED, fade, maxPlayers, lineHeight ); CG_DrawTeamBackground( 0, y - topBorderSize, 640, n1 * lineHeight + bottomBorderSize, 0.33f, TEAM_RED ); y += (n1 * lineHeight) + BIGCHAR_HEIGHT; maxPlayers -= n1; n2 = CG_TeamScoreboard( y, TEAM_BLUE, fade, maxPlayers, lineHeight ); CG_DrawTeamBackground( 0, y - topBorderSize, 640, n2 * lineHeight + bottomBorderSize, 0.33f, TEAM_BLUE ); y += (n2 * lineHeight) + BIGCHAR_HEIGHT; maxPlayers -= n2; } else { n1 = CG_TeamScoreboard( y, TEAM_BLUE, fade, maxPlayers, lineHeight ); CG_DrawTeamBackground( 0, y - topBorderSize, 640, n1 * lineHeight + bottomBorderSize, 0.33f, TEAM_BLUE ); y += (n1 * lineHeight) + BIGCHAR_HEIGHT; maxPlayers -= n1; n2 = CG_TeamScoreboard( y, TEAM_RED, fade, maxPlayers, lineHeight ); CG_DrawTeamBackground( 0, y - topBorderSize, 640, n2 * lineHeight + bottomBorderSize, 0.33f, TEAM_RED ); y += (n2 * lineHeight) + BIGCHAR_HEIGHT; maxPlayers -= n2; } n1 = CG_TeamScoreboard( y, TEAM_SPECTATOR, fade, maxPlayers, lineHeight ); y += (n1 * lineHeight) + BIGCHAR_HEIGHT; } else { // // free for all scoreboard // n1 = CG_TeamScoreboard( y, TEAM_FREE, fade, maxPlayers, lineHeight ); y += (n1 * lineHeight) + BIGCHAR_HEIGHT; n2 = CG_TeamScoreboard( y, TEAM_SPECTATOR, fade, maxPlayers - n1, lineHeight ); y += (n2 * lineHeight) + BIGCHAR_HEIGHT; } if (cg.cur_ps && !localPlayer) { // draw local player at the bottom for ( i = 0 ; i < cg.numScores ; i++ ) { if ( cg.scores[i].playerNum == cg.cur_ps->playerNum ) { CG_DrawPlayerScore( y, &cg.scores[i], fadeColor, fade, lineHeight == SB_NORMAL_HEIGHT ); break; } } } return qtrue; }
/* ================ Con_DrawSolidConsole Draws the console with the solid background ================ */ void Con_DrawSolidConsole( connstate_t state, float frac ) { int i; int x, y; int rows; char *text; int row; int lines; vec4_t color; if ( frac > 1 ) frac = 1; lines = cgs.glconfig.vidHeight * frac / cgs.screenYScale; if (lines <= 0) return; CG_SetScreenPlacement( PLACE_STRETCH, PLACE_STRETCH ); // draw the background y = frac * SCREEN_HEIGHT; if ( y < 1 ) { y = 0; } else { CG_DrawPic( 0, 0, SCREEN_WIDTH, y, cgs.media.consoleShader ); } color[0] = 1; color[1] = 0; color[2] = 0; color[3] = 1; CG_FillRect( 0, y, SCREEN_WIDTH, 2, color ); CG_SetScreenPlacement( PLACE_RIGHT, PLACE_TOP ); // draw the version number CG_DrawSmallStringColor( SCREEN_WIDTH - CG_DrawStrlen( con.version ) * SMALLCHAR_WIDTH, lines - SMALLCHAR_HEIGHT, con.version, color ); CG_SetScreenPlacement( PLACE_LEFT, PLACE_TOP ); // draw the text rows = (lines-SMALLCHAR_HEIGHT)/SMALLCHAR_HEIGHT; // rows of text to draw y = lines - (SMALLCHAR_HEIGHT*3); // draw from the bottom up if (con.display != con.current) { int linewidth = con.screenFakeWidth / SMALLCHAR_WIDTH; // draw arrows to show the buffer is backscrolled trap_R_SetColor( color ); for (x=0 ; x<linewidth ; x+=4) CG_DrawChar( (x+1)*SMALLCHAR_WIDTH, y, SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT, '^' ); y -= SMALLCHAR_HEIGHT; rows--; trap_R_SetColor( NULL ); } row = con.display; if ( con.x == 0 ) { row--; } for (i=0 ; i<rows ; i++, y -= SMALLCHAR_HEIGHT, row--) { if (row < 0) break; if (con.current - row >= CON_MAXLINES) { // past scrollback wrap point continue; } text = con.lines[row % CON_MAXLINES]; CG_DrawSmallString( con.sideMargin, y, text, 1.0f ); } // draw the input prompt, user text, and cursor if desired Con_DrawInput ( state, lines ); }
/* ======================================================================================================================================= CG_DrawScoreboard Draw the normal in-game scoreboard. ======================================================================================================================================= */ qboolean CG_DrawScoreboard(void) { int x = 0, y = 0, w; // TTimo init float fade; float *fadeColor; char *s; if (cg_fixedAspect.integer) { CG_SetScreenPlacement(PLACE_CENTER, PLACE_CENTER); } // don't draw anything if the menu or console is up if (cg_paused.integer) { cg.deferredPlayerLoading = 0; return qfalse; } // still need to see 'mission failed' message in SP if (cgs.gametype == GT_SINGLE_PLAYER && cg.predictedPlayerState.pm_type == PM_DEAD) { return qfalse; } if (cgs.gametype == GT_SINGLE_PLAYER && cg.predictedPlayerState.pm_type == PM_INTERMISSION) { cg.deferredPlayerLoading = 0; return qfalse; } // don't draw scoreboard during death while warmup up if (cg.warmup && !cg.showScores) { return qfalse; } if (cg.showScores || cg.predictedPlayerState.pm_type == PM_DEAD || cg.predictedPlayerState.pm_type == PM_INTERMISSION) { fade = 1.0; } else { fadeColor = CG_FadeColor(cg.scoreFadeTime, FADE_TIME); if (!fadeColor) { // next time scoreboard comes up, don't print killer cg.deferredPlayerLoading = 0; cg.killerName[0] = 0; return qfalse; } fade = *fadeColor; } // fragged by ... line if (cg.killerName[0]) { s = va("Killed by %s", cg.killerName); w = CG_DrawStrlen(s) * BIGCHAR_WIDTH; x = (SCREEN_WIDTH - w) / 2; y = 40; CG_DrawBigString(x, y, s, fade); } // current rank // ---- (SA) enclosed this so it doesn't draw for SP if (cgs.gametype != GT_SINGLE_PLAYER && cgs.gametype != GT_WOLF) { // added wolf multiplayer check if (cg.snap->ps.persistant[PERS_TEAM] != TEAM_SPECTATOR) { if (cgs.gametype < GT_TEAM) { s = va("%s place with %i", CG_PlaceString(cg.snap->ps.persistant[PERS_RANK] + 1), cg.snap->ps.persistant[PERS_SCORE]); w = CG_DrawStrlen(s) * BIGCHAR_WIDTH; x = (SCREEN_WIDTH - w) / 2; y = 60; CG_DrawBigString(x, y, s, fade); } else { if (cg.teamScores[0] == cg.teamScores[1]) { s = va("Teams are tied at %i", cg.teamScores[0]); } else if (cg.teamScores[0] >= cg.teamScores[1]) { s = va("Red leads %i to %i", cg.teamScores[0], cg.teamScores[1]); } else { s = va("Blue leads %i to %i", cg.teamScores[1], cg.teamScores[0]); } w = CG_DrawStrlen(s) * BIGCHAR_WIDTH; x = (SCREEN_WIDTH - w) / 2; y = 60; CG_DrawBigString(x, y, s, fade); } } // scoreboard x = 320 - SCOREBOARD_WIDTH / 2; y = 86; #if 0 CG_DrawBigStringColor(x, y, "SCORE PING TIME NAME", fadeColor); CG_DrawBigStringColor(x, y + 12, "---- - ---- ---- -------------- - ", fadeColor); #endif CG_DrawPic(x + 1 * 16, y, 64, 32, cgs.media.scoreboardScore); CG_DrawPic(x + 6 * 16 + 8, y, 64, 32, cgs.media.scoreboardPing); CG_DrawPic(x + 11 * 16 + 8, y, 64, 32, cgs.media.scoreboardTime); CG_DrawPic(x + 16 * 16, y, 64, 32, cgs.media.scoreboardName); y += 32; } // NERVE - SMF if (cgs.gametype == GT_WOLF) { // teamplay scoreboard x = 320 - SCOREBOARD_WIDTH / 2 + 20 + 20; y = 40; y = WM_ScoreboardOverlay(x, y, fade); if (cg.teamScores[0] >= cg.teamScores[1]) { y = WM_TeamScoreboard(x, y, TEAM_RED, fade); y = WM_TeamScoreboard(x, y, TEAM_BLUE, fade); } else { y = WM_TeamScoreboard(x, y, TEAM_BLUE, fade); y = WM_TeamScoreboard(x, y, TEAM_RED, fade); } WM_TeamScoreboard(x, y, TEAM_SPECTATOR, fade); } // - NERVE - SMF } else if (cgs.gametype >= GT_TEAM) {