Decouple screen wipes from f_finale

This commit is contained in:
Lactozilla 2023-12-27 18:18:08 -03:00
parent 924a5eb34d
commit c411594ab2
13 changed files with 302 additions and 280 deletions

View file

@ -36,6 +36,7 @@
#include "console.h"
#include "netcode/d_net.h"
#include "f_finale.h"
#include "f_wipe.h"
#include "g_game.h"
#include "hu_stuff.h"
#include "i_sound.h"
@ -474,7 +475,7 @@ static void D_Display(void)
{
SCR_SetMode(); // change video mode
if (wipe_running)
F_StopWipe();
ScreenWipe_Stop();
}
// Recalc the screen
@ -498,23 +499,23 @@ static void D_Display(void)
I_UpdateNoBlit();
// save the current screen if about to wipe
wipe_t *wipe = F_GetQueuedWipe();
wipe_t *wipe = ScreenWipe_GetQueued();
if (wipe && !wipe_running)
{
if (!(wipe->flags & (WSF_FADEIN | WSF_CROSSFADE)))
if (!(wipe->flags & (WIPEFLAGS_FADEIN | WIPEFLAGS_CROSSFADE)))
{
F_SetupFadeOut(wipe->flags);
F_StartPendingWipe();
ScreenWipe_SetupFadeOut(wipe->flags);
ScreenWipe_StartPending();
}
if (wipe->flags & WSF_CROSSFADE)
F_WipeStartScreen();
if (wipe->flags & WIPEFLAGS_CROSSFADE)
ScreenWipe_StartScreen();
}
// do buffered drawing
if (wipe_running)
{
F_DisplayWipe();
ScreenWipe_Display();
if (gamestate == GS_LEVEL && !levelstarting)
TitleCard_DrawOverWipe();
@ -567,20 +568,20 @@ static void D_Display(void)
//
// wipe update
//
wipe = F_GetQueuedWipe();
if (wipe && !wipe_running && (wipe->flags & (WSF_FADEIN | WSF_CROSSFADE)))
wipe = ScreenWipe_GetQueued();
if (wipe && !wipe_running && (wipe->flags & (WIPEFLAGS_FADEIN | WIPEFLAGS_CROSSFADE)))
{
F_WipeEndScreen();
ScreenWipe_EndScreen();
if (wipe->flags & WSF_FADEIN)
if (wipe->flags & WIPEFLAGS_FADEIN)
{
F_WipeColorFill(levelfadecol);
F_WipeStartScreen();
ScreenWipe_DoColorFill(levelfadecol);
ScreenWipe_StartScreen();
}
F_StartPendingWipe();
ScreenWipe_StartPending();
F_DisplayWipe();
ScreenWipe_Display();
if (titlecard.running)
TitleCard_DrawOverWipe();

View file

@ -23,6 +23,7 @@
#include "m_menu.h"
#include "m_misc.h"
#include "f_finale.h"
#include "f_wipe.h"
#include "st_stuff.h"
#include "i_system.h"
#include "p_setup.h"

View file

@ -16,6 +16,7 @@
#include "d_main.h"
#include "netcode/d_netcmd.h"
#include "f_finale.h"
#include "f_wipe.h"
#include "g_game.h"
#include "hu_stuff.h"
#include "r_local.h"
@ -339,7 +340,7 @@ void F_StartIntro(void)
S_StopMusic();
S_StopSounds();
F_StopAllWipes();
ScreenWipe_StopAll();
if (introtoplay)
{
@ -509,11 +510,11 @@ void F_StartIntro(void)
if (from_title)
{
wipe_t wipe = {0};
wipe.style = F_WipeGetStyle(wipe.flags);
wipe.style = ScreenWipe_GetStyle(wipe.flags);
wipe.type = wipedefs[wipe_intro_toblack];
wipe.drawmenuontop = false;
wipe.holdframes = 35;
F_StartWipeParametrized(&wipe);
ScreenWipe_StartParametrized(&wipe);
}
}
@ -850,7 +851,7 @@ static void F_IntroCheckMidSceneWipe(void)
if (intro_scenenum == INTRO_STJR && intro_curtime == 2*TICRATE-19)
{
S_ChangeMusicInternal("_stjr", false);
F_QueuePostWipe(99, WSF_FADEIN, NULL);
ScreenWipe_DoFadeIn(99, WIPEFLAGS_FADEIN, NULL);
return;
}
else if (intro_scenenum == INTRO_RADAR && intro_curtime == 5*TICRATE)
@ -861,7 +862,7 @@ static void F_IntroCheckMidSceneWipe(void)
do_crossfade = true;
if (do_crossfade)
F_WipeDoCrossfade(99);
ScreenWipe_DoCrossfade(99);
}
static void F_PlayIntroMusic(void)
@ -885,7 +886,7 @@ static void F_IntroDoSpecialWipe(INT32 scene)
do_fade_in = true;
break;
case INTRO_SKYRUNNER:
wipe.flags = WSF_TOWHITE;
wipe.flags = WIPEFLAGS_TOWHITE;
wipe.type = 0;
wipe.holdframes = 17;
do_fade_in = true;
@ -895,24 +896,24 @@ static void F_IntroDoSpecialWipe(INT32 scene)
wipe.callback = D_StartTitle;
break;
default:
wipe.flags = WSF_CROSSFADE;
wipe.flags = WIPEFLAGS_CROSSFADE;
break;
}
wipe.style = F_WipeGetStyle(wipe.flags);
wipe.style = ScreenWipe_GetStyle(wipe.flags);
F_StartWipeParametrized(&wipe);
ScreenWipe_StartParametrized(&wipe);
if (do_fade_in)
{
if (scene == INTRO_SKYRUNNER)
wipe.type = 99;
wipe.flags |= WSF_FADEIN;
wipe.flags |= WIPEFLAGS_FADEIN;
wipe.callback = NULL;
wipe.holdframes = 0;
F_StartWipeParametrized(&wipe);
ScreenWipe_StartParametrized(&wipe);
}
}
@ -952,7 +953,7 @@ void F_IntroTicker(void)
{
if (F_IntroSceneCrossfades(intro_scenenum))
{
F_WipeDoCrossfade(99);
ScreenWipe_DoCrossfade(99);
next = false;
}
@ -1242,7 +1243,7 @@ void F_StartCredits(void)
{
boolean from_ending = gamestate == GS_ENDING;
F_StopAllWipes();
ScreenWipe_StopAll();
TitleCard_Stop();
@ -1270,8 +1271,8 @@ void F_StartCredits(void)
timetonext = 2*TICRATE;
if (!from_ending)
F_QueuePreWipe(wipedefs[wipe_credits_toblack], 0, NULL);
F_QueuePostWipe(wipedefs[wipe_credits_final], WSF_FADEIN, NULL);
ScreenWipe_DoFadeOut(wipedefs[wipe_credits_toblack], 0, NULL);
ScreenWipe_DoFadeIn(wipedefs[wipe_credits_final], WIPEFLAGS_FADEIN, NULL);
}
void F_CreditDrawer(void)
@ -1468,8 +1469,8 @@ void F_StartGameEvaluation(void)
finalecount = -1;
sparklloop = 0;
F_QueuePreWipe(wipedefs[wipe_evaluation_toblack], 0, NULL);
F_QueuePostWipe(wipedefs[wipe_evaluation_final], WSF_FADEIN, NULL);
ScreenWipe_DoFadeOut(wipedefs[wipe_evaluation_toblack], 0, NULL);
ScreenWipe_DoFadeIn(wipedefs[wipe_evaluation_final], WIPEFLAGS_FADEIN, NULL);
}
void F_GameEvaluationDrawer(void)
@ -1767,7 +1768,7 @@ static void F_CacheGoodEnding(void)
void F_StartEnding(void)
{
F_StopAllWipes();
ScreenWipe_StopAll();
TitleCard_Stop();
@ -1789,8 +1790,8 @@ void F_StartEnding(void)
F_LoadEndingGraphics();
F_QueuePreWipe(wipedefs[wipe_ending_toblack], 0, NULL);
F_QueuePostWipe(wipedefs[wipe_ending_final], WSF_FADEIN, NULL);
ScreenWipe_DoFadeOut(wipedefs[wipe_ending_toblack], 0, NULL);
ScreenWipe_DoFadeIn(wipedefs[wipe_ending_final], WIPEFLAGS_FADEIN, NULL);
}
void F_EndingTicker(void)
@ -2232,7 +2233,7 @@ void F_StartGameEnd(void)
timetonext = TICRATE;
F_QueuePostWipe(99, 0, NULL);
ScreenWipe_DoFadeIn(99, 0, NULL);
}
//
@ -2415,7 +2416,7 @@ void F_InitTitleScreen(void)
void F_StartTitleScreen(void)
{
F_StopAllWipes();
ScreenWipe_StopAll();
if (menupres[MN_MAIN].musname[0])
S_ChangeMusic(menupres[MN_MAIN].musname, menupres[MN_MAIN].mustrack, menupres[MN_MAIN].muslooping);
@ -2438,9 +2439,9 @@ void F_StartTitleScreen(void)
else
finalecount = 0;
if (!F_GetQueuedWipe())
F_QueuePreWipe(wipedefs[wipe_titlescreen_toblack], 0, F_InitTitleScreen);
F_QueuePostWipe(menupres[MN_MAIN].enterwipe, WSF_FADEIN, NULL);
if (!ScreenWipe_GetQueued())
ScreenWipe_DoFadeOut(wipedefs[wipe_titlescreen_toblack], 0, F_InitTitleScreen);
ScreenWipe_DoFadeIn(menupres[MN_MAIN].enterwipe, WIPEFLAGS_FADEIN, NULL);
}
G_SetGamestate(GS_TITLESCREEN);
@ -3521,7 +3522,7 @@ void F_StartContinue(void)
return;
}
F_StopAllWipes();
ScreenWipe_StopAll();
G_SetGamestate(GS_CONTINUING);
gameaction = ga_nothing;
@ -3574,8 +3575,8 @@ void F_StartContinue(void)
timetonext = (11*TICRATE)+11;
continuetime = 0;
F_QueuePreWipe(wipedefs[wipe_continuing_toblack], 0, NULL);
F_QueuePostWipe(wipedefs[wipe_continuing_final], WSF_FADEIN, NULL);
ScreenWipe_DoFadeOut(wipedefs[wipe_continuing_toblack], 0, NULL);
ScreenWipe_DoFadeIn(wipedefs[wipe_continuing_final], WIPEFLAGS_FADEIN, NULL);
}
//
@ -3834,24 +3835,24 @@ static void F_PlayCutsceneMusic(void)
static void F_AdvanceToNextScene(void)
{
F_StopAllWipes();
ScreenWipe_StopAll();
// Fade to any palette color you want.
if (cutscenes[cutnum]->scene[scenenum].fadecolor)
{
wipe_t wipe = {0};
wipe.flags = WSF_CROSSFADE;
wipe.style = F_WipeGetStyle(wipe.flags);
wipe.flags = WIPEFLAGS_CROSSFADE;
wipe.style = ScreenWipe_GetStyle(wipe.flags);
wipe.type = cutscenes[cutnum]->scene[scenenum].fadeinid;
wipe.drawmenuontop = true;
wipe.callback = F_PlayCutsceneMusic;
F_StartWipeParametrized(&wipe);
ScreenWipe_StartParametrized(&wipe);
levelfadecol = cutscenes[cutnum]->scene[scenenum].fadecolor;
}
else
{
F_WipeDoCrossfade(DEFAULTWIPE);
ScreenWipe_DoCrossfade(DEFAULTWIPE);
}
// Don't increment until after endcutscene check
@ -3881,7 +3882,7 @@ static void F_AdvanceToNextScene(void)
animtimer = pictime = cutscenes[cutnum]->scene[scenenum].picduration[picnum];
F_StartWipe(cutscenes[cutnum]->scene[scenenum].fadeoutid, 0);
ScreenWipe_Start(cutscenes[cutnum]->scene[scenenum].fadeoutid, 0);
}
// See also G_AfterIntermission, the only other place which handles intra-map/ending transitions
@ -3951,8 +3952,8 @@ void F_StartCustomCutscene(INT32 cutscenenum, boolean precutscene, boolean reset
S_StopSounds();
if (!from_ending)
F_QueuePreWipe(wipedefs[wipe_cutscene_toblack], 0, NULL);
F_QueuePostWipe(wipedefs[wipe_cutscene_final], WSF_FADEIN, NULL);
ScreenWipe_DoFadeOut(wipedefs[wipe_cutscene_toblack], 0, NULL);
ScreenWipe_DoFadeIn(wipedefs[wipe_cutscene_final], WIPEFLAGS_FADEIN, NULL);
}
//
@ -4668,8 +4669,8 @@ void F_TextPromptTicker(void)
void F_StartWaitingPlayers(void)
{
F_QueuePreWipe(0, 0, NULL);
F_QueuePostWipe(0, WSF_FADEIN, NULL);
ScreenWipe_DoFadeOut(0, 0, NULL);
ScreenWipe_DoFadeIn(0, WIPEFLAGS_FADEIN, NULL);
finalecount = 0;
}

