stvoy-mp-sdk/Code-DM/cgame/cg_info.c
2000-12-11 00:00:00 +00:00

491 lines
14 KiB
C

// Copyright (C) 1999-2000 Id Software, Inc.
//
// cg_info.c -- display information while data is being loading
#include "cg_local.h"
#include "cg_text.h"
#define MAX_LOADING_PLAYER_ICONS 16
#define MAX_LOADING_ITEM_ICONS 26
static qhandle_t loadingPlayerIcon;
static qhandle_t loadingItemIcon;
void CG_LoadBar(void);
/*
===================
CG_DrawLoadingIcons
===================
*/
static void CG_DrawLoadingIcons( void ) {
// int n;
int x, y;
trap_R_SetColor( colorTable[CT_WHITE]);
x= 500;
y = 342;
if (loadingPlayerIcon)
{
CG_DrawPic( x, y, 64, 64, loadingPlayerIcon );
}
else if (loadingItemIcon)
{
trap_R_SetColor(colorTable[CT_LTPURPLE1]);
CG_DrawPic( x, y, 64, 64, cgs.media.weaponbox2 );
trap_R_SetColor( NULL);
CG_DrawPic( x, y, 64, 64, loadingItemIcon );
}
}
/*
======================
CG_LoadingString
======================
*/
void CG_LoadingString( const char *s ) {
Q_strncpyz( cg.infoScreenText, s, sizeof( cg.infoScreenText ) );
trap_UpdateScreen();
}
/*
===================
CG_LoadingItem
===================
*/
void CG_LoadingItem( int itemNum ) {
gitem_t *item;
item = &bg_itemlist[itemNum];
if ( item->icon ) {
loadingItemIcon = trap_R_RegisterShaderNoMip( item->icon );
}
CG_LoadingString( item->pickup_name );
}
/*
===================
CG_LoadingClient
===================
*/
void CG_LoadingClient( int clientNum ) {
const char *info;
char *skin;
char personality[MAX_QPATH];
char model[MAX_QPATH];
char iconName[MAX_QPATH];
info = CG_ConfigString( CS_PLAYERS + clientNum );
Q_strncpyz( model, Info_ValueForKey( info, "model" ), sizeof( model ) );
skin = Q_strrchr( model, '/' );
if ( skin ) {
*skin++ = '\0';
} else {
skin = "default";
}
Com_sprintf( iconName, MAX_QPATH, "models/players2/%s/icon_%s.jpg", model, skin );
loadingPlayerIcon = 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/voice/computer/misc/%s.wav", model ) ); //not exactly right since it'll miss subskins, but better than using personality
}//precache sound played in g_bot.c, PlayerIntroSound
CG_LoadingString( personality );
}
/*
====================
CG_DrawInformation
Draw all the status / pacifier stuff during level loading
this overlays the ui version in ui_connect.c, UI_DrawConnectScreen
====================
*/
void CG_DrawInformation( void ) {
const char *s;
const char *info;
const char *sysInfo;
int y,x;
int value;
qhandle_t levelshot;
// qhandle_t detail;
char buf[1024];
int strlength,length;
info = CG_ConfigString( CS_SERVERINFO );
sysInfo = CG_ConfigString( CS_SYSTEMINFO );
s = Info_ValueForKey( info, "mapname" );
levelshot = trap_R_RegisterShaderNoMip( va( "levelshots/%s.tga", s ) );
if ( !levelshot ) {
levelshot = trap_R_RegisterShaderNoMip( "levelshots/unknownmap" );
}
trap_R_SetColor( colorTable[CT_BLACK] );
CG_DrawPic( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, cgs.media.whiteShader );
trap_R_SetColor( colorTable[CT_DKGREY] );
CG_DrawPic( 11, 60, 260, 196, cgs.media.whiteShader );
trap_R_SetColor( NULL );
CG_DrawPic( 13, 62, 256, 192, levelshot ); //correct aspect
// trap_R_SetColor( colorTable[CT_LTGREY] );
// CG_DrawPic( 418, 82, 132, 132, cgs.media.whiteShader );
// trap_R_SetColor( NULL );
// CG_DrawPic( 420, 84, 128, 128, levelshot );
// blend a detail texture over it
// detail = trap_R_RegisterShader( "levelShotDetail" );
// trap_R_DrawStretchPic( 0, 0, cgs.glconfig.vidWidth, cgs.glconfig.vidHeight, 0, 0, 1, 1, detail );
UI_DrawProportionalString( 10, 10, ingame_text[IGT_HOLODECKSIMULATION], UI_BIGFONT, colorTable[CT_LTORANGE] );
strlength = UI_ProportionalStringWidth(ingame_text[IGT_HOLODECKSIMULATION],UI_BIGFONT);
length = 582 - (strlength + 6);
trap_R_SetColor( colorTable[CT_DKORANGE]);
CG_DrawPic( 10 + strlength + 6, 11, length, 22,cgs.media.whiteShader);
// CG_DrawPic( 224, 11, 368, 22,cgs.media.whiteShader);
CG_DrawPic( 595, 11, 32, 32,cgs.media.halfroundr_22); // Right End
trap_R_SetColor( colorTable[CT_DKPURPLE1]);
CG_DrawPic( 274+333, 232, -32, 32,cgs.media.corner_12_18); // LR
CG_DrawPic( 274+333, 84, -32, -32,cgs.media.corner_12_18); // UR
CG_DrawPic( 274, 60, 314, 18,cgs.media.whiteShader); // Top
CG_DrawPic( 274, 238, 314, 18,cgs.media.whiteShader); //Bottom
CG_DrawPic( 274, 75, 10, 170,cgs.media.whiteShader); // Left
CG_DrawPic( 274+321, 78, 12, 162,cgs.media.whiteShader); // Right
CG_LoadBar();
// draw the icons of thiings as they are loaded
CG_DrawLoadingIcons();
// the first 150 rows are reserved for the client connection
// screen to write into
if ( cg.infoScreenText[0] ) {
UI_DrawProportionalString( 320, 442, va("%s ... %s", ingame_text[IGT_LOADING], cg.infoScreenText),
UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorTable[CT_LTGOLD1]);
} else {
UI_DrawProportionalString( 320, 442, va("%s...", ingame_text[IGT_SNAPSHOT]),
UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorTable[CT_LTGOLD1] );
}
// draw info string information
y = 107;
// x = 314;
x = 288;
// don't print server lines if playing a local game
trap_Cvar_VariableStringBuffer( "sv_running", buf, sizeof( buf ) );
if ( !atoi( buf ) ) {
// server hostname
s = Info_ValueForKey( info, "sv_hostname" );
UI_DrawProportionalString( x, y, s,UI_SMALLFONT|UI_DROPSHADOW, colorTable[CT_VLTGOLD1] );
y += PROP_HEIGHT;
// pure server
s = Info_ValueForKey( sysInfo, "sv_pure" );
if ( s[0] == '1' ) {
UI_DrawProportionalString( x, y, ingame_text[IGT_PURESERVER],
UI_SMALLFONT|UI_DROPSHADOW, colorTable[CT_VLTGOLD1] );
y += PROP_HEIGHT;
}
// server-specific message of the day
s = CG_ConfigString( CS_MOTD );
if ( s[0] ) {
UI_DrawProportionalString(320, y, s,
UI_SMALLFONT|UI_DROPSHADOW, colorTable[CT_VLTGOLD1] );
y += PROP_HEIGHT;
}
// 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( x, y, s,
UI_SMALLFONT|UI_DROPSHADOW, colorTable[CT_VLTGOLD1] );
y += PROP_HEIGHT;
}
// cheats warning
s = Info_ValueForKey( sysInfo, "sv_cheats" );
if ( s[0] == '1' ) {
UI_DrawProportionalString( x, y, ingame_text[IGT_CHEATSAREENABLED],
UI_SMALLFONT|UI_DROPSHADOW, colorTable[CT_VLTGOLD1] );
y += PROP_HEIGHT;
}
// game type
switch ( cgs.gametype )
{
case GT_FFA:
s = ingame_text[IGT_GAME_FREEFORALL];
break;
case GT_SINGLE_PLAYER:
s = ingame_text[IGT_GAME_SINGLEPLAYER];
break;
case GT_TOURNAMENT:
s = ingame_text[IGT_GAME_TOURNAMENT];
break;
case GT_TEAM:
s = ingame_text[IGT_GAME_TEAMHOLOMATCH];
break;
case GT_CTF:
s = ingame_text[IGT_GAME_CAPTUREFLAG];
break;
default:
s = ingame_text[IGT_GAME_UNKNOWN];
break;
}
UI_DrawProportionalString( x, y, s, UI_SMALLFONT|UI_DROPSHADOW, colorTable[CT_VLTGOLD1] );
y += PROP_HEIGHT;
value = atoi( Info_ValueForKey( info, "timelimit" ) );
if ( value ) {
UI_DrawProportionalString( x, y, va( "%s %i",ingame_text[IGT_TIME_LIMIT], value ),
UI_SMALLFONT|UI_DROPSHADOW, colorTable[CT_VLTGOLD1] );
y += PROP_HEIGHT;
}
if (cgs.gametype != GT_CTF) {
value = atoi( Info_ValueForKey( info, "fraglimit" ) );
if ( value ) {
UI_DrawProportionalString( x, y, va( "%s %i", ingame_text[IGT_POINT_LIMIT],value ),
UI_SMALLFONT|UI_DROPSHADOW, colorTable[CT_VLTGOLD1] );
y += PROP_HEIGHT;
}
}
if (cgs.gametype == GT_CTF) {
value = atoi( Info_ValueForKey( info, "capturelimit" ) );
if ( value ) {
UI_DrawProportionalString( x, y, va( "%s %i",ingame_text[IGT_CAPTURE_LIMIT], value ),
UI_SMALLFONT|UI_DROPSHADOW, colorTable[CT_VLTGOLD1] );
y += PROP_HEIGHT;
}
}
}
/*
====================
CG_LoadBar
====================
*/
void CG_LoadBar(void)
{
int x,y,pad;
// Round LCARS buttons
y = 309;
x = 10;
pad = 22;
if (cg.loadLCARSStage < 1)
{
trap_R_SetColor( colorTable[CT_VDKPURPLE3]);
}
else
{
trap_R_SetColor( colorTable[CT_VLTGOLD1]);
CG_DrawPic( x + 222 - 20,y + 14, 16, 16,cgs.media.circle2);
UI_DrawProportionalString( x + 222, y + 14, ingame_text[IGT_REPLICATION_MATRIX],UI_SMALLFONT, colorTable[CT_VLTGOLD1]);
trap_R_SetColor( colorTable[CT_VLTPURPLE3]);
}
CG_DrawPic( x + 18, y +102, 128, 64,cgs.media.loading1);
if (cg.loadLCARSStage < 2)
{
trap_R_SetColor( colorTable[CT_VDKBLUE1]);
}
else
{
trap_R_SetColor( colorTable[CT_VLTGOLD1]);
CG_DrawPic( x + 222 - 20,y + 14, 16, 16,cgs.media.circle);
trap_R_SetColor( colorTable[CT_VLTBLUE1]);
}
CG_DrawPic( x, y + 37, 64, 64,cgs.media.loading2);
if (cg.loadLCARSStage < 3)
{
trap_R_SetColor( colorTable[CT_VDKPURPLE1]);
}
else
{
trap_R_SetColor( colorTable[CT_VLTGOLD1]);
CG_DrawPic( x + 222 - 20,y + 14+pad, 16, 16,cgs.media.circle2);
UI_DrawProportionalString( x + 222, y + 14 + pad, ingame_text[IGT_HOLOGRAPHIC_PROJECTORS],UI_SMALLFONT, colorTable[CT_VLTGOLD1]);
trap_R_SetColor( colorTable[CT_LTPURPLE1]);
}
CG_DrawPic( x + 17, y, 128, 64,cgs.media.loading3);
if (cg.loadLCARSStage < 4)
{
trap_R_SetColor( colorTable[CT_VDKPURPLE2]);
}
else
{
trap_R_SetColor( colorTable[CT_VLTGOLD1]);
CG_DrawPic( x + 222 - 20,y + 14+pad, 16, 16,cgs.media.circle);
trap_R_SetColor( colorTable[CT_LTPURPLE2]);
}
CG_DrawPic( x + 99, y, 128, 128,cgs.media.loading4);
if (cg.loadLCARSStage < 5)
{
trap_R_SetColor( colorTable[CT_VDKBLUE2]);
}
else
{
trap_R_SetColor( colorTable[CT_VLTGOLD1]);
CG_DrawPic( x + 222 - 20,y + 14+pad+pad, 16, 16,cgs.media.circle2);
UI_DrawProportionalString( x + 222, y + 14 + pad + pad, ingame_text[IGT_SIMULATION_DATA_BASE],UI_SMALLFONT, colorTable[CT_VLTGOLD1]);
trap_R_SetColor( colorTable[CT_VLTBLUE2]);
}
CG_DrawPic( x +137, y + 81, 64, 64,cgs.media.loading5);
if (cg.loadLCARSStage < 6)
{
trap_R_SetColor( colorTable[CT_VDKORANGE]);
}
else
{
trap_R_SetColor( colorTable[CT_VLTGOLD1]);
CG_DrawPic( x + 222 - 20,y + 14+pad+pad, 16, 16,cgs.media.circle);
trap_R_SetColor( colorTable[CT_LTORANGE]);
}
CG_DrawPic( x + 45, y + 99, 128, 64,cgs.media.loading6);
if (cg.loadLCARSStage < 7)
{
trap_R_SetColor( colorTable[CT_VDKBLUE2]);
}
else
{
trap_R_SetColor( colorTable[CT_VLTGOLD1]);
CG_DrawPic( x + 222 - 20,y + 14+pad+pad+pad, 16, 16,cgs.media.circle2);
UI_DrawProportionalString( x + 222, y + 14 + pad + pad + pad, ingame_text[IGT_SAFETY_LOCKS],UI_SMALLFONT, colorTable[CT_VLTGOLD1]);
trap_R_SetColor( colorTable[CT_LTBLUE2]);
}
CG_DrawPic( x + 38, y + 24, 64, 128,cgs.media.loading7);
if (cg.loadLCARSStage < 8)
{
trap_R_SetColor( colorTable[CT_VDKPURPLE1]);
}
else
{
trap_R_SetColor( colorTable[CT_VLTGOLD1]);
CG_DrawPic( x + 222 - 20,y + 14+pad+pad+pad, 16, 16,cgs.media.circle);
trap_R_SetColor( colorTable[CT_LTPURPLE1]);
}
CG_DrawPic( x + 78, y + 20, 128, 64,cgs.media.loading8);
if (cg.loadLCARSStage < 9)
{
trap_R_SetColor( colorTable[CT_VDKBROWN1]);
}
else
{
trap_R_SetColor( colorTable[CT_VLTBROWN1]);
}
CG_DrawPic( x +112, y + 66, 64, 128,cgs.media.loading9);
if (cg.loadLCARSStage < 9)
{
trap_R_SetColor( colorTable[CT_DKBLUE2]);
}
else
{
trap_R_SetColor( colorTable[CT_LTBLUE2]);
}
CG_DrawPic( x + 62, y + 44, 128, 128,cgs.media.loadingcircle); // Center arrows
cg.loadLCARScnt++;
if (cg.loadLCARScnt > 3)
{
cg.loadLCARScnt = 0;
}
trap_R_SetColor( colorTable[CT_DKPURPLE2]);
CG_DrawPic( x + 61, y + 43, 32, 32,cgs.media.loadingquarter); // Quad UL
CG_DrawPic( x + 135, y + 43, -32, 32,cgs.media.loadingquarter); // Quad UR
CG_DrawPic( x + 135, y +117, -32, -32,cgs.media.loadingquarter); // Quad LR
CG_DrawPic( x + 61, y +117, 32, -32,cgs.media.loadingquarter); // Quad LL
trap_R_SetColor( colorTable[CT_LTPURPLE2]);
switch (cg.loadLCARScnt)
{
case 0 :
CG_DrawPic( x + 61, y + 43, 32, 32,cgs.media.loadingquarter); // Quad UL
break;
case 1 :
CG_DrawPic( x + 135, y + 43, -32, 32,cgs.media.loadingquarter); // Quad UR
break;
case 2 :
CG_DrawPic( x + 135, y +117, -32, -32,cgs.media.loadingquarter); // Quad LR
break;
case 3 :
CG_DrawPic( x + 61, y +117, 32, -32,cgs.media.loadingquarter); // Quad LL
break;
}
UI_DrawProportionalString( x + 21, y + 150, "0987",UI_TINYFONT, colorTable[CT_BLACK]);
UI_DrawProportionalString( x + 3, y + 90, "18",UI_TINYFONT, colorTable[CT_BLACK]);
UI_DrawProportionalString( x + 24, y + 20, "7",UI_TINYFONT, colorTable[CT_BLACK]);
UI_DrawProportionalString( x + 93, y + 5, "51",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]);
UI_DrawProportionalString( x + 103, y + 5, "35",UI_TINYFONT, colorTable[CT_BLACK]);
UI_DrawProportionalString( x + 165, y + 83, "21",UI_TINYFONT, colorTable[CT_BLACK]);
UI_DrawProportionalString( x + 101, y + 149, "67",UI_TINYFONT, colorTable[CT_BLACK]);
UI_DrawProportionalString( x + 123, y + 36, "8",UI_TINYFONT, colorTable[CT_BLACK]);
UI_DrawProportionalString( x + 90, y + 65, "1",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]);
UI_DrawProportionalString( x + 105, y + 65, "2",UI_TINYFONT, colorTable[CT_BLACK]);
UI_DrawProportionalString( x + 105, y + 87, "3",UI_TINYFONT, colorTable[CT_BLACK]);
UI_DrawProportionalString( x + 91, y + 87, "4",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]);
trap_R_SetColor( colorTable[CT_DKBROWN1]);
y +=10;
CG_DrawPic( x + 130, y - 10 , 64, 16,cgs.media.loadingtrim);
CG_DrawPic( x + 130, y + 150, 64, -16,cgs.media.loadingtrim);
CG_DrawPic( x + 150, y - 10, 432, 8, cgs.media.whiteShader); // Top line
CG_DrawPic( x + 150, y + 142, 432, 8, cgs.media.whiteShader); // Bottom line
CG_DrawPic( x + 583, y - 7, 16, 151, cgs.media.whiteShader); // Side line
CG_DrawPic( x + 580, y + 1, 32, -16,cgs.media.loadingcorner);
CG_DrawPic( x + 580, y + 139, 32, 16,cgs.media.loadingcorner);
}