diff --git a/src/c_console.cpp b/src/c_console.cpp index e2ffe2ec6..0d37198f3 100644 --- a/src/c_console.cpp +++ b/src/c_console.cpp @@ -146,10 +146,9 @@ static int worklen = 0; CVAR(Float, con_notifytime, 3.f, CVAR_ARCHIVE) CVAR(Bool, con_centernotify, false, CVAR_ARCHIVE) -CUSTOM_CVAR(Int, con_scaletext, 1, CVAR_ARCHIVE) // Scale notify text at high resolutions? +CUSTOM_CVAR(Int, con_scaletext, 0, CVAR_ARCHIVE) // Scale notify text at high resolutions? { if (self < 0) self = 0; - if (self > 3) self = 3; } CUSTOM_CVAR(Int, con_scale, 0, CVAR_ARCHIVE) @@ -157,36 +156,6 @@ CUSTOM_CVAR(Int, con_scale, 0, CVAR_ARCHIVE) if (self < 0) self = 0; } -int active_con_scale() -{ - int scale = con_scale; - if (scale <= 0) - { - scale = uiscale; - if (scale == 0) - { - scale = CleanXfac - 1; - if (scale <= 0) - { - scale = 1; - } - } - } - return scale; -} - -int active_con_scaletext() -{ - switch (con_scaletext) - { - default: - case 0: return 1; - case 1: return uiscale; - case 2: return 2; - case 3: return 4; - } -} - CUSTOM_CVAR(Float, con_alpha, 0.75f, CVAR_ARCHIVE) { if (self < 0.f) self = 0.f; @@ -811,14 +780,7 @@ void FNotifyBuffer::AddString(int printlevel, FString source) return; } - if (active_con_scaletext() == 0) - { - width = DisplayWidth / CleanXfac; - } - else - { - width = DisplayWidth / active_con_scaletext(); - } + width = DisplayWidth / active_con_scaletext(); if (AddType == APPENDLINE && Text.Size() > 0 && Text[Text.Size() - 1].PrintLevel == printlevel) { @@ -1061,10 +1023,6 @@ void FNotifyBuffer::Draw() canskip = true; lineadv = SmallFont->GetHeight (); - if (active_con_scaletext() == 0) - { - lineadv *= CleanYfac; - } BorderTopRefresh = screen->GetPageCount (); @@ -1088,45 +1046,21 @@ void FNotifyBuffer::Draw() else color = PrintColors[notify.PrintLevel]; - if (active_con_scaletext() == 0) - { - if (!center) - screen->DrawText (SmallFont, color, 0, line, notify.Text, - DTA_CleanNoMove, true, DTA_Alpha, alpha, TAG_DONE); - else - screen->DrawText (SmallFont, color, (SCREENWIDTH - - SmallFont->StringWidth (notify.Text)*CleanXfac)/2, - line, notify.Text, DTA_CleanNoMove, true, - DTA_Alpha, alpha, TAG_DONE); - } - else if (active_con_scaletext() == 1) - { - if (!center) - screen->DrawText (SmallFont, color, 0, line, notify.Text, - DTA_Alpha, alpha, TAG_DONE); - else - screen->DrawText (SmallFont, color, (SCREENWIDTH - - SmallFont->StringWidth (notify.Text))/2, - line, notify.Text, - DTA_Alpha, alpha, TAG_DONE); - } + int scale = active_con_scaletext(); + if (!center) + screen->DrawText (SmallFont, color, 0, line, notify.Text, + DTA_VirtualWidth, screen->GetWidth() / scale, + DTA_VirtualHeight, screen->GetHeight() / scale, + DTA_KeepRatio, true, + DTA_Alpha, alpha, TAG_DONE); else - { - if (!center) - screen->DrawText (SmallFont, color, 0, line, notify.Text, - DTA_VirtualWidth, screen->GetWidth() / active_con_scaletext(), - DTA_VirtualHeight, screen->GetHeight() / active_con_scaletext(), - DTA_KeepRatio, true, - DTA_Alpha, alpha, TAG_DONE); - else - screen->DrawText (SmallFont, color, (screen->GetWidth() - - SmallFont->StringWidth (notify.Text) * active_con_scaletext()) / 2 / active_con_scaletext(), - line, notify.Text, - DTA_VirtualWidth, screen->GetWidth() / active_con_scaletext(), - DTA_VirtualHeight, screen->GetHeight() / active_con_scaletext(), - DTA_KeepRatio, true, - DTA_Alpha, alpha, TAG_DONE); - } + screen->DrawText (SmallFont, color, (screen->GetWidth() - + SmallFont->StringWidth (notify.Text) * scale) / 2 / scale, + line, notify.Text, + DTA_VirtualWidth, screen->GetWidth() / scale, + DTA_VirtualHeight, screen->GetHeight() / scale, + DTA_KeepRatio, true, + DTA_Alpha, alpha, TAG_DONE); line += lineadv; canskip = false; } diff --git a/src/ct_chat.cpp b/src/ct_chat.cpp index ac026143e..c632df203 100644 --- a/src/ct_chat.cpp +++ b/src/ct_chat.cpp @@ -227,16 +227,8 @@ void CT_Drawer (void) int i, x, scalex, y, promptwidth; y = (viewactive || gamestate != GS_LEVEL) ? -10 : -30; - if (active_con_scaletext() == 0) - { - scalex = CleanXfac; - y *= CleanYfac; - } - else - { - scalex = 1; - } + scalex = 1; int scale = active_con_scaletext(); int screen_width = SCREENWIDTH / scale; int screen_height= SCREENHEIGHT / scale; @@ -266,18 +258,10 @@ void CT_Drawer (void) // draw the prompt, text, and cursor ChatQueue[len] = SmallFont->GetCursor(); ChatQueue[len+1] = '\0'; - if (active_con_scaletext() < 2) - { - screen->DrawText (SmallFont, CR_GREEN, 0, y, prompt, DTA_CleanNoMove, active_con_scaletext() == 0, TAG_DONE); - screen->DrawText (SmallFont, CR_GREY, promptwidth, y, (char *)(ChatQueue + i), DTA_CleanNoMove, active_con_scaletext() == 0, TAG_DONE); - } - else - { - screen->DrawText (SmallFont, CR_GREEN, 0, y, prompt, - DTA_VirtualWidth, screen_width, DTA_VirtualHeight, screen_height, DTA_KeepRatio, true, TAG_DONE); - screen->DrawText (SmallFont, CR_GREY, promptwidth, y, (char *)(ChatQueue + i), - DTA_VirtualWidth, screen_width, DTA_VirtualHeight, screen_height, DTA_KeepRatio, true, TAG_DONE); - } + screen->DrawText (SmallFont, CR_GREEN, 0, y, prompt, + DTA_VirtualWidth, screen_width, DTA_VirtualHeight, screen_height, DTA_KeepRatio, true, TAG_DONE); + screen->DrawText (SmallFont, CR_GREY, promptwidth, y, (char *)(ChatQueue + i), + DTA_VirtualWidth, screen_width, DTA_VirtualHeight, screen_height, DTA_KeepRatio, true, TAG_DONE); ChatQueue[len] = '\0'; BorderTopRefresh = screen->GetPageCount (); diff --git a/src/g_shared/hudmessages.cpp b/src/g_shared/hudmessages.cpp index eab0e8d29..caa041d4c 100644 --- a/src/g_shared/hudmessages.cpp +++ b/src/g_shared/hudmessages.cpp @@ -42,7 +42,6 @@ #include "serializer.h" EXTERN_CVAR(Int, con_scaletext) -int active_con_scaletext(); IMPLEMENT_CLASS(DHUDMessage, false, true) @@ -269,11 +268,7 @@ void DHUDMessage::ResetText (const char *text) } else { - switch (active_con_scaletext()) - { - case 0: width = SCREENWIDTH / CleanXfac; break; - default: width = SCREENWIDTH / active_con_scaletext(); break; - } + width = SCREENWIDTH / active_con_scaletext(); } if (Lines != NULL) @@ -338,21 +333,13 @@ void DHUDMessage::Draw (int bottom, int visibility) int screen_width = SCREENWIDTH; int screen_height = SCREENHEIGHT; - if (HUDWidth == 0 && active_con_scaletext() == 0) + xscale = yscale = 1; + if (HUDWidth == 0) { - clean = true; - xscale = CleanXfac; - yscale = CleanYfac; - } - else - { - xscale = yscale = 1; - if (HUDWidth == 0) - { - screen_width /= active_con_scaletext(); - screen_height /= active_con_scaletext(); - bottom /= active_con_scaletext(); - } + int scale = active_con_scaletext(); + screen_width /= scale; + screen_height /= scale; + bottom /= scale; } if (HUDWidth == 0) @@ -453,24 +440,14 @@ void DHUDMessage::DoDraw (int linenum, int x, int y, bool clean, int hudheight) { if (hudheight == 0) { - if (active_con_scaletext() <= 1) - { - screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, - DTA_CleanNoMove, clean, - DTA_Alpha, Alpha, - DTA_RenderStyle, Style, - TAG_DONE); - } - else - { - screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, - DTA_VirtualWidth, SCREENWIDTH / active_con_scaletext(), - DTA_VirtualHeight, SCREENHEIGHT / active_con_scaletext(), - DTA_Alpha, Alpha, - DTA_RenderStyle, Style, - DTA_KeepRatio, true, - TAG_DONE); - } + int scale = active_con_scaletext(); + screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, + DTA_VirtualWidth, SCREENWIDTH / scale, + DTA_VirtualHeight, SCREENHEIGHT / scale, + DTA_Alpha, Alpha, + DTA_RenderStyle, Style, + DTA_KeepRatio, true, + TAG_DONE); } else { @@ -556,24 +533,14 @@ void DHUDMessageFadeOut::DoDraw (int linenum, int x, int y, bool clean, int hudh float trans = float(Alpha * -(Tics - FadeOutTics) / FadeOutTics); if (hudheight == 0) { - if (active_con_scaletext() <= 1) - { - screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, - DTA_CleanNoMove, clean, - DTA_Alpha, trans, - DTA_RenderStyle, Style, - TAG_DONE); - } - else - { - screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, - DTA_VirtualWidth, SCREENWIDTH / active_con_scaletext(), - DTA_VirtualHeight, SCREENHEIGHT / active_con_scaletext(), - DTA_Alpha, trans, - DTA_RenderStyle, Style, - DTA_KeepRatio, true, - TAG_DONE); - } + int scale = active_con_scaletext(); + screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, + DTA_VirtualWidth, SCREENWIDTH / scale, + DTA_VirtualHeight, SCREENHEIGHT / scale, + DTA_Alpha, trans, + DTA_RenderStyle, Style, + DTA_KeepRatio, true, + TAG_DONE); } else { @@ -656,24 +623,14 @@ void DHUDMessageFadeInOut::DoDraw (int linenum, int x, int y, bool clean, int hu float trans = float(Alpha * Tics / FadeInTics); if (hudheight == 0) { - if (active_con_scaletext() <= 1) - { - screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, - DTA_CleanNoMove, clean, - DTA_Alpha, trans, - DTA_RenderStyle, Style, - TAG_DONE); - } - else - { - screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, - DTA_VirtualWidth, SCREENWIDTH / active_con_scaletext(), - DTA_VirtualHeight, SCREENHEIGHT / active_con_scaletext(), - DTA_Alpha, trans, - DTA_RenderStyle, Style, - DTA_KeepRatio, true, - TAG_DONE); - } + int scale = active_con_scaletext(); + screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, + DTA_VirtualWidth, SCREENWIDTH / scale, + DTA_VirtualHeight, SCREENHEIGHT / scale, + DTA_Alpha, trans, + DTA_RenderStyle, Style, + DTA_KeepRatio, true, + TAG_DONE); } else { @@ -837,26 +794,15 @@ void DHUDMessageTypeOnFadeOut::DoDraw (int linenum, int x, int y, bool clean, in { if (hudheight == 0) { - if (active_con_scaletext() <= 1) - { - screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, - DTA_CleanNoMove, clean, - DTA_TextLen, LineVisible, - DTA_Alpha, Alpha, - DTA_RenderStyle, Style, - TAG_DONE); - } - else - { - screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, - DTA_VirtualWidth, SCREENWIDTH / active_con_scaletext(), - DTA_VirtualHeight, SCREENHEIGHT / active_con_scaletext(), - DTA_KeepRatio, true, - DTA_TextLen, LineVisible, - DTA_Alpha, Alpha, - DTA_RenderStyle, Style, - TAG_DONE); - } + int scale = active_con_scaletext(); + screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, + DTA_VirtualWidth, SCREENWIDTH / scale, + DTA_VirtualHeight, SCREENHEIGHT / scale, + DTA_KeepRatio, true, + DTA_TextLen, LineVisible, + DTA_Alpha, Alpha, + DTA_RenderStyle, Style, + TAG_DONE); } else { diff --git a/src/g_shared/shared_hud.cpp b/src/g_shared/shared_hud.cpp index ce8a4965e..19183a437 100644 --- a/src/g_shared/shared_hud.cpp +++ b/src/g_shared/shared_hud.cpp @@ -65,11 +65,12 @@ EXTERN_CVAR(Bool,am_follow) EXTERN_CVAR (Int, con_scaletext) EXTERN_CVAR (Bool, idmypos) EXTERN_CVAR (Int, screenblocks) +EXTERN_CVAR(Bool, hud_aspectscale) EXTERN_CVAR (Bool, am_showtime) EXTERN_CVAR (Bool, am_showtotaltime) -CVAR(Int,hud_althudscale, 4, CVAR_ARCHIVE) // Scale the hud to 640x400? +CVAR(Int,hud_althudscale, 0, CVAR_ARCHIVE) // Scale the hud to 640x400? CVAR(Bool,hud_althud, false, CVAR_ARCHIVE) // Enable/Disable the alternate HUD // These are intentionally not the same as in the automap! @@ -121,7 +122,6 @@ static int hudwidth, hudheight; // current width/height for HUD display static int statspace; DVector2 AM_GetPosition(); -int active_con_scaletext(); //--------------------------------------------------------------------------- // @@ -897,43 +897,31 @@ static void DrawCoordinates(player_t * CPlayer) pos = DVector3(apos, z); } - int vwidth, vheight; - if (active_con_scaletext() == 0) - { - vwidth = SCREENWIDTH / 2; - vheight = SCREENHEIGHT / 2; - } - else - { - vwidth = SCREENWIDTH / active_con_scaletext(); - vheight = SCREENHEIGHT / active_con_scaletext(); - } - - int xpos = vwidth - SmallFont->StringWidth("X: -00000")-6; + int xpos = hudwidth - SmallFont->StringWidth("X: -00000")-6; int ypos = 18; - screen->DrawText(SmallFont, hudcolor_titl, vwidth - 6 - SmallFont->StringWidth(level.MapName), ypos, level.MapName, + screen->DrawText(SmallFont, hudcolor_titl, hudwidth - 6 - SmallFont->StringWidth(level.MapName), ypos, level.MapName, DTA_KeepRatio, true, - DTA_VirtualWidth, vwidth, DTA_VirtualHeight, vheight, TAG_DONE); + DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, TAG_DONE); - screen->DrawText(SmallFont, hudcolor_titl, vwidth - 6 - SmallFont->StringWidth(level.LevelName), ypos + h, level.LevelName, + screen->DrawText(SmallFont, hudcolor_titl, hudwidth - 6 - SmallFont->StringWidth(level.LevelName), ypos + h, level.LevelName, DTA_KeepRatio, true, - DTA_VirtualWidth, vwidth, DTA_VirtualHeight, vheight, TAG_DONE); + DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, TAG_DONE); mysnprintf(coordstr, countof(coordstr), "X: %d", int(pos.X)); screen->DrawText(SmallFont, hudcolor_xyco, xpos, ypos+2*h, coordstr, DTA_KeepRatio, true, - DTA_VirtualWidth, vwidth, DTA_VirtualHeight, vheight, TAG_DONE); + DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, TAG_DONE); mysnprintf(coordstr, countof(coordstr), "Y: %d", int(pos.Y)); screen->DrawText(SmallFont, hudcolor_xyco, xpos, ypos+3*h, coordstr, DTA_KeepRatio, true, - DTA_VirtualWidth, vwidth, DTA_VirtualHeight, vheight, TAG_DONE); + DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, TAG_DONE); mysnprintf(coordstr, countof(coordstr), "Z: %d", int(pos.Z)); screen->DrawText(SmallFont, hudcolor_xyco, xpos, ypos+4*h, coordstr, DTA_KeepRatio, true, - DTA_VirtualWidth, vwidth, DTA_VirtualHeight, vheight, TAG_DONE); + DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, TAG_DONE); } //--------------------------------------------------------------------------- @@ -1134,49 +1122,9 @@ void DrawHUD() player_t * CPlayer = StatusBar->CPlayer; players[consoleplayer].inventorytics = 0; - if (hud_althudscale && SCREENWIDTH>640) - { - hudwidth=SCREENWIDTH/2; - if (hud_althudscale == 4) - { - if (uiscale == 0) - { - hudwidth = CleanWidth; - hudheight = CleanHeight; - } - else - { - hudwidth = SCREENWIDTH / uiscale; - hudheight = SCREENHEIGHT / uiscale; - } - } - else if (hud_althudscale == 3) - { - hudwidth = SCREENWIDTH / 4; - hudheight = SCREENHEIGHT / 4; - } - else if (hud_althudscale == 2) - { - // Optionally just double the pixels to reduce scaling artifacts. - hudheight=SCREENHEIGHT/2; - } - else - { - if (AspectTallerThanWide(r_viewwindow.WidescreenRatio)) - { - hudheight = hudwidth * 30 / AspectMultiplier(r_viewwindow.WidescreenRatio); // BaseRatioSizes is inverted for this mode - } - else - { - hudheight = hudwidth * 30 / (48*48/AspectMultiplier(r_viewwindow.WidescreenRatio)); - } - } - } - else - { - hudwidth=SCREENWIDTH; - hudheight=SCREENHEIGHT; - } + int scale = GetUIScale(hud_althudscale); + hudwidth = SCREENWIDTH / scale; + hudheight = hud_aspectscale ? int(SCREENHEIGHT / (scale*1.2)) : SCREENHEIGHT / scale; if (!automapactive) { diff --git a/src/g_statusbar/shared_sbar.cpp b/src/g_statusbar/shared_sbar.cpp index 1cb3fe32c..d5330b2b5 100644 --- a/src/g_statusbar/shared_sbar.cpp +++ b/src/g_statusbar/shared_sbar.cpp @@ -87,7 +87,6 @@ EXTERN_CVAR (Int, con_scaletext) EXTERN_CVAR(Bool, vid_fps) CVAR(Int, hud_scale, 0, CVAR_ARCHIVE); -int active_con_scaletext(); DBaseStatusBar *StatusBar; @@ -107,7 +106,7 @@ CVAR (Flag, pf_ice, paletteflash, PF_ICE) CVAR (Flag, pf_hazard, paletteflash, PF_HAZARD) // Stretch status bar to full screen width? -CUSTOM_CVAR (Int, st_scale, -1, CVAR_ARCHIVE) +CUSTOM_CVAR (Int, st_scale, 0, CVAR_ARCHIVE) { if (self < -1) { @@ -120,7 +119,7 @@ CUSTOM_CVAR (Int, st_scale, -1, CVAR_ARCHIVE) setsizeneeded = true; } } -CUSTOM_CVAR(Bool, st_aspectscale, false, CVAR_ARCHIVE) +CUSTOM_CVAR(Bool, hud_aspectscale, false, CVAR_ARCHIVE) { if (StatusBar) { @@ -419,7 +418,7 @@ void DBaseStatusBar::SetScale () { int w = SCREENWIDTH; int h = SCREENHEIGHT; - if (st_scale == -1) + if (st_scale < 0 || ForcedScale) { // This is the classic fullscreen scale with aspect ratio compensation. int sby = VerticalResolution - RelTop; @@ -448,10 +447,9 @@ void DBaseStatusBar::SetScale () // Since status bars and HUDs can be designed for non 320x200 screens this needs to be factored in here. // The global scaling factors are for resources at 320x200, so if the actual ones are higher resolution // the resulting scaling factor needs to be reduced accordingly. + int realscale = clamp((320 * GetUIScale(st_scale)) / HorizontalResolution, 1, w / HorizontalResolution); - int newscale = (st_scale > 0) ? *st_scale : *uiscale; - int realscale = clamp((320 * st_scale) / HorizontalResolution, 1, w / HorizontalResolution); // do not scale wider than the screen. - double realscaley = realscale * (st_aspectscale ? 1.2 : 1.); + double realscaley = realscale * (hud_aspectscale ? 1.2 : 1.); ST_X = (w - HorizontalResolution * realscale) / 2; SBarTop = int(h - RelTop * realscaley); @@ -482,24 +480,13 @@ DVector2 DBaseStatusBar::GetHUDScale() const { return defaultScale; } - if (hud_scale > 0) // use the scale as an absolute value, but also factor in the specified resolution of the HUD - { - scale = hud_scale; - } - else if (uiscale == 0) - { - return defaultScale; - } - else - { - scale = MAX(1, uiscale); - } + scale = GetUIScale(hud_scale); // Since status bars and HUDs can be designed for non 320x200 screens this needs to be factored in here. // The global scaling factors are for resources at 320x200, so if the actual ones are higher resolution // the resulting scaling factor needs to be reduced accordingly. int realscale = MAX(1, (320 * scale) / HorizontalResolution); - return{ double(realscale), double(realscale) }; + return{ double(realscale), double(realscale * (hud_aspectscale ? 1.2 : 1.)) }; } DEFINE_ACTION_FUNCTION(DBaseStatusBar, GetHUDScale) @@ -1032,16 +1019,9 @@ void DBaseStatusBar::DrawLog () if (CPlayer->LogText.IsNotEmpty()) { // This uses the same scaling as regular HUD messages - if (active_con_scaletext() == 0) - { - hudwidth = SCREENWIDTH / CleanXfac; - hudheight = SCREENHEIGHT / CleanYfac; - } - else - { - hudwidth = SCREENWIDTH / active_con_scaletext(); - hudheight = SCREENHEIGHT / active_con_scaletext(); - } + auto scale = active_con_scaletext(); + hudwidth = SCREENWIDTH / scale; + hudheight = SCREENHEIGHT / scale; int linelen = hudwidth<640? Scale(hudwidth,9,10)-40 : 560; FBrokenLines *lines = V_BreakLines (SmallFont, linelen, CPlayer->LogText); diff --git a/src/gameconfigfile.cpp b/src/gameconfigfile.cpp index cd221958d..ffeba90f2 100644 --- a/src/gameconfigfile.cpp +++ b/src/gameconfigfile.cpp @@ -356,12 +356,7 @@ void FGameConfigFile::DoGlobalSetup () } if (last < 213) { - FBaseCVar *var = FindCVar("hud_scale", NULL); - if (var != NULL) - { - var->ResetToDefault(); - } - var = FindCVar("snd_channels", NULL); + auto var = FindCVar("snd_channels", NULL); if (var != NULL) { // old settings were default 32, minimum 8, new settings are default 128, minimum 64. @@ -369,6 +364,21 @@ void FGameConfigFile::DoGlobalSetup () if (v.Int < 64) var->ResetToDefault(); } } + if (last < 214) + { + FBaseCVar *var = FindCVar("hud_scale", NULL); + if (var != NULL) var->ResetToDefault(); + var = FindCVar("st_scale", NULL); + if (var != NULL) var->ResetToDefault(); + var = FindCVar("hud_althudscale", NULL); + if (var != NULL) var->ResetToDefault(); + var = FindCVar("con_scale", NULL); + if (var != NULL) var->ResetToDefault(); + var = FindCVar("con_scaletext", NULL); + if (var != NULL) var->ResetToDefault(); + + } + } } } diff --git a/src/v_draw.cpp b/src/v_draw.cpp index c8da6ac4d..78b0dd7f3 100644 --- a/src/v_draw.cpp +++ b/src/v_draw.cpp @@ -76,6 +76,26 @@ CUSTOM_CVAR(Int, uiscale, 2, CVAR_ARCHIVE | CVAR_NOINITCALL) } } +int GetUIScale(int altval) +{ + int scaleval; + if (altval > 0) scaleval = altval; + else if (uiscale == 0) + { + // Default should try to scale to 640x480 + int vscale = screen->GetHeight() / 640; + int hscale = screen->GetWidth() / 480; + scaleval = clamp(vscale, 1, hscale); + } + else scaleval = uiscale; + + // block scales that result in something larger than the current screen. + int vmax = screen->GetHeight() / 200; + int hmax = screen->GetWidth() / 320; + int max = MAX(vmax, hmax); + return MIN(scaleval, max); +} + // [RH] Stretch values to make a 320x200 image best fit the screen // without using fractional steppings int CleanXfac, CleanYfac; diff --git a/src/v_video.cpp b/src/v_video.cpp index 07990af8b..3073e259c 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -870,13 +870,10 @@ void DFrameBuffer::DrawRateStuff () chars = mysnprintf (fpsbuff, countof(fpsbuff), "%2u ms (%3u fps)", howlong, LastCount); rate_x = Width / textScale - ConFont->StringWidth(&fpsbuff[0]); Clear (rate_x * textScale, 0, Width, ConFont->GetHeight() * textScale, GPalette.BlackIndex, 0); - if (textScale == 1) - DrawText (ConFont, CR_WHITE, rate_x, 0, (char *)&fpsbuff[0], TAG_DONE); - else - DrawText (ConFont, CR_WHITE, rate_x, 0, (char *)&fpsbuff[0], - DTA_VirtualWidth, screen->GetWidth() / textScale, - DTA_VirtualHeight, screen->GetHeight() / textScale, - DTA_KeepRatio, true, TAG_DONE); + DrawText (ConFont, CR_WHITE, rate_x, 0, (char *)&fpsbuff[0], + DTA_VirtualWidth, screen->GetWidth() / textScale, + DTA_VirtualHeight, screen->GetHeight() / textScale, + DTA_KeepRatio, true, TAG_DONE); uint32_t thisSec = ms/1000; if (LastSec < thisSec) diff --git a/src/v_video.h b/src/v_video.h index e92b045b1..d836e1a1f 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -563,7 +563,21 @@ int AspectBaseHeight(float aspect); double AspectPspriteOffset(float aspect); int AspectMultiplier(float aspect); bool AspectTallerThanWide(float aspect); +int GetUIScale(int altval); EXTERN_CVAR(Int, uiscale); +EXTERN_CVAR(Int, con_scaletext); +EXTERN_CVAR(Int, con_scale); + +inline int active_con_scaletext() +{ + return GetUIScale(con_scaletext); +} + +inline int active_con_scale() +{ + return GetUIScale(con_scale); +} + #endif // __V_VIDEO_H__ diff --git a/src/version.h b/src/version.h index a3bb6d199..b2e554633 100644 --- a/src/version.h +++ b/src/version.h @@ -66,7 +66,7 @@ const char *GetVersionString(); // Version stored in the ini's [LastRun] section. // Bump it if you made some configuration change that you want to // be able to migrate in FGameConfigFile::DoGlobalSetup(). -#define LASTRUNVERSION "213" +#define LASTRUNVERSION "214" // Protocol version used in demos. // Bump it if you change existing DEM_ commands or add new ones. diff --git a/wadsrc/static/language.enu b/wadsrc/static/language.enu index 1a4a97148..de32e0253 100644 --- a/wadsrc/static/language.enu +++ b/wadsrc/static/language.enu @@ -1847,7 +1847,6 @@ HUDMNU_CROSSHAIRHEALTH = "Crosshair shows health"; HUDMNU_CROSSHAIRSCALE = "Scale crosshair"; HUDMNU_NAMETAGS = "Display nametags"; HUDMNU_NAMETAGCOLOR = "Nametag color"; -HUDMNU_SCALESTATBAR = "Stretch status bar"; HUDMNU_SCALEFULLSCREENHUD = "Stretch Fullscreen HUD"; HUDMNU_OLDOUCH = "Use old ouch mug shot formula"; HUDMNU_HEXENFLASHES = "Hexen weapon flashes"; @@ -1855,10 +1854,19 @@ HUDMNU_POISONFLASHES = "Poison damage flashes"; HUDMNU_ICEFLASHES = "Ice death flashes"; HUDMNU_HAZARDFLASHES = "Poison Buildup flashes"; +// Scaling options +SCALEMNU_TITLE = "Scaling Options"; +SCALEMNU_OVERRIDE = "Overrides for above setting"; +SCALEMNU_MESSAGES = "Messages"; +SCALEMNU_CONSOLE = "Console"; +SCALEMNU_STATBAR = "Status bar"; +SCALEMNU_HUD = "Fullscreen HUD"; +SCALEMNU_ALTHUD = "Alternative HUD"; +SCALEMNU_HUDASPECT = "HUD preserves aspect ratio"; + // AltHUD Options ALTHUDMNU_TITLE = "Alternative HUD"; ALTHUDMNU_ENABLE = "Enable alternative HUD"; -ALTHUDMNU_SCALEHUD = "Stretch alternative HUD"; ALTHUDMNU_SHOWSECRETS = "Show secret count"; ALTHUDMNU_SHOWMONSTERS = "Show monster count"; ALTHUDMNU_SHOWITEMS = "Show item count"; @@ -1977,8 +1985,6 @@ MSGMNU_TITLE = "MESSAGES"; MSGMNU_SHOWMESSAGES = "Show messages"; MSGMNU_SHOWOBITUARIES = "Show obituaries"; MSGMNU_SHOWSECRETS = "Show secret notifications"; -MSGMNU_SCALETEXT = "Scale text in high res"; -MSGMNU_SCALECONSOLE = "Scale console"; MSGMNU_MESSAGELEVEL = "Minimum message level"; MSGMNU_CENTERMESSAGES = "Center messages"; MSGMNU_MESSAGECOLORS = "Message Colors"; diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index 545a9f31c..37b2a0175 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -828,11 +828,10 @@ OptionValue ZDoomStrife OptionMenu "HUDOptions" { Title "$HUDMNU_TITLE" + Submenu "$HUDMNU_SCALEOPT", "ScalingOptions" Submenu "$HUDMNU_ALTHUD", "AltHudOptions" Submenu "$HUDMNU_MESSAGE", "MessageOptions" StaticText " " - Slider "$HUDMNU_UISCALE", "uiscale", 0.0, 8.0, 1.0, 0 - StaticText " " Option "$HUDMNU_CROSSHAIR", "crosshair", "Crosshairs" Option "$HUDMNU_FORCECROSSHAIR", "crosshairforce", "OnOff" Option "$HUDMNU_GROWCROSSHAIR", "crosshairgrow", "OnOff" @@ -842,7 +841,6 @@ OptionMenu "HUDOptions" StaticText " " Option "$HUDMNU_NAMETAGS", "displaynametags", "DisplayTagsTypes" Option "$HUDMNU_NAMETAGCOLOR", "nametagcolor", "TextColors", "displaynametags" - Option "$HUDMNU_SCALESTATBAR", "st_scale", "OnOff" Option "$HUDMNU_OLDOUCH", "st_oldouch", "OnOff" StaticText " " Option "$HUDMNU_HEXENFLASHES", "pf_hexenweaps", "ZDoomHexen" @@ -850,7 +848,22 @@ OptionMenu "HUDOptions" Option "$HUDMNU_ICEFLASHES", "pf_ice", "ZDoomHexen" Option "$HUDMNU_HAZARDFLASHES", "pf_hazard", "ZDoomStrife" } - + +OptionMenu "ScalingOptions" +{ + Title "$SCALEMNU_TITLE" + Slider "$HUDMNU_UISCALE", "uiscale", 0.0, 8.0, 1.0, 0 + StaticText " " + // These will need a new control type. + StaticText "$SCALEMNU_OVERRIDE", 1 + Option "$SCALEMNU_MESSAGES", "con_scaletext", "OnOff" + Option "$SCALEMNU_CONSOLE", "con_scale", "OnOff" + Option "$SCALEMNU_STATBAR", "st_scale", "OnOff" + Option "$SCALEMNU_HUD", "hud_scale", "OnOff" + Option "$SCALEMNU_ALTHUD", "hud_althudscale", "OnOff" + StaticText " " + Option "$SCALEMNU_HUDASPECT", "hud_aspectscale", "OnOff" +} //------------------------------------------------------------------------------------------- // // Alternative HUD @@ -863,15 +876,6 @@ OptionValue "AMCoordinates" 1, "$OPTVAL_MAP" } -OptionValue "AltHUDScale" -{ - 0, "$OPTVAL_OFF" - 4, "$OPTVAL_ON" - 1, "$OPTVAL_SCALETO640X400" - 2, "$OPTVAL_PIXELDOUBLE" - 3, "$OPTVAL_PIXELQUADRUPLE" -} - OptionValue "AltHUDAmmo" { 0, "$OPTVAL_CURRENTWEAPON" @@ -911,7 +915,6 @@ OptionMenu "AltHUDOptions" Title "$ALTHUDMNU_TITLE" //Indent 220 Option "$ALTHUDMNU_ENABLE", "hud_althud", "OnOff" - Option "$ALTHUDMNU_SCALEHUD", "hud_althudscale", "AltHUDScale" Option "$ALTHUDMNU_SHOWSECRETS", "hud_showsecrets", "OnOff" Option "$ALTHUDMNU_SHOWMONSTERS", "hud_showmonsters", "OnOff" Option "$ALTHUDMNU_SHOWITEMS", "hud_showitems", "OnOff" @@ -1189,23 +1192,6 @@ OptionMenu ColorPickerMenu //------------------------------------------------------------------------------------------- -OptionValue ScaleValues -{ - 0, "$OPTVAL_OFF" - 1, "$OPTVAL_ON" - 2, "$OPTVAL_DOUBLE" - 3, "$OPTVAL_QUADRUPLE" -} - -OptionValue ConsoleScaleValues -{ - 1, "$OPTVAL_OFF" - 0, "$OPTVAL_ON" - 2, "$OPTVAL_DOUBLE" - 3, "$OPTVAL_TRIPLE" - 4, "$OPTVAL_QUADRUPLE" -} - OptionValue MessageLevels { 0.0, "$OPTVAL_ITEMPICKUP" @@ -1228,8 +1214,6 @@ OptionMenu MessageOptions Option "$MSGMNU_SHOWMESSAGES", "show_messages", "OnOff" Option "$MSGMNU_SHOWOBITUARIES", "show_obituaries", "OnOff" Option "$MSGMNU_SHOWSECRETS", "cl_showsecretmessage", "OnOff" - Option "$MSGMNU_SCALETEXT", "con_scaletext", "ScaleValues" - Option "$MSGMNU_SCALECONSOLE", "con_scale", "ConsoleScaleValues" Option "$MSGMNU_MESSAGELEVEL", "msg", "MessageLevels" Option "$MSGMNU_DEVELOPER", "developer", "DevMessageLevels" Option "$MSGMNU_CENTERMESSAGES", "con_centernotify", "OnOff"