From 5e76ea6f8fe89e27cc8c15de07c71d8b933876b3 Mon Sep 17 00:00:00 2001 From: toaster Date: Tue, 30 May 2023 00:40:00 +0100 Subject: [PATCH 1/4] K_StartCeremony: Directly modify spectator status for bots as early as possible The problem with bots randomly going towards the same spot in podium was... - If you failed a Sealed Star, K_UpdateGrandPrixBots wouldn't make the puppies non-spectators - P_SpawnPlayer catches the spectator status... - ...but it's in a loop that calls K_GetPodiumPosition... - ...which ignores spectators... - ...which means this is too late to catch it, so we simply have to do it earlier. Also short circuits P_SpawnPlayer's and K_UpdateGrandPrixBot's attempts to set so the author of this commit can be certain what is being done is correct --- src/k_grandprix.c | 4 ++++ src/k_podium.c | 8 ++++++-- src/p_mobj.c | 7 +++++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/k_grandprix.c b/src/k_grandprix.c index 6b19b8f06..151ab7724 100644 --- a/src/k_grandprix.c +++ b/src/k_grandprix.c @@ -17,6 +17,7 @@ #include "g_game.h" #include "k_bot.h" #include "k_kart.h" +#include "k_podium.h" #include "m_random.h" #include "p_local.h" #include "r_things.h" @@ -326,6 +327,9 @@ void K_UpdateGrandPrixBots(void) UINT16 newrivalscore = 0; UINT8 i; + if (K_PodiumSequence()) + return; + for (i = 0; i < MAXPLAYERS; i++) { if (!playeringame[i] || !players[i].bot) diff --git a/src/k_podium.c b/src/k_podium.c index 0a33844de..46de1eb79 100644 --- a/src/k_podium.c +++ b/src/k_podium.c @@ -258,9 +258,13 @@ boolean K_StartCeremony(void) // and be present for the podium for (i = 0; i < MAXPLAYERS; i++) { - if (playeringame[i] && !players[i].spectator && !players[i].bot) + if (playeringame[i]) { - players[i].lives = max(1, players[i].lives); + if (players[i].lives < 1) + players[i].lives = 1; + + if (players[i].bot) + players[i].spectator = false; } } diff --git a/src/p_mobj.c b/src/p_mobj.c index fbe4d90c2..4d87491b1 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -11645,8 +11645,11 @@ void P_SpawnPlayer(INT32 playernum) } else if (p->bot) { - if (K_PodiumSequence() == false - && (!(gametyperules & GTR_BOTS) || (grandprixinfo.gp == true && grandprixinfo.eventmode != GPEVENT_NONE))) + if (K_PodiumSequence() == true) + ; // This is too late to correct spectator status. Whatever state we're in at this point, our (dog) bed is made. + else if (!(gametyperules & GTR_BOTS) + || (grandprixinfo.gp == true + && grandprixinfo.eventmode != GPEVENT_NONE)) { // Bots aren't supposed to be here. p->spectator = true; From f9b1bdf2bc0edb2bc83df0c7ed99d1c820b92601 Mon Sep 17 00:00:00 2001 From: toaster Date: Tue, 30 May 2023 00:41:28 +0100 Subject: [PATCH 2/4] K_CalculateGPGrade: Do not penalise for a cup that has no Prisons/Laps at all, so Sealed Star can be reached with numlaps 0/custom Cup with no battle levels --- src/k_rank.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/k_rank.c b/src/k_rank.c index ec69c78c8..61c5a49c6 100644 --- a/src/k_rank.c +++ b/src/k_rank.c @@ -360,8 +360,8 @@ gp_rank_e K_CalculateGPGrade(gpRank_t *rankData) const INT32 positionWeight = 150; const INT32 pointsWeight = 100; - const INT32 lapsWeight = 100; - const INT32 prisonsWeight = 100; + const INT32 lapsWeight = (rankData->totalLaps > 0) ? 100 : 0; + const INT32 prisonsWeight = (rankData->totalPrisons > 0) ? 100 : 0; const INT32 ringsWeight = 50; const INT32 total = positionWeight + pointsWeight + lapsWeight + prisonsWeight + ringsWeight; const INT32 continuesPenalty = 20; From f24df4f38d256aede92bb709226b495104234778 Mon Sep 17 00:00:00 2001 From: toaster Date: Tue, 30 May 2023 01:05:20 +0100 Subject: [PATCH 3/4] Remove the interp-caused jitter from cutaway camera behaviour It is preferable that smash cuts reset view interpolation IMO --- src/p_spec.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/p_spec.c b/src/p_spec.c index ccc40d337..aa1411f74 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -3026,6 +3026,7 @@ boolean P_ProcessSpecial(activator_t *activator, INT16 special, INT32 *args, cha { altview_t *modifyView = NULL; mobj_t *newViewMobj = NULL; + INT32 i; if (gamestate != GS_LEVEL) { @@ -3052,10 +3053,20 @@ boolean P_ProcessSpecial(activator_t *activator, INT16 special, INT32 *args, cha { // If titlemap, awayview.tics is ignored modifyView->tics = -1; + + R_ResetViewInterpolation(0); } else { modifyView->tics = args[1]; + + for (i = 0; i <= r_splitscreen; i++) + { + if (displayplayers[i] == (mo->player - players)) + { + R_ResetViewInterpolation(i + 1); + } + } } if (args[2] != 0) @@ -3067,7 +3078,6 @@ boolean P_ProcessSpecial(activator_t *activator, INT16 special, INT32 *args, cha case TMCAM_THIRD: { mobj_t *firstPlace = NULL; - INT32 i; for (i = 0; i < MAXPLAYERS; i++) { From 36d81d7996faa83a9c355da50e0d9768d2d03de7 Mon Sep 17 00:00:00 2001 From: toaster Date: Tue, 30 May 2023 01:12:59 +0100 Subject: [PATCH 4/4] Final lack of smoothness in camera cutaway killed: A one-frame window where focus angle/pitch was incorrect due to not having thunk yet --- src/p_mobj.c | 1 + src/p_spec.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/p_mobj.c b/src/p_mobj.c index 4d87491b1..d8adcea8a 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9463,6 +9463,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj) } // If target is valid, then we'll focus on it. + // See also linedef type 422 if (mobj->target != NULL && P_MobjWasRemoved(mobj->target) == false) { mobj->angle = R_PointToAngle2( diff --git a/src/p_spec.c b/src/p_spec.c index aa1411f74..244f2ae6d 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -3135,6 +3135,28 @@ boolean P_ProcessSpecial(activator_t *activator, INT16 special, INT32 *args, cha break; } } + + // If target is valid, then we'll focus on it. + // See also MT_ALTVIEWMAN mobjthinker + if (newViewMobj->target != NULL && P_MobjWasRemoved(newViewMobj->target) == false) + { + newViewMobj->angle = R_PointToAngle2( + newViewMobj->x, + newViewMobj->y, + newViewMobj->target->x, + newViewMobj->target->y + ); + + newViewMobj->pitch = R_PointToAngle2( + 0, + newViewMobj->z, + R_PointToDist2( + newViewMobj->x, newViewMobj->y, + newViewMobj->target->x, newViewMobj->target->y + ), + newViewMobj->target->z + (newViewMobj->target->height >> 1) + ); + } } else {