Merge branch 'master' into 102-gameplay

This commit is contained in:
TehRealSalt 2018-11-26 10:14:41 -05:00
commit 732e0447a5
4 changed files with 56 additions and 39 deletions

View file

@ -3966,6 +3966,8 @@ static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd)
dist = P_AproxDistance(P_AproxDistance(player->mo->x-players[i].mo->x, dist = P_AproxDistance(P_AproxDistance(player->mo->x-players[i].mo->x,
player->mo->y-players[i].mo->y), player->mo->z-players[i].mo->z) / 2; player->mo->y-players[i].mo->y), player->mo->z-players[i].mo->z) / 2;
dist = FixedDiv(dist, mapheaderinfo[gamemap-1]->mobj_scale);
if (dist > 1536<<FRACBITS) if (dist > 1536<<FRACBITS)
continue; continue;
else if (dist < 160<<FRACBITS) // engine sounds' approx. range else if (dist < 160<<FRACBITS) // engine sounds' approx. range
@ -4023,6 +4025,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,49 +4276,14 @@ 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]) // This doesn't go in HUD update because it has potential gameplay ramifications
player->kartstuff[k_lapanimation]--;
if (player->kartstuff[k_yougotem])
player->kartstuff[k_yougotem]--;
if (player->kartstuff[k_itemblink] && player->kartstuff[k_itemblink]-- <= 0) if (player->kartstuff[k_itemblink] && player->kartstuff[k_itemblink]-- <= 0)
{ {
player->kartstuff[k_itemblinkmode] = 0; player->kartstuff[k_itemblinkmode] = 0;
player->kartstuff[k_itemblink] = 0; player->kartstuff[k_itemblink] = 0;
} }
if (G_BattleGametype() && (player->exiting || player->kartstuff[k_comebacktimer])) K_KartPlayerHUDUpdate(player);
{
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]--;

View file

@ -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);

View file

@ -7949,6 +7949,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++;
@ -7987,6 +7989,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);
} }
@ -9101,6 +9106,9 @@ void P_PlayerThink(player_t *player)
if (player->playerstate == PST_DEAD) if (player->playerstate == PST_DEAD)
{ {
if (player->spectator)
player->mo->flags2 |= MF2_SHADOW;
else
player->mo->flags2 &= ~MF2_SHADOW; player->mo->flags2 &= ~MF2_SHADOW;
P_DeathThink(player); P_DeathThink(player);

View file

@ -1199,7 +1199,7 @@ fixed_t S_CalculateSoundDistance(fixed_t sx1, fixed_t sy1, fixed_t sz1, fixed_t
approx_dist <<= FRACBITS; approx_dist <<= FRACBITS;
return approx_dist; return FixedDiv(approx_dist, mapheaderinfo[gamemap-1]->mobj_scale); // approx_dist
} }
// //