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,
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)
continue;
else if (dist < 160<<FRACBITS) // engine sounds' approx. range
@ -4023,6 +4025,47 @@ static void K_UpdateInvincibilitySounds(player_t *player)
#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
\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])
player->kartstuff[k_justbumped]--;
if (player->kartstuff[k_lapanimation])
player->kartstuff[k_lapanimation]--;
if (player->kartstuff[k_yougotem])
player->kartstuff[k_yougotem]--;
// This doesn't go in HUD update because it has potential gameplay ramifications
if (player->kartstuff[k_itemblink] && player->kartstuff[k_itemblink]-- <= 0)
{
player->kartstuff[k_itemblinkmode] = 0;
player->kartstuff[k_itemblink] = 0;
}
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;
K_KartPlayerHUDUpdate(player);
if (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_RespawnChecker(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_KartPlayerAfterThink(player_t *player);
void K_DoInstashield(player_t *player);

View file

@ -7949,6 +7949,8 @@ static void P_DeathThink(player_t *player)
else
player->kartstuff[k_timeovercam] = 0;
K_KartPlayerHUDUpdate(player);
if (player->deadtimer < INT32_MAX)
player->deadtimer++;
@ -7987,6 +7989,9 @@ static void P_DeathThink(player_t *player)
if (!player->mo)
return;
player->mo->colorized = false;
player->mo->color = player->skincolor;
P_CalcHeight(player);
}
@ -9101,7 +9106,10 @@ void P_PlayerThink(player_t *player)
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);
return;

View file

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