fix fades for real

This commit is contained in:
Jaime Passos 2019-11-05 12:10:42 -03:00
parent f057c6eef8
commit 00d76bd9ef
7 changed files with 97 additions and 58 deletions

View File

@ -267,7 +267,7 @@ static void D_Display(void)
&& wipetypepre != UINT8_MAX) && wipetypepre != UINT8_MAX)
{ {
F_WipeStartScreen(); F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); F_WipeColorFill(31);
F_WipeEndScreen(); F_WipeEndScreen();
F_RunWipe(wipetypepre, gamestate != GS_TIMEATTACK && gamestate != GS_TITLESCREEN); F_RunWipe(wipetypepre, gamestate != GS_TIMEATTACK && gamestate != GS_TITLESCREEN);
} }

View File

@ -763,7 +763,7 @@ void F_IntroDrawer(void)
if (rendermode != render_none) if (rendermode != render_none)
{ {
F_WipeStartScreen(); F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); F_WipeColorFill(31);
F_WipeEndScreen(); F_WipeEndScreen();
F_RunWipe(99,true); F_RunWipe(99,true);
} }
@ -773,10 +773,11 @@ void F_IntroDrawer(void)
else if (intro_scenenum == 10) else if (intro_scenenum == 10)
{ {
// The only fade to white in the entire damn game. // The only fade to white in the entire damn game.
// (not true)
if (rendermode != render_none) if (rendermode != render_none)
{ {
F_WipeStartScreen(); F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 0); F_WipeColorFill(0);
F_WipeEndScreen(); F_WipeEndScreen();
F_RunWipe(99,true); F_RunWipe(99,true);
} }
@ -786,7 +787,7 @@ void F_IntroDrawer(void)
if (rendermode != render_none) if (rendermode != render_none)
{ {
F_WipeStartScreen(); F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); F_WipeColorFill(31);
F_WipeEndScreen(); F_WipeEndScreen();
F_RunWipe(99,true); F_RunWipe(99,true);
} }
@ -833,7 +834,7 @@ void F_IntroDrawer(void)
patch_t *radar = W_CachePatchName("RADAR", PU_CACHE); patch_t *radar = W_CachePatchName("RADAR", PU_CACHE);
F_WipeStartScreen(); F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); F_WipeColorFill(31);
V_DrawScaledPatch(0, 0, 0, radar); V_DrawScaledPatch(0, 0, 0, radar);
W_UnlockCachedPatch(radar); W_UnlockCachedPatch(radar);
V_DrawString(8, 128, 0, cutscene_disptext); V_DrawString(8, 128, 0, cutscene_disptext);
@ -846,7 +847,7 @@ void F_IntroDrawer(void)
patch_t *grass = W_CachePatchName("SGRASS5", PU_CACHE); patch_t *grass = W_CachePatchName("SGRASS5", PU_CACHE);
F_WipeStartScreen(); F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); F_WipeColorFill(31);
V_DrawScaledPatch(0, 0, 0, grass); V_DrawScaledPatch(0, 0, 0, grass);
W_UnlockCachedPatch(grass); W_UnlockCachedPatch(grass);
V_DrawString(8, 128, 0, cutscene_disptext); V_DrawString(8, 128, 0, cutscene_disptext);
@ -859,7 +860,7 @@ void F_IntroDrawer(void)
patch_t *confront = W_CachePatchName("CONFRONT", PU_CACHE); patch_t *confront = W_CachePatchName("CONFRONT", PU_CACHE);
F_WipeStartScreen(); F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); F_WipeColorFill(31);
V_DrawSmallScaledPatch(0, 0, 0, confront); V_DrawSmallScaledPatch(0, 0, 0, confront);
W_UnlockCachedPatch(confront); W_UnlockCachedPatch(confront);
V_DrawString(8, 128, 0, cutscene_disptext); V_DrawString(8, 128, 0, cutscene_disptext);
@ -872,7 +873,7 @@ void F_IntroDrawer(void)
patch_t *sdo = W_CachePatchName("SONICDO2", PU_CACHE); patch_t *sdo = W_CachePatchName("SONICDO2", PU_CACHE);
F_WipeStartScreen(); F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); F_WipeColorFill(31);
V_DrawSmallScaledPatch(0, 0, 0, sdo); V_DrawSmallScaledPatch(0, 0, 0, sdo);
W_UnlockCachedPatch(sdo); W_UnlockCachedPatch(sdo);
V_DrawString(224, 8, 0, cutscene_disptext); V_DrawString(224, 8, 0, cutscene_disptext);

