hwr2: add wipe mode to F_RunWipe, fix all wipes

This commit is contained in:
Eidolon 2023-02-27 21:45:59 -06:00
parent 98ce714614
commit 83b6c30952
11 changed files with 44 additions and 37 deletions

View file

@ -343,7 +343,7 @@ static void D_Display(void)
F_WipeStartScreen();
F_WipeColorFill(31);
F_WipeEndScreen();
F_RunWipe(wipetypepre, gamestate != GS_MENU, "FADEMAP0", false, false);
F_RunWipe(wipedefindex, wipetypepre, gamestate != GS_MENU, "FADEMAP0", false, false);
}
if (gamestate != GS_LEVEL && rendermode != render_none)
@ -356,7 +356,7 @@ static void D_Display(void)
}
else //dedicated servers
{
F_RunWipe(wipedefs[wipedefindex], gamestate != GS_MENU, "FADEMAP0", false, false);
F_RunWipe(wipedefindex, wipedefs[wipedefindex], gamestate != GS_MENU, "FADEMAP0", false, false);
wipegamestate = gamestate;
}
@ -633,7 +633,7 @@ static void D_Display(void)
{
F_WipeEndScreen();
F_RunWipe(wipedefs[wipedefindex], gamestate != GS_MENU && gamestate != GS_TITLESCREEN, "FADEMAP0", true, false);
F_RunWipe(wipedefindex, wipedefs[wipedefindex], gamestate != GS_MENU && gamestate != GS_TITLESCREEN, "FADEMAP0", true, false);
}
// reset counters so timedemo doesn't count the wipe duration

View file

@ -313,7 +313,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(wipe_intro_toblack, wipedefs[wipe_intro_toblack], false, "FADEMAP0", false, false);
}
S_StopMusic();
@ -409,7 +409,7 @@ void F_IntroTicker(void)
F_WipeStartScreen();
F_WipeColorFill(31);
F_WipeEndScreen();
F_RunWipe(99, true, "FADEMAP0", false, false);
F_RunWipe(wipe_intro_toblack, 99, true, "FADEMAP0", false, false);
}
// Stay on black for a bit. =)
@ -2437,7 +2437,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(wipe_intro_toblack, cutscenes[cutnum]->scene[scenenum].fadeinid, true, NULL, false, false);
F_WipeStartScreen();
}
@ -2457,7 +2457,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(wipe_intro_toblack, cutscenes[cutnum]->scene[scenenum].fadeoutid, true, NULL, false, false);
}
V_DrawString(textxpos, textypos, V_ALLOWLOWERCASE, cutscene_disptext);

View file

