mirror of
https://github.com/FWGS/hlsdk-xash3d
synced 2024-11-21 17:36:18 +01:00
Fix instant camera movement after closing the VGUI menu (#455)
This commit is contained in:
parent
bc9019953d
commit
d774c9e0f9
@ -811,6 +811,11 @@ void GoldSourceInput::IN_GetMouseDelta( int *pOutX, int *pOutY)
|
||||
mx = my = 0;
|
||||
}
|
||||
|
||||
if (ignoreNextDelta)
|
||||
{
|
||||
ignoreNextDelta = false;
|
||||
mx = my = 0;
|
||||
}
|
||||
if(pOutX) *pOutX = mx;
|
||||
if(pOutY) *pOutY = my;
|
||||
}
|
||||
@ -1585,6 +1590,7 @@ IN_Init
|
||||
*/
|
||||
void GoldSourceInput::IN_Init (void)
|
||||
{
|
||||
ignoreNextDelta = false;
|
||||
m_filter = gEngfuncs.pfnRegisterVariable ( "m_filter","0", FCVAR_ARCHIVE );
|
||||
sensitivity = gEngfuncs.pfnRegisterVariable ( "sensitivity","3", FCVAR_ARCHIVE ); // user mouse sensitivity setting.
|
||||
|
||||
@ -1685,4 +1691,9 @@ void GoldSourceInput::IN_Init (void)
|
||||
IN_StartupJoystick ();
|
||||
}
|
||||
|
||||
void GoldSourceInput::IgnoreNextMouseDelta()
|
||||
{
|
||||
ignoreNextDelta = true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -87,7 +87,12 @@ void IN_ResetMouse()
|
||||
currentInput->IN_ResetMouse();
|
||||
}
|
||||
|
||||
void IgnoreNextMouseDelta()
|
||||
{
|
||||
currentInput->IgnoreNextMouseDelta();
|
||||
}
|
||||
|
||||
AbstractInput* CurrentMouseInput()
|
||||
{
|
||||
return currentInput;
|
||||
return currentInput;
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ public:
|
||||
virtual void IN_Init( void ) = 0;
|
||||
virtual void IN_ResetMouse( void ) = 0;
|
||||
virtual void Joy_AdvancedUpdate( void ) = 0;
|
||||
virtual void IgnoreNextMouseDelta() = 0;
|
||||
};
|
||||
|
||||
class FWGSInput : public AbstractInput
|
||||
@ -39,6 +40,7 @@ public:
|
||||
virtual void IN_Init( void );
|
||||
virtual void IN_ResetMouse( void ) {}
|
||||
virtual void Joy_AdvancedUpdate( void ) {}
|
||||
virtual void IgnoreNextMouseDelta() {}
|
||||
|
||||
protected:
|
||||
float ac_forwardmove;
|
||||
@ -82,6 +84,7 @@ public:
|
||||
virtual void IN_Init( void );
|
||||
virtual void IN_ResetMouse( void );
|
||||
virtual void Joy_AdvancedUpdate( void );
|
||||
virtual void IgnoreNextMouseDelta();
|
||||
|
||||
protected:
|
||||
void IN_GetMouseDelta( int *pOutX, int *pOutY);
|
||||
@ -98,6 +101,7 @@ protected:
|
||||
int old_mouse_x, old_mouse_y, mx_accum, my_accum;
|
||||
int mouseinitialized;
|
||||
void* sdl2Lib;
|
||||
bool ignoreNextDelta;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -58,6 +58,8 @@
|
||||
#include "screenfade.h"
|
||||
|
||||
void IN_SetVisibleMouse(bool visible);
|
||||
void IgnoreNextMouseDelta();
|
||||
|
||||
class CCommandMenu;
|
||||
|
||||
// Scoreboard positions
|
||||
@ -1672,6 +1674,7 @@ void TeamFortressViewport::UpdateCursorState()
|
||||
if( m_pSpectatorPanel->m_menuVisible || m_pCurrentMenu || m_pTeamMenu->isVisible() || GetClientVoiceMgr()->IsInSquelchMode() )
|
||||
{
|
||||
IN_SetVisibleMouse(true);
|
||||
IgnoreNextMouseDelta();
|
||||
App::getInstance()->setCursorOveride( App::getInstance()->getScheme()->getCursor(Scheme::scu_arrow) );
|
||||
return;
|
||||
}
|
||||
@ -1681,6 +1684,7 @@ void TeamFortressViewport::UpdateCursorState()
|
||||
if( gHUD.m_pCvarStealMouse->value != 0.0f )
|
||||
{
|
||||
IN_SetVisibleMouse(true);
|
||||
IgnoreNextMouseDelta();
|
||||
App::getInstance()->setCursorOveride( App::getInstance()->getScheme()->getCursor(Scheme::scu_arrow) );
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user