From 7e0d5a479ce9d2d537c462d3159e96a1471e92bf Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 19 Jul 2018 01:27:36 +0100 Subject: [PATCH] Fix the egregrious bugs from our last testing netgame. * Made Got_Teamchange's level-based stuff only happen in GS_LEVEL. * If, by chance, DoTimeOver gets called on a player without an object, it won't crash either. * Make ending music play when you get time overed. * Make changing-to-spectators get removed from the intermission drawer. --- src/d_netcmd.c | 3 +++ src/p_user.c | 9 +++++++-- src/y_inter.c | 11 +++-------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 24dc57e6..8357e99b 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3232,6 +3232,9 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum) } } + if (gamestate != GS_LEVEL) + return; + // Clear player score and rings if a spectator. if (players[playernum].spectator) { diff --git a/src/p_user.c b/src/p_user.c index 787da82a..a46d04b7 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -9065,9 +9065,14 @@ void P_DoTimeOver(player_t *player) && !demoplayback) legitimateexit = true; // SRB2kart: losing a race is still seeing it through to the end :p - S_StopSound(player->mo); - P_DamageMobj(player->mo, NULL, NULL, 10000); + if (player->mo) + { + S_StopSound(player->mo); + P_DamageMobj(player->mo, NULL, NULL, 10000); + } player->lives = 0; + + P_EndingMusic(player); } // diff --git a/src/y_inter.c b/src/y_inter.c index 2050711c..24bbff32 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -337,9 +337,6 @@ void Y_IntermissionDrawer(void) char name[MAXPLAYERNAME+1]; const char *timeheader = (intertype == int_race) ? "TIME" : "HITS"; - boolean completed[MAXPLAYERS]; - memset(completed, 0, sizeof (completed)); - // draw the level name V_DrawCenteredString(-4 + x + BASEVIDWIDTH/2, 20, 0, data.match.levelstring); V_DrawFill(x, 42, 312, 1, 0); @@ -369,12 +366,12 @@ void Y_IntermissionDrawer(void) for (i = 0; i < data.match.numplayers; i++) { - V_DrawCenteredString(x+6, y, 0, va("%d", data.match.pos[i])); - - if (data.match.num[i] != MAXPLAYERS && playeringame[data.match.num[i]]) + if (data.match.num[i] != MAXPLAYERS && playeringame[data.match.num[i]] && !players[data.match.num[i]].spectator) { char strtime[10]; + V_DrawCenteredString(x+6, y, 0, va("%d", data.match.pos[i])); + if (data.match.color[i] == 0) V_DrawSmallScaledPatch(x+16, y-4, 0,faceprefix[*data.match.character[i]]); else @@ -442,8 +439,6 @@ void Y_IntermissionDrawer(void) } } } - - completed[i] = true; } else data.match.num[i] = MAXPLAYERS;