mirror of
https://github.com/ZDoom/Raze.git
synced 2025-03-26 02:31:13 +00:00
- Move remaining mouse CVARs from inputstate.cpp
to gameinput.cpp
.
This commit is contained in:
parent
13cb52a0db
commit
ea4e850674
3 changed files with 17 additions and 29 deletions
|
@ -37,6 +37,8 @@ CVAR(Float, m_pitch, 1.f, CVAR_GLOBALCONFIG | CVAR_ARCHIVE)
|
|||
CVAR(Float, m_yaw, 1.f, CVAR_GLOBALCONFIG | CVAR_ARCHIVE)
|
||||
CVAR(Float, m_forward, 1.f, CVAR_GLOBALCONFIG | CVAR_ARCHIVE)
|
||||
CVAR(Float, m_side, 1.f, CVAR_GLOBALCONFIG | CVAR_ARCHIVE)
|
||||
CVARD(Bool, invertmousex, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG, "invert horizontal mouse movement")
|
||||
CVARD(Bool, invertmouse, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG, "invert vertical mouse movement")
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -58,6 +60,7 @@ static int dpad_lock = 0;
|
|||
ESyncBits ActionsToSend = 0;
|
||||
bool crouch_toggle = false;
|
||||
|
||||
static constexpr float backendmousescale = 1.f / 16.f;
|
||||
static constexpr double YAW_TURNSPEEDS[3] = { 41.1987304, 156.555175, 272.24121 };
|
||||
static constexpr double YAW_PREAMBLESCALE = YAW_TURNSPEEDS[0] / YAW_TURNSPEEDS[1];
|
||||
static constexpr double YAW_LOOKINGSPEED = 801.5625;
|
||||
|
@ -191,7 +194,7 @@ void processVehicleInput(HIDInput* const hidInput, InputPacket* const currInput,
|
|||
SB_AIM_UP | SB_AIM_DOWN | SB_AIMMODE | SB_LOOK_UP | SB_LOOK_DOWN | SB_LOOK_LEFT | SB_LOOK_RIGHT);
|
||||
|
||||
// Cancel out micro-movement
|
||||
if (fabs(hidInput->mouse.X) < (m_sensitivity_x * backendinputscale() * 2.f))
|
||||
if (fabs(hidInput->mouse.X) < (m_sensitivity_x * backendmousescale * 2.f))
|
||||
hidInput->mouse.X = 0;
|
||||
|
||||
// Yes, we need all these bools...
|
||||
|
@ -254,6 +257,14 @@ static void ApplyGlobalInput(HIDInput* const hidInput)
|
|||
inputState.GetMouseDelta(hidInput->mouse);
|
||||
if (use_joystick) I_GetAxes(hidInput->joyaxes);
|
||||
|
||||
hidInput->mouse *= backendmousescale;
|
||||
|
||||
if (invertmousex)
|
||||
hidInput->mouse.X = -hidInput->mouse.X;
|
||||
|
||||
if (invertmouse)
|
||||
hidInput->mouse.Y = -hidInput->mouse.Y;
|
||||
|
||||
if (WeaponToSend != 0) inputBuffer.setNewWeapon(WeaponToSend);
|
||||
WeaponToSend = 0;
|
||||
if (hidInput && buttonMap.ButtonDown(gamefunc_Dpad_Select))
|
||||
|
|
|
@ -44,28 +44,6 @@
|
|||
#include "gamestate.h"
|
||||
#include "gameinput.h"
|
||||
|
||||
// Mouse speeds
|
||||
CVARD(Bool, invertmousex, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG, "invert horizontal mouse movement")
|
||||
CVARD(Bool, invertmouse, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG, "invert vertical mouse movement")
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void InputState::GetMouseDelta(FVector2& hidInput)
|
||||
{
|
||||
hidInput = g_mousePos * backendinputscale();
|
||||
g_mousePos.Zero();
|
||||
|
||||
if (invertmousex)
|
||||
hidInput.X = -hidInput.X;
|
||||
|
||||
if (invertmouse)
|
||||
hidInput.Y = -hidInput.Y;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
|
|
|
@ -34,7 +34,11 @@ public:
|
|||
g_mousePos.Y += y;
|
||||
}
|
||||
|
||||
void GetMouseDelta(FVector2& hidInput);
|
||||
void GetMouseDelta(FVector2& gameinput)
|
||||
{
|
||||
gameinput = g_mousePos;
|
||||
g_mousePos.Zero();
|
||||
}
|
||||
|
||||
void ClearAllInput();
|
||||
bool CheckAllInput()
|
||||
|
@ -85,8 +89,3 @@ enum GameFunction_t
|
|||
};
|
||||
|
||||
void SetupGameButtons();
|
||||
|
||||
inline float backendinputscale()
|
||||
{
|
||||
return (1.f / 16.f);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue