diff --git a/source/core/gamecvars.cpp b/source/core/gamecvars.cpp index 75c5baba0..2f1e9d084 100644 --- a/source/core/gamecvars.cpp +++ b/source/core/gamecvars.cpp @@ -170,10 +170,10 @@ CUSTOM_CVARD(Int, hud_size, Hud_Stbar, CVAR_ARCHIVE | CVAR_NOINITCALL, "Defines else setViewport(self); } -CUSTOM_CVARD(Int, hud_scale, 100, CVAR_ARCHIVE | CVAR_NOINITCALL, "changes the hud scale") +CUSTOM_CVARD(Float, hud_scale, 1, CVAR_ARCHIVE, "changes the hud scale") { - if (self < 36) self = 36; - else if (self > 100) self = 100; + if (self < 0.36f) self = 0.36f; + else if (self > 1) self = 1; else setViewport(hud_size); } @@ -190,7 +190,7 @@ CCMD(sizeup) } else { - hud_scale = hud_scale + 4; + hud_scale = hud_scale + 0.04; } } @@ -206,7 +206,7 @@ CCMD(sizedown) } else { - hud_scale = hud_scale - 4; + hud_scale = hud_scale - 0.04; } } diff --git a/source/core/gamecvars.h b/source/core/gamecvars.h index 3f870a3dd..21e4e6fa4 100644 --- a/source/core/gamecvars.h +++ b/source/core/gamecvars.h @@ -50,7 +50,7 @@ EXTERN_CVAR(Int, snd_speech) EXTERN_CVAR(Int, mus_device) EXTERN_CVAR(Int, hud_layout) -EXTERN_CVAR(Int, hud_scale) +EXTERN_CVAR(Float, hud_scale) EXTERN_CVAR(Int, hud_size) EXTERN_CVAR(Float, hud_statscale) diff --git a/source/core/statusbar.cpp b/source/core/statusbar.cpp index 7f27f8787..27c1a88c2 100644 --- a/source/core/statusbar.cpp +++ b/source/core/statusbar.cpp @@ -200,8 +200,8 @@ void DBaseStatusBar::SetScale () refh = h; refw = h * refaspect; } - refw *= (hud_scale / 100.); - refh *= (hud_scale / 100.); + refw *= hud_scale; + refh *= hud_scale; int sby = VerticalResolution - RelTop; // Use full pixels for destination size. @@ -757,8 +757,8 @@ void setViewport(int viewSize) int ydim = screen->GetHeight(); if (xdim == 0 || ydim == 0) return; auto reserved = gi->GetReservedScreenSpace(viewSize); - reserved.top = (reserved.top * hud_scale * ydim) / 20000; - reserved.statusbar = (reserved.statusbar * hud_scale * ydim) / 20000; + reserved.top = xs_CRoundToInt((reserved.top * hud_scale * ydim) / 200); + reserved.statusbar = xs_CRoundToInt((reserved.statusbar * hud_scale * ydim) / 200); int xdimcorrect = std::min(Scale(ydim, 4, 3), xdim); if (viewSize > Hud_Stbar) diff --git a/source/games/duke/src/sbar.cpp b/source/games/duke/src/sbar.cpp index 9b5f6bcc0..88a7836b2 100644 --- a/source/games/duke/src/sbar.cpp +++ b/source/games/duke/src/sbar.cpp @@ -194,7 +194,7 @@ void DDukeCommonStatusBar::PrintLevelStats(int bottomy) font = isNamWW2GI() ? ConFont : SmallFont; if (isNamWW2GI()) color = CR_ORANGE; } - int top = am_nameontop ? 0 : ( 200 - Scale(bottomy < 0 ? RelTop : bottomy, hud_scale, 100) - (isRR()? 25 : 20)); + double top = am_nameontop ? 0 : ( 200 - (bottomy < 0 ? RelTop : bottomy) * hud_scale - (isRR()? 25 : 20)); if (!(currentLevel->flags & MI_USERMAP)) DrawText(twod, font, color, 5, top + 6, GStrings.localize(gVolumeNames[volfromlevelnum(currentLevel->levelNumber)]), DTA_FullscreenScale, FSMode_Fit320x200, DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_KeepRatio, true, TAG_DONE); diff --git a/source/sw/src/sbar.cpp b/source/sw/src/sbar.cpp index e97a8b04b..f6961879d 100644 --- a/source/sw/src/sbar.cpp +++ b/source/sw/src/sbar.cpp @@ -961,29 +961,29 @@ public: if (hud_size == Hud_Nothing) { align = DI_SCREEN_RIGHT_BOTTOM; - inv_x = -210 * hud_scale / 100.; - inv_y = -28 * hud_scale / 100.; + inv_x = -210 * hud_scale; + inv_y = -28 * hud_scale; PrintLevelStats(2); } else if (hud_size == Hud_full) { align = DI_SCREEN_CENTER_TOP; - inv_x = -80 * hud_scale / 100.; - inv_y = -70 * hud_scale / 100.; + inv_x = -80 * hud_scale; + inv_y = -70 * hud_scale; DrawHUD2(); // todo: Implement a proper view for this } else if (hud_size == Hud_Mini) { align = DI_SCREEN_RIGHT_BOTTOM; - inv_x = -210 * hud_scale / 100.; - inv_y = -28 * hud_scale / 100.; + inv_x = -210 * hud_scale; + inv_y = -28 * hud_scale; DrawHUD1(); } else { align = 0; - inv_x = 80 * hud_scale / 100.; - inv_y = 130 * hud_scale / 100.; + inv_x = 80 * hud_scale; + inv_y = 130 * hud_scale; DrawStatusBar(); } DrawInventory(inv_x, inv_y, align); diff --git a/wadsrc/static/engine/menudef.txt b/wadsrc/static/engine/menudef.txt index 478486837..9b11692b0 100644 --- a/wadsrc/static/engine/menudef.txt +++ b/wadsrc/static/engine/menudef.txt @@ -1024,7 +1024,7 @@ OptionMenu "HUDOptions" //protected Title "$OPTMNU_HUD" Slider "$DSPLYMNU_SCREENSIZE", "hud_size", 0.0, 9.0, 1.0, -1 - Slider "$DSPLYMNU_SBSCALE", "hud_scale", 36, 100, 4, 2 + Slider "$DSPLYMNU_SBSCALE", "hud_scale", 36, 100, 0.04, 2 StaticText "" Option "$DSPLYMNU_LEVELSTATS", "hud_stats", "OnOff" Slider "$DSPLYMNU_STATSCALE", "hud_statscale", .5, 3, 0.25, 2