From 040cb9d2986174600c6d256c3f0b305a47895c7c Mon Sep 17 00:00:00 2001 From: JugadorXEI Date: Tue, 14 Oct 2025 03:18:36 +0200 Subject: [PATCH] Clamp justPlayed to the upper limit (prevents SOC Hidden level weirdness) --- src/g_game.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/g_game.c b/src/g_game.c index 7af43ca82..da82ad1fc 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -4855,12 +4855,23 @@ void G_AddMapToBuffer(mapnum_t map) if (dedicated && D_NumPlayers() == 0) return; + const size_t upperJustPlayedLimit = TOLMaps(gametype) - VOTEROWSADDSONE - 1; + if (mapheaderinfo[map]->justPlayed == 0) // Started playing a new map. { // Decrement every maps' justPlayed value. INT32 i; for (i = 0; i < nummapheaders; i++) { + // If the map's justPlayed value is higher + // than what it should be, clamp it. + // (Usually a result of SOC files + // manipulating which levels are hidden.) + if (mapheaderinfo[i]->justPlayed > upperJustPlayedLimit) + { + mapheaderinfo[i]->justPlayed = upperJustPlayedLimit; + } + if (mapheaderinfo[i]->justPlayed > 0) { mapheaderinfo[i]->justPlayed--; @@ -4869,7 +4880,7 @@ void G_AddMapToBuffer(mapnum_t map) } // Set our map's justPlayed value. - mapheaderinfo[map]->justPlayed = TOLMaps(gametype) - VOTEROWSADDSONE - 1; + mapheaderinfo[map]->justPlayed = upperJustPlayedLimit; #endif } #undef VOTEROWSADDSONE