mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
* Restore player colour and colorization correctly when the Eggman Mark concludes its effect.
* Allow colorisation types to not completely crowd each other out.
* For example, it's possible for invincibility + grow to flicker Invincibility, Eggman mark, and grow colours if the conditions for each type of flash are true on different frames!
This commit is contained in:
parent
14053a55cd
commit
17d007d418
6 changed files with 57 additions and 33 deletions
|
|
@ -1447,8 +1447,7 @@ static void SendNameAndColor(UINT8 n)
|
|||
|
||||
player->skincolor = cv_playercolor[n].value;
|
||||
|
||||
if (player->mo && !player->dye)
|
||||
player->mo->color = player->skincolor;
|
||||
K_KartResetPlayerColor(player);
|
||||
|
||||
// Update follower for local games:
|
||||
if (cv_follower[n].value >= -1 && cv_follower[n].value != player->followerskin)
|
||||
|
|
|
|||
65
src/k_kart.c
65
src/k_kart.c
|
|
@ -3548,8 +3548,7 @@ static void K_RemoveGrowShrink(player_t *player)
|
|||
else if (player->growshrinktimer < 0) // Play Grow noise
|
||||
S_StartSound(player->mo, sfx_kc5a);
|
||||
|
||||
if (player->invincibilitytimer == 0)
|
||||
player->mo->color = player->skincolor;
|
||||
K_KartResetPlayerColor(player);
|
||||
|
||||
player->mo->scalespeed = mapobjectscale/TICRATE;
|
||||
player->mo->destscale = mapobjectscale;
|
||||
|
|
@ -7571,6 +7570,9 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
|||
if (player->eggmanexplode <= 0)
|
||||
{
|
||||
mobj_t *eggsexplode;
|
||||
|
||||
K_KartResetPlayerColor(player);
|
||||
|
||||
//player->flashing = 0;
|
||||
eggsexplode = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_SPBEXPLOSION);
|
||||
if (player->eggmanblame >= 0
|
||||
|
|
@ -7650,37 +7652,45 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
|||
K_HandleDelayedHitByEm(player);
|
||||
}
|
||||
|
||||
void K_KartPlayerAfterThink(player_t *player)
|
||||
void K_KartResetPlayerColor(player_t *player)
|
||||
{
|
||||
boolean forcereset = false;
|
||||
boolean fullbright = false;
|
||||
|
||||
if (player->playerstate == PST_DEAD || (player->respawn.state == RESPAWNST_MOVE)) // Ensure these are set correctly here
|
||||
if (!player->mo || P_MobjWasRemoved(player->mo)) // Can't do anything
|
||||
return;
|
||||
|
||||
if (player->mo->health <= 0 || player->playerstate == PST_DEAD || (player->respawn.state == RESPAWNST_MOVE)) // Override everything
|
||||
{
|
||||
player->mo->colorized = (player->dye != 0);
|
||||
player->mo->color = player->dye ? player->dye : player->skincolor;
|
||||
goto finalise;
|
||||
}
|
||||
else if (player->eggmanexplode) // You're gonna diiiiie
|
||||
|
||||
if (player->eggmanexplode) // You're gonna diiiiie
|
||||
{
|
||||
const INT32 flashtime = 4<<(player->eggmanexplode/TICRATE);
|
||||
if (player->eggmanexplode == 1 || (player->eggmanexplode % (flashtime/2) != 0))
|
||||
{
|
||||
player->mo->colorized = (player->dye != 0);
|
||||
player->mo->color = player->dye ? player->dye : player->skincolor;
|
||||
forcereset = true;
|
||||
}
|
||||
else if (player->eggmanexplode % flashtime == 0)
|
||||
{
|
||||
player->mo->colorized = true;
|
||||
player->mo->color = SKINCOLOR_BLACK;
|
||||
fullbright = true;
|
||||
goto finalise;
|
||||
}
|
||||
else
|
||||
{
|
||||
player->mo->colorized = true;
|
||||
player->mo->color = SKINCOLOR_CRIMSON;
|
||||
fullbright = true;
|
||||
goto finalise;
|
||||
}
|
||||
}
|
||||
else if (player->invincibilitytimer)
|
||||
|
||||
if (player->invincibilitytimer) // You're gonna kiiiiill
|
||||
{
|
||||
const tic_t defaultTime = itemtime+(2*TICRATE);
|
||||
tic_t flicker = 2;
|
||||
|
|
@ -7691,44 +7701,56 @@ void K_KartPlayerAfterThink(player_t *player)
|
|||
{
|
||||
player->mo->color = K_RainbowColor(leveltime / 2);
|
||||
player->mo->colorized = true;
|
||||
forcereset = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
player->mo->color = player->skincolor;
|
||||
player->mo->colorized = false;
|
||||
|
||||
flicker += (defaultTime - player->invincibilitytimer) / TICRATE / 2;
|
||||
forcereset = true;
|
||||
}
|
||||
|
||||
if (leveltime % flicker == 0)
|
||||
{
|
||||
player->mo->color = SKINCOLOR_INVINCFLASH;
|
||||
player->mo->colorized = true;
|
||||
forcereset = false;
|
||||
}
|
||||
|
||||
if (!forcereset)
|
||||
{
|
||||
goto finalise;
|
||||
}
|
||||
}
|
||||
else if (player->growshrinktimer) // Ditto, for grow/shrink
|
||||
|
||||
if (player->growshrinktimer) // Ditto, for grow/shrink
|
||||
{
|
||||
if (player->growshrinktimer % 5 == 0)
|
||||
{
|
||||
player->mo->colorized = true;
|
||||
player->mo->color = (player->growshrinktimer < 0 ? SKINCOLOR_CREAMSICLE : SKINCOLOR_PERIWINKLE);
|
||||
fullbright = true;
|
||||
goto finalise;
|
||||
}
|
||||
else
|
||||
{
|
||||
player->mo->colorized = (player->dye != 0);
|
||||
player->mo->color = player->dye ? player->dye : player->skincolor;
|
||||
|
||||
forcereset = true;
|
||||
}
|
||||
}
|
||||
else if (player->ringboost && (leveltime & 1)) // ring boosting
|
||||
|
||||
if (player->ringboost && (leveltime & 1)) // ring boosting
|
||||
{
|
||||
player->mo->colorized = true;
|
||||
fullbright = true;
|
||||
goto finalise;
|
||||
}
|
||||
else
|
||||
{
|
||||
player->mo->colorized = (player->dye != 0);
|
||||
if (forcereset)
|
||||
{
|
||||
player->mo->color = player->dye ? player->dye : player->skincolor;
|
||||
}
|
||||
}
|
||||
|
||||
finalise:
|
||||
|
||||
if (player->curshield)
|
||||
{
|
||||
|
|
@ -7744,6 +7766,11 @@ void K_KartPlayerAfterThink(player_t *player)
|
|||
if (!(player->mo->state->frame & FF_FULLBRIGHT))
|
||||
player->mo->frame &= ~FF_FULLBRIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
void K_KartPlayerAfterThink(player_t *player)
|
||||
{
|
||||
K_KartResetPlayerColor(player);
|
||||
|
||||
// Move held objects (Bananas, Orbinaut, etc)
|
||||
K_MoveHeldObjects(player);
|
||||
|
|
@ -8859,6 +8886,8 @@ void K_StripOther(player_t *player)
|
|||
{
|
||||
player->eggmanexplode = 0;
|
||||
player->eggmanblame = -1;
|
||||
|
||||
K_KartResetPlayerColor(player);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ void K_SpawnInvincibilitySpeedLines(mobj_t *mo);
|
|||
void K_SpawnBumpEffect(mobj_t *mo);
|
||||
void K_KartMoveAnimation(player_t *player);
|
||||
void K_KartPlayerHUDUpdate(player_t *player);
|
||||
void K_KartResetPlayerColor(player_t *player);
|
||||
void K_KartPlayerThink(player_t *player, ticcmd_t *cmd);
|
||||
void K_KartPlayerAfterThink(player_t *player);
|
||||
angle_t K_MomentumAngle(mobj_t *mo);
|
||||
|
|
|
|||
|
|
@ -1767,8 +1767,7 @@ static boolean P_KillPlayer(player_t *player, mobj_t *inflictor, mobj_t *source,
|
|||
|
||||
player->carry = CR_NONE;
|
||||
|
||||
player->mo->color = player->skincolor;
|
||||
player->mo->colorized = false;
|
||||
K_KartResetPlayerColor(player);
|
||||
|
||||
P_ResetPlayer(player);
|
||||
|
||||
|
|
|
|||
|
|
@ -1691,8 +1691,7 @@ static void P_CheckInvincibilityTimer(player_t *player)
|
|||
// Resume normal music stuff.
|
||||
if (player->invincibilitytimer == 1)
|
||||
{
|
||||
player->mo->color = player->skincolor;
|
||||
player->mo->colorized = false;
|
||||
//K_KartResetPlayerColor(player); -- this gets called every tic anyways
|
||||
G_GhostAddColor((INT32) (player - players), GHC_NORMAL);
|
||||
|
||||
P_RestoreMusic(player);
|
||||
|
|
@ -2679,8 +2678,7 @@ static void P_DeathThink(player_t *player)
|
|||
if (!player->mo)
|
||||
return;
|
||||
|
||||
player->mo->colorized = false;
|
||||
player->mo->color = player->skincolor;
|
||||
//K_KartResetPlayerColor(player); -- called at death, don't think we need to re-establish
|
||||
|
||||
P_CalcHeight(player);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,9 @@
|
|||
#include "p_local.h"
|
||||
#include "dehacked.h" // get_number (for thok)
|
||||
#include "m_cond.h"
|
||||
#if 0
|
||||
#include "k_kart.h" // K_KartResetPlayerColor
|
||||
#endif
|
||||
#ifdef HWRENDER
|
||||
#include "hardware/hw_md2.h"
|
||||
#endif
|
||||
|
|
@ -285,7 +288,7 @@ void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum)
|
|||
{
|
||||
player_t *player = &players[playernum];
|
||||
skin_t *skin = &skins[skinnum];
|
||||
UINT16 newcolor = 0;
|
||||
//UINT16 newcolor = 0;
|
||||
//UINT8 i;
|
||||
|
||||
if (skinnum >= 0 && skinnum < numskins && R_SkinUsable(playernum, skinnum)) // Make sure it exists!
|
||||
|
|
@ -311,6 +314,7 @@ void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum)
|
|||
}
|
||||
|
||||
player->skincolor = newcolor = skin->prefcolor;
|
||||
K_KartResetPlayerColor(player);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -323,12 +327,6 @@ void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum)
|
|||
if (player->mo)
|
||||
{
|
||||
player->mo->skin = skin;
|
||||
|
||||
if (newcolor)
|
||||
{
|
||||
player->mo->color = newcolor;
|
||||
}
|
||||
|
||||
P_SetScale(player->mo, player->mo->scale);
|
||||
P_SetPlayerMobjState(player->mo, player->mo->state-states); // Prevent visual errors when switching between skins with differing number of frames
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue