Encore invert fade

This commit is contained in:
TehRealSalt 2019-08-10 00:54:16 -04:00
parent 274dc434ff
commit aad0dbd076
8 changed files with 147 additions and 93 deletions

View file

@ -308,13 +308,6 @@ static void D_Display(void)
wipedefindex = gamestate; // wipe_xxx_toblack wipedefindex = gamestate; // wipe_xxx_toblack
if (gamestate == GS_TITLESCREEN && wipegamestate != GS_INTRO) if (gamestate == GS_TITLESCREEN && wipegamestate != GS_INTRO)
wipedefindex = wipe_timeattack_toblack; wipedefindex = wipe_timeattack_toblack;
else if (gamestate == GS_INTERMISSION)
{
if (intertype == int_spec) // Special Stage
wipedefindex = wipe_specinter_toblack;
else //if (intertype != int_coop) // Multiplayer
wipedefindex = wipe_multinter_toblack;
}
if (rendermode != render_none) if (rendermode != render_none)
{ {

View file

@ -3256,29 +3256,13 @@ static void readwipes(MYFILE *f)
else if (fastcmp(pword, "FINAL")) else if (fastcmp(pword, "FINAL"))
wipeoffset = wipe_intermission_final; wipeoffset = wipe_intermission_final;
} }
else if (fastncmp(word, "SPECINTER_", 10))
{
pword = word + 10;
if (fastcmp(pword, "TOBLACK"))
wipeoffset = wipe_specinter_toblack;
else if (fastcmp(pword, "FINAL"))
wipeoffset = wipe_specinter_final;
}
else if (fastncmp(word, "VOTING_", 7)) else if (fastncmp(word, "VOTING_", 7))
{ {
pword = word + 7; pword = word + 7;
if (fastcmp(pword, "TOBLACK")) if (fastcmp(pword, "TOBLACK"))
wipeoffset = wipe_specinter_toblack; wipeoffset = wipe_voting_toblack;
else if (fastcmp(pword, "FINAL")) else if (fastcmp(pword, "FINAL"))
wipeoffset = wipe_specinter_final; wipeoffset = wipe_voting_final;
}
else if (fastncmp(word, "MULTINTER_", 10))
{
pword = word + 10;
if (fastcmp(pword, "TOBLACK"))
wipeoffset = wipe_multinter_toblack;
else if (fastcmp(pword, "FINAL"))
wipeoffset = wipe_multinter_final;
} }
else if (fastncmp(word, "CONTINUING_", 11)) else if (fastncmp(word, "CONTINUING_", 11))
{ {
@ -3330,11 +3314,11 @@ static void readwipes(MYFILE *f)
else if (fastcmp(pword, "FINAL")) else if (fastcmp(pword, "FINAL"))
wipeoffset = wipe_gameend_final; wipeoffset = wipe_gameend_final;
} }
else if (fastncmp(word, "SPECLEVEL_", 10)) else if (fastncmp(word, "ENCORE_", 7))
{ {
pword = word + 10; pword = word + 7;
if (fastcmp(pword, "TOWHITE")) if (fastcmp(pword, "TOINVERT"))
wipeoffset = wipe_speclevel_towhite; wipeoffset = wipe_encore_toinvert;
} }
if (wipeoffset < 0) if (wipeoffset < 0)
@ -3344,10 +3328,10 @@ static void readwipes(MYFILE *f)
} }
if (value == UINT8_MAX if (value == UINT8_MAX
&& (wipeoffset <= wipe_level_toblack || wipeoffset >= wipe_speclevel_towhite)) && (wipeoffset <= wipe_level_toblack || wipeoffset >= wipe_encore_toinvert))
{ {
// Cannot disable non-toblack wipes // Cannot disable non-toblack wipes
// (or the level toblack wipe, or the special towhite wipe) // (or the level toblack wipe, or the special encore wipe)
deh_warning("Wipes: can't disable wipe of type '%s'", word); deh_warning("Wipes: can't disable wipe of type '%s'", word);
continue; continue;
} }

View file

