From b0d9110e5f226e08d4499a1c13562e7ee2f19c80 Mon Sep 17 00:00:00 2001 From: toaster Date: Mon, 2 Jul 2018 23:17:30 +0100 Subject: [PATCH] Intermissions... * Do the gametype change stuff on the voting screen. * Make all the picking sound and setting stuff one function, rather than in two seperate places that need to be kept identical. * Have the timer at the bottom be the highlight colour. * Map hell! LF2_HIDEINMENU is craftily reused... * Less allocation and deallocation for the adjacent G_RandMaps. Other stuff... * Fix command_map_f not resetting players' score in battle. * Shiny titlescreen! * Fix a random bonus newline in one of the quit messages. --- src/d_netcmd.c | 18 ++++++++------- src/doomstat.h | 3 ++- src/f_finale.c | 62 +++++++++++++++++++++++++++++++------------------- src/g_game.c | 35 +++++++++++++++++----------- src/g_game.h | 2 +- src/m_menu.c | 2 +- src/y_inter.c | 55 ++++++++++++++++++++++++++++++++------------ 7 files changed, 115 insertions(+), 62 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index ff6d82b3..43e4dfd9 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -449,7 +449,7 @@ consvar_t cv_mute = {"mute", "Off", CV_NETVAR|CV_CALL, CV_OnOff, Mute_OnChange, consvar_t cv_sleep = {"cpusleep", "-1", CV_SAVE, sleeping_cons_t, NULL, -1, NULL, NULL, 0, 0, NULL}; INT16 gametype = GT_RACE; // SRB2kart -INT16 deferredgametype = GT_RACE; // SRB2kart +boolean forceresetplayers = false; UINT8 splitscreen = 0; boolean circuitmap = true; // SRB2kart INT32 adminplayers[MAXPLAYERS]; @@ -1883,6 +1883,8 @@ void D_MapChange(INT32 mapnum, INT32 newgametype, boolean pultmode, boolean rese static char buf[2+MAX_WADPATH+1+4]; static char *buf_p = buf; + forceresetplayers = false; + // The supplied data are assumed to be good. I_Assert(delay >= 0 && delay <= 2); @@ -1966,21 +1968,21 @@ void D_SetupVote(void) char buf[8]; char *p = buf; INT32 i; - INT16 gt = gametype; + INT16 gt; for (i = 0; i < 4; i++) { if (i == 2) // sometimes a different gametype { - WRITEUINT16(p, G_RandMap(G_TOLFlag(gt = G_SometimesGetDifferentGametype()), prevmap, false, false)); + WRITEUINT16(p, G_RandMap(G_TOLFlag(gt = G_SometimesGetDifferentGametype()), prevmap, false, false, false, true)); WRITEUINT16(p, gt); } else { if (i == 3) // unknown-random - WRITEUINT16(p, G_RandMap(G_TOLFlag(gametype), prevmap, true, false)); + WRITEUINT16(p, G_RandMap(G_TOLFlag(gametype), prevmap, true, false, true, false)); else - WRITEUINT16(p, G_RandMap(G_TOLFlag(gametype), prevmap, false, false)); + WRITEUINT16(p, G_RandMap(G_TOLFlag(gametype), prevmap, false, false, false, true)); WRITEUINT16(p, gametype); } } @@ -2137,8 +2139,8 @@ static void Command_Map_f(void) } } - if (!(i = COM_CheckParm("-force")) && newgametype == gametype) // SRB2Kart - newresetplayers = false; // if not forcing and gametypes is the same + if (!(i = COM_CheckParm("-force")) && newgametype == gametype && !G_BattleGametype()) // SRB2Kart + newresetplayers = false; // if not forcing and gametypes is the same and not battle // don't use a gametype the map doesn't support if (cv_debug || i || cv_skipmapcheck.value) @@ -4183,7 +4185,7 @@ static void TimeLimit_OnChange(void) */ void D_GameTypeChanged(INT32 lastgametype) { - if (netgame) + if (multiplayer) CONS_Printf(M_GetText("Gametype was changed from %s to %s\n"), gametype_cons_t[lastgametype].strvalue, gametype_cons_t[gametype].strvalue); // Only do the following as the server, not as remote admin. diff --git a/src/doomstat.h b/src/doomstat.h index 2a596087..5f2ef91e 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -76,10 +76,11 @@ extern boolean addedtogame; // true after the server has added you // Only true if >1 player. netgame => multiplayer but not (multiplayer=>netgame) extern boolean multiplayer; -extern INT16 gametype, deferredgametype; +extern INT16 gametype; extern UINT8 splitscreen; extern boolean circuitmap; // Does this level have 'circuit mode'? extern boolean fromlevelselect; +extern boolean forceresetplayers; // ======================================== // Internal parameters for sound rendering. diff --git a/src/f_finale.c b/src/f_finale.c index 913d7625..c38cd2db 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -903,37 +903,53 @@ void F_TitleScreenDrawer(void) if (modeattacking) return; // We likely came here from retrying. Don't do a damn thing. - if (finalecount < 50) - V_DrawFill(0, 0, 320, 200, 31); - else - // Draw that sky! - F_SkyScroll(titlescrollspeed); - - // Don't draw outside of the title screewn, or if the patch isn't there. + // Don't draw outside of the title screen, or if the patch isn't there. if (!ttbanner || (gamestate != GS_TITLESCREEN && gamestate != GS_WAITINGPLAYERS)) - return; - - V_DrawSmallScaledPatch(84, 36, 0, ttbanner); - - if (finalecount < 20) { - if (finalecount >= 10) + F_SkyScroll(titlescrollspeed); + return; + } + + if (finalecount < 50) + { + V_DrawFill(0, 0, 320, 200, 31); + + V_DrawSmallScaledPatch(84, 36, 0, ttbanner); + + if (finalecount >= 20) + V_DrawSmallScaledPatch(84, 87, 0, ttkart); + else if (finalecount >= 10) V_DrawSciencePatch((84<= 50 && finalecount < 55) + else if (finalecount < 52) { V_DrawFill(0, 0, 320, 200, 120); V_DrawSmallScaledPatch(84, 36, 0, ttkflash); } + else + { + INT32 transval = 0; + + if (finalecount <= (50+(9<<1))) + transval = (finalecount - 50)>>1; + + F_SkyScroll(titlescrollspeed); + + V_DrawSciencePatch(0, 0 - FixedMul(40< */ -INT16 G_RandMap(INT16 tolflags, INT16 pprevmap, boolean dontadd, boolean ignorebuffer) +static INT16 *okmaps = NULL; +INT16 G_RandMap(INT16 tolflags, INT16 pprevmap, boolean dontadd, boolean ignorebuffer, boolean maphell, boolean callagainsoon) { - INT16 *okmaps = Z_Malloc(NUMMAPS * sizeof(INT16), PU_STATIC, NULL); INT32 numokmaps = 0; INT16 ix, bufx; + if (!okmaps) + okmaps = Z_Malloc(NUMMAPS * sizeof(INT16), PU_STATIC, NULL); + // Find all the maps that are ok and and put them in an array. for (ix = 0; ix < NUMMAPS; ix++) { @@ -3160,7 +3163,8 @@ INT16 G_RandMap(INT16 tolflags, INT16 pprevmap, boolean dontadd, boolean ignoreb if ((mapheaderinfo[ix]->typeoflevel & tolflags) != tolflags || ix == pprevmap - || (M_MapLocked(ix+1) && !dedicated)) + || (!dedicated && M_MapLocked(ix+1)) + || (!maphell && (mapheaderinfo[ix]->menuflags & LF2_HIDEINMENU))) // the highest quality memes isokmap = false; if (!ignorebuffer) @@ -3184,7 +3188,7 @@ INT16 G_RandMap(INT16 tolflags, INT16 pprevmap, boolean dontadd, boolean ignoreb if (numokmaps == 0) { if (!ignorebuffer) - return G_RandMap(tolflags, pprevmap, dontadd, true); // If there's no matches, (An incredibly silly function chain, buuut... :V) + return G_RandMap(tolflags, pprevmap, dontadd, true, maphell, callagainsoon); // 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+1; bufx++) @@ -3201,7 +3205,11 @@ INT16 G_RandMap(INT16 tolflags, INT16 pprevmap, boolean dontadd, boolean ignoreb } } - Z_Free(okmaps); + if (!callagainsoon) + { + Z_Free(okmaps); + okmaps = NULL; + } return ix; } @@ -3337,7 +3345,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); + nextmap = G_RandMap(G_TOLFlag(gametype), prevmap, false, false, false, false); } // We are committed to this map now. @@ -3385,7 +3393,7 @@ void G_NextLevel(void) else { if (gamestate != GS_VOTING) - deferredgametype = gametype; + forceresetplayers = false; gameaction = ga_worlddone; } } @@ -3395,12 +3403,13 @@ static void G_DoWorldDone(void) if (server) { // SRB2Kart - if (G_RaceGametype() && (deferredgametype == gametype)) - // don't reset player between maps in Race - D_MapChange(nextmap+1, deferredgametype, ultimatemode, false, 0, false, false); - else - // resetplayer in Battle for more equality - D_MapChange(nextmap+1, deferredgametype, ultimatemode, true, 0, false, false); + D_MapChange(nextmap+1, + gametype, + ultimatemode, + (forceresetplayers || G_BattleGametype()), // resetplayer in Battle for more equality + 0, + false, + false); } gameaction = ga_nothing; diff --git a/src/g_game.h b/src/g_game.h index a699964d..e601b658 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); +INT16 G_RandMap(INT16 tolflags, INT16 pprevmap, boolean dontadd, boolean ignorebuffer, boolean maphell, boolean callagainsoon); #endif diff --git a/src/m_menu.c b/src/m_menu.c index 70fb7faa..ca496366 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -3048,7 +3048,7 @@ void M_Init(void) quitmsg[QUIT3MSG] = M_GetText("Are you really going to give up?\nWe certainly would never give you up.\n\n(Press 'Y' to quit)"); quitmsg[QUIT3MSG1] = M_GetText("Come on, just ONE more netgame!\n\n(Press 'Y' to quit)"); quitmsg[QUIT3MSG2] = M_GetText("Press 'N' to unlock\nthe Golden Kart!\n\n(Press 'Y' to quit)"); - quitmsg[QUIT3MSG3] = M_GetText("Couldn't handle\nthe banana meta?\n\n\n(Press 'Y' to quit)"); + quitmsg[QUIT3MSG3] = M_GetText("Couldn't handle\nthe banana meta?\n\n(Press 'Y' to quit)"); quitmsg[QUIT3MSG4] = M_GetText("Every time you press 'Y', an\nSRB2Kart Developer cries...\n\n(Press 'Y' to quit)"); quitmsg[QUIT3MSG5] = M_GetText("You'll be back to play soon, though...\n...right?\n\n(Press 'Y' to quit)"); quitmsg[QUIT3MSG6] = M_GetText("Aww, is Eggman's Nightclub too\ndifficult for you?\n\n(Press 'Y' to quit)"); diff --git a/src/y_inter.c b/src/y_inter.c index 0bae4cb1..3554803d 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -233,6 +233,7 @@ void Y_IntermissionDrawer(void) { // Bonus loops INT32 i; + INT32 hilicol = V_YELLOWMAP; // fallback if (intertype == int_none || rendermode == render_none) return; @@ -310,7 +311,7 @@ void Y_IntermissionDrawer(void) INT32 x = 4; INT32 y = 48; char name[MAXPLAYERNAME+1]; - INT32 hilicol = (cons_menuhighlight.value) ? cons_menuhighlight.value : V_SKYMAP; + hilicol = (cons_menuhighlight.value) ? cons_menuhighlight.value : V_SKYMAP; boolean completed[MAXPLAYERS]; memset(completed, 0, sizeof (completed)); @@ -412,7 +413,7 @@ void Y_IntermissionDrawer(void) INT32 x = 4; INT32 y = 48; char name[MAXPLAYERNAME+1]; - INT32 hilicol = (cons_menuhighlight.value) ? cons_menuhighlight.value : V_REDMAP; + hilicol = (cons_menuhighlight.value) ? cons_menuhighlight.value : V_REDMAP; // draw the header V_DrawScaledPatch((BASEVIDWIDTH/2) - (SHORT(data.match.result->width) / 2), 2, 0, data.match.result); @@ -638,7 +639,7 @@ void Y_IntermissionDrawer(void) } if (timer) - V_DrawCenteredString(BASEVIDWIDTH/2, 188, V_YELLOWMAP, + V_DrawCenteredString(BASEVIDWIDTH/2, 188, hilicol, va("start in %d seconds", timer/TICRATE)); // Make it obvious that scrambling is happening next round. @@ -2284,8 +2285,40 @@ void Y_VoteDrawer(void) } if (timer) - V_DrawCenteredString(BASEVIDWIDTH/2, 188, V_YELLOWMAP|V_SNAPTOBOTTOM, + { + INT32 hilicol; + if (cons_menuhighlight.value) + hilicol = cons_menuhighlight.value; + else if (gametype == GT_RACE) + hilicol = V_SKYMAP; + else //if (gametype == GT_MATCH) + hilicol = V_REDMAP; + V_DrawCenteredString(BASEVIDWIDTH/2, 188, hilicol|V_SNAPTOBOTTOM, va("Vote ends in %d seconds", timer/TICRATE)); + } +} + +// +// Y_VoteStop +// +// Vote screen's selection stops moving +// +SINT8 deferredlevel = 0; +static void Y_VoteStops(SINT8 pick, SINT8 level) +{ + if (P_IsLocalPlayer(&players[pick])) + S_StartSound(NULL, sfx_yeeeah); + else + S_StartSound(NULL, sfx_kc48); + + nextmap = votelevels[level][0]; + if (gametype != votelevels[level][1]) + { + INT16 lastgametype = gametype; + gametype = votelevels[level][1]; + D_GameTypeChanged(lastgametype); + forceresetplayers = true; + } } // @@ -2385,10 +2418,7 @@ void Y_VoteTicker(void) else if (voteclient.roffset >= voteclient.rendoff) { voteendtic = votetic + (3*TICRATE); - if (P_IsLocalPlayer(&players[pickedvote])) - S_StartSound(NULL, sfx_yeeeah); - else - S_StartSound(NULL, sfx_kc48); + Y_VoteStops(pickedvote, deferredlevel); } } } @@ -2619,7 +2649,6 @@ void Y_SetupVoteFinish(SINT8 pick, SINT8 level) if (pick == -1) // No other votes? We gotta get out of here, then! { timer = 0; - deferredgametype = gametype; Y_UnloadVoteData(); Y_FollowIntermission(); return; @@ -2661,17 +2690,13 @@ void Y_SetupVoteFinish(SINT8 pick, SINT8 level) { voteendtic = votetic + (5*TICRATE); S_ChangeMusicInternal("voteeb", false); - if (P_IsLocalPlayer(&players[pick])) - S_StartSound(NULL, sfx_yeeeah); - else - S_StartSound(NULL, sfx_kc48); + Y_VoteStops(pick, level); } else S_ChangeMusicInternal("voteea", true); } + deferredlevel = level; pickedvote = pick; - nextmap = votelevels[level][0]; - deferredgametype = votelevels[level][1]; timer = 0; }