- 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 (*DispatchEvent)(event_t* ev);
bool (*CheckGame)(const char* nm); bool (*CheckGame)(const char* nm);
int (*GetGender)(); int (*GetGender)();
void (*MenuClosed)();
bool (*CheckMenudefOption)(const char* opt);
}; };
extern SystemCallbacks sysCallbacks; 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() void M_ClearMenus()
{ {
if (menuactive == MENU_Off) return;
transition.previous = transition.current = nullptr; transition.previous = transition.current = nullptr;
transition.dir = 0; transition.dir = 0;
@ -867,6 +880,7 @@ void M_ClearMenus()
menuactive = MENU_Off; menuactive = MENU_Off;
if (CurrentScaleOverrider) delete CurrentScaleOverrider; if (CurrentScaleOverrider) delete CurrentScaleOverrider;
CurrentScaleOverrider = nullptr; CurrentScaleOverrider = nullptr;
if (sysCallbacks.MenuClosed) sysCallbacks.MenuClosed();
} }
//============================================================================= //=============================================================================
@ -980,6 +994,7 @@ DEFINE_FIELD(DMenu, mBackbuttonSelected);
DEFINE_FIELD(DMenu, DontDim); DEFINE_FIELD(DMenu, DontDim);
DEFINE_FIELD(DMenu, DontBlur); DEFINE_FIELD(DMenu, DontBlur);
DEFINE_FIELD(DMenu, AnimatedTransition); DEFINE_FIELD(DMenu, AnimatedTransition);
DEFINE_FIELD(DMenu, Animated);
DEFINE_FIELD(DMenuDescriptor, mMenuName) DEFINE_FIELD(DMenuDescriptor, mMenuName)
DEFINE_FIELD(DMenuDescriptor, mNetgameMessage) DEFINE_FIELD(DMenuDescriptor, mNetgameMessage)

View file

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

View file

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

View file

@ -492,6 +492,7 @@ void CheckFrontend(int flags)
void I_StartupJoysticks(); void I_StartupJoysticks();
void I_ShutdownInput(); void I_ShutdownInput();
int RunGame(); int RunGame();
void System_MenuClosed();
int GameMain() int GameMain()
{ {
@ -516,6 +517,8 @@ int GameMain()
System_DispatchEvent, System_DispatchEvent,
validFilter, validFilter,
StrTable_GetGender, StrTable_GetGender,
System_MenuClosed,
nullptr
}; };
try 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 // M_Dim

View file

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

View file

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

View file

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

View file

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

View file

@ -88,10 +88,6 @@ void GameInterface::QuitToTitle()
} }
void GameInterface::MenuOpened()
{
}
void GameInterface::MenuSound(EMenuSounds snd) void GameInterface::MenuSound(EMenuSounds snd)
{ {
switch (snd) switch (snd)
@ -115,10 +111,6 @@ void GameInterface::MenuSound(EMenuSounds snd)
} }
} }
void GameInterface::MenuClosed()
{
}
bool GameInterface::CanSave() bool GameInterface::CanSave()
{ {
return (gamestate == GS_LEVEL && !CommEnabled && numplayers ==1 && /*!DemoMode &&*/ !TEST(Player[myconnectindex].Flags, PF_DEAD)); 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 FreeGameData() override;
void FreeLevelData() override; void FreeLevelData() override;
bool GenerateSavePic() override; bool GenerateSavePic() override;
void MenuOpened() override;
void MenuSound(EMenuSounds snd) override; void MenuSound(EMenuSounds snd) override;
void MenuClosed() override;
bool CanSave() override; bool CanSave() override;
bool StartGame(FNewGameStartup& gs) override; bool StartGame(FNewGameStartup& gs) override;
FSavegameInfo GetSaveSig() override; FSavegameInfo GetSaveSig() override;

View file

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