From a187460865447614d83e43ff0fce699b6ce288dd Mon Sep 17 00:00:00 2001 From: Louis-Antoine Date: Mon, 25 Nov 2019 01:09:00 +0100 Subject: [PATCH 1/3] Revert "Render title map on connecting to server screen too" This reverts commit b6e145f0c5ce990e54f4dd99a7f78d0df39303e0. --- src/d_main.c | 117 +++++++++++++++++++++++++------------------------ src/d_main.h | 3 -- src/f_finale.c | 12 +++-- 3 files changed, 65 insertions(+), 67 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 98e16a277..a68f9c09c 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -291,8 +291,11 @@ static void D_Display(void) switch (gamestate) { case GS_TITLESCREEN: - F_TitleScreenDrawer(); - break; + if (!titlemapinaction || !curbghide) { + F_TitleScreenDrawer(); + break; + } + /* FALLTHRU */ case GS_LEVEL: if (!gametic) break; @@ -363,11 +366,56 @@ static void D_Display(void) // clean up border stuff // see if the border needs to be initially drawn - if (gamestate == GS_LEVEL) + if (gamestate == GS_LEVEL || (gamestate == GS_TITLESCREEN && titlemapinaction && curbghide && (!hidetitlemap))) { // draw the view directly - D_Render(); + if (!automapactive && !dedicated && cv_renderview.value) + { + if (players[displayplayer].mo || players[displayplayer].playerstate == PST_DEAD) + { + topleft = screens[0] + viewwindowy*vid.width + viewwindowx; + objectsdrawn = 0; + #ifdef HWRENDER + if (rendermode != render_soft) + HWR_RenderPlayerView(0, &players[displayplayer]); + else + #endif + if (rendermode != render_none) + R_RenderPlayerView(&players[displayplayer]); + } + + // render the second screen + if (splitscreen && players[secondarydisplayplayer].mo) + { + #ifdef HWRENDER + if (rendermode != render_soft) + HWR_RenderPlayerView(1, &players[secondarydisplayplayer]); + else + #endif + if (rendermode != render_none) + { + viewwindowy = vid.height / 2; + M_Memcpy(ylookup, ylookup2, viewheight*sizeof (ylookup[0])); + + topleft = screens[0] + viewwindowy*vid.width + viewwindowx; + + R_RenderPlayerView(&players[secondarydisplayplayer]); + + viewwindowy = 0; + M_Memcpy(ylookup, ylookup1, viewheight*sizeof (ylookup[0])); + } + } + + // Image postprocessing effect + if (rendermode == render_soft) + { + if (postimgtype) + V_DoPostProcessor(0, postimgtype, postimgparam); + if (postimgtype2) + V_DoPostProcessor(1, postimgtype2, postimgparam2); + } + } if (lastdraw) { @@ -380,9 +428,14 @@ static void D_Display(void) lastdraw = false; } - ST_Drawer(); - F_TextPromptDrawer(); - HU_Drawer(); + if (gamestate == GS_LEVEL) + { + ST_Drawer(); + F_TextPromptDrawer(); + HU_Drawer(); + } + else + F_TitleScreenDrawer(); } } @@ -494,56 +547,6 @@ static void D_Display(void) } } -void D_Render(void) -{ - if (!automapactive && !dedicated && cv_renderview.value) - { - if (players[displayplayer].mo || players[displayplayer].playerstate == PST_DEAD) - { - topleft = screens[0] + viewwindowy*vid.width + viewwindowx; - objectsdrawn = 0; -#ifdef HWRENDER - if (rendermode != render_soft) - HWR_RenderPlayerView(0, &players[displayplayer]); - else -#endif - if (rendermode != render_none) - R_RenderPlayerView(&players[displayplayer]); - } - - // render the second screen - if (splitscreen && players[secondarydisplayplayer].mo) - { -#ifdef HWRENDER - if (rendermode != render_soft) - HWR_RenderPlayerView(1, &players[secondarydisplayplayer]); - else -#endif - if (rendermode != render_none) - { - viewwindowy = vid.height / 2; - M_Memcpy(ylookup, ylookup2, viewheight*sizeof (ylookup[0])); - - topleft = screens[0] + viewwindowy*vid.width + viewwindowx; - - R_RenderPlayerView(&players[secondarydisplayplayer]); - - viewwindowy = 0; - M_Memcpy(ylookup, ylookup1, viewheight*sizeof (ylookup[0])); - } - } - - // Image postprocessing effect - if (rendermode == render_soft) - { - if (postimgtype) - V_DoPostProcessor(0, postimgtype, postimgparam); - if (postimgtype2) - V_DoPostProcessor(1, postimgtype2, postimgparam2); - } - } -} - // ========================================================================= // D_SRB2Loop // ========================================================================= diff --git a/src/d_main.h b/src/d_main.h index 65c51802a..d67a5bb49 100644 --- a/src/d_main.h +++ b/src/d_main.h @@ -54,7 +54,4 @@ const char *D_Home(void); void D_AdvanceDemo(void); void D_StartTitle(void); -/* Here for title maps */ -void D_Render(void); - #endif //__D_MAIN__ diff --git a/src/f_finale.c b/src/f_finale.c index 2d20eb7f4..4a0b0826f 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -2588,9 +2588,7 @@ void F_TitleScreenDrawer(void) // Draw that sky! if (curbgcolor >= 0) V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, curbgcolor); - else if (titlemapinaction && curbghide && ! hidetitlemap) - D_Render(); - else + else if (!curbghide || !titlemapinaction || gamestate == GS_WAITINGPLAYERS) F_SkyScroll(curbgxspeed, curbgyspeed, curbgname); // Don't draw outside of the title screen, or if the patch isn't there. @@ -3350,6 +3348,10 @@ void F_TitleScreenTicker(boolean run) if (run) finalecount++; + // don't trigger if doing anything besides idling on title + if (gameaction != ga_nothing || gamestate != GS_TITLESCREEN) + return; + // Execute the titlemap camera settings if (titlemapinaction) { @@ -3396,10 +3398,6 @@ void F_TitleScreenTicker(boolean run) } } - // don't trigger if doing anything besides idling on title - if (gameaction != ga_nothing || gamestate != GS_TITLESCREEN) - return; - // no demos to play? or, are they disabled? if (!cv_rollingdemos.value || !numDemos) return; From 71e74ca36340e5532a52d1fc7f50a5a07aa833b0 Mon Sep 17 00:00:00 2001 From: toaster Date: Mon, 25 Nov 2019 14:33:15 +0000 Subject: [PATCH 2/3] Fix a bunch of shit with MP special stages! * Prevent an infinite quantity of Emeralds being spawned when P_GiveEmerald is called while a MP Special Stage is in session (resolves #347). * Fix FuriousFox's ridiculous timer on special stage spawn (mentioned in the comments of the previous issue) by correctly marking spectator players in special stages as finished, and preventing the underflow. --- src/g_game.c | 2 +- src/p_mobj.c | 2 +- src/p_tick.c | 5 ++--- src/p_user.c | 4 +++- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index faaed13c7..11ad1862d 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2978,7 +2978,7 @@ void G_AddPlayer(INT32 playernum) if (G_GametypeUsesLives() || ((netgame || multiplayer) && gametype == GT_COOP)) p->lives = cv_startinglives.value; - if (countplayers && !notexiting) + if ((countplayers && !notexiting) || G_IsSpecialStage(gamemap)) P_DoPlayerExit(p); } diff --git a/src/p_mobj.c b/src/p_mobj.c index f2dd1a734..b5af077b5 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -11294,7 +11294,7 @@ void P_SpawnPlayer(INT32 playernum) mobj->radius = FixedMul(skins[p->skin].radius, mobj->scale); mobj->height = P_GetPlayerHeight(p); - if (!leveltime && ((maptol & TOL_NIGHTS) == TOL_NIGHTS) != (G_IsSpecialStage(gamemap))) // non-special NiGHTS stage or special non-NiGHTS stage + if (!leveltime && !p->spectator && ((maptol & TOL_NIGHTS) == TOL_NIGHTS) != (G_IsSpecialStage(gamemap))) // non-special NiGHTS stage or special non-NiGHTS stage { if (maptol & TOL_NIGHTS) { diff --git a/src/p_tick.c b/src/p_tick.c index e02b11f49..60a776cbc 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -476,7 +476,7 @@ static inline void P_DoSpecialStageStuff(void) // Count up the rings of all the players and see if // they've collected the required amount. for (i = 0; i < MAXPLAYERS; i++) - if (playeringame[i]) + if (playeringame[i] && players[i].nightstime) { tic_t oldnightstime = players[i].nightstime; countspheres += players[i].spheres; @@ -506,12 +506,11 @@ static inline void P_DoSpecialStageStuff(void) { // Halt all the players for (i = 0; i < MAXPLAYERS; i++) - if (playeringame[i]) + if (playeringame[i] && !players[i].exiting) { players[i].mo->momx = players[i].mo->momy = 0; players[i].exiting = (14*TICRATE)/5 + 1; } - sstimer = 0; P_GiveEmerald(true); P_RestoreMusic(&players[consoleplayer]); diff --git a/src/p_user.c b/src/p_user.c index ed2a1a446..115ecc667 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -343,13 +343,15 @@ void P_GiveEmerald(boolean spawnObj) continue; emmo = P_SpawnMobjFromMobj(players[i].mo, 0, 0, players[i].mo->height, MT_GOTEMERALD); + if (!emmo) + continue; P_SetTarget(&emmo->target, players[i].mo); P_SetMobjState(emmo, mobjinfo[MT_GOTEMERALD].meleestate + em); P_SetTarget(&players[i].mo->tracer, emmo); if (pnum == 255) { - i = pnum; + pnum = i; continue; } From 2110fa6bd1642c74ea755f5187ce5ecabd2049d4 Mon Sep 17 00:00:00 2001 From: toaster Date: Mon, 25 Nov 2019 14:59:06 +0000 Subject: [PATCH 3/3] Fix extra lives given to game-overed players not re-entering them into the action when cv_coopstarposts is 0. --- src/p_user.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index ed2a1a446..cdfc073c6 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1223,6 +1223,7 @@ void P_GivePlayerSpheres(player_t *player, INT32 num_spheres) // void P_GivePlayerLives(player_t *player, INT32 numlives) { + UINT8 prevlives = player->lives; if (!player) return; @@ -1239,10 +1240,9 @@ void P_GivePlayerLives(player_t *player, INT32 numlives) if ((netgame || multiplayer) && gametype == GT_COOP && cv_cooplives.value == 0) { - UINT8 prevlives = player->lives; P_GivePlayerRings(player, 100*numlives); if (player->lives - prevlives >= numlives) - return; + goto docooprespawn; numlives = (numlives + prevlives - player->lives); } @@ -1256,6 +1256,15 @@ void P_GivePlayerLives(player_t *player, INT32 numlives) player->lives = 99; else if (player->lives < 1) player->lives = 1; + +docooprespawn: + if (cv_coopstarposts.value) + return; + if (prevlives > 0) + return; + if (!player->spectator) + return; + P_SpectatorJoinGame(player); } void P_GiveCoopLives(player_t *player, INT32 numlives, boolean sound)