mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-26 06:20:16 -04:00
Add gyro invert turn/look options (#1963)
* Don't invert local lean by default * Add gyro invert turn/look options
This commit is contained in:
parent
59f016d241
commit
54fcbd4416
27
src/i_gyro.c
27
src/i_gyro.c
@ -97,6 +97,8 @@ static int gyro_accel_max_threshold;
|
||||
static int gyro_smooth_threshold;
|
||||
static int gyro_smooth_time;
|
||||
static int gyro_tightening;
|
||||
static boolean gyro_invert_turn;
|
||||
static boolean gyro_invert_look;
|
||||
static fixed_t gyro_calibration_a;
|
||||
static fixed_t gyro_calibration_x;
|
||||
static fixed_t gyro_calibration_y;
|
||||
@ -311,12 +313,29 @@ void I_CalcGyroAxes(boolean strafe)
|
||||
{
|
||||
if (GyroActive())
|
||||
{
|
||||
gyro_axes[GYRO_TURN] = !strafe ? RAD2TIC(gyro_axes[GYRO_TURN]) : 0.0f;
|
||||
if (!strafe)
|
||||
{
|
||||
gyro_axes[GYRO_TURN] = RAD2TIC(gyro_axes[GYRO_TURN]);
|
||||
|
||||
if (gyro_invert_turn)
|
||||
{
|
||||
gyro_axes[GYRO_TURN] *= -1.0f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gyro_axes[GYRO_TURN] = 0.0f;
|
||||
}
|
||||
|
||||
if (padlook)
|
||||
{
|
||||
gyro_axes[GYRO_LOOK] = RAD2TIC(gyro_axes[GYRO_LOOK]);
|
||||
|
||||
if (gyro_invert_look)
|
||||
{
|
||||
gyro_axes[GYRO_LOOK] *= -1.0f;
|
||||
}
|
||||
|
||||
if (correct_aspect_ratio)
|
||||
{
|
||||
gyro_axes[GYRO_LOOK] /= 1.2f;
|
||||
@ -516,7 +535,7 @@ static void ApplyGyroSpace_Skip(void)
|
||||
|
||||
static void ApplyGyroSpace_LocalLean(void)
|
||||
{
|
||||
motion.gyro.y = -motion.gyro.z;
|
||||
motion.gyro.y = motion.gyro.z;
|
||||
}
|
||||
|
||||
static void ApplyGyroSpace_PlayerTurn(void)
|
||||
@ -829,6 +848,10 @@ void I_BindGyroVaribales(void)
|
||||
BIND_NUM(gyro_tightening, 30, 0, 100,
|
||||
"Gyro steadying: tightening threshold "
|
||||
"(0 = Off; 100 = 10.0 degrees/second)");
|
||||
BIND_BOOL(gyro_invert_turn, false,
|
||||
"Invert gyro turn axis");
|
||||
BIND_BOOL(gyro_invert_look, false,
|
||||
"Invert gyro look axis");
|
||||
|
||||
BIND_NUM(gyro_calibration_a, 0, UL, UL, "Accelerometer calibration");
|
||||
BIND_NUM(gyro_calibration_x, 0, UL, UL, "Gyro calibration (x-axis)");
|
||||
|
Loading…
x
Reference in New Issue
Block a user