From 5d76cbcbdb4a1cf34f53b8ce29ad41db739898f9 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 4 Oct 2020 20:53:37 +0200 Subject: [PATCH] - game compiles and starts again (without menu, of course) Now it's time to rebuild the menu. --- .../common/scripting/interface/vmnatives.cpp | 1 + source/core/menu/menu.cpp | 1 + source/core/menu/playermenu.cpp | 6 ++-- wadsrc/static/zscript/base.zs | 31 +++++++++++++++++++ wadsrc/static/zscript/ui/menu/loadsavemenu.zs | 13 ++++++-- wadsrc/static/zscript/ui/menu/menu.zs | 2 +- wadsrc/static/zscript/ui/menu/optionmenu.zs | 26 ---------------- 7 files changed, 47 insertions(+), 33 deletions(-) diff --git a/source/common/scripting/interface/vmnatives.cpp b/source/common/scripting/interface/vmnatives.cpp index c4499b5a4..04a28d4df 100644 --- a/source/common/scripting/interface/vmnatives.cpp +++ b/source/common/scripting/interface/vmnatives.cpp @@ -659,3 +659,4 @@ DEFINE_FIELD_X(MusPlayingInfo, MusPlayingInfo, loop); DEFINE_GLOBAL_NAMED(PClass::AllClasses, AllClasses) DEFINE_GLOBAL(Bindings) +DEFINE_GLOBAL(AutomapBindings) diff --git a/source/core/menu/menu.cpp b/source/core/menu/menu.cpp index 242e69ace..84f296cfd 100644 --- a/source/core/menu/menu.cpp +++ b/source/core/menu/menu.cpp @@ -1011,6 +1011,7 @@ CCMD(undocolorpic) DEFINE_GLOBAL(menuactive) DEFINE_GLOBAL(BackbuttonTime) DEFINE_GLOBAL(BackbuttonAlpha) +DEFINE_GLOBAL(GameTicRate) DEFINE_FIELD(DMenu, mParentMenu) DEFINE_FIELD(DMenu, mMouseCapture); diff --git a/source/core/menu/playermenu.cpp b/source/core/menu/playermenu.cpp index b88bef988..6dcef51ff 100644 --- a/source/core/menu/playermenu.cpp +++ b/source/core/menu/playermenu.cpp @@ -73,9 +73,9 @@ DEFINE_ACTION_FUNCTION(DPlayerMenu, ColorChanged) // //============================================================================= +#if 0 DEFINE_ACTION_FUNCTION(DPlayerMenu, PlayerNameChanged) { -#if 0 PARAM_PROLOGUE; PARAM_STRING(s); const char *pp = s; @@ -95,7 +95,6 @@ DEFINE_ACTION_FUNCTION(DPlayerMenu, PlayerNameChanged) command << '"'; C_DoCommand(command); } -#endif return 0; } @@ -104,7 +103,6 @@ DEFINE_ACTION_FUNCTION(DPlayerMenu, PlayerNameChanged) // // //============================================================================= -#if 0 DEFINE_ACTION_FUNCTION(DPlayerMenu, ColorSetChanged) { PARAM_PROLOGUE; @@ -201,6 +199,7 @@ DEFINE_ACTION_FUNCTION(DPlayerMenu, TeamChanged) // //============================================================================= +#if 0 DEFINE_ACTION_FUNCTION(DPlayerMenu, GenderChanged) { PARAM_PROLOGUE; @@ -218,6 +217,7 @@ DEFINE_ACTION_FUNCTION(DPlayerMenu, GenderChanged) } return 0; } +#endif //============================================================================= // diff --git a/wadsrc/static/zscript/base.zs b/wadsrc/static/zscript/base.zs index 03f633624..be9e2325d 100644 --- a/wadsrc/static/zscript/base.zs +++ b/wadsrc/static/zscript/base.zs @@ -24,6 +24,13 @@ struct _ native // These are the global variables, the struct is only here to av native readonly int CleanWidth_1; native readonly int CleanHeight_1; native readonly @MusPlayingInfo musplaying; + native ui int BackbuttonTime; + native ui float BackbuttonAlpha; + native readonly int GameTicRate; + native readonly @FOptionMenuSettings OptionMenuSettings; + native int menuactive; + native @KeyBindings Bindings; + native @KeyBindings AutomapBindings; } @@ -86,6 +93,30 @@ struct TexMan native static bool OkForLocalization(TextureID patch, String textSubstitute); } +enum EScaleMode +{ + FSMode_None = 0, + FSMode_ScaleToFit = 1, + FSMode_ScaleToFill = 2, + FSMode_ScaleToFit43 = 3, + FSMode_ScaleToScreen = 4, + FSMode_ScaleToFit43Top = 5, + FSMode_ScaleToFit43Bottom = 6, + FSMode_ScaleToHeight = 7, + + + FSMode_Max, + + // These all use ScaleToFit43, their purpose is to cut down on verbosity because they imply the virtual screen size. + FSMode_Predefined = 1000, + FSMode_Fit320x200 = 1000, + FSMode_Fit320x240, + FSMode_Fit640x400, + FSMode_Fit640x480, + FSMode_Fit320x200Top, + FSMode_Predefined_Max, +}; + enum DrawTextureTags { TAG_USER = (1<<30), diff --git a/wadsrc/static/zscript/ui/menu/loadsavemenu.zs b/wadsrc/static/zscript/ui/menu/loadsavemenu.zs index eb9b71436..92273bfdf 100644 --- a/wadsrc/static/zscript/ui/menu/loadsavemenu.zs +++ b/wadsrc/static/zscript/ui/menu/loadsavemenu.zs @@ -167,6 +167,11 @@ class LoadSaveMenu : ListMenu // //============================================================================= + virtual void DrawFrame(int left, int top, int width, int height) + { + // Todo: Define this in subclasses + } + override void Drawer () { Super.Drawer(); @@ -177,12 +182,14 @@ class LoadSaveMenu : ListMenu bool didSeeSelected = false; // Draw picture area + /* (todo: move to subclass) if (gameaction == ga_loadgame || gameaction == ga_loadgamehidecon || gameaction == ga_savegame) { return; } + */ - Screen.DrawFrame (savepicLeft, savepicTop, savepicWidth, savepicHeight); + DrawFrame (savepicLeft, savepicTop, savepicWidth, savepicHeight); if (!manager.DrawSavePic(savepicLeft, savepicTop, savepicWidth, savepicHeight)) { screen.Clear (savepicLeft, savepicTop, savepicLeft+savepicWidth, savepicTop+savepicHeight, 0, 0); @@ -198,7 +205,7 @@ class LoadSaveMenu : ListMenu } // Draw comment area - Screen.DrawFrame (commentLeft, commentTop, commentWidth, commentHeight); + DrawFrame (commentLeft, commentTop, commentWidth, commentHeight); screen.Clear (commentLeft, commentTop, commentRight, commentBottom, 0, 0); int numlinestoprint = min(commentRows, BrokenSaveComment? BrokenSaveComment.Count() : 0); @@ -210,7 +217,7 @@ class LoadSaveMenu : ListMenu // Draw file area - Screen.DrawFrame (listboxLeft, listboxTop, listboxWidth, listboxHeight); + DrawFrame (listboxLeft, listboxTop, listboxWidth, listboxHeight); screen.Clear (listboxLeft, listboxTop, listboxRight, listboxBottom, 0, 0); if (manager.SavegameCount() == 0) diff --git a/wadsrc/static/zscript/ui/menu/menu.zs b/wadsrc/static/zscript/ui/menu/menu.zs index 1a9c681bb..a611a3296 100644 --- a/wadsrc/static/zscript/ui/menu/menu.zs +++ b/wadsrc/static/zscript/ui/menu/menu.zs @@ -191,7 +191,7 @@ class Menu : Object native ui version("2.4") } else if (ev.type == UIEvent.Type_MouseMove) { - BackbuttonTime = 4*Thinker.TICRATE; + BackbuttonTime = 4*GameTicRate; if (mMouseCapture || m_use_mouse == 1) { res = MouseEventBack(MOUSE_Move, ev.MouseX, y); diff --git a/wadsrc/static/zscript/ui/menu/optionmenu.zs b/wadsrc/static/zscript/ui/menu/optionmenu.zs index 20ae748ae..14a2f95ab 100644 --- a/wadsrc/static/zscript/ui/menu/optionmenu.zs +++ b/wadsrc/static/zscript/ui/menu/optionmenu.zs @@ -518,32 +518,6 @@ class OptionMenu : Menu } -class GameplayMenu : OptionMenu -{ - override void Drawer () - { - Super.Drawer(); - - String s = String.Format("dmflags = %d dmflags2 = %d", dmflags, dmflags2); - screen.DrawText (OptionFont(), OptionMenuSettings.mFontColorValue, - (screen.GetWidth() - OptionWidth (s) * CleanXfac_1) / 2, 35 * CleanXfac_1, s, - DTA_CleanNoMove_1, true); - } -} - -class CompatibilityMenu : OptionMenu -{ - override void Drawer () - { - Super.Drawer(); - - String s = String.Format("compatflags = %d compatflags2 = %d", compatflags, compatflags2); - screen.DrawText (OptionFont(), OptionMenuSettings.mFontColorValue, - (screen.GetWidth() - OptionWidth (s) * CleanXfac_1) / 2, 35 * CleanXfac_1, s, - DTA_CleanNoMove_1, true); - } -} - class GLTextureGLOptions : OptionMenu { private int mWarningIndex;