diff --git a/main/source/cl_dll/hud_spectator.cpp b/main/source/cl_dll/hud_spectator.cpp index 34dc515a..29d03eaa 100644 --- a/main/source/cl_dll/hud_spectator.cpp +++ b/main/source/cl_dll/hud_spectator.cpp @@ -12,6 +12,7 @@ #include "vgui_TeamFortressViewport.h" #include "vgui_SpectatorPanel.h" #include "common/hltv.h" +#include "AvHServerVariables.h" #include "ammohistory.h" #include "pm_shared/pm_shared.h" @@ -493,7 +494,7 @@ int CHudSpectator::Draw(float flTime) bool CHudSpectator::IsInOverviewMode() const { - return g_iUser1 && m_overviewMode && gHUD.GetIsNSMode(); + return g_iUser1 && m_overviewMode && gHUD.GetIsNSMode() /*&& g_iUser1 != OBS_ROAMING*/; } void CHudSpectator::SetOverviewMode(bool overviewMode) @@ -868,7 +869,7 @@ void CHudSpectator::HandleButtonsDown( int ButtonPressed ) AvHPlayMode CurrPlayMode = gHUD.GetPlayMode(); - float FreeSpecMode = gHUD.GetServerVariableFloat("mp_freespectatormode"); + float FreeSpecMode = gHUD.GetServerVariableFloat(kvFreeSpectatorMode); if (FreeSpecMode == 0 || (FreeSpecMode == 1 && gHUD.GetPlayMode() != PLAYMODE_OBSERVER)) { while (theNewMainMode == OBS_CHASE_FREE || theNewMainMode == OBS_ROAMING) @@ -1025,8 +1026,8 @@ void CHudSpectator::SetMode(int iNewMainMode) if (NewMode == OBS_CHASE_FREE || NewMode == OBS_ROAMING) { - float FreeSpecMode = gHUD.GetServerVariableFloat("mp_freespectatormode"); - if (FreeSpecMode == 0 || (FreeSpecMode == 1 && gHUD.GetPlayMode() != PLAYMODE_OBSERVER)) + float FreeSpecMode = gHUD.GetServerVariableFloat(kvFreeSpectatorMode); + if ((FreeSpecMode == 0 || (FreeSpecMode == 1.0f && gHUD.GetPlayMode() != PLAYMODE_OBSERVER)) && !gEngfuncs.IsSpectateOnly()) { if (g_iUser1 != OBS_CHASE_FREE && g_iUser1 != OBS_ROAMING) { @@ -1899,7 +1900,7 @@ void CHudSpectator::CheckSettings() gHUD.SetCurrentCrosshair( 0, m_crosshairRect, 0, 0, 0 ); gWR.SetWeaponConfig(nullptr, -1); - } + } // Removed by mmcguire. /* diff --git a/main/source/cl_dll/vgui_TeamFortressViewport.cpp b/main/source/cl_dll/vgui_TeamFortressViewport.cpp index 2d22c312..4b57a606 100644 --- a/main/source/cl_dll/vgui_TeamFortressViewport.cpp +++ b/main/source/cl_dll/vgui_TeamFortressViewport.cpp @@ -129,6 +129,8 @@ void IN_ResetMouse( void ); extern CMenuPanel *CMessageWindowPanel_Create( const char *szMOTD, const char *szTitle, int iShadeFullscreen, int iRemoveMe, int x, int y, int wide, int tall ); extern float * GetClientColor( int clientIndex ); +extern AvHPieMenuHandler gPieMenuHandler; + using namespace vgui; @@ -1604,6 +1606,8 @@ void TeamFortressViewport::UpdateSpectatorPanel() gHUD.m_TextMessage.MsgFunc_TextMsg( NULL, strlen( tempString ) + 1, tempString ); */ } + + gViewPort->UpdateCursorState(); sprintf(bottomText,"#Spec_Mode%d", g_iUser1 ); sprintf(helpString2,"#Spec_Mode%d", g_iUser1 ); @@ -2216,7 +2220,8 @@ void TeamFortressViewport::UpdateOnPlayerInfo() void TeamFortressViewport::UpdateCursorState() { - if (gHUD.GetInTopDownMode() || m_pSpectatorPanel->isVisible() || GetClientVoiceMgr()->IsInSquelchMode()) + if (gHUD.GetInTopDownMode() || GetClientVoiceMgr()->IsInSquelchMode() || /*gPieMenuHandler.GetIsPieMenuOpen() ||*/ + (m_pSpectatorPanel->isVisible() && (g_iUser1 == OBS_CHASE_LOCKED || g_iUser1 == OBS_IN_EYE))) { gHUD.GetManager().SetMouseVisibility(true); } diff --git a/main/source/dlls/observer.cpp b/main/source/dlls/observer.cpp index c659e4e9..e5066dc7 100644 --- a/main/source/dlls/observer.cpp +++ b/main/source/dlls/observer.cpp @@ -295,7 +295,7 @@ void CBasePlayer::Observer_SetMode( int iMode ) NewMode = OBS_IN_EYE; // now it is // if we are not roaming, we need a valid target to track - if ( (NewMode != OBS_ROAMING) && (m_hObserverTarget == NULL) ) + if (NewMode != OBS_ROAMING) { Observer_FindNextPlayer(); @@ -313,6 +313,11 @@ void CBasePlayer::Observer_SetMode( int iMode ) if (NewMode == OBS_ROAMING) { pev->iuser2 = 0; + + if (!theIsObserving) + { + pev->health = 0; // Set dead status and block free look movement in pmove. + } } else { diff --git a/main/source/dlls/player.cpp b/main/source/dlls/player.cpp index dfe32500..c9442cae 100644 --- a/main/source/dlls/player.cpp +++ b/main/source/dlls/player.cpp @@ -1693,6 +1693,11 @@ void CBasePlayer::StartObserver( Vector vecPosition, Vector vecViewAngle ) // pev->flags = FL_CLIENT | FL_SPECTATOR; // Should we set Spectator flag? Or is it reserver for people connecting with spectator 1? pev->deadflag = DEAD_RESPAWNABLE; + if (this->pev->playerclass != PLAYMODE_OBSERVER) + { + pev->health = 0; // Set dead status and block free look movement in pmove. + } + // Tell the physics code that this player's now in observer mode Observer_SetMode(OBS_IN_EYE); Observer_SpectatePlayer(this->GetDefaultSpectatingTarget()); diff --git a/main/source/mod/AvHHud.cpp b/main/source/mod/AvHHud.cpp index 0d2bf110..4ff28b64 100644 --- a/main/source/mod/AvHHud.cpp +++ b/main/source/mod/AvHHud.cpp @@ -5561,7 +5561,7 @@ void AvHHud::UpdatePieMenuControl() } // If we're dead, make sure the popup menu is closed - if(!this->GetIsAlive(false)) + if(!this->GetIsAlive(false) && gPieMenuHandler.GetIsPieMenuOpen()) { gPieMenuHandler.ClosePieMenu(); }