diff --git a/src/game/bondgun.c b/src/game/bondgun.c index de61b86e0..ab7a2dc06 100644 --- a/src/game/bondgun.c +++ b/src/game/bondgun.c @@ -11699,7 +11699,7 @@ s32 bgunConsiderToggleGunFunction(s32 usedowntime, bool trigpressed, bool fromac } // Don't do anything if B hasn't been held for 50/60ths of a second - if (usedowntime < TICKS(50)) { + if (ABS(usedowntime) < 0) { return USETIMER_CONTINUE; } diff --git a/src/game/bondmove.c b/src/game/bondmove.c index 7f4f22ff6..084b9492e 100644 --- a/src/game/bondmove.c +++ b/src/game/bondmove.c @@ -1349,6 +1349,43 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i } } + + // handle L button + for (i = 0; i< numsamples; i++) { + if (joyGetButtonsOnSample(i, contpad1, c1allowedbuttons & L_TRIG)) { + if (g_Vars.currentplayer->altdowntime >= -1) { + if (joyGetButtonsPressedOnSample(i, contpad1, shootbuttons & c1allowedbuttons) + && g_Vars.currentplayer->altdowntime >= 0 + && bgunConsiderToggleGunFunction(g_Vars.currentplayer->altdowntime, true, false) != USETIMER_CONTINUE) { + g_Vars.currentplayer->altdowntime = -3; + } + + if (g_Vars.currentplayer->altdowntime != -4) { + if (g_Vars.currentplayer->altdowntime <= 0) { + g_Vars.currentplayer->altdowntime++; + } + } + } else { + if (g_Vars.currentplayer->altdowntime == -2) { + bgunConsiderToggleGunFunction(g_Vars.currentplayer->altdowntime, false, false); + g_Vars.currentplayer->altdowntime = -4; + } + } + } else { + // Released L + if (g_Vars.currentplayer->altdowntime != 0) { + s32 result = bgunConsiderToggleGunFunction(g_Vars.currentplayer->altdowntime, (g_Vars.currentplayer->altdowntime == -3 ? true: false), false); + + if (result == USETIMER_STOP) { + g_Vars.currentplayer->altdowntime = -1; + } else if (result == USETIMER_REPEAT) { + g_Vars.currentplayer->altdowntime = -2; + } + } + g_Vars.currentplayer->altdowntime = 0; + } + } + // Handle ALT1 / MI Reload Hack for (i = 0; i < numsamples; i++) { if (joyGetButtonsOnSample(i, contpad1, c1allowedbuttons & X_BUTTON)) { diff --git a/src/game/player.c b/src/game/player.c index d95e03948..a861e1a5d 100644 --- a/src/game/player.c +++ b/src/game/player.c @@ -806,6 +806,8 @@ void playerLoadDefaults(void) g_Vars.currentplayer->prevoverexposurered = 0; g_Vars.currentplayer->prevoverexposuregreen = 0; g_Vars.currentplayer->prevoverexposureblue = 0; + g_Vars.currentplayer->amdowntime = 0; + g_Vars.currentplayer->altdowntime = 0; } bool playerSpawnAnti(struct chrdata *hostchr, bool force) diff --git a/src/include/types.h b/src/include/types.h index 1963fc4f9..2c3de5498 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -2816,6 +2816,7 @@ struct player { /*0x1c64*/ s32 unk1c64; /*0x1c68*/ u32 unk1c68; /*0x1c6c*/ u32 unk1c6c; + s16 altdowntime; // for alt-modes, used like invdowntime and amdowntime }; struct ailist {