const char *CG_GetGameStatusText(void) { static const char *s = ""; if (cgs.gametype == GT_POWERDUEL) { s = ""; } else if ( cgs.gametype < GT_TEAM) { if (cg.snap->ps.persistant[PERS_TEAM] != TEAM_SPECTATOR ) { char sPlaceWith[256]; trap_SP_GetStringTextString("MP_INGAME_PLACE_WITH", sPlaceWith, sizeof(sPlaceWith)); s = va("%s %s %i",CG_PlaceString( cg.snap->ps.persistant[PERS_RANK] + 1 ), sPlaceWith, cg.snap->ps.persistant[PERS_SCORE] ); } } else { if ( cg.teamScores[0] == cg.teamScores[1] ) { s = va("%s %i", CG_GetStringEdString("MP_INGAME", "TIEDAT"), cg.teamScores[0] ); } else if ( cg.teamScores[0] >= cg.teamScores[1] ) { s = va("%s, %i / %i", CG_GetStringEdString("MP_INGAME", "RED_LEADS"), cg.teamScores[0], cg.teamScores[1] ); } else { s = va("%s, %i / %i", CG_GetStringEdString("MP_INGAME", "BLUE_LEADS"), cg.teamScores[1], cg.teamScores[0] ); } } return s; }
// The server has issued a map_restart, so the next snapshot is completely new and should not be interpolated to. // A tournament restart will clear everything, but doesn't require a reload of all the media static void CG_MapRestart( void ) { if ( cg_showMiss.integer ) trap->Print( "CG_MapRestart\n" ); trap->R_ClearDecals(); //FIXME: trap->FX_Reset? CG_InitLocalEntities(); CG_InitMarkPolys(); CG_KillCEntityInstances(); cg.fraglimitWarnings = 0; cg.timelimitWarnings = 0; cg.intermissionStarted = qfalse; cgs.voteTime = 0; cg.mapRestart = qtrue; CG_StartMusic( qtrue ); trap->S_ClearLoopingSounds(); // we really should clear more parts of cg here and stop sounds // play the "fight" sound if this is a restart without warmup if ( cg.warmup == 0 && cgs.gametype != GT_SIEGE && cgs.gametype != GT_POWERDUEL ) { trap->S_StartLocalSound( media.sounds.warning.countFight, CHAN_ANNOUNCER ); CG_CenterPrint( CG_GetStringEdString( "MP_SVGAME", "BEGIN_DUEL" ), 120, GIANTCHAR_WIDTH * 2 ); } }
const char *CG_GetKillerText(void) { static const char *s = ""; if ( cg.killerName[0] ) { s = va("%s %s", CG_GetStringEdString("MP_INGAME", "KILLEDBY"), cg.killerName ); } return s; }
static int Player_GetLastPickup( lua_State *L, jpluaEntity_t *ent ) { if ( (int)(ent - ents) == cg.clientNum ) { lua_pushstring( L, CG_GetStringEdString( "SP_INGAME", bg_itemlist[cg.itemPickup].classname ) ); } else { lua_pushnil( L ); } return 1; }
//Func: Player:GetLastPickup() //Retn: nil if Player:GetID() != self:GetID() due to lack of reliable information // string of the most recent pickup's name static int JPLua_Player_GetLastPickup( lua_State *L ) { jplua_player_t *player = JPLua_CheckPlayer( L, 1 ); if ( player->clientNum == cg.clientNum ) lua_pushstring( L, CG_GetStringEdString( "SP_INGAME", bg_itemlist[cg.itemPickup].classname ) ); else lua_pushnil( L ); return 1; }
void CG_DrawInformation( void ) { const char *s; const char *info; const char *sysInfo; //int y; //int value, valueNOFP; qhandle_t levelshot; //char buf[1024]; // int iPropHeight = 18; // I know, this is total crap, but as a post release asian-hack.... -Ste info = CG_ConfigString( CS_SERVERINFO ); sysInfo = CG_ConfigString( CS_SYSTEMINFO ); s = Info_ValueForKey( info, "mapname" ); levelshot = trap->R_RegisterShaderNoMip( va( "levelshots/%s", s ) ); if ( !levelshot ) { levelshot = trap->R_RegisterShaderNoMip( "menu/art/unknownmap_mp" ); } trap->R_SetColor( NULL ); CG_DrawPic( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, levelshot ); CG_LoadBar(); // the first 150 rows are reserved for the client connection // screen to write into if ( cg.infoScreenText[0] ) { const char *psLoading = CG_GetStringEdString("MENUS", "LOADING_MAPNAME"); UI_DrawProportionalString( 425, 105, ( const char * ) va(( char * ) /*"Loading... %s"*/ psLoading, cg.infoScreenText), UI_RIGHT|UI_BIGFONT|UI_DROPSHADOW, colorWhite, FONT_SMALL3 ); } else { const char *psAwaitingSnapshot = CG_GetStringEdString("MENUS", "AWAITING_SNAPSHOT"); UI_DrawProportionalString( 425, 128-32, ( const char * ) /*"Awaiting snapshot..."*/psAwaitingSnapshot, UI_RIGHT|UI_INFOFONT|UI_DROPSHADOW, colorWhite, FONT_SMALL3 ); } // Draw the loading screen tip if (cg_loadingTips.size() > 0 && cg_displayTipNumber != -1) { const char* loadingTip = CG_GetStringEdString2(cg_loadingTips.at(cg_displayTipNumber).tipText); int x = 320 - CG_Text_Width(loadingTip, 0.3f, FONT_SMALL) / 2; int y = 440; CG_Text_Paint(x, y, 0.3, colorWhite, loadingTip, 0, 0, ITEM_TEXTSTYLE_SHADOWED, FONT_SMALL); } }
static void CG_spLose_f( void) { trap_Cvar_Set("cg_cameraOrbit", "2"); trap_Cvar_Set("cg_cameraOrbitDelay", "35"); trap_Cvar_Set("cg_thirdPerson", "1"); trap_Cvar_Set("cg_thirdPersonAngle", "0"); trap_Cvar_Set("cg_thirdPersonRange", "100"); CG_AddBufferedSound(cgs.media.loserSound); //trap_S_StartLocalSound(cgs.media.loserSound, CHAN_ANNOUNCER); CG_CenterPrint(CG_GetStringEdString("MP_INGAME", "YOU_LOSE"), SCREEN_HEIGHT * .30, 0); }
void CG_CheckSVStringEdRef( char *buf, const char *str ) { int i, b = 0, strLen = 0; qboolean gotStrip = qfalse; // I don't really like doing this. But it utilizes the system that was already in place. if ( !str || !str[0] ) { if ( str ) strcpy( buf, str ); return; } strcpy( buf, str ); strLen = strlen( str ); if ( strLen >= MAX_STRINGED_SV_STRING ) return; for ( i = 0; i < strLen && str[i]; i++ ) { gotStrip = qfalse; if ( str[i] == '@' && (i + 1) < strLen ) { if ( str[i + 1] == '@' && (i + 2) < strLen ) { if ( str[i + 2] == '@' && (i + 3) < strLen ) { // @@@ should mean to insert a StringEd reference here, so insert it into buf at the current place char stringRef[MAX_STRINGED_SV_STRING]; int r = 0; while ( i < strLen && str[i] == '@' ) i++; while ( i < strLen && str[i] && str[i] != ' ' && str[i] != ':' && str[i] != '.' && str[i] != '\n' ) { stringRef[r] = str[i]; r++, i++; } stringRef[r] = '\0'; buf[b] = '\0'; Q_strcat( buf, MAX_STRINGED_SV_STRING, CG_GetStringEdString( "MP_SVGAME", stringRef ) ); b = strlen( buf ); } } } if ( !gotStrip ) { buf[b] = str[i]; b++; } } buf[b] = '\0'; }
/* ====================== CG_LoadingString ====================== */ void CG_LoadingString( const char *s ) { const char *psLoading = CG_GetStringEdString("MENUS", "LOADING_MAPNAME"); Q_strncpyz( cg.infoScreenText, s, sizeof( cg.infoScreenText ) ); if(s && *s) { CG_Printf(va((char *)psLoading, (char *)s)); CG_Printf("\n"); } trap_UpdateScreen(); }
/* =================== CG_LoadingItem =================== */ void CG_LoadingItem( int itemNum ) { gitem_t *item; char upperKey[1024]; item = &bg_itemlist[itemNum]; if (!item->classname || !item->classname[0]) { // CG_LoadingString( "Unknown item" ); return; } strcpy(upperKey, item->classname); CG_LoadingString( CG_GetStringEdString("SP_INGAME",Q_strupr(upperKey)) ); }
/* =============== CG_MapRestart The server has issued a map_restart, so the next snapshot is completely new and should not be interpolated to. A tournement restart will clear everything, but doesn't require a reload of all the media =============== */ static void CG_MapRestart( void ) { if ( cg_showMiss.integer ) { trap->Print( "CG_MapRestart\n" ); } trap->R_ClearDecals ( ); //FIXME: trap->FX_Reset? CG_InitLocalEntities(); CG_InitMarkPolys(); CG_KillCEntityInstances(); // make sure the "3 frags left" warnings play again cg.fraglimitWarnings = 0; cg.timelimitWarnings = 0; cg.intermissionStarted = qfalse; cgs.voteTime = 0; cg.mapRestart = qtrue; CG_StartMusic(qtrue); trap->S_ClearLoopingSounds(); // we really should clear more parts of cg here and stop sounds // play the "fight" sound if this is a restart without warmup if ( cg.warmup == 0 && cgs.gametype != GT_POWERDUEL/* && cgs.gametype == GT_DUEL */) { trap->S_StartLocalSound( cgs.media.countFightSound, CHAN_ANNOUNCER ); CG_CenterPrint( CG_GetStringEdString("MP_SVGAME", "BEGIN_DUEL"), 120, GIANTCHAR_WIDTH*2 ); } /* if (cg_singlePlayerActive.integer) { trap->Cvar_Set("ui_matchStartTime", va("%i", cg.time)); if (cg_recordSPDemo.integer && cg_recordSPDemoName.string && *cg_recordSPDemoName.string) { trap->SendConsoleCommand(va("set g_synchronousclients 1 ; record %s \n", cg_recordSPDemoName.string)); } } */ trap->Cvar_Set("cg_thirdPerson", "0"); cg.numItemsInInventory = 0; memset(cg.playerInventory, 0, sizeof(cg.playerInventory)); memset(cg.playerACI, -1, sizeof(cg.playerACI)); }
// returns either string or NULL for OOR... // static const char *GetCRDelineatedString( const char *psStripFileRef, const char *psStripStringRef, int iIndex) { static char sTemp[256] = {0}; const char *psList = CG_GetStringEdString((char *)psStripFileRef, (char *)psStripStringRef); char *p; while (iIndex--) { psList = strchr(psList, '\n'); if (!psList) { return NULL; // OOR } psList++; } Q_strncpyz(sTemp, psList, sizeof(sTemp)); p = strchr(sTemp, '\n'); if (p) { *p = '\0'; } return sTemp; }
void CG_CheckSVStringEdRef(char *buf, const char *str) { //I don't really like doing this. But it utilizes the system that was already in place. int i = 0; int b = 0; int strLen = 0; qboolean gotStrip = qfalse; if (!str || !str[0]) { if (str) { strcpy(buf, str); } return; } strcpy(buf, str); strLen = strlen(str); if (strLen >= MAX_STRINGED_SV_STRING) { return; } while (i < strLen && str[i]) { gotStrip = qfalse; if (str[i] == '@' && (i+1) < strLen) { if (str[i+1] == '@' && (i+2) < strLen) { if (str[i+2] == '@' && (i+3) < strLen) { //@@@ should mean to insert a StringEd reference here, so insert it into buf at the current place char stringRef[MAX_STRINGED_SV_STRING]; int r = 0; /*while (i < strLen && str[i] == '@') { i++; }*/ // Oh c'mon. i += 3; while (i < strLen && str[i] && str[i] != ' ' && str[i] != ':' && str[i] != '.' && str[i] != '\n') { stringRef[r] = str[i]; r++; i++; } stringRef[r] = 0; buf[b] = 0; // Bugfix -> DONT JUMP TO CONCLUSIONS, SILLY RAVEN { char buffer2[1024]; strcpy(buffer2, CG_GetStringEdString2(stringRef)); if(Q_stricmp(buffer2, stringRef)) { Q_strcat(buf, MAX_STRINGED_SV_STRING, buffer2); return; } } Q_strcat(buf, MAX_STRINGED_SV_STRING, CG_GetStringEdString("MP_SVGAME", stringRef)); // Might be a valid point...but WTF seriously b = strlen(buf); } } } if (!gotStrip) { buf[b] = str[i]; b++; } i++; } buf[b] = 0; }
void CG_DrawInformation( void ) { const char *s; const char *info; const char *sysInfo; int y; int value, valueNOFP; qhandle_t levelshot; char buf[1024]; int iPropHeight = 18; // I know, this is total crap, but as a post release asian-hack.... -Ste info = CG_ConfigString( CS_SERVERINFO ); sysInfo = CG_ConfigString( CS_SYSTEMINFO ); s = Info_ValueForKey( info, "mapname" ); levelshot = trap_R_RegisterShaderNoMip( va( "levelshots/%s", s ) ); if ( !levelshot ) { levelshot = trap_R_RegisterShaderNoMip( "menu/art/unknownmap_mp" ); } trap_R_SetColor( NULL ); CG_DrawPic( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, levelshot ); CG_LoadBar(); // draw the icons of things as they are loaded // CG_DrawLoadingIcons(); // the first 150 rows are reserved for the client connection // screen to write into if ( cg.infoScreenText[0] ) { const char *psLoading = CG_GetStringEdString("MENUS", "LOADING_MAPNAME"); //[OverflowProtection] UI_DrawProportionalString( 320, 128-32, va(/*"Loading... %s"*/ (char*) psLoading, cg.infoScreenText), //UI_DrawProportionalString( 320, 128-32, va(/*"Loading... %s"*/ psLoading, cg.infoScreenText), //[/OverflowProtection] UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); } else { const char *psAwaitingSnapshot = CG_GetStringEdString("MENUS", "AWAITING_SNAPSHOT"); UI_DrawProportionalString( 320, 128-32, /*"Awaiting snapshot..."*/psAwaitingSnapshot, UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); } // draw info string information y = 180-32; // 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); UI_DrawProportionalString( 320, y, buf, UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; // pure server s = Info_ValueForKey( sysInfo, "sv_pure" ); if ( s[0] == '1' ) { const char *psPure = CG_GetStringEdString("MP_INGAME", "PURE_SERVER"); UI_DrawProportionalString( 320, y, psPure, UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } // server-specific message of the day s = CG_ConfigString( CS_MOTD ); if ( s[0] ) { UI_DrawProportionalString( 320, y, s, UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } { // display global MOTD at bottom (mirrors ui_main UI_DrawConnectScreen char motdString[1024]; trap_Cvar_VariableStringBuffer( "cl_motdString", motdString, sizeof( motdString ) ); if (motdString[0]) { UI_DrawProportionalString( 320, 425, motdString, UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); } } // some extra space after hostname and motd y += 10; } // map-specific message (long map name) s = CG_ConfigString( CS_MESSAGE ); if ( s[0] ) { UI_DrawProportionalString( 320, y, s, UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } // cheats warning s = Info_ValueForKey( sysInfo, "sv_cheats" ); if ( s[0] == '1' ) { UI_DrawProportionalString( 320, y, CG_GetStringEdString("MP_INGAME", "CHEATSAREENABLED"), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } // game type switch ( cgs.gametype ) { case GT_FFA: s = CG_GetStringEdString("MENUS", "FREE_FOR_ALL");//"Free For All"; // s = "Free For All"; break; case GT_HOLOCRON: s = CG_GetStringEdString("MENUS", "HOLOCRON_FFA");//"Holocron FFA"; // s = "Holocron FFA"; break; case GT_JEDIMASTER: //[OLDGAMETYPES] //s = CG_GetStringEdString("MENUS", "SAGA");//"Jedi Master";?? s = CG_GetStringEdString("MENUS", "JEDIMASTER");//"Jedi Master";?? //[/OLDGAMETYPES] // s = "Jedi Master"; break; case GT_SINGLE_PLAYER: s = CG_GetStringEdString("MENUS", "COOP");//"Team FFA"; //s = "Single Player"; break; case GT_DUEL: s = CG_GetStringEdString("MENUS", "DUEL");//"Team FFA"; //s = "Duel"; break; case GT_POWERDUEL: s = CG_GetStringEdString("MENUS", "POWERDUEL");//"Team FFA"; //s = "Power Duel"; break; case GT_TEAM: s = CG_GetStringEdString("MENUS", "TEAM_FFA");//"Team FFA"; //s = "Team FFA"; break; case GT_SIEGE: s = CG_GetStringEdString("MENUS", "SIEGE");//"Siege"; //s = "Siege"; break; case GT_CTF: s = CG_GetStringEdString("MENUS", "CAPTURE_THE_FLAG");//"Capture the Flag"; //s = "Capture The Flag"; break; case GT_CTY: s = CG_GetStringEdString("MENUS", "CAPTURE_THE_YSALIMARI");//"Capture the Ysalamiri"; //s = "Capture The Ysalamiri"; break; //RoAR Mod NOTE: RPG Mode. /*case GT_RPG: s = CG_GetStringEdString("MENUS", "RPG");//"RPG"; //s = "Capture The Ysalamiri"; break;*/ default: s = CG_GetStringEdString("MENUS", "SAGA");//"Team FFA"; //s = "Unknown Gametype"; break; } UI_DrawProportionalString( 320, y, s, UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; if (cgs.gametype != GT_SIEGE) { value = atoi( Info_ValueForKey( info, "timelimit" ) ); if ( value ) { UI_DrawProportionalString( 320, y, va( "%s %i", CG_GetStringEdString("MP_INGAME", "TIMELIMIT"), value ), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } if (cgs.gametype < GT_CTF ) { value = atoi( Info_ValueForKey( info, "fraglimit" ) ); if ( value ) { UI_DrawProportionalString( 320, y, va( "%s %i", CG_GetStringEdString("MP_INGAME", "FRAGLIMIT"), value ), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } if (cgs.gametype == GT_DUEL || cgs.gametype == GT_POWERDUEL) { value = atoi( Info_ValueForKey( info, "duel_fraglimit" ) ); if ( value ) { UI_DrawProportionalString( 320, y, va( "%s %i", CG_GetStringEdString("MP_INGAME", "WINLIMIT"), value ), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } } } } if (cgs.gametype >= GT_CTF) { value = atoi( Info_ValueForKey( info, "capturelimit" ) ); if ( value ) { UI_DrawProportionalString( 320, y, va( "%s %i", CG_GetStringEdString("MP_INGAME", "CAPTURELIMIT"), value ), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } } if (cgs.gametype >= GT_TEAM) { value = atoi( Info_ValueForKey( info, "g_forceBasedTeams" ) ); if ( value ) { UI_DrawProportionalString( 320, y, CG_GetStringEdString("MP_INGAME", "FORCEBASEDTEAMS"), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } } if (cgs.gametype != GT_SIEGE) { valueNOFP = atoi( Info_ValueForKey( info, "g_forcePowerDisable" ) ); value = atoi( Info_ValueForKey( info, "g_maxForceRank" ) ); if ( value && !valueNOFP && (value < NUM_FORCE_MASTERY_LEVELS) ) { char fmStr[1024]; trap_SP_GetStringTextString("MP_INGAME_MAXFORCERANK",fmStr, sizeof(fmStr)); UI_DrawProportionalString( 320, y, va( "%s %s", fmStr, CG_GetStringEdString("MP_INGAME", forceMasteryLevels[value]) ), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } else if (!valueNOFP) { char fmStr[1024]; trap_SP_GetStringTextString("MP_INGAME_MAXFORCERANK",fmStr, sizeof(fmStr)); UI_DrawProportionalString( 320, y, va( "%s %s", fmStr, (char *)CG_GetStringEdString("MP_INGAME", forceMasteryLevels[7]) ), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } if (cgs.gametype == GT_DUEL || cgs.gametype == GT_POWERDUEL) { value = atoi( Info_ValueForKey( info, "g_duelWeaponDisable" ) ); } else { value = atoi( Info_ValueForKey( info, "g_weaponDisable" ) ); } if ( cgs.gametype != GT_JEDIMASTER && value ) { UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "SABERONLYSET") ), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } if ( valueNOFP ) { UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "NOFPSET") ), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } } // Display the rules based on type y += iPropHeight; switch ( cgs.gametype ) { case GT_FFA: UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_FFA_1")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; break; case GT_HOLOCRON: UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_HOLO_1")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_HOLO_2")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; break; case GT_JEDIMASTER: UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_JEDI_1")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_JEDI_2")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; break; case GT_SINGLE_PLAYER: break; case GT_DUEL: UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_DUEL_1")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_DUEL_2")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; break; case GT_POWERDUEL: UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_POWERDUEL_1")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_POWERDUEL_2")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; break; case GT_TEAM: UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_TEAM_1")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_TEAM_2")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; break; case GT_SIEGE: break; case GT_CTF: UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_CTF_1")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_CTF_2")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; break; case GT_CTY: UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_CTY_1")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_CTY_2")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; break; default: break; } }
/* ================= CG_DrawScoreboard ================= */ static void CG_DrawClientScore( int y, score_t *score, float *color, float fade, qboolean largeFormat ) { //vec3_t headAngles; clientInfo_t *ci; int iconx, headx; float scale; if ( largeFormat ) { scale = 1.0f; } else { scale = 0.75f; } if ( score->client < 0 || score->client >= cgs.maxclients ) { Com_Printf( "Bad score->client: %i\n", score->client ); return; } ci = &cgs.clientinfo[score->client]; iconx = SB_BOTICON_X + (SB_RATING_WIDTH / 2); headx = SB_HEAD_X + (SB_RATING_WIDTH / 2); // draw the handicap or bot skill marker (unless player has flag) if ( ci->powerups & ( 1 << PW_REDFLAG ) ) { CG_DrawFlagModel( iconx*cgs.screenXScale, y*cgs.screenYScale, 32*cgs.screenXScale, 32*cgs.screenYScale, TEAM_RED, qfalse ); } else if ( ci->powerups & ( 1 << PW_BLUEFLAG ) ) { CG_DrawFlagModel( iconx*cgs.screenXScale, y*cgs.screenYScale, 32*cgs.screenXScale, 32*cgs.screenYScale, TEAM_BLUE, qfalse ); } else if (cgs.gametype == GT_POWERDUEL && (ci->duelTeam == DUELTEAM_LONE || ci->duelTeam == DUELTEAM_DOUBLE)) { if (ci->duelTeam == DUELTEAM_LONE) { CG_DrawPic ( iconx, y, 32, 32, trap_R_RegisterShaderNoMip ( "gfx/mp/pduel_icon_lone" ) ); } else { CG_DrawPic ( iconx, y, 32, 32, trap_R_RegisterShaderNoMip ( "gfx/mp/pduel_icon_double" ) ); } } else { // draw the wins / losses /* if ( cgs.gametype == GT_DUEL || cgs.gametype == GT_POWERDUEL ) { CG_DrawSmallStringColor( iconx, y + SMALLCHAR_HEIGHT/2, va("%i/%i", ci->wins, ci->losses ), color ); } */ //rww - in duel, we now show wins/losses in place of "frags". This is because duel now defaults to 1 kill per round. } // highlight your position if ( score->client == cg.snap->ps.clientNum ) { float hcolor[4]; int rank; localClient = qtrue; if ( cg.snap->ps.persistant[PERS_TEAM] == TEAM_SPECTATOR || cgs.gametype >= GT_TEAM ) { rank = -1; } else { rank = cg.snap->ps.persistant[PERS_RANK] & ~RANK_TIED_FLAG; } if ( rank == 0 ) { hcolor[0] = 0; hcolor[1] = 0; hcolor[2] = 0.7f; } else if ( rank == 1 ) { hcolor[0] = 0.7f; hcolor[1] = 0; hcolor[2] = 0; } else if ( rank == 2 ) { hcolor[0] = 0.7f; hcolor[1] = 0.7f; hcolor[2] = 0; } else { hcolor[0] = 0.7f; hcolor[1] = 0.7f; hcolor[2] = 0.7f; } hcolor[3] = fade * 0.7; CG_FillRect( SB_SCORELINE_X - 5, y + 2, 640 - SB_SCORELINE_X * 2 + 10, largeFormat?SB_NORMAL_HEIGHT:SB_INTER_HEIGHT, hcolor ); } CG_Text_Paint (SB_NAME_X, y, 0.9f * scale, colorWhite, ci->name,0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM ); if ( score->ping != -1 ) { if ( ci->team != TEAM_SPECTATOR || cgs.gametype == GT_DUEL || cgs.gametype == GT_POWERDUEL ) { if (cgs.gametype == GT_DUEL || cgs.gametype == GT_POWERDUEL) { 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 ); } else { CG_Text_Paint (SB_SCORE_X, y, 1.0f * scale, colorWhite, va("%i", score->score),0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_SMALL ); } } CG_Text_Paint (SB_PING_X, y, 1.0f * scale, colorWhite, va("%i", score->ping),0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_SMALL ); CG_Text_Paint (SB_TIME_X, y, 1.0f * scale, colorWhite, va("%i", score->time),0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_SMALL ); } else { CG_Text_Paint (SB_SCORE_X, y, 1.0f * scale, colorWhite, "-",0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_SMALL ); CG_Text_Paint (SB_PING_X, y, 1.0f * scale, colorWhite, "-",0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_SMALL ); CG_Text_Paint (SB_TIME_X, y, 1.0f * scale, colorWhite, "-",0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_SMALL ); } // add the "ready" marker for intermission exiting if ( cg.snap->ps.stats[ STAT_CLIENTS_READY ] & ( 1 << score->client ) ) { 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 ); } }
void CG_DrawInformation( void ) { const char *s; const char *info; const char *sysInfo; int y; int value, valueNOFP; qhandle_t levelshot; char buf[1024]; int iPropHeight = 18; // I know, this is total crap, but as a post release asian-hack.... -Ste #ifdef WEB_DOWNLOAD char sDownLoading[256]; char sEstimatedTimeLeft[256]; char sTransferRate[256]; char sOf[20]; char sCopied[256]; char sSec[20]; int downloadSize, downloadCount, downloadTime; char dlSizeBuf[64], totalSizeBuf[64], xferRateBuf[64], dlTimeBuf[64]; int xferRate; int leftWidth; int centerPoint = 320; int yStart = 130; float scale = 1.0f; const char *downloadName = cgs.dlname; #endif #ifdef WEB_DOWNLOAD vec4_t colorLtGreyAlpha = {0, 0, 0, .5}; if(cgs.is_downloading!=0) { char motdString[1024]; char dlInfo[MAX_INFO_VALUE]; extern int startt,t; levelshot = trap->R_RegisterShaderNoMip( "menu/art/unknownmap_mp" ); trap->R_SetColor( NULL ); CG_DrawPic( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, levelshot ); dlInfo[0] = '\0'; if( CG_GetConfigString( CS_SERVERINFO, dlInfo, sizeof(dlInfo) ) ) { //if ( info = CG_ConfigString( CS_SERVERINFO ) ) { const char *psLoading = CG_GetStringEdString("MENUS", "LOADING_MAPNAME"); CG_DrawProportionalString( 320, 128-32, va( (char *)psLoading, Info_ValueForKey( dlInfo, "mapname" )), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); } else { const char *psAwaitingSnapshot = CG_GetStringEdString("MENUS", "AWAITING_SNAPSHOT"); CG_DrawProportionalString( 320, 128-32, psAwaitingSnapshot, UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); } // don't print server lines if playing a local game trap->Cvar_VariableStringBuffer( "sv_running", buf, sizeof( buf ) ); if ( !atoi( buf ) ) { trap->Cvar_VariableStringBuffer( "cl_motdString", motdString, sizeof( motdString ) ); if (motdString[0]) { CG_DrawProportionalString( 320, 425, motdString, UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); } } CG_FillRect( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, colorLtGreyAlpha ); s = GetCRDelineatedString("MENUS","DOWNLOAD_STUFF", 0); // "Downloading:" Q_strncpyz(sDownLoading,s?s:"", sizeof(sDownLoading)); s = GetCRDelineatedString("MENUS","DOWNLOAD_STUFF", 1); // "Estimated time left:" Q_strncpyz(sEstimatedTimeLeft,s?s:"", sizeof(sEstimatedTimeLeft)); s = GetCRDelineatedString("MENUS","DOWNLOAD_STUFF", 2); // "Transfer rate:" Q_strncpyz(sTransferRate,s?s:"", sizeof(sTransferRate)); s = GetCRDelineatedString("MENUS","DOWNLOAD_STUFF", 3); // "of" Q_strncpyz(sOf,s?s:"", sizeof(sOf)); s = GetCRDelineatedString("MENUS","DOWNLOAD_STUFF", 4); // "copied" Q_strncpyz(sCopied,s?s:"", sizeof(sCopied)); s = GetCRDelineatedString("MENUS","DOWNLOAD_STUFF", 5); // "sec." Q_strncpyz(sSec,s?s:"", sizeof(sSec)); downloadSize = cgs.dltotal; if( downloadSize == 0 ) return; downloadCount = cgs.dlnow; if(!t)t = trap->Milliseconds(); downloadTime = t - startt; leftWidth = 320; trap->R_SetColor(colorWhite); #define Text_PaintCenter(x,y,scale,color,text,adjust,iMenuFont) \ CG_DrawScaledProportionalString(x,y,text,UI_CENTER|UI_BIGFONT|UI_DROPSHADOW,color,scale) Text_PaintCenter(centerPoint, yStart + 112, scale, colorWhite, sDownLoading, 0, iMenuFont); Text_PaintCenter(centerPoint, yStart + 192, scale, colorWhite, sEstimatedTimeLeft, 0, iMenuFont); Text_PaintCenter(centerPoint, yStart + 248, scale, colorWhite, sTransferRate, 0, iMenuFont); if (downloadSize > 0) { s = va("%s (%d%%)", downloadName, (int)((float)downloadCount * 100.0f / downloadSize)); } else { s = downloadName; } Text_PaintCenter(centerPoint, yStart+136, scale, colorWhite, s, 0, iMenuFont); CG_ReadableSize( dlSizeBuf, sizeof dlSizeBuf, downloadCount ); CG_ReadableSize( totalSizeBuf, sizeof totalSizeBuf, downloadSize ); if (downloadCount < 4096 || !downloadTime) { Text_PaintCenter(leftWidth, yStart+216, scale, colorWhite, "estimating", 0, iMenuFont); Text_PaintCenter(leftWidth, yStart+160, scale, colorWhite, va("(%s %s %s %s)", dlSizeBuf, sOf, totalSizeBuf, sCopied), 0, iMenuFont); } else { if ((downloadTime) / 1000) { xferRate = downloadCount / ((downloadTime) / 1000); } else { xferRate = 0; } CG_ReadableSize( xferRateBuf, sizeof xferRateBuf, xferRate ); // Extrapolate estimated completion time if (downloadSize && xferRate) { int n = downloadSize / xferRate; // estimated time for entire d/l in secs // We do it in K (/1024) because we'd overflow around 4MB UI_PrintTime ( dlTimeBuf, sizeof dlTimeBuf, (n - (((downloadCount/1024) * n) / (downloadSize/1024))) * 1000); Text_PaintCenter(leftWidth, yStart+216, scale, colorWhite, dlTimeBuf, 0, iMenuFont); Text_PaintCenter(leftWidth, yStart+160, scale, colorWhite, va("(%s %s %s %s)", dlSizeBuf, sOf, totalSizeBuf, sCopied), 0, iMenuFont); } else { Text_PaintCenter(leftWidth, yStart+216, scale, colorWhite, "estimating", 0, iMenuFont); if (downloadSize) { Text_PaintCenter(leftWidth, yStart+160, scale, colorWhite, va("(%s %s %s %s)", dlSizeBuf, sOf, totalSizeBuf, sCopied), 0, iMenuFont); } else { Text_PaintCenter(leftWidth, yStart+160, scale, colorWhite, va("(%s %s)", dlSizeBuf, sCopied), 0, iMenuFont); } } if (xferRate) { Text_PaintCenter(leftWidth, yStart+272, scale, colorWhite, va("%s/%s", xferRateBuf,sSec), 0, iMenuFont); } } return; } #endif info = CG_ConfigString( CS_SERVERINFO ); sysInfo = CG_ConfigString( CS_SYSTEMINFO ); s = Info_ValueForKey( info, "mapname" ); levelshot = trap->R_RegisterShaderNoMip( va( "levelshots/%s", s ) ); if ( !levelshot ) { levelshot = trap->R_RegisterShaderNoMip( "menu/art/unknownmap_mp" ); } trap->R_SetColor( NULL ); CG_DrawPic( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, levelshot ); CG_LoadBar(); // draw the icons of things as they are loaded // CG_DrawLoadingIcons(); // the first 150 rows are reserved for the client connection // screen to write into if ( cg.infoScreenText[0] ) { const char *psLoading = CG_GetStringEdString("MENUS", "LOADING_MAPNAME"); CG_DrawProportionalString( 320, 128-32, va(/*"Loading... %s"*/ psLoading, cg.infoScreenText), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); } else { const char *psAwaitingSnapshot = CG_GetStringEdString("MENUS", "AWAITING_SNAPSHOT"); CG_DrawProportionalString( 320, 128-32, /*"Awaiting snapshot..."*/psAwaitingSnapshot, UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); } // draw info string information y = 180-32; // 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" ), sizeof( buf ) ); Q_CleanStr(buf); CG_DrawProportionalString( 320, y, buf, UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; // pure server s = Info_ValueForKey( sysInfo, "sv_pure" ); if ( s[0] == '1' ) { const char *psPure = CG_GetStringEdString("MP_INGAME", "PURE_SERVER"); CG_DrawProportionalString( 320, y, psPure, UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } // server-specific message of the day s = CG_ConfigString( CS_MOTD ); if ( s[0] ) { CG_DrawProportionalString( 320, y, s, UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } { // display global MOTD at bottom (mirrors ui_main UI_DrawConnectScreen char motdString[1024]; trap->Cvar_VariableStringBuffer( "cl_motdString", motdString, sizeof( motdString ) ); if (motdString[0]) { CG_DrawProportionalString( 320, 425, motdString, UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); } } // some extra space after hostname and motd y += 10; } // map-specific message (long map name) s = CG_ConfigString( CS_MESSAGE ); if ( s[0] ) { CG_DrawProportionalString( 320, y, s, UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } // cheats warning s = Info_ValueForKey( sysInfo, "sv_cheats" ); if ( s[0] == '1' ) { CG_DrawProportionalString( 320, y, CG_GetStringEdString("MP_INGAME", "CHEATSAREENABLED"), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } // game type s = BG_GetGametypeString( cgs.gametype ); CG_DrawProportionalString( 320, y, s, UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; if (cgs.gametype != GT_SIEGE) { value = atoi( Info_ValueForKey( info, "timelimit" ) ); if ( value ) { CG_DrawProportionalString( 320, y, va( "%s %i", CG_GetStringEdString("MP_INGAME", "TIMELIMIT"), value ), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } if (cgs.gametype < GT_CTF ) { value = atoi( Info_ValueForKey( info, "fraglimit" ) ); if ( value ) { CG_DrawProportionalString( 320, y, va( "%s %i", CG_GetStringEdString("MP_INGAME", "FRAGLIMIT"), value ), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } if (cgs.gametype == GT_DUEL || cgs.gametype == GT_POWERDUEL) { value = atoi( Info_ValueForKey( info, "duel_fraglimit" ) ); if ( value ) { CG_DrawProportionalString( 320, y, va( "%s %i", CG_GetStringEdString("MP_INGAME", "WINLIMIT"), value ), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } } } } if (cgs.gametype >= GT_CTF) { value = atoi( Info_ValueForKey( info, "capturelimit" ) ); if ( value ) { CG_DrawProportionalString( 320, y, va( "%s %i", CG_GetStringEdString("MP_INGAME", "CAPTURELIMIT"), value ), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } } if (cgs.gametype >= GT_TEAM) { value = atoi( Info_ValueForKey( info, "g_forceBasedTeams" ) ); if ( value ) { CG_DrawProportionalString( 320, y, CG_GetStringEdString("MP_INGAME", "FORCEBASEDTEAMS"), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } } if (cgs.gametype != GT_SIEGE) { valueNOFP = atoi( Info_ValueForKey( info, "g_forcePowerDisable" ) ); value = atoi( Info_ValueForKey( info, "g_maxForceRank" ) ); if ( value && !valueNOFP && (value < NUM_FORCE_MASTERY_LEVELS) ) { char fmStr[1024]; trap->SE_GetStringTextString("MP_INGAME_MAXFORCERANK",fmStr, sizeof(fmStr)); CG_DrawProportionalString( 320, y, va( "%s %s", fmStr, CG_GetStringEdString("MP_INGAME", forceMasteryLevels[value]) ), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } else if (!valueNOFP) { char fmStr[1024]; trap->SE_GetStringTextString("MP_INGAME_MAXFORCERANK",fmStr, sizeof(fmStr)); CG_DrawProportionalString( 320, y, va( "%s %s", fmStr, (char *)CG_GetStringEdString("MP_INGAME", forceMasteryLevels[7]) ), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } if (cgs.gametype == GT_DUEL || cgs.gametype == GT_POWERDUEL) { value = atoi( Info_ValueForKey( info, "g_duelWeaponDisable" ) ); } else { value = atoi( Info_ValueForKey( info, "g_weaponDisable" ) ); } if ( cgs.gametype != GT_JEDIMASTER && value ) { CG_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "SABERONLYSET") ), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } if ( valueNOFP ) { CG_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "NOFPSET") ), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } } // Display the rules based on type y += iPropHeight; switch ( cgs.gametype ) { case GT_FFA: CG_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_FFA_1")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; break; case GT_HOLOCRON: CG_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_HOLO_1")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; CG_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_HOLO_2")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; break; case GT_JEDIMASTER: CG_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_JEDI_1")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; CG_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_JEDI_2")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; break; case GT_SINGLE_PLAYER: break; case GT_DUEL: CG_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_DUEL_1")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; CG_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_DUEL_2")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; break; case GT_POWERDUEL: CG_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_POWERDUEL_1")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; CG_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_POWERDUEL_2")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; break; case GT_TEAM: CG_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_TEAM_1")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; CG_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_TEAM_2")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; break; case GT_SIEGE: break; case GT_CTF: CG_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_CTF_1")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; CG_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_CTF_2")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; break; case GT_CTY: CG_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_CTY_1")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; CG_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_CTY_2")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; break; default: break; } }
void CG_DrawInformation( void ) { const char *s; const char *info; const char *sysInfo; int y; int value, valueNOFP; qhandle_t levelshot; char buf[1024]; int iPropHeight = 18; // I know, this is total crap, but as a post release asian-hack.... -Ste info = CG_ConfigString( CS_SERVERINFO ); sysInfo = CG_ConfigString( CS_SYSTEMINFO ); s = Info_ValueForKey( info, "mapname" ); levelshot = trap_R_RegisterShaderNoMip( va( "levelshots/%s", s ) ); if ( !levelshot ) { levelshot = trap_R_RegisterShaderNoMip( "menu/art/unknownmap_mp" ); } trap_R_SetColor( NULL ); // Levelshot in bottom-right frame CG_DrawPic( 371, 279, 189, 141, levelshot ); switch( cgs.gametype ) { case GT_FFA: levelshot = trap_R_RegisterShaderNoMip( "levelshots/mp_ffa" ); break; case GT_DUEL: levelshot = trap_R_RegisterShaderNoMip( "levelshots/mp_duel" ); break; case GT_POWERDUEL: levelshot = trap_R_RegisterShaderNoMip( "levelshots/mp_pduel" ); break; case GT_TEAM: levelshot = trap_R_RegisterShaderNoMip( "levelshots/mp_tffa" ); break; case GT_SIEGE: levelshot = trap_R_RegisterShaderNoMip( "levelshots/mp_siege" ); break; case GT_CTF: levelshot = trap_R_RegisterShaderNoMip( "levelshots/mp_ctf" ); break; default: levelshot = trap_R_RegisterShaderNoMip( "levelshots/mp_ffa" ); break; } CG_DrawPic( 75, 279, 189, 141, levelshot ); CG_LoadBar(); // draw the icons of things as they are loaded // CG_DrawLoadingIcons(); // the first 150 rows are reserved for the client connection // screen to write into // if ( cg->infoScreenText[0] ) { // const char *psLoading = CG_GetStringEdString("MENUS", "LOADING_MAPNAME"); // UI_DrawProportionalString( 320, 128-32, va(/*"Loading... %s"*/ psLoading, cg->infoScreenText), // UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); // } else { // const char *psAwaitingSnapshot = CG_GetStringEdString("MENUS", "AWAITING_SNAPSHOT"); // UI_DrawProportionalString( 320, 128-32, /*"Awaiting snapshot..."*/psAwaitingSnapshot, // UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); // } // draw info string information y = 60; // 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); UI_DrawProportionalString( 320, y, buf, UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; // some extra space after hostname and motd y += 10; } */ // Long map name s = CG_ConfigString( CS_MESSAGE ); if ( s[0] ) { UI_DrawProportionalString( 320, y, s, UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } // Game type switch ( cgs.gametype ) { case GT_FFA: s = CG_GetStringEdString("MENUS", "FREE_FOR_ALL"); break; case GT_DUEL: s = CG_GetStringEdString("MENUS", "DUEL"); break; case GT_POWERDUEL: s = CG_GetStringEdString("MENUS", "POWERDUEL"); break; case GT_TEAM: s = CG_GetStringEdString("MENUS", "TEAM_FFA"); break; case GT_SIEGE: s = CG_GetStringEdString("MENUS", "SIEGE"); break; case GT_CTF: s = CG_GetStringEdString("MENUS", "CAPTURE_THE_FLAG"); break; default: s = CG_GetStringEdString("MENUS", "FREE_FOR_ALL"); break; } UI_DrawProportionalString( 320, y, s, UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; // Rules if (cgs.gametype != GT_SIEGE) { value = atoi( Info_ValueForKey( info, "timelimit" ) ); if ( value ) { UI_DrawProportionalString( 320, y, va( "%s %i", CG_GetStringEdString("MP_INGAME", "TIMELIMIT"), value ), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } if (cgs.gametype < GT_CTF ) { value = atoi( Info_ValueForKey( info, "fraglimit" ) ); if ( value ) { UI_DrawProportionalString( 320, y, va( "%s %i", CG_GetStringEdString("MP_INGAME", "FRAGLIMIT"), value ), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } if (cgs.gametype == GT_DUEL || cgs.gametype == GT_POWERDUEL) { value = atoi( Info_ValueForKey( info, "duel_fraglimit" ) ); if ( value ) { UI_DrawProportionalString( 320, y, va( "%s %i", CG_GetStringEdString("MP_INGAME", "WINLIMIT"), value ), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } } } } if (cgs.gametype >= GT_CTF) { value = atoi( Info_ValueForKey( info, "capturelimit" ) ); if ( value ) { UI_DrawProportionalString( 320, y, va( "%s %i", CG_GetStringEdString("MP_INGAME", "CAPTURELIMIT"), value ), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } } if (cgs.gametype >= GT_TEAM) { value = atoi( Info_ValueForKey( info, "g_forceBasedTeams" ) ); if ( value ) { UI_DrawProportionalString( 320, y, CG_GetStringEdString("MP_INGAME", "FORCEBASEDTEAMS"), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } } if (cgs.gametype != GT_SIEGE) { valueNOFP = atoi( Info_ValueForKey( info, "g_forcePowerDisable" ) ); value = atoi( Info_ValueForKey( info, "g_maxForceRank" ) ); if ( value && !valueNOFP ) { char fmStr[1024]; trap_SP_GetStringTextString("MP_INGAME_MAXFORCERANK",fmStr, sizeof(fmStr)); UI_DrawProportionalString( 320, y, va( "%s %s", fmStr, CG_GetStringEdString("MP_INGAME", forceMasteryLevels[value]) ), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } else if (!valueNOFP) { char fmStr[1024]; trap_SP_GetStringTextString("MP_INGAME_MAXFORCERANK",fmStr, sizeof(fmStr)); UI_DrawProportionalString( 320, y, va( "%s %s", fmStr, (char *)CG_GetStringEdString("MP_INGAME", forceMasteryLevels[7]) ), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } if (cgs.gametype == GT_DUEL || cgs.gametype == GT_POWERDUEL) { value = atoi( Info_ValueForKey( info, "g_duelWeaponDisable" ) ); } else { value = atoi( Info_ValueForKey( info, "g_weaponDisable" ) ); } if ( cgs.gametype != GT_JEDIMASTER && value ) { UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "SABERONLYSET") ), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } if ( valueNOFP ) { UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "NOFPSET") ), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; } } // Display the rules based on type y += iPropHeight; switch ( cgs.gametype ) { case GT_FFA: UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_FFA_1")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; break; case GT_DUEL: UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_DUEL_1")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_DUEL_2")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; break; case GT_POWERDUEL: UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_POWERDUEL_1")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_POWERDUEL_2")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_POWERDUEL_3")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; break; case GT_TEAM: UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_TEAM_1")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_TEAM_2")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; break; case GT_SIEGE: break; case GT_CTF: UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_CTF_1")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_CTF_2")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; UI_DrawProportionalString( 320, y, va( "%s", (char *)CG_GetStringEdString("MP_INGAME", "RULES_CTF_3")), UI_CENTER|UI_INFOFONT|UI_DROPSHADOW, colorWhite ); y += iPropHeight; break; default: break; } }
/* ================= CG_DrawScoreboard ================= */ static void CG_DrawClientScore( int y, score_t *score, vector4 *color, float fade, qboolean largeFormat ) { //vector3 headAngles; clientInfo_t *ci; int iconx = SB_SCORELINE_X - 5;//SB_BOTICON_X + (SB_RATING_WIDTH / 2); float scale = largeFormat ? 1.0f : 0.75f, iconSize = largeFormat ? SB_NORMAL_HEIGHT : SB_INTER_HEIGHT; iconx -= iconSize; if ( score->client < 0 || score->client >= cgs.maxclients ) { Com_Printf( "Bad score->client: %i\n", score->client ); return; } ci = &cgs.clientinfo[score->client]; // draw the handicap or bot skill marker (unless player has flag) if ( ci->powerups & (1<<PW_NEUTRALFLAG) ) { if ( largeFormat ) CG_DrawFlagModel( iconx, y - (32 - BIGCHAR_HEIGHT) / 2, iconSize, iconSize, TEAM_FREE, qfalse ); else CG_DrawFlagModel( iconx, y, iconSize, iconSize, TEAM_FREE, qfalse ); } else if ( ci->powerups & ( 1 << PW_REDFLAG ) ) CG_DrawFlagModel( iconx, y, iconSize, iconSize, TEAM_RED, qfalse ); else if ( ci->powerups & ( 1 << PW_BLUEFLAG ) ) CG_DrawFlagModel( iconx, y, iconSize, iconSize, TEAM_BLUE, qfalse ); else if ( cgs.gametype == GT_POWERDUEL && (ci->duelTeam == DUELTEAM_LONE || ci->duelTeam == DUELTEAM_DOUBLE) ) { CG_DrawPic( iconx, y, iconSize, iconSize, trap->R_RegisterShaderNoMip( (ci->duelTeam == DUELTEAM_LONE) ? "gfx/mp/pduel_icon_lone" : "gfx/mp/pduel_icon_double" ) ); } else if (cgs.gametype == GT_SIEGE) { //try to draw the shader for this class on the scoreboard if (ci->siegeIndex != -1) { siegeClass_t *scl = &bgSiegeClasses[ci->siegeIndex]; if (scl->classShader) { CG_DrawPic (iconx, y, largeFormat?24:12, largeFormat?24:12, scl->classShader); } } } else if ( ci->modelIcon && cg_scoreboardSkinIcons.integer ) CG_DrawPic( iconx, y, iconSize, iconSize, ci->modelIcon ); // highlight your position if ( score->client == cg.snap->ps.clientNum ) { vector4 hcolor; int rank; localClient = qtrue; if ( cg.snap->ps.persistant[PERS_TEAM] == TEAM_SPECTATOR || cgs.gametype >= GT_TEAM ) { rank = -1; } else { rank = cg.snap->ps.persistant[PERS_RANK] & ~RANK_TIED_FLAG; } if ( rank == 0 ) { hcolor.r = 0; hcolor.g = 0; hcolor.b = 0.7f; } else if ( rank == 1 ) { hcolor.r = 0.7f; hcolor.g = 0; hcolor.b = 0; } else if ( rank == 2 ) { hcolor.r = 0.7f; hcolor.g = 0.7f; hcolor.b = 0; } else { hcolor.r = 0.7f; hcolor.g = 0.7f; hcolor.b = 0.7f; } hcolor.a = fade * 0.7; CG_FillRect( SB_SCORELINE_X - 5, y /*+ 2*/, SB_SCORELINE_WIDTH /*- SB_SCORELINE_X * 2 + 10*/, largeFormat?SB_NORMAL_HEIGHT:SB_INTER_HEIGHT, &hcolor ); } CG_Text_Paint (SB_NAME_X, y, 0.9f * scale, &colorWhite, ci->name,0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM ); if ( score->ping != -1 ) { if ( ci->team != TEAM_SPECTATOR || cgs.gametype == GT_DUEL || cgs.gametype == GT_POWERDUEL ) { if (cgs.gametype == GT_DUEL || cgs.gametype == GT_POWERDUEL) { 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 ); } else { if ( Server_Supports( SSF_SCOREBOARD_KD ) ) CG_Text_Paint (SB_SCORE_X, y, 1.0f * scale, &colorWhite, va("%i/%i", score->score, score->deaths),0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_SMALL ); else CG_Text_Paint (SB_SCORE_X, y, 1.0f * scale, &colorWhite, va("%i", score->score),0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_SMALL ); } } CG_Text_Paint (SB_PING_X, y, 1.0f * scale, &colorWhite, va("%i", score->ping),0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_SMALL ); CG_Text_Paint (SB_TIME_X, y, 1.0f * scale, &colorWhite, va("%i", score->time),0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_SMALL ); } else { CG_Text_Paint (SB_SCORE_X, y, 1.0f * scale, &colorWhite, "-",0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_SMALL ); CG_Text_Paint (SB_PING_X, y, 1.0f * scale, &colorWhite, "-",0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_SMALL ); CG_Text_Paint (SB_TIME_X, y, 1.0f * scale, &colorWhite, "-",0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_SMALL ); } // add the "ready" marker for intermission exiting if ( cg.snap->ps.stats[STAT_CLIENTS_READY] & ( 1 << score->client ) ) { CG_Text_Paint( cg_scoreboardSkinIcons.integer ? 4 : SB_NAME_X - 48, y + 2, 0.7f * scale, &colorWhite, CG_GetStringEdString("MP_INGAME", "READY"), 0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM ); } else if ( cgs.clientinfo[score->client].botSkill != -1 ) CG_Text_Paint( cg_scoreboardSkinIcons.integer ? 4 : SB_NAME_X - 48, y + 2, 0.7f * scale, &colorWhite, "BOT", 0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM ); else if ( score->team == TEAM_SPECTATOR ) CG_Text_Paint( cg_scoreboardSkinIcons.integer ? 4 : SB_NAME_X - 48, y + 2, 0.7f * scale, &colorWhite, "SPEC", 0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM ); }
qboolean CG_DrawOldScoreboard( void ) { int x, y, w, i, n1, n2; float fade; float *fadeColor; char *s; int maxClients, realMaxClients; int lineHeight; int topBorderSize, bottomBorderSize; // Moved this up so we can use tab to refresh models if ( ++cg.deferredPlayerLoading > 10 ) { CG_LoadDeferredPlayers(); } // Re-enable it for now //return qfalse; //Disables scoreboard rendering, returns false before anything is drawn. // don't draw amuthing if the menu or console is up if ( cl_paused.integer ) { 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; fadeColor = colorWhite; } 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 // or if in intermission and duel, prints the winner of the duel round if ((cgs.gametype == GT_DUEL || cgs.gametype == GT_POWERDUEL) && cgs.duelWinner != -1 && cg.predictedPlayerState.pm_type == PM_INTERMISSION) { s = va("%s^7 %s", cgs.clientinfo[cgs.duelWinner].name, CG_GetStringEdString("MP_INGAME", "DUEL_WINS") ); /*w = CG_DrawStrlen( s ) * BIGCHAR_WIDTH; x = ( SCREEN_WIDTH - w ) / 2; y = 40; CG_DrawBigString( x, y, s, fade ); */ x = ( SCREEN_WIDTH ) / 2; y = 40; 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 ); } else if ((cgs.gametype == GT_DUEL || cgs.gametype == GT_POWERDUEL) && cgs.duelist1 != -1 && cgs.duelist2 != -1 && cg.predictedPlayerState.pm_type == PM_INTERMISSION) { if (cgs.gametype == GT_POWERDUEL && cgs.duelist3 != -1) { 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 ); } else { s = va("%s^7 %s %s", cgs.clientinfo[cgs.duelist1].name, CG_GetStringEdString("MP_INGAME", "SPECHUD_VERSUS"), cgs.clientinfo[cgs.duelist2].name ); } /*w = CG_DrawStrlen( s ) * BIGCHAR_WIDTH; x = ( SCREEN_WIDTH - w ) / 2; y = 40; CG_DrawBigString( x, y, s, fade ); */ x = ( SCREEN_WIDTH ) / 2; y = 40; 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 ); } else if ( cg.killerName[0] ) { s = va("%s %s", CG_GetStringEdString("MP_INGAME", "KILLEDBY"), cg.killerName ); /*w = CG_DrawStrlen( s ) * BIGCHAR_WIDTH; x = ( SCREEN_WIDTH - w ) / 2; y = 40; CG_DrawBigString( x, y, s, fade ); */ x = ( SCREEN_WIDTH ) / 2; y = 40; 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 ); } // current rank if (cgs.gametype == GT_POWERDUEL) { //do nothing? } else if ( cgs.gametype < GT_TEAM) { if (cg.snap->ps.persistant[PERS_TEAM] != TEAM_SPECTATOR ) { char sPlace[256]; char sOf[256]; char sWith[256]; trap_SP_GetStringTextString("MP_INGAME_PLACE", sPlace, sizeof(sPlace)); trap_SP_GetStringTextString("MP_INGAME_OF", sOf, sizeof(sOf)); trap_SP_GetStringTextString("MP_INGAME_WITH", sWith, sizeof(sWith)); s = va("%s %s (%s %i) %s %i", CG_PlaceString( cg.snap->ps.persistant[PERS_RANK] + 1 ), sPlace, sOf, cg.numScores, sWith, cg.snap->ps.persistant[PERS_SCORE] ); w = CG_DrawStrlen( s ) * BIGCHAR_WIDTH; x = ( SCREEN_WIDTH ) / 2; y = 60; //CG_DrawBigString( x, y, s, fade ); UI_DrawProportionalString(x, y, s, UI_CENTER|UI_DROPSHADOW, colorTable[CT_WHITE], FONT_MEDIUM); } } else { if ( cg.teamScores[0] == cg.teamScores[1] ) { s = va("%s %i", CG_GetStringEdString("MP_INGAME", "TIEDAT"), cg.teamScores[0] ); } else if ( cg.teamScores[0] >= cg.teamScores[1] ) { //s = va("%s, %i / %i", CG_GetStringEdString("MP_INGAME", "RED_LEADS"), cg.teamScores[0], cg.teamScores[1] ); s = va("%s, %i / %i", CG_GetStringEdString2(bgGangWarsTeams[cgs.redTeam].leadstring), cg.teamScores[0], cg.teamScores[1] ); } else { //s = va("%s, %i / %i", CG_GetStringEdString("MP_INGAME", "BLUE_LEADS"), cg.teamScores[1], cg.teamScores[0] ); s = va("%s, %i / %i", CG_GetStringEdString2(bgGangWarsTeams[cgs.blueTeam].leadstring), cg.teamScores[0], cg.teamScores[1] ); } x = ( SCREEN_WIDTH ) / 2; y = 60; 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 ); } // scoreboard y = SB_HEADER; CG_DrawPic ( SB_SCORELINE_X - 40, y - 5, SB_SCORELINE_WIDTH + 80, 40, trap_R_RegisterShaderNoMip ( "gfx/menus/menu_buttonback.tga" ) ); CG_Text_Paint ( SB_NAME_X, y, 1.0f, colorWhite, CG_GetStringEdString("MP_INGAME", "NAME"),0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM ); if (cgs.gametype == GT_DUEL || cgs.gametype == GT_POWERDUEL) { char sWL[100]; trap_SP_GetStringTextString("MP_INGAME_W_L", sWL, sizeof(sWL)); CG_Text_Paint ( SB_SCORE_X, y, 1.0f, colorWhite, sWL, 0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM ); } else { CG_Text_Paint ( SB_SCORE_X, y, 1.0f, colorWhite, CG_GetStringEdString("MP_INGAME", "SCORE"), 0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM ); } CG_Text_Paint ( SB_PING_X, y, 1.0f, colorWhite, CG_GetStringEdString("MP_INGAME", "PING"), 0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM ); CG_Text_Paint ( SB_TIME_X, y, 1.0f, colorWhite, CG_GetStringEdString("MP_INGAME", "TIME"), 0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM ); y = SB_TOP; // If there are more than SB_MAXCLIENTS_NORMAL, use the interleaved scores if ( cg.numScores > SB_MAXCLIENTS_NORMAL ) { maxClients = SB_MAXCLIENTS_INTER; lineHeight = SB_INTER_HEIGHT; topBorderSize = 8; bottomBorderSize = 16; } else { maxClients = SB_MAXCLIENTS_NORMAL; lineHeight = SB_NORMAL_HEIGHT; topBorderSize = 8; bottomBorderSize = 8; } realMaxClients = maxClients; localClient = qfalse; //I guess this should end up being able to display 19 clients at once. //In a team game, if there are 9 or more clients on the team not in the lead, //we only want to show 10 of the clients on the team in the lead, so that we //have room to display the clients in the lead on the losing team. //I guess this can be accomplished simply by printing the first teams score with a maxClients //value passed in related to how many players are on both teams. if ( cgs.gametype >= GT_TEAM ) { // // teamplay scoreboard // y += lineHeight/2; if ( cg.teamScores[0] >= cg.teamScores[1] ) { int team1MaxCl = CG_GetTeamCount(TEAM_RED, maxClients); int team2MaxCl = CG_GetTeamCount(TEAM_BLUE, maxClients); if (team1MaxCl > 10 && (team1MaxCl+team2MaxCl) > maxClients) { team1MaxCl -= team2MaxCl; //subtract as many as you have to down to 10, once we get there //we just set it to 10 if (team1MaxCl < 10) { team1MaxCl = 10; } } team2MaxCl = (maxClients-team1MaxCl); //team2 can display however many is left over after team1's display n1 = CG_TeamScoreboard( y, TEAM_RED, fade, team1MaxCl, lineHeight, qtrue ); CG_DrawTeamBackground( SB_SCORELINE_X - 5, y - topBorderSize, 640 - SB_SCORELINE_X * 2 + 10, n1 * lineHeight + bottomBorderSize, 0.33f, TEAM_RED ); CG_TeamScoreboard( y, TEAM_RED, fade, team1MaxCl, lineHeight, qfalse ); y += (n1 * lineHeight) + BIGCHAR_HEIGHT; //maxClients -= n1; n2 = CG_TeamScoreboard( y, TEAM_BLUE, fade, team2MaxCl, lineHeight, qtrue ); CG_DrawTeamBackground( SB_SCORELINE_X - 5, y - topBorderSize, 640 - SB_SCORELINE_X * 2 + 10, n2 * lineHeight + bottomBorderSize, 0.33f, TEAM_BLUE ); CG_TeamScoreboard( y, TEAM_BLUE, fade, team2MaxCl, lineHeight, qfalse ); y += (n2 * lineHeight) + BIGCHAR_HEIGHT; //maxClients -= n2; maxClients -= (team1MaxCl+team2MaxCl); } else { int team1MaxCl = CG_GetTeamCount(TEAM_BLUE, maxClients); int team2MaxCl = CG_GetTeamCount(TEAM_RED, maxClients); if (team1MaxCl > 10 && (team1MaxCl+team2MaxCl) > maxClients) { team1MaxCl -= team2MaxCl; //subtract as many as you have to down to 10, once we get there //we just set it to 10 if (team1MaxCl < 10) { team1MaxCl = 10; } } team2MaxCl = (maxClients-team1MaxCl); //team2 can display however many is left over after team1's display n1 = CG_TeamScoreboard( y, TEAM_BLUE, fade, team1MaxCl, lineHeight, qtrue ); CG_DrawTeamBackground( SB_SCORELINE_X - 5, y - topBorderSize, 640 - SB_SCORELINE_X * 2 + 10, n1 * lineHeight + bottomBorderSize, 0.33f, TEAM_BLUE ); CG_TeamScoreboard( y, TEAM_BLUE, fade, team1MaxCl, lineHeight, qfalse ); y += (n1 * lineHeight) + BIGCHAR_HEIGHT; //maxClients -= n1; n2 = CG_TeamScoreboard( y, TEAM_RED, fade, team2MaxCl, lineHeight, qtrue ); CG_DrawTeamBackground( SB_SCORELINE_X - 5, y - topBorderSize, 640 - SB_SCORELINE_X * 2 + 10, n2 * lineHeight + bottomBorderSize, 0.33f, TEAM_RED ); CG_TeamScoreboard( y, TEAM_RED, fade, team2MaxCl, lineHeight, qfalse ); y += (n2 * lineHeight) + BIGCHAR_HEIGHT; //maxClients -= n2; maxClients -= (team1MaxCl+team2MaxCl); } //Raz: Fix spectators not being shown on team scoreboard by preserving maxClients maxClients = realMaxClients; n1 = CG_TeamScoreboard( y, TEAM_SPECTATOR, fade, maxClients, lineHeight, qfalse ); y += (n1 * lineHeight) + BIGCHAR_HEIGHT; } else { // // free for all scoreboard // n1 = CG_TeamScoreboard( y, TEAM_FREE, fade, maxClients, lineHeight, qfalse ); y += (n1 * lineHeight) + BIGCHAR_HEIGHT; n2 = CG_TeamScoreboard( y, TEAM_SPECTATOR, fade, maxClients - n1, lineHeight, qfalse ); y += (n2 * lineHeight) + BIGCHAR_HEIGHT; } if (!localClient) { // draw local client at the bottom for ( i = 0 ; i < cg.numScores ; i++ ) { if ( cg.scores[i].client == cg.snap->ps.clientNum ) { CG_DrawClientScore( y, &cg.scores[i], fadeColor, fade, lineHeight == SB_NORMAL_HEIGHT ); break; } } } // load any models that have been deferred if ( ++cg.deferredPlayerLoading > 10 ) { CG_LoadDeferredPlayers(); } return qtrue; }
const char *CG_GetKillerText( void ) { if ( cg.killerName[0] ) return va( "%s %s", CG_GetStringEdString( "MP_INGAME", "KILLEDBY" ), cg.killerName ); return ""; }
// Draw the normal in-game scoreboard qboolean CG_DrawOldScoreboard( void ) { int x, y, i, n1, n2; float fade; const vector4 *fadeColor; const char *s; int maxClients, realMaxClients; int lineHeight; int topBorderSize, bottomBorderSize; // 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.0f; fadeColor = &colorWhite; } 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->a; } // fragged by ... line // or if in intermission and duel, prints the winner of the duel round if ( (cgs.gametype == GT_DUEL || cgs.gametype == GT_POWERDUEL) && cgs.duelWinner != -1 && cg.predictedPlayerState.pm_type == PM_INTERMISSION ) { s = va( "%s"S_COLOR_WHITE" %s", cgs.clientinfo[cgs.duelWinner].name, CG_GetStringEdString( "MP_INGAME", "DUEL_WINS" ) ); x = (SCREEN_WIDTH) / 2; y = 40; 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 ); } else if ( (cgs.gametype == GT_DUEL || cgs.gametype == GT_POWERDUEL) && cgs.duelist1 != -1 && cgs.duelist2 != -1 && cg.predictedPlayerState.pm_type == PM_INTERMISSION ) { if ( cgs.gametype == GT_POWERDUEL && cgs.duelist3 != -1 ) { s = va( "%s"S_COLOR_WHITE" %s %s"S_COLOR_WHITE" %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 ); } else { s = va( "%s"S_COLOR_WHITE" %s %s", cgs.clientinfo[cgs.duelist1].name, CG_GetStringEdString( "MP_INGAME", "SPECHUD_VERSUS" ), cgs.clientinfo[cgs.duelist2].name ); } x = (SCREEN_WIDTH) / 2; y = 40; 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 ); } else if ( cg.killerName[0] ) { s = va( "%s %s", CG_GetStringEdString( "MP_INGAME", "KILLEDBY" ), cg.killerName ); x = (SCREEN_WIDTH) / 2; y = 32; 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 ); } else if ( cgs.gametype == GT_SIEGE && (cg_siegeWinTeam == 1 || cg_siegeWinTeam == 2) ) { if ( cg_siegeWinTeam == 1 ) s = va( "%s", CG_GetStringEdString( "MP_INGAME", "SIEGETEAM1WIN" ) ); else s = va( "%s", CG_GetStringEdString( "MP_INGAME", "SIEGETEAM2WIN" ) ); x = (SCREEN_WIDTH) / 2; y = 60; 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 ); } else if ( cgs.gametype >= GT_TEAM ) { if ( cg.teamScores[0] == cg.teamScores[1] ) s = va( "%s %i", CG_GetStringEdString( "MP_INGAME", "TIEDAT" ), cg.teamScores[0] ); else if ( cg.teamScores[0] >= cg.teamScores[1] ) s = va( "%s, %i / %i", CG_GetStringEdString( "MP_INGAME", "RED_LEADS" ), cg.teamScores[0], cg.teamScores[1] ); else s = va( "%s, %i / %i", CG_GetStringEdString( "MP_INGAME", "BLUE_LEADS" ), cg.teamScores[1], cg.teamScores[0] ); x = (SCREEN_WIDTH) / 2; y = SB_HEADER - 24; 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 ); } x = (SCREEN_WIDTH) / 2; y = SB_HEADER; // CG_DrawBigString( x, y, s, fade ); s = cgs.japp.serverName; CG_Text_Paint( x - (CG_Text_Width( s, 0.75f, FONT_NONE ) / 2), y, 0.75f, &colorTable[CT_WHITE], s, 0.0f, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_NONE ); if ( cgs.gametype >= GT_TEAM ) { int redCount = 0, blueCount = 0, specCount = 0; for ( i = 0; i < cg.numScores; i++ ) { if ( cgs.clientinfo[cg.scores[i].client].team == TEAM_RED ) redCount++; else if ( cgs.clientinfo[cg.scores[i].client].team == TEAM_BLUE ) blueCount++; else if ( cgs.clientinfo[cg.scores[i].client].team == TEAM_SPECTATOR ) specCount++; } s = va( "Players: "S_COLOR_GREEN"%i"S_COLOR_WHITE"/"S_COLOR_GREEN"%i "S_COLOR_WHITE"("S_COLOR_RED"%i" S_COLOR_WHITE"/"S_COLOR_CYAN"%i"S_COLOR_WHITE") - %i spectators", cg.numScores, cgs.maxclients, redCount, blueCount, specCount ); } else { int specCount = 0; for ( i = 0; i < cg.numScores; i++ ) { if ( cgs.clientinfo[cg.scores[i].client].team == TEAM_SPECTATOR ) specCount++; } s = va( "Players: %i/%i - %i spectators", cg.numScores, cgs.maxclients, specCount ); } CG_Text_Paint( x - (CG_Text_Width( s, 0.75f, FONT_NONE ) / 2), y + 15, 0.75f, &colorTable[CT_WHITE], s, 0.0f, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_NONE ); s = va( "%s (%s)", (char *)CG_ConfigString( CS_MESSAGE ), cgs.mapname ); CG_Text_Paint( x - (CG_Text_Width( s, 0.75f, FONT_NONE ) / 2), y + 30, 0.75f, &colorTable[CT_WHITE], s, 0.0f, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_NONE ); // scoreboard y = SB_TOP - 24; //SB_HEADER // CG_DrawPic( SB_SCORELINE_X - 40, y - 5, SB_SCORELINE_WIDTH + 80, 40, trap->R_RegisterShaderNoMip ( "gfx/menus/menu_buttonback.tga" ) ); CG_Text_Paint( SB_NAME_X, y, 1.0f, &colorWhite, CG_GetStringEdString( "MP_INGAME", "NAME" ), 0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM ); if ( cgs.gametype == GT_DUEL || cgs.gametype == GT_POWERDUEL ) { char sWL[100]; trap->SE_GetStringTextString( "MP_INGAME_W_L", sWL, sizeof(sWL) ); CG_Text_Paint( SB_SCORE_X, y, 1.0f, &colorWhite, sWL, 0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM ); } else CG_Text_Paint( SB_SCORE_X, y, 1.0f, &colorWhite, CG_GetStringEdString( "MP_INGAME", "SCORE" ), 0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM ); CG_Text_Paint( SB_PING_X, y, 1.0f, &colorWhite, CG_GetStringEdString( "MP_INGAME", "PING" ), 0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM ); CG_Text_Paint( SB_TIME_X, y, 1.0f, &colorWhite, CG_GetStringEdString( "MP_INGAME", "TIME" ), 0, 0, ITEM_TEXTSTYLE_OUTLINED, FONT_MEDIUM ); y = SB_TOP; // If there are more than SB_MAXCLIENTS_NORMAL, use the interleaved scores if ( cg.numScores > SB_MAXCLIENTS_NORMAL ) { maxClients = SB_MAXCLIENTS_INTER; lineHeight = SB_INTER_HEIGHT; topBorderSize = 8; bottomBorderSize = 16; } else { maxClients = SB_MAXCLIENTS_NORMAL; lineHeight = SB_NORMAL_HEIGHT; topBorderSize = 8; bottomBorderSize = 8; } realMaxClients = maxClients; localClient = qfalse; //I guess this should end up being able to display 19 clients at once. //In a team game, if there are 9 or more clients on the team not in the lead, we only want to show 10 of the clients // on the team in the lead, so that we have room to display the clients in the lead on the losing team. //I guess this can be accomplished simply by printing the first teams score with a maxClients value passed in // related to how many players are on both teams. if ( cgs.gametype >= GT_TEAM ) { // teamplay scoreboard y += lineHeight / 2; if ( cg.teamScores[0] >= cg.teamScores[1] ) { int team1MaxCl = CG_GetTeamCount( TEAM_RED, maxClients ); int team2MaxCl = CG_GetTeamCount( TEAM_BLUE, maxClients ); if ( team1MaxCl > 10 && (team1MaxCl + team2MaxCl) > maxClients ) { team1MaxCl -= team2MaxCl; // subtract as many as you have to down to 10, once we get there we just set it to 10 if ( team1MaxCl < 10 ) team1MaxCl = 10; } team2MaxCl = (maxClients - team1MaxCl); //team2 can display however many is left over after team1's display n1 = CG_TeamScoreboard( y, TEAM_RED, fade, team1MaxCl, lineHeight, qtrue ); CG_DrawTeamBackground( SB_SCORELINE_X - 5, y - topBorderSize, SCREEN_WIDTH - SB_SCORELINE_X * 2 + 10, n1 * lineHeight + bottomBorderSize, 0.33f, TEAM_RED ); CG_TeamScoreboard( y, TEAM_RED, fade, team1MaxCl, lineHeight, qfalse ); y += (n1 * lineHeight) + BIGCHAR_HEIGHT; // maxClients -= n1; n2 = CG_TeamScoreboard( y, TEAM_BLUE, fade, team2MaxCl, lineHeight, qtrue ); CG_DrawTeamBackground( SB_SCORELINE_X - 5, y - topBorderSize, SCREEN_WIDTH - SB_SCORELINE_X * 2 + 10, n2 * lineHeight + bottomBorderSize, 0.33f, TEAM_BLUE ); CG_TeamScoreboard( y, TEAM_BLUE, fade, team2MaxCl, lineHeight, qfalse ); y += (n2 * lineHeight) + BIGCHAR_HEIGHT; // maxClients -= n2; // maxClients -= (team1MaxCl+team2MaxCl); } else { int team1MaxCl = CG_GetTeamCount( TEAM_BLUE, maxClients ); int team2MaxCl = CG_GetTeamCount( TEAM_RED, maxClients ); if ( team1MaxCl > 10 && (team1MaxCl + team2MaxCl) > maxClients ) { team1MaxCl -= team2MaxCl; //subtract as many as you have to down to 10, once we get there //we just set it to 10 if ( team1MaxCl < 10 ) team1MaxCl = 10; } team2MaxCl = (maxClients - team1MaxCl); //team2 can display however many is left over after team1's display n1 = CG_TeamScoreboard( y, TEAM_BLUE, fade, team1MaxCl, lineHeight, qtrue ); CG_DrawTeamBackground( SB_SCORELINE_X - 5, y - topBorderSize, SCREEN_WIDTH - SB_SCORELINE_X * 2 + 10, n1 * lineHeight + bottomBorderSize, 0.33f, TEAM_BLUE ); CG_TeamScoreboard( y, TEAM_BLUE, fade, team1MaxCl, lineHeight, qfalse ); y += (n1 * lineHeight) + BIGCHAR_HEIGHT; // maxClients -= n1; n2 = CG_TeamScoreboard( y, TEAM_RED, fade, team2MaxCl, lineHeight, qtrue ); CG_DrawTeamBackground( SB_SCORELINE_X - 5, y - topBorderSize, SCREEN_WIDTH - SB_SCORELINE_X * 2 + 10, n2 * lineHeight + bottomBorderSize, 0.33f, TEAM_RED ); CG_TeamScoreboard( y, TEAM_RED, fade, team2MaxCl, lineHeight, qfalse ); y += (n2 * lineHeight) + BIGCHAR_HEIGHT; // maxClients -= n2; // maxClients -= (team1MaxCl+team2MaxCl); } maxClients = realMaxClients; n1 = CG_TeamScoreboard( y, TEAM_SPECTATOR, fade, maxClients, lineHeight, qfalse ); y += (n1 * lineHeight) + BIGCHAR_HEIGHT; } else { // free for all scoreboard n1 = CG_TeamScoreboard( y, TEAM_FREE, fade, maxClients, lineHeight, qfalse ); y += (n1 * lineHeight) + BIGCHAR_HEIGHT; n2 = CG_TeamScoreboard( y, TEAM_SPECTATOR, fade, maxClients - n1, lineHeight, qfalse ); y += (n2 * lineHeight) + BIGCHAR_HEIGHT; } if ( !localClient ) { // draw local client at the bottom for ( i = 0; i<cg.numScores; i++ ) { if ( cg.scores[i].client == cg.snap->ps.clientNum ) { CG_DrawClientScore( y, &cg.scores[i], fadeColor, fade, lineHeight == SB_NORMAL_HEIGHT ); break; } } } // load any models that have been deferred if ( ++cg.deferredPlayerLoading > 10 ) CG_LoadDeferredPlayers(); return qtrue; }