From e5fef95d949d9346a43f943c010086ebf91e4029 Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 25 Nov 2018 13:30:43 +0000 Subject: [PATCH 1/2] Sound volume distance indication now scales with mapheader scale. --- src/k_kart.c | 2 ++ src/s_sound.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index 4403dd4a..a63b7230 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -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<mobj_scale); // approx_dist } // From 3c480277aa64248740610c4e8e7dabcdc59c2d31 Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 25 Nov 2018 13:48:46 +0000 Subject: [PATCH 2/2] 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(). --- src/k_kart.c | 79 ++++++++++++++++++++++++++++------------------------ src/k_kart.h | 1 + src/p_user.c | 10 ++++++- 3 files changed, 52 insertions(+), 38 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 4403dd4a..3f3f80ee 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -4023,6 +4023,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,43 +4274,7 @@ 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]--; - - 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]--; diff --git a/src/k_kart.h b/src/k_kart.h index 8f8cd100..3edbf0bd 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -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); diff --git a/src/p_user.c b/src/p_user.c index b2849c85..4f8b4234 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7946,6 +7946,8 @@ static void P_DeathThink(player_t *player) else player->kartstuff[k_timeovercam] = 0; + K_KartPlayerHUDUpdate(player); + if (player->deadtimer < INT32_MAX) player->deadtimer++; @@ -7984,6 +7986,9 @@ static void P_DeathThink(player_t *player) if (!player->mo) return; + player->mo->colorized = false; + player->mo->color = player->skincolor; + P_CalcHeight(player); } @@ -9098,7 +9103,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;