@ -80,6 +80,7 @@ enum
{ {
wipe_credits_intermediate, // makes a good 0 I guess. wipe_credits_intermediate, // makes a good 0 I guess.
// Gamestate wipes
wipe_level_toblack, wipe_level_toblack,
wipe_intermission_toblack, wipe_intermission_toblack,
wipe_voting_toblack, wipe_voting_toblack,
@ -92,11 +93,10 @@ enum
wipe_intro_toblack, wipe_intro_toblack,
wipe_cutscene_toblack, wipe_cutscene_toblack,
// custom intermissions // Specialized wipes
wipe_specinter_toblack, wipe_encore_toinvert,
wipe_multinter_toblack,
wipe_speclevel_towhite,
// "From black" wipes
wipe_level_final, wipe_level_final,
wipe_intermission_final, wipe_intermission_final,
wipe_voting_final, wipe_voting_final,
@ -109,10 +109,6 @@ enum
wipe_intro_final, wipe_intro_final,
wipe_cutscene_final, wipe_cutscene_final,
// custom intermissions
wipe_specinter_final,
wipe_multinter_final,
NUMWIPEDEFS, NUMWIPEDEFS,
WIPEFINALSHIFT = wipe_level_final - wipe_level_toblack WIPEFINALSHIFT = wipe_level_final - wipe_level_toblack
}; };

View file

@ -62,9 +62,7 @@ UINT8 wipedefs[NUMWIPEDEFS] = {
UINT8_MAX, // wipe_intro_toblack (hardcoded) UINT8_MAX, // wipe_intro_toblack (hardcoded)
99, // wipe_cutscene_toblack (hardcoded) 99, // wipe_cutscene_toblack (hardcoded)
0, // wipe_specinter_toblack 72, // wipe_encore_toinvert
0, // wipe_multinter_toblack
0, // wipe_speclevel_towhite
UINT8_MAX, // wipe_level_final UINT8_MAX, // wipe_level_final
0, // wipe_intermission_final 0, // wipe_intermission_final
@ -76,10 +74,7 @@ UINT8 wipedefs[NUMWIPEDEFS] = {
0, // wipe_evaluation_final 0, // wipe_evaluation_final
0, // wipe_gameend_final 0, // wipe_gameend_final
99, // wipe_intro_final (hardcoded) 99, // wipe_intro_final (hardcoded)
99, // wipe_cutscene_final (hardcoded) 99 // wipe_cutscene_final (hardcoded)
0, // wipe_specinter_final
0 // wipe_multinter_final
}; };
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------

View file

