Browse Source

Workaround loading bugs

gravgun
mittorn 6 years ago
parent
commit
5d386cf809
  1. 4
      dlls/client.cpp
  2. 32
      dlls/coop.cpp
  3. 1
      dlls/coop_util.h
  4. 8
      dlls/gravgunmod.cpp
  5. 3
      dlls/gravgunmod.h
  6. 9
      dlls/multiplay_gamerules.cpp

4
dlls/client.cpp

@ -88,7 +88,7 @@ BOOL ClientConnect( edict_t *pEntity, const char *pszName, const char *pszAddres @@ -88,7 +88,7 @@ BOOL ClientConnect( edict_t *pEntity, const char *pszName, const char *pszAddres
if( mp_coop.value && pEntity )
{
CBasePlayer *pl = (CBasePlayer *)CBaseEntity::Instance( pEntity ) ;
if( pl )
if( pl && pl->m_ggm.iState != STATE_LOAD_FIX )
{
pl->m_ggm.iState = STATE_UNINITIALIZED;
pl->RemoveAllItems( TRUE );
@ -703,6 +703,8 @@ void ClientUserInfoChanged( edict_t *pEntity, char *infobuffer ) @@ -703,6 +703,8 @@ void ClientUserInfoChanged( edict_t *pEntity, char *infobuffer )
{
GGM_SaveState( pPlayer );
pEntity->v.netname = pEntity->v.frags = 0;
if( pPlayer->m_ggm.iState == STATE_LOAD_FIX )
return;
pPlayer->m_ggm.pState = pState;
pPlayer->m_ggm.iState = STATE_UNINITIALIZED;
}

32
dlls/coop.cpp

@ -485,13 +485,21 @@ void COOP_SetupLandmarkTransition( const char *szNextMap, const char *szNextSpot @@ -485,13 +485,21 @@ void COOP_SetupLandmarkTransition( const char *szNextMap, const char *szNextSpot
}
}
bool COOP_PlayerSpawn( CBasePlayer *pPlayer )
{
if( g_CoopState.landmarkTransition.fLoading && pPlayer )
pPlayer->m_ggm.iState = STATE_LOAD_FIX;
if( pPlayer->m_ggm.iState == STATE_LOAD_FIX )
return true;
return false;
}
void COOP_ServerActivate( void )
{
static float st_DupCheck;
if( g_CoopState.landmarkTransition.fLoading )
{
st_DupCheck = gpGlobals->time;
}
if( !mp_coop.value )
return;
if( st_DupCheck && gpGlobals->time && st_DupCheck == gpGlobals->time)
{
@ -499,8 +507,10 @@ void COOP_ServerActivate( void ) @@ -499,8 +507,10 @@ void COOP_ServerActivate( void )
return;
}
if( !mp_coop.value )
return;
if( g_CoopState.landmarkTransition.fLoading )
{
st_DupCheck = gpGlobals->time;
}
GGM_ConnectSaveBot();
@ -530,13 +540,21 @@ void COOP_ServerActivate( void ) @@ -530,13 +540,21 @@ void COOP_ServerActivate( void )
for( int i = 1; i <= gpGlobals->maxClients; i++ )
{
CBasePlayer *plr = (CBasePlayer*)UTIL_PlayerByIndex( i );
// reset all players state
if( plr )
{
plr->m_ggm.iState = STATE_UNINITIALIZED;
plr->RemoveAllItems( TRUE );
UTIL_BecomeSpectator( plr );
if( g_CoopState.landmarkTransition.fLoading )
{
// plr->Spawn();
// CLIENT_COMMAND( plr->edict(), "reconnect\n");
plr->m_ggm.iState = STATE_LOAD_FIX;
}
//plr->Spawn();
}
}

1
dlls/coop_util.h

@ -56,6 +56,7 @@ void COOP_AddDefaultWeapon( const char *pszClassName ); @@ -56,6 +56,7 @@ void COOP_AddDefaultWeapon( const char *pszClassName );
void COOP_WriteState( const char *path );
bool COOP_ReadState( const char *path );
void COOP_AutoSave( void );
bool COOP_PlayerSpawn( CBasePlayer *pPlayer );
struct COOPChangelevelData *COOP_GetTriggerData( CBaseEntity *pTrigger );
#endif // COOP_UTIL_H

8
dlls/gravgunmod.cpp

@ -636,6 +636,8 @@ const char *GGM_GetAuthID( CBasePlayer *pPlayer ) @@ -636,6 +636,8 @@ const char *GGM_GetAuthID( CBasePlayer *pPlayer )
void GGM_ClientPutinServer( edict_t *pEntity, CBasePlayer *pPlayer )
{
if( pPlayer->m_ggm.iState == STATE_LOAD_FIX )
return;
if( mp_touchmenu.value && pPlayer->m_ggm.iState == STATE_UNINITIALIZED )
g_engfuncs.pfnQueryClientCvarValue2( pEntity, "touch_enable", 111 );
@ -1371,6 +1373,12 @@ void ClientPutInServer( edict_t *client ); @@ -1371,6 +1373,12 @@ void ClientPutInServer( edict_t *client );
bool GGM_PlayerSpawn( CBasePlayer *pPlayer )
{
if( mp_coop.value )
if( COOP_PlayerSpawn( pPlayer ) )
return true;
if( pPlayer->m_ggm.iState == STATE_LOAD_FIX )
return true;
if( pPlayer->m_ggm.iState == STATE_UNINITIALIZED )
{
ClientPutInServer( pPlayer->edict() );

3
dlls/gravgunmod.h

@ -71,7 +71,8 @@ enum PlayerState @@ -71,7 +71,8 @@ enum PlayerState
STATE_SPECTATOR_BEGIN,
STATE_SPAWNED,
STATE_SPECTATOR,
STATE_POINT_SELECT
STATE_POINT_SELECT,
STATE_LOAD_FIX
};
enum PlayerMenuState

9
dlls/multiplay_gamerules.cpp

@ -563,6 +563,15 @@ BOOL CHalfLifeMultiplay::FPlayerCanTakeDamage( CBasePlayer *pPlayer, CBaseEntity @@ -563,6 +563,15 @@ BOOL CHalfLifeMultiplay::FPlayerCanTakeDamage( CBasePlayer *pPlayer, CBaseEntity
//=========================================================
void CHalfLifeMultiplay::PlayerThink( CBasePlayer *pPlayer )
{
if( pPlayer->m_ggm.iState == STATE_LOAD_FIX )
if( pPlayer->m_afButtonPressed & ( IN_DUCK | IN_ATTACK | IN_ATTACK2 | IN_USE | IN_JUMP ) )
{
CLIENT_COMMAND( pPlayer->edict(), "reconnect\n" );
pPlayer->m_ggm.iState = STATE_UNINITIALIZED;
pPlayer->m_afButtonPressed = 0;
return;
}
if( !mp_coop.value && pPlayer->m_ggm.iState == STATE_SPECTATOR_BEGIN )
if( pPlayer->m_afButtonPressed & ( IN_DUCK | IN_ATTACK | IN_ATTACK2 | IN_USE | IN_JUMP ) )
UTIL_SpawnPlayer( pPlayer );

Loading…
Cancel
Save