Skip to content

Fix softlock on old special stages when running out of time due to being hit

Hanicef requested to merge Hanicef/SRB2:fix-time-old-special-softlock into next

On old special stages, the game can softlock if the player runs out of time due to being hit. This happens because of an integer underflow in the time ticker, where if the player would be hit for the last 5 seconds, the timer would reset to 0 in order to cause the player to register as finished. However, the check that actually ensures that the timer have run out decrements the timer first before checking if it's out, which causes it to underflow into a very large integer instead and thus fail the check.

This happens most notably on CyberDime Realm's special stages, where getting hit by any of the spikes within 5 seconds of running out of time will trigger the softlock. This patch fixes this by setting the timer to 1 instead in that case, so the decrement later turns it to 0 and correctly marks the player as finished.

Merge request reports