port: only allow crouch cycling when crouching is allowed

This commit is contained in:
fgsfds committed 2023-10-22 15:22:01 +02:00
1 parent 4c1076080d
commit 0b9f99a084
1 file changed
+31 -31
+31 -31
View File
@@ -1536,6 +1536,37 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
g_Vars.currentplayer->amdowntime = 0;
}
}
// Handle xbla-style crouch cycling
for (i = 0; i < numsamples; i++) {
s32 crouchsample = joyGetButtonsPressedOnSample(i, contpad1, 0xffffffff) & BUTTON_CROUCH_CYCLE;
if (crouchsample) {
if (g_Vars.currentplayer->crouchpos <= 0) {
g_Vars.currentplayer->crouchpos = CROUCHPOS_STAND;
} else {
g_Vars.currentplayer->crouchpos--;
}
}
// handle 1964GEPD style crouch setting
crouchsample = joyGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons) & BUTTON_HALF_CROUCH;
if (crouchsample) {
if (g_Vars.currentplayer->crouchpos == CROUCHPOS_DUCK) {
g_Vars.currentplayer->crouchpos = CROUCHPOS_STAND;
} else {
g_Vars.currentplayer->crouchpos = CROUCHPOS_DUCK;
}
}
crouchsample = joyGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons) & BUTTON_FULL_CROUCH;
if (crouchsample) {
if (g_Vars.currentplayer->crouchpos == CROUCHPOS_SQUAT) {
g_Vars.currentplayer->crouchpos = CROUCHPOS_STAND;
} else {
g_Vars.currentplayer->crouchpos = CROUCHPOS_SQUAT;
}
}
}
}
// Handle manual zoom in and out (sniper, farsight and horizon scanner)
@@ -1577,37 +1608,6 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
movedata.zoominfovpersec = movedata.zoominfovpersec + movedata.zoominfovpersec;
}
}
// Handle xbla-style crouch cycling
for (i = 0; i < numsamples; i++) {
s32 crouchsample = joyGetButtonsPressedOnSample(i, contpad1, 0xffffffff) & BUTTON_CROUCH_CYCLE;
if (crouchsample) {
if (g_Vars.currentplayer->crouchpos <= 0) {
g_Vars.currentplayer->crouchpos = CROUCHPOS_STAND;
} else {
g_Vars.currentplayer->crouchpos--;
}
}
// handle 1964GEPD style crouch setting
crouchsample = joyGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons) & BUTTON_HALF_CROUCH;
if (crouchsample) {
if (g_Vars.currentplayer->crouchpos == CROUCHPOS_DUCK) {
g_Vars.currentplayer->crouchpos = CROUCHPOS_STAND;
} else {
g_Vars.currentplayer->crouchpos = CROUCHPOS_DUCK;
}
}
crouchsample = joyGetButtonsPressedOnSample(i, contpad1, c1allowedbuttons) & BUTTON_FULL_CROUCH;
if (crouchsample) {
if (g_Vars.currentplayer->crouchpos == CROUCHPOS_SQUAT) {
g_Vars.currentplayer->crouchpos = CROUCHPOS_STAND;
} else {
g_Vars.currentplayer->crouchpos = CROUCHPOS_SQUAT;
}
}
}
#else
// Handle manual zoom in and out (sniper, farsight and horizon scanner)
if (canmanualzoom && g_Vars.currentplayer->insightaimmode) {