diff --git a/src/game/bondmove.c b/src/game/bondmove.c index 6a475793c..7f4f22ff6 100644 --- a/src/game/bondmove.c +++ b/src/game/bondmove.c @@ -579,6 +579,7 @@ void bmoveResetMoveData(struct movedata *data) data->freelookdx = 0.0f; data->freelookdy = 0.0f; #endif + data->alt1tapcount = 0; } /** @@ -1348,6 +1349,13 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i } } + // Handle ALT1 / MI Reload Hack + for (i = 0; i < numsamples; i++) { + if (joyGetButtonsOnSample(i, contpad1, c1allowedbuttons & X_BUTTON)) { + movedata.alt1tapcount++; + } + } + // Handle manual zoom in and out (sniper, farsight and horizon scanner) if (canmanualzoom && g_Vars.currentplayer->insightaimmode) { increment = 1; @@ -1474,10 +1482,13 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i g_Vars.currentplayer->bondactivateorreload = 0; + if (movedata.alt1tapcount) { + g_Vars.currentplayer->bondactivateorreload = g_Vars.currentplayer->bondactivateorreload | JO_ACTION_RELOAD; + } if (movedata.btapcount) { g_Vars.currentplayer->activatetimelast = g_Vars.currentplayer->activatetimethis; g_Vars.currentplayer->activatetimethis = g_Vars.lvframe60; - g_Vars.currentplayer->bondactivateorreload = movedata.btapcount; + g_Vars.currentplayer->bondactivateorreload = g_Vars.currentplayer->bondactivateorreload | JO_ACTION_ACTIVATE; bmoveHandleActivate(); } diff --git a/src/game/lv.c b/src/game/lv.c index 6d5516152..be614d435 100644 --- a/src/game/lv.c +++ b/src/game/lv.c @@ -1287,11 +1287,18 @@ Gfx *lvRender(Gfx *gdl) } // Handle opening doors and reloading - if (g_Vars.currentplayer->bondactivateorreload) { - if (currentPlayerInteract(false)) { + if (g_Vars.currentplayer->bondactivateorreload & JO_ACTION_RELOAD) { + if (g_Vars.currentplayer->hands[HAND_RIGHT].state != HANDSTATE_RELOAD){ bgunReloadIfPossible(HAND_RIGHT); + + } + if (g_Vars.currentplayer->hands[HAND_LEFT].state != HANDSTATE_RELOAD) { bgunReloadIfPossible(HAND_LEFT); } + g_Vars.currentplayer->bondactivateorreload = (g_Vars.currentplayer->bondactivateorreload & ~JO_ACTION_RELOAD) | (g_Vars.currentplayer->bondactivateorreload & 0x0); + } + if (g_Vars.currentplayer->bondactivateorreload & JO_ACTION_ACTIVATE) { + currentPlayerInteract(false); } else if (g_Vars.currentplayer->eyespy && g_Vars.currentplayer->eyespy->active && g_Vars.currentplayer->eyespy->opendoor) { diff --git a/src/include/constants.h b/src/include/constants.h index 3a8e7ea97..c4b948425 100644 --- a/src/include/constants.h +++ b/src/include/constants.h @@ -4615,3 +4615,6 @@ enum weaponnum { #define BODY_DARK_NEGOTIATOR 0x96 #endif + +#define JO_ACTION_ACTIVATE 0x0001 +#define JO_ACTION_RELOAD 0x0002 diff --git a/src/include/types.h b/src/include/types.h index 7914a3313..1963fc4f9 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -5302,6 +5302,7 @@ struct movedata { /* */ f32 freelookdx; // how much the mouse moved ... /* */ f32 freelookdy; // ... in normalized window coordinates #endif + /*0xac*/ s32 alt1tapcount; }; struct attackanimgroup {