From 48201dfcc3f2ea55996410b12818423dad0bfa25 Mon Sep 17 00:00:00 2001 From: mittorn Date: Mon, 30 Jul 2018 03:42:36 +0700 Subject: [PATCH] Observer seems to be complete broken, restore old mode --- dlls/client.cpp | 8 +++++--- dlls/coop.cpp | 8 ++++++-- dlls/multiplay_gamerules.cpp | 3 ++- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/dlls/client.cpp b/dlls/client.cpp index d5274a01..4b471c83 100644 --- a/dlls/client.cpp +++ b/dlls/client.cpp @@ -603,10 +603,10 @@ void ClientCommand( edict_t *pEntity ) else if( FStrEq( pcmd, "spectate" ) ) // clients wants to become a spectator { CBasePlayer *pPlayer = GetClassPtr( (CBasePlayer *)pev ); - if( !pPlayer->IsObserver() ) + /*if( !pPlayer->IsObserver() ) { // always allow proxies to become a spectator - if( ( pev->flags & FL_PROXY ) || allow_spectators.value ) + if( ( pev->flags & FL_PROXY ) || allow_spectators.value || mp_coop.value ) { edict_t *pentSpawnSpot = g_pGameRules->GetPlayerSpawnSpot( pPlayer ); pPlayer->StartObserver( pev->origin, VARS( pentSpawnSpot )->angles ); @@ -625,7 +625,9 @@ void ClientCommand( edict_t *pEntity ) // notify other clients of player left spectators UTIL_ClientPrintAll( HUD_PRINTNOTIFY, UTIL_VarArgs( "%s has left spectator mode\n", ( pev->netname && ( STRING( pev->netname ) )[0] != 0 ) ? STRING( pev->netname ) : "unconnected" ) ); - } + }*/ + pPlayer->RemoveAllItems(TRUE); + UTIL_BecomeSpectator(pPlayer); } else if( FStrEq( pcmd, "specmode" ) ) // new spectator mode { diff --git a/dlls/coop.cpp b/dlls/coop.cpp index fce63097..2dfe7a85 100644 --- a/dlls/coop.cpp +++ b/dlls/coop.cpp @@ -221,7 +221,7 @@ void UTIL_BecomeSpectator( CBasePlayer *pPlayer ) { //pPlayer->m_bDoneFirstSpawn = true; pPlayer->pev->takedamage = DAMAGE_NO; - pPlayer->pev->flags |= FL_SPECTATOR; + //pPlayer->pev->flags |= FL_SPECTATOR; pPlayer->pev->flags |= FL_NOTARGET; pPlayer->pev->effects |= EF_NODRAW; pPlayer->pev->solid = SOLID_NOT; @@ -229,11 +229,15 @@ void UTIL_BecomeSpectator( CBasePlayer *pPlayer ) pPlayer->pev->modelindex = 0; pPlayer->pev->health = 1; pPlayer->m_pGoalEnt = NULL; + //pPlayer->StopObserver(); + //while( !pPlayer->IsObserver() ) + //pPlayer->StartObserver(pPlayer->pev->origin, pPlayer->pev->angles); return; } void UTIL_SpawnPlayer( CBasePlayer *pPlayer ) { + //pPlayer->StopObserver(); pPlayer->gravgunmod_data.m_state = STATE_SPAWNED; pPlayer->m_iRespawnFrames = 0; pPlayer->pev->effects &= ~EF_NODRAW; @@ -242,7 +246,7 @@ void UTIL_SpawnPlayer( CBasePlayer *pPlayer ) pPlayer->pev->flags &= ~FL_SPECTATOR; pPlayer->pev->movetype = MOVETYPE_WALK; pPlayer->Spawn(); - + //pPlayer->StopObserver(); if( mp_coop.value ) CLIENT_COMMAND( pPlayer->edict(), "touch_show _coopm*\n" ); diff --git a/dlls/multiplay_gamerules.cpp b/dlls/multiplay_gamerules.cpp index c6172843..51a648d0 100644 --- a/dlls/multiplay_gamerules.cpp +++ b/dlls/multiplay_gamerules.cpp @@ -627,6 +627,7 @@ void CHalfLifeMultiplay::PlayerSpawn( CBasePlayer *pPlayer ) if( pPlayer->gravgunmod_data.m_state == STATE_UNINITIALIZED ) { ClientPutInServer( pPlayer->edict() ); + UTIL_BecomeSpectator( pPlayer ); return; } @@ -638,7 +639,7 @@ void CHalfLifeMultiplay::PlayerSpawn( CBasePlayer *pPlayer ) return; } - if( mp_coop_changelevel.value && pPlayer->gravgunmod_data.m_state == STATE_POINT_SELECT && !(pPlayer->pev->flags & FL_SPECTATOR) ) + if( mp_coop_changelevel.value && pPlayer->gravgunmod_data.m_state == STATE_POINT_SELECT && !pPlayer->IsObserver() ) { pPlayer->RemoveAllItems( TRUE ); UTIL_BecomeSpectator( pPlayer );