Skip to content

Commit

Permalink
Fix restore defaults for advanced gamepad menu
Browse files Browse the repository at this point in the history
  • Loading branch information
ceski-1 committed Sep 25, 2024
1 parent 796c0d0 commit 7b26024
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
7 changes: 5 additions & 2 deletions src/i_flickstick.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,14 @@ void I_RefreshFlickStickSettings(void)
flick.snap = joy_flick_snap ? PI_F / powf(2.0f, joy_flick_snap) : 0.0f;
}

#define BIND_NUM_PADADV(name, v, a, b, help) \
M_BindNum(#name, &name, NULL, (v), (a), (b), ss_padadv, wad_no, help)

void I_BindFlickStickVariables(void)
{
BIND_NUM(joy_flick_mode, MODE_DEFAULT, MODE_DEFAULT, NUM_FLICK_MODES - 1,
"Flick mode (0 = Default; 1 = Flick Only; 2 = Rotate Only)");
BIND_NUM(joy_flick_time, 10, 10, 50,
BIND_NUM_PADADV(joy_flick_time, 10, 10, 50,
"Flick time (10 = 100 ms; 50 = 500 ms)");
BIND_NUM(joy_flick_rotation_smooth, 8, 0, 50,
"Flick rotation smoothing threshold "
Expand All @@ -281,6 +284,6 @@ void I_BindFlickStickVariables(void)
"Flick deadzone relative to camera deadzone [percent]");
BIND_NUM(joy_flick_forward_deadzone, 7, 0, 45,
"Forward angle range where flicks are disabled [degrees]");
BIND_NUM(joy_flick_snap, 0, 0, 2,
BIND_NUM_PADADV(joy_flick_snap, 0, 0, 2,
"Snap to cardinal directions (0 = Off; 1 = 4-way; 2 = 8-way)");
}
11 changes: 7 additions & 4 deletions src/i_gamepad.c
Original file line number Diff line number Diff line change
Expand Up @@ -477,13 +477,16 @@ static void RefreshSettings(void)
I_RefreshGyroSettings();
}

#define BIND_NUM_PADADV(name, v, a, b, help) \
M_BindNum(#name, &name, NULL, (v), (a), (b), ss_padadv, wad_no, help)

void I_BindGamepadVariables(void)
{
BIND_BOOL(joy_enable, true, "Enable gamepad");
BIND_NUM(joy_platform, PLATFORM_AUTO, PLATFORM_AUTO, NUM_PLATFORMS - 1,
"Gamepad platform (0 = Auto; 1 = Xbox 360; 2 = Xbox One/Series; "
"3 = Playstation 3; 4 = Playstation 4; 5 = Playstation 5; 6 = Switch)");
BIND_NUM_GENERAL(joy_stick_layout, LAYOUT_DEFAULT, 0, NUM_LAYOUTS - 1,
BIND_NUM_PADADV(joy_stick_layout, LAYOUT_DEFAULT, 0, NUM_LAYOUTS - 1,
"Analog stick layout (0 = Off; 1 = Default; 2 = Southpaw; 3 = Legacy; "
"4 = Legacy Southpaw; 5 = Flick Stick; 6 = Flick Stick Southpaw)");
BIND_NUM(joy_forward_speed, 10, 0, 20,
Expand All @@ -500,11 +503,11 @@ void I_BindGamepadVariables(void)
"Extra look speed at outer deadzone [degrees/second]");
BIND_NUM(joy_outer_ramp_time, 200, 0, 1000,
"Ramp time for extra speed [milliseconds]");
BIND_NUM(joy_scale_diagonal_movement, 1, 0, 1,
BIND_NUM_PADADV(joy_scale_diagonal_movement, 1, 0, 1,
"Scale diagonal movement (0 = Linear; 1 = Circle to Square)");
BIND_NUM(joy_movement_curve, 10, 10, 30,
BIND_NUM_PADADV(joy_movement_curve, 10, 10, 30,
"Movement response curve (10 = Linear; 20 = Squared; 30 = Cubed)");
BIND_NUM_GENERAL(joy_camera_curve, 20, 10, 30,
BIND_NUM_PADADV(joy_camera_curve, 20, 10, 30,
"Camera response curve (10 = Linear; 20 = Squared; 30 = Cubed)");
BIND_NUM(joy_movement_deadzone_type, 1, 0, 1,
"Movement deadzone type (0 = Axial; 1 = Radial)");
Expand Down

0 comments on commit 7b26024

Please sign in to comment.