@ -140,6 +140,7 @@ extern UINT16 curtttics;
//
extern boolean WipeInAction;
extern UINT8 g_wipemode;
extern UINT8 g_wipetype;
extern UINT8 g_wipeframe;
extern boolean g_wipereverse;
@ -155,19 +156,19 @@ 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 wipemode, UINT8 wipetype, boolean drawMenu, const char *colormap, boolean reverse, boolean encorewiggle);
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);
/// @brief true if the wipetype is to-black
boolean F_WipeIsToBlack(UINT8 wipetype);
boolean F_WipeIsToBlack(UINT8 wipemode);
/// @brief true if the wipetype is to-white
boolean F_WipeIsToWhite(UINT8 wipetype);
boolean F_WipeIsToWhite(UINT8 wipemode);
/// @brief true if the wipetype is to-invert
boolean F_WipeIsToInvert(UINT8 wipetype);
boolean F_WipeIsToInvert(UINT8 wipemode);
/// @brief true if the wipetype is modulated from the previous frame
boolean F_WipeIsCrossfade(UINT8 wipetype);
boolean F_WipeIsCrossfade(UINT8 wipemode);
enum
{

View file

@ -222,6 +222,7 @@ static boolean g_wipedef_crossfade[NUMWIPEDEFS] = {
//--------------------------------------------------------------------------
boolean WipeInAction = false;
UINT8 g_wipemode = 0;
UINT8 g_wipetype = 0;
UINT8 g_wipeframe = 0;
boolean g_wipereverse = false;
@ -425,9 +426,10 @@ void F_WipeStageTitle(void)
/** After setting up the screens you want to wipe,
* calling this will do a 'typical' wipe.
*/
void F_RunWipe(UINT8 wipetype, boolean drawMenu, const char *colormap, boolean reverse, boolean encorewiggle)
void F_RunWipe(UINT8 wipemode, UINT8 wipetype, boolean drawMenu, const char *colormap, boolean reverse, boolean encorewiggle)
{
#ifdef NOWIPE
(void)wipemode;
(void)wipetype;
(void)drawMenu;
(void)colormap;
@ -489,6 +491,7 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu, const char *colormap, boolean r
if (rendermode != render_none) //this allows F_RunWipe to be called in dedicated servers
{
// F_DoWipe(fmask, fcolor, reverse);
g_wipemode = wipemode;
g_wipetype = wipetype;
g_wipeframe = wipeframe - 1;
g_wipereverse = reverse;
@ -593,23 +596,23 @@ boolean F_WipeExists(UINT8 wipetype)
#endif
}
boolean F_WipeIsToBlack(UINT8 wipetype)
boolean F_WipeIsToBlack(UINT8 wipemode)
{
return g_wipedef_toblack[wipetype];
return g_wipedef_toblack[wipemode];
}
boolean F_WipeIsToWhite(UINT8 wipetype)
boolean F_WipeIsToWhite(UINT8 wipemode)
{
return g_wipedef_towhite[wipetype];
return g_wipedef_towhite[wipemode];
}
boolean F_WipeIsToInvert(UINT8 wipetype)
boolean F_WipeIsToInvert(UINT8 wipemode)
{
return g_wipedef_toinvert[wipetype];
return g_wipedef_toinvert[wipemode];
}
boolean F_WipeIsCrossfade(UINT8 wipetype)
boolean F_WipeIsCrossfade(UINT8 wipemode)
{
return g_wipedef_crossfade[wipetype];
return g_wipedef_crossfade[wipemode];
}

View file

@ -86,24 +86,25 @@ void PostprocessWipePass::prepass(Rhi& rhi)
upload_ibo_ = true;
}
uint32_t wipe_mode = g_wipemode;
uint32_t wipe_type = g_wipetype;
uint32_t wipe_frame = g_wipeframe;
bool wipe_reverse = g_wipereverse;
wipe_color_mode_ = 0; // TODO 0 = modulate, 1 = invert, 2 = MD to black, 3 = MD to white
if (F_WipeIsToBlack(wipe_type))
if (F_WipeIsToBlack(wipe_mode))
{
wipe_color_mode_ = 2;
}
else if (F_WipeIsToWhite(wipe_type))
else if (F_WipeIsToWhite(wipe_mode))
{
wipe_color_mode_ = 3;
}
else if (F_WipeIsToInvert(wipe_type))
else if (F_WipeIsToInvert(wipe_mode))
{
wipe_color_mode_ = 1;
}
else if (F_WipeIsCrossfade(wipe_type))
else if (F_WipeIsCrossfade(wipe_mode))
{
wipe_color_mode_ = 0;
}

View file

@ -553,7 +553,7 @@ void M_Drawer(void)
if (menuwipe)
{
F_WipeEndScreen();
F_RunWipe(wipedefs[wipe_menu_final], false, "FADEMAP0", true, false);
F_RunWipe(wipe_menu_final, wipedefs[wipe_menu_final], false, "FADEMAP0", true, false);
menuwipe = false;
}

View file

@ -601,7 +601,7 @@ void M_SetupNextMenu(menu_t *menudef, boolean notransition)
F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
F_WipeEndScreen();
F_RunWipe(wipedefs[wipe_menu_toblack], false, "FADEMAP0", false, false);
F_RunWipe(wipe_menu_toblack, wipedefs[wipe_menu_toblack], false, "FADEMAP0", false, false);
}
}
@ -1034,7 +1034,7 @@ void M_Ticker(void)
F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
F_WipeEndScreen();
F_RunWipe(wipedefs[wipe_menu_toblack], false, "FADEMAP0", false, false);
F_RunWipe(wipe_menu_toblack, wipedefs[wipe_menu_toblack], false, "FADEMAP0", false, false);
}
M_SetupNextMenu(menutransition.endmenu, true);

