From 125646e521f5bffa3ccf67a181557d9019cd6261 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Tue, 4 Jul 2017 14:58:58 +0100 Subject: [PATCH] Some minor tweaks to make countdown not COMPLETELY broken. --- src/g_game.c | 18 ++++++++++-------- src/p_setup.c | 11 +++++++++++ src/p_tick.c | 4 +++- src/p_user.c | 3 --- 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 11ae16394..abffed4d2 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2499,6 +2499,7 @@ void G_DoReborn(INT32 playernum) { player_t *player = &players[playernum]; boolean resetlevel = false; + INT32 i; if (modeattacking) { @@ -2532,7 +2533,6 @@ void G_DoReborn(INT32 playernum) resetlevel = true; else if (gametype == GT_COOP && (netgame || multiplayer)) { - INT32 i; if (cv_cooplives.value == 0) ; else if (player->lives <= 0) // consider game over first @@ -2588,16 +2588,18 @@ void G_DoReborn(INT32 playernum) // reload the level from scratch if (countdowntimeup) { - player->starpostangle = 0; - player->starposttime = 0; - player->starpostx = 0; - player->starposty = 0; - player->starpostz = 0; - player->starpostnum = 0; + for (i = 0; i < MAXPLAYERS; i++) + { + players[i].starpostangle = 0; + players[i].starposttime = 0; + players[i].starpostx = 0; + players[i].starposty = 0; + players[i].starpostz = 0; + players[i].starpostnum = 0; + } } if (!countdowntimeup && (mapheaderinfo[gamemap-1]->levelflags & LF_NORELOAD)) { - INT32 i; player->playerstate = PST_REBORN; P_LoadThingsOnly(); P_ClearStarPost(player->starpostnum); diff --git a/src/p_setup.c b/src/p_setup.c index 3f346523b..49ee5e196 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2199,7 +2199,18 @@ static void P_LevelInitStuff(void) // map time limit if (mapheaderinfo[gamemap-1]->countdown) + { + tic_t maxtime = 0; countdowntimer = mapheaderinfo[gamemap-1]->countdown * TICRATE; + for (i = 0; i < MAXPLAYERS; i++) + { + if (!playeringame[i]) + continue; + if (players[i].starposttime > maxtime) + maxtime = players[i].starposttime; + } + countdowntimer -= maxtime; + } else countdowntimer = 0; countdowntimeup = false; diff --git a/src/p_tick.c b/src/p_tick.c index 1ef91ca82..a79d71ef4 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -650,7 +650,7 @@ void P_Ticker(boolean run) if (run) { - if (countdowntimer && --countdowntimer <= 0) + if (countdowntimer && G_PlatformGametype() && (gametype == GT_COOP || leveltime >= 4*TICRATE) && --countdowntimer <= 0) { countdowntimer = 0; countdowntimeup = true; @@ -662,6 +662,8 @@ void P_Ticker(boolean run) if (!players[i].mo) continue; + if (multiplayer || netgame) + players[i].exiting = 0; P_DamageMobj(players[i].mo, NULL, NULL, 1, DMG_INSTAKILL); } } diff --git a/src/p_user.c b/src/p_user.c index 86359cd83..21db4143b 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -6690,9 +6690,6 @@ static void P_MovePlayer(player_t *player) fixed_t runspd; - if (countdowntimeup) - return; - if (player->mo->state >= &states[S_PLAY_SUPER_TRANS] && player->mo->state <= &states[S_PLAY_SUPER_TRANS9]) { player->mo->momx = player->mo->momy = player->mo->momz = 0;