mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-18 15:32:33 +00:00
Slap colormap fades everywhere
This commit is contained in:
parent
82cbd953fb
commit
6adb957f0f
9 changed files with 100 additions and 35 deletions
16
src/d_main.c
16
src/d_main.c
|
@ -274,7 +274,10 @@ static void D_Display(void)
|
||||||
&& wipetypepre != UINT8_MAX)
|
&& wipetypepre != UINT8_MAX)
|
||||||
{
|
{
|
||||||
F_WipeStartScreen();
|
F_WipeStartScreen();
|
||||||
F_WipeColorFill(31);
|
// Check for Mega Genesis fade
|
||||||
|
wipestyleflags = WSF_FADEOUT;
|
||||||
|
if (F_TryColormapFade(31))
|
||||||
|
wipetypepost = -1; // Don't run the fade below this one
|
||||||
F_WipeEndScreen();
|
F_WipeEndScreen();
|
||||||
F_RunWipe(wipetypepre, gamestate != GS_TIMEATTACK && gamestate != GS_TITLESCREEN);
|
F_RunWipe(wipetypepre, gamestate != GS_TIMEATTACK && gamestate != GS_TITLESCREEN);
|
||||||
}
|
}
|
||||||
|
@ -488,15 +491,24 @@ static void D_Display(void)
|
||||||
if (rendermode != render_none)
|
if (rendermode != render_none)
|
||||||
{
|
{
|
||||||
F_WipeEndScreen();
|
F_WipeEndScreen();
|
||||||
|
|
||||||
// Funny.
|
// Funny.
|
||||||
if (WipeStageTitle && st_overlay)
|
if (WipeStageTitle && st_overlay)
|
||||||
{
|
{
|
||||||
lt_ticker--;
|
lt_ticker--;
|
||||||
lt_lasttic = lt_ticker;
|
lt_lasttic = lt_ticker;
|
||||||
ST_preLevelTitleCardDrawer(0, false);
|
ST_preLevelTitleCardDrawer(false);
|
||||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, levelfadecol);
|
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, levelfadecol);
|
||||||
F_WipeStartScreen();
|
F_WipeStartScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check for Mega Genesis fade
|
||||||
|
if (F_ShouldColormapFade())
|
||||||
|
{
|
||||||
|
wipestyleflags |= WSF_FADEIN;
|
||||||
|
wipestyleflags &= ~WSF_FADEOUT;
|
||||||
|
}
|
||||||
|
|
||||||
F_RunWipe(wipetypepost, gamestate != GS_TIMEATTACK && gamestate != GS_TITLESCREEN);
|
F_RunWipe(wipetypepost, gamestate != GS_TIMEATTACK && gamestate != GS_TITLESCREEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -910,8 +910,9 @@ void F_IntroDrawer(void)
|
||||||
{
|
{
|
||||||
if (rendermode != render_none)
|
if (rendermode != render_none)
|
||||||
{
|
{
|
||||||
|
wipestyleflags = WSF_FADEOUT;
|
||||||
F_WipeStartScreen();
|
F_WipeStartScreen();
|
||||||
F_WipeColorFill(31);
|
F_TryColormapFade(31);
|
||||||
F_WipeEndScreen();
|
F_WipeEndScreen();
|
||||||
F_RunWipe(99,true);
|
F_RunWipe(99,true);
|
||||||
}
|
}
|
||||||
|
@ -920,12 +921,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.
|
|
||||||
// (not true)
|
|
||||||
if (rendermode != render_none)
|
if (rendermode != render_none)
|
||||||
{
|
{
|
||||||
|
wipestyleflags = (WSF_FADEOUT|WSF_TOWHITE);
|
||||||
F_WipeStartScreen();
|
F_WipeStartScreen();
|
||||||
F_WipeColorFill(0);
|
F_TryColormapFade(0);
|
||||||
F_WipeEndScreen();
|
F_WipeEndScreen();
|
||||||
F_RunWipe(99,true);
|
F_RunWipe(99,true);
|
||||||
}
|
}
|
||||||
|
@ -934,8 +934,9 @@ void F_IntroDrawer(void)
|
||||||
{
|
{
|
||||||
if (rendermode != render_none)
|
if (rendermode != render_none)
|
||||||
{
|
{
|
||||||
|
wipestyleflags = WSF_FADEOUT;
|
||||||
F_WipeStartScreen();
|
F_WipeStartScreen();
|
||||||
F_WipeColorFill(31);
|
F_TryColormapFade(31);
|
||||||
F_WipeEndScreen();
|
F_WipeEndScreen();
|
||||||
F_RunWipe(99,true);
|
F_RunWipe(99,true);
|
||||||
}
|
}
|
||||||
|
@ -970,6 +971,7 @@ void F_IntroDrawer(void)
|
||||||
|
|
||||||
F_WipeStartScreen();
|
F_WipeStartScreen();
|
||||||
wipegamestate = -1;
|
wipegamestate = -1;
|
||||||
|
wipestyleflags = WSF_CROSSFADE;
|
||||||
animtimer = stoptimer = 0;
|
animtimer = stoptimer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -146,7 +146,7 @@ extern boolean WipeStageTitle;
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
WIPESTYLE_NORMAL,
|
WIPESTYLE_NORMAL,
|
||||||
WIPESTYLE_LEVEL
|
WIPESTYLE_COLORMAP
|
||||||
} wipestyle_t;
|
} wipestyle_t;
|
||||||
extern wipestyle_t wipestyle;
|
extern wipestyle_t wipestyle;
|
||||||
|
|
||||||
|
@ -159,6 +159,11 @@ typedef enum
|
||||||
} wipestyleflags_t;
|
} wipestyleflags_t;
|
||||||
extern wipestyleflags_t wipestyleflags;
|
extern wipestyleflags_t wipestyleflags;
|
||||||
|
|
||||||
|
// Even my function names are borderline
|
||||||
|
boolean F_ShouldColormapFade(void);
|
||||||
|
boolean F_TryColormapFade(UINT8 wipecolor);
|
||||||
|
void F_DecideWipeStyle(void);
|
||||||
|
|
||||||
#define FADECOLORMAPDIV 8
|
#define FADECOLORMAPDIV 8
|
||||||
#define FADECOLORMAPROWS (256/FADECOLORMAPDIV)
|
#define FADECOLORMAPROWS (256/FADECOLORMAPDIV)
|
||||||
|
|
||||||
|
|
80
src/f_wipe.c
80
src/f_wipe.c
|
@ -161,7 +161,7 @@ static fademask_t *F_GetFadeMask(UINT8 masknum, UINT8 scrnnum) {
|
||||||
{
|
{
|
||||||
// Determine pixel to use from fademask
|
// Determine pixel to use from fademask
|
||||||
pcolor = &pMasterPalette[*lump++];
|
pcolor = &pMasterPalette[*lump++];
|
||||||
if (wipestyle == WIPESTYLE_LEVEL)
|
if (wipestyle == WIPESTYLE_COLORMAP)
|
||||||
*mask++ = pcolor->s.red / FADECOLORMAPDIV;
|
*mask++ = pcolor->s.red / FADECOLORMAPDIV;
|
||||||
else
|
else
|
||||||
*mask++ = FixedDiv((pcolor->s.red+1)<<FRACBITS, paldiv)>>FRACBITS;
|
*mask++ = FixedDiv((pcolor->s.red+1)<<FRACBITS, paldiv)>>FRACBITS;
|
||||||
|
@ -191,7 +191,7 @@ void F_WipeStageTitle(void)
|
||||||
{
|
{
|
||||||
// draw level title
|
// draw level title
|
||||||
if ((WipeStageTitle && st_overlay)
|
if ((WipeStageTitle && st_overlay)
|
||||||
&& (wipestyle == WIPESTYLE_LEVEL)
|
&& (wipestyle == WIPESTYLE_COLORMAP)
|
||||||
&& !(mapheaderinfo[gamemap-1]->levelflags & LF_NOTITLECARD)
|
&& !(mapheaderinfo[gamemap-1]->levelflags & LF_NOTITLECARD)
|
||||||
&& *mapheaderinfo[gamemap-1]->lvlttl != '\0')
|
&& *mapheaderinfo[gamemap-1]->lvlttl != '\0')
|
||||||
{
|
{
|
||||||
|
@ -282,7 +282,7 @@ static void F_DoWipe(fademask_t *fademask)
|
||||||
relativepos += vid.width;
|
relativepos += vid.width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (*mask >= ((wipestyle == WIPESTYLE_LEVEL) ? FADECOLORMAPROWS : 10))
|
else if (*mask >= ((wipestyle == WIPESTYLE_COLORMAP) ? FADECOLORMAPROWS : 10))
|
||||||
{
|
{
|
||||||
// shortcut - memcpy target to work
|
// shortcut - memcpy target to work
|
||||||
while (draw_linestogo--)
|
while (draw_linestogo--)
|
||||||
|
@ -293,7 +293,7 @@ static void F_DoWipe(fademask_t *fademask)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (wipestyle == WIPESTYLE_LEVEL)
|
if (wipestyle == WIPESTYLE_COLORMAP)
|
||||||
{
|
{
|
||||||
int nmask;
|
int nmask;
|
||||||
UINT8 *fade = fadecolormap;
|
UINT8 *fade = fadecolormap;
|
||||||
|
@ -321,7 +321,7 @@ static void F_DoWipe(fademask_t *fademask)
|
||||||
e = e_base + relativepos;
|
e = e_base + relativepos;
|
||||||
draw_rowstogo = draw_rowend - draw_rowstart;
|
draw_rowstogo = draw_rowend - draw_rowstart;
|
||||||
|
|
||||||
if (wipestyle == WIPESTYLE_LEVEL)
|
if (wipestyle == WIPESTYLE_COLORMAP)
|
||||||
{
|
{
|
||||||
while (draw_rowstogo--)
|
while (draw_rowstogo--)
|
||||||
*w++ = transtbl[*e++];
|
*w++ = transtbl[*e++];
|
||||||
|
@ -382,6 +382,62 @@ void F_WipeEndScreen(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Verifies every condition for a colormapped fade.
|
||||||
|
*/
|
||||||
|
boolean F_ShouldColormapFade(void)
|
||||||
|
{
|
||||||
|
if ((wipestyleflags & (WSF_FADEIN|WSF_FADEOUT)) // only if one of those wipestyleflags are actually set
|
||||||
|
&& !(wipestyleflags & WSF_CROSSFADE)) // and if not crossfading
|
||||||
|
{
|
||||||
|
// World
|
||||||
|
return (gamestate == GS_LEVEL
|
||||||
|
|| gamestate == GS_TITLESCREEN
|
||||||
|
// Finales
|
||||||
|
|| gamestate == GS_CONTINUING
|
||||||
|
|| gamestate == GS_CREDITS
|
||||||
|
|| gamestate == GS_EVALUATION
|
||||||
|
|| gamestate == GS_INTRO
|
||||||
|
|| gamestate == GS_ENDING
|
||||||
|
// Menus
|
||||||
|
|| gamestate == GS_TIMEATTACK);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Decides what wipe style to use.
|
||||||
|
*/
|
||||||
|
void F_DecideWipeStyle(void)
|
||||||
|
{
|
||||||
|
// Set default wipe style
|
||||||
|
wipestyle = WIPESTYLE_NORMAL;
|
||||||
|
|
||||||
|
// Check for colormap wipe style
|
||||||
|
if (F_ShouldColormapFade())
|
||||||
|
wipestyle = WIPESTYLE_COLORMAP;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Attempt to run a colormap fade,
|
||||||
|
provided all the conditionals were properly met.
|
||||||
|
Returns true if so.
|
||||||
|
I demand you call F_RunWipe after this function.
|
||||||
|
*/
|
||||||
|
boolean F_TryColormapFade(UINT8 wipecolor)
|
||||||
|
{
|
||||||
|
if (F_ShouldColormapFade())
|
||||||
|
{
|
||||||
|
#ifdef HWRENDER
|
||||||
|
if (rendermode == render_opengl)
|
||||||
|
F_WipeColorFill(wipecolor);
|
||||||
|
#endif
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
F_WipeColorFill(wipecolor);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** After setting up the screens you want to wipe,
|
/** After setting up the screens you want to wipe,
|
||||||
* calling this will do a 'typical' wipe.
|
* calling this will do a 'typical' wipe.
|
||||||
*/
|
*/
|
||||||
|
@ -399,18 +455,10 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu)
|
||||||
paldiv = FixedDiv(257<<FRACBITS, 11<<FRACBITS);
|
paldiv = FixedDiv(257<<FRACBITS, 11<<FRACBITS);
|
||||||
|
|
||||||
// Init the wipe
|
// Init the wipe
|
||||||
|
F_DecideWipeStyle();
|
||||||
WipeInAction = true;
|
WipeInAction = true;
|
||||||
wipe_scr = screens[0];
|
wipe_scr = screens[0];
|
||||||
|
|
||||||
// don't know where else to put this.
|
|
||||||
// this any good?
|
|
||||||
if ((gamestate == GS_LEVEL || gamestate == GS_TITLESCREEN)
|
|
||||||
&& (wipestyleflags & (WSF_FADEIN|WSF_FADEOUT)) // only if one of those wipestyleflags are actually set
|
|
||||||
&& !(wipestyleflags & WSF_CROSSFADE)) // and if not crossfading
|
|
||||||
wipestyle = WIPESTYLE_LEVEL;
|
|
||||||
else
|
|
||||||
wipestyle = WIPESTYLE_NORMAL;
|
|
||||||
|
|
||||||
// lastwipetic should either be 0 or the tic we last wiped
|
// lastwipetic should either be 0 or the tic we last wiped
|
||||||
// on for fade-to-black
|
// on for fade-to-black
|
||||||
for (;;)
|
for (;;)
|
||||||
|
@ -429,7 +477,7 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu)
|
||||||
if (rendermode == render_opengl)
|
if (rendermode == render_opengl)
|
||||||
{
|
{
|
||||||
// send in the wipe type and wipe frame 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)
|
if (wipestyle == WIPESTYLE_COLORMAP)
|
||||||
HWR_DoTintedWipe(wipetype, wipeframe-1);
|
HWR_DoTintedWipe(wipetype, wipeframe-1);
|
||||||
else
|
else
|
||||||
HWR_DoWipe(wipetype, wipeframe-1);
|
HWR_DoWipe(wipetype, wipeframe-1);
|
||||||
|
@ -438,7 +486,7 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu)
|
||||||
#endif
|
#endif
|
||||||
F_DoWipe(fmask);
|
F_DoWipe(fmask);
|
||||||
|
|
||||||
if (wipestyle == WIPESTYLE_LEVEL)
|
if (wipestyle == WIPESTYLE_COLORMAP)
|
||||||
F_WipeStageTitle();
|
F_WipeStageTitle();
|
||||||
|
|
||||||
I_OsPolling();
|
I_OsPolling();
|
||||||
|
|
|
@ -1804,9 +1804,6 @@ void G_DoLoadLevel(boolean resetplayer)
|
||||||
//
|
//
|
||||||
void G_StartTitleCard(void)
|
void G_StartTitleCard(void)
|
||||||
{
|
{
|
||||||
wipestyleflags |= WSF_FADEIN;
|
|
||||||
wipestyleflags &= ~WSF_FADEOUT;
|
|
||||||
|
|
||||||
// The title card has been disabled for this map.
|
// The title card has been disabled for this map.
|
||||||
// Oh well.
|
// Oh well.
|
||||||
if (mapheaderinfo[gamemap-1]->levelflags & LF_NOTITLECARD)
|
if (mapheaderinfo[gamemap-1]->levelflags & LF_NOTITLECARD)
|
||||||
|
@ -1828,7 +1825,7 @@ void G_StartTitleCard(void)
|
||||||
//
|
//
|
||||||
// Run the title card before fading in to the level.
|
// Run the title card before fading in to the level.
|
||||||
//
|
//
|
||||||
void G_PreLevelTitleCard(tic_t ticker, boolean update)
|
void G_PreLevelTitleCard(void)
|
||||||
{
|
{
|
||||||
tic_t starttime = I_GetTime();
|
tic_t starttime = I_GetTime();
|
||||||
tic_t endtime = starttime + (PRELEVELTIME*NEWTICRATERATIO);
|
tic_t endtime = starttime + (PRELEVELTIME*NEWTICRATERATIO);
|
||||||
|
@ -1842,13 +1839,15 @@ void G_PreLevelTitleCard(tic_t ticker, boolean update)
|
||||||
lasttime = nowtime;
|
lasttime = nowtime;
|
||||||
|
|
||||||
ST_runTitleCard();
|
ST_runTitleCard();
|
||||||
ST_preLevelTitleCardDrawer(ticker, update);
|
ST_preLevelTitleCardDrawer(true);
|
||||||
|
|
||||||
if (moviemode)
|
if (moviemode)
|
||||||
M_SaveFrame();
|
M_SaveFrame();
|
||||||
if (takescreenshot) // Only take screenshots after drawing.
|
if (takescreenshot) // Only take screenshots after drawing.
|
||||||
M_DoScreenShot();
|
M_DoScreenShot();
|
||||||
}
|
}
|
||||||
|
if (!st_overlay)
|
||||||
|
wipestyleflags = WSF_CROSSFADE;
|
||||||
}
|
}
|
||||||
|
|
||||||
INT32 pausedelay = 0;
|
INT32 pausedelay = 0;
|
||||||
|
|
|
@ -141,7 +141,7 @@ void G_DeferedInitNew(boolean pultmode, const char *mapname, INT32 pickedchar,
|
||||||
boolean SSSG, boolean FLS);
|
boolean SSSG, boolean FLS);
|
||||||
void G_DoLoadLevel(boolean resetplayer);
|
void G_DoLoadLevel(boolean resetplayer);
|
||||||
void G_StartTitleCard(void);
|
void G_StartTitleCard(void);
|
||||||
void G_PreLevelTitleCard(tic_t ticker, boolean update);
|
void G_PreLevelTitleCard(void);
|
||||||
void G_DeferedPlayDemo(const char *demo);
|
void G_DeferedPlayDemo(const char *demo);
|
||||||
|
|
||||||
// Can be called by the startup code or M_Responder, calls P_SetupLevel.
|
// Can be called by the startup code or M_Responder, calls P_SetupLevel.
|
||||||
|
|
|
@ -3265,7 +3265,7 @@ boolean P_SetupLevel(boolean skipprecip)
|
||||||
|
|
||||||
// If so...
|
// If so...
|
||||||
if ((!(mapheaderinfo[gamemap-1]->levelflags & LF_NOTITLECARD)) && (*mapheaderinfo[gamemap-1]->lvlttl != '\0'))
|
if ((!(mapheaderinfo[gamemap-1]->levelflags & LF_NOTITLECARD)) && (*mapheaderinfo[gamemap-1]->lvlttl != '\0'))
|
||||||
G_PreLevelTitleCard(lt_ticker, true);
|
G_PreLevelTitleCard();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1348,11 +1348,10 @@ luahook:
|
||||||
//
|
//
|
||||||
// Drawer for G_PreLevelTitleCard.
|
// Drawer for G_PreLevelTitleCard.
|
||||||
//
|
//
|
||||||
void ST_preLevelTitleCardDrawer(tic_t ticker, boolean update)
|
void ST_preLevelTitleCardDrawer(boolean update)
|
||||||
{
|
{
|
||||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, levelfadecol);
|
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, levelfadecol);
|
||||||
if (ticker < PRELEVELTIME-1)
|
ST_drawWipeTitleCard();
|
||||||
ST_drawWipeTitleCard();
|
|
||||||
|
|
||||||
I_OsPolling();
|
I_OsPolling();
|
||||||
I_UpdateNoBlit();
|
I_UpdateNoBlit();
|
||||||
|
|
|
@ -52,7 +52,7 @@ void ST_startTitleCard(void);
|
||||||
void ST_runTitleCard(void);
|
void ST_runTitleCard(void);
|
||||||
void ST_drawTitleCard(void);
|
void ST_drawTitleCard(void);
|
||||||
void ST_preDrawTitleCard(void);
|
void ST_preDrawTitleCard(void);
|
||||||
void ST_preLevelTitleCardDrawer(tic_t ticker, boolean update);
|
void ST_preLevelTitleCardDrawer(boolean update);
|
||||||
void ST_drawWipeTitleCard(void);
|
void ST_drawWipeTitleCard(void);
|
||||||
|
|
||||||
extern tic_t lt_ticker, lt_lasttic;
|
extern tic_t lt_ticker, lt_lasttic;
|
||||||
|
|
Loading…
Reference in a new issue