View file

@ -10,7 +10,6 @@
//-----------------------------------------------------------------------------
/// \file f_finale.h
/// \brief Title screen, intro, game evaluation, and credits.
/// Also includes protos for screen wipe functions.
#ifndef __F_FINALE__
#define __F_FINALE__
@ -18,7 +17,6 @@
#include "doomtype.h"
#include "d_event.h"
#include "p_mobj.h"
#include "screen.h"
//
// FINALE
@ -155,122 +153,4 @@ extern UINT16 curtttics;
void F_InitMenuPresValues(void);
void F_MenuPresTicker(void);
//
// WIPES
//
#if NUMSCREENS < 5
#define NOWIPE // do not enable wipe image post processing for ARM, SH and MIPS CPUs
#endif
#define DEFAULTWIPE -1
extern boolean wipe_running;
extern boolean wipe_drawmenuontop;
typedef enum
{
WIPESTYLE_NORMAL,
WIPESTYLE_COLORMAP
} wipestyle_t;
typedef enum
{
WSF_FADEIN = 1,
WSF_TOWHITE = 1<<1,
WSF_CROSSFADE = 1<<2
} wipeflags_t;
typedef void (*wipe_callback_t)(void);
typedef struct
{
UINT8 type;
wipestyle_t style;
wipeflags_t flags;
boolean drawmenuontop;
tic_t holdframes;
wipe_callback_t callback;
} wipe_t;
typedef enum
{
SPECIALWIPE_NONE,
SPECIALWIPE_SSTAGE,
SPECIALWIPE_RETRY,
} specialwipe_t;
extern specialwipe_t ranspecialwipe;
void F_WipeStartScreen(void);
void F_WipeEndScreen(void);
void F_StartWipe(UINT8 type, wipeflags_t flags);
void F_StartWipeParametrized(wipe_t *wipe);
void F_RunWipe(void);
void F_DisplayWipe(void);
void F_StopWipe(void);
void F_StopAllWipes(void);
void F_SetupFadeOut(wipeflags_t flags);
void F_DoGenericTransition(void);
void F_QueuePreWipe(INT16 type, wipeflags_t flags, wipe_callback_t callback);
void F_QueuePostWipe(INT16 type, wipeflags_t flags, wipe_callback_t callback);
void F_WipeDoCrossfade(INT16 type);
void F_StartPendingWipe(void);
wipe_t *F_GetQueuedWipe(void);
wipestyle_t F_WipeGetStyle(wipeflags_t flags);
#define F_WipeColorFill(c) V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, c)
#define FADECOLORMAPDIV 8
#define FADECOLORMAPROWS (256/FADECOLORMAPDIV)
#define FADEREDFACTOR 15
#define FADEGREENFACTOR 15
#define FADEBLUEFACTOR 10
tic_t F_GetWipeLength(UINT8 type);
boolean F_WipeExists(UINT8 type);
enum
{
wipe_credits_intermediate, // makes a good 0 I guess.
wipe_level_toblack,
wipe_intermission_toblack,
wipe_continuing_toblack,
wipe_titlescreen_toblack,
wipe_timeattack_toblack,
wipe_credits_toblack,
wipe_evaluation_toblack,
wipe_gameend_toblack,
wipe_intro_toblack,
wipe_ending_toblack,
wipe_cutscene_toblack,
// custom intermissions
wipe_specinter_toblack,
wipe_multinter_toblack,
wipe_speclevel_towhite,
wipe_level_final,
wipe_intermission_final,
wipe_continuing_final,
wipe_titlescreen_final,
wipe_timeattack_final,
wipe_credits_final,
wipe_evaluation_final,
wipe_gameend_final,
wipe_intro_final,
wipe_ending_final,
wipe_cutscene_final,
// custom intermissions
wipe_specinter_final,
wipe_multinter_final,
NUMWIPEDEFS,
WIPEFINALSHIFT = (wipe_level_final-wipe_level_toblack)
};
extern UINT8 wipedefs[NUMWIPEDEFS];
#endif

