From 8814980a06acfcc1493b20828a5671594f9bc2e4 Mon Sep 17 00:00:00 2001 From: Riku Salminen <38985578+Riku-S@users.noreply.github.com> Date: Sat, 14 Nov 2020 19:18:36 +0200 Subject: [PATCH 1/4] Emeralds and tokens now reset when restarting marathon mode in first level --- src/g_game.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/g_game.c b/src/g_game.c index 228295b62..528721e2f 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2218,6 +2218,10 @@ void G_Ticker(boolean run) { marathonmode |= MA_INIT; marathontime = 0; + + tokenlist = 0; + token = 0; + emeralds = 0; } else if (G_GametypeUsesLives() && players[consoleplayer].playerstate == PST_LIVE && players[consoleplayer].lives != INFLIVES) players[consoleplayer].lives -= 1; From 0a1beab8c80591a90107017b0d0712f74ecba720 Mon Sep 17 00:00:00 2001 From: Riku Salminen <38985578+Riku-S@users.noreply.github.com> Date: Sat, 14 Nov 2020 20:17:35 +0200 Subject: [PATCH 2/4] Reset a couple of other variables while we're at it --- src/g_game.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 528721e2f..d6861b252 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2216,12 +2216,32 @@ void G_Ticker(boolean run) // Costs a life to retry ... unless the player in question is dead already, or you haven't even touched the first starpost in marathon run. if (marathonmode && gamemap == spmarathon_start && !players[consoleplayer].starposttime) { + player_t *p = &players[consoleplayer]; marathonmode |= MA_INIT; marathontime = 0; - tokenlist = 0; - token = 0; - emeralds = 0; + numgameovers = tokenlist = token = 0; + countdown = countdown2 = exitfadestarted = 0; + + p->playerstate = PST_REBORN; + p->starpostx = p->starposty = p->starpostz = 0; + + p->lives = startinglivesbalance[0]; + p->continues = 1; + + p->score = 0; + + // The latter two should clear by themselves, but just in case + p->pflags &= ~(PF_TAGIT|PF_GAMETYPEOVER|PF_FULLSTASIS); + + // Clear cheatcodes too, just in case. + p->pflags &= ~(PF_GODMODE|PF_NOCLIP|PF_INVIS); + + p->xtralife = 0; + + // Reset unlockable triggers + unlocktriggers = 0; + } else if (G_GametypeUsesLives() && players[consoleplayer].playerstate == PST_LIVE && players[consoleplayer].lives != INFLIVES) players[consoleplayer].lives -= 1; From f51be77aa21e125c4abd16da2f660c4da03daa84 Mon Sep 17 00:00:00 2001 From: Riku Salminen <38985578+Riku-S@users.noreply.github.com> Date: Sun, 22 Nov 2020 23:19:24 +0200 Subject: [PATCH 3/4] Now the fix actually does what the MR says... +lua banks --- src/g_game.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/g_game.c b/src/g_game.c index d6861b252..1afaf8956 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2242,6 +2242,12 @@ void G_Ticker(boolean run) // Reset unlockable triggers unlocktriggers = 0; + emeralds = 0; + tokenbits = 0; + tokenlist = 0; + token = 0; + + memset(&luabanks, 0, sizeof(luabanks)); } else if (G_GametypeUsesLives() && players[consoleplayer].playerstate == PST_LIVE && players[consoleplayer].lives != INFLIVES) players[consoleplayer].lives -= 1; From b9fa50f7ef00000bc1f79e5d47582aeae971b37f Mon Sep 17 00:00:00 2001 From: Riku Salminen <38985578+Riku-S@users.noreply.github.com> Date: Sun, 22 Nov 2020 23:23:32 +0200 Subject: [PATCH 4/4] No need to reset tokens twice --- src/g_game.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 1afaf8956..b91087b2b 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2243,9 +2243,6 @@ void G_Ticker(boolean run) unlocktriggers = 0; emeralds = 0; - tokenbits = 0; - tokenlist = 0; - token = 0; memset(&luabanks, 0, sizeof(luabanks)); }