Add con_scale for scaling just the console

This commit is contained in:
Magnus Norddahl 2016-09-07 11:34:49 +02:00 committed by Christoph Oelckers
parent d2f8fc63fc
commit e794e59cd2
8 changed files with 82 additions and 57 deletions

View file

@ -165,7 +165,20 @@ CUSTOM_CVAR (Int, con_scaletext, 1, CVAR_ARCHIVE) // Scale notify text at high
if (self > 3) self = 3;
}
int con_uiscale()
CUSTOM_CVAR(Int, con_scale, 0, CVAR_ARCHIVE)
{
if (self < 0) self = 0;
}
int active_con_scale()
{
if (con_scale == 0)
return uiscale;
else
return con_scale;
}
int active_con_scaletext()
{
switch (con_scaletext)
{
@ -505,13 +518,13 @@ void C_AddNotifyString (int printlevel, const char *source)
return;
}
if (con_uiscale() == 0)
if (active_con_scaletext() == 0)
{
width = DisplayWidth / CleanXfac;
}
else
{
width = DisplayWidth / con_uiscale();
width = DisplayWidth / active_con_scaletext();
}
if (addtype == APPENDLINE && NotifyStrings[NUMNOTIFIES-1].PrintLevel == printlevel)
@ -733,7 +746,7 @@ static void C_DrawNotifyText ()
canskip = true;
lineadv = SmallFont->GetHeight ();
if (con_uiscale() == 0)
if (active_con_scaletext() == 0)
{
lineadv *= CleanYfac;
}
@ -767,7 +780,7 @@ static void C_DrawNotifyText ()
else
color = PrintColors[NotifyStrings[i].PrintLevel];
if (con_uiscale() == 0)
if (active_con_scaletext() == 0)
{
if (!center)
screen->DrawText (SmallFont, color, 0, line, NotifyStrings[i].Text,
@ -778,7 +791,7 @@ static void C_DrawNotifyText ()
line, NotifyStrings[i].Text, DTA_CleanNoMove, true,
DTA_AlphaF, alpha, TAG_DONE);
}
else if (con_uiscale() == 1)
else if (active_con_scaletext() == 1)
{
if (!center)
screen->DrawText (SmallFont, color, 0, line, NotifyStrings[i].Text,
@ -793,16 +806,16 @@ static void C_DrawNotifyText ()
{
if (!center)
screen->DrawText (SmallFont, color, 0, line, NotifyStrings[i].Text,
DTA_VirtualWidth, screen->GetWidth() / con_uiscale(),
DTA_VirtualHeight, screen->GetHeight() / con_uiscale(),
DTA_VirtualWidth, screen->GetWidth() / active_con_scaletext(),
DTA_VirtualHeight, screen->GetHeight() / active_con_scaletext(),
DTA_KeepRatio, true,
DTA_AlphaF, alpha, TAG_DONE);
else
screen->DrawText (SmallFont, color, (screen->GetWidth() / con_uiscale() -
SmallFont->StringWidth (NotifyStrings[i].Text))/ con_uiscale(),
screen->DrawText (SmallFont, color, (screen->GetWidth() / active_con_scaletext() -
SmallFont->StringWidth (NotifyStrings[i].Text))/ active_con_scaletext(),
line, NotifyStrings[i].Text,
DTA_VirtualWidth, screen->GetWidth() / con_uiscale(),
DTA_VirtualHeight, screen->GetHeight() / con_uiscale(),
DTA_VirtualWidth, screen->GetWidth() / active_con_scaletext(),
DTA_VirtualHeight, screen->GetHeight() / active_con_scaletext(),
DTA_KeepRatio, true,
DTA_AlphaF, alpha, TAG_DONE);
}
@ -846,7 +859,7 @@ void C_DrawConsole (bool hw2d)
static int oldbottom = 0;
int lines, left, offset;
int textScale = con_uiscale();
int textScale = active_con_scale();
if (textScale == 0)
textScale = CleanXfac;

View file

@ -46,7 +46,7 @@ EXTERN_CVAR (Bool, sb_cooperative_enable)
EXTERN_CVAR (Bool, sb_deathmatch_enable)
EXTERN_CVAR (Bool, sb_teamdeathmatch_enable)
int con_uiscale();
int active_con_scaletext();
// Public data
@ -226,7 +226,7 @@ void CT_Drawer (void)
int i, x, scalex, y, promptwidth;
y = (viewactive || gamestate != GS_LEVEL) ? -10 : -30;
if (con_uiscale() == 0)
if (active_con_scaletext() == 0)
{
scalex = CleanXfac;
y *= CleanYfac;
@ -237,7 +237,7 @@ void CT_Drawer (void)
}
int screen_width, screen_height, st_y;
if (con_uiscale() == 0)
if (active_con_scaletext() == 0)
{
screen_width = SCREENWIDTH;
screen_height = SCREENHEIGHT;
@ -245,9 +245,9 @@ void CT_Drawer (void)
}
else
{
screen_width = SCREENWIDTH / con_uiscale();
screen_height = SCREENHEIGHT / con_uiscale();
st_y = ST_Y / con_uiscale();
screen_width = SCREENWIDTH / active_con_scaletext();
screen_height = SCREENHEIGHT / active_con_scaletext();
st_y = ST_Y / active_con_scaletext();
}
y += ((SCREENHEIGHT == viewheight && viewactive) || gamestate != GS_LEVEL) ? screen_height : st_y;
@ -274,10 +274,10 @@ void CT_Drawer (void)
// draw the prompt, text, and cursor
ChatQueue[len] = SmallFont->GetCursor();
ChatQueue[len+1] = '\0';
if (con_uiscale() < 2)
if (active_con_scaletext() < 2)
{
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_uiscale() == 0, TAG_DONE);
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
{

View file

@ -42,7 +42,7 @@
#include "farchive.h"
EXTERN_CVAR(Int, con_scaletext)
int con_uiscale();
int active_con_scaletext();
IMPLEMENT_POINTY_CLASS (DHUDMessage)
DECLARE_POINTER(Next)
@ -261,10 +261,10 @@ void DHUDMessage::ResetText (const char *text)
}
else
{
switch (con_uiscale())
switch (active_con_scaletext())
{
case 0: width = SCREENWIDTH / CleanXfac; break;
default: width = SCREENWIDTH / con_uiscale(); break;
default: width = SCREENWIDTH / active_con_scaletext(); break;
}
}
@ -330,7 +330,7 @@ void DHUDMessage::Draw (int bottom, int visibility)
int screen_width = SCREENWIDTH;
int screen_height = SCREENHEIGHT;
if (HUDWidth == 0 && con_uiscale() == 0)
if (HUDWidth == 0 && active_con_scaletext() == 0)
{
clean = true;
xscale = CleanXfac;
@ -341,9 +341,9 @@ void DHUDMessage::Draw (int bottom, int visibility)
xscale = yscale = 1;
if (HUDWidth == 0)
{
screen_width /= con_uiscale();
screen_height /= con_uiscale();
bottom /= con_uiscale();
screen_width /= active_con_scaletext();
screen_height /= active_con_scaletext();
bottom /= active_con_scaletext();
}
}
@ -445,7 +445,7 @@ void DHUDMessage::DoDraw (int linenum, int x, int y, bool clean, int hudheight)
{
if (hudheight == 0)
{
if (con_uiscale() <= 1)
if (active_con_scaletext() <= 1)
{
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_CleanNoMove, clean,
@ -456,8 +456,8 @@ void DHUDMessage::DoDraw (int linenum, int x, int y, bool clean, int hudheight)
else
{
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_VirtualWidth, SCREENWIDTH / con_uiscale(),
DTA_VirtualHeight, SCREENHEIGHT / con_uiscale(),
DTA_VirtualWidth, SCREENWIDTH / active_con_scaletext(),
DTA_VirtualHeight, SCREENHEIGHT / active_con_scaletext(),
DTA_AlphaF, Alpha,
DTA_RenderStyle, Style,
DTA_KeepRatio, true,
@ -548,7 +548,7 @@ void DHUDMessageFadeOut::DoDraw (int linenum, int x, int y, bool clean, int hudh
float trans = float(Alpha * -(Tics - FadeOutTics) / FadeOutTics);
if (hudheight == 0)
{
if (con_uiscale() <= 1)
if (active_con_scaletext() <= 1)
{
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_CleanNoMove, clean,
@ -559,8 +559,8 @@ void DHUDMessageFadeOut::DoDraw (int linenum, int x, int y, bool clean, int hudh
else
{
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_VirtualWidth, SCREENWIDTH / con_uiscale(),
DTA_VirtualHeight, SCREENHEIGHT / con_uiscale(),
DTA_VirtualWidth, SCREENWIDTH / active_con_scaletext(),
DTA_VirtualHeight, SCREENHEIGHT / active_con_scaletext(),
DTA_AlphaF, trans,
DTA_RenderStyle, Style,
DTA_KeepRatio, true,
@ -648,7 +648,7 @@ void DHUDMessageFadeInOut::DoDraw (int linenum, int x, int y, bool clean, int hu
float trans = float(Alpha * Tics / FadeInTics);
if (hudheight == 0)
{
if (con_uiscale() <= 1)
if (active_con_scaletext() <= 1)
{
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_CleanNoMove, clean,
@ -659,8 +659,8 @@ void DHUDMessageFadeInOut::DoDraw (int linenum, int x, int y, bool clean, int hu
else
{
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_VirtualWidth, SCREENWIDTH / con_uiscale(),
DTA_VirtualHeight, SCREENHEIGHT / con_uiscale(),
DTA_VirtualWidth, SCREENWIDTH / active_con_scaletext(),
DTA_VirtualHeight, SCREENHEIGHT / active_con_scaletext(),
DTA_AlphaF, trans,
DTA_RenderStyle, Style,
DTA_KeepRatio, true,
@ -826,7 +826,7 @@ void DHUDMessageTypeOnFadeOut::DoDraw (int linenum, int x, int y, bool clean, in
{
if (hudheight == 0)
{
if (con_uiscale() <= 1)
if (active_con_scaletext() <= 1)
{
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_CleanNoMove, clean,
@ -838,8 +838,8 @@ void DHUDMessageTypeOnFadeOut::DoDraw (int linenum, int x, int y, bool clean, in
else
{
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_VirtualWidth, SCREENWIDTH / con_uiscale(),
DTA_VirtualHeight, SCREENHEIGHT / con_uiscale(),
DTA_VirtualWidth, SCREENWIDTH / active_con_scaletext(),
DTA_VirtualHeight, SCREENHEIGHT / active_con_scaletext(),
DTA_KeepRatio, true,
DTA_TextLen, LineVisible,
DTA_AlphaF, Alpha,

View file

@ -118,7 +118,7 @@ static int hudwidth, hudheight; // current width/height for HUD display
static int statspace;
DVector2 AM_GetPosition();
int con_uiscale();
int active_con_scaletext();
FTextureID GetHUDIcon(PClassInventory *cls)
{
@ -886,15 +886,15 @@ static void DrawCoordinates(player_t * CPlayer)
}
int vwidth, vheight;
if (con_uiscale() == 0)
if (active_con_scaletext() == 0)
{
vwidth = SCREENWIDTH / 2;
vheight = SCREENHEIGHT / 2;
}
else
{
vwidth = SCREENWIDTH / con_uiscale();
vheight = SCREENHEIGHT / con_uiscale();
vwidth = SCREENWIDTH / active_con_scaletext();
vheight = SCREENHEIGHT / active_con_scaletext();
}
int xpos = vwidth - SmallFont->StringWidth("X: -00000")-6;

View file

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

View file

@ -65,7 +65,7 @@
#include "menu/menu.h"
#include "r_data/voxels.h"
int con_uiscale();
int active_con_scale();
FRenderer *Renderer;
@ -858,7 +858,7 @@ void DFrameBuffer::DrawRateStuff ()
int chars;
int rate_x;
int textScale = con_uiscale();
int textScale = active_con_scale();
if (textScale == 0)
textScale = CleanXfac;

View file

@ -1947,6 +1947,7 @@ 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";
@ -2238,6 +2239,7 @@ OPTVAL_ANIMATED = "Animated";
OPTVAL_ROTATED = "Rotated";
OPTVAL_MAPDEFINEDCOLORSONLY = "Map defined colors only";
OPTVAL_DOUBLE = "Double";
OPTVAL_TRIPLE = "Triple";
OPTVAL_QUADRUPLE = "Quadruple";
OPTVAL_ITEMPICKUP = "Item Pickup";
OPTVAL_OBITUARIES = "Obituaries";

View file

@ -1114,6 +1114,15 @@ OptionValue ScaleValues
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"
@ -1137,6 +1146,7 @@ OptionMenu MessageOptions
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"