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
if( mp_coop.value && pEntity ) if( mp_coop.value && pEntity )
{ {
CBasePlayer *pl = (CBasePlayer *)CBaseEntity::Instance( 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->m_ggm.iState = STATE_UNINITIALIZED;
pl->RemoveAllItems( TRUE ); pl->RemoveAllItems( TRUE );
@ -703,6 +703,8 @@ void ClientUserInfoChanged( edict_t *pEntity, char *infobuffer )
{ {
GGM_SaveState( pPlayer ); GGM_SaveState( pPlayer );
pEntity->v.netname = pEntity->v.frags = 0; pEntity->v.netname = pEntity->v.frags = 0;
if( pPlayer->m_ggm.iState == STATE_LOAD_FIX )
return;
pPlayer->m_ggm.pState = pState; pPlayer->m_ggm.pState = pState;
pPlayer->m_ggm.iState = STATE_UNINITIALIZED; pPlayer->m_ggm.iState = STATE_UNINITIALIZED;
} }

32
dlls/coop.cpp

@ -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 ) void COOP_ServerActivate( void )
{ {
static float st_DupCheck; static float st_DupCheck;
if( g_CoopState.landmarkTransition.fLoading )
{ if( !mp_coop.value )
st_DupCheck = gpGlobals->time; return;
}
if( st_DupCheck && gpGlobals->time && st_DupCheck == gpGlobals->time) if( st_DupCheck && gpGlobals->time && st_DupCheck == gpGlobals->time)
{ {
@ -499,8 +507,10 @@ void COOP_ServerActivate( void )
return; return;
} }
if( !mp_coop.value ) if( g_CoopState.landmarkTransition.fLoading )
return; {
st_DupCheck = gpGlobals->time;
}
GGM_ConnectSaveBot(); GGM_ConnectSaveBot();
@ -530,13 +540,21 @@ void COOP_ServerActivate( void )
for( int i = 1; i <= gpGlobals->maxClients; i++ ) for( int i = 1; i <= gpGlobals->maxClients; i++ )
{ {
CBasePlayer *plr = (CBasePlayer*)UTIL_PlayerByIndex( i ); CBasePlayer *plr = (CBasePlayer*)UTIL_PlayerByIndex( i );
// reset all players state // reset all players state
if( plr ) if( plr )
{ {
plr->m_ggm.iState = STATE_UNINITIALIZED; plr->m_ggm.iState = STATE_UNINITIALIZED;
plr->RemoveAllItems( TRUE ); plr->RemoveAllItems( TRUE );
UTIL_BecomeSpectator( plr ); 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(); //plr->Spawn();
} }
} }

1
dlls/coop_util.h

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

8
dlls/gravgunmod.cpp

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

3
dlls/gravgunmod.h

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

9
dlls/multiplay_gamerules.cpp

@ -563,6 +563,15 @@ BOOL CHalfLifeMultiplay::FPlayerCanTakeDamage( CBasePlayer *pPlayer, CBaseEntity
//========================================================= //=========================================================
void CHalfLifeMultiplay::PlayerThink( CBasePlayer *pPlayer ) 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( !mp_coop.value && pPlayer->m_ggm.iState == STATE_SPECTATOR_BEGIN )
if( pPlayer->m_afButtonPressed & ( IN_DUCK | IN_ATTACK | IN_ATTACK2 | IN_USE | IN_JUMP ) ) if( pPlayer->m_afButtonPressed & ( IN_DUCK | IN_ATTACK | IN_ATTACK2 | IN_USE | IN_JUMP ) )
UTIL_SpawnPlayer( pPlayer ); UTIL_SpawnPlayer( pPlayer );

Loading…
Cancel
Save