map L_TRIG to alt button

- switches immediately when releases L
- or whenevever L+Z is pressed. Will switch back when L is released.
This commit is contained in:
Catherine Reprobate 2023-07-17 23:46:45 -07:00
parent 68c00af44e
commit 25b5f66e6b
4 changed files with 41 additions and 1 deletions

View File

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

View File

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

View File

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

View File

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