View file

@ -12,14 +12,13 @@
/// \file f_wipe.c
/// \brief SRB2 2.1 custom fade mask "wipe" behavior.
#include "f_finale.h"
#include "f_wipe.h"
#include "i_video.h"
#include "v_video.h"
#include "r_main.h" // framecount
#include "r_state.h" // fadecolormap
#include "r_draw.h" // transtable
#include "p_pspr.h" // tr_transxxx
#include "p_local.h"
#include "st_stuff.h"
#include "w_wad.h"
@ -99,7 +98,7 @@ static boolean wipe_stopped = false;
static tic_t wipe_holdframes = 0;
static wipestyle_t wipe_style = WIPESTYLE_NORMAL;
static wipeflags_t wipe_flags = WSF_CROSSFADE;
static wipeflags_t wipe_flags = 0;
specialwipe_t ranspecialwipe = SPECIALWIPE_NONE;
@ -368,7 +367,7 @@ static void F_DoColormapWipe(fademask_t *fademask, UINT8 *colormap)
draw_linestogo = draw_lineend - draw_linestart;
int nmask = *mask;
if (wipe_flags & WSF_FADEIN)
if (wipe_flags & WIPEFLAGS_FADEIN)
nmask = (FADECOLORMAPROWS-1) - nmask;
transtbl = colormap + (nmask * 256);
@ -399,7 +398,7 @@ static void F_DoColormapWipe(fademask_t *fademask, UINT8 *colormap)
/** Saves the "before" screen of a wipe.
*/
void F_WipeStartScreen(void)
void ScreenWipe_StartScreen(void)
{
#ifndef NOWIPE
#ifdef HWRENDER
@ -417,7 +416,7 @@ void F_WipeStartScreen(void)
/** Saves the "after" screen of a wipe.
*/
void F_WipeEndScreen(void)
void ScreenWipe_EndScreen(void)
{
#ifndef NOWIPE
#ifdef HWRENDER
@ -433,9 +432,9 @@ void F_WipeEndScreen(void)
#endif
}
static boolean F_WipeCanTint(wipeflags_t flags)
static boolean ScreenWipe_CanTint(wipeflags_t flags)
{
if (flags & WSF_CROSSFADE)
if (flags & WIPEFLAGS_CROSSFADE)
return false;
return true;
@ -443,9 +442,9 @@ static boolean F_WipeCanTint(wipeflags_t flags)
/** Decides what wipe style to use.
*/
wipestyle_t F_WipeGetStyle(wipeflags_t flags)
wipestyle_t ScreenWipe_GetStyle(wipeflags_t flags)
{
if (F_WipeCanTint(flags))
if (ScreenWipe_CanTint(flags))
return WIPESTYLE_COLORMAP;
else
return WIPESTYLE_NORMAL;
@ -468,7 +467,7 @@ static void F_RestartWipe(void)
wipe_frame = 0;
}
void F_StartPendingWipe(void)
void ScreenWipe_StartPending(void)
{
if (wipe_numqueued)
F_RestartWipe();
@ -477,17 +476,17 @@ void F_StartPendingWipe(void)
/** After setting up the screens you want to wipe,
* calling this will do a 'typical' wipe.
*/
void F_StartWipe(UINT8 type, wipeflags_t flags)
void ScreenWipe_Start(UINT8 type, wipeflags_t flags)
{
wipe_t wipe = {0};
wipe.style = F_WipeGetStyle(flags);
wipe.style = ScreenWipe_GetStyle(flags);
wipe.flags = flags;
wipe.type = type;
wipe.drawmenuontop = true;
F_StartWipeParametrized(&wipe);
ScreenWipe_StartParametrized(&wipe);
}
void F_StartWipeParametrized(wipe_t *wipe)
void ScreenWipe_StartParametrized(wipe_t *wipe)
{
#ifdef NOWIPE
(void)wipe;
@ -510,7 +509,7 @@ void F_StartWipeParametrized(wipe_t *wipe)
/** Runs the current wipe.
*/
void F_RunWipe(void)
void ScreenWipe_Run(void)
{
#ifndef NOWIPE
if (!wipe_numqueued)
@ -520,7 +519,7 @@ void F_RunWipe(void)
{
wipe_holdframes--;
if (wipe_holdframes <= 0)
F_StopWipe();
ScreenWipe_Stop();
return;
}
@ -530,23 +529,23 @@ void F_RunWipe(void)
wipe_stopped = true;
if (wipe_holdframes)
{
if (!(wipe_flags & WSF_FADEIN))
if (!(wipe_flags & WIPEFLAGS_FADEIN))
wipe_frame--;
return;
}
F_StopWipe();
ScreenWipe_Stop();
return;
}
wipe_frame++;
#else
F_StopWipe();
ScreenWipe_Stop();
#endif
}
/** Stops running the current wipe.
*/
void F_StopWipe(void)
void ScreenWipe_Stop(void)
{
void (*callback)(void) = NULL;
@ -571,11 +570,11 @@ void F_StopWipe(void)
callback();
}
void F_StopAllWipes(void)
void ScreenWipe_StopAll(void)
{
wipe_numqueued = 0;
F_StopWipe();
ScreenWipe_Stop();
}
#ifndef NOWIPE
@ -586,7 +585,7 @@ static void F_RenderWipe(UINT8 style, UINT8 flags, fademask_t *fmask)
if (style == WIPESTYLE_COLORMAP)
{
UINT8 *colormap = fadecolormap;
if (flags & WSF_TOWHITE)
if (flags & WIPEFLAGS_TOWHITE)
colormap += (FADECOLORMAPROWS * 256);
F_DoColormapWipe(fmask, colormap);
}
@ -610,7 +609,7 @@ static void F_RenderWipeHW(UINT8 style, UINT8 type, UINT8 frame)
/** Displays the current wipe.
*/
void F_DisplayWipe(void)
void ScreenWipe_Display(void)
{
#ifndef NOWIPE
wipe_scr = screens[0];
@ -629,7 +628,7 @@ void F_DisplayWipe(void)
else
#endif
F_RenderWipe(wipe_style, wipe_flags, fmask);
F_WipeStartScreen();
ScreenWipe_StartScreen();
}
return;
}
@ -658,7 +657,7 @@ static int F_GetWipedefIndex(void)
return index;
}
wipe_t *F_GetQueuedWipe(void)
wipe_t *ScreenWipe_GetQueued(void)
{
if (wipe_numqueued)
return &wipe_queue[0];
@ -666,83 +665,83 @@ wipe_t *F_GetQueuedWipe(void)
return NULL;
}
void F_SetupFadeOut(wipeflags_t flags)
void ScreenWipe_SetupFadeOut(wipeflags_t flags)
{
#ifndef NOWIPE
F_WipeStartScreen();
ScreenWipe_StartScreen();
UINT8 wipecolor = (flags & WSF_TOWHITE) ? 0 : 31;
UINT8 wipecolor = (flags & WIPEFLAGS_TOWHITE) ? 0 : 31;
if (F_WipeCanTint(flags))
if (ScreenWipe_CanTint(flags))
{
#ifdef HWRENDER
if (rendermode == render_opengl)
F_WipeColorFill(wipecolor);
ScreenWipe_DoColorFill(wipecolor);
#endif
}
else
{
F_WipeColorFill(wipecolor);
ScreenWipe_DoColorFill(wipecolor);
}
F_WipeEndScreen();
ScreenWipe_EndScreen();
#endif
}
void F_DoGenericTransition(void)
void ScreenWipe_DoFadeOutIn(void)
{
F_QueuePreWipe(DEFAULTWIPE, 0, NULL);
F_QueuePostWipe(DEFAULTWIPE, WSF_FADEIN, NULL);
ScreenWipe_DoFadeOut(DEFAULTWIPE, 0, NULL);
ScreenWipe_DoFadeIn(DEFAULTWIPE, WIPEFLAGS_FADEIN, NULL);
}
/** Starts the "pre" type of a wipe.
*/
void F_QueuePreWipe(INT16 type, wipeflags_t flags, wipe_callback_t callback)
void ScreenWipe_DoFadeOut(INT16 type, wipeflags_t flags, wipe_callback_t callback)
{
if (type == DEFAULTWIPE || !F_WipeExists(type))
if (type == DEFAULTWIPE || !ScreenWipe_Exists(type))
type = wipedefs[F_GetWipedefIndex()];
wipe_t wipe = {0};
wipe.flags = flags;
wipe.style = F_WipeGetStyle(flags);
wipe.style = ScreenWipe_GetStyle(flags);
wipe.type = type;
wipe.drawmenuontop = gamestate != GS_TIMEATTACK && gamestate != GS_TITLESCREEN;
wipe.callback = callback;
F_StartWipeParametrized(&wipe);
ScreenWipe_StartParametrized(&wipe);
}
/** Starts the "post" type of a wipe.
*/
void F_QueuePostWipe(INT16 type, wipeflags_t flags, wipe_callback_t callback)
void ScreenWipe_DoFadeIn(INT16 type, wipeflags_t flags, wipe_callback_t callback)
{
if (type == DEFAULTWIPE || !F_WipeExists(type))
if (type == DEFAULTWIPE || !ScreenWipe_Exists(type))
type = wipedefs[F_GetWipedefIndex() + WIPEFINALSHIFT];
wipe_t wipe = {0};
wipe.flags = flags;
wipe.style = F_WipeGetStyle(flags);
wipe.style = ScreenWipe_GetStyle(flags);
wipe.type = type;
wipe.drawmenuontop = gamestate != GS_TIMEATTACK && gamestate != GS_TITLESCREEN;
wipe.callback = callback;
F_StartWipeParametrized(&wipe);
ScreenWipe_StartParametrized(&wipe);
}
/** Does a crossfade.
*/
void F_WipeDoCrossfade(INT16 type)
void ScreenWipe_DoCrossfade(INT16 type)
{
wipe_t wipe = {0};
wipe.flags = WSF_CROSSFADE;
wipe.style = F_WipeGetStyle(wipe.flags);
wipe.flags = WIPEFLAGS_CROSSFADE;
wipe.style = ScreenWipe_GetStyle(wipe.flags);
wipe.type = type == DEFAULTWIPE ? wipedefs[F_GetWipedefIndex()] : type;
wipe.drawmenuontop = false;
F_StartWipeParametrized(&wipe);
ScreenWipe_StartParametrized(&wipe);
}
/** Returns tic length of wipe
* One lump equals one tic
*/
tic_t F_GetWipeLength(UINT8 type)
tic_t ScreenWipe_GetLength(UINT8 type)
{
#ifdef NOWIPE
(void)type;
@ -769,7 +768,7 @@ tic_t F_GetWipeLength(UINT8 type)
/** Does the specified wipe exist?
*/
boolean F_WipeExists(UINT8 type)
boolean ScreenWipe_Exists(UINT8 type)
{
#ifdef NOWIPE
(void)type;

139
src/f_wipe.h Normal file
View file

@ -0,0 +1,139 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
// Copyright (C) 1999-2023 by Sonic Team Junior.
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file f_wipe.h
/// \brief Screen wipes
#ifndef __F_WIPE__
#define __F_WIPE__
#include "screen.h"
//
// WIPES
//
#if NUMSCREENS < 5
#define NOWIPE // do not enable wipe image post processing for ARM, SH and MIPS CPUs
#endif
#define DEFAULTWIPE -1
extern boolean wipe_running;
extern boolean wipe_drawmenuontop;
typedef enum
{
WIPESTYLE_NORMAL,
WIPESTYLE_COLORMAP
} wipestyle_t;
typedef enum
{
WIPEFLAGS_FADEIN = 1,
WIPEFLAGS_TOWHITE = 1<<1,
WIPEFLAGS_CROSSFADE = 1<<2
} wipeflags_t;
typedef void (*wipe_callback_t)(void);
typedef struct
{
UINT8 type;
wipestyle_t style;
wipeflags_t flags;
boolean drawmenuontop;
tic_t holdframes;
wipe_callback_t callback;
} wipe_t;
typedef enum
{
SPECIALWIPE_NONE,
SPECIALWIPE_SSTAGE,
SPECIALWIPE_RETRY,
} specialwipe_t;
extern specialwipe_t ranspecialwipe;
void ScreenWipe_Start(UINT8 type, wipeflags_t flags);
void ScreenWipe_StartParametrized(wipe_t *wipe);
void ScreenWipe_DoFadeOut(INT16 type, wipeflags_t flags, wipe_callback_t callback);
void ScreenWipe_DoFadeIn(INT16 type, wipeflags_t flags, wipe_callback_t callback);
void ScreenWipe_DoFadeOutIn(void);
void ScreenWipe_DoCrossfade(INT16 type);
void ScreenWipe_Run(void);
void ScreenWipe_Display(void);
void ScreenWipe_Stop(void);
void ScreenWipe_StopAll(void);
void ScreenWipe_StartPending(void);
wipe_t *ScreenWipe_GetQueued(void);
wipestyle_t ScreenWipe_GetStyle(wipeflags_t flags);
void ScreenWipe_SetupFadeOut(wipeflags_t flags);
void ScreenWipe_StartScreen(void);
void ScreenWipe_EndScreen(void);
#define ScreenWipe_DoColorFill(c) V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, c)
#define FADECOLORMAPDIV 8
#define FADECOLORMAPROWS (256/FADECOLORMAPDIV)
#define FADEREDFACTOR 15
#define FADEGREENFACTOR 15
#define FADEBLUEFACTOR 10
tic_t ScreenWipe_GetLength(UINT8 type);
boolean ScreenWipe_Exists(UINT8 type);
enum
{
wipe_credits_intermediate, // makes a good 0 I guess.
wipe_level_toblack,
wipe_intermission_toblack,
wipe_continuing_toblack,
wipe_titlescreen_toblack,
wipe_timeattack_toblack,
wipe_credits_toblack,
wipe_evaluation_toblack,
wipe_gameend_toblack,
wipe_intro_toblack,
wipe_ending_toblack,
wipe_cutscene_toblack,
// custom intermissions
wipe_specinter_toblack,
wipe_multinter_toblack,
wipe_speclevel_towhite,
wipe_level_final,
wipe_intermission_final,
wipe_continuing_final,
wipe_titlescreen_final,
wipe_timeattack_final,
wipe_credits_final,
wipe_evaluation_final,
wipe_gameend_final,
wipe_intro_final,
wipe_ending_final,
wipe_cutscene_final,
// custom intermissions
wipe_specinter_final,
wipe_multinter_final,
NUMWIPEDEFS,
WIPEFINALSHIFT = (wipe_level_final-wipe_level_toblack)
};
extern UINT8 wipedefs[NUMWIPEDEFS];
#endif

View file

@ -18,6 +18,7 @@
#include "netcode/d_clisrv.h"
#include "netcode/net_command.h"
#include "f_finale.h"
#include "f_wipe.h"
#include "p_setup.h"
#include "p_saveg.h"
#include "i_time.h"
@ -2054,7 +2055,7 @@ void G_DoLoadLevel(void)
//
void G_StartLevelWipe(void)
{
F_StopAllWipes();
ScreenWipe_StopAll();
ranspecialwipe = SPECIALWIPE_NONE;
@ -2078,21 +2079,21 @@ void G_StartLevelWipe(void)
strnicmp(S_MusicName(),
(mapmusflags & MUSIC_RELOADRESET) ? mapheaderinfo[gamemap-1]->musname : mapmusname, 7)))
S_FadeMusic(0, FixedMul(
FixedDiv((F_GetWipeLength(wipedefs[wipe_level_toblack])-2)*NEWTICRATERATIO, NEWTICRATE), MUSICRATE));
FixedDiv((ScreenWipe_GetLength(wipedefs[wipe_level_toblack])-2)*NEWTICRATERATIO, NEWTICRATE), MUSICRATE));
}
}
static void G_DoLevelFadeIn(void)
{
wipeflags_t flags = WSF_FADEIN;
wipeflags_t flags = WIPEFLAGS_FADEIN;
if (ranspecialwipe == SPECIALWIPE_SSTAGE)
flags |= WSF_TOWHITE;
flags |= WIPEFLAGS_TOWHITE;
wipe_t wipe = {0};
wipe.style = F_WipeGetStyle(wipe.flags);
wipe.style = ScreenWipe_GetStyle(wipe.flags);
wipe.flags = flags;
wipe.type = wipedefs[wipe_level_final];
wipe.drawmenuontop = true;
F_StartWipeParametrized(&wipe);
ScreenWipe_StartParametrized(&wipe);
}
//
@ -2181,7 +2182,7 @@ void TitleCard_Run(void)
{
if (!cv_showhud.value)
{
F_WipeDoCrossfade(DEFAULTWIPE);
ScreenWipe_DoCrossfade(DEFAULTWIPE);
}
else
{
@ -2593,18 +2594,18 @@ void G_Ticker(boolean run)
{
case GS_LEVEL:
if ((loading && G_GetRetryFlag(RETRY_PAUSED)) || !(paused || P_AutoPause()))
F_RunWipe();
ScreenWipe_Run();
break;
default:
F_RunWipe();
ScreenWipe_Run();
break;
}
// Run the title card
if (titlecard.running)
{
wipe_t *wipe = F_GetQueuedWipe();
if (wipe && wipe->flags & WSF_FADEIN)
wipe_t *wipe = ScreenWipe_GetQueued();
if (wipe && wipe->flags & WIPEFLAGS_FADEIN)
TitleCard_Run();
}
@ -3574,7 +3575,7 @@ void G_DoReborn(INT32 playernum)
P_ClearStarPost(players[i].starpostnum);
}
F_WipeDoCrossfade(DEFAULTWIPE);
ScreenWipe_DoCrossfade(DEFAULTWIPE);
if (camera.chase)
P_ResetCamera(&players[displayplayer], &camera);

View file

@ -47,6 +47,7 @@
#include "p_local.h"
#include "p_setup.h"
#include "f_finale.h"
#include "f_wipe.h"
#include "lua_hook.h"
#ifdef HWRENDER
@ -2977,9 +2978,9 @@ static void M_HandleMenuPresState(menu_t *newMenu)
else if (wipetypepost != INT16_MAX && wipetypepre == INT16_MAX)
wipetypepre = wipetypepost;
F_StopAllWipes();
F_QueuePreWipe(wipetypepre, 0, NULL);
F_QueuePostWipe(wipetypepost, 0, NULL);
ScreenWipe_StopAll();
ScreenWipe_DoFadeOut(wipetypepre, 0, NULL);
ScreenWipe_DoFadeIn(wipetypepost, 0, NULL);
}
}
@ -3010,7 +3011,7 @@ static void M_GoBack(INT32 choice)
}
menuactive = false;
F_QueuePreWipe(menupres[M_GetYoungestChildMenu()].exitwipe, 0, F_InitTitleScreen);
ScreenWipe_DoFadeOut(menupres[M_GetYoungestChildMenu()].exitwipe, 0, F_InitTitleScreen);
I_UpdateMouseGrab();
D_StartTitle();
}
@ -10142,7 +10143,7 @@ static void M_TimeAttack(INT32 choice)
M_PatchSkinNameTable();
F_StopAllWipes();
ScreenWipe_StopAll();
G_SetGamestate(GS_TIMEATTACK); // do this before M_SetupNextMenu so that menu meta state knows that we're switching
titlemapinaction = TITLEMAP_OFF; // Nope don't give us HOMs please
@ -10152,10 +10153,10 @@ static void M_TimeAttack(INT32 choice)
else
Nextmap_OnChange();
if (!F_GetQueuedWipe())
if (!ScreenWipe_GetQueued())
{
F_QueuePreWipe(wipedefs[wipe_level_toblack], 0, NULL);
F_QueuePostWipe(menupres[MN_SP_TIMEATTACK].enterwipe, WSF_FADEIN, NULL);
ScreenWipe_DoFadeOut(wipedefs[wipe_level_toblack], 0, NULL);
ScreenWipe_DoFadeIn(menupres[MN_SP_TIMEATTACK].enterwipe, WIPEFLAGS_FADEIN, NULL);
}
itemOn = tastart; // "Start" is selected.
@ -10358,7 +10359,7 @@ static void M_NightsAttack(INT32 choice)
// This is really just to make sure Sonic is the played character, just in case
M_PatchSkinNameTable();
F_StopAllWipes();
ScreenWipe_StopAll();
ntssupersonic[0] = W_CachePatchName("NTSSONC1", PU_PATCH);
ntssupersonic[1] = W_CachePatchName("NTSSONC2", PU_PATCH);
@ -10371,10 +10372,10 @@ static void M_NightsAttack(INT32 choice)
else
Nextmap_OnChange();
if (!F_GetQueuedWipe())
if (!ScreenWipe_GetQueued())
{
F_QueuePreWipe(wipedefs[wipe_level_toblack], 0, NULL);
F_QueuePostWipe(menupres[MN_SP_NIGHTSATTACK].enterwipe, WSF_FADEIN, NULL);
ScreenWipe_DoFadeOut(wipedefs[wipe_level_toblack], 0, NULL);
ScreenWipe_DoFadeIn(menupres[MN_SP_NIGHTSATTACK].enterwipe, WIPEFLAGS_FADEIN, NULL);
}
itemOn = nastart; // "Start" is selected.
@ -10706,9 +10707,9 @@ static void M_ModeAttackEndGame(INT32 choice)
M_ChangeMenuMusic("_title", true);
Nextmap_OnChange();
F_StopAllWipes();
F_QueuePreWipe(wipedefs[wipe_level_toblack], 0, NULL);
F_QueuePostWipe(wipetype, WSF_FADEIN, NULL);
ScreenWipe_StopAll();
ScreenWipe_DoFadeOut(wipedefs[wipe_level_toblack], 0, NULL);
ScreenWipe_DoFadeIn(wipetype, WIPEFLAGS_FADEIN, NULL);
}
static void M_MarathonLiveEventBackup(INT32 choice)
@ -10781,7 +10782,7 @@ static void M_Marathon(INT32 choice)
M_ChangeMenuMusic("spec8", true);
F_StopAllWipes();
ScreenWipe_StopAll();
SP_MarathonDef.prevMenu = &MainDef;
G_SetGamestate(GS_TIMEATTACK); // do this before M_SetupNextMenu so that menu meta state knows that we're switching
@ -10791,10 +10792,10 @@ static void M_Marathon(INT32 choice)
recatkdrawtimer = (50-8) * FRACUNIT;
char_scroll = 0;
if (!F_GetQueuedWipe())
if (!ScreenWipe_GetQueued())
{
F_QueuePreWipe(wipedefs[wipe_level_toblack], 0, NULL);
F_QueuePostWipe(menupres[MN_SP_MARATHON].enterwipe, WSF_FADEIN, NULL);
ScreenWipe_DoFadeOut(wipedefs[wipe_level_toblack], 0, NULL);
ScreenWipe_DoFadeIn(menupres[MN_SP_MARATHON].enterwipe, WIPEFLAGS_FADEIN, NULL);
}
}

