mirror of
https://github.com/ENSL/NS.git
synced 2024-11-22 04:31:12 +00:00
Additional spectator fixes
- fixed issues with piemenu cursor code being enabled when spectating - the cursor is now enabled when in an observer mode that locks the view. - fixed bugs/exploits where dead players could first person spectate the enemy team or travel around in freelook if all spectatable players on the team are dead.
This commit is contained in:
parent
e24041c64a
commit
b5177e8e47
5 changed files with 24 additions and 8 deletions
|
@ -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.
|
||||
/*
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue