From 2af4f0451a2812512355ae9b79166ac96c4018c3 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sat, 10 Feb 2018 16:50:44 -0500 Subject: [PATCH] One last thing: don't add whatever the game rolls for the random option Makes it even more of a wild-card option, also makes sure that you actually *see* all of the maps before it empties --- src/d_netcmd.c | 7 ++++++- src/g_game.c | 8 ++++---- src/g_game.h | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index cb212ede..e449a831 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -1962,7 +1962,12 @@ void D_SetupVote(void) p = buf; for (i = 0; i < 4; i++) - WRITEUINT16(p, G_RandMap(G_TOLFlag(gametype), prevmap, false)); + { + if (i == 3) + WRITEUINT16(p, G_RandMap(G_TOLFlag(gametype), prevmap, true, false)); + else + WRITEUINT16(p, G_RandMap(G_TOLFlag(gametype), prevmap, false, false)); + } SendNetXCmd(XD_SETUPVOTE, buf, p - buf); } diff --git a/src/g_game.c b/src/g_game.c index b967a1e1..30b771f7 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -3110,7 +3110,7 @@ static INT32 TOLMaps(INT16 tolflags) * has those flags. * \author Graue */ -INT16 G_RandMap(INT16 tolflags, INT16 pprevmap, boolean ignorebuffer) +INT16 G_RandMap(INT16 tolflags, INT16 pprevmap, boolean dontadd, boolean ignorebuffer) { INT16 *okmaps = Z_Malloc(NUMMAPS * sizeof(INT16), PU_STATIC, NULL); INT32 numokmaps = 0; @@ -3150,7 +3150,7 @@ INT16 G_RandMap(INT16 tolflags, INT16 pprevmap, boolean ignorebuffer) if (numokmaps == 0) { if (!ignorebuffer) - return G_RandMap(tolflags, pprevmap, true); // If there's no matches, (An incredibly silly function chain, buuut... :V) + return G_RandMap(tolflags, pprevmap, dontadd, true); // If there's no matches, (An incredibly silly function chain, buuut... :V) ix = 0; // Sorry, none match. You get MAP01. for (bufx = 0; bufx < NUMMAPS; bufx++) @@ -3289,7 +3289,7 @@ static void G_DoCompleted(void) automapactive = false; - if (randmapbuffer[TOLMaps(G_TOLFlag(gametype))-5] != -1) // we're getting pretty full, so lets clear it + if (randmapbuffer[TOLMaps(G_TOLFlag(gametype))-4] != -1) // we're getting pretty full, so lets clear it { for (i = 0; i < NUMMAPS; i++) randmapbuffer[i] = -1; @@ -3300,7 +3300,7 @@ static void G_DoCompleted(void) if (cv_advancemap.value == 0) // Stay on same map. nextmap = prevmap; else if (cv_advancemap.value == 2) // Go to random map. - nextmap = G_RandMap(G_TOLFlag(gametype), prevmap, false); + nextmap = G_RandMap(G_TOLFlag(gametype), prevmap, false, false); } // We are committed to this map now. diff --git a/src/g_game.h b/src/g_game.h index 9a69fd12..8ea9d8f6 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -235,6 +235,6 @@ FUNCMATH INT32 G_TicsToMilliseconds(tic_t tics); // Don't split up TOL handling INT16 G_TOLFlag(INT32 pgametype); -INT16 G_RandMap(INT16 tolflags, INT16 pprevmap, boolean ignorebuffer); +INT16 G_RandMap(INT16 tolflags, INT16 pprevmap, boolean dontadd, boolean ignorebuffer); #endif