- preparations for the image scroller menu.

This commit is contained in:
Christoph Oelckers 2020-10-08 18:02:25 +02:00
parent 8caaf4fa64
commit 15eaf86f5a
13 changed files with 33 additions and 24 deletions

View File

@ -24,6 +24,8 @@ struct SystemCallbacks
bool (*DispatchEvent)(event_t* ev);
bool (*CheckGame)(const char* nm);
int (*GetGender)();
void (*MenuClosed)();
bool (*CheckMenudefOption)(const char* opt);
};
extern SystemCallbacks sysCallbacks;

View File

@ -460,6 +460,17 @@ void M_DoStartControlPanel (bool scaleoverride)
}
}
bool M_IsAnimated()
{
if (ConsoleState == c_down) return false;
if (!CurrentMenu) return false;
if (CurrentMenu->Animated) return true;
if (transition.previous) return true;
return false;
}
//=============================================================================
//
//
@ -855,6 +866,8 @@ void M_Drawer (void)
void M_ClearMenus()
{
if (menuactive == MENU_Off) return;
transition.previous = transition.current = nullptr;
transition.dir = 0;
@ -867,6 +880,7 @@ void M_ClearMenus()
menuactive = MENU_Off;
if (CurrentScaleOverrider) delete CurrentScaleOverrider;
CurrentScaleOverrider = nullptr;
if (sysCallbacks.MenuClosed) sysCallbacks.MenuClosed();
}
//=============================================================================
@ -980,6 +994,7 @@ DEFINE_FIELD(DMenu, mBackbuttonSelected);
DEFINE_FIELD(DMenu, DontDim);
DEFINE_FIELD(DMenu, DontBlur);
DEFINE_FIELD(DMenu, AnimatedTransition);
DEFINE_FIELD(DMenu, Animated);
DEFINE_FIELD(DMenuDescriptor, mMenuName)
DEFINE_FIELD(DMenuDescriptor, mNetgameMessage)

View File

@ -213,6 +213,7 @@ public:
bool mBackbuttonSelected;
bool DontDim;
bool DontBlur;
bool Animated;
bool AnimatedTransition;
static int InMenu;
@ -297,7 +298,7 @@ void M_MarkMenus();
FTextureID GetMenuTexture(const char* const name);
void DeinitMenus();
bool M_Active();
inline bool M_IsAnimated() { return false; }
bool M_IsAnimated();
struct IJoystickConfig;

View File

@ -220,7 +220,7 @@ static bool CheckSkipOptionBlock(FScanner &sc)
do
{
sc.MustGetString();
if (CheckSkipGameOptionBlock(sc)) filter = true;
if (sysCallbacks.CheckMenudefOption && sysCallbacks.CheckMenudefOption(sc.String)) filter = true;
else if (sc.Compare("Windows"))
{
#ifdef _WIN32

View File

@ -492,6 +492,7 @@ void CheckFrontend(int flags)
void I_StartupJoysticks();
void I_ShutdownInput();
int RunGame();
void System_MenuClosed();
int GameMain()
{
@ -516,6 +517,8 @@ int GameMain()
System_DispatchEvent,
validFilter,
StrTable_GetGender,
System_MenuClosed,
nullptr
};
try

View File

@ -174,6 +174,14 @@ void M_StartControlPanel(bool makeSound, bool)
}
void System_MenuClosed()
{
GSnd->SetSfxPaused(false, PAUSESFX_MENU);
inputState.ClearAllInput();
gi->MenuClosed();
}
//==========================================================================
//
// M_Dim

View File

@ -90,12 +90,6 @@ void GameInterface::QuitToTitle()
gameaction = ga_mainmenu;
}
void GameInterface::MenuClosed()
{
}
bool GameInterface::StartGame(FNewGameStartup& gs)
{
auto map = FindMapByLevelNum(gs.Episode);

View File

@ -239,7 +239,6 @@ struct GameInterface : ::GameInterface
bool GenerateSavePic() override;
void MenuOpened() override;
void MenuSound(EMenuSounds snd) override;
void MenuClosed() override;
bool StartGame(FNewGameStartup& gs) override;
FSavegameInfo GetSaveSig() override;
bool LoadGame() override;

View File

@ -99,10 +99,6 @@ void GameInterface::MenuSound(EMenuSounds snd)
}
}
void GameInterface::MenuClosed()
{
}
bool GameInterface::CanSave()
{
if (ud.recstat == 2 || gamestate != GS_LEVEL) return false;

View File

@ -38,7 +38,6 @@ struct GameInterface : public ::GameInterface
GameStats getStats() override;
void MenuOpened() override;
void MenuSound(EMenuSounds snd) override;
void MenuClosed() override;
bool CanSave() override;
bool StartGame(FNewGameStartup& gs) override;
FSavegameInfo GetSaveSig() override;

View File

@ -88,10 +88,6 @@ void GameInterface::QuitToTitle()
}
void GameInterface::MenuOpened()
{
}
void GameInterface::MenuSound(EMenuSounds snd)
{
switch (snd)
@ -115,10 +111,6 @@ void GameInterface::MenuSound(EMenuSounds snd)
}
}
void GameInterface::MenuClosed()
{
}
bool GameInterface::CanSave()
{
return (gamestate == GS_LEVEL && !CommEnabled && numplayers ==1 && /*!DemoMode &&*/ !TEST(Player[myconnectindex].Flags, PF_DEAD));

View File

@ -2186,9 +2186,7 @@ struct GameInterface : ::GameInterface
void FreeGameData() override;
void FreeLevelData() override;
bool GenerateSavePic() override;
void MenuOpened() override;
void MenuSound(EMenuSounds snd) override;
void MenuClosed() override;
bool CanSave() override;
bool StartGame(FNewGameStartup& gs) override;
FSavegameInfo GetSaveSig() override;

View File

@ -95,6 +95,7 @@ class Menu : Object native ui version("2.4")
native bool DontDim;
native bool DontBlur;
native bool AnimatedTransition;
native bool Animated;
native static int MenuTime();
native static Menu GetCurrentMenu();
@ -118,6 +119,7 @@ class Menu : Object native ui version("2.4")
DontDim = false;
DontBlur = false;
AnimatedTransition = false;
Animated = false;
}
//=============================================================================