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 committed 2023-08-18 14:09:45 -07:00
1 parent 12571746d7
commit 68c00af44e
4 files changed
+25 -3

No files matched your search

+12 -1
View File
@@ -579,6 +579,7 @@ void bmoveResetMoveData(struct movedata *data)
data->freelookdx = 0.0f; data->freelookdx = 0.0f;
data->freelookdy = 0.0f; data->freelookdy = 0.0f;
#endif #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) // Handle manual zoom in and out (sniper, farsight and horizon scanner)
if (canmanualzoom && g_Vars.currentplayer->insightaimmode) { if (canmanualzoom && g_Vars.currentplayer->insightaimmode) {
increment = 1; increment = 1;
@@ -1474,10 +1482,13 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
g_Vars.currentplayer->bondactivateorreload = 0; g_Vars.currentplayer->bondactivateorreload = 0;
if (movedata.alt1tapcount) {
g_Vars.currentplayer->bondactivateorreload = g_Vars.currentplayer->bondactivateorreload | JO_ACTION_RELOAD;
}
if (movedata.btapcount) { if (movedata.btapcount) {
g_Vars.currentplayer->activatetimelast = g_Vars.currentplayer->activatetimethis; g_Vars.currentplayer->activatetimelast = g_Vars.currentplayer->activatetimethis;
g_Vars.currentplayer->activatetimethis = g_Vars.lvframe60; 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(); bmoveHandleActivate();
} }
+9 -2
View File
@@ -1287,11 +1287,18 @@ Gfx *lvRender(Gfx *gdl)
} }
// Handle opening doors and reloading // Handle opening doors and reloading
if (g_Vars.currentplayer->bondactivateorreload) { if (g_Vars.currentplayer->bondactivateorreload & JO_ACTION_RELOAD) {
if (currentPlayerInteract(false)) { if (g_Vars.currentplayer->hands[HAND_RIGHT].state != HANDSTATE_RELOAD){
bgunReloadIfPossible(HAND_RIGHT); bgunReloadIfPossible(HAND_RIGHT);
}
if (g_Vars.currentplayer->hands[HAND_LEFT].state != HANDSTATE_RELOAD) {
bgunReloadIfPossible(HAND_LEFT); 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 } else if (g_Vars.currentplayer->eyespy
&& g_Vars.currentplayer->eyespy->active && g_Vars.currentplayer->eyespy->active
&& g_Vars.currentplayer->eyespy->opendoor) { && g_Vars.currentplayer->eyespy->opendoor) {
+3
View File
@@ -4615,3 +4615,6 @@ enum weaponnum {
#define BODY_DARK_NEGOTIATOR 0x96 #define BODY_DARK_NEGOTIATOR 0x96
#endif #endif
#define JO_ACTION_ACTIVATE 0x0001
#define JO_ACTION_RELOAD 0x0002
+1
View File
@@ -5302,6 +5302,7 @@ struct movedata {
/* */ f32 freelookdx; // how much the mouse moved ... /* */ f32 freelookdx; // how much the mouse moved ...
/* */ f32 freelookdy; // ... in normalized window coordinates /* */ f32 freelookdy; // ... in normalized window coordinates
#endif #endif
/*0xac*/ s32 alt1tapcount;
}; };
struct attackanimgroup { struct attackanimgroup {