From a7b020d1a8435240d18f61cedce19dc1a234d9ac Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 22 Jan 2020 16:14:01 +0100 Subject: [PATCH] - implemented proper screen size scaling for Exhumed. --- source/common/gamecontrol.cpp | 6 ++++ source/exhumed/src/exhumed.cpp | 50 ++++++++++++++------------------ source/exhumed/src/exhumed.h | 2 +- wadsrc/static/engine/menudef.txt | 4 +++ 4 files changed, 33 insertions(+), 29 deletions(-) diff --git a/source/common/gamecontrol.cpp b/source/common/gamecontrol.cpp index be27b5862..d3c60453c 100644 --- a/source/common/gamecontrol.cpp +++ b/source/common/gamecontrol.cpp @@ -611,6 +611,7 @@ int RunGame() InitFileSystem(usedgroups); if (usedgroups.Size() == 0) return 0; + // Handle CVARs with game specific defaults here. if (g_gameType & GAMEFLAG_BLOOD) { mus_redbook.SetGenericRepDefault(false, CVAR_Bool); // Blood should default to CD Audio off - all other games must default to on. @@ -622,6 +623,11 @@ int RunGame() hud_size.SetGenericRepDefault(8, CVAR_Int); hud_size_max = 9; } + if (g_gameType & GAMEFLAG_PSEXHUMED) + { + hud_size.SetGenericRepDefault(7, CVAR_Int); + hud_size_max = 8; + } G_ReadConfig(currentGame); diff --git a/source/exhumed/src/exhumed.cpp b/source/exhumed/src/exhumed.cpp index dba0f4acf..15f42a3bf 100644 --- a/source/exhumed/src/exhumed.cpp +++ b/source/exhumed/src/exhumed.cpp @@ -986,44 +986,38 @@ static const char *safeStrtok(char *s, const char *d) return r ? r : ""; } + +void GameInterface::set_hud_layout(int layout) +{ + if (layout == 8) + { + if (!bFullScreen) + { + bFullScreen = true; + screensize = 0; + UnMaskStatus(); + } + } + else + { + screensize = (7 - clamp(layout, 0, 7)) * 2; + bFullScreen = false; + UpdateScreenSize(); + } +} + void CheckKeys() { if (buttonMap.ButtonDown(gamefunc_Enlarge_Screen)) { - if (screensize == 0) - { - if (!bFullScreen) - { - bFullScreen = kTrue; - UnMaskStatus(); - } - } - else - { - screensize--; - if (screensize < 0) { - screensize = 0; - } - - UpdateScreenSize(); - } buttonMap.ClearButton(gamefunc_Enlarge_Screen); + G_ChangeHudLayout(1); } if (buttonMap.ButtonDown(gamefunc_Shrink_Screen)) { - if (bFullScreen) - { - bFullScreen = kFalse; - } - else - { - if ((screensize + 1) < 15) - screensize++; - } - - UpdateScreenSize(); buttonMap.ClearButton(gamefunc_Shrink_Screen); + G_ChangeHudLayout(-1); } // go to 3rd person view? diff --git a/source/exhumed/src/exhumed.h b/source/exhumed/src/exhumed.h index 08863fb25..0577fecff 100644 --- a/source/exhumed/src/exhumed.h +++ b/source/exhumed/src/exhumed.h @@ -277,7 +277,7 @@ struct GameInterface : ::GameInterface void UpdateScreenSize() override; bool GenerateSavePic() override; bool validate_hud(int) override { return true; } - void set_hud_layout(int size) override {} + void set_hud_layout(int size) override; void set_hud_scale(int size) override {} void DrawNativeMenuText(int fontnum, int state, double xpos, double ypos, float fontscale, const char* text, int flags) override; void MenuOpened() override; diff --git a/wadsrc/static/engine/menudef.txt b/wadsrc/static/engine/menudef.txt index 2b4ae4001..87a8aa32e 100644 --- a/wadsrc/static/engine/menudef.txt +++ b/wadsrc/static/engine/menudef.txt @@ -1210,6 +1210,10 @@ OptionMenu "HUDOptions" //protected { Slider "$DSPLYMNU_SCREENSIZE", "hud_size", 0.0, 9.0, 1.0, -1 } + ifgame(exhumed) + { + Slider "$DSPLYMNU_SCREENSIZE", "hud_size", 0.0, 8.0, 1.0, -1 + } Option "$DSPLYMNU_LEVELSTATS", "hud_stats", "OnOff" ifgame(duke, nam, ww2gi, redneck, redneckrides, fury)