Various changes between 2018-11-16 and 2018-11-20

This commit is contained in:
GenericHeroGuy 2025-06-17 02:14:02 +02:00
parent 205d1401f6
commit ca7caf3dd5
5 changed files with 110 additions and 27 deletions

View file

@ -456,19 +456,20 @@ static bool D_Display(void)
if (gamestate == GS_TITLESCREEN && wipegamestate != GS_INTRO)
wipedefindex = wipe_timeattack_toblack;
if (wipetypepre < 0)
if (wipetypepre < 0 || !F_WipeExists(wipetypepre))
wipetypepre = wipedefs[wipedefindex];
if (rendermode != render_none)
{
// Fade to black first
if (!(gamestate == GS_LEVEL || (gamestate == GS_TITLESCREEN && titlemapinaction)) // fades to black on its own timing, always
if ((wipegamestate == FORCEWIPE ||
!(gamestate == GS_LEVEL || (gamestate == GS_TITLESCREEN && titlemapinaction))) // fades to black on its own timing, always
&& wipetypepre != UINT8_MAX)
{
F_WipeStartScreen();
F_WipeColorFill(31);
F_WipeEndScreen();
F_RunWipe(wipetypepre, gamestate != GS_TIMEATTACK);
F_RunWipe(wipetypepre, gamestate != GS_TIMEATTACK && gamestate != GS_TITLESCREEN);
ranwipe = true;
}
@ -482,7 +483,7 @@ static bool D_Display(void)
}
else //dedicated servers
{
F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK);
F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK && gamestate != GS_TITLESCREEN);
ranwipe = true;
wipegamestate = gamestate;
}
@ -670,14 +671,14 @@ static bool D_Display(void)
// and input during wipe tends to mess things up
wipedefindex += WIPEFINALSHIFT;
if (wipetypepost < 0)
if (wipetypepost < 0 || !F_WipeExists(wipetypepost))
wipetypepost = wipedefs[wipedefindex];
if (rendermode != render_none)
{
F_WipeEndScreen();
F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK && gamestate != GS_TITLESCREEN);
F_RunWipe(wipetypepost, gamestate != GS_TIMEATTACK && gamestate != GS_TITLESCREEN);
ranwipe = true;
}

View file

@ -26,6 +26,9 @@ extern "C" {
//
// FINALE
//
// HACK for menu fading while titlemapinaction; skips the level check
#define FORCEWIPE -2
// Called by main loop.
boolean F_IntroResponder(event_t *ev);
@ -153,6 +156,8 @@ extern INT32 lastwipetic;
void F_WipeStartScreen(void);
void F_WipeEndScreen(void);
void F_RunWipe(UINT8 wipetype, boolean drawMenu);
tic_t F_GetWipeLength(UINT8 wipetype);
boolean F_WipeExists(UINT8 wipetype);
void F_WipeStageTitle(void);
#define F_WipeColorFill(c) V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, c)

View file

@ -423,3 +423,52 @@ void F_RunWipe(UINT8 wipetype, boolean drawMenu)
WipeInAction = false;
#endif
}
/** Returns tic length of wipe
* One lump equals one tic
*/
tic_t F_GetWipeLength(UINT8 wipetype)
{
#ifdef NOWIPE
(void)wipetype;
return 0;
#else
static char lumpname[10] = "FADEmmss";
lumpnum_t lumpnum;
UINT8 wipeframe;
if (wipetype > 99)
return 0;
for (wipeframe = 0; wipeframe < 100; wipeframe++)
{
sprintf(&lumpname[4], "%.2hu%.2hu", (UINT16)wipetype, (UINT16)wipeframe);
lumpnum = W_CheckNumForName(lumpname);
if (lumpnum == LUMPERROR)
return --wipeframe;
}
return --wipeframe;
#endif
}
/** Does the specified wipe exist?
*/
boolean F_WipeExists(UINT8 wipetype)
{
#ifdef NOWIPE
(void)wipetype;
return false;
#else
static char lumpname[10] = "FADEmm00";
lumpnum_t lumpnum;
if (wipetype > 99)
return false;
sprintf(&lumpname[4], "%.2hu00", (UINT16)wipetype);
lumpnum = W_CheckNumForName(lumpname);
return !(lumpnum == LUMPERROR);
#endif
}

View file

