From 90365ffc521d9ccf9682821a130a4aa8f16d99a8 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Sat, 3 Aug 2019 17:30:51 -0400 Subject: [PATCH] Work on menus --- src/g_game.h | 2 ++ src/m_menu.c | 82 ++++++++++++++++++++++++++++++--------------------- src/p_inter.c | 5 ++-- src/p_setup.c | 6 +++- src/p_tick.c | 4 +++ 5 files changed, 62 insertions(+), 37 deletions(-) diff --git a/src/g_game.h b/src/g_game.h index 3cbde9a3c..dd0058e70 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -31,6 +31,8 @@ extern char player_names[MAXPLAYERS][MAXPLAYERNAME+1]; extern player_t players[MAXPLAYERS]; extern boolean playeringame[MAXPLAYERS]; +extern boolean gameovermus; + // ====================================== // DEMO playback/recording related stuff. // ====================================== diff --git a/src/m_menu.c b/src/m_menu.c index 5e164ecb9..a2206771a 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2480,16 +2480,14 @@ static void M_HandleMenuPresState(menu_t *newMenu) curfadevalue = 16; curhidepics = hidetitlepics; curbgcolor = -1; - curbgxspeed = (gamestate == GS_TIMEATTACK) ? 0 : titlescrollxspeed; - curbgyspeed = (gamestate == GS_TIMEATTACK) ? 18 : titlescrollyspeed; + curbgxspeed = titlescrollxspeed; + curbgyspeed = titlescrollyspeed; curbghide = (gamestate != GS_TIMEATTACK); // show in time attack, hide in other menus // don't do the below during the in-game menus if (gamestate != GS_TITLESCREEN && gamestate != GS_TIMEATTACK) return; - // Find current presentation values - M_SetMenuCurBackground((gamestate == GS_TIMEATTACK) ? "RECATTBG" : "TITLESKY"); M_SetMenuCurFadeValue(16); M_SetMenuCurHideTitlePics(); @@ -4820,31 +4818,33 @@ static void M_HandleLevelPlatter(INT32 choice) if (!(levellistmode == LLM_CREATESERVER && !lsrow)) { ifselectvalnextmapnobrace(lscol) - lsoffs[0] = lsoffs[1] = 0; - S_StartSound(NULL,sfx_menu1); - if (gamestate == GS_TIMEATTACK) - M_SetupNextMenu(currentMenu->prevMenu); - else if (currentMenu == &MISC_ChangeLevelDef) - { - if (currentMenu->prevMenu && currentMenu->prevMenu != &MPauseDef) - M_SetupNextMenu(currentMenu->prevMenu); - else - M_ChangeLevel(0); - Z_Free(levelselect.rows); - levelselect.rows = NULL; - } - else - M_LevelSelectWarp(0); - Nextmap_OnChange(); - } - else if (!lsoffs[0]) // prevent sound spam + lsoffs[0] = lsoffs[1] = 0; + S_StartSound(NULL,sfx_menu1); + + if (gamestate == GS_TIMEATTACK) + M_SetupNextMenu(currentMenu->prevMenu); + else if (currentMenu == &MISC_ChangeLevelDef) { - lsoffs[0] = -8; - S_StartSound(NULL,sfx_s3kb2); + if (currentMenu->prevMenu && currentMenu->prevMenu != &MPauseDef) + M_SetupNextMenu(currentMenu->prevMenu); + else + M_ChangeLevel(0); + Z_Free(levelselect.rows); + levelselect.rows = NULL; } - break; + else + M_LevelSelectWarp(0); + Nextmap_OnChange(); } + } + else if (!lsoffs[0]) + { + lsoffs[0] = -8; + S_StartSound(NULL,sfx_s3kb2); + } + break; /* FALLTHRU */ + case KEY_RIGHTARROW: if (levellistmode == LLM_CREATESERVER && !lsrow) { @@ -4906,7 +4906,6 @@ static void M_HandleLevelPlatter(INT32 choice) case KEY_ESCAPE: exitmenu = true; break; - default: break; } @@ -5054,12 +5053,13 @@ static void M_DrawLevelPlatterMenu(void) INT32 y = lsbasey + lsoffs[0] - getheadingoffset(lsrow); const INT32 cursorx = (sizeselect ? 0 : (lscol*lshseperation)); - if (gamestate == GS_TIMEATTACK) + if (currentMenu->prevMenu == &SP_TimeAttackDef) { + M_SetMenuCurBackground("RECATTBG"); + curbgxspeed = 0; curbgyspeed = 18; - curbghide = false; - strncpy(curbgname, "RECATTBG", 8); + if (curbgcolor >= 0) V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, curbgcolor); else if (!curbghide || !titlemapinaction) @@ -5068,14 +5068,27 @@ static void M_DrawLevelPlatterMenu(void) V_DrawFadeScreen(0xFF00, curfadevalue); // Draw and animate foreground - if (!curbghide || !titlemapinaction) + if ((!curbghide || !titlemapinaction) && !stricmp("RECATTBG", curbgname)) { V_DrawSciencePatch(0, -(130<prevMenu == &SP_NightsAttackDef) + { + 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); + } + // finds row at top of the screen while (y > -8) { @@ -8082,11 +8095,11 @@ void M_DrawTimeAttackMenu(void) UINT16 dispstatus; patch_t *PictureOfUrFace; + M_SetMenuCurBackground("RECATTBG"); + curbgxspeed = 0; curbgyspeed = 18; - curbghide = false; - strncpy(curbgname, "RECATTBG", 8); M_ChangeMenuMusic("_inter", true); // Eww, but needed for when user hits escape during demo playback if (curbgcolor >= 0) @@ -8097,10 +8110,11 @@ void M_DrawTimeAttackMenu(void) V_DrawFadeScreen(0xFF00, curfadevalue); // Draw and animate foreground - if (!curbghide || !titlemapinaction) + if ((!curbghide || !titlemapinaction) && !stricmp("RECATTBG", curbgname)) { V_DrawSciencePatch(0, -(130<= 0) diff --git a/src/p_inter.c b/src/p_inter.c index abf33429f..e66cf4a6c 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -2445,7 +2445,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget if (target->player->lives <= 0) // Tails 03-14-2000 { - boolean gameovermus = false; + gameovermus = false; if ((netgame || multiplayer) && (gametype == GT_COOP) && (cv_cooplives.value != 1)) { INT32 i; @@ -2465,8 +2465,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget if (gameovermus) { - S_StopMusic(); // Stop the Music! Tails 03-14-2000 - S_ChangeMusicInternal("_gover", false); // Yousa dead now, Okieday? Tails 03-14-2000 + S_FadeOutStopMusic(1000); // Stop the Music! Tails 03-14-2000 } if (!(netgame || multiplayer || demoplayback || demorecording || metalrecording || modeattacking) && numgameovers < maxgameovers) diff --git a/src/p_setup.c b/src/p_setup.c index c0aa7ffa3..f47cccf25 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -81,6 +81,10 @@ #include "p_slopes.h" #endif +// Game over stuff +boolean gameovermus; +INT32 fadetogameovermus; + // // Map MD5, calculated on level load. // Sent to clients in PT_SERVERINFO. @@ -2619,7 +2623,7 @@ boolean P_SetupLevel(boolean skipprecip) boolean loadedbm = false; sector_t *ss; boolean chase; - + gameovermus = false; levelloading = true; // This is needed. Don't touch. diff --git a/src/p_tick.c b/src/p_tick.c index a0f6edef9..388245be5 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -24,6 +24,7 @@ // Object place #include "m_cheat.h" +boolean gameovermus; tic_t leveltime; @@ -724,6 +725,9 @@ void P_Ticker(boolean run) P_MapEnd(); + if ((leveltime % (TICRATE * 2) == 0) && gameovermus) + S_ChangeMusicInternal("_gover", false); // Yousa dead now, Okieday? Tails 03-14-2000 + // Z_CheckMemCleanup(); }