View file

@ -446,7 +446,7 @@ void M_StartTimeAttack(INT32 choice)
F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
F_WipeEndScreen();
F_RunWipe(wipedefs[wipe_level_toblack], false, "FADEMAP0", false, false);
F_RunWipe(wipe_level_toblack, wipedefs[wipe_level_toblack], false, "FADEMAP0", false, false);
SV_StartSinglePlayerServer(levellist.newgametype, false);

View file

@ -112,7 +112,7 @@ void M_CupSelectHandler(INT32 choice)
F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
F_WipeEndScreen();
F_RunWipe(wipedefs[wipe_level_toblack], false, "FADEMAP0", false, false);
F_RunWipe(wipe_level_toblack, wipedefs[wipe_level_toblack], false, "FADEMAP0", false, false);
memset(&grandprixinfo, 0, sizeof(struct grandprixinfo));

View file

@ -484,7 +484,7 @@ void M_LevelSelected(INT16 add)
F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
F_WipeEndScreen();
F_RunWipe(wipedefs[wipe_level_toblack], false, "FADEMAP0", false, false);
F_RunWipe(wipe_level_toblack, wipedefs[wipe_level_toblack], false, "FADEMAP0", false, false);
SV_StartSinglePlayerServer(levellist.newgametype, levellist.netgame);

View file

@ -7555,7 +7555,7 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
F_WipeEndScreen();
S_StartSound(NULL, sfx_ruby1);
F_RunWipe(wipedefs[wipe_encore_toinvert], false, NULL, false, false);
F_RunWipe(wipe_encore_toinvert, 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)
@ -7584,7 +7584,7 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 0);
F_WipeEndScreen();
F_RunWipe(wipedefs[wipe_encore_towhite], false, "FADEMAP1", false, true); // wiggle the screen during this!
F_RunWipe(wipe_encore_towhite, wipedefs[wipe_encore_towhite], false, "FADEMAP1", false, true); // wiggle the screen during this!
// THEN fade to a black screen.
F_WipeStartScreen();
@ -7592,7 +7592,7 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31);
F_WipeEndScreen();
F_RunWipe(wipedefs[wipe_level_toblack], false, "FADEMAP0", false, false);
F_RunWipe(wipe_level_toblack, wipedefs[wipe_level_toblack], false, "FADEMAP0", false, false);
// Wait a bit longer.
WAIT((3*TICRATE)/4);
@ -7600,8 +7600,8 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
else
{
// 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(wipe_encore_towhite, wipedefs[wipe_encore_towhite], false, "FADEMAP1", false, true);
F_RunWipe(wipe_level_toblack, wipedefs[wipe_level_toblack], false, "FADEMAP0", false, false);
}
}
@ -7625,6 +7625,7 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
// But only if we didn't do the encore startup wipe
if (!demo.rewinding && !reloadinggamestate)
{
int wipetype = wipe_level_toblack;
// 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.
@ -7654,6 +7655,7 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
if (ranspecialwipe != 2)
S_StartSound(NULL, sfx_s3kaf);
levelfadecol = 0;
wipetype = wipe_encore_towhite;
}
else if (encoremode)
{
@ -7672,7 +7674,7 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
F_WipeEndScreen();
}
F_RunWipe(wipedefs[wipe_level_toblack], false, ((levelfadecol == 0) ? "FADEMAP1" : "FADEMAP0"), false, false);
F_RunWipe(wipetype, wipedefs[wipetype], false, ((levelfadecol == 0) ? "FADEMAP1" : "FADEMAP0"), false, false);
}
/*if (!titlemapinaction)
wipegamestate = GS_LEVEL;*/