mirror of
https://github.com/ENSL/NS.git
synced 2024-11-10 15:21:54 +00:00
Mantis 0001012:
o Duck toggle implemented - bind toggleduck to a key to use - while duck is toggled, pressing +duck will unduck and releasing will revert the player to a ducked state git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@49 67975925-1194-0748-b3d5-c16f83f1a3a1
This commit is contained in:
parent
f3a6a36a35
commit
ec5bbe6b90
3 changed files with 40 additions and 2 deletions
|
@ -34,6 +34,10 @@
|
|||
#include "mod/AvHNetworkMessages.h"
|
||||
#include "ui/ChatPanel.h"
|
||||
|
||||
// tankefugl: duck toggle
|
||||
bool g_bDuckToggled;
|
||||
// :tankefugl
|
||||
|
||||
class CHLVoiceStatusHelper : public IVoiceStatusHelper
|
||||
{
|
||||
public:
|
||||
|
@ -192,6 +196,10 @@ void CHud :: Init( void )
|
|||
m_iLogo = 0;
|
||||
m_iFOV = 0;
|
||||
|
||||
// tankefugl: duck toggle
|
||||
g_bDuckToggled = false;
|
||||
// :tankefugl
|
||||
|
||||
CVAR_CREATE( "zoom_sensitivity_ratio", "1.2", 0 );
|
||||
default_fov = CVAR_CREATE( "default_fov", "90", 0 );
|
||||
m_pCvarStealMouse = CVAR_CREATE( "hud_capturemouse", "1", FCVAR_ARCHIVE );
|
||||
|
|
|
@ -21,6 +21,10 @@
|
|||
#include "common/r_efx.h"
|
||||
#include "mod/AvHNetworkMessages.h"
|
||||
|
||||
// tankefugl: duck toggle
|
||||
extern bool g_bDuckToggled;
|
||||
// :tankefugl
|
||||
|
||||
#define MAX_CLIENTS 32
|
||||
|
||||
#if !defined( _TFC )
|
||||
|
@ -46,6 +50,10 @@ int CHud :: MsgFunc_ResetHUD(const char *pszName, int iSize, void *pbuf )
|
|||
// reset sensitivity
|
||||
m_flMouseSensitivity = 0;
|
||||
|
||||
// tankefugl: duck toggle
|
||||
g_bDuckToggled = false;
|
||||
// :tankefugl
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -61,6 +61,10 @@ extern "C"
|
|||
#include "engine/APIProxy.h"
|
||||
#include "Exports.h"
|
||||
|
||||
// tankefugl: duck toggle
|
||||
extern bool g_bDuckToggled;
|
||||
// :tankefugl
|
||||
|
||||
extern int g_iAlive;
|
||||
|
||||
extern int g_weaponselect;
|
||||
|
@ -790,6 +794,12 @@ void IN_DuckDown(void)
|
|||
}
|
||||
|
||||
void IN_DuckUp(void) {KeyUp(&in_duck);}
|
||||
// tankefugl: duck toggle
|
||||
void IN_DuckToggle(void)
|
||||
{
|
||||
g_bDuckToggled = !g_bDuckToggled;
|
||||
}
|
||||
// :tankefugl
|
||||
void IN_ReloadDown(void) {KeyDown(&in_reload);}
|
||||
void IN_ReloadUp(void) {KeyUp(&in_reload);}
|
||||
void IN_Alt1Down(void) {KeyDown(&in_alt1);}
|
||||
|
@ -1318,11 +1328,20 @@ int CL_ButtonBits( int bResetState )
|
|||
bits |= IN_ATTACK;
|
||||
}
|
||||
|
||||
if (in_duck.state & 3)
|
||||
// tankefugl: duck toggle
|
||||
if ( g_bDuckToggled )
|
||||
{
|
||||
if (!(in_duck.state & 3))
|
||||
{
|
||||
bits |= IN_DUCK;
|
||||
}
|
||||
}
|
||||
else if (in_duck.state & 3)
|
||||
{
|
||||
bits |= IN_DUCK;
|
||||
}
|
||||
|
||||
// :tankefugl
|
||||
|
||||
if (in_jump.state & 3)
|
||||
{
|
||||
bits |= IN_JUMP;
|
||||
|
@ -1489,6 +1508,9 @@ void InitInput (void)
|
|||
gEngfuncs.pfnAddCommand ("-jlook", IN_JLookUp);
|
||||
gEngfuncs.pfnAddCommand ("+duck", IN_DuckDown);
|
||||
gEngfuncs.pfnAddCommand ("-duck", IN_DuckUp);
|
||||
// tankefugl: duck toggle
|
||||
gEngfuncs.pfnAddCommand ("toggleduck", IN_DuckToggle);
|
||||
// :tankefugl
|
||||
gEngfuncs.pfnAddCommand ("+reload", IN_ReloadDown);
|
||||
gEngfuncs.pfnAddCommand ("-reload", IN_ReloadUp);
|
||||
gEngfuncs.pfnAddCommand ("+alt1", IN_Alt1Down);
|
||||
|
|
Loading…
Reference in a new issue