M_ChallengesTick: Speed up digesting pending rounds into Chao Keys if there's lots of them remaining

This commit is contained in:
toaster 2023-03-14 11:35:08 +00:00
parent 1fb0e0454f
commit 276b19e871

View file

@ -344,12 +344,28 @@ void M_ChallengesTick(void)
}
else
{
if (!(--gamedata->pendingkeyrounds & 1))
UINT32 keyexchange = gamedata->keyspending;
if (keyexchange > gamedata->pendingkeyrounds)
{
keyexchange = 1;
}
else if (keyexchange >= GDCONVERT_ROUNDSTOKEY/2)
{
keyexchange = GDCONVERT_ROUNDSTOKEY/2;
}
keyexchange |= 1; // guarantee an odd delta for the sake of the sound
gamedata->pendingkeyrounds -= keyexchange;
gamedata->pendingkeyroundoffset += keyexchange;
if (!(gamedata->pendingkeyrounds & 1))
{
S_StartSound(NULL, sfx_ptally);
}
if (++gamedata->pendingkeyroundoffset >= GDCONVERT_ROUNDSTOKEY)
if (gamedata->pendingkeyroundoffset >= GDCONVERT_ROUNDSTOKEY)
{
gamedata->pendingkeyroundoffset %= GDCONVERT_ROUNDSTOKEY;