Merge branch 'colour-persistence' into 'master'

Player colour persistence (resolves #255).

Closes #255

See merge request KartKrew/Kart!610
This commit is contained in:
Sal 2022-05-30 21:58:07 +00:00
commit 30f60585be

View file

@ -7679,7 +7679,6 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
void K_KartResetPlayerColor(player_t *player) void K_KartResetPlayerColor(player_t *player)
{ {
boolean forcereset = false;
boolean fullbright = false; boolean fullbright = false;
if (!player->mo || P_MobjWasRemoved(player->mo)) // Can't do anything if (!player->mo || P_MobjWasRemoved(player->mo)) // Can't do anything
@ -7695,9 +7694,9 @@ void K_KartResetPlayerColor(player_t *player)
if (player->eggmanexplode) // You're gonna diiiiie if (player->eggmanexplode) // You're gonna diiiiie
{ {
const INT32 flashtime = 4<<(player->eggmanexplode/TICRATE); const INT32 flashtime = 4<<(player->eggmanexplode/TICRATE);
if (player->eggmanexplode == 1 || (player->eggmanexplode % (flashtime/2) != 0)) if (player->eggmanexplode % (flashtime/2) != 0)
{ {
forcereset = true; ;
} }
else if (player->eggmanexplode % flashtime == 0) else if (player->eggmanexplode % flashtime == 0)
{ {
@ -7719,6 +7718,7 @@ void K_KartResetPlayerColor(player_t *player)
{ {
const tic_t defaultTime = itemtime+(2*TICRATE); const tic_t defaultTime = itemtime+(2*TICRATE);
tic_t flicker = 2; tic_t flicker = 2;
boolean skip = false;
fullbright = true; fullbright = true;
@ -7726,22 +7726,21 @@ void K_KartResetPlayerColor(player_t *player)
{ {
player->mo->color = K_RainbowColor(leveltime / 2); player->mo->color = K_RainbowColor(leveltime / 2);
player->mo->colorized = true; player->mo->colorized = true;
forcereset = false; skip = true;
} }
else else
{ {
flicker += (defaultTime - player->invincibilitytimer) / TICRATE / 2; flicker += (defaultTime - player->invincibilitytimer) / TICRATE / 2;
forcereset = true;
} }
if (leveltime % flicker == 0) if (leveltime % flicker == 0)
{ {
player->mo->color = SKINCOLOR_INVINCFLASH; player->mo->color = SKINCOLOR_INVINCFLASH;
player->mo->colorized = true; player->mo->colorized = true;
forcereset = false; skip = true;
} }
if (!forcereset) if (skip)
{ {
goto finalise; goto finalise;
} }
@ -7756,8 +7755,6 @@ void K_KartResetPlayerColor(player_t *player)
fullbright = true; fullbright = true;
goto finalise; goto finalise;
} }
forcereset = true;
} }
if (player->ringboost && (leveltime & 1)) // ring boosting if (player->ringboost && (leveltime & 1)) // ring boosting
@ -7769,10 +7766,7 @@ void K_KartResetPlayerColor(player_t *player)
else else
{ {
player->mo->colorized = (player->dye != 0); player->mo->colorized = (player->dye != 0);
if (forcereset) player->mo->color = player->dye ? player->dye : player->skincolor;
{
player->mo->color = player->dye ? player->dye : player->skincolor;
}
} }
finalise: finalise: