mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 09:11:48 +00:00
Rearranged menu presentation methods
* Menu parameter retrieval and hierarchy in m_menu * Presentation logic (background display) in f_finale
This commit is contained in:
parent
dcac157ccd
commit
eb95289ea4
8 changed files with 256 additions and 248 deletions
|
@ -1984,7 +1984,7 @@ static boolean CL_ServerConnectionTicker(boolean viams, const char *tmpsave, tic
|
||||||
#ifdef CLIENT_LOADINGSCREEN
|
#ifdef CLIENT_LOADINGSCREEN
|
||||||
if (client && cl_mode != CL_CONNECTED && cl_mode != CL_ABORTED)
|
if (client && cl_mode != CL_CONNECTED && cl_mode != CL_ABORTED)
|
||||||
{
|
{
|
||||||
MN_Ticker(true); // title sky
|
F_MenuPresTicker(true); // title sky
|
||||||
F_TitleScreenTicker(true);
|
F_TitleScreenTicker(true);
|
||||||
F_TitleScreenDrawer();
|
F_TitleScreenDrawer();
|
||||||
CL_DrawConnectionStatus();
|
CL_DrawConnectionStatus();
|
||||||
|
|
10
src/d_main.c
10
src/d_main.c
|
@ -372,7 +372,7 @@ static void D_Display(void)
|
||||||
|
|
||||||
// Run menu state updates and linedef execs in titlemap
|
// Run menu state updates and linedef execs in titlemap
|
||||||
if (wipe && (gamestate == GS_TITLESCREEN || gamestate == GS_TIMEATTACK))
|
if (wipe && (gamestate == GS_TITLESCREEN || gamestate == GS_TIMEATTACK))
|
||||||
M_ApplyMenuMetaState();
|
M_ApplyMenuPresState();
|
||||||
|
|
||||||
// clean up border stuff
|
// clean up border stuff
|
||||||
// see if the border needs to be initially drawn
|
// see if the border needs to be initially drawn
|
||||||
|
@ -751,7 +751,7 @@ void D_StartTitle(void)
|
||||||
gametype = GT_COOP;
|
gametype = GT_COOP;
|
||||||
paused = false;
|
paused = false;
|
||||||
advancedemo = false;
|
advancedemo = false;
|
||||||
MN_Start();
|
F_InitMenuPresValues();
|
||||||
F_StartTitleScreen();
|
F_StartTitleScreen();
|
||||||
CON_ToggleOff();
|
CON_ToggleOff();
|
||||||
|
|
||||||
|
@ -1120,11 +1120,11 @@ void D_SRB2Main(void)
|
||||||
P_PatchInfoTables();
|
P_PatchInfoTables();
|
||||||
|
|
||||||
// initiate menu metadata before SOCcing them
|
// initiate menu metadata before SOCcing them
|
||||||
MN_InitInfoTables();
|
M_InitMenuPresTables();
|
||||||
|
|
||||||
// init title screen display params
|
// init title screen display params
|
||||||
if (M_CheckParm("-connect"))
|
if (M_CheckParm("-connect"))
|
||||||
MN_Start();
|
F_InitMenuPresValues();
|
||||||
|
|
||||||
//---------------------------------------------------- READY TIME
|
//---------------------------------------------------- READY TIME
|
||||||
// we need to check for dedicated before initialization of some subsystems
|
// we need to check for dedicated before initialization of some subsystems
|
||||||
|
@ -1405,7 +1405,7 @@ void D_SRB2Main(void)
|
||||||
{
|
{
|
||||||
CON_ToggleOff();
|
CON_ToggleOff();
|
||||||
CON_ClearHUD();
|
CON_ClearHUD();
|
||||||
MN_Start();
|
F_InitMenuPresValues();
|
||||||
F_StartTitleScreen();
|
F_StartTitleScreen();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -1956,40 +1956,40 @@ static void readmenu(MYFILE *f, INT32 num)
|
||||||
|
|
||||||
if (fastcmp(word, "BACKGROUNDNAME"))
|
if (fastcmp(word, "BACKGROUNDNAME"))
|
||||||
{
|
{
|
||||||
strncpy(menumeta[num].bgname, word2, 8);
|
strncpy(menupres[num].bgname, word2, 8);
|
||||||
titlechanged = true;
|
titlechanged = true;
|
||||||
}
|
}
|
||||||
else if (fastcmp(word, "HIDEBACKGROUND"))
|
else if (fastcmp(word, "HIDEBACKGROUND"))
|
||||||
{
|
{
|
||||||
menumeta[num].bghide = (boolean)(value || word2[0] == 'T' || word2[0] == 'Y');
|
menupres[num].bghide = (boolean)(value || word2[0] == 'T' || word2[0] == 'Y');
|
||||||
titlechanged = true;
|
titlechanged = true;
|
||||||
}
|
}
|
||||||
else if (fastcmp(word, "BACKGROUNDCOLOR"))
|
else if (fastcmp(word, "BACKGROUNDCOLOR"))
|
||||||
{
|
{
|
||||||
menumeta[num].bgcolor = value;
|
menupres[num].bgcolor = value;
|
||||||
titlechanged = true;
|
titlechanged = true;
|
||||||
}
|
}
|
||||||
else if (fastcmp(word, "HIDETITLEPICS") || fastcmp(word, "HIDEPICS"))
|
else if (fastcmp(word, "HIDETITLEPICS") || fastcmp(word, "HIDEPICS"))
|
||||||
{
|
{
|
||||||
// true by default, except MM_MAIN
|
// true by default, except MM_MAIN
|
||||||
menumeta[num].hidetitlepics = (boolean)(value || word2[0] == 'T' || word2[0] == 'Y');
|
menupres[num].hidetitlepics = (boolean)(value || word2[0] == 'T' || word2[0] == 'Y');
|
||||||
titlechanged = true;
|
titlechanged = true;
|
||||||
}
|
}
|
||||||
else if (fastcmp(word, "TITLESCROLLSPEED") || fastcmp(word, "TITLESCROLLXSPEED")
|
else if (fastcmp(word, "TITLESCROLLSPEED") || fastcmp(word, "TITLESCROLLXSPEED")
|
||||||
|| fastcmp(word, "SCROLLSPEED") || fastcmp(word, "SCROLLXSPEED"))
|
|| fastcmp(word, "SCROLLSPEED") || fastcmp(word, "SCROLLXSPEED"))
|
||||||
{
|
{
|
||||||
menumeta[num].titlescrollxspeed = get_number(word2);
|
menupres[num].titlescrollxspeed = get_number(word2);
|
||||||
titlechanged = true;
|
titlechanged = true;
|
||||||
}
|
}
|
||||||
else if (fastcmp(word, "TITLESCROLLYSPEED") || fastcmp(word, "SCROLLYSPEED"))
|
else if (fastcmp(word, "TITLESCROLLYSPEED") || fastcmp(word, "SCROLLYSPEED"))
|
||||||
{
|
{
|
||||||
menumeta[num].titlescrollyspeed = get_number(word2);
|
menupres[num].titlescrollyspeed = get_number(word2);
|
||||||
titlechanged = true;
|
titlechanged = true;
|
||||||
}
|
}
|
||||||
else if (fastcmp(word, "MUSIC"))
|
else if (fastcmp(word, "MUSIC"))
|
||||||
{
|
{
|
||||||
strncpy(menumeta[num].musname, word2, 7);
|
strncpy(menupres[num].musname, word2, 7);
|
||||||
menumeta[num].musname[6] = 0;
|
menupres[num].musname[6] = 0;
|
||||||
titlechanged = true;
|
titlechanged = true;
|
||||||
}
|
}
|
||||||
#ifdef MUSICSLOT_COMPATIBILITY
|
#ifdef MUSICSLOT_COMPATIBILITY
|
||||||
|
@ -1997,70 +1997,70 @@ static void readmenu(MYFILE *f, INT32 num)
|
||||||
{
|
{
|
||||||
value = get_mus(word2, true);
|
value = get_mus(word2, true);
|
||||||
if (value && value <= 1035)
|
if (value && value <= 1035)
|
||||||
snprintf(menumeta[num].musname, 7, "%sM", G_BuildMapName(value));
|
snprintf(menupres[num].musname, 7, "%sM", G_BuildMapName(value));
|
||||||
else if (value && value <= 1050)
|
else if (value && value <= 1050)
|
||||||
strncpy(menumeta[num].musname, compat_special_music_slots[value - 1036], 7);
|
strncpy(menupres[num].musname, compat_special_music_slots[value - 1036], 7);
|
||||||
else
|
else
|
||||||
menumeta[num].musname[0] = 0; // becomes empty string
|
menupres[num].musname[0] = 0; // becomes empty string
|
||||||
menumeta[num].musname[6] = 0;
|
menupres[num].musname[6] = 0;
|
||||||
titlechanged = true;
|
titlechanged = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else if (fastcmp(word, "MUSICTRACK"))
|
else if (fastcmp(word, "MUSICTRACK"))
|
||||||
{
|
{
|
||||||
menumeta[num].mustrack = ((UINT16)value - 1);
|
menupres[num].mustrack = ((UINT16)value - 1);
|
||||||
titlechanged = true;
|
titlechanged = true;
|
||||||
}
|
}
|
||||||
else if (fastcmp(word, "MUSICLOOP"))
|
else if (fastcmp(word, "MUSICLOOP"))
|
||||||
{
|
{
|
||||||
// true by default except MM_MAIN
|
// true by default except MM_MAIN
|
||||||
menumeta[num].muslooping = (value || word2[0] == 'T' || word2[0] == 'Y');
|
menupres[num].muslooping = (value || word2[0] == 'T' || word2[0] == 'Y');
|
||||||
titlechanged = true;
|
titlechanged = true;
|
||||||
}
|
}
|
||||||
else if (fastcmp(word, "NOMUSIC"))
|
else if (fastcmp(word, "NOMUSIC"))
|
||||||
{
|
{
|
||||||
menumeta[num].musstop = (value || word2[0] == 'T' || word2[0] == 'Y');
|
menupres[num].musstop = (value || word2[0] == 'T' || word2[0] == 'Y');
|
||||||
titlechanged = true;
|
titlechanged = true;
|
||||||
}
|
}
|
||||||
else if (fastcmp(word, "IGNOREMUSIC"))
|
else if (fastcmp(word, "IGNOREMUSIC"))
|
||||||
{
|
{
|
||||||
menumeta[num].musignore = (value || word2[0] == 'T' || word2[0] == 'Y');
|
menupres[num].musignore = (value || word2[0] == 'T' || word2[0] == 'Y');
|
||||||
titlechanged = true;
|
titlechanged = true;
|
||||||
}
|
}
|
||||||
else if (fastcmp(word, "FADESTRENGTH"))
|
else if (fastcmp(word, "FADESTRENGTH"))
|
||||||
{
|
{
|
||||||
// one-based, <= 0 means use default value. 1-32
|
// one-based, <= 0 means use default value. 1-32
|
||||||
menumeta[num].fadestrength = value-1;
|
menupres[num].fadestrength = value-1;
|
||||||
titlechanged = true;
|
titlechanged = true;
|
||||||
}
|
}
|
||||||
else if (fastcmp(word, "NOENTERBUBBLE"))
|
else if (fastcmp(word, "NOENTERBUBBLE"))
|
||||||
{
|
{
|
||||||
menumeta[num].enterbubble = !(value || word2[0] == 'T' || word2[0] == 'Y');
|
menupres[num].enterbubble = !(value || word2[0] == 'T' || word2[0] == 'Y');
|
||||||
titlechanged = true;
|
titlechanged = true;
|
||||||
}
|
}
|
||||||
else if (fastcmp(word, "NOEXITBUBBLE"))
|
else if (fastcmp(word, "NOEXITBUBBLE"))
|
||||||
{
|
{
|
||||||
menumeta[num].exitbubble = !(value || word2[0] == 'T' || word2[0] == 'Y');
|
menupres[num].exitbubble = !(value || word2[0] == 'T' || word2[0] == 'Y');
|
||||||
titlechanged = true;
|
titlechanged = true;
|
||||||
}
|
}
|
||||||
else if (fastcmp(word, "ENTERTAG"))
|
else if (fastcmp(word, "ENTERTAG"))
|
||||||
{
|
{
|
||||||
menumeta[num].entertag = value;
|
menupres[num].entertag = value;
|
||||||
titlechanged = true;
|
titlechanged = true;
|
||||||
}
|
}
|
||||||
else if (fastcmp(word, "EXITTAG"))
|
else if (fastcmp(word, "EXITTAG"))
|
||||||
{
|
{
|
||||||
menumeta[num].exittag = value;
|
menupres[num].exittag = value;
|
||||||
titlechanged = true;
|
titlechanged = true;
|
||||||
}
|
}
|
||||||
else if (fastcmp(word, "ENTERWIPE"))
|
else if (fastcmp(word, "ENTERWIPE"))
|
||||||
{
|
{
|
||||||
menumeta[num].enterwipe = value;
|
menupres[num].enterwipe = value;
|
||||||
titlechanged = true;
|
titlechanged = true;
|
||||||
}
|
}
|
||||||
else if (fastcmp(word, "EXITWIPE"))
|
else if (fastcmp(word, "EXITWIPE"))
|
||||||
{
|
{
|
||||||
menumeta[num].exitwipe = value;
|
menupres[num].exitwipe = value;
|
||||||
titlechanged = true;
|
titlechanged = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
124
src/f_finale.c
124
src/f_finale.c
|
@ -51,7 +51,7 @@ static INT32 timetonext; // Delay between screen changes
|
||||||
static INT32 continuetime; // Short delay when continuing
|
static INT32 continuetime; // Short delay when continuing
|
||||||
|
|
||||||
static tic_t animtimer; // Used for some animation timings
|
static tic_t animtimer; // Used for some animation timings
|
||||||
static INT16 skullAnimCounter; // Prompts: Chevron animation; Title screen: Y animation timing
|
static INT16 skullAnimCounter; // Prompts: Chevron animation
|
||||||
static INT32 roidtics; // Asteroid spinning
|
static INT32 roidtics; // Asteroid spinning
|
||||||
|
|
||||||
static INT32 deplete;
|
static INT32 deplete;
|
||||||
|
@ -60,6 +60,20 @@ static tic_t stoptimer;
|
||||||
static boolean keypressed = false;
|
static boolean keypressed = false;
|
||||||
|
|
||||||
// (no longer) De-Demo'd Title Screen
|
// (no longer) De-Demo'd Title Screen
|
||||||
|
static tic_t xscrolltimer;
|
||||||
|
static tic_t yscrolltimer;
|
||||||
|
static INT32 menuanimtimer; // Title screen: background animation timing
|
||||||
|
mobj_t *titlemapcameraref = NULL;
|
||||||
|
|
||||||
|
// menu presentation state
|
||||||
|
char curbgname[8];
|
||||||
|
SINT8 curfadevalue;
|
||||||
|
boolean curhidepics;
|
||||||
|
INT32 curbgcolor;
|
||||||
|
INT32 curbgxspeed;
|
||||||
|
INT32 curbgyspeed;
|
||||||
|
boolean curbghide;
|
||||||
|
|
||||||
static UINT8 curDemo = 0;
|
static UINT8 curDemo = 0;
|
||||||
static UINT32 demoDelayLeft;
|
static UINT32 demoDelayLeft;
|
||||||
static UINT32 demoIdleLeft;
|
static UINT32 demoIdleLeft;
|
||||||
|
@ -610,7 +624,7 @@ static void F_IntroDrawScene(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
M_SkyScroll(80*4, 0, "TITLESKY");
|
F_SkyScroll(80*4, 0, "TITLESKY");
|
||||||
if (timetonext == 6)
|
if (timetonext == 6)
|
||||||
{
|
{
|
||||||
stoptimer = finalecount;
|
stoptimer = finalecount;
|
||||||
|
@ -1351,19 +1365,103 @@ void F_GameEndTicker(void)
|
||||||
// ==============
|
// ==============
|
||||||
// TITLE SCREEN
|
// TITLE SCREEN
|
||||||
// ==============
|
// ==============
|
||||||
mobj_t *titlemapcameraref = NULL;
|
|
||||||
|
void F_InitMenuPresValues(void)
|
||||||
|
{
|
||||||
|
menuanimtimer = 0;
|
||||||
|
prevMenuId = 0;
|
||||||
|
activeMenuId = MainDef.menuid;
|
||||||
|
|
||||||
|
// Set defaults for presentation values
|
||||||
|
strncpy(curbgname, "TITLESKY", 8);
|
||||||
|
curfadevalue = 16;
|
||||||
|
curhidepics = hidetitlepics;
|
||||||
|
curbgcolor = -1;
|
||||||
|
curbgxspeed = titlescrollxspeed;
|
||||||
|
curbgyspeed = titlescrollyspeed;
|
||||||
|
curbghide = false;
|
||||||
|
|
||||||
|
// Find current presentation values
|
||||||
|
M_SetMenuCurBackground((gamestate == GS_TIMEATTACK) ? "SRB2BACK" : "TITLESKY");
|
||||||
|
M_SetMenuCurFadeValue(16);
|
||||||
|
M_SetMenuCurHideTitlePics();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// F_SkyScroll
|
||||||
|
//
|
||||||
|
void F_SkyScroll(INT32 scrollxspeed, INT32 scrollyspeed, const char *patchname)
|
||||||
|
{
|
||||||
|
INT32 xscrolled, x, xneg = (scrollxspeed > 0) - (scrollxspeed < 0), tilex;
|
||||||
|
INT32 yscrolled, y, yneg = (scrollyspeed > 0) - (scrollyspeed < 0), tiley;
|
||||||
|
boolean xispos = (scrollxspeed >= 0), yispos = (scrollyspeed >= 0);
|
||||||
|
INT32 dupz = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy);
|
||||||
|
INT16 patwidth, patheight;
|
||||||
|
INT32 pw, ph; // scaled by dupz
|
||||||
|
patch_t *pat;
|
||||||
|
INT32 i, j;
|
||||||
|
|
||||||
|
if (rendermode == render_none)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!patchname || !patchname[0])
|
||||||
|
{
|
||||||
|
V_DrawFill(0, 0, vid.width, vid.height, 31);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!scrollxspeed && !scrollyspeed)
|
||||||
|
{
|
||||||
|
V_DrawPatchFill(W_CachePatchName(patchname, PU_CACHE));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
pat = W_CachePatchName(patchname, PU_CACHE);
|
||||||
|
|
||||||
|
patwidth = SHORT(pat->width);
|
||||||
|
patheight = SHORT(pat->height);
|
||||||
|
pw = patwidth * dupz;
|
||||||
|
ph = patheight * dupz;
|
||||||
|
|
||||||
|
tilex = max(FixedCeil(FixedDiv(vid.width, pw)) >> FRACBITS, 1)+2; // one tile on both sides of center
|
||||||
|
tiley = max(FixedCeil(FixedDiv(vid.height, ph)) >> FRACBITS, 1)+2;
|
||||||
|
|
||||||
|
xscrolltimer = ((menuanimtimer*scrollxspeed)/16 + patwidth*xneg) % (patwidth);
|
||||||
|
yscrolltimer = ((menuanimtimer*scrollyspeed)/16 + patheight*yneg) % (patheight);
|
||||||
|
|
||||||
|
// coordinate offsets
|
||||||
|
xscrolled = xscrolltimer * dupz;
|
||||||
|
yscrolled = yscrolltimer * dupz;
|
||||||
|
|
||||||
|
for (x = (xispos) ? -pw*(tilex-1)+pw : 0, i = 0;
|
||||||
|
i < tilex;
|
||||||
|
x += pw, i++)
|
||||||
|
{
|
||||||
|
for (y = (yispos) ? -ph*(tiley-1)+ph : 0, j = 0;
|
||||||
|
j < tiley;
|
||||||
|
y += ph, j++)
|
||||||
|
{
|
||||||
|
V_DrawScaledPatch(
|
||||||
|
(xispos) ? xscrolled - x : x + xscrolled,
|
||||||
|
(yispos) ? yscrolled - y : y + yscrolled,
|
||||||
|
V_NOSCALESTART, pat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
W_UnlockCachedPatch(pat);
|
||||||
|
}
|
||||||
|
|
||||||
void F_StartTitleScreen(void)
|
void F_StartTitleScreen(void)
|
||||||
{
|
{
|
||||||
if (menumeta[MN_MAIN].musname[0])
|
if (menupres[MN_MAIN].musname[0])
|
||||||
S_ChangeMusic(menumeta[MN_MAIN].musname, menumeta[MN_MAIN].mustrack, menumeta[MN_MAIN].muslooping);
|
S_ChangeMusic(menupres[MN_MAIN].musname, menupres[MN_MAIN].mustrack, menupres[MN_MAIN].muslooping);
|
||||||
else
|
else
|
||||||
S_ChangeMusicInternal("_title", looptitle);
|
S_ChangeMusicInternal("_title", looptitle);
|
||||||
|
|
||||||
if (gamestate != GS_TITLESCREEN && gamestate != GS_WAITINGPLAYERS)
|
if (gamestate != GS_TITLESCREEN && gamestate != GS_WAITINGPLAYERS)
|
||||||
{
|
{
|
||||||
finalecount = 0;
|
finalecount = 0;
|
||||||
wipetypepost = menumeta[MN_MAIN].enterwipe;
|
wipetypepost = menupres[MN_MAIN].enterwipe;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
wipegamestate = GS_TITLESCREEN;
|
wipegamestate = GS_TITLESCREEN;
|
||||||
|
@ -1416,8 +1514,8 @@ void F_StartTitleScreen(void)
|
||||||
camera.height = 0;
|
camera.height = 0;
|
||||||
|
|
||||||
// Run enter linedef exec for MN_MAIN, since this is where we start
|
// Run enter linedef exec for MN_MAIN, since this is where we start
|
||||||
if (menumeta[MN_MAIN].entertag)
|
if (menupres[MN_MAIN].entertag)
|
||||||
P_LinedefExecute(menumeta[MN_MAIN].entertag, players[displayplayer].mo, NULL);
|
P_LinedefExecute(menupres[MN_MAIN].entertag, players[displayplayer].mo, NULL);
|
||||||
|
|
||||||
wipegamestate = prevwipegamestate;
|
wipegamestate = prevwipegamestate;
|
||||||
}
|
}
|
||||||
|
@ -1466,7 +1564,7 @@ void F_TitleScreenDrawer(void)
|
||||||
if (curbgcolor >= 0)
|
if (curbgcolor >= 0)
|
||||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, curbgcolor);
|
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, curbgcolor);
|
||||||
else if (!curbghide || !titlemapinaction || gamestate == GS_WAITINGPLAYERS)
|
else if (!curbghide || !titlemapinaction || gamestate == GS_WAITINGPLAYERS)
|
||||||
M_SkyScroll(curbgxspeed, curbgyspeed, curbgname);
|
F_SkyScroll(curbgxspeed, curbgyspeed, curbgname);
|
||||||
|
|
||||||
// Don't draw outside of the title screewn, or if the patch isn't there.
|
// Don't draw outside of the title screewn, or if the patch isn't there.
|
||||||
if (!ttwing || (gamestate != GS_TITLESCREEN && gamestate != GS_WAITINGPLAYERS))
|
if (!ttwing || (gamestate != GS_TITLESCREEN && gamestate != GS_WAITINGPLAYERS))
|
||||||
|
@ -1524,6 +1622,14 @@ luahook:
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// separate animation timer for backgrounds, since we also count
|
||||||
|
// during GS_TIMEATTACK
|
||||||
|
void F_MenuPresTicker(boolean run)
|
||||||
|
{
|
||||||
|
if (run)
|
||||||
|
menuanimtimer++;
|
||||||
|
}
|
||||||
|
|
||||||
// (no longer) De-Demo'd Title Screen
|
// (no longer) De-Demo'd Title Screen
|
||||||
void F_TitleScreenTicker(boolean run)
|
void F_TitleScreenTicker(boolean run)
|
||||||
{
|
{
|
||||||
|
|
|
@ -40,6 +40,7 @@ void F_TextPromptTicker(void);
|
||||||
void F_GameEndDrawer(void);
|
void F_GameEndDrawer(void);
|
||||||
void F_IntroDrawer(void);
|
void F_IntroDrawer(void);
|
||||||
void F_TitleScreenDrawer(void);
|
void F_TitleScreenDrawer(void);
|
||||||
|
void F_SkyScroll(INT32 scrollxspeed, INT32 scrollyspeed, const char *patchname);
|
||||||
|
|
||||||
void F_GameEvaluationDrawer(void);
|
void F_GameEvaluationDrawer(void);
|
||||||
void F_StartGameEvaluation(void);
|
void F_StartGameEvaluation(void);
|
||||||
|
@ -79,8 +80,22 @@ typedef enum
|
||||||
TITLEMAP_RUNNING
|
TITLEMAP_RUNNING
|
||||||
} titlemap_enum;
|
} titlemap_enum;
|
||||||
|
|
||||||
|
// Current menu parameters
|
||||||
|
|
||||||
extern UINT8 titlemapinaction;
|
extern UINT8 titlemapinaction;
|
||||||
extern mobj_t *titlemapcameraref;
|
extern mobj_t *titlemapcameraref;
|
||||||
|
extern char curbgname[8];
|
||||||
|
extern SINT8 curfadevalue;
|
||||||
|
extern boolean curhidepics;
|
||||||
|
extern INT32 curbgcolor;
|
||||||
|
extern INT32 curbgxspeed;
|
||||||
|
extern INT32 curbgyspeed;
|
||||||
|
extern boolean curbghide;
|
||||||
|
|
||||||
|
#define TITLEBACKGROUNDACTIVE (curfadevalue >= 0 || curbgname[0])
|
||||||
|
|
||||||
|
void F_InitMenuPresValues(void);
|
||||||
|
void F_MenuPresTicker(boolean run);
|
||||||
|
|
||||||
//
|
//
|
||||||
// WIPE
|
// WIPE
|
||||||
|
|
|
@ -1924,7 +1924,7 @@ void G_Ticker(boolean run)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GS_TIMEATTACK:
|
case GS_TIMEATTACK:
|
||||||
MN_Ticker(run);
|
F_MenuPresTicker(run);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GS_INTRO:
|
case GS_INTRO:
|
||||||
|
@ -1964,7 +1964,7 @@ void G_Ticker(boolean run)
|
||||||
if (titlemapinaction) P_Ticker(run); // then intentionally fall through
|
if (titlemapinaction) P_Ticker(run); // then intentionally fall through
|
||||||
/* FALLTHRU */
|
/* FALLTHRU */
|
||||||
case GS_WAITINGPLAYERS:
|
case GS_WAITINGPLAYERS:
|
||||||
MN_Ticker(run);
|
F_MenuPresTicker(run);
|
||||||
F_TitleScreenTicker(run);
|
F_TitleScreenTicker(run);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
276
src/m_menu.c
276
src/m_menu.c
|
@ -2188,62 +2188,43 @@ void Addons_option_Onchange(void)
|
||||||
menu_t *currentMenu = &MainDef;
|
menu_t *currentMenu = &MainDef;
|
||||||
|
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
// MENU METADATA LOGIC (BACKGROUNDS)
|
// MENU PRESENTATION PARAMETER HANDLING (BACKGROUNDS)
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
|
|
||||||
menumeta_t menumeta[NUMMENUTYPES];
|
// menu IDs are equal to current/prevMenu in most cases, except MN_SPECIAL when we don't want to operate on Message, Pause, etc.
|
||||||
static tic_t xscrolltimer;
|
UINT32 prevMenuId = 0;
|
||||||
static tic_t yscrolltimer;
|
UINT32 activeMenuId = 0;
|
||||||
static INT32 menuanimtimer;
|
|
||||||
|
|
||||||
// menu IDs are equal to current/prevMenu in most cases, except MM_SPECIAL when we don't want to operate on Message, Pause, etc.
|
menupres_t menupres[NUMMENUTYPES];
|
||||||
static UINT32 prevMenuId = 0;
|
|
||||||
static UINT32 activeMenuId = 0;
|
|
||||||
|
|
||||||
// menu presentation state
|
void M_InitMenuPresTables(void)
|
||||||
char curbgname[8];
|
|
||||||
SINT8 curfadevalue;
|
|
||||||
boolean curhidepics;
|
|
||||||
INT32 curbgcolor;
|
|
||||||
INT32 curbgxspeed;
|
|
||||||
INT32 curbgyspeed;
|
|
||||||
boolean curbghide;
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
char musname[7];
|
|
||||||
UINT16 mustrack;
|
|
||||||
boolean muslooping;
|
|
||||||
} menumetamusic_t;
|
|
||||||
|
|
||||||
void MN_InitInfoTables(void)
|
|
||||||
{
|
{
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
|
||||||
// Called in d_main before SOC can get to the tables
|
// Called in d_main before SOC can get to the tables
|
||||||
// Set menumeta defaults
|
// Set menupres defaults
|
||||||
for (i = 0; i < NUMMENUTYPES; i++)
|
for (i = 0; i < NUMMENUTYPES; i++)
|
||||||
{
|
{
|
||||||
// so-called "undefined"
|
// so-called "undefined"
|
||||||
menumeta[i].fadestrength = -1;
|
menupres[i].fadestrength = -1;
|
||||||
menumeta[i].hidetitlepics = -1; // inherits global hidetitlepics
|
menupres[i].hidetitlepics = -1; // inherits global hidetitlepics
|
||||||
menumeta[i].enterwipe = -1;
|
menupres[i].enterwipe = -1;
|
||||||
menumeta[i].exitwipe = -1;
|
menupres[i].exitwipe = -1;
|
||||||
menumeta[i].bgcolor = -1;
|
menupres[i].bgcolor = -1;
|
||||||
menumeta[i].titlescrollxspeed = INT32_MAX;
|
menupres[i].titlescrollxspeed = INT32_MAX;
|
||||||
menumeta[i].titlescrollyspeed = INT32_MAX;
|
menupres[i].titlescrollyspeed = INT32_MAX;
|
||||||
// default true
|
// default true
|
||||||
menumeta[i].enterbubble = true;
|
menupres[i].enterbubble = true;
|
||||||
menumeta[i].exitbubble = true;
|
menupres[i].exitbubble = true;
|
||||||
|
|
||||||
if (i != MN_MAIN)
|
if (i != MN_MAIN)
|
||||||
{
|
{
|
||||||
menumeta[i].muslooping = true;
|
menupres[i].muslooping = true;
|
||||||
}
|
}
|
||||||
if (i == MN_SP_TIMEATTACK || i == MN_SP_NIGHTSATTACK)
|
if (i == MN_SP_TIMEATTACK || i == MN_SP_NIGHTSATTACK)
|
||||||
strncpy(menumeta[i].musname, "_inter", 7);
|
strncpy(menupres[i].musname, "_inter", 7);
|
||||||
else if (i == MN_SP_PLAYER)
|
else if (i == MN_SP_PLAYER)
|
||||||
strncpy(menumeta[i].musname, "_chsel", 7);
|
strncpy(menupres[i].musname, "_chsel", 7);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2260,6 +2241,15 @@ void MN_InitInfoTables(void)
|
||||||
// return false - continue
|
// return false - continue
|
||||||
typedef boolean (*menutree_iterator)(UINT32, INT32, INT32 *, void **, boolean fromoldest);
|
typedef boolean (*menutree_iterator)(UINT32, INT32, INT32 *, void **, boolean fromoldest);
|
||||||
|
|
||||||
|
// HACK: Used in the ChangeMusic iterator because we only allow
|
||||||
|
// a single input. Maybe someday use this struct program-wide.
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
char musname[7];
|
||||||
|
UINT16 mustrack;
|
||||||
|
boolean muslooping;
|
||||||
|
} menupresmusic_t;
|
||||||
|
|
||||||
static INT32 M_IterateMenuTree(menutree_iterator itfunc, void *input)
|
static INT32 M_IterateMenuTree(menutree_iterator itfunc, void *input)
|
||||||
{
|
{
|
||||||
INT32 i, retval = 0;
|
INT32 i, retval = 0;
|
||||||
|
@ -2304,7 +2294,6 @@ static boolean MIT_GetMenuAtLevel(UINT32 menutype, INT32 level, INT32 *retval, v
|
||||||
INT32 targetlevel = *inputptr;
|
INT32 targetlevel = *inputptr;
|
||||||
if (menutype)
|
if (menutype)
|
||||||
{
|
{
|
||||||
// \todo offset targetlevel by failed initial attempts
|
|
||||||
if (level == targetlevel || targetlevel < 0)
|
if (level == targetlevel || targetlevel < 0)
|
||||||
{
|
{
|
||||||
*retval = menutype;
|
*retval = menutype;
|
||||||
|
@ -2353,19 +2342,19 @@ static boolean MIT_SetCurBackground(UINT32 menutype, INT32 level, INT32 *retval,
|
||||||
(void)retval;
|
(void)retval;
|
||||||
(void)fromoldest;
|
(void)fromoldest;
|
||||||
|
|
||||||
if (menumeta[menutype].bgcolor >= 0)
|
if (menupres[menutype].bgcolor >= 0)
|
||||||
{
|
{
|
||||||
curbgcolor = menumeta[menutype].bgcolor;
|
curbgcolor = menupres[menutype].bgcolor;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (menumeta[menutype].bgname[0] && (!menumeta[menutype].bghide || !titlemapinaction))
|
else if (menupres[menutype].bgname[0] && (!menupres[menutype].bghide || !titlemapinaction))
|
||||||
{
|
{
|
||||||
strncpy(curbgname, menumeta[menutype].bgname, 8);
|
strncpy(curbgname, menupres[menutype].bgname, 8);
|
||||||
curbgxspeed = menumeta[menutype].titlescrollxspeed != INT32_MAX ? menumeta[menutype].titlescrollxspeed : titlescrollxspeed;
|
curbgxspeed = menupres[menutype].titlescrollxspeed != INT32_MAX ? menupres[menutype].titlescrollxspeed : titlescrollxspeed;
|
||||||
curbgyspeed = menumeta[menutype].titlescrollyspeed != INT32_MAX ? menumeta[menutype].titlescrollyspeed : titlescrollyspeed;
|
curbgyspeed = menupres[menutype].titlescrollyspeed != INT32_MAX ? menupres[menutype].titlescrollyspeed : titlescrollyspeed;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (menumeta[menutype].bghide && titlemapinaction) // hide the background
|
else if (menupres[menutype].bghide && titlemapinaction) // hide the background
|
||||||
{
|
{
|
||||||
curbghide = true;
|
curbghide = true;
|
||||||
return true;
|
return true;
|
||||||
|
@ -2388,22 +2377,22 @@ static boolean MIT_SetCurBackground(UINT32 menutype, INT32 level, INT32 *retval,
|
||||||
|
|
||||||
static boolean MIT_ChangeMusic(UINT32 menutype, INT32 level, INT32 *retval, void **input, boolean fromoldest)
|
static boolean MIT_ChangeMusic(UINT32 menutype, INT32 level, INT32 *retval, void **input, boolean fromoldest)
|
||||||
{
|
{
|
||||||
menumetamusic_t *defaultmusic = (menumetamusic_t*)*input;
|
menupresmusic_t *defaultmusic = (menupresmusic_t*)*input;
|
||||||
|
|
||||||
(void)retval;
|
(void)retval;
|
||||||
(void)fromoldest;
|
(void)fromoldest;
|
||||||
|
|
||||||
if (menumeta[menutype].musname[0])
|
if (menupres[menutype].musname[0])
|
||||||
{
|
{
|
||||||
S_ChangeMusic(menumeta[menutype].musname, menumeta[menutype].mustrack, menumeta[menutype].muslooping);
|
S_ChangeMusic(menupres[menutype].musname, menupres[menutype].mustrack, menupres[menutype].muslooping);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (menumeta[menutype].musstop)
|
else if (menupres[menutype].musstop)
|
||||||
{
|
{
|
||||||
S_StopMusic();
|
S_StopMusic();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (menumeta[menutype].musignore)
|
else if (menupres[menutype].musignore)
|
||||||
return true;
|
return true;
|
||||||
else if (!level && defaultmusic && defaultmusic->musname[0])
|
else if (!level && defaultmusic && defaultmusic->musname[0])
|
||||||
S_ChangeMusic(defaultmusic->musname, defaultmusic->mustrack, defaultmusic->muslooping);
|
S_ChangeMusic(defaultmusic->musname, defaultmusic->mustrack, defaultmusic->muslooping);
|
||||||
|
@ -2417,9 +2406,9 @@ static boolean MIT_SetCurFadeValue(UINT32 menutype, INT32 level, INT32 *retval,
|
||||||
(void)retval;
|
(void)retval;
|
||||||
(void)fromoldest;
|
(void)fromoldest;
|
||||||
|
|
||||||
if (menumeta[menutype].fadestrength >= 0)
|
if (menupres[menutype].fadestrength >= 0)
|
||||||
{
|
{
|
||||||
curfadevalue = (menumeta[menutype].fadestrength % 32);
|
curfadevalue = (menupres[menutype].fadestrength % 32);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (!level)
|
else if (!level)
|
||||||
|
@ -2433,9 +2422,9 @@ static boolean MIT_SetCurHideTitlePics(UINT32 menutype, INT32 level, INT32 *retv
|
||||||
(void)retval;
|
(void)retval;
|
||||||
(void)fromoldest;
|
(void)fromoldest;
|
||||||
|
|
||||||
if (menumeta[menutype].hidetitlepics >= 0)
|
if (menupres[menutype].hidetitlepics >= 0)
|
||||||
{
|
{
|
||||||
curhidepics = menumeta[menutype].hidetitlepics;
|
curhidepics = menupres[menutype].hidetitlepics;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (!level)
|
else if (!level)
|
||||||
|
@ -2490,9 +2479,9 @@ static boolean M_HasMenuType(menutype_t needletype)
|
||||||
// EFFECTS
|
// EFFECTS
|
||||||
// ====================================
|
// ====================================
|
||||||
|
|
||||||
static void M_ChangeMusic(const char *defaultmusname, boolean defaultmuslooping)
|
void M_ChangeMenuMusic(const char *defaultmusname, boolean defaultmuslooping)
|
||||||
{
|
{
|
||||||
menumetamusic_t defaultmusic;
|
menupresmusic_t defaultmusic;
|
||||||
|
|
||||||
if (!defaultmusname)
|
if (!defaultmusname)
|
||||||
defaultmusname = "";
|
defaultmusname = "";
|
||||||
|
@ -2505,19 +2494,19 @@ static void M_ChangeMusic(const char *defaultmusname, boolean defaultmuslooping)
|
||||||
M_IterateMenuTree(MIT_ChangeMusic, &defaultmusic);
|
M_IterateMenuTree(MIT_ChangeMusic, &defaultmusic);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void M_SetCurBackground(const char *defaultname)
|
void M_SetMenuCurBackground(const char *defaultname)
|
||||||
{
|
{
|
||||||
char name[8];
|
char name[8];
|
||||||
strncpy(name, defaultname, 8);
|
strncpy(name, defaultname, 8);
|
||||||
M_IterateMenuTree(MIT_SetCurBackground, &name);
|
M_IterateMenuTree(MIT_SetCurBackground, &name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void M_SetCurFadeValue(UINT8 defaultvalue)
|
void M_SetMenuCurFadeValue(UINT8 defaultvalue)
|
||||||
{
|
{
|
||||||
M_IterateMenuTree(MIT_SetCurFadeValue, &defaultvalue);
|
M_IterateMenuTree(MIT_SetCurFadeValue, &defaultvalue);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void M_SetCurHideTitlePics(void)
|
void M_SetMenuCurHideTitlePics(void)
|
||||||
{
|
{
|
||||||
M_IterateMenuTree(MIT_SetCurHideTitlePics, NULL);
|
M_IterateMenuTree(MIT_SetCurHideTitlePics, NULL);
|
||||||
}
|
}
|
||||||
|
@ -2532,7 +2521,7 @@ static INT16 exitwipe, enterwipe;
|
||||||
static boolean exitbubble, enterbubble;
|
static boolean exitbubble, enterbubble;
|
||||||
static INT16 exittag, entertag;
|
static INT16 exittag, entertag;
|
||||||
|
|
||||||
static void M_HandleMenuMetaState(menu_t *newMenu)
|
static void M_HandleMenuPresState(menu_t *newMenu)
|
||||||
{
|
{
|
||||||
INT32 i;
|
INT32 i;
|
||||||
UINT32 bitmask;
|
UINT32 bitmask;
|
||||||
|
@ -2574,9 +2563,9 @@ static void M_HandleMenuMetaState(menu_t *newMenu)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Find current presentation values
|
// Find current presentation values
|
||||||
M_SetCurBackground((gamestate == GS_TIMEATTACK) ? "SRB2BACK" : "TITLESKY");
|
M_SetMenuCurBackground((gamestate == GS_TIMEATTACK) ? "SRB2BACK" : "TITLESKY");
|
||||||
M_SetCurFadeValue(16);
|
M_SetMenuCurFadeValue(16);
|
||||||
M_SetCurHideTitlePics();
|
M_SetMenuCurHideTitlePics();
|
||||||
|
|
||||||
// Loop through both menu IDs in parallel and look for type changes
|
// Loop through both menu IDs in parallel and look for type changes
|
||||||
// The youngest child in activeMenuId is the entered menu
|
// The youngest child in activeMenuId is the entered menu
|
||||||
|
@ -2600,18 +2589,18 @@ static void M_HandleMenuMetaState(menu_t *newMenu)
|
||||||
{
|
{
|
||||||
exittype = prevtype;
|
exittype = prevtype;
|
||||||
exitlevel = i;
|
exitlevel = i;
|
||||||
exitwipe = menumeta[exittype].exitwipe;
|
exitwipe = menupres[exittype].exitwipe;
|
||||||
exitbubble = menumeta[exittype].exitbubble;
|
exitbubble = menupres[exittype].exitbubble;
|
||||||
exittag = menumeta[exittype].exittag;
|
exittag = menupres[exittype].exittag;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (activetype && (entertype < 0))
|
if (activetype && (entertype < 0))
|
||||||
{
|
{
|
||||||
entertype = activetype;
|
entertype = activetype;
|
||||||
enterlevel = i;
|
enterlevel = i;
|
||||||
enterwipe = menumeta[entertype].enterwipe;
|
enterwipe = menupres[entertype].enterwipe;
|
||||||
enterbubble = menumeta[entertype].enterbubble;
|
enterbubble = menupres[entertype].enterbubble;
|
||||||
entertag = menumeta[entertype].entertag;
|
entertag = menupres[entertype].entertag;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prevtype && activetype && prevtype == activetype && anceslevel < 0)
|
if (prevtype && activetype && prevtype == activetype && anceslevel < 0)
|
||||||
|
@ -2630,15 +2619,15 @@ static void M_HandleMenuMetaState(menu_t *newMenu)
|
||||||
bitmask = ((1 << MENUBITS) - 1) << (MENUBITS*i);
|
bitmask = ((1 << MENUBITS) - 1) << (MENUBITS*i);
|
||||||
prevtype = (prevMenuId & bitmask) >> (MENUBITS*i);
|
prevtype = (prevMenuId & bitmask) >> (MENUBITS*i);
|
||||||
|
|
||||||
if (menumeta[prevtype].exitwipe >= 0)
|
if (menupres[prevtype].exitwipe >= 0)
|
||||||
{
|
{
|
||||||
exitwipe = menumeta[prevtype].exitwipe;
|
exitwipe = menupres[prevtype].exitwipe;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exitwipe < 0)
|
if (exitwipe < 0)
|
||||||
exitwipe = menumeta[MN_MAIN].exitwipe;
|
exitwipe = menupres[MN_MAIN].exitwipe;
|
||||||
}
|
}
|
||||||
|
|
||||||
// do the same for enter wipe
|
// do the same for enter wipe
|
||||||
|
@ -2649,19 +2638,19 @@ static void M_HandleMenuMetaState(menu_t *newMenu)
|
||||||
bitmask = ((1 << MENUBITS) - 1) << (MENUBITS*i);
|
bitmask = ((1 << MENUBITS) - 1) << (MENUBITS*i);
|
||||||
activetype = (activeMenuId & bitmask) >> (MENUBITS*i);
|
activetype = (activeMenuId & bitmask) >> (MENUBITS*i);
|
||||||
|
|
||||||
if (menumeta[activetype].enterwipe >= 0)
|
if (menupres[activetype].enterwipe >= 0)
|
||||||
{
|
{
|
||||||
exitwipe = menumeta[activetype].enterwipe;
|
exitwipe = menupres[activetype].enterwipe;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enterwipe < 0)
|
if (enterwipe < 0)
|
||||||
enterwipe = menumeta[MN_MAIN].enterwipe;
|
enterwipe = menupres[MN_MAIN].enterwipe;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change the music
|
// Change the music
|
||||||
M_ChangeMusic("_title", false);
|
M_ChangeMenuMusic("_title", false);
|
||||||
|
|
||||||
// Run the linedef execs
|
// Run the linedef execs
|
||||||
if (titlemapinaction)
|
if (titlemapinaction)
|
||||||
|
@ -2675,8 +2664,8 @@ static void M_HandleMenuMetaState(menu_t *newMenu)
|
||||||
{
|
{
|
||||||
bitmask = ((1 << MENUBITS) - 1) << (MENUBITS*i);
|
bitmask = ((1 << MENUBITS) - 1) << (MENUBITS*i);
|
||||||
menutype = (prevMenuId & bitmask) >> (MENUBITS*i);
|
menutype = (prevMenuId & bitmask) >> (MENUBITS*i);
|
||||||
if (menumeta[menutype].exittag)
|
if (menupres[menutype].exittag)
|
||||||
P_LinedefExecute(menumeta[menutype].exittag, players[displayplayer].mo, NULL);
|
P_LinedefExecute(menupres[menutype].exittag, players[displayplayer].mo, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (exittag)
|
else if (exittag)
|
||||||
|
@ -2692,8 +2681,8 @@ static void M_HandleMenuMetaState(menu_t *newMenu)
|
||||||
{
|
{
|
||||||
bitmask = ((1 << MENUBITS) - 1) << (MENUBITS*i);
|
bitmask = ((1 << MENUBITS) - 1) << (MENUBITS*i);
|
||||||
menutype = (activeMenuId & bitmask) >> (MENUBITS*i);
|
menutype = (activeMenuId & bitmask) >> (MENUBITS*i);
|
||||||
if (menumeta[menutype].entertag)
|
if (menupres[menutype].entertag)
|
||||||
P_LinedefExecute(menumeta[menutype].entertag, players[displayplayer].mo, NULL);
|
P_LinedefExecute(menupres[menutype].entertag, players[displayplayer].mo, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (entertag)
|
else if (entertag)
|
||||||
|
@ -2728,10 +2717,10 @@ static void M_HandleMenuMetaState(menu_t *newMenu)
|
||||||
// D_Display runs the next step of processing
|
// D_Display runs the next step of processing
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
M_ApplyMenuMetaState(); // run the next step now
|
M_ApplyMenuPresState(); // run the next step now
|
||||||
}
|
}
|
||||||
|
|
||||||
void M_ApplyMenuMetaState(void)
|
void M_ApplyMenuPresState(void)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
INT32 i;
|
INT32 i;
|
||||||
|
@ -2775,7 +2764,7 @@ static void M_GoBack(INT32 choice)
|
||||||
Z_Free(levelselect.rows);
|
Z_Free(levelselect.rows);
|
||||||
levelselect.rows = NULL;
|
levelselect.rows = NULL;
|
||||||
menuactive = false;
|
menuactive = false;
|
||||||
wipetypepre = menumeta[M_GetYoungestChildMenu()].exitwipe;
|
wipetypepre = menupres[M_GetYoungestChildMenu()].exitwipe;
|
||||||
D_StartTitle();
|
D_StartTitle();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -3437,7 +3426,7 @@ void M_SetupNextMenu(menu_t *menudef)
|
||||||
return; // we can't quit this menu (also used to set parameter from the menu)
|
return; // we can't quit this menu (also used to set parameter from the menu)
|
||||||
}
|
}
|
||||||
|
|
||||||
M_HandleMenuMetaState(menudef);
|
M_HandleMenuPresState(menudef);
|
||||||
|
|
||||||
currentMenu = menudef;
|
currentMenu = menudef;
|
||||||
itemOn = currentMenu->lastOn;
|
itemOn = currentMenu->lastOn;
|
||||||
|
@ -3543,101 +3532,6 @@ void M_Init(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==========================================================================
|
|
||||||
// COMMON MENU DRAW ROUTINES
|
|
||||||
// ==========================================================================
|
|
||||||
|
|
||||||
void MN_Start(void)
|
|
||||||
{
|
|
||||||
menuanimtimer = 0;
|
|
||||||
prevMenuId = 0;
|
|
||||||
activeMenuId = MainDef.menuid;
|
|
||||||
|
|
||||||
// Set defaults for presentation values
|
|
||||||
strncpy(curbgname, "TITLESKY", 8);
|
|
||||||
curfadevalue = 16;
|
|
||||||
curhidepics = hidetitlepics;
|
|
||||||
curbgcolor = -1;
|
|
||||||
curbgxspeed = titlescrollxspeed;
|
|
||||||
curbgyspeed = titlescrollyspeed;
|
|
||||||
curbghide = false;
|
|
||||||
|
|
||||||
// Find current presentation values
|
|
||||||
M_SetCurBackground((gamestate == GS_TIMEATTACK) ? "SRB2BACK" : "TITLESKY");
|
|
||||||
M_SetCurFadeValue(16);
|
|
||||||
M_SetCurHideTitlePics();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MN_Ticker(boolean run)
|
|
||||||
{
|
|
||||||
if (run)
|
|
||||||
menuanimtimer++;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// M_SkyScroll
|
|
||||||
//
|
|
||||||
void M_SkyScroll(INT32 scrollxspeed, INT32 scrollyspeed, const char *patchname)
|
|
||||||
{
|
|
||||||
INT32 xscrolled, x, xneg = (scrollxspeed > 0) - (scrollxspeed < 0), tilex;
|
|
||||||
INT32 yscrolled, y, yneg = (scrollyspeed > 0) - (scrollyspeed < 0), tiley;
|
|
||||||
boolean xispos = (scrollxspeed >= 0), yispos = (scrollyspeed >= 0);
|
|
||||||
INT32 dupz = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy);
|
|
||||||
INT16 patwidth, patheight;
|
|
||||||
INT32 pw, ph; // scaled by dupz
|
|
||||||
patch_t *pat;
|
|
||||||
INT32 i, j;
|
|
||||||
|
|
||||||
if (rendermode == render_none)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!patchname || !patchname[0])
|
|
||||||
{
|
|
||||||
V_DrawFill(0, 0, vid.width, vid.height, 31);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!scrollxspeed && !scrollyspeed)
|
|
||||||
{
|
|
||||||
V_DrawPatchFill(W_CachePatchName(patchname, PU_CACHE));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
pat = W_CachePatchName(patchname, PU_CACHE);
|
|
||||||
|
|
||||||
patwidth = SHORT(pat->width);
|
|
||||||
patheight = SHORT(pat->height);
|
|
||||||
pw = patwidth * dupz;
|
|
||||||
ph = patheight * dupz;
|
|
||||||
|
|
||||||
tilex = max(FixedCeil(FixedDiv(vid.width, pw)) >> FRACBITS, 1)+2; // one tile on both sides of center
|
|
||||||
tiley = max(FixedCeil(FixedDiv(vid.height, ph)) >> FRACBITS, 1)+2;
|
|
||||||
|
|
||||||
xscrolltimer = ((menuanimtimer*scrollxspeed)/16 + patwidth*xneg) % (patwidth);
|
|
||||||
yscrolltimer = ((menuanimtimer*scrollyspeed)/16 + patheight*yneg) % (patheight);
|
|
||||||
|
|
||||||
// coordinate offsets
|
|
||||||
xscrolled = xscrolltimer * dupz;
|
|
||||||
yscrolled = yscrolltimer * dupz;
|
|
||||||
|
|
||||||
for (x = (xispos) ? -pw*(tilex-1)+pw : 0, i = 0;
|
|
||||||
i < tilex;
|
|
||||||
x += pw, i++)
|
|
||||||
{
|
|
||||||
for (y = (yispos) ? -ph*(tiley-1)+ph : 0, j = 0;
|
|
||||||
j < tiley;
|
|
||||||
y += ph, j++)
|
|
||||||
{
|
|
||||||
V_DrawScaledPatch(
|
|
||||||
(xispos) ? xscrolled - x : x + xscrolled,
|
|
||||||
(yispos) ? yscrolled - y : y + yscrolled,
|
|
||||||
V_NOSCALESTART, pat);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
W_UnlockCachedPatch(pat);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
// SPECIAL MENU OPTION DRAW ROUTINES GO HERE
|
// SPECIAL MENU OPTION DRAW ROUTINES GO HERE
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
@ -5180,7 +5074,7 @@ static void M_DrawLevelPlatterMenu(void)
|
||||||
if (curbgcolor >= 0)
|
if (curbgcolor >= 0)
|
||||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, curbgcolor);
|
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, curbgcolor);
|
||||||
else if (!curbghide || !titlemapinaction)
|
else if (!curbghide || !titlemapinaction)
|
||||||
M_SkyScroll(curbgxspeed, curbgyspeed, curbgname);
|
F_SkyScroll(curbgxspeed, curbgyspeed, curbgname);
|
||||||
if (curfadevalue)
|
if (curfadevalue)
|
||||||
V_DrawFadeScreen(0xFF00, curfadevalue);
|
V_DrawFadeScreen(0xFF00, curfadevalue);
|
||||||
}
|
}
|
||||||
|
@ -5389,7 +5283,7 @@ static void M_DrawMessageMenu(void)
|
||||||
if (curbgcolor >= 0)
|
if (curbgcolor >= 0)
|
||||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, curbgcolor);
|
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, curbgcolor);
|
||||||
else if (!curbghide || !titlemapinaction)
|
else if (!curbghide || !titlemapinaction)
|
||||||
M_SkyScroll(curbgxspeed, curbgyspeed, curbgname);
|
F_SkyScroll(curbgxspeed, curbgyspeed, curbgname);
|
||||||
if (curfadevalue)
|
if (curfadevalue)
|
||||||
V_DrawFadeScreen(0xFF00, curfadevalue);
|
V_DrawFadeScreen(0xFF00, curfadevalue);
|
||||||
}
|
}
|
||||||
|
@ -7687,7 +7581,7 @@ static void M_SetupChoosePlayer(INT32 choice)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Playing() == false)
|
if (Playing() == false)
|
||||||
M_ChangeMusic("_chsel", true);
|
M_ChangeMenuMusic("_chsel", true);
|
||||||
|
|
||||||
SP_PlayerDef.prevMenu = currentMenu;
|
SP_PlayerDef.prevMenu = currentMenu;
|
||||||
M_SetupNextMenu(&SP_PlayerDef);
|
M_SetupNextMenu(&SP_PlayerDef);
|
||||||
|
@ -7784,7 +7678,7 @@ static void M_DrawSetupChoosePlayerMenu(void)
|
||||||
if (curbgcolor >= 0)
|
if (curbgcolor >= 0)
|
||||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, curbgcolor);
|
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, curbgcolor);
|
||||||
else if (!curbghide || !titlemapinaction)
|
else if (!curbghide || !titlemapinaction)
|
||||||
M_SkyScroll(curbgxspeed, curbgyspeed, curbgname);
|
F_SkyScroll(curbgxspeed, curbgyspeed, curbgname);
|
||||||
if (curfadevalue)
|
if (curfadevalue)
|
||||||
V_DrawFadeScreen(0xFF00, curfadevalue);
|
V_DrawFadeScreen(0xFF00, curfadevalue);
|
||||||
|
|
||||||
|
@ -8174,12 +8068,12 @@ void M_DrawTimeAttackMenu(void)
|
||||||
UINT16 dispstatus;
|
UINT16 dispstatus;
|
||||||
patch_t *PictureOfUrFace;
|
patch_t *PictureOfUrFace;
|
||||||
|
|
||||||
M_ChangeMusic("_inter", true); // Eww, but needed for when user hits escape during demo playback
|
M_ChangeMenuMusic("_inter", true); // Eww, but needed for when user hits escape during demo playback
|
||||||
|
|
||||||
if (curbgcolor >= 0)
|
if (curbgcolor >= 0)
|
||||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, curbgcolor);
|
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, curbgcolor);
|
||||||
else if (!curbghide || !titlemapinaction)
|
else if (!curbghide || !titlemapinaction)
|
||||||
M_SkyScroll(curbgxspeed, curbgyspeed, curbgname);
|
F_SkyScroll(curbgxspeed, curbgyspeed, curbgname);
|
||||||
if (curfadevalue)
|
if (curfadevalue)
|
||||||
V_DrawFadeScreen(0xFF00, curfadevalue);
|
V_DrawFadeScreen(0xFF00, curfadevalue);
|
||||||
|
|
||||||
|
@ -8366,12 +8260,12 @@ void M_DrawNightsAttackMenu(void)
|
||||||
INT32 i, x, y, cursory = 0;
|
INT32 i, x, y, cursory = 0;
|
||||||
UINT16 dispstatus;
|
UINT16 dispstatus;
|
||||||
|
|
||||||
M_ChangeMusic("_inter", true); // Eww, but needed for when user hits escape during demo playback
|
M_ChangeMenuMusic("_inter", true); // Eww, but needed for when user hits escape during demo playback
|
||||||
|
|
||||||
if (curbgcolor >= 0)
|
if (curbgcolor >= 0)
|
||||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, curbgcolor);
|
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, curbgcolor);
|
||||||
else if (!curbghide || !titlemapinaction)
|
else if (!curbghide || !titlemapinaction)
|
||||||
M_SkyScroll(curbgxspeed, curbgyspeed, curbgname);
|
F_SkyScroll(curbgxspeed, curbgyspeed, curbgname);
|
||||||
if (curfadevalue)
|
if (curfadevalue)
|
||||||
V_DrawFadeScreen(0xFF00, curfadevalue);
|
V_DrawFadeScreen(0xFF00, curfadevalue);
|
||||||
|
|
||||||
|
@ -8761,17 +8655,17 @@ static void M_ModeAttackEndGame(INT32 choice)
|
||||||
default:
|
default:
|
||||||
case ATTACKING_RECORD:
|
case ATTACKING_RECORD:
|
||||||
currentMenu = &SP_TimeAttackDef;
|
currentMenu = &SP_TimeAttackDef;
|
||||||
wipetypepost = menumeta[MN_SP_TIMEATTACK].enterwipe;
|
wipetypepost = menupres[MN_SP_TIMEATTACK].enterwipe;
|
||||||
break;
|
break;
|
||||||
case ATTACKING_NIGHTS:
|
case ATTACKING_NIGHTS:
|
||||||
currentMenu = &SP_NightsAttackDef;
|
currentMenu = &SP_NightsAttackDef;
|
||||||
wipetypepost = menumeta[MN_SP_NIGHTSATTACK].enterwipe;
|
wipetypepost = menupres[MN_SP_NIGHTSATTACK].enterwipe;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
itemOn = currentMenu->lastOn;
|
itemOn = currentMenu->lastOn;
|
||||||
G_SetGamestate(GS_TIMEATTACK);
|
G_SetGamestate(GS_TIMEATTACK);
|
||||||
modeattacking = ATTACKING_NONE;
|
modeattacking = ATTACKING_NONE;
|
||||||
M_ChangeMusic("_title", true);
|
M_ChangeMenuMusic("_title", true);
|
||||||
Nextmap_OnChange();
|
Nextmap_OnChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
27
src/m_menu.h
27
src/m_menu.h
|
@ -121,7 +121,6 @@ typedef enum
|
||||||
NUMMENUTYPES,
|
NUMMENUTYPES,
|
||||||
} menutype_t; // up to 63; MN_SPECIAL = 53
|
} menutype_t; // up to 63; MN_SPECIAL = 53
|
||||||
|
|
||||||
// Menu parameters
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
char bgname[8]; // name for background gfx lump; lays over titlemap if this is set
|
char bgname[8]; // name for background gfx lump; lays over titlemap if this is set
|
||||||
|
@ -144,25 +143,19 @@ typedef struct
|
||||||
INT32 exittag; // line exec to run on menu exit, if titlemap
|
INT32 exittag; // line exec to run on menu exit, if titlemap
|
||||||
INT16 enterwipe; // wipe type to run on menu enter, -1 means default
|
INT16 enterwipe; // wipe type to run on menu enter, -1 means default
|
||||||
INT16 exitwipe; // wipe type to run on menu exit, -1 means default
|
INT16 exitwipe; // wipe type to run on menu exit, -1 means default
|
||||||
} menumeta_t;
|
} menupres_t;
|
||||||
|
|
||||||
extern menumeta_t menumeta[NUMMENUTYPES];
|
extern menupres_t menupres[NUMMENUTYPES];
|
||||||
extern char curbgname[8];
|
extern UINT32 prevMenuId;
|
||||||
extern SINT8 curfadevalue;
|
extern UINT32 activeMenuId;
|
||||||
extern boolean curhidepics;
|
|
||||||
extern INT32 curbgcolor;
|
|
||||||
extern INT32 curbgxspeed;
|
|
||||||
extern INT32 curbgyspeed;
|
|
||||||
extern boolean curbghide;
|
|
||||||
|
|
||||||
#define TITLEBACKGROUNDACTIVE (curfadevalue >= 0 || curbgname[0])
|
void M_InitMenuPresTables(void);
|
||||||
|
void M_ApplyMenuPresState(void);
|
||||||
void M_SkyScroll(INT32 scrollxspeed, INT32 scrollyspeed, const char *patchname);
|
|
||||||
void MN_Ticker(boolean run);
|
|
||||||
void MN_Start(void);
|
|
||||||
void MN_InitInfoTables(void);
|
|
||||||
void M_ApplyMenuMetaState(void);
|
|
||||||
UINT8 M_GetYoungestChildMenu(void);
|
UINT8 M_GetYoungestChildMenu(void);
|
||||||
|
void M_ChangeMenuMusic(const char *defaultmusname, boolean defaultmuslooping);
|
||||||
|
void M_SetMenuCurBackground(const char *defaultname);
|
||||||
|
void M_SetMenuCurFadeValue(UINT8 defaultvalue);
|
||||||
|
void M_SetMenuCurHideTitlePics(void);
|
||||||
|
|
||||||
// Called by main loop,
|
// Called by main loop,
|
||||||
// saves config file and calls I_Quit when user exits.
|
// saves config file and calls I_Quit when user exits.
|
||||||
|
|
Loading…
Reference in a new issue