@ -2778,7 +2778,7 @@ boolean P_SetupLevel(boolean skipprecip)
// use gamemap to get map number. // use gamemap to get map number.
// 99% of the things already did, so. // 99% of the things already did, so.
// Map header should always be in place at this point // Map header should always be in place at this point
INT32 i, loadprecip = 1, ranspecialwipe = 0; INT32 i, loadprecip = 1;
INT32 loademblems = 1; INT32 loademblems = 1;
INT32 fromnetsave = 0; INT32 fromnetsave = 0;
boolean loadedbm = false; boolean loadedbm = false;
@ -2857,36 +2857,50 @@ boolean P_SetupLevel(boolean skipprecip)
S_StartSound(NULL, sfx_ruby1); S_StartSound(NULL, sfx_ruby1);
// Fade to an inverted screen, with a circle fade...
F_WipeStartScreen(); F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 209);
V_EncoreInvertScreen();
F_WipeEndScreen(); F_WipeEndScreen();
F_RunWipe(wipedefs[wipe_speclevel_towhite], false, NULL, false);
F_RunWipe(wipedefs[wipe_encore_toinvert], false, NULL, 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(); \
lastwipetic = nowtime; \
if (moviemode) \
M_SaveFrame(); \
NetKeepAlive(); \
} \
WAIT((3*TICRATE)/2);
S_StartSound(NULL, sfx_ruby2);
// Then fade to a white screen
F_WipeStartScreen(); F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 0); V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 0);
F_WipeEndScreen(); F_WipeEndScreen();
F_RunWipe(wipedefs[wipe_level_final], false, "FADEMAP1", false);
locstarttime = nowtime = lastwipetic; F_RunWipe(wipedefs[wipe_level_toblack], false, "FADEMAP1", false);
endtime = locstarttime + (3*TICRATE)/2;
// Hold on white for extra effect. // THEN fade to a black screen.
while (nowtime < endtime) F_WipeStartScreen();
{
// wait loop
while (!((nowtime = I_GetTime()) - lastwipetic))
I_Sleep();
lastwipetic = nowtime;
if (moviemode) // make sure we save frames for the white hold too
M_SaveFrame();
// Keep the network alive V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
NetKeepAlive(); F_WipeEndScreen();
}
ranspecialwipe = 1; F_RunWipe(wipedefs[wipe_level_toblack], false, "FADEMAP0", false);
// Wait a bit longer.
WAIT((3*TICRATE)/4);
} }
// Make sure all sounds are stopped before Z_FreeTags. // Make sure all sounds are stopped before Z_FreeTags.
@ -2897,17 +2911,18 @@ boolean P_SetupLevel(boolean skipprecip)
// We should be fine starting it here. // We should be fine starting it here.
S_Start(); S_Start();
levelfadecol = (encoremode && !ranspecialwipe ? 209 : 0); levelfadecol = (encoremode ? 0 : 31);
// Let's fade to white here // Let's fade to white here
// But only if we didn't do the encore startup wipe // But only if we didn't do the encore startup wipe
if (rendermode != render_none && !ranspecialwipe && !demo.rewinding) if (rendermode != render_none && !demo.rewinding)
{ {
F_WipeStartScreen(); F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, levelfadecol);
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, levelfadecol);
F_WipeEndScreen(); F_WipeEndScreen();
F_RunWipe(wipedefs[(encoremode ? wipe_level_final : wipe_level_toblack)], false, "FADEMAP1", false); // Fading to white
F_RunWipe(wipedefs[wipe_level_toblack], false, ((levelfadecol == 0) ? "FADEMAP1" : "FADEMAP0"), false);
} }
// Reset the palette now all fades have been done // Reset the palette now all fades have been done

View file

@ -2134,12 +2134,7 @@ void ST_Drawer(void)
ST_MayonakaStatic(); ST_MayonakaStatic();
} }
// Draw a white fade on level opening // Draw a fade on level opening
if (timeinmap < 15) if (timeinmap < 16)
{ V_DrawCustomFadeScreen(((levelfadecol == 0) ? "FADEMAP1" : "FADEMAP0"), 32-(timeinmap*2)); // Then gradually fade out from there
if (timeinmap <= 5)
V_DrawFill(0,0,BASEVIDWIDTH,BASEVIDHEIGHT,0); // Pure white on first few frames, to hide SRB2's awful level load artifacts
else
V_DrawFadeScreen(0, 15-timeinmap); // Then gradually fade out from there
}
} }

View file

