mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-22 03:12:00 -04:00
Simplify gamepad calculations
This commit is contained in:
parent
f219f7231d
commit
ef34eab76d
@ -2456,6 +2456,7 @@ void D_DoomMain(void)
|
|||||||
G_UpdateSideMove();
|
G_UpdateSideMove();
|
||||||
G_UpdateAngleFunctions();
|
G_UpdateAngleFunctions();
|
||||||
G_UpdateLocalViewFunction();
|
G_UpdateLocalViewFunction();
|
||||||
|
G_UpdateControllerVariables();
|
||||||
G_UpdateMouseVariables();
|
G_UpdateMouseVariables();
|
||||||
R_UpdateViewAngleFunction();
|
R_UpdateViewAngleFunction();
|
||||||
|
|
||||||
|
@ -171,6 +171,14 @@ int G_CarryVert(double vert)
|
|||||||
|
|
||||||
static const int direction[] = {1, -1};
|
static const int direction[] = {1, -1};
|
||||||
static double deltatics;
|
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)
|
void G_UpdateDeltaTics(void)
|
||||||
{
|
{
|
||||||
@ -200,14 +208,12 @@ void G_UpdateDeltaTics(void)
|
|||||||
|
|
||||||
double G_CalcControllerAngle(void)
|
double G_CalcControllerAngle(void)
|
||||||
{
|
{
|
||||||
return (angleturn[1] * axes[AXIS_TURN] * direction[joy_invert_turn]
|
return (axes[AXIS_TURN] * joy_scale_angle * deltatics);
|
||||||
* deltatics);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double G_CalcControllerPitch(void)
|
double G_CalcControllerPitch(void)
|
||||||
{
|
{
|
||||||
return (angleturn[1] * axes[AXIS_LOOK] * direction[joy_invert_look]
|
return (axes[AXIS_LOOK] * joy_scale_pitch * deltatics);
|
||||||
* deltatics * FRACUNIT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int G_CalcControllerSideTurn(int speed)
|
int G_CalcControllerSideTurn(int speed)
|
||||||
|
@ -35,6 +35,7 @@ int G_CarryVert(double vert);
|
|||||||
|
|
||||||
// Gamepad
|
// Gamepad
|
||||||
|
|
||||||
|
void G_UpdateControllerVariables(void);
|
||||||
void G_UpdateDeltaTics(void);
|
void G_UpdateDeltaTics(void);
|
||||||
double G_CalcControllerAngle(void);
|
double G_CalcControllerAngle(void);
|
||||||
double G_CalcControllerPitch(void);
|
double G_CalcControllerPitch(void);
|
||||||
|
@ -2189,7 +2189,8 @@ static setup_menu_t gen_settings4[] = {
|
|||||||
{"Free Look", S_ONOFF, CNTR_X, M_SPC, {"padlook"}, m_null, input_null,
|
{"Free Look", S_ONOFF, CNTR_X, M_SPC, {"padlook"}, m_null, input_null,
|
||||||
str_empty, MN_UpdateFreeLook},
|
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,
|
MI_GAP,
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user