Mapped reload to X_BUTTON.

Introduce `JO_ACTION*` constants to use `player.bondreloadoractivate` as a bit
field.

Deviation from vanilla Mouse Injector behavior: hard seperation between
reload and activate. `B` will not reload just as `ALT1` will not
activate.
This commit is contained in:
Catherine Reprobate 2022-12-21 17:12:40 -08:00
parent 12571746d7
commit 68c00af44e
4 changed files with 25 additions and 3 deletions

View File

@ -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();
}

View File

@ -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) {

View File

@ -4615,3 +4615,6 @@ enum weaponnum {
#define BODY_DARK_NEGOTIATOR 0x96
#endif
#define JO_ACTION_ACTIVATE 0x0001
#define JO_ACTION_RELOAD 0x0002

View File

@ -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 {