mirror of
https://github.com/dhewm/dhewm3.git
synced 2024-11-26 22:31:17 +00:00
New input CVars: in_allowAlwaysRunInSP, m_invertLook
in_allowAlwaysRunInSP allows using in_alwaysRun and in_toggleRun in Single Player (it'll still drain your stamina!) m_invertLook allows inverting mouse look, both for up/down and left/right, if you're into that kind of thing
This commit is contained in:
parent
bd22f55f56
commit
50d7129b1c
1 changed files with 25 additions and 8 deletions
|
@ -363,6 +363,14 @@ private:
|
|||
|
||||
void Key( int keyNum, bool down );
|
||||
|
||||
// DG: if in_allowAlwaysRunInSP is set, you can use always run or toggle run even in SP.
|
||||
// Why not, we're all adults here, if you run out of stamina it's your problem
|
||||
// (though I'll probably add another CVar to disable stamina in SP)
|
||||
inline bool AlwaysRunAllowed() const
|
||||
{
|
||||
return in_allowAlwaysRunInSP.GetBool() || idAsyncNetwork::IsActive();
|
||||
}
|
||||
|
||||
idVec3 viewangles;
|
||||
int flags;
|
||||
int impulse;
|
||||
|
@ -400,6 +408,7 @@ private:
|
|||
static idCVar in_pitchSpeed;
|
||||
static idCVar in_angleSpeedKey;
|
||||
static idCVar in_freeLook;
|
||||
static idCVar in_allowAlwaysRunInSP; // DG: I don't care, I'm not a cop
|
||||
static idCVar in_alwaysRun;
|
||||
static idCVar in_toggleRun;
|
||||
static idCVar in_toggleCrouch;
|
||||
|
@ -411,14 +420,16 @@ private:
|
|||
static idCVar m_smooth;
|
||||
static idCVar m_strafeSmooth;
|
||||
static idCVar m_showMouseRate;
|
||||
static idCVar m_invertLook; // DG: added this
|
||||
};
|
||||
|
||||
idCVar idUsercmdGenLocal::in_yawSpeed( "in_yawspeed", "140", CVAR_SYSTEM | CVAR_ARCHIVE | CVAR_FLOAT, "yaw change speed when holding down _left or _right button" );
|
||||
idCVar idUsercmdGenLocal::in_pitchSpeed( "in_pitchspeed", "140", CVAR_SYSTEM | CVAR_ARCHIVE | CVAR_FLOAT, "pitch change speed when holding down look _lookUp or _lookDown button" );
|
||||
idCVar idUsercmdGenLocal::in_angleSpeedKey( "in_anglespeedkey", "1.5", CVAR_SYSTEM | CVAR_ARCHIVE | CVAR_FLOAT, "angle change scale when holding down _speed button" );
|
||||
idCVar idUsercmdGenLocal::in_freeLook( "in_freeLook", "1", CVAR_SYSTEM | CVAR_ARCHIVE | CVAR_BOOL, "look around with mouse (reverse _mlook button)" );
|
||||
idCVar idUsercmdGenLocal::in_alwaysRun( "in_alwaysRun", "0", CVAR_SYSTEM | CVAR_ARCHIVE | CVAR_BOOL, "always run (reverse _speed button) - only in MP" );
|
||||
idCVar idUsercmdGenLocal::in_toggleRun( "in_toggleRun", "0", CVAR_SYSTEM | CVAR_ARCHIVE | CVAR_BOOL, "pressing _speed button toggles run on/off - only in MP" );
|
||||
idCVar idUsercmdGenLocal::in_allowAlwaysRunInSP ( "in_allowAlwaysRunInSP", "0", CVAR_SYSTEM | CVAR_ARCHIVE | CVAR_BOOL, "Allow always run and toggle run in Single Player as well - keep in mind you may run out of stamina!" );
|
||||
idCVar idUsercmdGenLocal::in_alwaysRun( "in_alwaysRun", "0", CVAR_SYSTEM | CVAR_ARCHIVE | CVAR_BOOL, "always run (reverse _speed button) - only in MP, unless in_allowAlwaysRunInSP is set" );
|
||||
idCVar idUsercmdGenLocal::in_toggleRun( "in_toggleRun", "0", CVAR_SYSTEM | CVAR_ARCHIVE | CVAR_BOOL, "pressing _speed button toggles run on/off - only in MP, unless in_allowAlwaysRunInSP is set" );
|
||||
idCVar idUsercmdGenLocal::in_toggleCrouch( "in_toggleCrouch", "0", CVAR_SYSTEM | CVAR_ARCHIVE | CVAR_BOOL, "pressing _movedown button toggles player crouching/standing" );
|
||||
idCVar idUsercmdGenLocal::in_toggleZoom( "in_toggleZoom", "0", CVAR_SYSTEM | CVAR_ARCHIVE | CVAR_BOOL, "pressing _zoom button toggles zoom on/off" );
|
||||
idCVar idUsercmdGenLocal::sensitivity( "sensitivity", "5", CVAR_SYSTEM | CVAR_ARCHIVE | CVAR_FLOAT, "mouse view sensitivity" );
|
||||
|
@ -428,6 +439,7 @@ idCVar idUsercmdGenLocal::m_strafeScale( "m_strafeScale", "6.25", CVAR_SYSTEM |
|
|||
idCVar idUsercmdGenLocal::m_smooth( "m_smooth", "1", CVAR_SYSTEM | CVAR_ARCHIVE | CVAR_INTEGER, "number of samples blended for mouse viewing", 1, 8, idCmdSystem::ArgCompletion_Integer<1,8> );
|
||||
idCVar idUsercmdGenLocal::m_strafeSmooth( "m_strafeSmooth", "4", CVAR_SYSTEM | CVAR_ARCHIVE | CVAR_INTEGER, "number of samples blended for mouse moving", 1, 8, idCmdSystem::ArgCompletion_Integer<1,8> );
|
||||
idCVar idUsercmdGenLocal::m_showMouseRate( "m_showMouseRate", "0", CVAR_SYSTEM | CVAR_BOOL, "shows mouse movement" );
|
||||
idCVar idUsercmdGenLocal::m_invertLook( "m_invertLook", "0", CVAR_SYSTEM | CVAR_ARCHIVE | CVAR_INTEGER, "invert mouse look 0: don't invert, 1: invert up/down (flight controls), 2: invert left/right, 3: invert both", 0, 3, idCmdSystem::ArgCompletion_Integer<0,3> );
|
||||
|
||||
idCVar joy_triggerThreshold( "joy_triggerThreshold", "0.05", CVAR_FLOAT | CVAR_ARCHIVE, "how far the joystick triggers have to be pressed before they register as down" );
|
||||
idCVar joy_deadZone( "joy_deadZone", "0.25", CVAR_FLOAT | CVAR_ARCHIVE, "specifies how large the dead-zone is on the joystick" );
|
||||
|
@ -559,7 +571,7 @@ Moves the local angle positions
|
|||
void idUsercmdGenLocal::AdjustAngles( void ) {
|
||||
float speed;
|
||||
|
||||
if ( toggled_run.on ^ ( in_alwaysRun.GetBool() && idAsyncNetwork::IsActive() ) ) {
|
||||
if ( toggled_run.on ^ ( in_alwaysRun.GetBool() && AlwaysRunAllowed() ) ) { // DG: always run in SP
|
||||
speed = idMath::M_MS2SEC * USERCMD_MSEC * in_angleSpeedKey.GetFloat();
|
||||
} else {
|
||||
speed = idMath::M_MS2SEC * USERCMD_MSEC;
|
||||
|
@ -696,13 +708,17 @@ void idUsercmdGenLocal::MouseMove( void ) {
|
|||
}
|
||||
|
||||
if ( !ButtonState( UB_STRAFE ) ) {
|
||||
viewangles[YAW] -= m_yaw.GetFloat() * mx;
|
||||
// m_invertLook 2 and 3 invert looking left/right
|
||||
float invYaw = ( m_invertLook.GetInteger() & 2 ) ? -1.0f : 1.0f;
|
||||
viewangles[YAW] -= m_yaw.GetFloat() * mx * invYaw;
|
||||
} else {
|
||||
cmd.rightmove = idMath::ClampChar( (int)(cmd.rightmove + strafeMx) );
|
||||
}
|
||||
|
||||
if ( !ButtonState( UB_STRAFE ) && ( cmd.buttons & BUTTON_MLOOK ) ) {
|
||||
viewangles[PITCH] += m_pitch.GetFloat() * my;
|
||||
// m_invertLook 1 and 3 invert looking up/down
|
||||
float invPitch = ( m_invertLook.GetInteger() & 1 ) ? -1.0f : 1.0f;
|
||||
viewangles[PITCH] += m_pitch.GetFloat() * my * invPitch;
|
||||
} else {
|
||||
cmd.forwardmove = idMath::ClampChar( (int)(cmd.forwardmove - strafeMy) );
|
||||
}
|
||||
|
@ -960,7 +976,7 @@ void idUsercmdGenLocal::CmdButtons( void ) {
|
|||
}
|
||||
|
||||
// check the run button
|
||||
if ( toggled_run.on ^ ( in_alwaysRun.GetBool() && idAsyncNetwork::IsActive() ) ) {
|
||||
if ( toggled_run.on ^ ( in_alwaysRun.GetBool() && AlwaysRunAllowed() ) ) { // DG: always run in SP
|
||||
cmd.buttons |= BUTTON_RUN;
|
||||
}
|
||||
|
||||
|
@ -992,7 +1008,7 @@ void idUsercmdGenLocal::InitCurrent( void ) {
|
|||
memset( &cmd, 0, sizeof( cmd ) );
|
||||
cmd.flags = flags;
|
||||
cmd.impulse = impulse;
|
||||
cmd.buttons |= ( in_alwaysRun.GetBool() && idAsyncNetwork::IsActive() ) ? BUTTON_RUN : 0;
|
||||
cmd.buttons |= ( in_alwaysRun.GetBool() && AlwaysRunAllowed() ) ? BUTTON_RUN : 0; // DG: always run in SP
|
||||
cmd.buttons |= in_freeLook.GetBool() ? BUTTON_MLOOK : 0;
|
||||
}
|
||||
|
||||
|
@ -1012,7 +1028,8 @@ void idUsercmdGenLocal::MakeCurrent( void ) {
|
|||
if ( !Inhibited() ) {
|
||||
// update toggled key states
|
||||
toggled_crouch.SetKeyState( ButtonState( UB_DOWN ), in_toggleCrouch.GetBool() );
|
||||
toggled_run.SetKeyState( ButtonState( UB_SPEED ), in_toggleRun.GetBool() && idAsyncNetwork::IsActive() );
|
||||
// DG: allow toggle run in SP (of in_allowAlwaysRun is set)
|
||||
toggled_run.SetKeyState( ButtonState( UB_SPEED ), in_toggleRun.GetBool() && AlwaysRunAllowed() );
|
||||
toggled_zoom.SetKeyState( ButtonState( UB_ZOOM ), in_toggleZoom.GetBool() );
|
||||
|
||||
// keyboard angle adjustment
|
||||
|
|
Loading…
Reference in a new issue