From 58e685353a3575e71869f691de6a2e793cb1ec1e Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Tue, 5 Jan 2016 05:03:00 -0800 Subject: [PATCH] Attempt 2 at special stage fades. More basic in execution. --- src/dehacked.c | 12 ++++++++++-- src/f_finale.h | 3 ++- src/f_wipe.c | 1 + src/p_setup.c | 51 +++++++++++++++++++++++++++++++++++++------------- 4 files changed, 51 insertions(+), 16 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 44ef998ac..f7ec8ed51 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -3187,6 +3187,12 @@ static void readwipes(MYFILE *f) else if (fastcmp(pword, "FINAL")) wipeoffset = wipe_gameend_final; } + else if (fastncmp(word, "SPECLEVEL_", 10)) + { + pword = word + 10; + if (fastcmp(pword, "TOWHITE")) + wipeoffset = wipe_speclevel_towhite; + } if (wipeoffset < 0) { @@ -3194,9 +3200,11 @@ static void readwipes(MYFILE *f) continue; } - if (value == UINT8_MAX // Cannot disable non-toblack wipes (or the level toblack wipe) - && (wipeoffset <= wipe_level_toblack || wipeoffset >= wipe_level_final)) + if (value == UINT8_MAX + && (wipeoffset <= wipe_level_toblack || wipeoffset >= wipe_speclevel_towhite)) { + // Cannot disable non-toblack wipes + // (or the level toblack wipe, or the special towhite wipe) deh_warning("Wipes: can't disable wipe of type '%s'", word); continue; } diff --git a/src/f_finale.h b/src/f_finale.h index 97a26f4c4..e263a3797 100644 --- a/src/f_finale.h +++ b/src/f_finale.h @@ -90,6 +90,7 @@ enum // custom intermissions wipe_specinter_toblack, wipe_multinter_toblack, + wipe_speclevel_towhite, wipe_level_final, wipe_intermission_final, @@ -108,7 +109,7 @@ enum NUMWIPEDEFS }; -#define WIPEFINALSHIFT 12 +#define WIPEFINALSHIFT 13 extern UINT8 wipedefs[NUMWIPEDEFS]; #endif diff --git a/src/f_wipe.c b/src/f_wipe.c index 6f14e577a..e0578949e 100644 --- a/src/f_wipe.c +++ b/src/f_wipe.c @@ -58,6 +58,7 @@ UINT8 wipedefs[NUMWIPEDEFS] = { 0, // wipe_specinter_toblack 0, // wipe_multinter_toblack + 0, // wipe_speclevel_towhite 0, // wipe_level_final 0, // wipe_intermission_final diff --git a/src/p_setup.c b/src/p_setup.c index 3491669c7..dc0e4ffd5 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2369,7 +2369,7 @@ boolean P_SetupLevel(boolean skipprecip) // use gamemap to get map number. // 99% of the things already did, so. // Map header should always be in place at this point - INT32 i, loadprecip = 1; + INT32 i, loadprecip = 1, ranspecialwipe = 0; INT32 loademblems = 1; INT32 fromnetsave = 0; boolean loadedbm = false; @@ -2442,6 +2442,28 @@ boolean P_SetupLevel(boolean skipprecip) // will be set by player think. players[consoleplayer].viewz = 1; + // Special stage fade to white + // This is handled BEFORE sounds are stopped. + if (rendermode != render_none && G_IsSpecialStage(gamemap)) + { + tic_t starttime = I_GetTime(); + tic_t endtime = starttime + (3*TICRATE)/2; + + S_StartSound(NULL, sfx_s3kaf); + + F_WipeStartScreen(); + V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 0); + + F_WipeEndScreen(); + F_RunWipe(wipedefs[wipe_speclevel_towhite], false); + + // Hold on white for extra effect. + while (I_GetTime() < endtime) + I_Sleep(); + + ranspecialwipe = 1; + } + // Make sure all sounds are stopped before Z_FreeTags. S_StopSounds(); S_ClearSfx(); @@ -2451,25 +2473,28 @@ boolean P_SetupLevel(boolean skipprecip) S_Start(); // Let's fade to black here - if (rendermode != render_none) + // But only if we didn't do the special stage wipe + if (rendermode != render_none && !ranspecialwipe) { F_WipeStartScreen(); V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); F_WipeEndScreen(); F_RunWipe(wipedefs[wipe_level_toblack], false); + } + // Print "SPEEDING OFF TO [ZONE] [ACT 1]..." + if (rendermode != render_none) + { // Don't include these in the fade! - { - char tx[64]; - V_DrawSmallString(1, 191, V_ALLOWLOWERCASE, M_GetText("Speeding off to...")); - snprintf(tx, 63, "%s%s%s", - mapheaderinfo[gamemap-1]->lvlttl, - (mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE) ? "" : " ZONE", - (mapheaderinfo[gamemap-1]->actnum > 0) ? va(", Act %d",mapheaderinfo[gamemap-1]->actnum) : ""); - V_DrawSmallString(1, 195, V_ALLOWLOWERCASE, tx); - I_UpdateNoVsync(); - } + char tx[64]; + V_DrawSmallString(1, 191, V_ALLOWLOWERCASE, M_GetText("Speeding off to...")); + snprintf(tx, 63, "%s%s%s", + mapheaderinfo[gamemap-1]->lvlttl, + (mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE) ? "" : " ZONE", + (mapheaderinfo[gamemap-1]->actnum > 0) ? va(", Act %d",mapheaderinfo[gamemap-1]->actnum) : ""); + V_DrawSmallString(1, 195, V_ALLOWLOWERCASE, tx); + I_UpdateNoVsync(); } #ifdef HAVE_BLUA @@ -2767,7 +2792,7 @@ boolean P_SetupLevel(boolean skipprecip) // Remove the loading shit from the screen if (rendermode != render_none) - V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); + V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, (ranspecialwipe) ? 0 : 31); if (precache || dedicated) R_PrecacheLevel();