mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-11 15:47:55 +00:00
engine: client: make it more obvious that CL_InitEdicts depends on maxclients value
This commit is contained in:
parent
00765f1ff2
commit
ca134a85ee
@ -648,11 +648,13 @@ void CL_DemoStartPlayback( int mode )
|
||||
{
|
||||
if( cls.changedemo )
|
||||
{
|
||||
int maxclients = cl.maxclients;
|
||||
|
||||
S_StopAllSounds( true );
|
||||
SCR_BeginLoadingPlaque( false );
|
||||
|
||||
CL_ClearState ();
|
||||
CL_InitEdicts (); // re-arrange edicts
|
||||
CL_ClearState( );
|
||||
CL_InitEdicts( maxclients ); // re-arrange edicts
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1088,13 +1088,13 @@ void CL_ClearWorld( void )
|
||||
clgame.numStatics = 0;
|
||||
}
|
||||
|
||||
void CL_InitEdicts( void )
|
||||
void CL_InitEdicts( int maxclients )
|
||||
{
|
||||
Assert( clgame.entities == NULL );
|
||||
|
||||
if( !clgame.mempool ) return; // Host_Error without client
|
||||
#if XASH_LOW_MEMORY != 2
|
||||
CL_UPDATE_BACKUP = ( cl.maxclients <= 1 ) ? SINGLEPLAYER_BACKUP : MULTIPLAYER_BACKUP;
|
||||
CL_UPDATE_BACKUP = ( maxclients <= 1 ) ? SINGLEPLAYER_BACKUP : MULTIPLAYER_BACKUP;
|
||||
#endif
|
||||
cls.num_client_entities = CL_UPDATE_BACKUP * NUM_PACKET_ENTITIES;
|
||||
cls.packet_entities = Mem_Realloc( clgame.mempool, cls.packet_entities, sizeof( entity_state_t ) * cls.num_client_entities );
|
||||
@ -1140,7 +1140,7 @@ void CL_ClearEdicts( void )
|
||||
|
||||
// in case we stopped with error
|
||||
clgame.maxEntities = 2;
|
||||
CL_InitEdicts();
|
||||
CL_InitEdicts( cl.maxclients );
|
||||
}
|
||||
|
||||
/*
|
||||
@ -4054,7 +4054,7 @@ qboolean CL_LoadProgs( const char *name )
|
||||
if( !Mobile_Init() ) // Xash3D FWGS extension: mobile interface
|
||||
Con_Reportf( S_WARN "CL_LoadProgs: couldn't get mobility API\n" );
|
||||
|
||||
CL_InitEdicts (); // initailize local player and world
|
||||
CL_InitEdicts( cl.maxclients ); // initailize local player and world
|
||||
CL_InitClientMove(); // initialize pm_shared
|
||||
|
||||
// initialize game
|
||||
|
@ -966,7 +966,7 @@ void CL_ParseServerData( sizebuf_t *msg, qboolean legacy )
|
||||
Q_strncpy( gameui.globals->maptitle, clgame.maptitle, sizeof( gameui.globals->maptitle ));
|
||||
|
||||
if( !cls.changelevel && !cls.changedemo )
|
||||
CL_InitEdicts (); // re-arrange edicts
|
||||
CL_InitEdicts( cl.maxclients ); // re-arrange edicts
|
||||
|
||||
// get splash name
|
||||
if( cls.demoplayback && ( cls.demonum != -1 ))
|
||||
@ -2260,6 +2260,8 @@ void CL_ParseServerMessage( sizebuf_t *msg, qboolean normal_message )
|
||||
old_background = cl.background;
|
||||
if( MSG_ReadOneBit( msg ))
|
||||
{
|
||||
int maxclients = cl.maxclients;
|
||||
|
||||
cls.changelevel = true;
|
||||
S_StopAllSounds( true );
|
||||
|
||||
@ -2271,8 +2273,8 @@ void CL_ParseServerMessage( sizebuf_t *msg, qboolean normal_message )
|
||||
cls.changedemo = true;
|
||||
}
|
||||
|
||||
CL_ClearState ();
|
||||
CL_InitEdicts (); // re-arrange edicts
|
||||
CL_ClearState();
|
||||
CL_InitEdicts( maxclients ); // re-arrange edicts
|
||||
}
|
||||
else Con_Printf( "Server disconnected, reconnecting\n" );
|
||||
|
||||
|
@ -373,7 +373,7 @@ void CL_ParseLegacyServerMessage( sizebuf_t *msg, qboolean normal_message )
|
||||
old_background = cl.background;
|
||||
if( MSG_ReadOneBit( msg ))
|
||||
{
|
||||
int old_maxplayers = cl.maxclients;
|
||||
int maxclients = cl.maxclients;
|
||||
|
||||
cls.changelevel = true;
|
||||
S_StopAllSounds( true );
|
||||
@ -386,15 +386,14 @@ void CL_ParseLegacyServerMessage( sizebuf_t *msg, qboolean normal_message )
|
||||
cls.changedemo = true;
|
||||
}
|
||||
|
||||
CL_ClearState ();
|
||||
CL_ClearState( );
|
||||
|
||||
// a1ba: need to restore cl.maxclients because engine chooses
|
||||
// frame backups count depending on this value
|
||||
// In general, it's incorrect to call CL_InitEdicts right after
|
||||
// CL_ClearState because of this bug. Some time later this logic
|
||||
// should be re-done.
|
||||
cl.maxclients = old_maxplayers;
|
||||
CL_InitEdicts (); // re-arrange edicts
|
||||
CL_InitEdicts( maxclients ); // re-arrange edicts
|
||||
}
|
||||
else Con_Printf( "Server disconnected, reconnecting\n" );
|
||||
|
||||
|
@ -258,7 +258,7 @@ static void CL_ParseQuakeServerInfo( sizebuf_t *msg )
|
||||
Q_strncpy( gameui.globals->maptitle, clgame.maptitle, sizeof( gameui.globals->maptitle ));
|
||||
|
||||
if( !cls.changelevel && !cls.changedemo )
|
||||
CL_InitEdicts (); // re-arrange edicts
|
||||
CL_InitEdicts( cl.maxclients ); // re-arrange edicts
|
||||
|
||||
// Quake just have a large packet of initialization data
|
||||
for( i = 1; i < MAX_MODELS; i++ )
|
||||
|
@ -830,7 +830,7 @@ void CL_LinkUserMessage( char *pszName, const int svc_num, int iSize );
|
||||
void CL_ParseFinaleCutscene( sizebuf_t *msg, int level );
|
||||
void CL_ParseTextMessage( sizebuf_t *msg );
|
||||
void CL_DrawHUD( int state );
|
||||
void CL_InitEdicts( void );
|
||||
void CL_InitEdicts( int maxclients );
|
||||
void CL_FreeEdicts( void );
|
||||
void CL_ClearWorld( void );
|
||||
void CL_DrawCenterPrint( void );
|
||||
|
Loading…
Reference in New Issue
Block a user