From 9a56b3ce36cb3d1b0a84cf81b3c79e5a4f77de30 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Thu, 4 May 2023 22:04:04 +1000 Subject: [PATCH] Fix random aimer taps when there's no controller samples --- src/game/bondmove.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/game/bondmove.c b/src/game/bondmove.c index c30a6dc9b..0f1965214 100644 --- a/src/game/bondmove.c +++ b/src/game/bondmove.c @@ -731,12 +731,14 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i } if (optionsGetAimControl(g_Vars.currentplayerstats->mpindex) == AIMCONTROL_HOLD) { - for (i = 0; i < numsamples; i++) { - aimonhist[i] = allowc1buttons && joyGetButtonsOnSample(i, aimpad, aimallowedbuttons & Z_TRIG); - aimoffhist[i] = !aimonhist[i]; - } + if (numsamples) { + for (i = 0; i < numsamples; i++) { + aimonhist[i] = allowc1buttons && joyGetButtonsOnSample(i, aimpad, aimallowedbuttons & Z_TRIG); + aimoffhist[i] = !aimonhist[i]; + } - g_Vars.currentplayer->insightaimmode = aimonhist[numsamples - 1]; + g_Vars.currentplayer->insightaimmode = aimonhist[numsamples - 1]; + } } if (!lvIsPaused()) { @@ -1034,12 +1036,14 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i } if (optionsGetAimControl(g_Vars.currentplayerstats->mpindex) == AIMCONTROL_HOLD) { - for (i = 0; i < numsamples; i++) { - aimonhist[i] = allowc1buttons && joyGetButtonsOnSample(i, contpad1, aimbuttons & c1allowedbuttons); - aimoffhist[i] = !aimonhist[i]; - } + if (numsamples) { + for (i = 0; i < numsamples; i++) { + aimonhist[i] = allowc1buttons && joyGetButtonsOnSample(i, contpad1, aimbuttons & c1allowedbuttons); + aimoffhist[i] = !aimonhist[i]; + } - g_Vars.currentplayer->insightaimmode = aimonhist[numsamples - 1]; + g_Vars.currentplayer->insightaimmode = aimonhist[numsamples - 1]; + } } if (!lvIsPaused()) {