114 lines
3.5 KiB
C
114 lines
3.5 KiB
C
/*
|
|
===========================================================================
|
|
Copyright (C) 1999-2005 Id Software, Inc.
|
|
Copyright (C) 2007 HermitWorks Entertainment Corporation
|
|
|
|
This file is part of the Space Trader source code.
|
|
|
|
The Space Trader 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 2 of the License,
|
|
or (at your option) any later version.
|
|
|
|
The Space Trader 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 the Space Trader source code; if not, write to the Free Software
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
===========================================================================
|
|
*/
|
|
|
|
#include "cg_local.h"
|
|
|
|
// cg_info.c -- display information while data is being loading
|
|
|
|
#define MAX_LOADING_PLAYER_ICONS 16
|
|
#define MAX_LOADING_ITEM_ICONS 26
|
|
|
|
static int loadingPlayerIconCount;
|
|
static int loadingItemIconCount;
|
|
static qhandle_t loadingPlayerIcons[MAX_LOADING_PLAYER_ICONS];
|
|
static qhandle_t loadingItemIcons[MAX_LOADING_ITEM_ICONS];
|
|
|
|
|
|
/*
|
|
======================
|
|
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 && loadingItemIconCount < MAX_LOADING_ITEM_ICONS ) {
|
|
loadingItemIcons[loadingItemIconCount++] = 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 );
|
|
|
|
if ( loadingPlayerIconCount < MAX_LOADING_PLAYER_ICONS ) {
|
|
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/players/%s/icon_%s.tga", model, skin );
|
|
|
|
loadingPlayerIcons[loadingPlayerIconCount] = trap_R_RegisterShaderNoMip( iconName );
|
|
if ( !loadingPlayerIcons[loadingPlayerIconCount] ) {
|
|
Com_sprintf( iconName, MAX_QPATH, "models/players/characters/%s/icon_%s.tga", model, skin );
|
|
loadingPlayerIcons[loadingPlayerIconCount] = trap_R_RegisterShaderNoMip( iconName );
|
|
}
|
|
if ( !loadingPlayerIcons[loadingPlayerIconCount] ) {
|
|
Com_sprintf( iconName, MAX_QPATH, "models/players/%s/icon_%s.tga", DEFAULT_MODEL, "default" );
|
|
loadingPlayerIcons[loadingPlayerIconCount] = trap_R_RegisterShaderNoMip( iconName );
|
|
}
|
|
if ( loadingPlayerIcons[loadingPlayerIconCount] ) {
|
|
loadingPlayerIconCount++;
|
|
}
|
|
}
|
|
|
|
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.ogg", personality ), qtrue );
|
|
}
|
|
|
|
CG_LoadingString( personality );
|
|
}
|