summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2001-06-30 20:06:28 +0000
committerTim Angus <tim@ngus.net>2001-06-30 20:06:28 +0000
commit34b359355ee3e5652b98dbf986276596fd687750 (patch)
tree266a78075160a4f48683794c128e8365f6fdf457 /src
parent0666485a027c9e6fa196882ef411542f554eb9f1 (diff)
Hopefully finally fixed precaching mechanism
Diffstat (limited to 'src')
-rw-r--r--src/cgame/cg_local.h2
-rw-r--r--src/cgame/cg_main.c38
-rw-r--r--src/cgame/cg_players.c19
-rw-r--r--src/game/bg_public.h4
-rw-r--r--src/game/g_main.c2
5 files changed, 28 insertions, 37 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
diff --git a/src/game/bg_public.h b/src/game/bg_public.h
index 883c2957..82c34be0 100644
--- a/src/game/bg_public.h
+++ b/src/game/bg_public.h
@@ -95,8 +95,8 @@
#define CS_MODELS 33
#define CS_SOUNDS (CS_MODELS+MAX_MODELS)
#define CS_PLAYERS (CS_SOUNDS+MAX_SOUNDS)
-#define MAX_PRECACHES 32
-#define CS_LOCATIONS (CS_PLAYERS+MAX_CLIENTS+MAX_PRECACHES)
+#define CS_PRECACHES (CS_PLAYERS+MAX_CLIENTS)
+#define CS_LOCATIONS (CS_PRECACHES+MAX_CLIENTS)
#define CS_MAX (CS_LOCATIONS+MAX_LOCATIONS)
diff --git a/src/game/g_main.c b/src/game/g_main.c
index f2dee3ca..74e2d575 100644
--- a/src/game/g_main.c
+++ b/src/game/g_main.c
@@ -308,7 +308,7 @@ void G_RegisterPlayerModels( void )
class = BG_FindModelNameForClass( i );
s = va("n\\%s%d\\t\\%i\\model\\%s\\hmodel\\%s\\g_redteam\\%s\\g_blueteam\\%s\\c1\\%s\\hc\\%i\\w\\%i\\l\\%i\\tt\\%d\\tl\\%d", "precache", i, 0, class, class, 0, 0, "7", 100, 0, 0, 0, 0);
- trap_SetConfigstring( CS_PLAYERS + MAX_CLIENTS + i, s );
+ trap_SetConfigstring( CS_PRECACHES + i, s );
}
}