1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292
|
/*
===========================================================================
Return to Castle Wolfenstein multiplayer GPL Source Code
Copyright (C) 1999-2010 id Software LLC, a ZeniMax Media company.
This file is part of the Return to Castle Wolfenstein multiplayer GPL Source Code (RTCW MP Source Code).
RTCW MP Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
RTCW MP Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with RTCW MP Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the RTCW MP Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the RTCW MP Source Code. If not, please request a copy in writing from id Software at the address below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
===========================================================================
*/
// cg_info.c -- display information while data is being loading
#include "cg_local.h"
/*
======================
CG_LoadingString
======================
*/
void CG_LoadingString( const char *s ) {
Q_strncpyz( cg.infoScreenText, s, sizeof( cg.infoScreenText ) );
if ( s && s[0] != 0 ) {
CG_Printf( "%s", va( "LOADING... %s\n",s ) ); //----(SA) added so you can see from the console what's going on
}
trap_UpdateScreen();
}
/*
===================
CG_LoadingItem
===================
*/
void CG_LoadingItem( int itemNum ) {
#if 0 //----(SA) Max Kaufman request that we don't show any pacifier stuff for items
gitem_t *item;
item = &bg_itemlist[itemNum];
if ( item->giType == IT_KEY ) { // do not show keys at level startup //----(SA)
return;
}
if ( item->icon && loadingItemIconCount < MAX_LOADING_ITEM_ICONS ) {
loadingItemIcons[loadingItemIconCount++] = trap_R_RegisterShaderNoMip( item->icon );
}
CG_LoadingString( item->pickup_name );
#endif //----(SA) end
}
/*
===================
CG_LoadingClient
===================
*/
void CG_LoadingClient( int clientNum ) {
const char *info;
char *skin;
char personality[MAX_QPATH];
char model[MAX_QPATH];
char iconName[MAX_QPATH];
if ( cgs.gametype == GT_SINGLE_PLAYER && clientNum > 0 ) { // for now only show the player's icon in SP games
return;
}
info = CG_ConfigString( CS_PLAYERS + clientNum );
Q_strncpyz( model, Info_ValueForKey( info, "model" ), sizeof( model ) );
skin = strrchr( model, '/' );
if ( skin ) {
*skin++ = '\0';
} else {
skin = "default";
}
Com_sprintf( iconName, MAX_QPATH, "models/players/%s/icon_%s.tga", model, skin );
// (SA) ignore player icons for the moment
if ( !( cg_entities[clientNum].currentState.aiChar ) ) {
// if ( loadingPlayerIconCount < MAX_LOADING_PLAYER_ICONS ) {
// loadingPlayerIcons[loadingPlayerIconCount++] = trap_R_RegisterShaderNoMip( iconName );
// }
}
Q_strncpyz( personality, Info_ValueForKey( info, "n" ), sizeof( personality ) );
Q_CleanStr( personality );
if ( cgs.gametype == GT_SINGLE_PLAYER ) {
trap_S_RegisterSound( va( "sound/player/announce/%s.wav", personality ) );
}
CG_LoadingString( personality );
}
/*
====================
CG_DrawStats
====================
*/
typedef struct {
char *label;
int YOfs;
int labelX;
int labelFlags;
vec4_t *labelColor;
char *format;
int formatX;
int formatFlags;
vec4_t *formatColor;
int numVars;
} statsItem_t;
// this defines the layout of the mission stats
// NOTE: these must match the stats sent in AICast_ScriptAction_ChangeLevel()
static statsItem_t statsItems[] = {
{ "Kills", 170, 40, UI_SMALLFONT | UI_DROPSHADOW, &colorWhite, "%3i/%3i", 600, UI_SMALLFONT | UI_DROPSHADOW | UI_RIGHT, &colorWhite, 2 },
{ " Nazis", 40, 40, UI_EXSMALLFONT | UI_DROPSHADOW, &colorWhite, "%3i/%3i", 600, UI_EXSMALLFONT | UI_DROPSHADOW | UI_RIGHT, &colorWhite, 2 },
{ " Monsters", 15, 40, UI_EXSMALLFONT | UI_DROPSHADOW, &colorWhite, "%3i/%3i", 600, UI_EXSMALLFONT | UI_DROPSHADOW | UI_RIGHT, &colorWhite, 2 },
{ "Time", 30, 40, UI_SMALLFONT | UI_DROPSHADOW, &colorWhite, "%2ih %2im %2is", 600, UI_SMALLFONT | UI_DROPSHADOW | UI_RIGHT, &colorWhite, 3 },
{ "Secrets", 30, 40, UI_SMALLFONT | UI_DROPSHADOW, &colorWhite, "%i/%i", 600, UI_SMALLFONT | UI_DROPSHADOW | UI_RIGHT, &colorWhite, 2 },
{ "Attempts", 30, 40, UI_SMALLFONT | UI_DROPSHADOW, &colorWhite, "%i", 600, UI_SMALLFONT | UI_DROPSHADOW | UI_RIGHT, &colorWhite, 1 },
{ NULL }
};
/*
==============
CG_DrawStats
==============
*/
void CG_DrawStats( char *stats ) {
int i, y, v, j;
#define MAX_STATS_VARS 64
int vars[MAX_STATS_VARS];
char *str, *token;
char *formatStr = NULL; // TTimo: init
int varIndex;
char string[MAX_QPATH];
UI_DrawProportionalString( 320, 120, "MISSION STATS",
UI_CENTER | UI_SMALLFONT | UI_DROPSHADOW, colorWhite );
Q_strncpyz( string, stats, sizeof( string ) );
str = string;
// convert commas to spaces
for ( i = 0; str[i]; i++ ) {
if ( str[i] == ',' ) {
str[i] = ' ';
}
}
for ( i = 0, y = 0, v = 0; statsItems[i].label; i++ ) {
y += statsItems[i].YOfs;
UI_DrawProportionalString( statsItems[i].labelX, y, statsItems[i].label,
statsItems[i].labelFlags, *statsItems[i].labelColor );
if ( statsItems[i].numVars ) {
varIndex = v;
for ( j = 0; j < statsItems[i].numVars; j++ ) {
token = COM_Parse( &str );
if ( !token[0] ) {
CG_Error( "error parsing mission stats\n" );
return;
}
vars[v++] = atoi( token );
}
// build the formatStr
switch ( statsItems[i].numVars ) {
case 1:
formatStr = va( statsItems[i].format, vars[varIndex] );
break;
case 2:
formatStr = va( statsItems[i].format, vars[varIndex], vars[varIndex + 1] );
break;
case 3:
formatStr = va( statsItems[i].format, vars[varIndex], vars[varIndex + 1], vars[varIndex + 2] );
break;
case 4:
formatStr = va( statsItems[i].format, vars[varIndex], vars[varIndex + 1], vars[varIndex + 2], vars[varIndex + 3] );
break;
}
UI_DrawProportionalString( statsItems[i].formatX, y, formatStr,
statsItems[i].formatFlags, *statsItems[i].formatColor );
}
}
}
/*
====================
CG_DrawInformation
Draw all the status / pacifier stuff during level loading
====================
*/
void CG_DrawInformation( void ) {
const char *s;
const char *info;
qhandle_t levelshot = 0; // TTimo: init
static int callCount = 0;
float percentDone;
int expectedHunk;
char hunkBuf[MAX_QPATH];
if ( cg.snap ) {
return; // we are in the world, no need to draw information
}
if ( callCount ) { // reject recursive calls
return;
}
callCount++;
info = CG_ConfigString( CS_SERVERINFO );
trap_Cvar_VariableStringBuffer( "com_expectedhunkusage", hunkBuf, MAX_QPATH );
expectedHunk = atoi( hunkBuf );
s = Info_ValueForKey( info, "mapname" );
levelshot = trap_R_RegisterShaderNoMip( va( "levelshots/%s.tga", s ) );
if ( !levelshot ) {
levelshot = trap_R_RegisterShaderNoMip( "levelshots/unknownmap.jpg" );
}
trap_R_SetColor( NULL );
// Pillarboxes
if ( cg_fixedAspect.integer ) {
if ( cgs.glconfig.vidWidth * 480.0 > cgs.glconfig.vidHeight * 640.0 ) {
vec4_t col = { 0, 0, 0, 1 };
float pillar = 0.5 * ( ( cgs.glconfig.vidWidth - ( cgs.screenXScale * 640.0 ) ) / cgs.screenXScale );
CG_SetScreenPlacement( PLACE_LEFT, PLACE_CENTER );
CG_FillRect( 0, 0, pillar + 1, 480, col );
CG_SetScreenPlacement( PLACE_RIGHT, PLACE_CENTER );
CG_FillRect( 640 - pillar, 0, pillar + 1, 480, col );
CG_SetScreenPlacement( PLACE_CENTER, PLACE_CENTER );
}
}
CG_DrawPic( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, levelshot );
// show the server motd
CG_DrawMotd();
// show the percent complete bar
if ( expectedHunk >= 0 ) {
vec2_t xy = { 200, 468 };
vec2_t wh = { 240, 10 };
percentDone = (float)( cg_hunkUsed.integer + cg_soundAdjust.integer ) / (float)( expectedHunk );
if ( percentDone > 0.97 ) { // never actually show 100%, since we are not in the game yet
percentDone = 0.97;
}
CG_HorizontalPercentBar( xy[0], xy[1], wh[0], wh[1], percentDone );
}
callCount--;
}
|