View File

@ -138,6 +138,8 @@ void F_WipeStartScreen(void);
void F_WipeEndScreen(void); void F_WipeEndScreen(void);
void F_RunWipe(UINT8 wipetype, boolean drawMenu); void F_RunWipe(UINT8 wipetype, boolean drawMenu);
void F_WipeTicker(void); void F_WipeTicker(void);
void F_WipeTitleCard(void);
void F_WipeColorFill(UINT8 color);
tic_t F_GetWipeLength(UINT8 wipetype); tic_t F_GetWipeLength(UINT8 wipetype);
boolean F_WipeExists(UINT8 wipetype); boolean F_WipeExists(UINT8 wipetype);

View File

@ -103,6 +103,7 @@ static fixed_t paldiv = 0;
static UINT8 curwipetype; static UINT8 curwipetype;
static UINT8 curwipeframe; static UINT8 curwipeframe;
static UINT8 wipecolorfill = 31;
/** Create fademask_t from lump /** Create fademask_t from lump
* *
@ -186,7 +187,7 @@ static fademask_t *F_GetFadeMask(UINT8 masknum, UINT8 scrnnum) {
return NULL; return NULL;
} }
static void F_WipeTitleCard(void) void F_WipeTitleCard(void)
{ {
if (wipestyle == WIPESTYLE_LEVEL if (wipestyle == WIPESTYLE_LEVEL
&& (!titlemapinaction) && (!titlemapinaction)
@ -199,6 +200,12 @@ static void F_WipeTitleCard(void)
ST_drawLevelTitle(TICRATE); ST_drawLevelTitle(TICRATE);
} }
void F_WipeColorFill(UINT8 color)
{
wipecolorfill = color;
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, wipecolorfill);
}
/** Wipe ticker /** Wipe ticker
* *
* \param fademask pixels to change * \param fademask pixels to change
@ -430,10 +437,17 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu)
#ifdef HWRENDER #ifdef HWRENDER
if (rendermode == render_opengl) if (rendermode == render_opengl)
HWR_DoWipe(wipetype, wipeframe-1); // send in the wipe type and wipeframe because we need to cache the graphic {
// send in the wipe type and wipe frame because we need to cache the graphic
if (wipestyle == WIPESTYLE_LEVEL)
HWR_DoTintedWipe(wipetype, wipeframe-1);
else
HWR_DoWipe(wipetype, wipeframe-1);
}
else else
#endif #endif
F_DoWipe(fmask); F_DoWipe(fmask);
I_OsPolling(); I_OsPolling();
I_UpdateNoBlit(); I_UpdateNoBlit();
@ -473,8 +487,9 @@ void F_WipeTicker(void)
} }
#ifdef HWRENDER #ifdef HWRENDER
// send in the wipe type and wipe frame because we need to cache the graphic
if (rendermode == render_opengl) if (rendermode == render_opengl)
HWR_DoWipeLevel(curwipetype, curwipeframe-1); HWR_DoLevelWipe(curwipetype, curwipeframe-1, wipecolorfill); // also send the wipe color
else else
#endif #endif
F_DoWipe(fmask); F_DoWipe(fmask);

View File

@ -39,6 +39,7 @@
#include "../st_stuff.h" #include "../st_stuff.h"
#include "../i_system.h" #include "../i_system.h"
#include "../m_cheat.h" #include "../m_cheat.h"
#include "../f_finale.h"
#ifdef ESLOPE #ifdef ESLOPE
#include "../p_slopes.h" #include "../p_slopes.h"
#endif #endif
@ -6991,73 +6992,82 @@ void HWR_DrawIntermissionBG(void)
HWD.pfnDrawIntermissionBG(); HWD.pfnDrawIntermissionBG();
} }
void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum) //
// hwr mode wipes
//
static char wipelumpname[9];
static lumpnum_t wipelumpnum;
// puts wipe lumpname in wipename[9]
static boolean check_wipe(UINT8 wipenum, UINT8 scrnnum)
{ {
static char lumpname[9] = "FADEmmss";
lumpnum_t lumpnum;
size_t lsize; size_t lsize;
if (wipenum > 99 || scrnnum > 99) // not a valid wipe number // write FADE prefix into wipelumpname
return; // shouldn't end up here really, the loop should've stopped running beforehand strncpy(wipelumpname, "FADEmmss", 8);
// puts the numbers into the lumpname // not a valid wipe number
sprintf(&lumpname[4], "%.2hu%.2hu", (UINT16)wipenum, (UINT16)scrnnum); if (wipenum > 99 || scrnnum > 99)
lumpnum = W_CheckNumForName(lumpname); return false; // shouldn't end up here really, the loop should've stopped running beforehand
if (lumpnum == LUMPERROR) // again, shouldn't be here really // puts the numbers into the wipename
return; sprintf(&wipelumpname[4], "%.2hu%.2hu", (UINT16)wipenum, (UINT16)scrnnum);
wipelumpnum = W_CheckNumForName(wipelumpname);
lsize = W_LumpLength(lumpnum); // again, shouldn't be here really
if (wipelumpnum == LUMPERROR)
return false;
lsize = W_LumpLength(wipelumpnum);
if (!(lsize == 256000 || lsize == 64000 || lsize == 16000 || lsize == 4000)) if (!(lsize == 256000 || lsize == 64000 || lsize == 16000 || lsize == 4000))
{ {
CONS_Alert(CONS_WARNING, "Fade mask lump %s of incorrect size, ignored\n", lumpname); CONS_Alert(CONS_WARNING, "Fade mask lump %s of incorrect size, ignored\n", wipelumpname);
return; // again, shouldn't get here if it is a bad size return false; // again, shouldn't get here if it is a bad size
} }
HWR_GetFadeMask(lumpnum); return true;
}
void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum)
{
if (!check_wipe(wipenum, scrnnum))
return;
HWR_GetFadeMask(wipelumpnum);
HWD.pfnDoScreenWipe(HWRWipeCounter); // Still send in wipecounter since old stuff might not support multitexturing HWD.pfnDoScreenWipe(HWRWipeCounter); // Still send in wipecounter since old stuff might not support multitexturing
HWRWipeCounter += 0.05f; // increase opacity of end screen HWRWipeCounter += 0.05f; // increase opacity of end screen
if (HWRWipeCounter > 1.0f) if (HWRWipeCounter > 1.0f)
HWRWipeCounter = 1.0f; HWRWipeCounter = 1.0f;
} }
void HWR_DoWipeLevel(UINT8 wipenum, UINT8 scrnnum) void HWR_DoTintedWipe(UINT8 wipenum, UINT8 scrnnum)
{ {
static char lumpname[9] = "FADEmmss"; if (!check_wipe(wipenum, scrnnum))
lumpnum_t lumpnum;
size_t lsize;
if (wipenum > 99 || scrnnum > 99) // not a valid wipe number
return; // shouldn't end up here really, the loop should've stopped running beforehand
// puts the numbers into the lumpname
sprintf(&lumpname[4], "%.2hu%.2hu", (UINT16)wipenum, (UINT16)scrnnum);
lumpnum = W_CheckNumForName(lumpname);
if (lumpnum == LUMPERROR) // again, shouldn't be here really
return; return;
lsize = W_LumpLength(lumpnum); HWR_GetFadeMask(wipelumpnum);
HWD.pfnDoScreenWipe(HWRWipeCounter);
if (!(lsize == 256000 || lsize == 64000 || lsize == 16000 || lsize == 4000))
{
CONS_Alert(CONS_WARNING, "Fade mask lump %s of incorrect size, ignored\n", lumpname);
return; // again, shouldn't get here if it is a bad size
}
HWR_EndScreenWipe();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
HWR_StartScreenWipe();
HWR_GetFadeMask(lumpnum);
HWD.pfnDoScreenWipeLevel();
HWRWipeCounter += 0.05f; // increase opacity of end screen HWRWipeCounter += 0.05f; // increase opacity of end screen
if (HWRWipeCounter > 1.0f)
HWRWipeCounter = 1.0f;
}
void HWR_DoLevelWipe(UINT8 wipenum, UINT8 scrnnum, UINT8 wipecolorfill)
{
if (!check_wipe(wipenum, scrnnum))
return;
HWR_EndScreenWipe();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, wipecolorfill);
HWR_StartScreenWipe();
HWR_GetFadeMask(wipelumpnum);
HWD.pfnDoScreenWipeLevel();
F_WipeTitleCard();
HWRWipeCounter += 0.05f; // increase opacity of end screen
if (HWRWipeCounter > 1.0f) if (HWRWipeCounter > 1.0f)
HWRWipeCounter = 1.0f; HWRWipeCounter = 1.0f;
} }

View File

@ -67,7 +67,8 @@ void HWR_StartScreenWipe(void);
void HWR_EndScreenWipe(void); void HWR_EndScreenWipe(void);
void HWR_DrawIntermissionBG(void); void HWR_DrawIntermissionBG(void);
void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum); void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum);
void HWR_DoWipeLevel(UINT8 wipenum, UINT8 scrnnum); void HWR_DoTintedWipe(UINT8 wipenum, UINT8 scrnnum);
void HWR_DoLevelWipe(UINT8 wipenum, UINT8 scrnnum, UINT8 wipecolorfill);
void HWR_MakeScreenFinalTexture(void); void HWR_MakeScreenFinalTexture(void);
void HWR_DrawScreenFinalTexture(int width, int height); void HWR_DrawScreenFinalTexture(int width, int height);

View File

@ -2691,10 +2691,15 @@ boolean P_SetupLevel(boolean skipprecip)
F_WipeStartScreen(); F_WipeStartScreen();
wipestyleflags |= WSF_FADEOUT|WSF_TOWHITE; wipestyleflags |= WSF_FADEOUT|WSF_TOWHITE;
#ifdef HWRENDER
// uh..........
if (rendermode == render_opengl)
F_WipeColorFill(0);
#endif
F_WipeEndScreen(); F_WipeEndScreen();
F_RunWipe(wipedefs[wipe_speclevel_towhite], false); F_RunWipe(wipedefs[wipe_speclevel_towhite], false);
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 0);
I_OsPolling(); I_OsPolling();
I_FinishUpdate(); // page flip or blit buffer I_FinishUpdate(); // page flip or blit buffer
if (moviemode) if (moviemode)
@ -2734,7 +2739,12 @@ boolean P_SetupLevel(boolean skipprecip)
{ {
F_WipeStartScreen(); F_WipeStartScreen();
wipestyleflags |= WSF_FADEOUT; wipestyleflags |= WSF_FADEOUT;
//V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
#ifdef HWRENDER
// uh..........
if (rendermode == render_opengl)
F_WipeColorFill(31);
#endif
F_WipeEndScreen(); F_WipeEndScreen();
// for titlemap: run a specific wipe if specified // for titlemap: run a specific wipe if specified
@ -3130,7 +3140,7 @@ boolean P_SetupLevel(boolean skipprecip)
// Remove the loading shit from the screen // Remove the loading shit from the screen
if (rendermode != render_none && !titlemapinaction) if (rendermode != render_none && !titlemapinaction)
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, levelfadecol); F_WipeColorFill(levelfadecol);
if (precache || dedicated) if (precache || dedicated)
R_PrecacheLevel(); R_PrecacheLevel();
@ -3203,7 +3213,7 @@ boolean P_SetupLevel(boolean skipprecip)
I_Sleep(); I_Sleep();
lasttime = nowtime; lasttime = nowtime;
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, levelfadecol); F_WipeColorFill(levelfadecol);
stplyr = &players[consoleplayer]; stplyr = &players[consoleplayer];
ST_drawLevelTitle(nowtime - starttime); ST_drawLevelTitle(nowtime - starttime);
if (splitscreen) if (splitscreen)