Skip to content

Commit c62b634

Browse files
authored
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#1390. Signed-off-by: Michał Górny <mgorny@gentoo.org>
1 parent 7df1f93 commit c62b634

3 files changed

Lines changed: 11 additions & 1 deletion

File tree

src/strife/doomstat.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ extern boolean usergame;
182182
extern boolean demoplayback;
183183
extern boolean demorecording;
184184
extern int mouse_fire_countdown; // villsa [STRIFE]
185+
extern int joystick_fire_countdown;
185186

186187
extern fixed_t forwardmove[2];
187188
extern fixed_t sidemove[2];

src/strife/g_game.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ fixed_t sidemove[2] = {0x18, 0x28};
157157
fixed_t angleturn[3] = {640, 1280, 320}; // + slow turn
158158

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

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

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

546547
// villsa [STRIFE]
@@ -551,6 +552,13 @@ void G_BuildTiccmd (ticcmd_t* cmd, int maketic)
551552
else
552553
--mouse_fire_countdown;
553554
}
555+
if(joybuttons[joybfire])
556+
{
557+
if(joystick_fire_countdown <= 0)
558+
cmd->buttons |= BT_ATTACK;
559+
else
560+
--joystick_fire_countdown;
561+
}
554562

555563
if (gamekeydown[key_use]
556564
|| joybuttons[joybuse]

src/strife/m_menu.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1791,6 +1791,7 @@ boolean M_Responder (event_t* ev)
17911791
key = key_menu_forward;
17921792
}
17931793
joywait = I_GetTime() + 5;
1794+
joystick_fire_countdown = 5;
17941795
}
17951796
if (JOY_BUTTON_PRESSED(joybuse))
17961797
{

0 commit comments

Comments
 (0)