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
This commit is contained in:
TehRealSalt 2018-02-10 16:50:44 -05:00
parent bc99e0963e
commit 2af4f0451a
3 changed files with 11 additions and 6 deletions

View File

@ -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);
}

View File

@ -3110,7 +3110,7 @@ static INT32 TOLMaps(INT16 tolflags)
* has those flags.
* \author Graue <graue@oceanbase.org>
*/
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.

View File

@ -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