diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 6fc6492bb..8829b7587 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -975,6 +975,7 @@ install(TARGETS demolition COMPONENT "Game executable") source_group("Utility" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/utility/.+") +source_group("Code" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/.+") source_group("Code\\Textures" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/textures/.+") source_group("Code\\Textures\\Formats" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/textures/formats/.+") source_group("Code\\Utility" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/common/utility/.+") diff --git a/source/blood/src/blood.cpp b/source/blood/src/blood.cpp index ffc56bd24..518cd1660 100644 --- a/source/blood/src/blood.cpp +++ b/source/blood/src/blood.cpp @@ -2590,10 +2590,16 @@ extern int32_t startwin_puts(const char*); extern int32_t startwin_settitle(const char*); extern int32_t startwin_idle(void*); extern int32_t startwin_run(void); +bool validate_hud(int layout); +void set_hud_layout(int layout); +void set_hud_scale(int scale); GameInterface Interface = { faketimerhandler, app_main, + validate_hud, + set_hud_layout, + set_hud_scale, app_crashhandler, startwin_open, startwin_close, diff --git a/source/blood/src/config.cpp b/source/blood/src/config.cpp index 333da0074..3438d5504 100644 --- a/source/blood/src/config.cpp +++ b/source/blood/src/config.cpp @@ -963,6 +963,7 @@ void CONFIG_WriteSetup(uint32_t flags) OSD_Printf("Wrote %s\n",SetupFilename); CONFIG_WriteSettings(); + G_SaveConfig(); Bfflush(NULL); } diff --git a/source/blood/src/controls.cpp b/source/blood/src/controls.cpp index fda0041d3..3116e7ef2 100644 --- a/source/blood/src/controls.cpp +++ b/source/blood/src/controls.cpp @@ -147,6 +147,32 @@ void ctrlTerm(void) int32_t mouseyaxismode = -1; + + +// This is mainly here to account for the different implementation between Blood and the other games +// and to allow unified handling and the same value range in the CVAR code. +// Unlike EDuke's version, NBlood's was actually fine, it just had a too small value range to be chosen as the unified version. +bool validate_hud(int layout) +{ + return layout > 3 && layout != 8; // 8 is the status bar overlay which NBlood did not implement. +} + +void set_hud_layout(int layout) +{ + static const uint8_t screen_size_vals[] = { 7, 7, 7, 7, 6, 5, 4, 3, 3, 2, 1, 0 }; + + if (validate_hud(layout)) + { + viewResizeView(screen_size_vals[layout]); + } +} + +void set_hud_scale(int scale) +{ + // Not implemented, only needed as a placeholder. Maybe implement it after all? The hud is a bit large at its default size. +} + + void ctrlGetInput(void) { ControlInfo info; @@ -251,8 +277,8 @@ void ctrlGetInput(void) if (gViewMode == 3) { CONTROL_ClearButton(gamefunc_Shrink_Screen); - viewResizeView(gViewSize + 1); - } + G_ChangeHudLayout(-1); + } if (gViewMode == 2 || gViewMode == 4) { gZoom = ClipLow(gZoom - (gZoom >> 4), 64); @@ -265,7 +291,7 @@ void ctrlGetInput(void) if (gViewMode == 3) { CONTROL_ClearButton(gamefunc_Enlarge_Screen); - viewResizeView(gViewSize - 1); + G_ChangeHudLayout(1); } if (gViewMode == 2 || gViewMode == 4) { diff --git a/source/blood/src/menus.cpp b/source/blood/src/menus.cpp index ac1218887..a192cd509 100644 --- a/source/blood/src/menus.cpp +++ b/source/blood/src/menus.cpp @@ -3285,8 +3285,6 @@ static int32_t Menu_EntryOptionModify(MenuEntry_t *entry, int32_t newOption) break; } } - else if (entry == &ME_SCREENSETUP_SCREENSIZE) - G_SetViewportShrink((newOption - vpsize) * 4); else if (entry == &ME_SOUND) { if (newOption == 0) @@ -3451,8 +3449,6 @@ static void Menu_Custom2ColScreen(/*MenuEntry_t *entry*/) static int32_t Menu_EntryRangeInt32Modify(MenuEntry_t *entry, int32_t newValue) { - if (entry == &ME_SCREENSETUP_SCREENSIZE) - G_SetViewportShrink((newValue - vpsize) * 4); else if (entry == &ME_SCREENSETUP_SBARSIZE) G_SetStatusBarScale(newValue); else if (entry == &ME_SOUND_VOLUME_FX) diff --git a/source/build/include/baselayer.h b/source/build/include/baselayer.h index 18b9271b1..ea3e0da83 100644 --- a/source/build/include/baselayer.h +++ b/source/build/include/baselayer.h @@ -234,6 +234,9 @@ struct GameInterface { void (*faketimerhandler)(); int (*app_main)(int, char const* const*); + bool (*validate_hud)(int); + void (*set_hud_layout)(int size); + void (*set_hud_scale)(int size); // These will later be removed. void (*app_crashhandler)(); diff --git a/source/build/src/baselayer.cpp b/source/build/src/baselayer.cpp index 878bd8186..e7205ccad 100644 --- a/source/build/src/baselayer.cpp +++ b/source/build/src/baselayer.cpp @@ -354,13 +354,6 @@ int32_t baselayer_init(void) { "vid_gamma","adjusts gamma component of gamma ramp",(void *) &g_videoGamma, CVAR_FLOAT|CVAR_FUNCPTR, 0, 10 }, { "vid_contrast","adjusts contrast component of gamma ramp",(void *) &g_videoContrast, CVAR_FLOAT|CVAR_FUNCPTR, 0, 10 }, { "vid_brightness","adjusts brightness component of gamma ramp",(void *) &g_videoBrightness, CVAR_FLOAT|CVAR_FUNCPTR, 0, 10 }, -#ifdef DEBUGGINGAIDS - { "debug1","debug counter",(void *) &debug1, CVAR_FLOAT, -100000, 100000 }, - { "debug2","debug counter",(void *) &debug2, CVAR_FLOAT, -100000, 100000 }, -#endif -#ifdef DEBUG_MASK_DRAWING - { "debug_maskdrawmode", "Show mask draw orders", (void *)&g_maskDrawMode, CVAR_BOOL, 0, 1 }, -#endif }; for (auto & i : cvars_engine) @@ -371,9 +364,6 @@ int32_t baselayer_init(void) "Mode numbers are:\n" " 0 - Classic Build software\n" " 3 - Polygonal OpenGL\n" -#ifdef POLYMER - " 4 - Great justice renderer (Polymer)\n" -#endif , osdfunc_setrendermode); diff --git a/source/build/src/sdlayer.cpp b/source/build/src/sdlayer.cpp index 848736bf3..5b92b02fc 100644 --- a/source/build/src/sdlayer.cpp +++ b/source/build/src/sdlayer.cpp @@ -22,6 +22,7 @@ #include "mmulti.h" #include "scriptfile.h" #include "zstring.h" +#include "gamecvars.h" #include "../../glbackend/glbackend.h" #ifdef USE_OPENGL @@ -387,7 +388,11 @@ GameInterface *CheckFrontend() f = fopen("redneck.grp", "rb"); if (f) { - currentGame = "Redneck"; // RRRA is not separately covered + currentGame = "Redneck"; + fseek(f, 0, SEEK_END); + auto pos = ftell(f); + // Quick hack to distinguish these two. This won't survive until production but for testing it's sufficient. + if (pos > 190'000'000) currentGame = "RedneckRides"; fclose(f); return &Redneck::Interface; } @@ -403,10 +408,28 @@ GameInterface *CheckFrontend() f = fopen("fury.grp", "rb"); if (f) { - currentGame = "Fury"; + currentGame = "IonFury"; fclose(f); + return &Duke::Interface; + } + f = fopen("nam.grp", "rb"); + if (f) + { + currentGame = "Nam"; + fclose(f); + return &Duke::Interface; + } + f = fopen("ww2gi.grp", "rb"); + if (f) + { + currentGame = "WW2GI"; + fclose(f); + return &Duke::Interface; + } + else + { + currentGame = "Duke"; } - else currentGame = "Duke"; // also covers Nam and WW2GI. return &Duke::Interface; } } @@ -482,6 +505,8 @@ void ChooseGame() } } + + int WINAPI WinMain(HINSTANCE , HINSTANCE , LPSTR , int ) #else int main(int argc, char *argv[]) @@ -550,6 +575,7 @@ int main(int argc, char *argv[]) startwin_open(); + G_LoadConfig(currentGame); r = gi->app_main(buildargc, (const char **)buildargv); startwin_close(); @@ -1355,7 +1381,7 @@ void sdlayer_setvideomode_opengl(void) GLInterface.InitGLState(4, glmultisample); // I have no idea how to get this info from the lookup tables. Fortunately it is consistent per game. if (!currentGame.Compare("Blood")) GLInterface.SetShadeDiv(62); - else if (!currentGame.Compare("Fury")) GLInterface.SetShadeDiv(30); + else if (!currentGame.Compare("IonFury")) GLInterface.SetShadeDiv(30); else GLInterface.SetShadeDiv(26); GLInterface.mSamplers->SetTextureFilterMode(gltexfiltermode, glanisotropy); diff --git a/source/common/gameconfigfile.cpp b/source/common/gameconfigfile.cpp index 096acedb1..e92830fb6 100644 --- a/source/common/gameconfigfile.cpp +++ b/source/common/gameconfigfile.cpp @@ -219,11 +219,11 @@ void FGameConfigFile::DoGlobalSetup () { if (SetSection ("GlobalSettings.Unknown")) { - //ReadCVars (CVAR_GLOBALCONFIG); + ReadCVars (CVAR_GLOBALCONFIG); } if (SetSection ("GlobalSettings")) { - //ReadCVars (CVAR_GLOBALCONFIG); + ReadCVars (CVAR_GLOBALCONFIG); } if (SetSection ("LastRun")) { diff --git a/source/common/gamecvars.cpp b/source/common/gamecvars.cpp index 6c9a94c05..ea75274e8 100644 --- a/source/common/gamecvars.cpp +++ b/source/common/gamecvars.cpp @@ -1,6 +1,8 @@ #include "c_cvars.h" #include "common.h" #include "fx_man.h" +#include "baselayer.h" +#include "gameconfigfile.h" /* Notes @@ -10,6 +12,26 @@ */ +FGameConfigFile* GameConfig; +static FString GameName; + +void G_LoadConfig(const char *game) +{ + GameConfig = new FGameConfigFile(); + GameConfig->DoGlobalSetup(); + GameConfig->DoGameSetup(game); + FBaseCVar::EnableCallbacks(); + GameName = game; +} + +void G_SaveConfig() +{ + GameConfig->ArchiveGameData(GameName); + GameConfig->WriteConfigFile(); + delete GameConfig; + GameConfig = nullptr; +} + CVARD(Bool, cl_crosshair, true, CVAR_ARCHIVE, "enable/disable crosshair"); CVARD(Bool, cl_automsg, false, CVAR_ARCHIVE, "enable/disable automatically sending messages to all players") // Not implemented for Blood CVARD(Bool, cl_autorun, true, CVAR_ARCHIVE, "enable/disable autorun") @@ -119,7 +141,7 @@ CUSTOM_CVARD(Int, snd_numvoices, 64, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "the number CUSTOM_CVARD(Int, snd_speech, 5, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "enables/disables player speech") { - if (self < 8) self = 0; + if (self < 0) self = 0; else if (self > 5) self = 5; } @@ -129,6 +151,68 @@ CUSTOM_CVARD(Int, mus_volume, 255, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "controls mus if (self > 255) self = 255; } +// HUD + +// NBlood had this differently with an inverted scale of 0-7 with 0 having no HUD, For consistency all frontends now use the same scale, with 0 being the smallest and 11 being the largest. +CUSTOM_CVARD(Int, r_size, 9, CVAR_ARCHIVE | CVAR_NOINITCALL, "Defines the HUD layout") +{ + if (self < 0) self = 0; + else if (self > 11) self = 11; + else + { + if (gi->validate_hud(self)) + gi->set_hud_layout(self); + else + OSD_Printf("Hud size %d not available\n"); + } +} + +CUSTOM_CVARD(Int, hud_scale, 100, CVAR_ARCHIVE | CVAR_NOINITCALL, "changes the hud scale")//, (void*)&ud.statusbarscale, CVAR_INT | CVAR_FUNCPTR, 36, 100 }, +{ + if (self < 36) self = 36; + else if (self > 100) self = 100; + else gi->set_hud_scale(r_size); +} + +// This is to allow flattening the overly complicated HUD configuration to one single value and keep the complexity safely inside the HUD code. +bool G_ChangeHudLayout(int direction) +{ + if (direction < 0 && r_size > 0) + { + int layout = r_size - 1; + while (!gi->validate_hud(layout) && layout >= 0) layout--; + if (layout >= 0) + { + r_size = layout; + return true; + } + } + else if (r_size < 11) + { + int layout = r_size + 1; + while (!gi->validate_hud(layout) && layout <= 11) layout++; + if (layout <= 11) + { + r_size = layout; + return true; + } + } + return false; +} + +int hud_statusbarrange; // will be set by the game's configuration setup. +CUSTOM_CVARD(Int, hud_custom, 0, CVAR_ARCHIVE|CVAR_NOINITCALL, "change the custom hud")// not implemented by Blood , (void*)&ud.statusbarcustom, CVAR_INT, 0, ud.statusbarrange }, +{ + if (self < 0) self = 0; + else if (self >= hud_statusbarrange) self = hud_statusbarrange - 1; +} + +//{ "hud_stats", "enable/disable level statistics display", (void*)&ud.levelstats, CVAR_BOOL, 0, 1 }, +//{ "hud_stats", "enable/disable level statistics display", (void*)&gLevelStats, CVAR_BOOL, 0, 1 }, + +//{ "hud_showmapname", "enable/disable map name display on load", (void*)&hud_showmapname, CVAR_BOOL, 0, 1 }, +//{ "hud_showmaptitle", "enable/disable displaying the map title at the beginning of the maps", (void*)&gShowMapTitle, CVAR_BOOL, 0, 1 }, + #if 0 @@ -138,26 +222,6 @@ CUSTOM_CVARD(Int, mus_volume, 255, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "controls mus { "color", "changes player palette", (void *)&ud.color, CVAR_INT|CVAR_MULTI, 0, MAXPALOOKUPS-1 }, - - { "fov", "change the field of view", (void *)&ud.fov, CVAR_INT, 60, 140 }, - - { "hud_althud", "enable/disable alternate mini-hud", (void *)&ud.althud, CVAR_BOOL, 0, 1 }, - { "hud_custom", "change the custom hud", (void *)&ud.statusbarcustom, CVAR_INT, 0, ud.statusbarrange }, - { "hud_position", "aligns the status bar to the bottom/top", (void *)&ud.hudontop, CVAR_BOOL, 0, 1 }, - { "hud_bgstretch", "enable/disable background image stretching in wide resolutions", (void *)&ud.bgstretch, CVAR_BOOL, 0, 1 }, - { "hud_messagetime", "length of time to display multiplayer chat messages", (void *)&ud.msgdisptime, CVAR_INT, 0, 3600 }, - { "hud_numbertile", "first tile in alt hud number set", (void *)&althud_numbertile, CVAR_INT, 0, MAXUSERTILES-10 }, - { "hud_numberpal", "pal for alt hud numbers", (void *)&althud_numberpal, CVAR_INT, 0, MAXPALOOKUPS-1 }, - { "hud_shadows", "enable/disable althud shadows", (void *)&althud_shadows, CVAR_BOOL, 0, 1 }, - { "hud_flashing", "enable/disable althud flashing", (void *)&althud_flashing, CVAR_BOOL, 0, 1 }, - { "hud_glowingquotes", "enable/disable \"glowing\" quote text", (void *)&hud_glowingquotes, CVAR_BOOL, 0, 1 }, - { "hud_scale","changes the hud scale", (void *)&ud.statusbarscale, CVAR_INT|CVAR_FUNCPTR, 50, 100 }, - { "hud_showmapname", "enable/disable map name display on load", (void *)&hud_showmapname, CVAR_BOOL, 0, 1 }, - { "hud_stats", "enable/disable level statistics display", (void *)&ud.levelstats, CVAR_BOOL, 0, 1 }, - { "hud_textscale", "sets multiplayer chat message size", (void *)&ud.textscale, CVAR_INT, 100, 400 }, - { "hud_weaponscale","changes the weapon scale", (void *)&ud.weaponscale, CVAR_INT, 10, 100 }, - { "hud_statusbarmode", "change overlay mode of status bar", (void *)&ud.statusbarmode, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 }, - { "in_joystick","enables input from the joystick if it is present",(void *)&ud.setup.usejoystick, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 }, { "in_mouse","enables input from the mouse if it is present",(void *)&ud.setup.usemouse, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 }, @@ -171,7 +235,8 @@ CUSTOM_CVARD(Int, mus_volume, 255, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "controls mus { "in_mousemode", "toggles vertical mouse view", (void *)&g_myAimMode, CVAR_BOOL, 0, 1 }, { "in_mousesmoothing", "enable/disable mouse input smoothing", (void *)&ud.config.SmoothInput, CVAR_BOOL, 0, 1 }, - { "r_camrefreshdelay", "minimum delay between security camera sprite updates, 120 = 1 second", (void *)&ud.camera_time, CVAR_INT, 1, 240 }, + { "fov", "change the field of view", (void*)&ud.fov, CVAR_INT, 60, 140 }, + { "r_camrefreshdelay", "minimum delay between security camera sprite updates, 120 = 1 second", (void *)&ud.camera_time, CVAR_INT, 1, 240 }, { "r_drawweapon", "enable/disable weapon drawing", (void *)&ud.drawweapon, CVAR_INT, 0, 2 }, { "r_showfps", "show the frame rate counter", (void *)&ud.showfps, CVAR_INT, 0, 3 }, { "r_showfpsperiod", "time in seconds before averaging min and max stats for r_showfps 2+", (void *)&ud.frameperiod, CVAR_INT, 0, 5 }, @@ -217,23 +282,6 @@ CUSTOM_CVARD(Int, mus_volume, 255, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "controls mus { "fov", "change the field of view", (void *)&ud.fov, CVAR_INT|CVAR_FUNCPTR, 75, 120 }, - { "hud_althud", "enable/disable alternate mini-hud", (void *)&ud.althud, CVAR_BOOL, 0, 1 }, - { "hud_custom", "change the custom hud", (void *)&ud.statusbarcustom, CVAR_INT, 0, ud.statusbarrange }, - { "hud_position", "aligns the status bar to the bottom/top", (void *)&ud.hudontop, CVAR_BOOL, 0, 1 }, - { "hud_bgstretch", "enable/disable background image stretching in wide resolutions", (void *)&ud.bgstretch, CVAR_BOOL, 0, 1 }, - { "hud_messagetime", "length of time to display multiplayer chat messages", (void *)&ud.msgdisptime, CVAR_INT, 0, 3600 }, - { "hud_numbertile", "first tile in alt hud number set", (void *)&althud_numbertile, CVAR_INT, 0, MAXUSERTILES-10 }, - { "hud_numberpal", "pal for alt hud numbers", (void *)&althud_numberpal, CVAR_INT, 0, MAXPALOOKUPS-1 }, - { "hud_shadows", "enable/disable althud shadows", (void *)&althud_shadows, CVAR_BOOL, 0, 1 }, - { "hud_flashing", "enable/disable althud flashing", (void *)&althud_flashing, CVAR_BOOL, 0, 1 }, - { "hud_glowingquotes", "enable/disable \"glowing\" quote text", (void *)&hud_glowingquotes, CVAR_BOOL, 0, 1 }, - { "hud_scale","changes the hud scale", (void *)&ud.statusbarscale, CVAR_INT|CVAR_FUNCPTR, 36, 100 }, - { "hud_showmapname", "enable/disable map name display on load", (void *)&hud_showmapname, CVAR_BOOL, 0, 1 }, - { "hud_stats", "enable/disable level statistics display", (void *)&ud.levelstats, CVAR_BOOL, 0, 1 }, - { "hud_textscale", "sets multiplayer chat message size", (void *)&ud.textscale, CVAR_INT, 100, 400 }, - { "hud_weaponscale","changes the weapon scale", (void *)&ud.weaponscale, CVAR_INT, 10, 100 }, - { "hud_statusbarmode", "change overlay mode of status bar", (void *)&ud.statusbarmode, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 }, - { "in_joystick","enables input from the joystick if it is present",(void *)&ud.setup.usejoystick, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 }, { "in_mouse","enables input from the mouse if it is present",(void *)&ud.setup.usemouse, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 }, @@ -296,26 +344,6 @@ int32_t registerosdcommands(void) // // { "color", "changes player palette", (void *)&ud.color, CVAR_INT|CVAR_MULTI, 0, MAXPALOOKUPS-1 }, -// { "hud_althud", "enable/disable alternate mini-hud", (void *)&ud.althud, CVAR_BOOL, 0, 1 }, -// { "hud_custom", "change the custom hud", (void *)&ud.statusbarcustom, CVAR_INT, 0, ud.statusbarrange }, -// { "hud_position", "aligns the status bar to the bottom/top", (void *)&ud.hudontop, CVAR_BOOL, 0, 1 }, -// { "hud_bgstretch", "enable/disable background image stretching in wide resolutions", (void *)&ud.bgstretch, CVAR_BOOL, 0, 1 }, - { "hud_messages", "enable/disable showing messages", (void *)&gMessageState, CVAR_BOOL, 0, 1 }, -// { "hud_messagetime", "length of time to display multiplayer chat messages", (void *)&ud.msgdisptime, CVAR_INT, 0, 3600 }, -// { "hud_numbertile", "first tile in alt hud number set", (void *)&althud_numbertile, CVAR_INT, 0, MAXUSERTILES-10 }, -// { "hud_numberpal", "pal for alt hud numbers", (void *)&althud_numberpal, CVAR_INT, 0, MAXPALOOKUPS-1 }, -// { "hud_shadows", "enable/disable althud shadows", (void *)&althud_shadows, CVAR_BOOL, 0, 1 }, -// { "hud_flashing", "enable/disable althud flashing", (void *)&althud_flashing, CVAR_BOOL, 0, 1 }, -// { "hud_glowingquotes", "enable/disable \"glowing\" quote text", (void *)&hud_glowingquotes, CVAR_BOOL, 0, 1 }, -// { "hud_scale","changes the hud scale", (void *)&ud.statusbarscale, CVAR_INT|CVAR_FUNCPTR, 36, 100 }, -// { "hud_showmapname", "enable/disable map name display on load", (void *)&hud_showmapname, CVAR_BOOL, 0, 1 }, - { "hud_stats", "enable/disable level statistics display", (void *)&gLevelStats, CVAR_BOOL, 0, 1 }, - { "hud_powerupduration", "enable/disable displaying the remaining seconds for power-ups", (void *)&gPowerupDuration, CVAR_BOOL, 0, 1 }, - { "hud_showmaptitle", "enable/disable displaying the map title at the beginning of the maps", (void*)& gShowMapTitle, CVAR_BOOL, 0, 1 }, -// { "hud_textscale", "sets multiplayer chat message size", (void *)&ud.textscale, CVAR_INT, 100, 400 }, -// { "hud_weaponscale","changes the weapon scale", (void *)&ud.weaponscale, CVAR_INT, 10, 100 }, -// { "hud_statusbarmode", "change overlay mode of status bar", (void *)&ud.statusbarmode, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 }, - { "horizcenter", "enable/disable centered horizon line", (void *)&gCenterHoriz, CVAR_BOOL, 0, 1 }, { "deliriumblur", "enable/disable delirium blur effect(polymost)", (void *)&gDeliriumBlur, CVAR_BOOL, 0, 1 }, { "fov", "change the field of view", (void *)&gFov, CVAR_INT|CVAR_FUNCPTR, 75, 120 }, @@ -337,7 +365,6 @@ int32_t registerosdcommands(void) { "r_showfps", "show the frame rate counter", (void *)&gShowFps, CVAR_INT, 0, 3 }, { "r_showfpsperiod", "time in seconds before averaging min and max stats for r_showfps 2+", (void *)&gFramePeriod, CVAR_INT, 0, 5 }, // { "r_shadows", "enable/disable sprite and model shadows", (void *)&ud.shadows, CVAR_BOOL, 0, 1 }, - { "r_size", "change size of viewable area", (void *)&gViewSize, CVAR_INT|CVAR_FUNCPTR, 0, 7 }, // { "r_rotatespritenowidescreen", "pass bit 1024 to all CON rotatesprite calls", (void *)&g_rotatespriteNoWidescreen, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 }, }, { "r_precache", "enable/disable the pre-level caching routine", (void *)&useprecache, CVAR_BOOL, 0, 1 }, @@ -372,4 +399,21 @@ int32_t registerosdcommands(void) // These I don't care about. //{ "r_upscalefactor", "increase performance by rendering at upscalefactor less than the screen resolution and upscale to the full resolution in the software renderer", (void *)&ud.detail, CVAR_INT|CVAR_FUNCPTR, 1, 16 }, //{ "r_upscalefactor", "increase performance by rendering at upscalefactor less than the screen resolution and upscale to the full resolution in the software renderer", (void *)&gUpscaleFactor, CVAR_INT|CVAR_FUNCPTR, 1, 16 + +// These have to wait until the HUD code is cleaned up (no idea which may survive and which won't.) +/* + { "hud_position", "aligns the status bar to the bottom/top", (void*)&ud.hudontop, CVAR_BOOL, 0, 1 }, + { "hud_bgstretch", "enable/disable background image stretching in wide resolutions", (void*)&ud.bgstretch, CVAR_BOOL, 0, 1 }, + { "hud_messagetime", "length of time to display multiplayer chat messages", (void*)&ud.msgdisptime, CVAR_INT, 0, 3600 }, + { "hud_numbertile", "first tile in alt hud number set", (void*)&althud_numbertile, CVAR_INT, 0, MAXUSERTILES - 10 }, + { "hud_numberpal", "pal for alt hud numbers", (void*)&althud_numberpal, CVAR_INT, 0, MAXPALOOKUPS - 1 }, + { "hud_shadows", "enable/disable althud shadows", (void*)&althud_shadows, CVAR_BOOL, 0, 1 }, + { "hud_flashing", "enable/disable althud flashing", (void*)&althud_flashing, CVAR_BOOL, 0, 1 }, + { "hud_glowingquotes", "enable/disable \"glowing\" quote text", (void*)&hud_glowingquotes, CVAR_BOOL, 0, 1 }, + { "hud_textscale", "sets multiplayer chat message size", (void*)&ud.textscale, CVAR_INT, 100, 400 }, + { "hud_weaponscale","changes the weapon scale", (void*)&ud.weaponscale, CVAR_INT, 10, 100 }, + + { "hud_messages", "enable/disable showing messages", (void*)&gMessageState, CVAR_BOOL, 0, 1 }, + { "hud_powerupduration", "enable/disable displaying the remaining seconds for power-ups", (void*)&gPowerupDuration, CVAR_BOOL, 0, 1 }, +*/ #endif diff --git a/source/common/gamecvars.h b/source/common/gamecvars.h index 416125c97..6a7adea06 100644 --- a/source/common/gamecvars.h +++ b/source/common/gamecvars.h @@ -1,3 +1,4 @@ +#pragma once; #include "c_cvars.h" EXTERN_CVAR(Bool, cl_crosshair) @@ -48,4 +49,12 @@ EXTERN_CVAR(Int, snd_numvoices) EXTERN_CVAR(Int, snd_speech) EXTERN_CVAR(Int, mus_volume) +EXTERN_CVAR(Int, hud_layout) +EXTERN_CVAR(Int, hud_scale) +EXTERN_CVAR(Int, hud_custom) + +extern int hud_statusbarrange; // will be set by the game's configuration setup. +bool G_ChangeHudLayout(int direction); bool G_CheckAutorun(bool button); +void G_LoadConfig(const char*); +void G_SaveConfig(); diff --git a/source/duke3d/src/config.cpp b/source/duke3d/src/config.cpp index 2ba9dbef3..f5b535a5a 100644 --- a/source/duke3d/src/config.cpp +++ b/source/duke3d/src/config.cpp @@ -282,7 +282,7 @@ void CONFIG_SetDefaults(void) ud.shadows = 1; ud.show_level_text = 1; ud.slidebar_paldisabled = 1; - ud.statusbarflags = STATUSBAR_NOSHRINK; + ud.statusbarflags = 0;//STATUSBAR_NOSHRINK; ud.statusbarmode = 1; ud.statusbarscale = 100; ud.team = 0; @@ -1086,7 +1086,8 @@ void CONFIG_WriteSetup(uint32_t flags) OSD_Printf("Wrote %s\n",g_setupFileName); CONFIG_WriteSettings(); - Bfflush(NULL); + G_SaveConfig(); + Bfflush(NULL); } char const * CONFIG_GetGameFuncOnKeyboard(int gameFunc) diff --git a/source/duke3d/src/game.cpp b/source/duke3d/src/game.cpp index 3d74e73f8..515c0902d 100644 --- a/source/duke3d/src/game.cpp +++ b/source/duke3d/src/game.cpp @@ -4443,46 +4443,6 @@ skip: #endif } -void G_SetViewportShrink(int32_t dir) -{ - if (dir!=0) - { - if (dir > 0) // shrinking - { - if (ud.screen_size < 4 && (!(ud.statusbarflags & STATUSBAR_NOMINI) || !(ud.statusbarflags & STATUSBAR_NOMODERN))) - ud.screen_size = 4; - else if (ud.screen_size == 4 && ud.althud == 1 && !(ud.statusbarflags & STATUSBAR_NOMINI)) - ud.althud = 0; - else if (ud.screen_size == 4 && ud.statusbarcustom < ud.statusbarrange && !(ud.statusbarflags & STATUSBAR_NOMINI)) - ud.statusbarcustom += 1; - else if (ud.screen_size < 8 && (!(ud.statusbarflags & STATUSBAR_NOFULL) || !(ud.statusbarflags & STATUSBAR_NOOVERLAY))) - ud.screen_size = 8; - else if (ud.screen_size == 8 && ud.statusbarmode == 1 && !(ud.statusbarflags & STATUSBAR_NOFULL)) - ud.statusbarmode = 0; - else if (ud.screen_size < 64 && !(ud.statusbarflags & STATUSBAR_NOSHRINK)) - ud.screen_size += dir; - } - else // enlarging - { - if (ud.screen_size > 12) - ud.screen_size += dir; - else if (ud.screen_size > 8 && (!(ud.statusbarflags & STATUSBAR_NOFULL) || !(ud.statusbarflags & STATUSBAR_NOOVERLAY))) - ud.screen_size = 8; - else if (ud.screen_size == 8 && ud.statusbarmode == 0 && !(ud.statusbarflags & STATUSBAR_NOOVERLAY)) - ud.statusbarmode = 1; - else if (ud.screen_size > 4 && (!(ud.statusbarflags & STATUSBAR_NOMINI) || !(ud.statusbarflags & STATUSBAR_NOMODERN))) - ud.screen_size = 4; - else if (ud.screen_size == 4 && ud.statusbarcustom > 0) - ud.statusbarcustom -= 1; - else if (ud.screen_size == 4 && ud.althud == 0 && !(ud.statusbarflags & STATUSBAR_NOMODERN)) - ud.althud = 1; - else if (ud.screen_size > 0 && !(ud.statusbarflags & STATUSBAR_NONONE)) - ud.screen_size = 0; - } - } - G_UpdateScreenArea(); -} - void G_InitTimer(int32_t ticspersec) { if (g_timerTicsPerSecond != ticspersec) @@ -4521,6 +4481,54 @@ void G_PrintCurrentMusic(void) P_DoQuote(QUOTE_MUSIC, g_player[myconnectindex].ps); } +// Trying to sanitize the mess of options and the mess of variables the mess was stored in. (Did I say this was a total mess before...? >) ) +// Hopefully this is more comprehensible, at least it neatly stores everything useful in a single linear value... +bool validate_hud(int layout) +{ + if (layout <= 6) // Status bar with border + { + return !(ud.statusbarflags & STATUSBAR_NOSHRINK); + } + else if (layout == 7) // Status bar fullscreen + { + return (!(ud.statusbarflags & STATUSBAR_NOFULL) || !(ud.statusbarflags & STATUSBAR_NOOVERLAY)); + } + else if (layout == 8) // Status bar overlay + { + return !(ud.statusbarflags & STATUSBAR_NOOVERLAY); + } + else if (layout == 9) // Fullscreen HUD + { + return (!(ud.statusbarflags & STATUSBAR_NOMINI) || !(ud.statusbarflags & STATUSBAR_NOMODERN)); + } + else if (layout == 10) + { + return !(ud.statusbarflags & STATUSBAR_NOMODERN); + } + else if (layout == 11) + { + return !(ud.statusbarflags & STATUSBAR_NONONE); + } + return false; +} + +void set_hud_layout(int layout) +{ + static const uint8_t screen_size_vals[] = { 60, 54, 48, 40, 32, 24, 16, 8, 8, 4, 4, 0 }; + if (validate_hud(layout)) + { + ud.screen_size = screen_size_vals[layout]; + ud.statusbarmode = layout >= 8; + ud.althud = layout >= 10; + G_UpdateScreenArea(); + } +} + +void set_hud_scale(int scale) +{ + G_UpdateScreenArea(); +} + void G_HandleLocalKeys(void) { // CONTROL_ProcessBinds(); @@ -4551,18 +4559,10 @@ void G_HandleLocalKeys(void) if (!SHIFTS_IS_PRESSED) { - // conditions copied from G_SetViewportShrink - if ((ud.screen_size > 12) || - (ud.screen_size > 8 && (!(ud.statusbarflags & STATUSBAR_NOFULL) || !(ud.statusbarflags & STATUSBAR_NOOVERLAY))) || - (ud.screen_size == 8 && ud.statusbarmode == 0 && !(ud.statusbarflags & STATUSBAR_NOOVERLAY)) || - (ud.screen_size > 4 && (!(ud.statusbarflags & STATUSBAR_NOMINI) || !(ud.statusbarflags & STATUSBAR_NOMODERN))) || - (ud.screen_size == 4 && ud.statusbarcustom > 0) || - (ud.screen_size == 4 && ud.althud == 0 && !(ud.statusbarflags & STATUSBAR_NOMODERN)) || - (ud.screen_size > 0 && !(ud.statusbarflags & STATUSBAR_NONONE))) - { - S_PlaySound(THUD); - G_SetViewportShrink(-4); - } + if (G_ChangeHudLayout(1)) + { + S_PlaySound(THUD); + } } else { @@ -4578,17 +4578,10 @@ void G_HandleLocalKeys(void) if (!SHIFTS_IS_PRESSED) { - // conditions copied from G_SetViewportShrink - if ((ud.screen_size < 4 && (!(ud.statusbarflags & STATUSBAR_NOMINI) || !(ud.statusbarflags & STATUSBAR_NOMODERN))) || - (ud.screen_size == 4 && ud.althud == 1 && !(ud.statusbarflags & STATUSBAR_NOMINI)) || - (ud.screen_size == 4 && ud.statusbarcustom < ud.statusbarrange && !(ud.statusbarflags & STATUSBAR_NOMINI)) || - (ud.screen_size < 8 && (!(ud.statusbarflags & STATUSBAR_NOFULL) || !(ud.statusbarflags & STATUSBAR_NOOVERLAY))) || - (ud.screen_size == 8 && ud.statusbarmode == 1 && !(ud.statusbarflags & STATUSBAR_NOFULL)) || - (ud.screen_size < 64 && !(ud.statusbarflags & STATUSBAR_NOSHRINK))) - { - S_PlaySound(THUD); - G_SetViewportShrink(+4); - } + if (G_ChangeHudLayout(-1)) + { + S_PlaySound(THUD); + } } else { @@ -7306,6 +7299,9 @@ extern int32_t startwin_run(void); GameInterface Interface = { faketimerhandler, app_main, + validate_hud, + set_hud_layout, + set_hud_scale, app_crashhandler, startwin_open, startwin_close, diff --git a/source/duke3d/src/gamestructures.cpp b/source/duke3d/src/gamestructures.cpp index 84bc11b0f..d29e5e005 100644 --- a/source/duke3d/src/gamestructures.cpp +++ b/source/duke3d/src/gamestructures.cpp @@ -1504,7 +1504,7 @@ int32_t __fastcall VM_GetUserdef(int32_t labelNum, int const lParm2) case USERDEFS_SCREENAREA_Y2: labelNum = ud.returnvar[2]; break; case USERDEFS_SCREENFADE: labelNum = ud.screenfade; break; case USERDEFS_MENUBACKGROUND: labelNum = ud.menubackground; break; - case USERDEFS_STATUSBARFLAGS: labelNum = ud.statusbarflags; break; + case USERDEFS_STATUSBARFLAGS: labelNum = 0/*ud.statusbarflags*/; break; case USERDEFS_STATUSBARRANGE: labelNum = ud.statusbarrange; break; case USERDEFS_STATUSBARCUSTOM: labelNum = ud.statusbarcustom; break; case USERDEFS_HUDONTOP: labelNum = ud.hudontop; break; @@ -1697,7 +1697,7 @@ void __fastcall VM_SetUserdef(int const labelNum, int const lParm2, int32_t cons case USERDEFS_SCREENAREA_Y2: ud.returnvar[2] = iSet; break; case USERDEFS_SCREENFADE: ud.screenfade = iSet; break; case USERDEFS_MENUBACKGROUND: ud.menubackground = iSet; break; - case USERDEFS_STATUSBARFLAGS: ud.statusbarflags = iSet; break; + case USERDEFS_STATUSBARFLAGS: ud.statusbarflags = iSet; break; // Sigh... Ion Fury needs this. :( case USERDEFS_STATUSBARRANGE: ud.statusbarrange = iSet; break; case USERDEFS_STATUSBARCUSTOM: ud.statusbarcustom = iSet; break; case USERDEFS_HUDONTOP: ud.hudontop = iSet; break; diff --git a/source/duke3d/src/menus.cpp b/source/duke3d/src/menus.cpp index 6da097f87..b6cada58f 100644 --- a/source/duke3d/src/menus.cpp +++ b/source/duke3d/src/menus.cpp @@ -2008,7 +2008,7 @@ static void Menu_Pre(MenuID_t cm) MEO_SCREENSETUP_SCREENSIZE.steps = !(ud.statusbarflags & STATUSBAR_NONONE) + !(ud.statusbarflags & STATUSBAR_NOMODERN) + - !(ud.statusbarflags & STATUSBAR_NOMINI) * (ud.statusbarrange + 1) + + !(ud.statusbarflags & STATUSBAR_NOMINI) + !(ud.statusbarflags & STATUSBAR_NOOVERLAY) + !(ud.statusbarflags & STATUSBAR_NOFULL) + !(ud.statusbarflags & STATUSBAR_NOSHRINK) * 14; @@ -3299,8 +3299,6 @@ static int32_t Menu_EntryOptionModify(MenuEntry_t *entry, int32_t newOption) break; } } - else if (entry == &ME_SCREENSETUP_SCREENSIZE) - G_SetViewportShrink((newOption - vpsize) * 4); else if (entry == &ME_SOUND) { if (newOption == 0) @@ -3465,9 +3463,7 @@ static void Menu_Custom2ColScreen(/*MenuEntry_t *entry*/) static int32_t Menu_EntryRangeInt32Modify(MenuEntry_t *entry, int32_t newValue) { - if (entry == &ME_SCREENSETUP_SCREENSIZE) - G_SetViewportShrink((newValue - vpsize) * 4); - else if (entry == &ME_SCREENSETUP_SBARSIZE) + if (entry == &ME_SCREENSETUP_SBARSIZE) G_SetStatusBarScale(newValue); else if (entry == &ME_SOUND_VOLUME_FX) FX_SetVolume(newValue); diff --git a/source/duke3d/src/osdcmds.cpp b/source/duke3d/src/osdcmds.cpp index 29edb6c09..36cd00586 100644 --- a/source/duke3d/src/osdcmds.cpp +++ b/source/duke3d/src/osdcmds.cpp @@ -1480,9 +1480,7 @@ static int osdcmd_cvar_set_game(osdcmdptr_t parm) { videoSetPalette(ud.brightness>>2,g_player[myconnectindex].ps->palette,0); } - else if (!Bstrcasecmp(parm->name, "hud_scale") - || !Bstrcasecmp(parm->name, "hud_statusbarmode") - || !Bstrcasecmp(parm->name, "r_rotatespritenowidescreen")) + else if (!Bstrcasecmp(parm->name, "r_rotatespritenowidescreen")) { G_UpdateScreenArea(); } diff --git a/source/duke3d/src/premap.h b/source/duke3d/src/premap.h index b7f2c1dc6..a0888a05f 100644 --- a/source/duke3d/src/premap.h +++ b/source/duke3d/src/premap.h @@ -37,7 +37,6 @@ void G_NewGame(int volumeNum, int levelNum, int skillNum); void G_ResetTimers(bool saveMoveCnt); void G_SetCrosshairColor(int32_t r,int32_t g,int32_t b); void G_UpdateScreenArea(void); -void G_SetViewportShrink(int32_t dir); void P_MoveToRandomSpawnPoint(int playerNum); void P_ResetInventory(int playerNum); void P_ResetMultiPlayer(int playerNum); diff --git a/source/rr/src/config.cpp b/source/rr/src/config.cpp index 2ecdcb698..a63b4535f 100644 --- a/source/rr/src/config.cpp +++ b/source/rr/src/config.cpp @@ -925,7 +925,8 @@ void CONFIG_WriteSetup(uint32_t flags) OSD_Printf("Wrote %s\n",g_setupFileName); CONFIG_WriteSettings(); - Bfflush(NULL); + G_SaveConfig(); + Bfflush(NULL); } static const char *CONFIG_GetMapEntryName(char m[], char const * const mapname) diff --git a/source/rr/src/game.cpp b/source/rr/src/game.cpp index 24a250d02..ecfd8b838 100644 --- a/source/rr/src/game.cpp +++ b/source/rr/src/game.cpp @@ -5950,50 +5950,6 @@ rrcoolexplosion1: #endif } -void G_SetViewportShrink(int32_t dir) -{ - if (dir!=0) - { - if (dir > 0) // shrinking - { - if (ud.screen_size < 4 && (!(ud.statusbarflags & STATUSBAR_NOMINI) || !(ud.statusbarflags & STATUSBAR_NOMODERN))) - ud.screen_size = 4; - else if (ud.screen_size == 4 && ud.althud == 1 && !(ud.statusbarflags & STATUSBAR_NOMINI)) - ud.althud = 0; - else if (ud.screen_size == 4 && ud.statusbarcustom < ud.statusbarrange && !(ud.statusbarflags & STATUSBAR_NOMINI)) - ud.statusbarcustom += 1; - else if (ud.screen_size < 8 && (!(ud.statusbarflags & STATUSBAR_NOFULL) || !(ud.statusbarflags & STATUSBAR_NOOVERLAY))) - ud.screen_size = 8; - else if (ud.screen_size == 8 && ud.statusbarmode == 1 && !(ud.statusbarflags & STATUSBAR_NOFULL)) - ud.statusbarmode = 0; - else if (RR && ud.screen_size == 8) - ud.screen_size = 12; - else if (ud.screen_size < 64 && !(ud.statusbarflags & STATUSBAR_NOSHRINK)) - ud.screen_size += dir; - } - else // enlarging - { - if (ud.screen_size > (RR ? 16 : 12)) - ud.screen_size += dir; - else if (RR && ud.screen_size > 12 && (!(ud.statusbarflags & STATUSBAR_NOFULL) || !(ud.statusbarflags & STATUSBAR_NOOVERLAY))) - ud.screen_size = 12; - else if (ud.screen_size > 8 && (!(ud.statusbarflags & STATUSBAR_NOFULL) || !(ud.statusbarflags & STATUSBAR_NOOVERLAY))) - ud.screen_size = 8; - else if (ud.screen_size == 8 && ud.statusbarmode == 0 && !(ud.statusbarflags & STATUSBAR_NOOVERLAY)) - ud.statusbarmode = 1; - else if (ud.screen_size > 4 && (!(ud.statusbarflags & STATUSBAR_NOMINI) || !(ud.statusbarflags & STATUSBAR_NOMODERN))) - ud.screen_size = 4; - else if (ud.screen_size == 4 && ud.statusbarcustom > 0) - ud.statusbarcustom -= 1; - else if (ud.screen_size == 4 && ud.althud == 0 && !(ud.statusbarflags & STATUSBAR_NOMODERN)) - ud.althud = 1; - else if (ud.screen_size > 0 && !(ud.statusbarflags & STATUSBAR_NONONE)) - ud.screen_size = 0; - } - } - G_UpdateScreenArea(); -} - void G_InitTimer(int32_t ticspersec) { if (g_timerTicsPerSecond != ticspersec) @@ -6032,6 +5988,55 @@ void G_PrintCurrentMusic(void) P_DoQuote(QUOTE_MUSIC, g_player[myconnectindex].ps); } +// Trying to sanitize the mess of options and the mess of variables the mess was stored in. (Did I say this was a total mess before...? >) ) +// Hopefully this is more comprehensible, at least it neatly stores everything useful in a single linear value... +bool validate_hud(int layout) +{ + if (layout <= (RR? 5: 6)) // Status bar with border + { + return !(ud.statusbarflags & STATUSBAR_NOSHRINK); + } + else if (layout <= 7) // Status bar fullscreen + { + return (!(ud.statusbarflags & STATUSBAR_NOFULL) || !(ud.statusbarflags & STATUSBAR_NOOVERLAY)); + } + else if (layout == 8) // Status bar overlay + { + return !(ud.statusbarflags & STATUSBAR_NOOVERLAY); + } + else if (layout == 9) // Fullscreen HUD + { + return (!(ud.statusbarflags & STATUSBAR_NOMINI) || !(ud.statusbarflags & STATUSBAR_NOMODERN)); + } + else if (layout == 10) + { + return !(ud.statusbarflags & STATUSBAR_NOMODERN); + } + else if (layout == 11) + { + return !(ud.statusbarflags & STATUSBAR_NONONE); + } + return false; +} + +void set_hud_layout(int layout) +{ + static const uint8_t screen_size_vals[] = { 60, 54, 48, 40, 32, 24, 16, 8, 8, 4, 4, 0 }; + static const uint8_t screen_size_vals_rr[] = { 56, 48, 40, 32, 24, 16, 12, 8, 8, 4, 4, 0 }; + if (validate_hud(layout)) + { + ud.screen_size = RR? screen_size_vals_rr[layout] : screen_size_vals[layout]; + ud.statusbarmode = layout >= 8; + ud.althud = layout >= 10; + G_UpdateScreenArea(); + } +} + +void set_hud_scale(int scale) +{ + G_UpdateScreenArea(); +} + void G_HandleLocalKeys(void) { // CONTROL_ProcessBinds(); @@ -6061,19 +6066,10 @@ void G_HandleLocalKeys(void) if (!SHIFTS_IS_PRESSED) { - // conditions copied from G_SetViewportShrink - if ((ud.screen_size > (RR ? 16 : 12)) || - (RR && ud.screen_size > 12 && (!(ud.statusbarflags & STATUSBAR_NOFULL) || !(ud.statusbarflags & STATUSBAR_NOOVERLAY))) || - (ud.screen_size > 8 && (!(ud.statusbarflags & STATUSBAR_NOFULL) || !(ud.statusbarflags & STATUSBAR_NOOVERLAY))) || - (ud.screen_size == 8 && ud.statusbarmode == 0 && !(ud.statusbarflags & STATUSBAR_NOOVERLAY)) || - (ud.screen_size > 4 && (!(ud.statusbarflags & STATUSBAR_NOMINI) || !(ud.statusbarflags & STATUSBAR_NOMODERN))) || - (ud.screen_size == 4 && ud.statusbarcustom > 0) || - (ud.screen_size == 4 && ud.althud == 0 && !(ud.statusbarflags & STATUSBAR_NOMODERN)) || - (ud.screen_size > 0 && !(ud.statusbarflags & STATUSBAR_NONONE))) - { - S_PlaySound(RR ? 341 : THUD); - G_SetViewportShrink(-4); - } + if (G_ChangeHudLayout(-1)) + { + S_PlaySound(RR ? 341 : THUD); + } } else { @@ -6089,18 +6085,10 @@ void G_HandleLocalKeys(void) if (!SHIFTS_IS_PRESSED) { - // conditions copied from G_SetViewportShrink - if ((ud.screen_size < 4 && (!(ud.statusbarflags & STATUSBAR_NOMINI) || !(ud.statusbarflags & STATUSBAR_NOMODERN))) || - (ud.screen_size == 4 && ud.althud == 1 && !(ud.statusbarflags & STATUSBAR_NOMINI)) || - (ud.screen_size == 4 && ud.statusbarcustom < ud.statusbarrange && !(ud.statusbarflags & STATUSBAR_NOMINI)) || - (ud.screen_size < 8 && (!(ud.statusbarflags & STATUSBAR_NOFULL) || !(ud.statusbarflags & STATUSBAR_NOOVERLAY))) || - (ud.screen_size == 8 && ud.statusbarmode == 1 && !(ud.statusbarflags & STATUSBAR_NOFULL)) || - (RR && ud.screen_size == 8) || - (ud.screen_size < 64 && !(ud.statusbarflags & STATUSBAR_NOSHRINK))) - { - S_PlaySound(RR ? 341 : THUD); - G_SetViewportShrink(+4); - } + if (G_ChangeHudLayout(-1)) + { + S_PlaySound(RR ? 341 : THUD); + } } else { @@ -8756,6 +8744,9 @@ extern int32_t startwin_run(void); GameInterface Interface = { faketimerhandler, app_main, + validate_hud, + set_hud_layout, + set_hud_scale, app_crashhandler, startwin_open, startwin_close, diff --git a/source/rr/src/menus.cpp b/source/rr/src/menus.cpp index 532aa29f5..7aae8eafa 100644 --- a/source/rr/src/menus.cpp +++ b/source/rr/src/menus.cpp @@ -1988,7 +1988,7 @@ static void Menu_Pre(MenuID_t cm) MEO_SCREENSETUP_SCREENSIZE.steps = !(ud.statusbarflags & STATUSBAR_NONONE) + !(ud.statusbarflags & STATUSBAR_NOMODERN) + - !(ud.statusbarflags & STATUSBAR_NOMINI) * (ud.statusbarrange + 1) + + !(ud.statusbarflags & STATUSBAR_NOMINI) + !(ud.statusbarflags & STATUSBAR_NOOVERLAY) + !(ud.statusbarflags & STATUSBAR_NOFULL) + !(ud.statusbarflags & STATUSBAR_NOSHRINK) * 14; @@ -3863,9 +3863,7 @@ static void Menu_Custom2ColScreen(/*MenuEntry_t *entry*/) static int32_t Menu_EntryRangeInt32Modify(MenuEntry_t *entry, int32_t newValue) { - if (entry == &ME_SCREENSETUP_SCREENSIZE) - G_SetViewportShrink((newValue - vpsize) * 4); - else if (entry == &ME_SCREENSETUP_SBARSIZE) + if (entry == &ME_SCREENSETUP_SBARSIZE) G_SetStatusBarScale(newValue); else if (entry == &ME_SOUND_VOLUME_FX) FX_SetVolume(newValue); diff --git a/source/rr/src/premap.h b/source/rr/src/premap.h index d4b455e47..73854f4aa 100644 --- a/source/rr/src/premap.h +++ b/source/rr/src/premap.h @@ -39,7 +39,6 @@ void G_NewGame(int volumeNum, int levelNum, int skillNum); void G_ResetTimers(uint8_t keepgtics); void G_SetCrosshairColor(int32_t r,int32_t g,int32_t b); void G_UpdateScreenArea(void); -void G_SetViewportShrink(int32_t dir); void P_RandomSpawnPoint(int playerNum); void P_ResetInventory(int playerNum); void P_ResetPlayer(int playerNum); diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index 361fbe306..99abf70b3 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -5924,10 +5924,15 @@ extern int32_t startwin_puts(const char*); extern int32_t startwin_settitle(const char*); extern int32_t startwin_idle(void*); extern int32_t startwin_run(void); +/*extern*/ bool validate_hud(int requested_size) { return requested_size; } +/*extern*/ void set_hud(int requested_size) {} GameInterface Interface = { faketimerhandler, app_main, + validate_hud, + set_hud, + set_hud, app_crashhandler, startwin_open, startwin_close,