From 1ea6084478a2f59faed6906ec3bc7c1b71e2380a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 6 Oct 2020 22:35:25 +0200 Subject: [PATCH] - Exhumed also done. Also using proper assets now. --- source/core/menu/razemenu.cpp | 4 +- source/exhumed/src/exhumed.cpp | 13 ++++++ source/exhumed/src/namelist.h | 28 +++++++++++++ source/exhumed/src/names.h | 40 ++++++------------- wadsrc/static/zscript.txt | 2 +- .../static/zscript/games/exhumed/ui/menu.zs | 27 +++++++++++++ 6 files changed, 84 insertions(+), 30 deletions(-) create mode 100644 source/exhumed/src/namelist.h create mode 100644 wadsrc/static/zscript/games/exhumed/ui/menu.zs diff --git a/source/core/menu/razemenu.cpp b/source/core/menu/razemenu.cpp index efc284f81..e8579827d 100644 --- a/source/core/menu/razemenu.cpp +++ b/source/core/menu/razemenu.cpp @@ -1137,7 +1137,9 @@ void SetDefaultMenuColors() { OptionSettings.mFontColorHeader = CR_LIGHTBLUE; OptionSettings.mFontColorHighlight = CR_SAPPHIRE; - OptionSettings.mFontColor = CR_GOLD; + OptionSettings.mFontColorSelection = CR_ORANGE; + OptionSettings.mFontColor = CR_FIRE; + cls = PClass::FindClass("MenuCustomizerExhumed"); } else { diff --git a/source/exhumed/src/exhumed.cpp b/source/exhumed/src/exhumed.cpp index 1872f3601..a7c81e1e5 100644 --- a/source/exhumed/src/exhumed.cpp +++ b/source/exhumed/src/exhumed.cpp @@ -46,6 +46,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "cheathandler.h" #include "inputstate.h" #include "d_protocol.h" +#include "texturemanager.h" #include "razemenu.h" BEGIN_PS_NS @@ -475,6 +476,17 @@ void ExitGame() throw CExitEvent(0); } +#define x(a, b) registerName(#a, b); +static void SetTileNames() +{ + auto registerName = [](const char* name, int index) + { + TexMan.AddAlias(name, tileGetTexture(index)); + }; +#include "namelist.h" +} +#undef x + void GameInterface::app_init() { int i; @@ -509,6 +521,7 @@ void GameInterface::app_init() // temp - moving InstallEngine(); before FadeOut as we use nextpage() in FadeOut InstallEngine(); LoadDefinitions(); + SetTileNames(); TileFiles.SetBackup(); diff --git a/source/exhumed/src/namelist.h b/source/exhumed/src/namelist.h new file mode 100644 index 000000000..09d0d8dfd --- /dev/null +++ b/source/exhumed/src/namelist.h @@ -0,0 +1,28 @@ +x(PowerslaveLogo, 3442) +x(MenuNewGameTile, 3460) +x(MenuLoadGameTile, 3461) +x(MenuMusicTile, 3465) +x(MenuSoundFxTile, 3466) +x(MenuCursorTile, 3468) +x(MenuBlank, 3469) +x(SkullHead, 3582) +x(ExhumedLogo, 3592) +x(Energy1, 3604) +x(Energy2, 3605) +x(ClockSymbol1, 3606) +x(ClockSymbol2, 3607) +x(ClockSymbol3, 3608) +x(ClockSymbol4, 3609) +x(ClockSymbol5, 3610) +x(ClockSymbol6, 3611) +x(ClockSymbol7, 3612) +x(ClockSymbol8, 3613) +x(ClockSymbol9, 3614) +x(ClockSymbol10, 3615) +x(ClockSymbol11, 3616) +x(ClockSymbol12, 3617) +x(ClockSymbol13, 3618) +x(ClockSymbol14, 3619) +x(ClockSymbol15, 3620) +x(ClockSymbol16, 3621) +x(TileLoboLaptop, 3623) diff --git a/source/exhumed/src/names.h b/source/exhumed/src/names.h index a81d83371..88d208e69 100644 --- a/source/exhumed/src/names.h +++ b/source/exhumed/src/names.h @@ -3461,7 +3461,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #define kTile3439 3439 #define kTile3440 3440 #define kTile3441 3441 -#define kPowerslaveLogo 3442 #define kTile3443 3443 #define kTile3444 3444 #define kTile3445 3445 @@ -3479,16 +3478,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #define kTile3457 3457 #define kTile3458 3458 #define kTile3459 3459 -#define kMenuNewGameTile 3460 -#define kMenuLoadGameTile 3461 #define kTile3462 3462 #define kTile3463 3463 #define kTile3464 3464 -#define kMenuMusicTile 3465 -#define kMenuSoundFxTile 3466 #define kTile3467 3467 -#define kMenuCursorTile 3468 -#define kMenuBlankTitleTile 3469 #define kTile3470 3470 #define kTile3471 3471 #define kTile3472 3472 @@ -3601,7 +3594,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #define kTile3579 3579 #define kTile3580 3580 #define kTile3581 3581 -#define kSkullHead 3582 #define kTile3583 3583 #define kTile3584 3584 #define kTile3585 3585 @@ -3611,7 +3603,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #define kTile3589 3589 #define kTile3590 3590 #define kTile3591 3591 -#define kExhumedLogo 3592 #define kTile3593 3593 #define kTile3594 3594 #define kTile3595 3595 @@ -3623,26 +3614,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #define kTile3601 3601 #define kTile3602 3602 #define kTile3603 3603 -#define kEnergy1 3604 -#define kEnergy2 3605 -#define kClockSymbol1 3606 -#define kClockSymbol2 3607 -#define kClockSymbol3 3608 -#define kClockSymbol4 3609 -#define kClockSymbol5 3610 -#define kClockSymbol6 3611 -#define kClockSymbol7 3612 -#define kClockSymbol8 3613 -#define kClockSymbol9 3614 -#define kClockSymbol10 3615 -#define kClockSymbol11 3616 -#define kClockSymbol12 3617 -#define kClockSymbol13 3618 -#define kClockSymbol14 3619 -#define kClockSymbol15 3620 -#define kClockSymbol16 3621 #define kTile3622 3622 -#define kTileLoboLaptop 3623 #define kTile3624 3624 #define kTile3625 3625 #define kTile3626 3626 @@ -6164,4 +6136,16 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #define kTile6142 6142 #define kTile6143 6143 + +BEGIN_PS_NS + +#define x(a, b) k##a = b, +enum +{ +#include "namelist.h" +}; +#undef x + +END_PS_NS + #endif \ No newline at end of file diff --git a/wadsrc/static/zscript.txt b/wadsrc/static/zscript.txt index fb2255f25..9ce361f43 100644 --- a/wadsrc/static/zscript.txt +++ b/wadsrc/static/zscript.txt @@ -24,4 +24,4 @@ version "4.3" #include "zscript/games/duke/ui/menu.zs" #include "zscript/games/blood/ui/menu.zs" #include "zscript/games/sw/ui/menu.zs" - +#include "zscript/games/exhumed/ui/menu.zs" diff --git a/wadsrc/static/zscript/games/exhumed/ui/menu.zs b/wadsrc/static/zscript/games/exhumed/ui/menu.zs new file mode 100644 index 000000000..141953e77 --- /dev/null +++ b/wadsrc/static/zscript/games/exhumed/ui/menu.zs @@ -0,0 +1,27 @@ + +class MenuCustomizerExhumed : MenuCustomize +{ + 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("MENUBLANK"); + let texsize = TexMan.GetScaledSize(texid); + let fonth = font.GetGlyphHeight("A"); + if (drawit) + { + int width = font.StringWidth(title); + if (texid.isValid()) + { + double scalex = 1.; // Expand the box if the text is longer + if (texsize.X - 18 < width) scalex = width / (texsize.X - 18); + screen.DrawTexture(texid, false, 160, 20, DTA_FullscreenScale, FSMode_Fit320x200Top, DTA_CenterOffset, true, DTA_ScaleX, scalex); + } + screen.DrawText(font, Font.CR_UNTRANSLATED, 160 - width / 2, 20 - fonth / 2, title, DTA_FullscreenScale, FSMode_Fit320x200Top); + } + double fx, fy, fw, fh; + [fx, fy, fw, fh] = Screen.GetFullscreenRect(320, 200, FSMode_ScaleToFit43Top); + int h = texid.isValid()? texsize.Y : fonth; + return int((y+h) * fh / 200); // This must be the covered height of the header in true pixels. + } +} +