foxygit / doom Log in
commit c62b634f394e64dd51dec7e6f890496f43a56ade
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: Sat May 16 14:59:12 2026 +0200
Commit:     GitHub <noreply@github.com>
CommitDate: Sat May 16 14:59:12 2026 +0200

    strife: Mirror the `mouse_fire_countdown` in joystick logic as well (#1796)

    Mirror the `mouse_fire_countdown` logic to `joystick_fire_countdown`.
    This resolves the same problem, that is the joystick fire button used to
    select a response triggering an attack when the dialog closes.

    Originally reported to fabiangreffrath/crispy-doom#1390.

    Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 src/strife/doomstat.h |  1 +
 src/strife/g_game.c   | 10 +++++++++-
 src/strife/m_menu.c   |  1 +
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/strife/doomstat.h b/src/strife/doomstat.h
index e205a7f0..4be2435b 100644
--- a/src/strife/doomstat.h
+++ b/src/strife/doomstat.h
@@ -182,6 +182,7 @@ extern  boolean	usergame;
 extern  boolean	demoplayback;
 extern  boolean	demorecording;
 extern  int     mouse_fire_countdown;   // villsa [STRIFE]
+extern  int     joystick_fire_countdown;

 extern fixed_t forwardmove[2];
 extern fixed_t sidemove[2];
diff --git a/src/strife/g_game.c b/src/strife/g_game.c
index 86d997ca..50faee1c 100644
--- a/src/strife/g_game.c
+++ b/src/strife/g_game.c
@@ -157,6 +157,7 @@ fixed_t         sidemove[2] = {0x18, 0x28};
 fixed_t         angleturn[3] = {640, 1280, 320};    // + slow turn

 int mouse_fire_countdown = 0;    // villsa [STRIFE]
+int joystick_fire_countdown = 0;

 static int *weapon_keys[] = {
     &key_weapon1,
@@ -540,7 +541,7 @@ void G_BuildTiccmd (ticcmd_t* cmd, int maketic)
         cmd->buttons2 |= BT2_JUMP;

     // villsa [STRIFE]: Moved mousebuttons[mousebfire] to below
-    if (gamekeydown[key_fire] || joybuttons[joybfire])
+    if (gamekeydown[key_fire])
         cmd->buttons |= BT_ATTACK;

     // villsa [STRIFE]
@@ -551,6 +552,13 @@ void G_BuildTiccmd (ticcmd_t* cmd, int maketic)
          else
              --mouse_fire_countdown;
     }
+    if(joybuttons[joybfire])
+    {
+         if(joystick_fire_countdown <= 0)
+             cmd->buttons |= BT_ATTACK;
+         else
+             --joystick_fire_countdown;
+    }

     if (gamekeydown[key_use]
      || joybuttons[joybuse]
diff --git a/src/strife/m_menu.c b/src/strife/m_menu.c
index 32a5d658..d277fd3c 100644
--- a/src/strife/m_menu.c
+++ b/src/strife/m_menu.c
@@ -1791,6 +1791,7 @@ boolean M_Responder (event_t* ev)
                 key = key_menu_forward;
             }
             joywait = I_GetTime() + 5;
+            joystick_fire_countdown = 5;
         }
         if (JOY_BUTTON_PRESSED(joybuse))
         {