diff --git a/src/d_main.c b/src/d_main.c index 95c9732c..3319ebe3 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -2456,6 +2456,7 @@ void D_DoomMain(void) G_UpdateSideMove(); G_UpdateAngleFunctions(); G_UpdateLocalViewFunction(); + G_UpdateControllerVariables(); G_UpdateMouseVariables(); R_UpdateViewAngleFunction(); diff --git a/src/g_input.c b/src/g_input.c index 257d0ef8..30721077 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -171,6 +171,14 @@ int G_CarryVert(double vert) static const int direction[] = {1, -1}; static double deltatics; +static double joy_scale_angle; +static double joy_scale_pitch; + +void G_UpdateControllerVariables(void) +{ + joy_scale_angle = angleturn[1] * direction[joy_invert_turn]; + joy_scale_pitch = angleturn[1] * direction[joy_invert_look] * FRACUNIT; +} void G_UpdateDeltaTics(void) { @@ -200,14 +208,12 @@ void G_UpdateDeltaTics(void) double G_CalcControllerAngle(void) { - return (angleturn[1] * axes[AXIS_TURN] * direction[joy_invert_turn] - * deltatics); + return (axes[AXIS_TURN] * joy_scale_angle * deltatics); } double G_CalcControllerPitch(void) { - return (angleturn[1] * axes[AXIS_LOOK] * direction[joy_invert_look] - * deltatics * FRACUNIT); + return (axes[AXIS_LOOK] * joy_scale_pitch * deltatics); } int G_CalcControllerSideTurn(int speed) diff --git a/src/g_input.h b/src/g_input.h index ebb292ae..33cff5b2 100644 --- a/src/g_input.h +++ b/src/g_input.h @@ -35,6 +35,7 @@ int G_CarryVert(double vert); // Gamepad +void G_UpdateControllerVariables(void); void G_UpdateDeltaTics(void); double G_CalcControllerAngle(void); double G_CalcControllerPitch(void); diff --git a/src/mn_setup.c b/src/mn_setup.c index 9c2384ce..c38e9ecf 100644 --- a/src/mn_setup.c +++ b/src/mn_setup.c @@ -2189,7 +2189,8 @@ static setup_menu_t gen_settings4[] = { {"Free Look", S_ONOFF, CNTR_X, M_SPC, {"padlook"}, m_null, input_null, str_empty, MN_UpdateFreeLook}, - {"Invert Look", S_ONOFF, CNTR_X, M_SPC, {"joy_invert_look"}}, + {"Invert Look", S_ONOFF, CNTR_X, M_SPC, {"joy_invert_look"}, + m_null, input_null, str_empty, G_UpdateControllerVariables}, MI_GAP,