Adds HUD quadruple scale and a scale slider for the crosshair

This commit is contained in:
Magnus Norddahl 2016-08-05 01:43:56 +02:00 committed by Christoph Oelckers
parent 01fb2eaecc
commit a893013dbb
7 changed files with 150 additions and 14 deletions

View File

@ -162,7 +162,7 @@ CVAR (Bool, con_centernotify, false, CVAR_ARCHIVE)
CUSTOM_CVAR (Int, con_scaletext, 0, CVAR_ARCHIVE) // Scale notify text at high resolutions?
{
if (self < 0) self = 0;
if (self > 2) self = 2;
if (self > 3) self = 3;
}
CUSTOM_CVAR(Float, con_alpha, 0.75f, CVAR_ARCHIVE)
@ -493,7 +493,14 @@ void C_AddNotifyString (int printlevel, const char *source)
return;
}
width = con_scaletext > 1 ? DisplayWidth/2 : con_scaletext == 1 ? DisplayWidth / CleanXfac : DisplayWidth;
switch (con_scaletext)
{
default:
case 0: width = DisplayWidth; break;
case 1: width = DisplayWidth / CleanXfac; break;
case 2: width = DisplayWidth / 2; break;
case 3: width = DisplayWidth / 4; break;
}
if (addtype == APPENDLINE && NotifyStrings[NUMNOTIFIES-1].PrintLevel == printlevel)
{
@ -770,6 +777,23 @@ static void C_DrawNotifyText ()
line, NotifyStrings[i].Text,
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
{
if (!center)

View File

@ -234,9 +234,27 @@ void CT_Drawer (void)
scalex = 1;
}
int screen_width = con_scaletext > 1? SCREENWIDTH/2 : SCREENWIDTH;
int screen_height = con_scaletext > 1? SCREENHEIGHT/2 : SCREENHEIGHT;
int st_y = con_scaletext > 1? ST_Y/2 : ST_Y;
int screen_width, screen_height, st_y;
switch (con_scaletext)
{
default:
case 0:
case 1:
screen_width = SCREENWIDTH;
screen_height = SCREENHEIGHT;
st_y = ST_Y;
break;
case 2:
screen_width = SCREENWIDTH / 2;
screen_height = SCREENHEIGHT / 2;
st_y = ST_Y / 2;
break;
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;

View File

@ -260,7 +260,14 @@ void DHUDMessage::ResetText (const char *text)
}
else
{
width = con_scaletext >= 2 ? SCREENWIDTH/2 : (con_scaletext ? SCREENWIDTH / CleanXfac : SCREENWIDTH);
switch (con_scaletext)
{
default:
case 0: width = SCREENWIDTH; break;
case 1: width = SCREENWIDTH / CleanXfac; break;
case 2: width = SCREENWIDTH / 2; break;
case 3: width = SCREENWIDTH / 4; break;
}
}
if (Lines != NULL)
@ -334,12 +341,18 @@ void DHUDMessage::Draw (int bottom, int visibility)
else
{
xscale = yscale = 1;
if (HUDWidth==0 && con_scaletext>1)
if (HUDWidth==0 && con_scaletext==2)
{
screen_width/=2;
screen_height/=2;
bottom/=2;
}
else if (HUDWidth==0 && con_scaletext==3)
{
screen_width/=4;
screen_height/=4;
bottom/=4;
}
}
if (HUDWidth == 0)
@ -448,6 +461,16 @@ void DHUDMessage::DoDraw (int linenum, int x, int y, bool clean, int hudheight)
DTA_RenderStyle, Style,
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
{
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
@ -551,6 +574,16 @@ void DHUDMessageFadeOut::DoDraw (int linenum, int x, int y, bool clean, int hudh
DTA_RenderStyle, Style,
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
{
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
@ -651,6 +684,16 @@ void DHUDMessageFadeInOut::DoDraw (int linenum, int x, int y, bool clean, int hu
DTA_RenderStyle, Style,
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
{
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
@ -830,6 +873,17 @@ void DHUDMessageTypeOnFadeOut::DoDraw (int linenum, int x, int y, bool clean, in
DTA_RenderStyle, Style,
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
{
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,

View File

@ -885,8 +885,25 @@ static void DrawCoordinates(player_t * CPlayer)
pos = DVector3(apos, z);
}
int vwidth = con_scaletext==0? SCREENWIDTH : SCREENWIDTH/2;
int vheight = con_scaletext==0? SCREENHEIGHT : SCREENHEIGHT/2;
int vwidth, vheight;
switch (con_scaletext)
{
default:
case 0:
vwidth = SCREENWIDTH;
vheight = SCREENWIDTH;
break;
case 1:
case 2:
vwidth = SCREENWIDTH/2;
vheight = SCREENWIDTH/2;
break;
case 3:
vwidth = SCREENWIDTH/4;
vheight = SCREENWIDTH/4;
break;
}
int xpos = vwidth - SmallFont->StringWidth("X: -00000")-6;
int ypos = 18;
@ -1073,7 +1090,12 @@ void DrawHUD()
if (hud_althudscale && SCREENWIDTH>640)
{
hudwidth=SCREENWIDTH/2;
if (hud_althudscale == 2)
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;

View File

@ -108,7 +108,7 @@ CVAR (Int, crosshair, 0, CVAR_ARCHIVE)
CVAR (Bool, crosshairforce, false, CVAR_ARCHIVE)
CVAR (Color, crosshaircolor, 0xff0000, CVAR_ARCHIVE);
CVAR (Bool, crosshairhealth, true, CVAR_ARCHIVE);
CVAR (Bool, crosshairscale, false, CVAR_ARCHIVE);
CVAR (Float, crosshairscale, 1.0, CVAR_ARCHIVE);
CVAR (Bool, crosshairgrow, false, CVAR_ARCHIVE);
CUSTOM_CVAR(Int, am_showmaplabel, 2, CVAR_ARCHIVE)
{
@ -1106,9 +1106,9 @@ void DBaseStatusBar::DrawCrosshair ()
return;
}
if (crosshairscale)
if (crosshairscale > 0.0f)
{
size = SCREENHEIGHT / 200.;
size = SCREENHEIGHT * crosshairscale / 200.;
}
else
{
@ -1247,6 +1247,13 @@ void DBaseStatusBar::Draw (EHudState state)
xpos = vwidth - 80;
y = ::ST_Y - height;
}
else if (con_scaletext == 3)
{
vwidth = SCREENWIDTH/4;
vheight = SCREENHEIGHT/4;
xpos = vwidth - SmallFont->StringWidth("X: -00000")-6;
y = ::ST_Y/4 - height;
}
else
{
vwidth = SCREENWIDTH/2;
@ -1259,6 +1266,8 @@ void DBaseStatusBar::Draw (EHudState state)
{
if (con_scaletext == 0)
y -= height * 4;
else if (con_scaletext == 3)
y -= height;
else
y -= height * 2;
}
@ -1407,6 +1416,11 @@ void DBaseStatusBar::DrawLog ()
hudwidth = SCREENWIDTH / 2;
hudheight = SCREENHEIGHT / 2;
break;
case 3:
hudwidth = SCREENWIDTH / 4;
hudheight = SCREENHEIGHT / 4;
break;
}
int linelen = hudwidth<640? Scale(hudwidth,9,10)-40 : 560;

View File

@ -2197,6 +2197,7 @@ OPTVAL_PLAYER = "Player";
OPTVAL_MAP = "Map";
OPTVAL_SCALETO640X400 = "Scale to 640x400";
OPTVAL_PIXELDOUBLE = "Pixel double";
OPTVAL_PIXELQUADRUPLE = "Pixel quadruple";
OPTVAL_CURRENTWEAPON = "Current weapon";
OPTVAL_AVAILABLEWEAPONS = "Available weapons";
OPTVAL_ALLWEAPONS = "All weapons";
@ -2231,6 +2232,7 @@ OPTVAL_ANIMATED = "Animated";
OPTVAL_ROTATED = "Rotated";
OPTVAL_MAPDEFINEDCOLORSONLY = "Map defined colors only";
OPTVAL_DOUBLE = "Double";
OPTVAL_QUADRUPLE = "Quadruple";
OPTVAL_ITEMPICKUP = "Item Pickup";
OPTVAL_OBITUARIES = "Obituaries";
OPTVAL_CRITICALMESSAGES = "Critical Messages";

View File

@ -760,7 +760,7 @@ OptionMenu "HUDOptions"
Option "$HUDMNU_GROWCROSSHAIR", "crosshairgrow", "OnOff"
ColorPicker "$HUDMNU_CROSSHAIRCOLOR", "crosshaircolor"
Option "$HUDMNU_CROSSHAIRHEALTH", "crosshairhealth", "OnOff"
Option "$HUDMNU_CROSSHAIRSCALE", "crosshairscale", "OnOff"
Slider "$HUDMNU_CROSSHAIRSCALE", "crosshairscale", 0.0, 2.0, 0.05, 2
StaticText " "
Option "$HUDMNU_NAMETAGS", "displaynametags", "DisplayTagsTypes"
Option "$HUDMNU_NAMETAGCOLOR", "nametagcolor", "TextColors", "displaynametags"
@ -791,6 +791,7 @@ OptionValue "AltHUDScale"
0, "$OPTVAL_OFF"
1, "$OPTVAL_SCALETO640X400"
2, "$OPTVAL_PIXELDOUBLE"
3, "$OPTVAL_PIXELQUADRUPLE"
}
OptionValue "AltHUDAmmo"
@ -1107,6 +1108,7 @@ OptionValue ScaleValues
0, "$OPTVAL_OFF"
1, "$OPTVAL_ON"
2, "$OPTVAL_DOUBLE"
3, "$OPTVAL_QUADRUPLE"
}
OptionValue MessageLevels