View file

@ -64,7 +64,8 @@
#include "lua_hud.h" // level title
#include "f_finale.h" // wipes
#include "f_finale.h"
#include "f_wipe.h" // wipes
#include "md5.h" // map MD5
@ -7543,31 +7544,31 @@ void P_RunSpecialStageWipe(void)
(mapmusflags & MUSIC_RELOADRESET) ? mapheaderinfo[gamemap - 1]->musname : mapmusname, 7))
S_FadeOutStopMusic(MUSICRATE/4);
if (titlemapinaction || F_GetQueuedWipe())
if (titlemapinaction || ScreenWipe_GetQueued())
return;
wipe_t wipe = {0};
wipe.flags = WSF_TOWHITE;
wipe.style = F_WipeGetStyle(wipe.flags);
wipe.flags = WIPEFLAGS_TOWHITE;
wipe.style = ScreenWipe_GetStyle(wipe.flags);
wipe.callback = G_DoLoadLevel;
wipe.type = wipedefs[wipe_speclevel_towhite];
wipe.drawmenuontop = false;
wipe.holdframes = (3*TICRATE)/2;
F_StartWipeParametrized(&wipe);
ScreenWipe_StartParametrized(&wipe);
}
void P_RunLevelWipe(void)
{
if (titlemapinaction || F_GetQueuedWipe())
if (titlemapinaction || ScreenWipe_GetQueued())
return;
wipe_t wipe = {0};
wipe.flags = 0;
wipe.style = F_WipeGetStyle(wipe.flags);
wipe.style = ScreenWipe_GetStyle(wipe.flags);
wipe.callback = G_DoLoadLevel;
wipe.type = wipedefs[wipe_level_toblack];
wipe.drawmenuontop = false;
F_StartWipeParametrized(&wipe);
ScreenWipe_StartParametrized(&wipe);
}
static void P_InitPlayers(void)
@ -7868,10 +7869,6 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
// clear special respawning que
iquehead = iquetail = 0;
// Remove the loading shit from the screen
if (rendermode != render_none && !(titlemapinaction || reloadinggamestate))
F_WipeColorFill(levelfadecol);
if (precache || dedicated)
R_PrecacheLevel();
@ -7945,11 +7942,11 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
if (ranspecialwipe == SPECIALWIPE_RETRY)
{
wipe_t wipe = {0};
wipe.flags = WSF_TOWHITE | WSF_FADEIN;
wipe.style = F_WipeGetStyle(wipe.flags);
wipe.flags = WIPEFLAGS_TOWHITE | WIPEFLAGS_FADEIN;
wipe.style = ScreenWipe_GetStyle(wipe.flags);
wipe.type = wipedefs[wipe_level_final];
wipe.drawmenuontop = true;
F_StartWipeParametrized(&wipe);
ScreenWipe_StartParametrized(&wipe);
// Reset the HUD translucency!
st_translucency = cv_translucenthud.value;

View file

@ -26,7 +26,7 @@
#include "z_zone.h"
#include "p_setup.h" // levelflats
#include "v_video.h" // pMasterPalette
#include "f_finale.h" // wipes
#include "f_wipe.h" // wipes
#include "byteptr.h"
#include "dehacked.h"

View file

@ -18,6 +18,7 @@
#include "r_local.h"
#include "p_local.h"
#include "f_finale.h"
#include "f_wipe.h"
#include "st_stuff.h"
#include "i_video.h"
#include "v_video.h"

View file

@ -20,7 +20,7 @@
#include "v_video.h"
#include "st_stuff.h"
#include "hu_stuff.h"
#include "f_finale.h"
#include "f_wipe.h" // wipes
#include "r_draw.h"
#include "console.h"

View file

@ -13,6 +13,7 @@
#include "doomstat.h"
#include "d_main.h"
#include "f_finale.h"
#include "f_wipe.h"
#include "g_game.h"
#include "hu_stuff.h"
#include "netcode/i_net.h"
@ -1328,7 +1329,7 @@ void Y_StartIntermission(void)
}
}
F_StopAllWipes();
ScreenWipe_StopAll();
// This should always exist, but just in case...
if(!mapheaderinfo[prevmap])
@ -1363,7 +1364,7 @@ void Y_StartIntermission(void)
}
usetile = false;
F_WipeDoCrossfade(DEFAULTWIPE);
ScreenWipe_DoCrossfade(DEFAULTWIPE);
// set up the "got through act" message according to skin name
if (stagefailed)
@ -1440,7 +1441,7 @@ void Y_StartIntermission(void)
// tile if using the default background
usetile = !useinterpic;
F_DoGenericTransition();
ScreenWipe_DoFadeOutIn();
// Super form stuff (normally blank)
data.spec.passed3[0] = '\0';
@ -1516,7 +1517,7 @@ void Y_StartIntermission(void)
usetile = true;
useinterpic = false;
F_DoGenericTransition();
ScreenWipe_DoFadeOutIn();
break;
}
@ -1542,7 +1543,7 @@ void Y_StartIntermission(void)
usetile = true;
useinterpic = false;
F_DoGenericTransition();
ScreenWipe_DoFadeOutIn();
break;
}
@ -1569,7 +1570,7 @@ void Y_StartIntermission(void)
usetile = true;
useinterpic = false;
F_DoGenericTransition();
ScreenWipe_DoFadeOutIn();
break;
}
@ -1595,7 +1596,7 @@ void Y_StartIntermission(void)
usetile = true;
useinterpic = false;
F_DoGenericTransition();
ScreenWipe_DoFadeOutIn();
break;
}