dedicated radial menu mapped to `D_JPAD`

This commit is contained in:
Catherine Reprobate 2023-07-14 23:27:20 -07:00
parent 25b5f66e6b
commit ffae4540f9
3 changed files with 36 additions and 6 deletions

View File

@ -64,7 +64,7 @@ void amTick(void)
g_AmMenus[g_AmIndex].allbots = false;
if (g_Vars.currentplayer->activemenumode == AMMODE_EDIT) {
buttonsstate = buttonsstate & A_BUTTON;
buttonsstate = buttonsstate & D_JPAD;
cstickx = 0;
csticky = 0;
buttonspressed = 0;
@ -76,7 +76,7 @@ void amTick(void)
stayopen = true;
}
if (buttonsstate & A_BUTTON) {
if (buttonsstate & D_JPAD) {
#if VERSION >= VERSION_JPN_FINAL
if (g_Vars.currentplayer->numaibuddies > 0) {
g_AmMenus[g_AmIndex].allbots = true;
@ -86,7 +86,7 @@ void amTick(void)
#endif
}
} else {
if (buttonsstate & A_BUTTON) {
if (buttonsstate & D_JPAD) {
stayopen = true;
}
@ -145,12 +145,16 @@ void amTick(void)
u16 buttonspressed2 = joyGetButtonsPressedOnSample(j, contpadnum2, 0xffff);
if (g_Vars.currentplayer->activemenumode == AMMODE_EDIT) {
buttonsstate2 = buttonsstate2 & A_BUTTON;
buttonsstate2 = buttonsstate2 & D_JPAD;
cstickx2 = 0;
csticky2 = 0;
buttonspressed2 = 0;
}
if (buttonsstate2 & D_JPAD) {
stayopen = true;
}
if (buttonspressed2 & Z_TRIG) {
toggle = true;
}

View File

@ -914,7 +914,7 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
if (g_Vars.currentplayer->invdowntime > -1
&& joyGetButtonsOnSample(i, shootpad, shootallowedbuttons & Z_TRIG) == 0) {
if (g_Vars.currentplayer->invdowntime > TICKS(15)) {
amOpen();
/* amOpen(); */
g_Vars.currentplayer->invdowntime = -1;
} else {
g_Vars.currentplayer->invdowntime++;
@ -1285,7 +1285,7 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
if (g_Vars.currentplayer->invdowntime >= 0 && joyGetButtonsOnSample(i, contpad1, shootbuttons & c1allowedbuttons) == 0) {
// Holding A and haven't pressed Z
if (g_Vars.currentplayer->invdowntime > TICKS(15)) {
amOpen();
/* amOpen(); */
g_Vars.currentplayer->invdowntime = -1;
} else {
g_Vars.currentplayer->invdowntime++;
@ -1393,6 +1393,31 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
}
}
// Handle radial menu (D-Down)
for (i = 0; i < numsamples; i++) {
if (joyGetButtonsOnSample(i, contpad1, c1allowedbuttons & D_JPAD)) {
if (g_Vars.currentplayer->amdowntime < -2) {
g_Vars.currentplayer->amdowntime += numsamples;
if (g_Vars.currentplayer->amdowntime > -3) {
g_Vars.currentplayer->amdowntime = 0;
}
} else {
if (g_Vars.currentplayer->amdowntime >= 0) {
if (joyGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons & D_JPAD)) {
amOpen();
g_Vars.currentplayer->amdowntime = -1;
} else {
g_Vars.currentplayer->amdowntime++;
}
}
}
} else {
g_Vars.currentplayer->amdowntime = 0;
}
}
// Handle manual zoom in and out (sniper, farsight and horizon scanner)
if (canmanualzoom && g_Vars.currentplayer->insightaimmode) {
increment = 1;

View File

@ -2817,6 +2817,7 @@ struct player {
/*0x1c68*/ u32 unk1c68;
/*0x1c6c*/ u32 unk1c6c;
s16 altdowntime; // for alt-modes, used like invdowntime and amdowntime
s16 amdowntime; // for alt-modes, used like invdowntime and amdowntime
};
struct ailist {