Add uiscale slider controlling what scale the On setting uses for hud_scale, hud_althudscale and con_scaletext

This commit is contained in:
Magnus Norddahl 2016-09-06 19:48:14 +02:00 committed by Christoph Oelckers
parent 01e9d351b4
commit 6414e01354
10 changed files with 125 additions and 167 deletions

View file

@ -159,12 +159,24 @@ static int HistSize;
CVAR (Float, con_notifytime, 3.f, CVAR_ARCHIVE) CVAR (Float, con_notifytime, 3.f, CVAR_ARCHIVE)
CVAR (Bool, con_centernotify, false, CVAR_ARCHIVE) CVAR (Bool, con_centernotify, false, CVAR_ARCHIVE)
CUSTOM_CVAR (Int, con_scaletext, 0, CVAR_ARCHIVE) // Scale notify text at high resolutions? CUSTOM_CVAR (Int, con_scaletext, 1, CVAR_ARCHIVE) // Scale notify text at high resolutions?
{ {
if (self < 0) self = 0; if (self < 0) self = 0;
if (self > 3) self = 3; if (self > 3) self = 3;
} }
int con_uiscale()
{
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) CUSTOM_CVAR(Float, con_alpha, 0.75f, CVAR_ARCHIVE)
{ {
if (self < 0.f) self = 0.f; if (self < 0.f) self = 0.f;
@ -493,13 +505,13 @@ void C_AddNotifyString (int printlevel, const char *source)
return; return;
} }
switch (con_scaletext) if (con_uiscale() == 0)
{ {
default: width = DisplayWidth / CleanXfac;
case 0: width = DisplayWidth; break; }
case 1: width = DisplayWidth / CleanXfac; break; else
case 2: width = DisplayWidth / 2; break; {
case 3: width = DisplayWidth / 4; break; width = DisplayWidth / con_uiscale();
} }
if (addtype == APPENDLINE && NotifyStrings[NUMNOTIFIES-1].PrintLevel == printlevel) if (addtype == APPENDLINE && NotifyStrings[NUMNOTIFIES-1].PrintLevel == printlevel)
@ -721,7 +733,7 @@ static void C_DrawNotifyText ()
canskip = true; canskip = true;
lineadv = SmallFont->GetHeight (); lineadv = SmallFont->GetHeight ();
if (con_scaletext == 1) if (con_uiscale() == 0)
{ {
lineadv *= CleanYfac; lineadv *= CleanYfac;
} }
@ -755,7 +767,7 @@ static void C_DrawNotifyText ()
else else
color = PrintColors[NotifyStrings[i].PrintLevel]; color = PrintColors[NotifyStrings[i].PrintLevel];
if (con_scaletext == 1) if (con_uiscale() == 0)
{ {
if (!center) if (!center)
screen->DrawText (SmallFont, color, 0, line, NotifyStrings[i].Text, screen->DrawText (SmallFont, color, 0, line, NotifyStrings[i].Text,
@ -766,7 +778,7 @@ static void C_DrawNotifyText ()
line, NotifyStrings[i].Text, DTA_CleanNoMove, true, line, NotifyStrings[i].Text, DTA_CleanNoMove, true,
DTA_AlphaF, alpha, TAG_DONE); DTA_AlphaF, alpha, TAG_DONE);
} }
else if (con_scaletext == 0) else if (con_uiscale() == 1)
{ {
if (!center) if (!center)
screen->DrawText (SmallFont, color, 0, line, NotifyStrings[i].Text, screen->DrawText (SmallFont, color, 0, line, NotifyStrings[i].Text,
@ -777,37 +789,20 @@ static void C_DrawNotifyText ()
line, NotifyStrings[i].Text, line, NotifyStrings[i].Text,
DTA_AlphaF, alpha, TAG_DONE); DTA_AlphaF, alpha, TAG_DONE);
} }
else if (con_scaletext == 3)
{
if (!center)
screen->DrawText (SmallFont, color, 0, line, NotifyStrings[i].Text,
DTA_VirtualWidth, screen->GetWidth() / 4,
DTA_VirtualHeight, screen->GetHeight() / 4,
DTA_KeepRatio, true,
DTA_AlphaF, alpha, TAG_DONE);
else
screen->DrawText (SmallFont, color, (screen->GetWidth() / 4 -
SmallFont->StringWidth (NotifyStrings[i].Text))/4,
line, NotifyStrings[i].Text,
DTA_VirtualWidth, screen->GetWidth() / 4,
DTA_VirtualHeight, screen->GetHeight() / 4,
DTA_KeepRatio, true,
DTA_AlphaF, alpha, TAG_DONE);
}
else else
{ {
if (!center) if (!center)
screen->DrawText (SmallFont, color, 0, line, NotifyStrings[i].Text, screen->DrawText (SmallFont, color, 0, line, NotifyStrings[i].Text,
DTA_VirtualWidth, screen->GetWidth() / 2, DTA_VirtualWidth, screen->GetWidth() / con_uiscale(),
DTA_VirtualHeight, screen->GetHeight() / 2, DTA_VirtualHeight, screen->GetHeight() / con_uiscale(),
DTA_KeepRatio, true, DTA_KeepRatio, true,
DTA_AlphaF, alpha, TAG_DONE); DTA_AlphaF, alpha, TAG_DONE);
else else
screen->DrawText (SmallFont, color, (screen->GetWidth() / 2 - screen->DrawText (SmallFont, color, (screen->GetWidth() / con_uiscale() -
SmallFont->StringWidth (NotifyStrings[i].Text))/2, SmallFont->StringWidth (NotifyStrings[i].Text))/ con_uiscale(),
line, NotifyStrings[i].Text, line, NotifyStrings[i].Text,
DTA_VirtualWidth, screen->GetWidth() / 2, DTA_VirtualWidth, screen->GetWidth() / con_uiscale(),
DTA_VirtualHeight, screen->GetHeight() / 2, DTA_VirtualHeight, screen->GetHeight() / con_uiscale(),
DTA_KeepRatio, true, DTA_KeepRatio, true,
DTA_AlphaF, alpha, TAG_DONE); DTA_AlphaF, alpha, TAG_DONE);
} }

