From c77a072628173e9a7c65874db065ca115d7c427e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 28 Oct 2020 23:11:45 +0100 Subject: [PATCH] - added all needed parts of Witchaven's native looking menu. This isn't particularly faithful, though, neither with DOS nor GDX because both menus have UX issues. Main menu items reflect what a modern engine needs, not what DOS had. The hi-res menu background is not being used because it forces the entire menu into the upper left corner. The original game had the difficulty only as a setting on the "gore" page and could not start the game from there. This has been changed to a more traditional skill menu. The only other part that has been ported over is the help screens. --- wadsrc/static/menudef.txt | 31 +++++-- wadsrc/static/zscript/games/wh/ui/menu_wh1.zs | 87 +++++++++++-------- 2 files changed, 76 insertions(+), 42 deletions(-) diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index ee8d927b0..097fa0f2e 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -72,9 +72,10 @@ LISTMENU "MainMenu" position 213, 60 Linespacing 18 WH1TextItem "$MNU_NEWGAME", "n", "SkillMenu" - WH1TextItem "$MNU_MULTIPLAYER", "m", "MultiMenu" + //WH1TextItem "$MNU_MULTIPLAYER", "m", "MultiMenu" WH1TextItem "$MNU_OPTIONS", "o", "OptionsMenu" WH1TextItem "$MNU_LOADGAME", "l", "LoadGameMenu" + WH1TextItem "$MNU_Help", "l", "HelpMenu" WH1TextItem "$MNU_QUITGAME", "q", "QuitMenu" } /* @@ -83,9 +84,10 @@ LISTMENU "MainMenu" position 160, 50 Linespacing 14 WH2TextItem "$MNU_NEWGAME", "n", "SkillMenu" - WH2TextItem "$MNU_MULTIPLAYER", "m", "MultiMenu" + //WH2TextItem "$MNU_MULTIPLAYER", "m", "MultiMenu" WH2TextItem "$MNU_OPTIONS", "o", "OptionsMenu" WH2TextItem "$MNU_LOADGAME", "l", "LoadGameMenu" + WH2TextItem "$MNU_Help", "l", "HelpMenu" WH2TextItem "$MNU_QUITGAME", "q", "QuitMenu" } */ @@ -237,13 +239,18 @@ LISTMENU "SkillMenu" Position 35, 32 Linespacing 17 } - /* ifgame(Witchaven) { CaptionItem "$MNU_DIFFICULTY" - Position 35, 32 - Linespacing 17 + position 130, 50 + Linespacing 16 + + WH1SkillItem "#00510", "$SKILL_EASY", "e", "StartGame 0" + WH1SkillItem "#00511", "$SKILL_NORMAL", "m", "StartGame 1" + WH1SkillItem "#00512", "$SKILL_HARD", "h", "StartGame 2" + WH1SkillItem "#00513", "$SKILL_VERY_HARD", "v", "StartGame 3" } + /* ifgame(Witchaven2) { CaptionItem "$MNU_DIFFICULTY" @@ -297,8 +304,22 @@ ImageScroller "HelpMenu" ImageItem "TileBMGLogo" ImageItem "TilePIELogo" } + ifgame(Witchaven) + { + ImageItem "#01793" //WEAPONS" + ImageItem "#01791" // SPELLS" + ImageItem "#01790" // POTIONS" + ImageItem "#01792" // WALKING" + ImageItem "#01788" // FLYING" + ImageItem "#01784" // CREDIT1" + ImageItem "#01785" // CREDIT2" + ImageItem "#01786" // CREDIT3" + ImageItem "#01787" // CREDIT4" + ImageItem "#02691" // BETAPAGE" + } } + //------------------------------------------------------------------------------------------- // // Credits menu. This is logically highly game specific. diff --git a/wadsrc/static/zscript/games/wh/ui/menu_wh1.zs b/wadsrc/static/zscript/games/wh/ui/menu_wh1.zs index a06ad17d7..31c87217c 100644 --- a/wadsrc/static/zscript/games/wh/ui/menu_wh1.zs +++ b/wadsrc/static/zscript/games/wh/ui/menu_wh1.zs @@ -3,59 +3,29 @@ class WHMenuDelegate : RazeMenuDelegate { override int DrawCaption(String title, Font fnt, int y, bool drawit) { - /* let font = generic_ui? NewConsoleFont : BigFont; // this ignores the passed font intentionally. - let texid = TexMan.CheckForTexture("MENUBAR"); - let texsize = TexMan.GetScaledSize(texid); let fonth = font.GetGlyphHeight("A"); - let fontscale = 1.; + let fontscale = 0.7; + double squash = 1.0; if (drawit) { int width = font.StringWidth(title) * fontscale; - double scalex = 1.; - if (texid.isValid()) + if (width > 315) { - if (texsize.X - 60 < width) - { - // First start squashing the font down to 0.7x the original width. - fontscale = (texsize.X - 66) / width; - if (fontscale < 0.7) - { - // If that is not enough, extend the box. - fontscale = 0.7; - width *= 0.7; - scalex = width / (texsize.X - 66); - } - else width *= fontscale; - } - screen.DrawTexture(texid, false, 160, 15, DTA_FullscreenScale, FSMode_Fit320x200Top, DTA_CenterOffsetRel, true, DTA_ScaleX, scalex); + squash = 315. / width; + width = 315; } - screen.DrawText(font, Font.CR_UNTRANSLATED, 160 - width / 2, 17 - fonth / 2, title, DTA_FullscreenScale, FSMode_Fit320x200Top, DTA_ScaleX, fontscale); + screen.DrawText(font, Font.CR_UNTRANSLATED, 160 - width / 2, 17 - fonth / 2, title, DTA_FullscreenScale, FSMode_Fit320x200Top, DTA_ScaleX, fontscale * squash, DTA_ScaleY, fontscale); } double fx, fy, fw, fh; [fx, fy, fw, fh] = Screen.GetFullscreenRect(320, 200, FSMode_ScaleToFit43Top); - int h = texid.isValid()? texsize.Y : fonth; + int h = fonth * 0.8; return int((y+h) * fh / 200); // This must be the covered height of the header in true pixels. - */ return y; } override bool DrawSelector(ListMenuDescriptor desc) { - /* - let item = desc.mItems[desc.mSelectedItem]; - let x = item.GetX(); - let y = item.GetY(); - - - let tex = TexMan.CheckForTexture("YINYANG"); - - x -= TexMan.GetSize(tex) / 4 + 2; - y += 4; - - Screen.DrawTexture(tex, true, x, y, DTA_FullscreenScale, FSMode_Fit320x200, - DTA_CenterOffset, true, DTA_Color, 0xfff0f0f0, DTA_ScaleX, 0.5, DTA_ScaleY, 0.5); - */ return true; } } @@ -139,3 +109,46 @@ class ListMenuItemWH1TextItem : ListMenuItemTextItem } } +//============================================================================= +// +// text item +// +//============================================================================= + +class ListMenuItemWH1SkillItem : ListMenuItemTextItem +{ + TextureID skull; + void Init(ListMenuDescriptor desc, String icon, String text, String hotkey, Name child, int param = 0) + { + Super.Init(desc, text, hotkey, child, param); + skull = TexMan.CheckForTexture(icon); + } + + override void Draw(bool selected, ListMenuDescriptor desc) + { + let gamefont = generic_ui ? NewSmallFont : BigFont; + int cr = generic_ui? Font.CR_Fire : Font.CR_UNDEFINED; + double scalex = 1.; + int trans = 0; + Color colr = Color(255, 255, 255, 255); + let fontscale = 0.7; + + if (gamefont == NewSmallFont) + { + if (selected) cr = Font.CR_GREEN; + } + else + { + if (selected) trans = Translation.MakeID(Translation_Remap, 20); + } + if (selected) + { + int mclock = MSTime() * 120 / 1000; + int light = 223 + (Build.calcSinTableValue(mclock<<4) / 512.); + colr = Color(255, light, light, light); + } + screen.DrawTexture(skull, false, mXpos - 15, mYpos + 10, DTA_FullscreenScale, FSMode_Fit320x200Top, DTA_CenterOffsetRel, true, DTA_ScaleX, 0.6, DTA_ScaleY, 0.6, DTA_Alpha, selected? 1.0 : 0.5); + Screen.DrawText(BigFont, cr, mXpos, mYpos, mText, DTA_FullscreenScale, FSMode_Fit320x200, DTA_Color, colr, DTA_TranslationIndex, trans, DTA_ScaleX, scalex * fontscale, DTA_ScaleY, fontscale); + } +} +