From e9906c633afe69a5c9e3598f9d46a568c75267b0 Mon Sep 17 00:00:00 2001 From: Noseey Date: Thu, 21 Nov 2024 23:10:50 +0100 Subject: [PATCH] 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. --- src/heretic/g_game.c | 8 ++++++++ src/hexen/g_game.c | 8 ++++++++ src/m_config.c | 4 ++-- src/setup/keyboard.c | 1 + src/setup/mouse.c | 1 + 5 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/heretic/g_game.c b/src/heretic/g_game.c index 75c8d18601..14f8c67945 100644 --- a/src/heretic/g_game.c +++ b/src/heretic/g_game.c @@ -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]) { diff --git a/src/hexen/g_game.c b/src/hexen/g_game.c index 6adb44f461..8d59e4df0c 100644 --- a/src/hexen/g_game.c +++ b/src/hexen/g_game.c @@ -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]) { diff --git a/src/m_config.c b/src/m_config.c index 1bdff289b5..698e213355 100644 --- a/src/m_config.c +++ b/src/m_config.c @@ -508,7 +508,7 @@ static default_t doom_defaults_list[] = CONFIG_VARIABLE_INT(mouseb_mouselook), //! - // @game doom + // @game doom heretic hexen // // Quick 180° reverse. // @@ -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. // diff --git a/src/setup/keyboard.c b/src/setup/keyboard.c index 88b0525c16..32e2cd49e5 100644 --- a/src/setup/keyboard.c +++ b/src/setup/keyboard.c @@ -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) diff --git a/src/setup/mouse.c b/src/setup/mouse.c index 9dfdc5c73c..6fbdc0393d 100644 --- a/src/setup/mouse.c +++ b/src/setup/mouse.c @@ -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);