View file

@ -46,6 +46,8 @@ EXTERN_CVAR (Bool, sb_cooperative_enable)
EXTERN_CVAR (Bool, sb_deathmatch_enable) EXTERN_CVAR (Bool, sb_deathmatch_enable)
EXTERN_CVAR (Bool, sb_teamdeathmatch_enable) EXTERN_CVAR (Bool, sb_teamdeathmatch_enable)
int con_uiscale();
// Public data // Public data
void CT_Init (); void CT_Init ();
@ -224,7 +226,7 @@ void CT_Drawer (void)
int i, x, scalex, y, promptwidth; int i, x, scalex, y, promptwidth;
y = (viewactive || gamestate != GS_LEVEL) ? -10 : -30; y = (viewactive || gamestate != GS_LEVEL) ? -10 : -30;
if (con_scaletext == 1) if (con_uiscale() == 0)
{ {
scalex = CleanXfac; scalex = CleanXfac;
y *= CleanYfac; y *= CleanYfac;
@ -235,25 +237,17 @@ void CT_Drawer (void)
} }
int screen_width, screen_height, st_y; int screen_width, screen_height, st_y;
switch (con_scaletext) if (con_uiscale() == 0)
{ {
default:
case 0:
case 1:
screen_width = SCREENWIDTH; screen_width = SCREENWIDTH;
screen_height = SCREENHEIGHT; screen_height = SCREENHEIGHT;
st_y = ST_Y; st_y = ST_Y;
break; }
case 2: else
screen_width = SCREENWIDTH / 2; {
screen_height = SCREENHEIGHT / 2; screen_width = SCREENWIDTH / con_uiscale();
st_y = ST_Y / 2; screen_height = SCREENHEIGHT / con_uiscale();
break; st_y = ST_Y / con_uiscale();
case 3:
screen_width = SCREENWIDTH / 4;
screen_height = SCREENHEIGHT / 4;
st_y = ST_Y / 4;
break;
} }
y += ((SCREENHEIGHT == viewheight && viewactive) || gamestate != GS_LEVEL) ? screen_height : st_y; y += ((SCREENHEIGHT == viewheight && viewactive) || gamestate != GS_LEVEL) ? screen_height : st_y;
@ -280,10 +274,10 @@ void CT_Drawer (void)
// draw the prompt, text, and cursor // draw the prompt, text, and cursor
ChatQueue[len] = SmallFont->GetCursor(); ChatQueue[len] = SmallFont->GetCursor();
ChatQueue[len+1] = '\0'; ChatQueue[len+1] = '\0';
if (con_scaletext < 2) if (con_uiscale() < 2)
{ {
screen->DrawText (SmallFont, CR_GREEN, 0, y, prompt, DTA_CleanNoMove, *con_scaletext, TAG_DONE); screen->DrawText (SmallFont, CR_GREEN, 0, y, prompt, DTA_CleanNoMove, con_uiscale() == 0, TAG_DONE);
screen->DrawText (SmallFont, CR_GREY, promptwidth, y, (char *)(ChatQueue + i), DTA_CleanNoMove, *con_scaletext, TAG_DONE); screen->DrawText (SmallFont, CR_GREY, promptwidth, y, (char *)(ChatQueue + i), DTA_CleanNoMove, con_uiscale() == 0, TAG_DONE);
} }
else else
{ {

View file

@ -41,7 +41,8 @@
#include "doomstat.h" #include "doomstat.h"
#include "farchive.h" #include "farchive.h"
EXTERN_CVAR (Int, con_scaletext) EXTERN_CVAR(Int, con_scaletext)
int con_uiscale();
IMPLEMENT_POINTY_CLASS (DHUDMessage) IMPLEMENT_POINTY_CLASS (DHUDMessage)
DECLARE_POINTER(Next) DECLARE_POINTER(Next)
@ -260,13 +261,10 @@ void DHUDMessage::ResetText (const char *text)
} }
else else
{ {
switch (con_scaletext) switch (con_uiscale())
{ {
default: case 0: width = SCREENWIDTH / CleanXfac; break;
case 0: width = SCREENWIDTH; break; default: width = SCREENWIDTH / con_uiscale(); break;
case 1: width = SCREENWIDTH / CleanXfac; break;
case 2: width = SCREENWIDTH / 2; break;
case 3: width = SCREENWIDTH / 4; break;
} }
} }
@ -332,7 +330,7 @@ void DHUDMessage::Draw (int bottom, int visibility)
int screen_width = SCREENWIDTH; int screen_width = SCREENWIDTH;
int screen_height = SCREENHEIGHT; int screen_height = SCREENHEIGHT;
if (HUDWidth == 0 && con_scaletext==1) if (HUDWidth == 0 && con_uiscale() == 0)
{ {
clean = true; clean = true;
xscale = CleanXfac; xscale = CleanXfac;
@ -341,17 +339,11 @@ void DHUDMessage::Draw (int bottom, int visibility)
else else
{ {
xscale = yscale = 1; xscale = yscale = 1;
if (HUDWidth==0 && con_scaletext==2) if (HUDWidth == 0)
{ {
screen_width/=2; screen_width /= con_uiscale();
screen_height/=2; screen_height /= con_uiscale();
bottom/=2; bottom /= con_uiscale();
}
else if (HUDWidth==0 && con_scaletext==3)
{
screen_width/=4;
screen_height/=4;
bottom/=4;
} }
} }
@ -453,7 +445,7 @@ void DHUDMessage::DoDraw (int linenum, int x, int y, bool clean, int hudheight)
{ {
if (hudheight == 0) if (hudheight == 0)
{ {
if (con_scaletext <= 1) if (con_uiscale() <= 1)
{ {
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_CleanNoMove, clean, DTA_CleanNoMove, clean,
@ -461,21 +453,11 @@ void DHUDMessage::DoDraw (int linenum, int x, int y, bool clean, int hudheight)
DTA_RenderStyle, Style, DTA_RenderStyle, Style,
TAG_DONE); TAG_DONE);
} }
else if (con_scaletext == 3)
{
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_VirtualWidth, SCREENWIDTH/4,
DTA_VirtualHeight, SCREENHEIGHT/4,
DTA_AlphaF, Alpha,
DTA_RenderStyle, Style,
DTA_KeepRatio, true,
TAG_DONE);
}
else else
{ {
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_VirtualWidth, SCREENWIDTH/2, DTA_VirtualWidth, SCREENWIDTH / con_uiscale(),
DTA_VirtualHeight, SCREENHEIGHT/2, DTA_VirtualHeight, SCREENHEIGHT / con_uiscale(),
DTA_AlphaF, Alpha, DTA_AlphaF, Alpha,
DTA_RenderStyle, Style, DTA_RenderStyle, Style,
DTA_KeepRatio, true, DTA_KeepRatio, true,
@ -566,7 +548,7 @@ void DHUDMessageFadeOut::DoDraw (int linenum, int x, int y, bool clean, int hudh
float trans = float(Alpha * -(Tics - FadeOutTics) / FadeOutTics); float trans = float(Alpha * -(Tics - FadeOutTics) / FadeOutTics);
if (hudheight == 0) if (hudheight == 0)
{ {
if (con_scaletext <= 1) if (con_uiscale() <= 1)
{ {
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_CleanNoMove, clean, DTA_CleanNoMove, clean,
@ -574,21 +556,11 @@ void DHUDMessageFadeOut::DoDraw (int linenum, int x, int y, bool clean, int hudh
DTA_RenderStyle, Style, DTA_RenderStyle, Style,
TAG_DONE); TAG_DONE);
} }
else if (con_scaletext == 3)
{
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_VirtualWidth, SCREENWIDTH/4,
DTA_VirtualHeight, SCREENHEIGHT/4,
DTA_AlphaF, trans,
DTA_RenderStyle, Style,
DTA_KeepRatio, true,
TAG_DONE);
}
else else
{ {
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_VirtualWidth, SCREENWIDTH/2, DTA_VirtualWidth, SCREENWIDTH / con_uiscale(),
DTA_VirtualHeight, SCREENHEIGHT/2, DTA_VirtualHeight, SCREENHEIGHT / con_uiscale(),
DTA_AlphaF, trans, DTA_AlphaF, trans,
DTA_RenderStyle, Style, DTA_RenderStyle, Style,
DTA_KeepRatio, true, DTA_KeepRatio, true,
@ -676,7 +648,7 @@ void DHUDMessageFadeInOut::DoDraw (int linenum, int x, int y, bool clean, int hu
float trans = float(Alpha * Tics / FadeInTics); float trans = float(Alpha * Tics / FadeInTics);
if (hudheight == 0) if (hudheight == 0)
{ {
if (con_scaletext <= 1) if (con_uiscale() <= 1)
{ {
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_CleanNoMove, clean, DTA_CleanNoMove, clean,
@ -684,21 +656,11 @@ void DHUDMessageFadeInOut::DoDraw (int linenum, int x, int y, bool clean, int hu
DTA_RenderStyle, Style, DTA_RenderStyle, Style,
TAG_DONE); TAG_DONE);
} }
else if (con_scaletext == 3)
{
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_VirtualWidth, SCREENWIDTH/4,
DTA_VirtualHeight, SCREENHEIGHT/4,
DTA_AlphaF, trans,
DTA_RenderStyle, Style,
DTA_KeepRatio, true,
TAG_DONE);
}
else else
{ {
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_VirtualWidth, SCREENWIDTH/2, DTA_VirtualWidth, SCREENWIDTH / con_uiscale(),
DTA_VirtualHeight, SCREENHEIGHT/2, DTA_VirtualHeight, SCREENHEIGHT / con_uiscale(),
DTA_AlphaF, trans, DTA_AlphaF, trans,
DTA_RenderStyle, Style, DTA_RenderStyle, Style,
DTA_KeepRatio, true, DTA_KeepRatio, true,
@ -864,7 +826,7 @@ void DHUDMessageTypeOnFadeOut::DoDraw (int linenum, int x, int y, bool clean, in
{ {
if (hudheight == 0) if (hudheight == 0)
{ {
if (con_scaletext <= 1) if (con_uiscale() <= 1)
{ {
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_CleanNoMove, clean, DTA_CleanNoMove, clean,
@ -873,22 +835,11 @@ void DHUDMessageTypeOnFadeOut::DoDraw (int linenum, int x, int y, bool clean, in
DTA_RenderStyle, Style, DTA_RenderStyle, Style,
TAG_DONE); TAG_DONE);
} }
else if (con_scaletext == 3)
{
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_VirtualWidth, SCREENWIDTH/4,
DTA_VirtualHeight, SCREENHEIGHT/4,
DTA_KeepRatio, true,
DTA_TextLen, LineVisible,
DTA_AlphaF, Alpha,
DTA_RenderStyle, Style,
TAG_DONE);
}
else else
{ {
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text, screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_VirtualWidth, SCREENWIDTH/2, DTA_VirtualWidth, SCREENWIDTH / con_uiscale(),
DTA_VirtualHeight, SCREENHEIGHT/2, DTA_VirtualHeight, SCREENHEIGHT / con_uiscale(),
DTA_KeepRatio, true, DTA_KeepRatio, true,
DTA_TextLen, LineVisible, DTA_TextLen, LineVisible,
DTA_AlphaF, Alpha, DTA_AlphaF, Alpha,

View file

@ -1013,7 +1013,15 @@ public:
void ScreenSizeChanged() void ScreenSizeChanged()
{ {
Super::ScreenSizeChanged(); Super::ScreenSizeChanged();
V_CalcCleanFacs(script->resW, script->resH, SCREENWIDTH, SCREENHEIGHT, &script->cleanX, &script->cleanY); if (uiscale > 0)
{
script->cleanX = uiscale;
script->cleanY = uiscale;
}
else
{
V_CalcCleanFacs(script->resW, script->resH, SCREENWIDTH, SCREENHEIGHT, &script->cleanX, &script->cleanY);
}
} }
void Draw (EHudState state) void Draw (EHudState state)

View file

@ -66,7 +66,7 @@ EXTERN_CVAR (Int, screenblocks)
EXTERN_CVAR (Bool, am_showtime) EXTERN_CVAR (Bool, am_showtime)
EXTERN_CVAR (Bool, am_showtotaltime) EXTERN_CVAR (Bool, am_showtotaltime)
CVAR(Int,hud_althudscale, 2, CVAR_ARCHIVE) // Scale the hud to 640x400? CVAR(Int,hud_althudscale, 4, CVAR_ARCHIVE) // Scale the hud to 640x400?
CVAR(Bool,hud_althud, false, CVAR_ARCHIVE) // Enable/Disable the alternate HUD CVAR(Bool,hud_althud, false, CVAR_ARCHIVE) // Enable/Disable the alternate HUD
// These are intentionally not the same as in the automap! // These are intentionally not the same as in the automap!
@ -118,7 +118,7 @@ static int hudwidth, hudheight; // current width/height for HUD display
static int statspace; static int statspace;
DVector2 AM_GetPosition(); DVector2 AM_GetPosition();
int con_uiscale();
FTextureID GetHUDIcon(PClassInventory *cls) FTextureID GetHUDIcon(PClassInventory *cls)
{ {
@ -886,22 +886,15 @@ static void DrawCoordinates(player_t * CPlayer)
} }
int vwidth, vheight; int vwidth, vheight;
switch (con_scaletext) if (con_uiscale() == 0)
{ {
default: vwidth = SCREENWIDTH / 2;
case 0: vheight = SCREENHEIGHT / 2;
vwidth = SCREENWIDTH; }
vheight = SCREENHEIGHT; else
break; {
case 1: vwidth = SCREENWIDTH / con_uiscale();
case 2: vheight = SCREENHEIGHT / con_uiscale();
vwidth = SCREENWIDTH/2;
vheight = SCREENHEIGHT/2;
break;
case 3:
vwidth = SCREENWIDTH/4;
vheight = SCREENHEIGHT/4;
break;
} }
int xpos = vwidth - SmallFont->StringWidth("X: -00000")-6; int xpos = vwidth - SmallFont->StringWidth("X: -00000")-6;
@ -1090,7 +1083,20 @@ void DrawHUD()
if (hud_althudscale && SCREENWIDTH>640) if (hud_althudscale && SCREENWIDTH>640)
{ {
hudwidth=SCREENWIDTH/2; hudwidth=SCREENWIDTH/2;
if (hud_althudscale == 3) 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; hudwidth = SCREENWIDTH / 4;
hudheight = SCREENHEIGHT / 4; hudheight = SCREENHEIGHT / 4;

View file

@ -74,6 +74,8 @@ EXTERN_CVAR (Bool, am_showtotaltime)
EXTERN_CVAR (Bool, noisedebug) EXTERN_CVAR (Bool, noisedebug)
EXTERN_CVAR (Int, con_scaletext) EXTERN_CVAR (Int, con_scaletext)
int con_uiscale();
DBaseStatusBar *StatusBar; DBaseStatusBar *StatusBar;
extern int setblocks; extern int setblocks;
@ -1240,17 +1242,17 @@ void DBaseStatusBar::Draw (EHudState state)
int xpos; int xpos;
int y; int y;
if (con_scaletext == 0) if (con_uiscale() == 1)
{ {
vwidth = SCREENWIDTH; vwidth = SCREENWIDTH;
vheight = SCREENHEIGHT; vheight = SCREENHEIGHT;
xpos = vwidth - 80; xpos = vwidth - 80;
y = ::ST_Y - height; y = ::ST_Y - height;
} }
else if (con_scaletext == 3) else if (con_uiscale() > 1)
{ {
vwidth = SCREENWIDTH/4; vwidth = SCREENWIDTH / con_uiscale();
vheight = SCREENHEIGHT/4; vheight = SCREENHEIGHT / con_uiscale();
xpos = vwidth - SmallFont->StringWidth("X: -00000")-6; xpos = vwidth - SmallFont->StringWidth("X: -00000")-6;
y = ::ST_Y/4 - height; y = ::ST_Y/4 - height;
} }
@ -1264,9 +1266,9 @@ void DBaseStatusBar::Draw (EHudState state)
if (gameinfo.gametype == GAME_Strife) if (gameinfo.gametype == GAME_Strife)
{ {
if (con_scaletext == 0) if (con_uiscale() == 1)
y -= height * 4; y -= height * 4;
else if (con_scaletext == 3) else if (con_uiscale() > 3)
y -= height; y -= height;
else else
y -= height * 2; y -= height * 2;
@ -1400,27 +1402,15 @@ void DBaseStatusBar::DrawLog ()
if (CPlayer->LogText.IsNotEmpty()) if (CPlayer->LogText.IsNotEmpty())
{ {
// This uses the same scaling as regular HUD messages // This uses the same scaling as regular HUD messages
switch (con_scaletext) if (con_uiscale() == 0)
{ {
default:
hudwidth = SCREENWIDTH;
hudheight = SCREENHEIGHT;
break;
case 1:
hudwidth = SCREENWIDTH / CleanXfac; hudwidth = SCREENWIDTH / CleanXfac;
hudheight = SCREENHEIGHT / CleanYfac; hudheight = SCREENHEIGHT / CleanYfac;
break; }
else
case 2: {
hudwidth = SCREENWIDTH / 2; hudwidth = SCREENWIDTH / con_uiscale();
hudheight = SCREENHEIGHT / 2; hudheight = SCREENHEIGHT / con_uiscale();
break;
case 3:
hudwidth = SCREENWIDTH / 4;
hudheight = SCREENHEIGHT / 4;
break;
} }
int linelen = hudwidth<640? Scale(hudwidth,9,10)-40 : 560; int linelen = hudwidth<640? Scale(hudwidth,9,10)-40 : 560;

View file

@ -62,6 +62,14 @@
#include "colormatcher.h" #include "colormatcher.h"
#include "r_data/colormaps.h" #include "r_data/colormaps.h"
CUSTOM_CVAR(Int, uiscale, 2, CVAR_ARCHIVE | CVAR_NOINITCALL)
{
if (StatusBar != NULL)
{
StatusBar->ScreenSizeChanged();
}
}
// [RH] Stretch values to make a 320x200 image best fit the screen // [RH] Stretch values to make a 320x200 image best fit the screen
// without using fractional steppings // without using fractional steppings
int CleanXfac, CleanYfac; int CleanXfac, CleanYfac;
@ -75,7 +83,7 @@ int CleanXfac_1, CleanYfac_1, CleanWidth_1, CleanHeight_1;
// FillSimplePoly uses this // FillSimplePoly uses this
extern "C" short spanend[MAXHEIGHT]; extern "C" short spanend[MAXHEIGHT];
CVAR (Bool, hud_scale, false, CVAR_ARCHIVE); CVAR (Bool, hud_scale, true, CVAR_ARCHIVE);
// For routines that take RGB colors, cache the previous lookup in case there // For routines that take RGB colors, cache the previous lookup in case there
// are several repetitions with the same color. // are several repetitions with the same color.

View file

@ -522,4 +522,6 @@ inline bool Is54Aspect(int ratio) {
return ratio == 4; return ratio == 4;
} }
EXTERN_CVAR(Int, uiscale);
#endif // __V_VIDEO_H__ #endif // __V_VIDEO_H__

View file

@ -1807,6 +1807,7 @@ DSPLYMNU_STILLBOB = "View bob amount while not moving";
HUDMNU_TITLE = "HUD Options"; HUDMNU_TITLE = "HUD Options";
HUDMNU_ALTHUD = "Alternative HUD"; HUDMNU_ALTHUD = "Alternative HUD";
HUDMNU_MESSAGE = "Message Options"; HUDMNU_MESSAGE = "Message Options";
HUDMNU_UISCALE = "User interface scale";
HUDMNU_CROSSHAIR = "Default Crosshair"; HUDMNU_CROSSHAIR = "Default Crosshair";
HUDMNU_FORCECROSSHAIR = "Force default crosshair"; HUDMNU_FORCECROSSHAIR = "Force default crosshair";
HUDMNU_GROWCROSSHAIR = "Grow crosshair when picking up items"; HUDMNU_GROWCROSSHAIR = "Grow crosshair when picking up items";

View file

@ -755,6 +755,8 @@ OptionMenu "HUDOptions"
Submenu "$HUDMNU_ALTHUD", "AltHudOptions" Submenu "$HUDMNU_ALTHUD", "AltHudOptions"
Submenu "$HUDMNU_MESSAGE", "MessageOptions" Submenu "$HUDMNU_MESSAGE", "MessageOptions"
StaticText " " StaticText " "
Slider "$HUDMNU_UISCALE", "uiscale", 0.0, 8.0, 1.0, 0
StaticText " "
Option "$HUDMNU_CROSSHAIR", "crosshair", "Crosshairs" Option "$HUDMNU_CROSSHAIR", "crosshair", "Crosshairs"
Option "$HUDMNU_FORCECROSSHAIR", "crosshairforce", "OnOff" Option "$HUDMNU_FORCECROSSHAIR", "crosshairforce", "OnOff"
Option "$HUDMNU_GROWCROSSHAIR", "crosshairgrow", "OnOff" Option "$HUDMNU_GROWCROSSHAIR", "crosshairgrow", "OnOff"
@ -789,6 +791,7 @@ OptionValue "AMCoordinates"
OptionValue "AltHUDScale" OptionValue "AltHUDScale"
{ {
0, "$OPTVAL_OFF" 0, "$OPTVAL_OFF"
4, "$OPTVAL_ON"
1, "$OPTVAL_SCALETO640X400" 1, "$OPTVAL_SCALETO640X400"
2, "$OPTVAL_PIXELDOUBLE" 2, "$OPTVAL_PIXELDOUBLE"
3, "$OPTVAL_PIXELQUADRUPLE" 3, "$OPTVAL_PIXELQUADRUPLE"