@ -1287,28 +1287,75 @@ void V_DrawVhsEffect(boolean rewind)
void V_DrawFadeScreen(UINT16 color, UINT8 strength) void V_DrawFadeScreen(UINT16 color, UINT8 strength)
{ {
#ifdef HWRENDER #ifdef HWRENDER
if (rendermode != render_soft && rendermode != render_none) if (rendermode != render_soft && rendermode != render_none)
{ {
HWR_FadeScreenMenuBack(color, strength); HWR_FadeScreenMenuBack(color, strength);
return; return;
} }
#endif #endif
{ {
const UINT8 *fadetable = const UINT8 *fadetable =
(color > 0xFFF0) // Grab a specific colormap palette? (color > 0xFFF0) // Grab a specific colormap palette?
? R_GetTranslationColormap(color | 0xFFFF0000, strength, GTC_CACHE) ? R_GetTranslationColormap(color | 0xFFFF0000, strength, GTC_CACHE)
: ((color & 0xFF00) // Color is not palette index? : ((color & 0xFF00) // Color is not palette index?
? ((UINT8 *)colormaps + strength*256) // Do COLORMAP fade. ? ((UINT8 *)colormaps + strength*256) // Do COLORMAP fade.
: ((UINT8 *)transtables + ((9-strength)<<FF_TRANSSHIFT) + color*256)); // Else, do TRANSMAP** fade. : ((UINT8 *)transtables + ((9-strength)<<FF_TRANSSHIFT) + color*256)); // Else, do TRANSMAP** fade.
const UINT8 *deststop = screens[0] + vid.rowbytes * vid.height; const UINT8 *deststop = screens[0] + vid.rowbytes * vid.height;
UINT8 *buf = screens[0]; UINT8 *buf = screens[0];
// heavily simplified -- we don't need to know x or y // heavily simplified -- we don't need to know x or y
// position when we're doing a full screen fade // position when we're doing a full screen fade
for (; buf < deststop; ++buf) for (; buf < deststop; ++buf)
*buf = fadetable[*buf]; *buf = fadetable[*buf];
} }
}
//
// Fade the screen buffer, using a custom COLORMAP lump.
// Split from V_DrawFadeScreen, because that function has
// WAY too many options piled on top of it as is. :V
//
void V_DrawCustomFadeScreen(const char *lump, UINT8 strength)
{
#ifdef HWRENDER
if (rendermode != render_soft && rendermode != render_none)
{
//HWR_DrawCustomFadeScreen(color, strength);
return;
}
#endif
{
lumpnum_t lumpnum = LUMPERROR;
lighttable_t *clm = NULL;
if (lump != NULL)
lumpnum = W_GetNumForName(lump);
else
return;
if (lumpnum != LUMPERROR)
{
clm = Z_MallocAlign((256 * 32), PU_STATIC, NULL, 8);
W_ReadLump(lumpnum, clm);
if (clm != NULL)
{
const UINT8 *fadetable = ((UINT8 *)clm + strength*256);
const UINT8 *deststop = screens[0] + vid.rowbytes * vid.height;
UINT8 *buf = screens[0];
// heavily simplified -- we don't need to know x or y
// position when we're doing a full screen fade
for (; buf < deststop; ++buf)
*buf = fadetable[*buf];
Z_Free(clm);
clm = NULL;
}
}
}
} }
// Simple translucency with one color, over a set number of lines starting from the top. // Simple translucency with one color, over a set number of lines starting from the top.
@ -1332,6 +1379,34 @@ void V_DrawFadeConsBack(INT32 plines)
*buf = consolebgmap[*buf]; *buf = consolebgmap[*buf];
} }
//
// Invert the entire screen, for Encore fades
//
void V_EncoreInvertScreen(void)
{
#ifdef HWRENDER
if (rendermode != render_soft && rendermode != render_none)
{
//HWR_EncoreInvertScreen();
return;
}
#endif
{
const UINT8 *deststop = screens[0] + vid.rowbytes * vid.height;
UINT8 *buf = screens[0];
for (; buf < deststop; ++buf)
{
*buf = NearestColor(
256 - pLocalPalette[*buf].s.red,
256 - pLocalPalette[*buf].s.green,
256 - pLocalPalette[*buf].s.blue
);
}
}
}
// Gets string colormap, used for 0x80 color codes // Gets string colormap, used for 0x80 color codes
// //
UINT8 *V_GetStringColormap(INT32 colorflags) UINT8 *V_GetStringColormap(INT32 colorflags)

View file

@ -158,8 +158,9 @@ void V_DrawVhsEffect(boolean rewind);
// fade down the screen buffer before drawing the menu over // fade down the screen buffer before drawing the menu over
void V_DrawFadeScreen(UINT16 color, UINT8 strength); void V_DrawFadeScreen(UINT16 color, UINT8 strength);
void V_DrawCustomFadeScreen(const char *lump, UINT8 strength);
void V_DrawFadeConsBack(INT32 plines); void V_DrawFadeConsBack(INT32 plines);
void V_EncoreInvertScreen(void);
// draw a single character // draw a single character
void V_DrawCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed); void V_DrawCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed);