From e0149fea3afad8acf03de1e69f1e8c0121b0beed Mon Sep 17 00:00:00 2001 From: NepDisk <16447892+NepDisk@users.noreply.github.com> Date: Mon, 14 Oct 2024 17:54:47 -0400 Subject: [PATCH] revert fades --- src/d_main.c | 10 ++-- src/f_finale.c | 8 +-- src/f_finale.h | 4 +- src/f_wipe.c | 138 +++++-------------------------------------------- src/p_setup.c | 89 ++++++++++++------------------- 5 files changed, 56 insertions(+), 193 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 4909f7646..58da12a8d 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -323,7 +323,7 @@ static void D_Display(void) if (gamestate == GS_TITLESCREEN && wipegamestate != GS_INTRO) wipedefindex = wipe_timeattack_toblack; - if (wipetypepre < 0 || !F_WipeExists(wipetypepre)) + if (wipetypepre < 0) wipetypepre = wipedefs[wipedefindex]; if (rendermode != render_none) @@ -335,7 +335,7 @@ static void D_Display(void) F_WipeStartScreen(); F_WipeColorFill(31); F_WipeEndScreen(); - F_RunWipe(wipetypepre, gamestate != GS_TIMEATTACK, "FADEMAP0", false, false); + F_RunWipe(wipetypepre, gamestate != GS_TIMEATTACK); } if (gamestate != GS_LEVEL && rendermode != render_none) @@ -348,7 +348,7 @@ static void D_Display(void) } else //dedicated servers { - F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK, "FADEMAP0", false, false); + F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK); wipegamestate = gamestate; } @@ -616,14 +616,14 @@ static void D_Display(void) // and input during wipe tends to mess things up wipedefindex += WIPEFINALSHIFT; - if (wipetypepost < 0 || !F_WipeExists(wipetypepost)) + if (wipetypepost < 0) wipetypepost = wipedefs[wipedefindex]; if (rendermode != render_none) { F_WipeEndScreen(); - F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK && gamestate != GS_TITLESCREEN, "FADEMAP0", true, false); + F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK && gamestate != GS_TITLESCREEN); } // reset counters so timedemo doesn't count the wipe duration diff --git a/src/f_finale.c b/src/f_finale.c index 8633d7bb1..50e1192c0 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -303,7 +303,7 @@ void F_StartIntro(void) F_WipeStartScreen(); V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); F_WipeEndScreen(); - F_RunWipe(wipedefs[wipe_intro_toblack], false, "FADEMAP0", false, false); + F_RunWipe(wipedefs[wipe_intro_toblack], false); } S_StopMusic(); @@ -399,7 +399,7 @@ void F_IntroTicker(void) F_WipeStartScreen(); F_WipeColorFill(31); F_WipeEndScreen(); - F_RunWipe(99, true, "FADEMAP0", false, false); + F_RunWipe(99, true); } // Stay on black for a bit. =) @@ -2403,7 +2403,7 @@ void F_CutsceneDrawer(void) V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, cutscenes[cutnum]->scene[scenenum].fadecolor); F_WipeEndScreen(); - F_RunWipe(cutscenes[cutnum]->scene[scenenum].fadeinid, true, NULL, false, false); + F_RunWipe(cutscenes[cutnum]->scene[scenenum].fadeinid, true); F_WipeStartScreen(); } @@ -2423,7 +2423,7 @@ void F_CutsceneDrawer(void) if (dofadenow && rendermode != render_none) { F_WipeEndScreen(); - F_RunWipe(cutscenes[cutnum]->scene[scenenum].fadeoutid, true, NULL, false, false); + F_RunWipe(cutscenes[cutnum]->scene[scenenum].fadeoutid, true); } V_DrawString(textxpos, textypos, V_ALLOWLOWERCASE, cutscene_disptext); diff --git a/src/f_finale.h b/src/f_finale.h index 011908c84..74e2607f7 100644 --- a/src/f_finale.h +++ b/src/f_finale.h @@ -146,11 +146,9 @@ extern INT32 lastwipetic; void F_WipeStartScreen(void); void F_WipeEndScreen(void); -void F_RunWipe(UINT8 wipetype, boolean drawMenu, const char *colormap, boolean reverse, boolean encorewiggle); +void F_RunWipe(UINT8 wipetype, boolean drawMenu); void F_WipeStageTitle(void); #define F_WipeColorFill(c) V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, c) -tic_t F_GetWipeLength(UINT8 wipetype); -boolean F_WipeExists(UINT8 wipetype); enum { diff --git a/src/f_wipe.c b/src/f_wipe.c index 5f5ebac3e..a09f7ff97 100644 --- a/src/f_wipe.c +++ b/src/f_wipe.c @@ -191,7 +191,7 @@ static fademask_t *F_GetFadeMask(UINT8 masknum, UINT8 scrnnum) { * * \param fademask pixels to change */ -static void F_DoWipe(fademask_t *fademask, lighttable_t *fadecolormap, boolean reverse) +static void F_DoWipe(fademask_t *fademask) { // Software mask wipe -- optimized; though it might not look like it! // Okay, to save you wondering *how* this is more optimized than the simpler @@ -209,10 +209,6 @@ static void F_DoWipe(fademask_t *fademask, lighttable_t *fadecolormap, boolean r // look a little messy; sorry!) but it simultaneously runs at twice the speed. // In addition, we precalculate all the X and Y positions that we need to draw // from and to, so it uses a little extra memory, but again, helps it run faster. - // --- - // Sal: I kinda destroyed some of this code by introducing Genesis-style fades. - // A colormap can be provided in F_RunWipe, which the white/black values will be - // remapped to the appropriate entry in the fade colormap. { // wipe screen, start, end UINT8 *w = wipe_scr; @@ -256,8 +252,6 @@ static void F_DoWipe(fademask_t *fademask, lighttable_t *fadecolormap, boolean r maskx = masky = 0; do { - UINT8 m = *mask; - draw_rowstart = scrxpos[maskx]; draw_rowend = scrxpos[maskx + 1]; draw_linestart = scrypos[masky]; @@ -266,31 +260,28 @@ static void F_DoWipe(fademask_t *fademask, lighttable_t *fadecolormap, boolean r relativepos = (draw_linestart * vid.width) + draw_rowstart; draw_linestogo = draw_lineend - draw_linestart; - if (reverse) - m = ((pallen-1) - m); - - if (m == 0) + if (*mask == 0) { // shortcut - memcpy source to work while (draw_linestogo--) { - M_Memcpy(w_base+relativepos, (reverse ? e_base : s_base)+relativepos, draw_rowend-draw_rowstart); + M_Memcpy(w_base+relativepos, s_base+relativepos, draw_rowend-draw_rowstart); relativepos += vid.width; } } - else if (m >= (pallen-1)) + else if (*mask == 10) { // shortcut - memcpy target to work while (draw_linestogo--) { - M_Memcpy(w_base+relativepos, (reverse ? s_base : e_base)+relativepos, draw_rowend-draw_rowstart); + M_Memcpy(w_base+relativepos, e_base+relativepos, draw_rowend-draw_rowstart); relativepos += vid.width; } } else { // pointer to transtable that this mask would use - transtbl = transtables + ((9 - m)< 99) - return 0; - - for (wipeframe = 0; wipeframe < 100; wipeframe++) - { - sprintf(&lumpname[4], "%.2hu%.2hu", (UINT16)wipetype, (UINT16)wipeframe); - - lumpnum = W_CheckNumForName(lumpname); - if (lumpnum == LUMPERROR) - return --wipeframe; - } - return --wipeframe; -#endif -} - -/** Does the specified wipe exist? - */ -boolean F_WipeExists(UINT8 wipetype) -{ -#ifdef NOWIPE - (void)wipetype; - return false; -#else - static char lumpname[10] = "FADEmm00"; - lumpnum_t lumpnum; - - if (wipetype > 99) - return false; - - sprintf(&lumpname[4], "%.2hu00", (UINT16)wipetype); - - lumpnum = W_CheckNumForName(lumpname); - return !(lumpnum == LUMPERROR); #endif } diff --git a/src/p_setup.c b/src/p_setup.c index 6f09318d7..0de1a06db 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -7863,67 +7863,53 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate) // This is handled BEFORE sounds are stopped. else if (encoremode && !prevencoremode && !demo.rewinding) { + tic_t locstarttime, endtime, nowtime; + if (rendermode != render_none) { - tic_t locstarttime, endtime, nowtime; - S_StopMusic(); // er, about that... - // Fade to an inverted screen, with a circle fade... - F_WipeStartScreen(); - - V_EncoreInvertScreen(); - F_WipeEndScreen(); - S_StartSound(NULL, sfx_ruby1); - F_RunWipe(wipedefs[wipe_encore_toinvert], false, NULL, false, false); - // Hold on invert for extra effect. - // (This define might be useful for other areas of code? Not sure) -#define WAIT(timetowait) \ - locstarttime = nowtime = lastwipetic; \ - endtime = locstarttime + timetowait; \ - while (nowtime < endtime) \ - { \ - while (!((nowtime = I_GetTime()) - lastwipetic)) \ - { \ - I_Sleep(cv_sleep.value); \ - I_UpdateTime(cv_timescale.value); \ - } \ - lastwipetic = nowtime; \ - if (moviemode) \ - M_SaveFrame(); \ - NetKeepAlive(); \ - } \ - - WAIT((3*TICRATE)/2); - S_StartSound(NULL, sfx_ruby2); - - // Then fade to a white screen F_WipeStartScreen(); + V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 122); - V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 0); F_WipeEndScreen(); + F_RunWipe(wipedefs[wipe_encore_towhite], false); - F_RunWipe(wipedefs[wipe_encore_towhite], false, "FADEMAP1", false, true); // wiggle the screen during this! - - // THEN fade to a black screen. F_WipeStartScreen(); + V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 120); - V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); F_WipeEndScreen(); - - F_RunWipe(wipedefs[wipe_level_toblack], false, "FADEMAP0", false, false); - - // Wait a bit longer. - WAIT((3*TICRATE)/4); + F_RunWipe(wipedefs[wipe_level_final], false); } - else + else //dedicated servers can call this now, to wait the appropriate amount of time for clients to wipe { - // dedicated servers can call this now, to wait the appropriate amount of time for clients to wipe - F_RunWipe(wipedefs[wipe_encore_towhite], false, "FADEMAP1", false, true); - F_RunWipe(wipedefs[wipe_level_toblack], false, "FADEMAP0", false, false); + F_RunWipe(wipedefs[wipe_encore_towhite], false); + F_RunWipe(wipedefs[wipe_level_final], false); } + + locstarttime = nowtime = lastwipetic; + endtime = locstarttime + (3*TICRATE)/2; + + // Hold on white for extra effect. + while (nowtime < endtime) + { + // wait loop + while (!((nowtime = I_GetTime()) - lastwipetic)) + { + I_Sleep(cv_sleep.value); + I_UpdateTime(cv_timescale.value); + } + lastwipetic = nowtime; + if (moviemode) // make sure we save frames for the white hold too + M_SaveFrame(); + + // Keep the network alive + NetKeepAlive(); + } + + ranspecialwipe = 1; } // Special stage & record attack retry fade to white @@ -7953,13 +7939,6 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate) // But only if we didn't do the encore startup wipe if (!demo.rewinding && !reloadinggamestate) { - - // Fade out music here. Deduct 2 tics so the fade volume actually reaches 0. - // But don't halt the music! S_Start will take care of that. This dodges a MIDI crash bug. - if (!(reloadinggamestate || titlemapinaction)) - S_FadeMusic(0, FixedMul( - FixedDiv((F_GetWipeLength(wipedefs[wipe_level_toblack])-2)*NEWTICRATERATIO, NEWTICRATE), MUSICRATE)); - // Reset the palette now all fades have been done if (rendermode != render_none) V_SetPaletteLump(GetPalette()); // Set the level palette @@ -7978,7 +7957,7 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate) } } - levelfadecol = (encoremode && !ranspecialwipe ? 209 : 0); + levelfadecol = (encoremode && !ranspecialwipe ? 122 : 120); // Let's fade to white here // But only if we didn't do the encore startup wipe @@ -7990,11 +7969,11 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate) V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, levelfadecol); F_WipeEndScreen(); - F_RunWipe(wipedefs[(encoremode ? wipe_level_final : wipe_level_toblack)], false, "FADEMAP0", false, false); + F_RunWipe(wipedefs[(encoremode ? wipe_level_final : wipe_level_toblack)], false); } else //dedicated servers { - F_RunWipe(wipedefs[(encoremode ? wipe_level_final : wipe_level_toblack)], false, "FADEMAP0", false, false); + F_RunWipe(wipedefs[(encoremode ? wipe_level_final : wipe_level_toblack)], false); } } /*if (!titlemapinaction)