[2.1] Item auto roulette can get stuck
The autoroulette can get stuck if a condition fails while the other succeeds:
First, if the elapsed time is an EXACT number, confirmItem
is set to true
:
https://git.do.srb2.org/KartKrew/RingRacers/-/blob/master/src/k_roulette.c?ref_type=heads#L1630
Afterwards, if confirmItem
is true
and the player is NOT in a ring use state, the final item is calculated and the roulette stops:
https://git.do.srb2.org/KartKrew/RingRacers/-/blob/master/src/k_roulette.c?ref_type=heads#L1642
Holding [ITEM] without an item gives the player the IF_USERINGS
item flag.
If the button is continued to be held when the item box is touched, the flag won't be cleared. Not even after the player is well without rings.
If the player continues holding the button past the 2 second mark (when autoroulette would normally stop) and releases it afterwards, the roulette will not stop: Instead, it will continue to roll until the 16 second timeout. Pressing the [ITEM] button during this state does not stop the roulette nor allows the player to use rings.
(If the ring usage is sustained, the roulette can be forced to continue rolling even after past the timeout.)
A possible solution would be to change the condition from being exact to just a larger than:
confirmItem = (roulette->elapsed == TICRATE*2);
to
confirmItem = (roulette->elapsed > TICRATE*2);
Issue in action:
ringracers_2024-04-29_16-55-56
(A mod has been loaded to set the round timer to an approximation (roulette fields are not exposed) of the roulette elapsed time.
Time starts when an item box has received the player mobj as a target. Time stops when the player has an item.
Mod: test_approxRoul.lua)