diff --git a/src/d_netcmd.c b/src/d_netcmd.c index aa28524a..64d07c16 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -1969,21 +1969,21 @@ void D_SetupVote(void) char buf[8]; char *p = buf; INT32 i; - INT16 gt; - for (i = 0; i < 4; i++) + for (i = 0; i < 5; i++) { if (i == 2) // sometimes a different gametype { - WRITEUINT16(p, G_RandMap(G_TOLFlag(gt = G_SometimesGetDifferentGametype()), prevmap, false, false, false, true)); + INT16 gt = G_SometimesGetDifferentGametype(); + WRITEUINT16(p, G_RandMap(G_TOLFlag(gt), prevmap, false, false, 0, true)); WRITEUINT16(p, gt); } else { - if (i == 3) // unknown-random - WRITEUINT16(p, G_RandMap(G_TOLFlag(gametype), prevmap, true, false, true, false)); + if (i >= 3) // unknown-random and force-unknown MAP HELL + WRITEUINT16(p, G_RandMap(G_TOLFlag(gametype), prevmap, true, false, (i-2), (i < 4))); else - WRITEUINT16(p, G_RandMap(G_TOLFlag(gametype), prevmap, false, false, false, true)); + WRITEUINT16(p, G_RandMap(G_TOLFlag(gametype), prevmap, false, false, 0, true)); WRITEUINT16(p, gametype); } } @@ -2011,7 +2011,9 @@ void D_PickVote(void) char* p = buf; SINT8 temppicks[MAXPLAYERS]; SINT8 templevels[MAXPLAYERS]; + SINT8 votecompare = -1; UINT8 numvotes = 0, key = 0; + boolean force = true; INT32 i; for (i = 0; i < MAXPLAYERS; i++) @@ -2023,6 +2025,10 @@ void D_PickVote(void) temppicks[numvotes] = i; templevels[numvotes] = votes[i]; numvotes++; + if (votecompare == -1) + votecompare = votes[i]; + else if (votes[i] != votecompare) + force = false; } } @@ -2031,7 +2037,10 @@ void D_PickVote(void) if (numvotes > 0) { WRITESINT8(p, temppicks[key]); - WRITESINT8(p, templevels[key]); + if (force && templevels[key] == 3 && numvotes > 1) + WRITESINT8(p, 4); + else + WRITESINT8(p, templevels[key]); } else { @@ -4588,7 +4597,7 @@ static void Got_SetupVotecmd(UINT8 **cp, INT32 playernum) return; } - for (i = 0; i < 4; i++) + for (i = 0; i < 5; i++) { votelevels[i][0] = (INT16)READUINT16(*cp); votelevels[i][1] = (INT16)READUINT16(*cp); diff --git a/src/doomstat.h b/src/doomstat.h index 0f5ade7a..aa490356 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -459,7 +459,7 @@ extern boolean legitimateexit; extern boolean comebackshowninfo; extern tic_t curlap, bestlap; -extern INT16 votelevels[4][2]; +extern INT16 votelevels[5][2]; extern SINT8 votes[MAXPLAYERS]; extern SINT8 pickedvote; diff --git a/src/g_game.c b/src/g_game.c index 801a810f..5161c8a7 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -252,7 +252,7 @@ boolean franticitems; // Frantic items currently enabled? boolean comeback; // Battle Mode's karma comeback is on/off // Voting system -INT16 votelevels[4][2]; // Levels that were rolled by the host +INT16 votelevels[5][2]; // Levels that were rolled by the host SINT8 votes[MAXPLAYERS]; // Each player's vote SINT8 pickedvote; // What vote the host rolls @@ -3172,7 +3172,7 @@ static INT32 TOLMaps(INT16 tolflags) * \author Graue */ static INT16 *okmaps = NULL; -INT16 G_RandMap(INT16 tolflags, INT16 pprevmap, boolean dontadd, boolean ignorebuffer, boolean maphell, boolean callagainsoon) +INT16 G_RandMap(INT16 tolflags, INT16 pprevmap, boolean dontadd, boolean ignorebuffer, UINT8 maphell, boolean callagainsoon) { INT32 numokmaps = 0; INT16 ix, bufx; @@ -3191,7 +3191,8 @@ INT16 G_RandMap(INT16 tolflags, INT16 pprevmap, boolean dontadd, boolean ignoreb if ((mapheaderinfo[ix]->typeoflevel & tolflags) != tolflags || ix == pprevmap || (!dedicated && M_MapLocked(ix+1)) - || (!maphell && (mapheaderinfo[ix]->menuflags & LF2_HIDEINMENU))) // the highest quality memes + || (!maphell && (mapheaderinfo[ix]->menuflags & LF2_HIDEINMENU)) // this is bad + || ((maphell == 2) && !(mapheaderinfo[ix]->menuflags & LF2_HIDEINMENU))) // gasp isokmap = false; if (!ignorebuffer) @@ -3216,6 +3217,8 @@ INT16 G_RandMap(INT16 tolflags, INT16 pprevmap, boolean dontadd, boolean ignoreb { if (!ignorebuffer) return G_RandMap(tolflags, pprevmap, dontadd, true, maphell, callagainsoon); // If there's no matches, (An incredibly silly function chain, buuut... :V) + if (maphell) + return G_RandMap(tolflags, pprevmap, dontadd, true, maphell-1, callagainsoon); ix = 0; // Sorry, none match. You get MAP01. for (bufx = 0; bufx < NUMMAPS+1; bufx++) @@ -3388,7 +3391,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, false, false, false); + nextmap = G_RandMap(G_TOLFlag(gametype), prevmap, false, false, 0, false); } // We are committed to this map now. diff --git a/src/g_game.h b/src/g_game.h index e601b658..bfe67cbb 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -249,6 +249,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 dontadd, boolean ignorebuffer, boolean maphell, boolean callagainsoon); +INT16 G_RandMap(INT16 tolflags, INT16 pprevmap, boolean dontadd, boolean ignorebuffer, UINT8 maphell, boolean callagainsoon); #endif diff --git a/src/sounds.c b/src/sounds.c index 1fb171d2..69fc8433 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -148,6 +148,8 @@ sfxinfo_t S_sfx[NUMSFX] = {"fizzle", false, 127, 8, -1, NULL, 0, -1, -1, LUMPERROR}, {"gbeep", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, // Grenade beep {"yeeeah", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, + {"noooo1", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, + {"noooo2", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, {"ghit" , false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, {"gloop", false, 60, 0, -1, NULL, 0, -1, -1, LUMPERROR}, {"gspray", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR}, diff --git a/src/sounds.h b/src/sounds.h index 39345407..106e77df 100644 --- a/src/sounds.h +++ b/src/sounds.h @@ -220,6 +220,8 @@ typedef enum sfx_fizzle, sfx_gbeep, sfx_yeeeah, + sfx_noooo1, + sfx_noooo2, sfx_ghit, sfx_gloop, sfx_gspray, diff --git a/src/y_inter.c b/src/y_inter.c index 318ffb22..4c5d9e26 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -144,7 +144,7 @@ typedef struct UINT8 rendoff; } y_voteclient; -static y_votelvlinfo levelinfo[4]; +static y_votelvlinfo levelinfo[5]; static y_voteclient voteclient; static INT32 votetic; static INT32 voteendtic = -1; @@ -988,7 +988,7 @@ void Y_VoteDrawer(void) { char str[40]; patch_t *pic; - UINT8 sizeadd = selected[i], j, color; + UINT8 j, color; if (i == 3) { @@ -1004,6 +1004,8 @@ void Y_VoteDrawer(void) if (selected[i]) { + UINT8 sizeadd = selected[i]; + for (j = 0; j <= splitscreen; j++) // another loop for drawing the selection backgrounds in the right order, grumble grumble.. { INT32 handy = y; @@ -1101,7 +1103,7 @@ void Y_VoteDrawer(void) { patch_t *pic; - if (votes[i] == 3 && (i != pickedvote || voteendtic == -1)) + if (votes[i] >= 3 && (i != pickedvote || voteendtic == -1)) pic = randomlvl; else pic = levelinfo[votes[i]].pic; @@ -1162,12 +1164,17 @@ void Y_VoteDrawer(void) SINT8 deferredlevel = 0; static void Y_VoteStops(SINT8 pick, SINT8 level) { - if (!splitscreen && pick == consoleplayer) - S_StartSound(NULL, sfx_yeeeah); - else - S_StartSound(NULL, sfx_kc48); - nextmap = votelevels[level][0]; + + if (level == 4) + S_StartSound(NULL, sfx_noooo2); // gasp + else if (mapheaderinfo[nextmap] && (mapheaderinfo[nextmap]->menuflags & LF2_HIDEINMENU)) + S_StartSound(NULL, sfx_noooo1); // this is bad + else if (!splitscreen && pick == consoleplayer) + S_StartSound(NULL, sfx_yeeeah); // yeeeah! + else + S_StartSound(NULL, sfx_kc48); // just a cool sound + if (gametype != votelevels[level][1]) { INT16 lastgametype = gametype; @@ -1414,40 +1421,44 @@ void Y_StartVote(void) for (i = 0; i < MAXPLAYERS; i++) votes[i] = -1; - for (i = 0; i < 4; i++) + for (i = 0; i < 5; i++) { lumpnum_t lumpnum; - //INT16 j; // set up the str - if (strlen(mapheaderinfo[votelevels[i][0]]->zonttl) > 0) - { - if (strlen(mapheaderinfo[votelevels[i][0]]->actnum) > 0) - snprintf(levelinfo[i].str, - sizeof levelinfo[i].str, - "%.32s %.32s %s", - mapheaderinfo[votelevels[i][0]]->lvlttl, mapheaderinfo[votelevels[i][0]]->zonttl, mapheaderinfo[votelevels[i][0]]->actnum); - else - snprintf(levelinfo[i].str, - sizeof levelinfo[i].str, - "%.32s %.32s", - mapheaderinfo[votelevels[i][0]]->lvlttl, mapheaderinfo[votelevels[i][0]]->zonttl); - } + if (i == 4) + levelinfo[i].str[0] = '\0'; else { - if (strlen(mapheaderinfo[votelevels[i][0]]->actnum) > 0) - snprintf(levelinfo[i].str, - sizeof levelinfo[i].str, - "%.32s %s", - mapheaderinfo[votelevels[i][0]]->lvlttl, mapheaderinfo[votelevels[i][0]]->actnum); + if (strlen(mapheaderinfo[votelevels[i][0]]->zonttl) > 0) + { + if (strlen(mapheaderinfo[votelevels[i][0]]->actnum) > 0) + snprintf(levelinfo[i].str, + sizeof levelinfo[i].str, + "%.32s %.32s %s", + mapheaderinfo[votelevels[i][0]]->lvlttl, mapheaderinfo[votelevels[i][0]]->zonttl, mapheaderinfo[votelevels[i][0]]->actnum); + else + snprintf(levelinfo[i].str, + sizeof levelinfo[i].str, + "%.32s %.32s", + mapheaderinfo[votelevels[i][0]]->lvlttl, mapheaderinfo[votelevels[i][0]]->zonttl); + } else - snprintf(levelinfo[i].str, - sizeof levelinfo[i].str, - "%.32s", - mapheaderinfo[votelevels[i][0]]->lvlttl); - } + { + if (strlen(mapheaderinfo[votelevels[i][0]]->actnum) > 0) + snprintf(levelinfo[i].str, + sizeof levelinfo[i].str, + "%.32s %s", + mapheaderinfo[votelevels[i][0]]->lvlttl, mapheaderinfo[votelevels[i][0]]->actnum); + else + snprintf(levelinfo[i].str, + sizeof levelinfo[i].str, + "%.32s", + mapheaderinfo[votelevels[i][0]]->lvlttl); + } - levelinfo[i].str[sizeof levelinfo[i].str - 1] = '\0'; + levelinfo[i].str[sizeof levelinfo[i].str - 1] = '\0'; + } // set up the gtc and gts levelinfo[i].gtc = G_GetGametypeColor(votelevels[i][1]); @@ -1491,6 +1502,7 @@ static void Y_UnloadVoteData(void) UNLOAD(cursor4); UNLOAD(randomlvl); + UNLOAD(levelinfo[4].pic); UNLOAD(levelinfo[3].pic); UNLOAD(levelinfo[2].pic); UNLOAD(levelinfo[1].pic); @@ -1526,6 +1538,15 @@ void Y_SetupVoteFinish(SINT8 pick, SINT8 level) if (votes[i] == -1 || endtype > 1) // Don't need to go on continue; + if (level == 4) + { + votes[i] = 4; + continue; + } + + if (endtype == 2) + continue; + if (votecompare == -1) { votecompare = votes[i]; @@ -1535,19 +1556,19 @@ void Y_SetupVoteFinish(SINT8 pick, SINT8 level) endtype = 2; } - if (endtype == 0) // Might as well put this here, too. + if (level == 4 || endtype == 1) // Only one unique vote, so just end it immediately. + { + voteendtic = votetic + (5*TICRATE); + S_ChangeMusicInternal("voteeb", false); + Y_VoteStops(pick, level); + } + else if (endtype == 0) // Might as well put this here, too. { timer = 0; Y_UnloadVoteData(); Y_FollowIntermission(); return; } - else if (endtype == 1) // Only one unique vote, so just end it immediately. - { - voteendtic = votetic + (5*TICRATE); - S_ChangeMusicInternal("voteeb", false); - Y_VoteStops(pick, level); - } else S_ChangeMusicInternal("voteea", true); }