Skip to content

Commit

Permalink
Adding Quick Reverse Key to Hexen / Heretic (#1240)
Browse files Browse the repository at this point in the history
* Adding Quick-Reverse Key and Mouse for Hexen and Heretic

Adding Quick-Reverse Key and Mouse Input for Hexen and Heretic by copying the implementation from Doom.

* 180° Turn only once per button press

Introduced state variable to only allow a 180° Turn once per button press (either mouse or keyboard). This improves the useability when binding it to a mouse key.

* Revert "180° Turn only once per button press"

This reverts commit ba920ff.
  • Loading branch information
Noseey authored Nov 23, 2024
1 parent f665d01 commit bd87fce
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/heretic/g_game.c
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,14 @@ void G_BuildTiccmd(ticcmd_t *cmd, int maketic)
lspeed = 2;
}

// [crispy] add quick 180° reverse
if (gamekeydown[key_reverse] || mousebuttons[mousebreverse])
{
angle += ANG180 >> FRACBITS;
gamekeydown[key_reverse] = false;
mousebuttons[mousebreverse] = false;
}

// [crispy] toggle "always run"
if (gamekeydown[key_toggleautorun])
{
Expand Down
8 changes: 8 additions & 0 deletions src/hexen/g_game.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,14 @@ void G_BuildTiccmd(ticcmd_t *cmd, int maketic)
lspeed = 2; // 5;
}

// [crispy] add quick 180° reverse
if (gamekeydown[key_reverse] || mousebuttons[mousebreverse])
{
angle += ANG180 >> FRACBITS;
gamekeydown[key_reverse] = false;
mousebuttons[mousebreverse] = false;
}

// [crispy] toggle "always run"
if (gamekeydown[key_toggleautorun])
{
Expand Down
4 changes: 2 additions & 2 deletions src/m_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ static default_t doom_defaults_list[] =
CONFIG_VARIABLE_INT(mouseb_mouselook),

//!
// @game doom
// @game doom heretic hexen
//
// Quick 180° reverse.
//
Expand Down Expand Up @@ -2251,7 +2251,7 @@ static default_t extra_defaults_list[] =
CONFIG_VARIABLE_KEY(key_multi_msgplayer8),

//!
// @game doom
// @game doom heretic hexen
// Quick 180° reverse.
//

Expand Down
1 change: 1 addition & 0 deletions src/setup/keyboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ static void ConfigExtraKeys(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused))
AddKeyControl(table, "Strafe Right (alt.)", &key_alt_straferight);
AddKeyControl(table, "Toggle always run", &key_toggleautorun);
AddKeyControl(table, "Toggle vert. mouse", &key_togglenovert);
AddKeyControl(table, "Quick Reverse", &key_reverse);
}

if (gamemission == heretic || gamemission == hexen)
Expand Down
1 change: 1 addition & 0 deletions src/setup/mouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ static void ConfigExtraButtons(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused))

if (gamemission == heretic || gamemission == hexen)
{
AddMouseControl(buttons_table, "Quick Reverse", &mousebreverse);
AddMouseControl(buttons_table, "Mouselook", &mousebmouselook);
AddMouseControl(buttons_table, "Inventory left", &mousebinvleft);
AddMouseControl(buttons_table, "Inventory right", &mousebinvright);
Expand Down

0 comments on commit bd87fce

Please sign in to comment.