- changed the rules for dimming the menu to be more clear

It will no longer depend on the game state when the menu was opened but the current game state - only on the dedicated menu screen there's no dimming - everywhere else a dim gets applied.

Also renamed GS_DEMOSCREEN to GS_MENUSCREEN for clarity
This commit is contained in:
Christoph Oelckers 2020-08-11 00:46:27 +02:00
parent 000c00dc91
commit 6a10a7f266
10 changed files with 18 additions and 20 deletions

View file

@ -655,7 +655,7 @@ void ProcessFrame(void)
if (gGameOptions.nGameType == 0) if (gGameOptions.nGameType == 0)
{ {
auto completion = [] (bool) { auto completion = [] (bool) {
gamestate = GS_DEMOSCREEN; gamestate = GS_MENUSCREEN;
M_StartControlPanel(false); M_StartControlPanel(false);
M_SetMenu(NAME_CreditsMenu); M_SetMenu(NAME_CreditsMenu);
gGameOptions.uGameFlags &= ~3; gGameOptions.uGameFlags &= ~3;
@ -948,13 +948,13 @@ int GameInterface::app_main()
if (playvideo) playlogos(); if (playvideo) playlogos();
else else
{ {
gamestate = GS_DEMOSCREEN; gamestate = GS_MENUSCREEN;
M_StartControlPanel(false); M_StartControlPanel(false);
M_SetMenu(NAME_Mainmenu); M_SetMenu(NAME_Mainmenu);
} }
break; break;
case GS_DEMOSCREEN: case GS_MENUSCREEN:
case GS_FULLCONSOLE: case GS_FULLCONSOLE:
drawBackground(); drawBackground();
break; break;

View file

@ -91,7 +91,7 @@ void playlogos()
jobs[job++] = { Create<DImageScreen>(2518, DScreenJob::fadein) }; jobs[job++] = { Create<DImageScreen>(2518, DScreenJob::fadein) };
RunScreenJob(jobs, job, [](bool) { RunScreenJob(jobs, job, [](bool) {
gamestate = GS_DEMOSCREEN; gamestate = GS_MENUSCREEN;
M_StartControlPanel(false); M_StartControlPanel(false);
M_SetMenu(NAME_Mainmenu); M_SetMenu(NAME_Mainmenu);
}, true, true); }, true, true);

View file

@ -783,7 +783,7 @@ void FNotifyBuffer::AddString(int printlevel, FString source)
if (hud_messages == 0 || if (hud_messages == 0 ||
source.IsEmpty() || source.IsEmpty() ||
gamestate == GS_FULLCONSOLE || gamestate == GS_FULLCONSOLE ||
gamestate == GS_DEMOSCREEN || gamestate == GS_MENUSCREEN ||
con_notifylines == 0) con_notifylines == 0)
return; return;
@ -1074,7 +1074,7 @@ void FNotifyBuffer::Draw()
int line, lineadv, color, j; int line, lineadv, color, j;
bool canskip; bool canskip;
if (gamestate == GS_FULLCONSOLE || gamestate == GS_DEMOSCREEN) if (gamestate == GS_FULLCONSOLE || gamestate == GS_MENUSCREEN)
return; return;
FFont* font = generic_ui ? NewSmallFont : SmallFont? SmallFont : AlternativeSmallFont; FFont* font = generic_ui ? NewSmallFont : SmallFont? SmallFont : AlternativeSmallFont;
@ -1293,7 +1293,7 @@ void C_ToggleConsole ()
{ {
return; return;
} }
if (gamestate == GS_DEMOSCREEN) if (gamestate == GS_MENUSCREEN)
{ {
gamestate = GS_FULLCONSOLE; gamestate = GS_FULLCONSOLE;
C_FullConsole(); C_FullConsole();
@ -1605,7 +1605,7 @@ static bool C_HandleKey (event_t *ev, FCommandBuffer &buffer)
} }
else if (gamestate == GS_FULLCONSOLE) else if (gamestate == GS_FULLCONSOLE)
{ {
gamestate = GS_DEMOSCREEN; gamestate = GS_MENUSCREEN;
C_DoCommand ("menu_main"); C_DoCommand ("menu_main");
} }
else else

View file

@ -173,7 +173,7 @@ bool System_WantGuiCapture()
bool System_WantLeftButton() bool System_WantLeftButton()
{ {
return false;// (gamestate == GS_DEMOSCREEN || gamestate == GS_TITLELEVEL); return false;// (gamestate == GS_MENUSCREEN || gamestate == GS_TITLELEVEL);
} }
bool System_NetGame() bool System_NetGame()

View file

@ -9,11 +9,11 @@ enum gamestate_t : int
GS_INTRO, GS_INTRO,
GS_INTERMISSION, GS_INTERMISSION,
GS_FINALE, GS_FINALE,
GS_DEMOSCREEN, GS_MENUSCREEN,
GS_FULLCONSOLE, // [RH] Fullscreen console GS_FULLCONSOLE, // [RH] Fullscreen console
GS_HIDECONSOLE, // [RH] The menu just did something that should hide fs console GS_HIDECONSOLE, // [RH] The menu just did something that should hide fs console
GS_STARTUP, // [RH] Console is fullscreen, and game is just starting GS_STARTUP, // [RH] Console is fullscreen, and game is just starting
GS_TITLELEVEL, // [RH] A combination of GS_LEVEL and GS_DEMOSCREEN GS_TITLELEVEL, // [RH] A combination of GS_LEVEL and GS_MENUSCREEN
GS_FORCEWIPE = -1, GS_FORCEWIPE = -1,
GS_FORCEWIPEFADE = -2, GS_FORCEWIPEFADE = -2,

View file

@ -67,7 +67,6 @@ void RegisterJoystickMenus();
void UpdateJoystickMenu(IJoystickConfig* joy); void UpdateJoystickMenu(IJoystickConfig* joy);
bool help_disabled, credits_disabled; bool help_disabled, credits_disabled;
int g_currentMenu; // accessible by CON scripts - contains the current menu's script ID if defined or INT_MAX if none given. int g_currentMenu; // accessible by CON scripts - contains the current menu's script ID if defined or INT_MAX if none given.
int DrawBackground;
TArray<DMenu*> toDelete; TArray<DMenu*> toDelete;
// //
@ -432,7 +431,6 @@ bool M_SetMenu(FName menu, int param, FName caller)
NewGameStartupInfo.Episode = NewGameStartupInfo.Skill = 0; NewGameStartupInfo.Episode = NewGameStartupInfo.Skill = 0;
menu = NAME_Startgame; menu = NAME_Startgame;
#endif #endif
DrawBackground = gamestate == GS_DEMOSCREEN;
// some menus need some special treatment (needs to be adjusted for the various frontends. // some menus need some special treatment (needs to be adjusted for the various frontends.
switch (caller.GetIndex()) switch (caller.GetIndex())
{ {
@ -824,7 +822,7 @@ bool M_DoResponder (event_t *ev)
{ {
M_StartControlPanel(true); M_StartControlPanel(true);
M_SetMenu(gi->CanSave()? NAME_IngameMenu : NAME_Mainmenu, -1); M_SetMenu(gi->CanSave()? NAME_IngameMenu : NAME_Mainmenu, -1);
if (gamestate == GS_FULLCONSOLE) gamestate = GS_DEMOSCREEN; if (gamestate == GS_FULLCONSOLE) gamestate = GS_MENUSCREEN;
} }
return true; return true;
} }
@ -912,7 +910,7 @@ void M_Drawer (void)
if (CurrentMenu != NULL && menuactive != MENU_Off) if (CurrentMenu != NULL && menuactive != MENU_Off)
{ {
if (CurrentMenu->DimAllowed() && fade && !DrawBackground) twod->AddColorOnlyQuad(0, 0, screen->GetWidth(), screen->GetHeight(), fade); if (CurrentMenu->DimAllowed() && fade && gamestate != GS_MENUSCREEN) twod->AddColorOnlyQuad(0, 0, screen->GetWidth(), screen->GetHeight(), fade);
bool going = false; bool going = false;
if (transition.previous) if (transition.previous)

View file

@ -1088,7 +1088,7 @@ CCMD(testscreen)
auto gs = gamestate; auto gs = gamestate;
auto completion = [=](bool) auto completion = [=](bool)
{ {
if (gs == GS_LEVEL || gs == GS_DEMOSCREEN) gamestate = gs; if (gs == GS_LEVEL || gs == GS_MENUSCREEN) gamestate = gs;
else gamestate = GS_STARTUP; else gamestate = GS_STARTUP;
}; };

View file

@ -647,7 +647,7 @@ CCMD(testrscreen)
auto gs = gamestate; auto gs = gamestate;
auto completion = [=](bool) auto completion = [=](bool)
{ {
if (gs == GS_LEVEL || gs == GS_DEMOSCREEN) gamestate = gs; if (gs == GS_LEVEL || gs == GS_MENUSCREEN) gamestate = gs;
else gamestate = GS_STARTUP; else gamestate = GS_STARTUP;
}; };

View file

@ -387,7 +387,7 @@ bool GameTicker()
void startmainmenu() void startmainmenu()
{ {
gamestate = GS_DEMOSCREEN; gamestate = GS_MENUSCREEN;
M_StartControlPanel(false); M_StartControlPanel(false);
M_SetMenu(NAME_Mainmenu); M_SetMenu(NAME_Mainmenu);
FX_StopAllSounds(); FX_StopAllSounds();
@ -443,7 +443,7 @@ void app_loop()
} }
break; break;
case GS_DEMOSCREEN: case GS_MENUSCREEN:
case GS_FULLCONSOLE: case GS_FULLCONSOLE:
drawbackground(); drawbackground();
break; break;

View file

@ -81,7 +81,7 @@ enum EGameState
GS_LEVEL, GS_LEVEL,
GS_INTERMISSION, GS_INTERMISSION,
GS_FINALE, GS_FINALE,
GS_DEMOSCREEN, GS_MENUSCREEN,
GS_FULLCONSOLE, GS_FULLCONSOLE,
GS_HIDECONSOLE, GS_HIDECONSOLE,
GS_STARTUP, GS_STARTUP,