void CG_demoTimescaleDraw(void) { if(cg.demoPlayback && cgs.timescaleUpdate > cg.time && demo_drawTimeScale.integer != 0) { char *s = va("^3TimeScale: ^7%.1f", cg_timescale.value); int w = CG_DrawStrlen(s) * SMALLCHAR_WIDTH; CG_FillRect(42 - 2, 400, w + 5, SMALLCHAR_HEIGHT + 3, colorDkGreen); CG_DrawRect(42 - 2, 400, w + 5, SMALLCHAR_HEIGHT + 3, 1, colorMdYellow); CG_DrawStringExt(42, 400, s, colorWhite, qfalse, qtrue, SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT, 0); } }
void CG_demoAviFPSDraw(void) { qboolean fKeyDown = cgs.fKeyPressed[K_F1] | cgs.fKeyPressed[K_F2] | cgs.fKeyPressed[K_F3] | cgs.fKeyPressed[K_F4] | cgs.fKeyPressed[K_F5]; if (cg.demoPlayback && fKeyDown && cgs.aviDemoRate >= 0) { CG_DrawStringExt(42, 425, ((cgs.aviDemoRate > 0) ? va("^3Record AVI @ ^7%d^2fps", cgs.aviDemoRate) : "^1Stop AVI Recording"), colorWhite, qfalse, qfalse, SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT - 2, 0); } }
/* ================ CG_CenterGiantLine ================ */ static void CG_CenterGiantLine( float y, const char *string ) { float x; /* vec4_t color; color[0] = 1; color[1] = 1; color[2] = 1; color[3] = 1; */ x = ( SCREEN_WIDTH - GIANT_WIDTH * CG_DrawStrlen(string) )/2; CG_DrawStringExt( x, y, string, colorWhite, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0, SCR_CENTER ); }
/* ================ CG_CenterGiantLine ================ */ static void CG_CenterGiantLine( gfixed y, const char *string ) { gfixed x; vec4_t color; color[0] = GFIXED_1; color[1] = GFIXED_1; color[2] = GFIXED_1; color[3] = GFIXED_1; x = GFIXED(0,5) * MAKE_GFIXED( 640 - GIANT_WIDTH * CG_DrawStrlen( string ) ); CG_DrawStringExt( FIXED_TO_INT(x), FIXED_TO_INT(y), string, color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0 ); }
/* ======================================================================================================================================= CG_CenterGiantLine ======================================================================================================================================= */ static void CG_CenterGiantLine(float y, const char *string) { float x; vec4_t color; color[0] = 1; color[1] = 1; color[2] = 1; color[3] = 1; x = 0.5 * (640 - GIANT_WIDTH * CG_DrawStrlen(string)); CG_DrawStringExt(x, y, string, color, qtrue, qtrue, GIANT_WIDTH, GIANT_HEIGHT, 0); }
void CG_Cutscene2d_Draw(void) { int i; CG_Cutscene2d_Init(); // make sure that we are inited for(i=0;i<MAX_CUTSCENE2D_PICTURES;++i) { cutscene2dPicture_t* pic = &cg_cutscene2d.pics[i]; if(pic->isShown) { trap_R_SetColor(pic->color); CG_DrawPic(pic->x,pic->y,pic->w,pic->h,pic->shader); trap_R_SetColor(NULL); if(pic->text[0]) { char* start, *end; int line=0; start = pic->text; do { end = strstr(start,"\\n"); if(end) end[0] = '\0'; CG_DrawStringExt(pic->x+pic->text_x,pic->y+pic->text_y +line*pic->text_ch, start,pic->textcolor, qfalse, qfalse, pic->text_cw, pic->text_ch, 0 ); if(end) { end[0] = '\\'; start = end+2; } ++line; } while(end); } } } }
static void WM_DrawClientScore_Small( int x, int y, score_t *score, float *color, float fade ) { int maxchars, offset; float tempx; vec4_t hcolor; clientInfo_t *ci; if ( y + SMALLCHAR_HEIGHT >= 470 ) return; ci = &cgs.clientinfo[score->client]; if ( score->client == cg.snap->ps.clientNum ) { tempx = x; hcolor[3] = fade * 0.3; VectorSet( hcolor, .5f, .5f, .2f ); // DARK-RED CG_FillRect( tempx, y + 1, INFO_PLAYER_WIDTH - INFO_BORDER, MINICHAR_HEIGHT - 1, hcolor ); tempx += INFO_PLAYER_WIDTH; if ( ci->team == TEAM_SPECTATOR ) { int width; width = INFO_CLASS_WIDTH + INFO_SCORE_WIDTH + INFO_LATENCY_WIDTH; CG_FillRect( tempx, y + 1, width - INFO_BORDER, MINICHAR_HEIGHT - 1, hcolor ); tempx += width; } else { CG_FillRect( tempx, y + 1, INFO_CLASS_WIDTH - INFO_BORDER, MINICHAR_HEIGHT - 1, hcolor ); tempx += INFO_CLASS_WIDTH; if( cg_gameType.integer == GT_WOLF_LMS ) { CG_FillRect( tempx, y + 1, INFO_SCORE_WIDTH - INFO_BORDER, MINICHAR_HEIGHT - 1, hcolor ); tempx += INFO_SCORE_WIDTH; } else { CG_FillRect( tempx, y + 1, INFO_XP_WIDTH - INFO_BORDER, MINICHAR_HEIGHT - 1, hcolor ); tempx += INFO_XP_WIDTH; } CG_FillRect( tempx, y + 1, INFO_LATENCY_WIDTH - INFO_BORDER, MINICHAR_HEIGHT - 1, hcolor ); tempx += INFO_LATENCY_WIDTH; if( cg_gameType.integer != GT_WOLF_LMS ) { CG_FillRect( tempx, y + 1, INFO_LIVES_WIDTH - INFO_BORDER, MINICHAR_HEIGHT - 1, hcolor ); tempx += INFO_LIVES_WIDTH; } } } tempx = x; // DHM - Nerve VectorSet( hcolor, 1, 1, 1 ); hcolor[3] = fade; maxchars = 17; offset = 0; if ( ci->team != TEAM_SPECTATOR ) { if ( ci->powerups & ( (1 << PW_REDFLAG) | (1 << PW_BLUEFLAG) ) ) { CG_DrawPic( tempx-2, y-4, 20, 20, trap_R_RegisterShader( "models/multiplayer/treasure/treasure" ) ); offset += 14; tempx += 14; maxchars -= 2; } // draw the skull icon if out of lives if ( score->respawnsLeft == -2 || ( cgs.clientinfo[cg.clientNum].team != TEAM_SPECTATOR && ci->team == cgs.clientinfo[cg.clientNum].team && cgs.clientinfo[score->client].health == -1 ) ) { CG_DrawPic( tempx, y, 12, 12, cgs.media.scoreEliminatedShader ); offset += 14; tempx += 14; maxchars -= 2; } else if( cgs.clientinfo[cg.clientNum].team != TEAM_SPECTATOR && ci->team == cgs.clientinfo[cg.clientNum].team && cgs.clientinfo[score->client].health == 0 ) { CG_DrawPic( tempx + 1, y + 1, 10, 10, cgs.media.medicIcon ); offset += 14; tempx += 14; maxchars -= 2; } } // draw name CG_DrawStringExt( tempx, y, ci->name, hcolor, qfalse, qfalse, MINICHAR_WIDTH, MINICHAR_HEIGHT, maxchars ); tempx += INFO_PLAYER_WIDTH - offset; // dhm - nerve if ( ci->team == TEAM_SPECTATOR ) { const char *s; int w, totalwidth; totalwidth = INFO_CLASS_WIDTH + INFO_SCORE_WIDTH + INFO_LATENCY_WIDTH - 8; s = CG_TranslateString( "^3SPECTATOR" ); w = CG_DrawStrlen( s ) * MINICHAR_WIDTH; CG_DrawSmallString( tempx + totalwidth - w, y, s, fade ); return; } else if ( cg.snap->ps.persistant[PERS_TEAM] == ci->team ) { CG_DrawStringExt( tempx, y, CG_TranslateString( BG_ShortClassnameForNumber( score->playerClass ) ), hcolor, qfalse, qfalse, MINICHAR_WIDTH, MINICHAR_HEIGHT, 0 ); // CG_DrawSmallString( tempx, y, CG_TranslateString( s ), fade ); } tempx += INFO_CLASS_WIDTH; CG_DrawStringExt( tempx, y, va( "%3i", score->score ), hcolor, qfalse, qfalse, MINICHAR_WIDTH, MINICHAR_HEIGHT, 0 ); if( cg_gameType.integer == GT_WOLF_LMS ) { tempx += INFO_SCORE_WIDTH; } else { tempx += INFO_XP_WIDTH; } CG_DrawStringExt( tempx, y, va( "%4i", score->ping ), hcolor, qfalse, qfalse, MINICHAR_WIDTH, MINICHAR_HEIGHT, 0 ); tempx += INFO_LATENCY_WIDTH; if( cg_gameType.integer != GT_WOLF_LMS ) { if( score->respawnsLeft >= 0 ) { CG_DrawStringExt( tempx, y, va( "%2i", score->respawnsLeft ), hcolor, qfalse, qfalse, MINICHAR_WIDTH, MINICHAR_HEIGHT, 0 ); } else { CG_DrawStringExt( tempx, y, va( " -", score->respawnsLeft ), hcolor, qfalse, qfalse, MINICHAR_WIDTH, MINICHAR_HEIGHT, 0 ); } tempx += INFO_LIVES_WIDTH; } }
static void WM_DrawClientScore( int x, int y, score_t *score, float *color, float fade ) { int maxchars, offset; int i, j; float tempx; vec4_t hcolor; clientInfo_t *ci; char buf[64]; if ( y + SMALLCHAR_HEIGHT >= 470 ) return; ci = &cgs.clientinfo[score->client]; if ( score->client == cg.snap->ps.clientNum ) { tempx = x; hcolor[3] = fade * 0.3; VectorSet( hcolor, .5f, .5f, .2f ); // DARK-RED CG_FillRect( tempx, y + 1, INFO_PLAYER_WIDTH - INFO_BORDER, SMALLCHAR_HEIGHT - 1, hcolor ); tempx += INFO_PLAYER_WIDTH; if ( ci->team == TEAM_SPECTATOR ) { int width; width = INFO_CLASS_WIDTH + INFO_SCORE_WIDTH + INFO_LATENCY_WIDTH; CG_FillRect( tempx, y + 1, width - INFO_BORDER, SMALLCHAR_HEIGHT - 1, hcolor ); tempx += width; } else { CG_FillRect( tempx, y + 1, INFO_CLASS_WIDTH - INFO_BORDER, SMALLCHAR_HEIGHT - 1, hcolor ); tempx += INFO_CLASS_WIDTH; if( cg_gameType.integer == GT_WOLF_LMS ) { CG_FillRect( tempx, y + 1, INFO_SCORE_WIDTH - INFO_BORDER, SMALLCHAR_HEIGHT - 1, hcolor ); tempx += INFO_SCORE_WIDTH; } else { CG_FillRect( tempx, y + 1, INFO_XP_WIDTH - INFO_BORDER, SMALLCHAR_HEIGHT - 1, hcolor ); tempx += INFO_XP_WIDTH; } CG_FillRect( tempx, y + 1, INFO_LATENCY_WIDTH - INFO_BORDER, SMALLCHAR_HEIGHT - 1, hcolor ); tempx += INFO_LATENCY_WIDTH; if( cg_gameType.integer != GT_WOLF_LMS ) { CG_FillRect( tempx, y + 1, INFO_LIVES_WIDTH - INFO_BORDER, SMALLCHAR_HEIGHT - 1, hcolor ); tempx += INFO_LIVES_WIDTH; } } } tempx = x; // DHM - Nerve VectorSet( hcolor, 1, 1, 1 ); hcolor[3] = fade; maxchars = 16; offset = 0; if ( ci->team != TEAM_SPECTATOR ) { if ( ci->powerups & ( (1 << PW_REDFLAG) | (1 << PW_BLUEFLAG) ) ) { CG_DrawPic( tempx-4, y, 16, 16, cgs.media.objectiveShader ); offset += 8; tempx += 12; maxchars -= 2; } // draw the skull icon if out of lives if( score->respawnsLeft == -2 || (cgs.clientinfo[cg.clientNum].team != TEAM_SPECTATOR && ci->team == cgs.clientinfo[cg.clientNum].team && cgs.clientinfo[score->client].health == -1 ) ) { CG_DrawPic( tempx, y, 18, 18, cgs.media.scoreEliminatedShader ); offset += 18; tempx += 18; maxchars -= 2; } else if( cgs.clientinfo[cg.clientNum].team != TEAM_SPECTATOR && ci->team == cgs.clientinfo[cg.clientNum].team && cgs.clientinfo[score->client].health == 0 ) { CG_DrawPic( tempx + 1, y + 1, 16, 16, cgs.media.medicIcon ); offset += 18; tempx += 18; maxchars -= 2; } } // draw name CG_DrawStringExt( tempx, y, ci->name, hcolor, qfalse, qfalse, SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT, maxchars ); maxchars -= CG_DrawStrlen( ci->name ); // draw medals buf[0] = '\0'; for( i = 0; i < SK_NUM_SKILLS; i++ ) { for( j = 0; j < ci->medals[i]; j++ ) Q_strcat( buf, sizeof(buf), va( "^%c%c", COLOR_RED + i, skillNames[i][0] ) ); } maxchars--; CG_DrawStringExt( tempx + (BG_drawStrlen(ci->name) * SMALLCHAR_WIDTH + SMALLCHAR_WIDTH), y, buf, hcolor, qfalse, qfalse, SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT, maxchars ); tempx += INFO_PLAYER_WIDTH - offset; if ( ci->team == TEAM_SPECTATOR ) { const char *s; int w, totalwidth; totalwidth = INFO_CLASS_WIDTH + INFO_SCORE_WIDTH + INFO_LATENCY_WIDTH - 8; s = CG_TranslateString( "^3SPECTATOR" ); w = CG_DrawStrlen( s ) * SMALLCHAR_WIDTH; CG_DrawSmallString( tempx + totalwidth - w, y, s, fade ); return; } // OSP - allow MV clients see the class of its merged client's on the scoreboard else if ( cg.snap->ps.persistant[PERS_TEAM] == ci->team || CG_mvMergedClientLocate(score->client) ) { CG_DrawSmallString( tempx, y, CG_TranslateString( BG_ShortClassnameForNumber( score->playerClass ) ), fade ); } tempx += INFO_CLASS_WIDTH; CG_DrawSmallString( tempx, y, va( "%3i", score->score ), fade ); if( cg_gameType.integer == GT_WOLF_LMS ) { tempx += INFO_SCORE_WIDTH; } else { tempx += INFO_XP_WIDTH; } CG_DrawSmallString( tempx, y, va( "%4i", score->ping ), fade ); tempx += INFO_LATENCY_WIDTH; if( cg_gameType.integer != GT_WOLF_LMS ) { if( score->respawnsLeft >= 0 ) { CG_DrawSmallString( tempx, y, va( "%2i", score->respawnsLeft ), fade ); } else { CG_DrawSmallString( tempx, y, va( " -", score->respawnsLeft ), fade ); } tempx += INFO_LIVES_WIDTH; } }
void CG_DrawSmallStringColor( int x, int y, const char *s, const vector4 *color ) { CG_DrawStringExt(x, y, s, color, qtrue, qfalse, SMALLCHAR_WIDTH * cgs.widthRatioCoef, SMALLCHAR_HEIGHT, 0); }
void CG_DrawBigStringColor( int x, int y, const char *s, const vector4 *color ) { CG_DrawStringExt(x, y, s, color, qtrue, qtrue, BIGCHAR_WIDTH * cgs.widthRatioCoef, BIGCHAR_HEIGHT, 0); }
void CG_DrawTinyStringColor( int x, int y, const char *s, vec4_t color ) { CG_DrawStringExt( x, y, s, color, qtrue, qfalse, TINYCHAR_WIDTH, TINYCHAR_HEIGHT, 0 ); }
static void WM_DrawClientScore(int x, int y, score_t * score, float *color, float fade) { int maxchars, offset; int i, j; float tempx; vec4_t hcolor; clientInfo_t *ci; char buf[64]; // CHRUKER: b0?? - Was using the wrong char height for this calculation if(y + SMALLCHAR_HEIGHT >= 470) { return; } ci = &cgs.clientinfo[score->client]; if(score->client == cg.snap->ps.clientNum) { hcolor[3] = fade * 0.3; VectorSet(hcolor, .5f, .5f, .2f); // DARK-RED // CHRUKER: b077 - Player highlighting was split into columns CG_FillRect( x-5, y, (INFO_PLAYER_WIDTH + INFO_CLASS_WIDTH + INFO_SCORE_WIDTH + INFO_LATENCY_WIDTH + 5), SMALLCHAR_HEIGHT - 1, hcolor ); } tempx = x; // DHM - Nerve VectorSet(hcolor, 1, 1, 1); hcolor[3] = fade; maxchars = 16; offset = 0; if(ci->team != TEAM_SPECTATOR) { if(ci->powerups & ((1 << PW_REDFLAG) | (1 << PW_BLUEFLAG))) { // CHRUKER: b078 - Medic, death and objective icons on the scoreboard are drawn too big CG_DrawPic( tempx - 3, y + 1, 14, 14, cgs.media.objectiveShader ); offset += 14; // CHRUKER: b072 - Need to match tempx or else the other text gets offset tempx += 14; maxchars -= 2; } // draw the skull icon if out of lives if(score->respawnsLeft == -2 || (cgs.clientinfo[cg.clientNum].team != TEAM_SPECTATOR && ci->team == cgs.clientinfo[cg.clientNum].team && cgs.clientinfo[score->client].health == -1)) { // CHRUKER: b078 - Medic, death and objective icons on the scoreboard are drawn too big CG_DrawPic( tempx - 3, y + 1, 14, 14, cgs.media.scoreEliminatedShader ); offset += 14; tempx += 14; maxchars -= 2; } else if(cgs.clientinfo[cg.clientNum].team != TEAM_SPECTATOR && ci->team == cgs.clientinfo[cg.clientNum].team && cgs.clientinfo[score->client].health == 0) { // CHRUKER: b078 - Medic, death and objective icons on the scoreboard are drawn too big CG_DrawPic( tempx - 3, y + 1, 14, 14, cgs.media.medicIcon ); offset += 14; tempx += 14; maxchars -= 2; } } // draw name CG_DrawStringExt(tempx, y, ci->name, hcolor, qfalse, qfalse, SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT, maxchars); maxchars -= CG_DrawStrlen(ci->name); // draw medals buf[0] = '\0'; for(i = 0; i < SK_NUM_SKILLS; i++) { for(j = 0; j < ci->medals[i]; j++) Q_strcat(buf, sizeof(buf), va("^%c%c", COLOR_RED + i, skillNames[i][0])); } maxchars--; // CHRUKER: b032 - Medals clipped wrong in scoreboard when you're dead, because CG_DrawStringExt will draw // everything if maxchars <= 0 if (maxchars > 0) { CG_DrawStringExt(tempx + (BG_drawStrlen(ci->name) * SMALLCHAR_WIDTH + SMALLCHAR_WIDTH), y, buf, hcolor, qfalse, qfalse, SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT, maxchars); } tempx += INFO_PLAYER_WIDTH - offset; if(ci->team == TEAM_SPECTATOR) { const char *s; int w, totalwidth; totalwidth = INFO_CLASS_WIDTH + INFO_SCORE_WIDTH + INFO_LATENCY_WIDTH - 8; // CHRUKER: b031 - Show connecting people as connecting if (score->ping == -1) { s = CG_TranslateString( "^1CONNECTING" ); } else { s = CG_TranslateString( "^3SPECTATOR" ); } w = CG_DrawStrlen(s) * SMALLCHAR_WIDTH; CG_DrawSmallString(tempx + totalwidth - w, y, s, fade); return; } // OSP - allow MV clients see the class of its merged client's on the scoreboard else if(cg.snap->ps.persistant[PERS_TEAM] == ci->team || CG_mvMergedClientLocate(score->client)) { CG_DrawSmallString(tempx, y, CG_TranslateString(BG_ShortClassnameForNumber(score->playerClass)), fade); } tempx += INFO_CLASS_WIDTH; CG_DrawSmallString(tempx, y, va("%3i", score->score), fade); if(cg_gameType.integer == GT_WOLF_LMS) { tempx += INFO_SCORE_WIDTH; } else { tempx += INFO_XP_WIDTH; } CG_DrawSmallString(tempx, y, va("%4i", score->ping), fade); tempx += INFO_LATENCY_WIDTH; if(cg_gameType.integer != GT_WOLF_LMS) { if(score->respawnsLeft >= 0) { CG_DrawSmallString(tempx, y, va("%2i", score->respawnsLeft), fade); } else { CG_DrawSmallString(tempx, y, " -", fade); } tempx += INFO_LIVES_WIDTH; } }
static void WM_DrawClientScore_Small(int x, int y, score_t * score, float *color, float fade) { int maxchars, offset; float tempx; vec4_t hcolor; clientInfo_t *ci; // CHRUKER: b033 - Added to draw medals int i, j; char buf[64]; if(y + MINICHAR_HEIGHT >= 470) { return; } ci = &cgs.clientinfo[score->client]; if(score->client == cg.snap->ps.clientNum) { hcolor[3] = fade * 0.3; VectorSet(hcolor, .5f, .5f, .2f); // DARK-RED // CHRUKER: b077 - Player highlighting was split into columns CG_FillRect( x-5, y, (INFO_PLAYER_WIDTH + INFO_CLASS_WIDTH + INFO_SCORE_WIDTH + INFO_LATENCY_WIDTH + 5), MINICHAR_HEIGHT - 1, hcolor ); } tempx = x; // DHM - Nerve VectorSet(hcolor, 1, 1, 1); hcolor[3] = fade; // CHRUKER: b033 - Corrected to draw medals maxchars = 16; offset = 0; if(ci->team != TEAM_SPECTATOR) { if(ci->powerups & ((1 << PW_REDFLAG) | (1 << PW_BLUEFLAG))) { // CHRUKER: b071 - Objective carrier icon missing on compact scoreboard // CHRUKER: b078 - Medic, death and objective icons on the scoreboard are drawn too big CG_DrawPic( tempx - 1, y + 1, 10, 10, cgs.media.objectiveShader ); offset += 10; tempx += 10; maxchars -= 2; } // draw the skull icon if out of lives if(score->respawnsLeft == -2 || (cgs.clientinfo[cg.clientNum].team != TEAM_SPECTATOR && ci->team == cgs.clientinfo[cg.clientNum].team && cgs.clientinfo[score->client].health == -1)) { // CHRUKER: b078 - Medic, death and objective icons on the scoreboard are drawn too big CG_DrawPic( tempx - 1, y + 1, 10, 10, cgs.media.scoreEliminatedShader ); offset += 10; tempx += 10; maxchars -= 2; } else if(cgs.clientinfo[cg.clientNum].team != TEAM_SPECTATOR && ci->team == cgs.clientinfo[cg.clientNum].team && cgs.clientinfo[score->client].health == 0) { // CHRUKER: b078 - Medic, death and objective icons on the scoreboard are drawn too big CG_DrawPic( tempx - 1, y + 1, 10, 10, cgs.media.medicIcon ); offset += 10; tempx += 10; maxchars -= 2; } } // draw name CG_DrawStringExt(tempx, y, ci->name, hcolor, qfalse, qfalse, MINICHAR_WIDTH, MINICHAR_HEIGHT, maxchars); // CHRUKER: b033 - Added to draw medals maxchars -= CG_DrawStrlen( ci->name ); buf[0] = '\0'; for( i = 0; i < SK_NUM_SKILLS; i++ ) { for( j = 0; j < ci->medals[i]; j++ ) { Q_strcat( buf, sizeof(buf), va( "^%c%c", COLOR_RED + i, skillNames[i][0] ) ); } } maxchars--; if (maxchars > 0) CG_DrawStringExt( tempx + (BG_drawStrlen(ci->name) * MINICHAR_WIDTH + MINICHAR_WIDTH), y, buf, hcolor, qfalse, qfalse, MINICHAR_WIDTH, MINICHAR_HEIGHT, maxchars ); // b033 tempx += INFO_PLAYER_WIDTH - offset; // dhm - nerve if(ci->team == TEAM_SPECTATOR) { const char *s; int w, totalwidth; totalwidth = INFO_CLASS_WIDTH + INFO_SCORE_WIDTH + INFO_LATENCY_WIDTH - 8; // CHRUKER: b031 - Show connecting people as connecting if (score->ping == -1) { s = CG_TranslateString( "^1CONNECTING" ); } else { s = CG_TranslateString( "^3SPECTATOR" ); } w = CG_DrawStrlen(s) * MINICHAR_WIDTH; // CHRUKER: b034 - Using the mini char height CG_DrawStringExt( tempx + totalwidth - w, y, s, hcolor, qfalse, qfalse, MINICHAR_WIDTH, MINICHAR_HEIGHT, 0 ); return; } else if(cg.snap->ps.persistant[PERS_TEAM] == ci->team) { CG_DrawStringExt(tempx, y, CG_TranslateString(BG_ShortClassnameForNumber(score->playerClass)), hcolor, qfalse, qfalse, MINICHAR_WIDTH, MINICHAR_HEIGHT, 0); // CG_DrawSmallString( tempx, y, CG_TranslateString( s ), fade ); } tempx += INFO_CLASS_WIDTH; CG_DrawStringExt(tempx, y, va("%3i", score->score), hcolor, qfalse, qfalse, MINICHAR_WIDTH, MINICHAR_HEIGHT, 0); if(cg_gameType.integer == GT_WOLF_LMS) { tempx += INFO_SCORE_WIDTH; } else { tempx += INFO_XP_WIDTH; } CG_DrawStringExt(tempx, y, va("%4i", score->ping), hcolor, qfalse, qfalse, MINICHAR_WIDTH, MINICHAR_HEIGHT, 0); tempx += INFO_LATENCY_WIDTH; if(cg_gameType.integer != GT_WOLF_LMS) { if(score->respawnsLeft >= 0) { CG_DrawStringExt(tempx, y, va("%2i", score->respawnsLeft), hcolor, qfalse, qfalse, MINICHAR_WIDTH, MINICHAR_HEIGHT, 0); } else { CG_DrawStringExt(tempx, y, " -", hcolor, qfalse, qfalse, MINICHAR_WIDTH, MINICHAR_HEIGHT, 0); } tempx += INFO_LIVES_WIDTH; } }
static void WM_DrawClientScore( int x, int y, score_t *score, float *color, float fade ) { int maxchars, offset; float tempx; vec4_t hcolor; clientInfo_t *ci; if ( y + SMALLCHAR_HEIGHT >= 470 ) { return; } ci = &cgs.clientinfo[score->client]; if ( score->client == cg.snap->ps.clientNum ) { tempx = x; hcolor[3] = fade * 0.3; VectorSet( hcolor, 0.4452, 0.1172, 0.0782 ); // DARK-RED CG_FillRect( tempx, y + 1, INFO_PLAYER_WIDTH - INFO_BORDER, SMALLCHAR_HEIGHT - 1, hcolor ); tempx += INFO_PLAYER_WIDTH; if ( ci->team == TEAM_SPECTATOR ) { int width; width = INFO_CLASS_WIDTH + INFO_SCORE_WIDTH + INFO_LATENCY_WIDTH; CG_FillRect( tempx, y + 1, width - INFO_BORDER, SMALLCHAR_HEIGHT - 1, hcolor ); tempx += width; } else { CG_FillRect( tempx, y + 1, INFO_CLASS_WIDTH - INFO_BORDER, SMALLCHAR_HEIGHT - 1, hcolor ); tempx += INFO_CLASS_WIDTH; CG_FillRect( tempx, y + 1, INFO_SCORE_WIDTH - INFO_BORDER, SMALLCHAR_HEIGHT - 1, hcolor ); tempx += INFO_SCORE_WIDTH; CG_FillRect( tempx, y + 1, INFO_LATENCY_WIDTH - INFO_BORDER, SMALLCHAR_HEIGHT - 1, hcolor ); tempx += INFO_LATENCY_WIDTH; } } tempx = x; // DHM - Nerve VectorSet( hcolor, 1, 1, 1 ); hcolor[3] = fade; maxchars = 17; offset = 0; if ( ci->team != TEAM_SPECTATOR ) { if ( ci->powerups & ( ( 1 << PW_REDFLAG ) | ( 1 << PW_BLUEFLAG ) ) ) { CG_DrawPic( tempx - 4, y - 4, 24, 24, trap_R_RegisterShader( "models/multiplayer/treasure/treasure" ) ); offset += 16; tempx += 16; maxchars -= 2; } // draw the skull icon if out of lives if ( score->respawnsLeft == -2 ) { CG_DrawPic( tempx, y, 18, 18, cgs.media.scoreEliminatedShader ); offset += 18; tempx += 18; maxchars -= 2; } } // draw name CG_DrawStringExt( tempx, y, ci->name, hcolor, qfalse, qfalse, SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT, maxchars ); tempx += INFO_PLAYER_WIDTH - offset; // dhm - nerve if ( ci->team == TEAM_SPECTATOR ) { const char *s; int w, totalwidth; totalwidth = INFO_CLASS_WIDTH + INFO_SCORE_WIDTH + INFO_LATENCY_WIDTH - 8; s = CG_TranslateString( "^3SPECTATOR" ); w = CG_DrawStrlen( s ) * SMALLCHAR_WIDTH; CG_DrawSmallString( tempx + totalwidth - w, y, s, fade ); return; } else if ( cg.snap->ps.persistant[PERS_TEAM] == ci->team ) { int val = score->playerClass; // cg_entities[ ci->clientNum ].currentState.teamNum; const char *s; if ( val == 0 ) { s = "Soldr"; } else if ( val == 1 ) { s = "Medic"; } else if ( val == 2 ) { s = "Engr"; } else if ( val == 3 ) { s = "Lieut"; } else { s = ""; } CG_DrawSmallString( tempx, y, CG_TranslateString( s ), fade ); } tempx += INFO_CLASS_WIDTH; CG_DrawSmallString( tempx, y, va( "%4i", score->score ), fade ); tempx += INFO_SCORE_WIDTH; CG_DrawSmallString( tempx, y, va( "%4i", score->ping ), fade ); tempx += INFO_LATENCY_WIDTH; }
static void WM_DrawClientScore(int x, int y, score_t *score, float *color, float fade) { int maxchars, offset; int i, j; float tempx; vec4_t hcolor; clientInfo_t *ci; char buf[64]; if (y + SMALLCHAR_HEIGHT >= 470) { return; } ci = &cgs.clientinfo[score->client]; if (score->client == cg.snap->ps.clientNum) { hcolor[3] = fade * 0.3; VectorSet(hcolor, .5f, .5f, .2f); // DARK-RED CG_FillRect(x - 5, y, (INFO_TOTAL_WIDTH + 5), SMALLCHAR_HEIGHT - 1, hcolor); } tempx = x; VectorSet(hcolor, 1, 1, 1); hcolor[3] = fade; maxchars = 16; offset = 0; if (ci->team != TEAM_SPECTATOR) { /* FIXME: adjust x,y coordinates ... // draw ready icon if client is ready.. if (score->scoreflags & 1 && cgs.gamestate != GS_PLAYING) { CG_DrawPic(tempx - 3, y + 1, 14, 14, cgs.media.readyIcon); offset += 14; tempx += 14; maxchars -= 2; } */ if (ci->powerups & ((1 << PW_REDFLAG) | (1 << PW_BLUEFLAG))) { CG_DrawPic(tempx - 1, y + 1, 14, 14, cgs.media.objectiveShader); offset += 14; tempx += 14; maxchars -= 2; } if (cgs.gametype == GT_WOLF_GOLDY && ci->team == cgs.clientinfo[cg.clientNum].team && ci->gold > 0 && ci->health != -1) { CG_DrawPic(tempx - 1, y + 1, 14, 14, cgs.media.goldIcon); offset += 14; tempx += 14; maxchars -= 2; } // draw the skull icon if out of lives if (score->respawnsLeft == -2 || (cgs.clientinfo[cg.clientNum].team != TEAM_SPECTATOR && ci->team == cgs.clientinfo[cg.clientNum].team && cgs.clientinfo[score->client].health == -1)) { CG_DrawPic(tempx - 1, y + 1, 14, 14, cgs.media.scoreEliminatedShader); offset += 14; tempx += 14; maxchars -= 2; } else if (cgs.clientinfo[cg.clientNum].team != TEAM_SPECTATOR && ci->team == cgs.clientinfo[cg.clientNum].team && cgs.clientinfo[score->client].health == 0) { CG_DrawPic(tempx - 1, y + 1, 14, 14, cgs.media.medicIcon); offset += 14; tempx += 14; maxchars -= 2; } } // GeoIP - draw flag before name if (score->ping != -1 && score->ping != 999 && cg_countryflags.integer) { if (cf_draw(tempx - 11, y - 8, fade, ci->clientNum)) { offset += 14; tempx += 14; maxchars -= 2; } } // draw name CG_DrawStringExt(tempx, y, ci->name, hcolor, qfalse, qfalse, SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT, maxchars); maxchars -= CG_DrawStrlen(ci->name); // draw medals buf[0] = '\0'; for (i = 0; i < SK_NUM_SKILLS; i++) { for (j = 0; j < ci->medals[i]; j++) { Q_strcat(buf, sizeof(buf), va("^%c%c", COLOR_RED + i, skillNames[i][0])); } } maxchars--; // CG_DrawStringExt will draw everything if maxchars <= 0 if (maxchars > 0) { CG_DrawStringExt(tempx + (BG_drawStrlen(ci->name) * SMALLCHAR_WIDTH + SMALLCHAR_WIDTH), y, buf, hcolor, qfalse, qfalse, SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT, maxchars); } tempx += INFO_PLAYER_WIDTH - offset; if (ci->team == TEAM_SPECTATOR) { const char *s; int w, totalwidth = INFO_CLASS_WIDTH + INFO_SCORE_WIDTH + INFO_LATENCY_WIDTH - 8; // Show connecting people as CONNECTING if (score->ping == -1) { s = CG_TranslateString("^3CONNECTING"); } else { s = CG_TranslateString("^3SPECTATOR"); } w = CG_DrawStrlen(s) * SMALLCHAR_WIDTH; CG_DrawSmallString(tempx + totalwidth - w, y, s, fade); return; } // allow MV clients see the class of its merged client's on the scoreboard else if (cg.snap->ps.persistant[PERS_TEAM] == ci->team || cg.snap->ps.persistant[PERS_TEAM] == TEAM_SPECTATOR || cg.snap->ps.pm_type == PM_INTERMISSION #if FEATURE_MULTIVIEW || CG_mvMergedClientLocate(score->client) #endif ) { CG_DrawPic(tempx - 3, y + 1, 14, 14, cgs.media.skillPics[SkillNumForClass(ci->cls)]); } tempx += INFO_CLASS_WIDTH; CG_DrawSmallString(tempx, y, va("^7%3i", score->score), fade); if (cg_gameType.integer == GT_WOLF_LMS) { tempx += INFO_SCORE_WIDTH; } else { tempx += INFO_XP_WIDTH; } if (score->ping == -1) { CG_DrawSmallString(tempx, y, "^1CONN^7", fade); } else if (score->scoreflags & 2) { CG_DrawSmallString(tempx, y, " BOT", fade); } else { CG_DrawSmallString(tempx, y, va("%4i", score->ping), fade); } tempx += INFO_LATENCY_WIDTH; if (cg_gameType.integer != GT_WOLF_LMS) { if (score->respawnsLeft >= 0) { CG_DrawSmallString(tempx, y, va("%2i", score->respawnsLeft), fade); } else { CG_DrawSmallString(tempx, y, " -", fade); } } }
static void WM_DrawClientScore_Small(int x, int y, score_t *score, float *color, float fade) { int maxchars, offset; float tempx; vec4_t hcolor; clientInfo_t *ci; int i, j; // To draw medals char buf[64]; // To draw medals if (y + MINICHAR_HEIGHT >= 470) { return; } ci = &cgs.clientinfo[score->client]; if (score->client == cg.snap->ps.clientNum) { hcolor[3] = fade * 0.3; VectorSet(hcolor, .5f, .5f, .2f); // DARK-RED CG_FillRect(x - 5, y, (INFO_TOTAL_WIDTH + 5), MINICHAR_HEIGHT - 1, hcolor); } tempx = x; VectorSet(hcolor, 1, 1, 1); hcolor[3] = fade; maxchars = 16; offset = 0; if (ci->team != TEAM_SPECTATOR) { /* FIXME adjust x,y coordinates ... // draw ready icon if client is ready.. if ( score->scoreflags & 1 && ( cgs.gamestate == GS_WARMUP || cgs.gamestate == GS_INTERMISSION ) ) { CG_DrawPic( tempx-2 + 1, y + 1, 14, 14, cgs.media.readyIcon ); offset += 14; tempx += 14; maxchars -= 2; } */ if (ci->powerups & ((1 << PW_REDFLAG) | (1 << PW_BLUEFLAG))) { CG_DrawPic(tempx + 1, y + 1, 10, 10, cgs.media.objectiveShader); offset += 14; tempx += 14; maxchars -= 2; } // draw the skull icon if out of lives if (score->respawnsLeft == -2 || (cgs.clientinfo[cg.clientNum].team != TEAM_SPECTATOR && ci->team == cgs.clientinfo[cg.clientNum].team && cgs.clientinfo[score->client].health == -1)) { CG_DrawPic(tempx, y, 12, 12, cgs.media.scoreEliminatedShader); offset += 14; tempx += 14; maxchars -= 2; } else if (cgs.clientinfo[cg.clientNum].team != TEAM_SPECTATOR && ci->team == cgs.clientinfo[cg.clientNum].team && cgs.clientinfo[score->client].health == 0) { CG_DrawPic(tempx + 1, y + 1, 10, 10, cgs.media.medicIcon); offset += 14; tempx += 14; maxchars -= 2; } } // GeoIP - draw flag before name if (score->ping != -1 && score->ping != 999 && cg_countryflags.integer) { if (cf_draw(tempx - 11, y - 10, fade, ci->clientNum)) { offset += 14; tempx += 14; maxchars -= 2; } } // draw name CG_DrawStringExt(tempx, y, ci->name, hcolor, qfalse, qfalse, MINICHAR_WIDTH, MINICHAR_HEIGHT, maxchars); // draw medals maxchars -= CG_DrawStrlen(ci->name); buf[0] = '\0'; for (i = 0; i < SK_NUM_SKILLS; i++) { for (j = 0; j < ci->medals[i]; j++) { Q_strcat(buf, sizeof(buf), va("^%c%c", COLOR_RED + i, skillNames[i][0])); } maxchars--; } if (maxchars > 0) { CG_DrawStringExt(tempx + (BG_drawStrlen(ci->name) * MINICHAR_WIDTH + MINICHAR_WIDTH), y, buf, hcolor, qfalse, qfalse, MINICHAR_WIDTH, MINICHAR_HEIGHT, maxchars); } tempx += INFO_PLAYER_WIDTH - offset; if (ci->team == TEAM_SPECTATOR) { const char *s; int w, totalwidth = INFO_CLASS_WIDTH + INFO_SCORE_WIDTH + INFO_LATENCY_WIDTH - 8; // Show connecting people as CONNECTING if (score->ping == -1) { s = CG_TranslateString("^3CONNECTING"); } else { s = CG_TranslateString("^3SPECTATOR"); } w = CG_DrawStrlen(s) * MINICHAR_WIDTH; CG_DrawStringExt(tempx + totalwidth - w, y, s, hcolor, qfalse, qfalse, MINICHAR_WIDTH, MINICHAR_HEIGHT, 0); return; } else if (cg.snap->ps.persistant[PERS_TEAM] == ci->team || cg.snap->ps.persistant[PERS_TEAM] == TEAM_SPECTATOR) { CG_DrawPic(tempx, y - 2, 12, 12, cgs.media.skillPics[SkillNumForClass(ci->cls)]); } tempx += INFO_CLASS_WIDTH; CG_DrawStringExt(tempx, y, va("%3i", score->score), hcolor, qfalse, qfalse, MINICHAR_WIDTH, MINICHAR_HEIGHT, 0); if (cg_gameType.integer == GT_WOLF_LMS) { tempx += INFO_SCORE_WIDTH; } else { tempx += INFO_XP_WIDTH; } if (score->ping == -1) { CG_DrawStringExt(tempx, y, "^1CONN", hcolor, qfalse, qfalse, MINICHAR_WIDTH, MINICHAR_HEIGHT, 0); } else if (score->scoreflags & 2) { CG_DrawStringExt(tempx, y, " ^4BOT", hcolor, qfalse, qfalse, MINICHAR_WIDTH, MINICHAR_HEIGHT, 0); } else { CG_DrawStringExt(tempx, y, va("%4i", score->ping), hcolor, qfalse, qfalse, MINICHAR_WIDTH, MINICHAR_HEIGHT, 0); } tempx += INFO_LATENCY_WIDTH; if (cg_gameType.integer != GT_WOLF_LMS) { if (score->respawnsLeft >= 0) { CG_DrawStringExt(tempx, y, va("%2i", score->respawnsLeft), hcolor, qfalse, qfalse, MINICHAR_WIDTH, MINICHAR_HEIGHT, 0); } else { CG_DrawStringExt(tempx, y, " -", hcolor, qfalse, qfalse, MINICHAR_WIDTH, MINICHAR_HEIGHT, 0); } tempx += INFO_LIVES_WIDTH; } }
/* ======================================================================================================================================= 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; } } }
void CG_DrawBigStringColor( int x, int y, const char *s, vec4_t color ) { CG_DrawStringExt( x, y, s, color, qtrue, qtrue, BIGCHAR_WIDTH, BIGCHAR_HEIGHT, 0 ); }
void CG_DrawSmallString( int x, int y, const char *s, float alpha ) { vector4 color; VectorSet4( &color, 1.0f, 1.0f, 1.0f, alpha ); CG_DrawStringExt( x, y, s, &color, qfalse, qfalse, SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT, 0 ); }
/* ==================== CG_DrawInformation Draw all the status / pacifier stuff during level loading and ingame ==================== **/ void CG_DrawInformation (qboolean loading) { const char *s; const char *info; const char *sysInfo; int y; int value; qhandle_t levelshot; qhandle_t detail; char buf[1024]; //vec4_t color; int n; int lines; info = CG_ConfigString( CS_SERVERINFO ); sysInfo = CG_ConfigString( CS_SYSTEMINFO ); if (loading) { QLWideScreen = 0; s = Info_ValueForKey( info, "mapname" ); if (CG_FileExists(va("levelshots/%s.tga", s)) || CG_FileExists(va("levelshots/%s.jpg", s))) { levelshot = trap_R_RegisterShaderNoMip( va( "levelshots/%s.tga", s ) ); } else { levelshot = trap_R_RegisterShaderNoMip( "menu/art/unknownmap" ); } if ( !levelshot ) { levelshot = trap_R_RegisterShaderNoMip( "menu/art/unknownmap" ); } trap_R_SetColor( NULL ); //trap_R_SetColor(colorBlue); //Vector4Set(color, 0, 0, 1, 1); //trap_R_SetColor(color); CG_DrawPic( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, levelshot ); //FIXME new ql 2014-09-07 not found and spams "RE_RegisterShader(levelShotDetail) failed" // blend a detail texture over it detail = trap_R_RegisterShader( "wc/levelShotDetail" ); if (detail) { trap_R_DrawStretchPic( 0, 0, cgs.glconfig.vidWidth, cgs.glconfig.vidHeight, 0, 0, 2.5, 2, detail ); } // draw the icons of things as they are loaded QLWideScreen = 2; CG_DrawLoadingIcons(); // the first 150 rows are reserved for the client connection // screen to write into if ( cg.infoScreenText[0] ) { UI_DrawProportionalString3( 320, 128-32, va("Loading... %s", cg.infoScreenText), UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorWhite ); } else { UI_DrawProportionalString3( 320, 128-32, "Awaiting snapshot...", UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorWhite ); } } // loading QLWideScreen = 1; //CG_DrawStringExt(2, 2, va("wolfcamql version %s Τη γλώσσα μου έδωσαν ελληνική test test", WOLFCAM_VERSION), colorYellow, qfalse, qtrue, SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT, 0, &cgs.media.smallchar); //CG_DrawStringExt(2, 2, va("wolfcamql version %s Τη γλώσσα μου έδωσαν ελληνική test test", WOLFCAM_VERSION), colorYellow, qfalse, qtrue, SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT, 0, &cgs.media.bigchar); CG_DrawStringExt(2, 2, va("wolfcamql version %s", WOLFCAM_VERSION), colorYellow, qfalse, qtrue, SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT, 0, &cgs.media.bigchar); QLWideScreen = 2; // draw info string information if (loading) { //y = 200 - 32; y = 160 - 32; } else { y = 20; } // don't print server lines if playing a local game trap_Cvar_VariableStringBuffer( "sv_running", buf, sizeof( buf ) ); if (1) { //( !atoi( buf ) ) { int timePlayed; if (cgs.cpma) { //Com_Printf("^11: %s\n", CG_GetLocalTimeString()); } timePlayed = atoi(Info_ValueForKey(CG_ConfigString(CS_SERVERINFO), "g_levelStartTime")); if (timePlayed) { lines = UI_DrawProportionalString3(320, y, CG_GetLocalTimeString(), UI_CENTER | UI_SMALLFONT|UI_DROPSHADOW, colorYellow); y += PROP_HEIGHT * lines; } // server hostname lines = UI_DrawProportionalString3( 320, y, Info_ValueForKey(info, "sv_hostname"), UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorWhite); y += PROP_HEIGHT * lines; // ranked or mod if (cgs.protocol == PROTOCOL_QL && cgs.realProtocol < 91) { value = atoi(Info_ValueForKey(info, "sv_ranked")); Com_sprintf(buf, sizeof(buf), "(%s server)", value ? "ranked" : "unranked"); } else if (cgs.protocol == PROTOCOL_Q3) { // mod: baseq3, osp, cpma, etc.. if (cgs.ospEncrypt) { Com_sprintf(buf, sizeof(buf), "osp ^6encrypted"); } else if (cgs.osp) { Com_sprintf(buf, sizeof(buf), "osp"); } else if (cgs.cpma) { Com_sprintf(buf, sizeof(buf), "cpma: %s", Info_ValueForKey(CG_ConfigString(CS_SERVERINFO), "server_gameplay")); } else { Com_sprintf(buf, sizeof(buf), "%s", CG_ConfigString(CS_GAME_VERSION)); } } else { // current ql, skip //FIXME check for maybe minix or something else? buf[0] = '\0'; } if (buf[0] != '\0') { lines = UI_DrawProportionalString3( 320, y, buf, UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorYellow); y += PROP_HEIGHT * lines; } // pure server s = Info_ValueForKey( sysInfo, "sv_pure" ); if ( s[0] == '1' ) { lines = UI_DrawProportionalString3( 320, y, va("Pure Server protocol %d", SC_Cvar_Get_Int("real_protocol")), UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorCyan ); y += PROP_HEIGHT * lines; } else { lines = UI_DrawProportionalString3( 320, y, va("Impure Server protocol %d", SC_Cvar_Get_Int("real_protocol")), UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorRed ); y += PROP_HEIGHT * lines; } // server-specific message of the day s = CG_ConfigString( CS_MOTD ); if ( s[0] ) { lines = UI_DrawProportionalString3( 320, y, s, UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorWhite ); y += PROP_HEIGHT * lines; } // some extra space after hostname and motd y += 10; } // map-specific message (long map name) //s = CG_ConfigString( CS_MESSAGE ); s = va("^1(%s.bsp) ^7%s", Info_ValueForKey(info, "mapname"), CG_ConfigString(CS_MESSAGE)); if ( s[0] ) { lines = UI_DrawProportionalString3( 320, y, s, UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorWhite ); y += PROP_HEIGHT * lines; } // cheats warning s = Info_ValueForKey( sysInfo, "sv_cheats" ); if ( s[0] == '1' ) { lines = UI_DrawProportionalString3( 320, y, "CHEATS ARE ENABLED", UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorRed ); y += PROP_HEIGHT * lines; } // game type if (cgs.gametype == GT_FFA) { s = "Free For All"; } else if (cgs.gametype == GT_SINGLE_PLAYER) { s = "Single Player"; } else if (cgs.gametype == GT_TOURNAMENT) { s = "Duel"; } else if (cgs.gametype == GT_TEAM) { s = "Team Deathmatch"; } else if (cgs.gametype == GT_CA) { s = "Clan Arena"; } else if (cgs.gametype == GT_CTF) { s = "Capture The Flag"; } else if (cgs.gametype == GT_1FCTF) { s = "One Flag CTF"; } else if (cgs.gametype == GT_CTFS) { if (cgs.cpma) { s = "Capture Strike"; } else { s = "Attack and Defend"; } } else if (cgs.gametype == GT_OBELISK) { s = "Overload"; } else if (cgs.gametype == GT_HARVESTER) { s = "Harvester"; } else if (cgs.gametype == GT_FREEZETAG) { s = "Freeze Tag"; } else if (cgs.gametype == GT_DOMINATION) { s = "Domination"; } else if (cgs.gametype == GT_RED_ROVER) { if (cgs.customServerSettings & SERVER_SETTING_INFECTED) { s = "Red Rover (Infected)"; } else { s = "Red Rover"; } } else if (cgs.gametype == GT_NTF) { s = "Not Team Fortress"; } else if (cgs.gametype == GT_2V2) { s = "Two vs Two"; } else if (cgs.gametype == GT_HM) { s = "Hoonymode"; } else if (cgs.gametype == GT_RACE) { s = "Race"; } else { s = "Unknown Gametype"; } if (cgs.protocol != PROTOCOL_QL) { lines = UI_DrawProportionalString3(320, y, s, UI_CENTER | UI_SMALLFONT | UI_DROPSHADOW, colorYellow); y += PROP_HEIGHT * lines; } else { n = atoi(Info_ValueForKey(info, "ruleset")); if (n == 2) { lines = UI_DrawProportionalString3(320, y, va("%s %s%s", s, " (pql)", atoi(Info_ValueForKey(info, "g_instagib")) ? " (instagib)" : ""), UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorBlue); } else { if (CG_CheckQlVersion(0, 1, 0, 495)) { n = atoi(Info_ValueForKey(CG_ConfigString(CS_ARMOR_TIERED), "armor_tiered")); } else { n = 0; } lines = UI_DrawProportionalString3(320, y, va("%s%s%s", s, n == 1 ? " (tiered armor)" : "", atoi(Info_ValueForKey(info, "g_instagib")) ? " (instagib)" : ""), UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, n == 1 ? colorGreen : atoi(Info_ValueForKey(info, "g_instagib")) ? colorMagenta : colorYellow); } y += PROP_HEIGHT * lines; if (atoi(Info_ValueForKey(info, "ruleset")) != 2) { if (*CG_ConfigString(CS_PMOVE_SETTINGS)) { if (atoi(Info_ValueForKey(CG_ConfigString(CS_PMOVE_SETTINGS), "pmove_WeaponRaiseTime")) == 0 && atoi(Info_ValueForKey(CG_ConfigString(CS_PMOVE_SETTINGS), "pmove_WeaponDropTime")) == 0) { lines = UI_DrawProportionalString3(320, y, "fast weapon switch", UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorCyan); y += PROP_HEIGHT * lines; } } } } value = atoi( Info_ValueForKey( info, "scorelimit" ) ); if ( value ) { lines = UI_DrawProportionalString3( 320, y, va( "scorelimit %i", value ), UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorWhite ); y += PROP_HEIGHT * lines; } value = atoi( Info_ValueForKey( info, "timelimit" ) ); if ( value ) { lines = UI_DrawProportionalString3( 320, y, va( "timelimit %i", value ), UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorWhite ); y += PROP_HEIGHT * lines; } if (cgs.gametype < GT_CA ) { value = atoi( Info_ValueForKey( info, "fraglimit" ) ); if ( value ) { lines = UI_DrawProportionalString3( 320, y, va( "fraglimit %i", value ), UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorWhite ); y += PROP_HEIGHT * lines; } } if (cgs.gametype == GT_CA || cgs.gametype == GT_FREEZETAG) { value = atoi( Info_ValueForKey( info, "roundlimit" ) ); if ( value ) { lines = UI_DrawProportionalString3( 320, y, va( "roundlimit %i", value ), UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorWhite ); y += PROP_HEIGHT * lines; } } if (cgs.gametype >= GT_CTF && cgs.gametype < GT_FREEZETAG) { value = atoi( Info_ValueForKey( info, "capturelimit" ) ); if ( value ) { lines = UI_DrawProportionalString3( 320, y, va( "capturelimit %i", value ), UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorWhite ); y += PROP_HEIGHT * lines; } } if (cgs.protocol == PROTOCOL_QL) { const char *p; if (cgs.realProtocol < 91) { value = atoi(Info_ValueForKey(info, "sv_skillrating")); lines = UI_DrawProportionalString3(320, y, va( "skill rating %i", value), UI_CENTER | UI_SMALLFONT | UI_DROPSHADOW, colorWhite); y += PROP_HEIGHT * lines; } if (*Info_ValueForKey(info, "sv_location")) { lines = UI_DrawProportionalString3(320, y, va("location %s", Info_ValueForKey(info, "sv_location")), UI_CENTER | UI_SMALLFONT | UI_DROPSHADOW, colorWhite); y += PROP_HEIGHT * lines; } if (*cgs.serverModelOverride || *cgs.serverHeadModelOverride) { lines = UI_DrawProportionalString3(320, y, "forced server models", UI_CENTER | UI_SMALLFONT | UI_DROPSHADOW, colorMdGrey); y += PROP_HEIGHT * lines; } p = SC_Cvar_Get_String("com_workshopids"); // strlen() check since it is sometimes a blank space ' ' if (p && *p && strlen(p) > 1) { lines = UI_DrawProportionalString3(320, y, va("workshops: %s", p), UI_CENTER | UI_SMALLFONT | UI_DROPSHADOW, colorMdGrey); y += PROP_HEIGHT * lines; } } // end protocol ql if (cg.demoPlayback && !loading && cg.snap) { int startTime, endTime, currentTime; startTime = trap_GetFirstServerTime(); endTime = trap_GetLastServerTime(); currentTime = cg.snap->serverTime; trap_Cvar_VariableStringBuffer("cl_demoFileBaseName", buf, sizeof(buf)); QLWideScreen = 1; CG_DrawStringExt(2, 480 - 64, va("^3demo: ^7%s", buf), colorWhite, qfalse, qtrue, SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT, 0, &cgs.media.bigchar); CG_DrawStringExt(2, 480 - 32, va(" ^5%s ^6%02.2f%%", clockString(endTime - startTime), (float)(currentTime - startTime) / (float)(endTime - startTime) * 100.0f), colorWhite, qfalse, qtrue, SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT, 0, &cgs.media.bigchar); QLWideScreen = 2; } }
void CG_DrawInformation(void) { const char *s; const char *info; const char *sysInfo; const char *line; int x = 8, y, value, bar = 0; qhandle_t levelshot, shadow, clapper; //qhandle_t detail; qhandle_t percentBox; char buf[1024]; //qboolean skipdetail; vec4_t color1 = { .75, .75, .75, 1 }, color2 = { 1, 1, 1, 1 }; info = CG_ConfigString(CS_SERVERINFO); sysInfo = CG_ConfigString(CS_SYSTEMINFO); /* Makro - no longer used //Makro - settings read from the worldspawn entity s = CG_ConfigString( CS_LOADINGSCREEN ); color1[0] = atof(Info_ValueForKey(s, "r1")); color1[1] = atof(Info_ValueForKey(s, "g1")); color1[2] = atof(Info_ValueForKey(s, "b1")); color2[0] = atof(Info_ValueForKey(s, "r2")); color2[1] = atof(Info_ValueForKey(s, "g2")); color2[2] = atof(Info_ValueForKey(s, "b2")); color1[3] = color2[3] = 1; skipdetail = ( atoi(Info_ValueForKey(s, "nodetail")) != 0 ); */ s = Info_ValueForKey(info, "mapname"); shadow = trap_R_RegisterShaderNoMip("ui/assets/rq3-main-shadow-1.tga"); levelshot = trap_R_RegisterShaderNoMip(va("levelshots/load_%s.tga", s)); percentBox = trap_R_RegisterShaderNoMip("gfx/percent.tga"); //Makro - added if (!levelshot) { levelshot = trap_R_RegisterShaderNoMip(va("levelshots/%s.tga", s)); } if (!levelshot) { //Elder: changed levelshot = trap_R_RegisterShaderNoMip("levelshots/rq3-unknownmap.tga"); //skipdetail = qtrue; } trap_R_SetColor(NULL); CG_DrawPic(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, levelshot); /* Makro - removed // blend a detail texture over it //Elder: changed to RQ3 detail overlay if (!skipdetail) { detail = trap_R_RegisterShader( "rq3-levelShotDetail" ); trap_R_DrawStretchPic( 0, 0, cgs.glconfig.vidWidth, cgs.glconfig.vidHeight, 0, 0, 2.5, 2, detail ); } */ //Elder: "Letterbox" mask //Makro - changed it a bit CG_FillRect(0, 0, SCREEN_WIDTH, LS_TOPMARGIN, colorBlack); CG_FillRect(0, LS_TOPMARGIN, SCREEN_WIDTH, 2, colorMdGrey); CG_FillRect(0, SCREEN_HEIGHT - LS_BOTTOMMARGIN, SCREEN_WIDTH, LS_BOTTOMMARGIN, colorBlack); CG_FillRect(0, SCREEN_HEIGHT - LS_BOTTOMMARGIN - 2, SCREEN_WIDTH, 2, colorMdGrey); //Makro - shadow CG_DrawPic(0, LS_TOPMARGIN + 2, 640, 12, shadow); //Elder: mapname //Makro - removed //UI_DrawProportionalString(x, 26, s, UI_LEFT|UI_DROPSHADOW, colorDkGrey); //CG_DrawBigStringColor(4, 24, s, color_red); //Elder: removed // draw the icons of things as they are loaded //CG_DrawLoadingIcons(); // draw info string information //Elder: Initial y-position y = LS_TOPMARGIN - 8 - LS_CHAR_HEIGHT; // map-specific message (long map name) s = CG_ConfigString(CS_MESSAGE); if (s[0]) { //Makro - allow color-coded text; also changed to use custom color instead of colorLtGrey //CG_DrawSmallStringColor(x, y, s, colorMdGrey); //CG_DrawStringExt(x, y, s, colorWhite, qtrue, qfalse, LS_CHAR_WIDTH, LS_CHAR_HEIGHT, 0); CG_DrawStringExt(x, y, s, color1, qtrue, qfalse, LS_CHAR_WIDTH, LS_CHAR_HEIGHT, 0); y -= (2 * LS_CHAR_HEIGHT); } //y += LS_CHAR_HEIGHT; // game type switch (cgs.gametype) { case GT_FFA: line = "CLASSIC ACTION DEATHMATCH"; break; case GT_SINGLE_PLAYER: line = "SINGLE PLAYER"; break; case GT_TOURNAMENT: line = "TOURNAMENT"; break; //Makro - added tdmMode case GT_TEAM: line = (atoi(Info_ValueForKey(info, "g_RQ3_tdmMode")) != 0) ? "TEAM DEATHMATCH (CLASSIC)" : "TEAM DEATHMATCH (TP-STYLE)"; break; // JBravo: teamplay stuff. case GT_TEAMPLAY: //Makro - changed from RQ3 Teamplay line = "CLASSIC ACTION TEAMPLAY"; break; // JBravo: now knows as CTB case GT_CTF: line = "CAPTURE THE BRIEFCASE"; break; default: line = "UNKNOWN GAMETYPE"; break; } // JBravo: the call to Q_strupr seems to crash Q3 when running as dll or .so. Attempting a fix // Makro: the fix crashes Q3 with .dll's, unfixing ;P //strcat (line, '\0'); //line = Q_strupr(line); // cheats warning s = Info_ValueForKey(sysInfo, "sv_cheats"); //Makro - didn't like this //if ( s[0] == '1' ) { if (atoi(s)) line = va("%s / CHEATS ARE ENABLED", line); if (cg_RQ3_matchmode.integer) line = va("%s / MATCHMODE", line); s = Info_ValueForKey(sysInfo, "sv_pure"); if (atoi(s) == 0) line = va("%s / SV_PURE OFF", line); //Makro - custom color; changed from colorWhite //CG_DrawSmallStringColor(x, y, line, color2); CG_DrawStringExt(x, y, line, color2, qfalse, qfalse, LS_CHAR_WIDTH, LS_CHAR_HEIGHT, 0); y -= LS_CHAR_HEIGHT; line = ""; // pure server s = Info_ValueForKey(sysInfo, "sv_pure"); if (atoi(s)) { if (line[0]) line = va("%s / ", line); line = va("%sPURE SERVER", line); } value = atoi(Info_ValueForKey(info, "timelimit")); if (value) { line = va("TIMELIMIT %i", value); } if (cgs.gametype <= GT_TEAM) { value = atoi(Info_ValueForKey(info, "fraglimit")); if (value) { if (line[0]) line = va("%s / ", line); line = va("%sFRAGLIMIT %i", line, value); } } else if (cgs.gametype == GT_TEAMPLAY) { value = atoi(Info_ValueForKey(info, "g_RQ3_roundlimit")); if (value) { if (line[0]) line = va("%s / ", line); line = va("%sROUNDLIMIT %i", line, value); } } else { value = atoi(Info_ValueForKey(info, "capturelimit")); if (value) { if (line[0]) line = va("%s / ", line); line = va("%sCAPTURELIMIT %i", line, value); } } //Makro - don't write unless there's something to write if (line[0]) { CG_DrawStringExt(x, y, line, color2, qfalse, qfalse, LS_CHAR_WIDTH, LS_CHAR_HEIGHT, 0); y -= LS_CHAR_HEIGHT; } line = ""; // don't print server lines if playing a local game trap_Cvar_VariableStringBuffer("sv_running", buf, sizeof(buf)); if (!atoi(buf)) { // server hostname Q_strncpyz(buf, Info_ValueForKey(info, "sv_hostname"), 1024); Q_CleanStr(buf); if (buf[0] && Q_stricmp(buf, "noname")) { line = va("%s", buf); } // server-specific message of the day s = CG_ConfigString(CS_MOTD); if (s[0]) { if (line[0]) line = va("%s / ", line); line = va("%s%s", line, s); } //Makro - don't write unless there's something to write if (line[0]) { CG_DrawStringExt(x, y, line, color2, qfalse, qfalse, LS_CHAR_WIDTH, LS_CHAR_HEIGHT, 0); y -= LS_CHAR_HEIGHT; } } // BOTTOM // // the first 150 rows are reserved for the client connection // screen to write into //y = SCREEN_HEIGHT - (int) (0.5 * (LS_BOTTOMMARGIN + LS_CHAR_HEIGHT)); y = SCREEN_HEIGHT - LS_BOTTOMMARGIN + 8; if (cg.infoScreenText[0]) { CG_DrawStringExt(x, y, va("LOADING... %s", Q_strupr(cg.infoScreenText)), color2, qfalse, qfalse, LS_CHAR_WIDTH, LS_CHAR_HEIGHT, 0); //UI_DrawProportionalString(SCREEN_WIDTH - 8, y, va("LOADING... %s", Q_strupr(cg.infoScreenText)), UI_RIGHT, colorWhite); } else { CG_DrawStringExt(x, y, "AWAITING SNAPSHOT...", color2, qfalse, qfalse, LS_CHAR_WIDTH, LS_CHAR_HEIGHT, 0); //UI_DrawProportionalString(SCREEN_WIDTH - 8, y, "AWAITING SNAPSHOT...", UI_RIGHT, colorWhite); } //y += 24; clapper = trap_R_RegisterShaderNoMip(va("levelshots/clapper_%s.tga", Info_ValueForKey(info, "mapname"))); if (clapper) { y = LS_TOPMARGIN - 8 - LS_CHAR_HEIGHT; CG_DrawPic(392, 296, 240, 180, clapper); } if (percentBox) { trap_R_SetColor(colorWhite); for (bar = 0; bar < ceil(cg.loadingMapPercent * 10) && bar < 10; bar++) { CG_DrawPic(SCREEN_WIDTH - (11 - bar) * 10, y, 8, 8, percentBox); } trap_R_SetColor(colorDkGrey); for (; bar < 10; bar++) { CG_DrawPic(SCREEN_WIDTH - (11 - bar) * 10, y, 8, 8, percentBox); } } else { for (bar = 0; bar < ceil(cg.loadingMapPercent * 10) && bar < 10; bar++) { CG_FillRect(SCREEN_WIDTH - (11 - bar) * 10, y, 8, 8, colorWhite); } for (; bar < 10; bar++) { CG_FillRect(SCREEN_WIDTH - (11 - bar) * 10, y, 8, 8, colorDkGrey); } } }
void CG_DrawBigStringColor( int x, int y, const char *s, vec4_t color ) { CG_DrawStringExt( x, y, s, color, qtrue, qtrue, BIGCHAR_WIDTH, BIGCHAR_HEIGHT, 0, cgs.media.charsetShader ); }
void CG_DrawSmallStringColor( int x, int y, const char *s, vec4_t color ) { CG_DrawStringExt( x, y, s, color, qtrue, qfalse, SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT, 0 ); }
void CG_DrawBigString( int x, int y, const char *s, float alpha ) { vector4 color; VectorSet4( &color, 1.0f, 1.0f, 1.0f, alpha ); CG_DrawStringExt(x, y, s, &color, qfalse, qtrue, BIGCHAR_WIDTH * cgs.widthRatioCoef, BIGCHAR_HEIGHT, 0); }