@ -1248,7 +1248,7 @@ static void M_HandleMenuPresState(menutype_t newMenuType)
// because 0 is a valid index and -1 means default
wipetypepre = ((exitwipe && enterlevel <= exitlevel) || anceslevel < 0) ? exitwipe : INT16_MAX;
wipetypepost = ((enterwipe && enterlevel >= exitlevel) || anceslevel < 0) ? enterwipe : INT16_MAX;
wipegamestate = -1; // G: FORCEWIPE
wipegamestate = FORCEWIPE;
// If just one of the above is a force not-wipe,
// mirror the other wipe.
@ -1878,9 +1878,22 @@ void M_Drawer(void)
{
// now that's more readable with a faded background (yeah like Quake...)
if (gamestate == GS_TIMEATTACK)
V_DrawPatchFill(W_CachePatchName("SRB2BACK", PU_CACHE));
else if (!WipeInAction && menustack[0] != MN_PLAYBACK) // Replay playback has its own background
V_DrawFadeScreen(0xFF00, 16);
{
// TODO: M_DrawScrollingBackground("SRB2BACK")
// TODO: M_DrawFadeScreen(0)
//V_DrawPatchFill(W_CachePatchName("SRB2BACK", PU_CACHE));
//M_SetMenuCurBackground("SRB2BACK");
if (curbgcolor >= 0)
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, curbgcolor);
else if (!curbghide || !titlemapinaction)
F_SkyScroll(curbgxspeed, curbgyspeed, curbgname);
if (curfadevalue)
V_DrawFadeScreen(0xFF00, curfadevalue);
}
else if (!WipeInAction && menustack[0] != MN_PLAYBACK && (curfadevalue || (gamestate != GS_TITLESCREEN && gamestate != GS_TIMEATTACK))) // Replay playback has its own background
// TODO: M_DrawFadeScreen(16)
// nope!
V_DrawFadeScreen(0xFF00, (gamestate != GS_TITLESCREEN && gamestate != GS_TIMEATTACK) ? 16 : curfadevalue);
}
if (messagebox.active)
@ -2033,7 +2046,10 @@ void M_ClearMenus(boolean callexitmenufunc)
// D_StartTitle does its own wipe, since GS_TIMEATTACK is now a complete gamestate.
if (gamestate == GS_TIMEATTACK)
{
wipetypepre = menudefs[M_GetYoungestChildMenu()].exitwipe;
D_StartTitle();
}
}
//
@ -3896,13 +3912,13 @@ INT32 MR_ReplayHut(INT32 choice)
PrepReplayList();
M_ClearMenus(true);
G_SetGamestate(GS_TIMEATTACK);
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
demo.rewinding = false;
CL_ClearRewinds();
S_ChangeMusicInternal("replst", true);
M_ChangeMenuMusic("replst", true);
return true;
}
@ -4654,7 +4670,7 @@ INT32 MR_PlaybackQuit(INT32 choice)
else if (modeattacking)
{
MR_ModeAttackEndGame(0);
S_ChangeMusicInternal("racent", true);
M_ChangeMenuMusic("racent", true);
}
else
{
@ -5250,7 +5266,7 @@ INT32 MR_HandleMusicTest(INT32 choice)
S_StopMusic();
st_time = 0;
curplaying = soundtestdefs[st_sel];
S_ChangeMusicInternal(&curplaying->name[0][0], true);
S_ChangeMusicInternal(&curplaying->name[0][0], true); // TODO: M_ChangeMenuMusic?
break;
default:
@ -5808,7 +5824,7 @@ INT32 MR_TimeAttack(INT32 arg)
M_PatchSkinNameTable();
M_ClearMenus(true);
G_SetGamestate(GS_TIMEATTACK);
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
if (cv_nextmap.value)
@ -5818,7 +5834,7 @@ INT32 MR_TimeAttack(INT32 arg)
M_SetItemOn(MN_SP_TIMEATTACK, "START"); // "Start" is selected.
S_ChangeMusicInternal("racent", true);
M_ChangeMenuMusic("racent", true);
return true;
}

View file

@ -8632,18 +8632,30 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
// But only if we didn't do the encore startup wipe
if (!ranspecialwipe && !demo.rewinding && !reloadinggamestate)
{
if(rendermode != render_none)
{
F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, levelfadecol);
UINT16 wipe = encoremode ? wipe_level_final : wipe_level_toblack;
F_WipeEndScreen();
F_RunWipe(wipedefs[(encoremode ? wipe_level_final : wipe_level_toblack)], false);
}
else //dedicated servers
{
F_RunWipe(wipedefs[(encoremode ? wipe_level_final : wipe_level_toblack)], false);
}
// for titlemap: run a specific wipe if specified
// needed for exiting time attack
if (wipetypepre != INT16_MAX && wipetypepre >= 0 && F_WipeExists(wipetypepre))
{
wipe = wipetypepre;
wipetypepre = -1;
}
if(rendermode != render_none)
{
F_WipeStartScreen();
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, levelfadecol);
F_WipeEndScreen();
if (wipetypepre != INT16_MAX)
F_RunWipe(wipedefs[wipe], false);
}
else //dedicated servers
{
if (wipetypepre != INT16_MAX)
F_RunWipe(wipedefs[wipe], false);
}
}
/*if (!titlemapinaction)
wipegamestate = GS_LEVEL;*/