mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-27 11:40:52 +00:00
Update HUD anim counters when dead.
* Split out the HUD-related counters from K_KartPlayerThink() into their own function. * Called this function in P_DeathThink().
This commit is contained in:
parent
92d5a6b8fb
commit
3c480277aa
3 changed files with 52 additions and 38 deletions
79
src/k_kart.c
79
src/k_kart.c
|
@ -4023,6 +4023,47 @@ static void K_UpdateInvincibilitySounds(player_t *player)
|
||||||
#undef STOPTHIS
|
#undef STOPTHIS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void K_KartPlayerHUDUpdate(player_t *player)
|
||||||
|
{
|
||||||
|
if (player->kartstuff[k_lapanimation])
|
||||||
|
player->kartstuff[k_lapanimation]--;
|
||||||
|
|
||||||
|
if (player->kartstuff[k_yougotem])
|
||||||
|
player->kartstuff[k_yougotem]--;
|
||||||
|
|
||||||
|
if (G_BattleGametype() && (player->exiting || player->kartstuff[k_comebacktimer]))
|
||||||
|
{
|
||||||
|
if (player->exiting)
|
||||||
|
{
|
||||||
|
if (player->exiting < 6*TICRATE)
|
||||||
|
player->kartstuff[k_cardanimation] += ((164-player->kartstuff[k_cardanimation])/8)+1;
|
||||||
|
else if (player->exiting == 6*TICRATE)
|
||||||
|
player->kartstuff[k_cardanimation] = 0;
|
||||||
|
else if (player->kartstuff[k_cardanimation] < 2*TICRATE)
|
||||||
|
player->kartstuff[k_cardanimation]++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (player->kartstuff[k_comebacktimer] < 6*TICRATE)
|
||||||
|
player->kartstuff[k_cardanimation] -= ((164-player->kartstuff[k_cardanimation])/8)+1;
|
||||||
|
else if (player->kartstuff[k_comebacktimer] < 9*TICRATE)
|
||||||
|
player->kartstuff[k_cardanimation] += ((164-player->kartstuff[k_cardanimation])/8)+1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player->kartstuff[k_cardanimation] > 164)
|
||||||
|
player->kartstuff[k_cardanimation] = 164;
|
||||||
|
if (player->kartstuff[k_cardanimation] < 0)
|
||||||
|
player->kartstuff[k_cardanimation] = 0;
|
||||||
|
}
|
||||||
|
else if (G_RaceGametype() && player->exiting)
|
||||||
|
{
|
||||||
|
if (player->kartstuff[k_cardanimation] < 2*TICRATE)
|
||||||
|
player->kartstuff[k_cardanimation]++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
player->kartstuff[k_cardanimation] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/** \brief Decreases various kart timers and powers per frame. Called in P_PlayerThink in p_user.c
|
/** \brief Decreases various kart timers and powers per frame. Called in P_PlayerThink in p_user.c
|
||||||
|
|
||||||
\param player player object passed from P_PlayerThink
|
\param player player object passed from P_PlayerThink
|
||||||
|
@ -4233,43 +4274,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
||||||
if (player->kartstuff[k_justbumped])
|
if (player->kartstuff[k_justbumped])
|
||||||
player->kartstuff[k_justbumped]--;
|
player->kartstuff[k_justbumped]--;
|
||||||
|
|
||||||
if (player->kartstuff[k_lapanimation])
|
K_KartPlayerHUDUpdate(player);
|
||||||
player->kartstuff[k_lapanimation]--;
|
|
||||||
|
|
||||||
if (player->kartstuff[k_yougotem])
|
|
||||||
player->kartstuff[k_yougotem]--;
|
|
||||||
|
|
||||||
if (G_BattleGametype() && (player->exiting || player->kartstuff[k_comebacktimer]))
|
|
||||||
{
|
|
||||||
if (player->exiting)
|
|
||||||
{
|
|
||||||
if (player->exiting < 6*TICRATE)
|
|
||||||
player->kartstuff[k_cardanimation] += ((164-player->kartstuff[k_cardanimation])/8)+1;
|
|
||||||
else if (player->exiting == 6*TICRATE)
|
|
||||||
player->kartstuff[k_cardanimation] = 0;
|
|
||||||
else if (player->kartstuff[k_cardanimation] < 2*TICRATE)
|
|
||||||
player->kartstuff[k_cardanimation]++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (player->kartstuff[k_comebacktimer] < 6*TICRATE)
|
|
||||||
player->kartstuff[k_cardanimation] -= ((164-player->kartstuff[k_cardanimation])/8)+1;
|
|
||||||
else if (player->kartstuff[k_comebacktimer] < 9*TICRATE)
|
|
||||||
player->kartstuff[k_cardanimation] += ((164-player->kartstuff[k_cardanimation])/8)+1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player->kartstuff[k_cardanimation] > 164)
|
|
||||||
player->kartstuff[k_cardanimation] = 164;
|
|
||||||
if (player->kartstuff[k_cardanimation] < 0)
|
|
||||||
player->kartstuff[k_cardanimation] = 0;
|
|
||||||
}
|
|
||||||
else if (G_RaceGametype() && player->exiting)
|
|
||||||
{
|
|
||||||
if (player->kartstuff[k_cardanimation] < 2*TICRATE)
|
|
||||||
player->kartstuff[k_cardanimation]++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
player->kartstuff[k_cardanimation] = 0;
|
|
||||||
|
|
||||||
if (player->kartstuff[k_voices])
|
if (player->kartstuff[k_voices])
|
||||||
player->kartstuff[k_voices]--;
|
player->kartstuff[k_voices]--;
|
||||||
|
|
|
@ -24,6 +24,7 @@ void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid)
|
||||||
void K_MatchGenericExtraFlags(mobj_t *mo, mobj_t *master);
|
void K_MatchGenericExtraFlags(mobj_t *mo, mobj_t *master);
|
||||||
void K_RespawnChecker(player_t *player);
|
void K_RespawnChecker(player_t *player);
|
||||||
void K_KartMoveAnimation(player_t *player);
|
void K_KartMoveAnimation(player_t *player);
|
||||||
|
void K_KartPlayerHUDUpdate(player_t *player);
|
||||||
void K_KartPlayerThink(player_t *player, ticcmd_t *cmd);
|
void K_KartPlayerThink(player_t *player, ticcmd_t *cmd);
|
||||||
void K_KartPlayerAfterThink(player_t *player);
|
void K_KartPlayerAfterThink(player_t *player);
|
||||||
void K_DoInstashield(player_t *player);
|
void K_DoInstashield(player_t *player);
|
||||||
|
|
10
src/p_user.c
10
src/p_user.c
|
@ -7946,6 +7946,8 @@ static void P_DeathThink(player_t *player)
|
||||||
else
|
else
|
||||||
player->kartstuff[k_timeovercam] = 0;
|
player->kartstuff[k_timeovercam] = 0;
|
||||||
|
|
||||||
|
K_KartPlayerHUDUpdate(player);
|
||||||
|
|
||||||
if (player->deadtimer < INT32_MAX)
|
if (player->deadtimer < INT32_MAX)
|
||||||
player->deadtimer++;
|
player->deadtimer++;
|
||||||
|
|
||||||
|
@ -7984,6 +7986,9 @@ static void P_DeathThink(player_t *player)
|
||||||
if (!player->mo)
|
if (!player->mo)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
player->mo->colorized = false;
|
||||||
|
player->mo->color = player->skincolor;
|
||||||
|
|
||||||
P_CalcHeight(player);
|
P_CalcHeight(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9098,7 +9103,10 @@ void P_PlayerThink(player_t *player)
|
||||||
|
|
||||||
if (player->playerstate == PST_DEAD)
|
if (player->playerstate == PST_DEAD)
|
||||||
{
|
{
|
||||||
player->mo->flags2 &= ~MF2_SHADOW;
|
if (player->spectator)
|
||||||
|
player->mo->flags2 |= MF2_SHADOW;
|
||||||
|
else
|
||||||
|
player->mo->flags2 &= ~MF2_SHADOW;
|
||||||
P_DeathThink(player);
|
P_DeathThink(player);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue