Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor gamepad updates #1211

Merged
merged 5 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions src/doom/g_game.c
Original file line number Diff line number Diff line change
Expand Up @@ -683,18 +683,42 @@ void G_BuildTiccmd (ticcmd_t* cmd, int maketic)
{
static unsigned int kbdlookctrl = 0;

if (gamekeydown[key_lookup] || joylook < 0)
if (gamekeydown[key_lookup])
{
look = lspeed;
kbdlookctrl += ticdup;
}
else
if (gamekeydown[key_lookdown] || joylook > 0)
if (gamekeydown[key_lookdown])
{
look = -lspeed;
kbdlookctrl += ticdup;
}
else
if (use_analog && joylook)
{
joylook = joylook * joystick_look_sensitivity / 10;
mikeday0 marked this conversation as resolved.
Show resolved Hide resolved
joylook = (joylook > FRACUNIT) ? FRACUNIT : joylook;
joylook = (joylook < -FRACUNIT) ? -FRACUNIT : joylook;
look = -FixedMul(2, joylook);
kbdlookctrl += ticdup;
}
else
if (joystick_look_sensitivity && joylook)
mikeday0 marked this conversation as resolved.
Show resolved Hide resolved
{
if (joylook < 0)
{
look = lspeed;
kbdlookctrl += ticdup;
}

if (joylook > 0)
{
look = -lspeed;
kbdlookctrl += ticdup;
}
}
else
// [crispy] keyboard lookspring
if (gamekeydown[key_lookcenter] || (crispy->freelook == FREELOOK_SPRING && kbdlookctrl))
{
Expand Down
2 changes: 1 addition & 1 deletion src/i_joystick.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ static int joystick_y_dead_zone = 33;
static int joystick_strafe_dead_zone = 33;
static int joystick_look_dead_zone = 33;

int use_analog = 0;
int use_analog = 1; // [crispy] use analog by default

int joystick_turn_sensitivity = 10;
int joystick_move_sensitivity = 10;
Expand Down
5 changes: 1 addition & 4 deletions src/setup/joystick.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ static int joystick_y_dead_zone = 33;
static int joystick_strafe_dead_zone = 33;
static int joystick_look_dead_zone = 33;

int use_analog = 0;
int use_analog = 1; // [crispy] use analog by default

int joystick_turn_sensitivity = 10;
int joystick_move_sensitivity = 10;
Expand Down Expand Up @@ -1173,12 +1173,9 @@ static void AdjustAnalog(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused))
TXT_NewLabel("Turn"),
TXT_NewSpinControl(&joystick_turn_sensitivity, 0, 20),
NULL);
if (gamemission == heretic || gamemission == hexen || gamemission == strife)
{
TXT_AddWidgets(window,
TXT_NewLabel("Look"),
TXT_NewSpinControl(&joystick_look_sensitivity, 0, 20), NULL);
}
TXT_SetWindowAction(window, TXT_HORIZ_LEFT, NULL);
TXT_SetWindowAction(window, TXT_HORIZ_CENTER,
TXT_NewWindowEscapeAction(window));
Expand Down
Loading