summaryrefslogtreecommitdiff
path: root/src/cgame
diff options
context:
space:
mode:
Diffstat (limited to 'src/cgame')
-rw-r--r--src/cgame/cg_local.h2
-rw-r--r--src/cgame/cg_main.c38
-rw-r--r--src/cgame/cg_players.c19
3 files changed, 25 insertions, 34 deletions
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h
index 5c015ab3..fc009a62 100644
--- a/src/cgame/cg_local.h
+++ b/src/cgame/cg_local.h
@@ -193,8 +193,6 @@ typedef struct centity_s {
vec3_t lerpOrigin;
vec3_t lerpAngles;
- //TA: value to store corpse number
- int corpseNum;
lerpFrame_t lerpFrame;
} centity_t;
diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c
index 82b11aee..926f055c 100644
--- a/src/cgame/cg_main.c
+++ b/src/cgame/cg_main.c
@@ -934,32 +934,28 @@ CG_RegisterClients
static void CG_RegisterClients( void ) {
int i;
- //CG_LoadingClient(cg.clientNum);
- //CG_NewClientInfo(cg.clientNum);
+ //precache all the models/sounds/etc
+ for ( i = PCL_NONE + 1; i < PCL_NUM_CLASSES; i++ ) {
+ const char *clientInfo;
- //yeah ok its silly, but lets precache models before setting client defaults
- for (i=MAX_CLIENTS+MAX_PRECACHES+1; i>=0; i--) {
- const char *clientInfo;
-
-/* if (cg.clientNum == i) {
+ clientInfo = CG_ConfigString( CS_PRECACHES + i );
+ if ( !clientInfo[0] )
continue;
- }*/
+
+ CG_LoadingClient( i );
+ CG_PrecacheClientInfo( i );
+ }
- clientInfo = CG_ConfigString( CS_PLAYERS+i );
- if ( !clientInfo[0] ) {
+ //load all the clientinfos of clients already connected to the server
+ for( i = 0; i < MAX_CLIENTS; i++ )
+ {
+ const char *clientInfo;
+
+ clientInfo = CG_ConfigString( CS_PLAYERS + i );
+ if( !clientInfo[ 0 ] )
continue;
- }
- if( i < MAX_CLIENTS )
- {
-/* CG_LoadingClient( i );
- CG_NewClientInfo( i );*/
- }
- else
- {
- CG_LoadingClient( i );
- CG_PrecacheClientInfo( i );
- }
+ CG_NewClientInfo( i );
}
CG_BuildSpectatorString();
diff --git a/src/cgame/cg_players.c b/src/cgame/cg_players.c
index 803f3389..a6c5fcab 100644
--- a/src/cgame/cg_players.c
+++ b/src/cgame/cg_players.c
@@ -501,7 +501,7 @@ static int CG_GetCorpseNum( int pclass ) {
modelName = BG_FindModelNameForClass( pclass );
- for ( i = 0 ; i < MAX_CLIENTS; i++ )
+ for ( i = PCL_NONE + 1 ; i < PCL_NUM_CLASSES; i++ )
{
match = &cgs.corpseinfo[ i ];
if ( !match->infoValid )
@@ -621,11 +621,11 @@ void CG_PrecacheClientInfo( int clientNum ) {
const char *v;
char *slash;
- ci = &cgs.corpseinfo[ clientNum - MAX_CLIENTS - 1 ];
+ ci = &cgs.corpseinfo[ clientNum ];
//CG_Printf( "%d %d\n", clientNum, (clientNum - MAX_CLIENTS ) );
- configstring = CG_ConfigString( clientNum + CS_PLAYERS );
+ configstring = CG_ConfigString( clientNum + CS_PRECACHES );
if ( !configstring[0] ) {
return; // player just left
}
@@ -1944,20 +1944,17 @@ void CG_Corpse( centity_t *cent )
refEntity_t legs;
refEntity_t torso;
refEntity_t head;
- int clientNum;
+ int corpseNum;
int renderfx;
qboolean shadow;
float shadowPlane;
vec3_t origin, liveZ, deadZ;
- //if this is the first time the function has been run set cent->corpseNum
- cent->corpseNum = CG_GetCorpseNum( cent->currentState.clientNum );
- if ( cent->corpseNum < 0 || cent->corpseNum >= MAX_CLIENTS )
- {
- CG_Error( "Bad corpseNum on corpse entity: %d", cent->corpseNum );
- }
+ corpseNum = CG_GetCorpseNum( cent->currentState.clientNum );
+ if ( corpseNum < 0 || corpseNum >= MAX_CLIENTS )
+ CG_Error( "Bad corpseNum on corpse entity: %d", corpseNum );
- ci = &cgs.corpseinfo[ cent->corpseNum ];
+ ci = &cgs.corpseinfo[ corpseNum ];
// it is possible to see corpses from disconnected players that may
// not have valid clientinfo