mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Correct player colour persistence, *actually* resolving #255.
An explanation for the approach: I started writing a whole system where an extra pflag would be defined for "colour is not currently the player's ACTUAL colour". Then I looked at the actual code flow that would be affected by it - the single line guarded by `if (forcereset)` - and decided it was simpler to just do an extra write in this once-per-player-per-frame function instead of increasing across-the-board complexity.
This commit is contained in:
parent
286f1c34a5
commit
80f2111f00
1 changed files with 7 additions and 13 deletions
20
src/k_kart.c
20
src/k_kart.c
|
|
@ -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:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue