- use the 2d drawer's size where appropriate.

This commit is contained in:
Christoph Oelckers 2020-04-11 19:48:14 +02:00
parent b18faacab0
commit ce4c2be3c7
17 changed files with 116 additions and 118 deletions

View file

@ -1187,11 +1187,11 @@ void DAutomap::findMinMaxBoundaries ()
void DAutomap::calcMinMaxMtoF()
{
const double safe_frame = 1.0 - am_emptyspacemargin / 100.0;
double a = safe_frame * (SCREENWIDTH / max_w);
double a = safe_frame * (twod->GetWidth() / max_w);
double b = safe_frame * (StatusBar->GetTopOfStatusbar() / max_h);
min_scale_mtof = a < b ? a : b;
max_scale_mtof = SCREENHEIGHT / (2*PLAYERRADIUS);
max_scale_mtof = twod->GetHeight() / (2*PLAYERRADIUS);
}
//=============================================================================
@ -1274,8 +1274,8 @@ void DAutomap::changeWindowLoc ()
incx = m_paninc.x;
incy = m_paninc.y;
oincx = incx = m_paninc.x * SCREENWIDTH / 320;
oincy = incy = m_paninc.y * SCREENHEIGHT / 200;
oincx = incx = m_paninc.x * twod->GetWidth() / 320;
oincy = incy = m_paninc.y * twod->GetHeight() / 200;
if (am_rotate == 1 || (am_rotate == 2 && viewactive))
{
rotate(&incx, &incy, players[consoleplayer].camera->Angles.Yaw - 90.);
@ -1305,8 +1305,8 @@ void DAutomap::startDisplay()
m_paninc.x = m_paninc.y = 0;
mtof_zoommul = 1.;
m_w = FTOM(SCREENWIDTH);
m_h = FTOM(SCREENHEIGHT);
m_w = FTOM(twod->GetWidth());
m_h = FTOM(twod->GetHeight());
// find player to center on initially
if (!playeringame[pnum = consoleplayer])

View file

@ -99,7 +99,7 @@ void FStat::PrintStat (F2DDrawer *drawer)
int textScale = active_con_scale(drawer);
int fontheight = NewConsoleFont->GetHeight() + 1;
int y = screen->GetHeight() / textScale;
int y = drawer->GetHeight() / textScale;
int count = 0;
for (FStat *stat = FirstStat; stat != NULL; stat = stat->m_Next)

View file

@ -221,13 +221,13 @@ public:
{
DrawChar(twod, CurrentConsoleFont, CR_ORANGE, x, y, '\x1c',
DTA_VirtualWidth, twod->GetWidth() / scale,
DTA_VirtualHeight, screen->GetHeight() / scale,
DTA_VirtualHeight, twod->GetHeight() / scale,
DTA_KeepRatio, true, TAG_DONE);
DrawText(twod, CurrentConsoleFont, CR_ORANGE, x + CurrentConsoleFont->GetCharWidth(0x1c), y,
&Text[StartPos],
DTA_VirtualWidth, twod->GetWidth() / scale,
DTA_VirtualHeight, screen->GetHeight() / scale,
DTA_VirtualHeight, twod->GetHeight() / scale,
DTA_KeepRatio, true, TAG_DONE);
if (cursor)
@ -236,7 +236,7 @@ public:
x + CurrentConsoleFont->GetCharWidth(0x1c) + (CursorPosCells - StartPosCells) * CurrentConsoleFont->GetCharWidth(0xb),
y, '\xb',
DTA_VirtualWidth, twod->GetWidth() / scale,
DTA_VirtualHeight, screen->GetHeight() / scale,
DTA_VirtualHeight, twod->GetHeight() / scale,
DTA_KeepRatio, true, TAG_DONE);
}
}
@ -993,14 +993,14 @@ void C_FlushDisplay ()
void C_AdjustBottom ()
{
if (gamestate == GS_FULLCONSOLE || gamestate == GS_STARTUP)
ConBottom = SCREENHEIGHT;
else if (ConBottom > SCREENHEIGHT / 2 || ConsoleState == c_down)
ConBottom = SCREENHEIGHT / 2;
ConBottom = twod->GetHeight();
else if (ConBottom > twod->GetHeight() / 2 || ConsoleState == c_down)
ConBottom = twod->GetHeight() / 2;
}
void C_NewModeAdjust ()
{
C_InitConsole (SCREENWIDTH, SCREENHEIGHT, true);
C_InitConsole (twod->GetWidth(), twod->GetHeight(), true);
C_FlushDisplay ();
C_AdjustBottom ();
}
@ -1023,16 +1023,16 @@ void C_Ticker()
{
if (ConsoleState == c_falling)
{
ConBottom += (consoletic - lasttic) * (SCREENHEIGHT * 2 / 25);
if (ConBottom >= SCREENHEIGHT / 2)
ConBottom += (consoletic - lasttic) * (twod->GetHeight() * 2 / 25);
if (ConBottom >= twod->GetHeight() / 2)
{
ConBottom = SCREENHEIGHT / 2;
ConBottom = twod->GetHeight() / 2;
ConsoleState = c_down;
}
}
else if (ConsoleState == c_rising)
{
ConBottom -= (consoletic - lasttic) * (SCREENHEIGHT * 2 / 25);
ConBottom -= (consoletic - lasttic) * (twod->GetHeight() * 2 / 25);
if (ConBottom <= 0)
{
ConsoleState = c_up;
@ -1116,7 +1116,7 @@ void FNotifyBuffer::Draw()
if (!center)
DrawText(twod, font, color, 0, line, notify.Text,
DTA_VirtualWidth, twod->GetWidth() / scale,
DTA_VirtualHeight, screen->GetHeight() / scale,
DTA_VirtualHeight, twod->GetHeight() / scale,
DTA_KeepRatio, true,
DTA_Alpha, alpha, TAG_DONE);
else
@ -1124,7 +1124,7 @@ void FNotifyBuffer::Draw()
font->StringWidth (notify.Text) * scale) / 2 / scale,
line, notify.Text,
DTA_VirtualWidth, twod->GetWidth() / scale,
DTA_VirtualHeight, screen->GetHeight() / scale,
DTA_VirtualHeight, twod->GetHeight() / scale,
DTA_KeepRatio, true,
DTA_Alpha, alpha, TAG_DONE);
line += lineadv;
@ -1174,14 +1174,14 @@ void C_DrawConsole ()
visheight = ConBottom;
DrawTexture(twod, conpic, 0, visheight - screen->GetHeight(),
DrawTexture(twod, conpic, 0, visheight - twod->GetHeight(),
DTA_DestWidth, twod->GetWidth(),
DTA_DestHeight, screen->GetHeight(),
DTA_DestHeight, twod->GetHeight(),
DTA_ColorOverlay, conshade,
DTA_Alpha, (gamestate != GS_FULLCONSOLE) ? (double)con_alpha : 1.,
DTA_Masked, false,
TAG_DONE);
if (conline && visheight < screen->GetHeight())
if (conline && visheight < twod->GetHeight())
{
ClearRect(twod, 0, visheight, twod->GetWidth(), visheight+1, 0, 0);
}
@ -1189,17 +1189,17 @@ void C_DrawConsole ()
if (ConBottom >= 12)
{
if (textScale == 1)
DrawText(twod, CurrentConsoleFont, CR_ORANGE, SCREENWIDTH - 8 -
DrawText(twod, CurrentConsoleFont, CR_ORANGE, twod->GetWidth() - 8 -
CurrentConsoleFont->StringWidth (GetVersionString()),
ConBottom / textScale - CurrentConsoleFont->GetHeight() - 4,
GetVersionString(), TAG_DONE);
else
DrawText(twod, CurrentConsoleFont, CR_ORANGE, SCREENWIDTH / textScale - 8 -
DrawText(twod, CurrentConsoleFont, CR_ORANGE, twod->GetWidth() / textScale - 8 -
CurrentConsoleFont->StringWidth(GetVersionString()),
ConBottom / textScale - CurrentConsoleFont->GetHeight() - 4,
GetVersionString(),
DTA_VirtualWidth, twod->GetWidth() / textScale,
DTA_VirtualHeight, screen->GetHeight() / textScale,
DTA_VirtualHeight, twod->GetHeight() / textScale,
DTA_KeepRatio, true, TAG_DONE);
}
@ -1231,7 +1231,7 @@ void C_DrawConsole ()
{
DrawText(twod, CurrentConsoleFont, CR_TAN, LEFTMARGIN, offset + lines * CurrentConsoleFont->GetHeight(), p->Text,
DTA_VirtualWidth, twod->GetWidth() / textScale,
DTA_VirtualHeight, screen->GetHeight() / textScale,
DTA_VirtualHeight, twod->GetHeight() / textScale,
DTA_KeepRatio, true, TAG_DONE);
}
}
@ -1257,7 +1257,7 @@ void C_DrawConsole ()
else
DrawChar(twod, CurrentConsoleFont, CR_GREEN, 0, bottomline, RowAdjust == conbuffer->GetFormattedLineCount() ? 12 : 10,
DTA_VirtualWidth, twod->GetWidth() / textScale,
DTA_VirtualHeight, screen->GetHeight() / textScale,
DTA_VirtualHeight, twod->GetHeight() / textScale,
DTA_KeepRatio, true, TAG_DONE);
}
}
@ -1378,7 +1378,7 @@ static bool C_HandleKey (event_t *ev, FCommandBuffer &buffer)
case GK_PGUP:
if (ev->data3 & (GKM_SHIFT|GKM_CTRL))
{ // Scroll console buffer up one page
RowAdjust += (SCREENHEIGHT-4)/active_con_scale(twod) /
RowAdjust += (twod->GetHeight()-4)/active_con_scale(twod) /
((gamestate == GS_FULLCONSOLE || gamestate == GS_STARTUP) ? CurrentConsoleFont->GetHeight() : CurrentConsoleFont->GetHeight()*2) - 3;
}
else if (RowAdjust < conbuffer->GetFormattedLineCount())
@ -1401,7 +1401,7 @@ static bool C_HandleKey (event_t *ev, FCommandBuffer &buffer)
case GK_PGDN:
if (ev->data3 & (GKM_SHIFT|GKM_CTRL))
{ // Scroll console buffer down one page
const int scrollamt = (SCREENHEIGHT-4)/active_con_scale(twod) /
const int scrollamt = (twod->GetHeight()-4)/active_con_scale(twod) /
((gamestate == GS_FULLCONSOLE || gamestate == GS_STARTUP) ? CurrentConsoleFont->GetHeight() : CurrentConsoleFont->GetHeight()*2) - 3;
if (RowAdjust < scrollamt)
{

View file

@ -268,11 +268,11 @@ void CT_Drawer (void)
scalex = 1;
int scale = active_con_scaletext(drawer);
int screen_width = SCREENWIDTH / scale;
int screen_height= SCREENHEIGHT / scale;
int screen_width = twod->GetWidth() / scale;
int screen_height= twod->GetHeight() / scale;
int st_y = StatusBar->GetTopOfStatusbar() / scale;
y += ((SCREENHEIGHT == viewheight && viewactive) || gamestate != GS_LEVEL) ? screen_height : st_y;
y += ((twod->GetHeight() == viewheight && viewactive) || gamestate != GS_LEVEL) ? screen_height : st_y;
promptwidth = displayfont->StringWidth (prompt) * scalex;
x = displayfont->GetCharWidth (displayfont->GetCursor()) * scalex * 2 + promptwidth;

View file

@ -1014,7 +1014,7 @@ void D_Display ()
FString pstring = GStrings("TXT_BY");
pstring.Substitute("%s", players[paused - 1].userinfo.GetName());
DrawText(twod, font, CR_RED,
(screen->GetWidth() - font->StringWidth(pstring)*CleanXfac) / 2,
(twod->GetWidth() - font->StringWidth(pstring)*CleanXfac) / 2,
(tex->GetDisplayHeight() * CleanYfac) + 4, pstring, DTA_CleanNoMove, true, TAG_DONE);
}
}

View file

@ -298,8 +298,8 @@ void DHUDMessage::CalcClipCoords(int hudheight)
{ // No clipping rectangle set; use the full screen.
ClipLeft = 0;
ClipTop = 0;
ClipRight = screen->GetWidth();
ClipBot = screen->GetHeight();
ClipRight = twod->GetWidth();
ClipBot = twod->GetHeight();
}
else
{
@ -328,7 +328,7 @@ void DHUDMessage::ResetText (const char *text)
}
else
{
width = SCREENWIDTH / active_con_scaletext(twod);
width = twod->GetWidth() / active_con_scaletext(twod);
}
Lines = V_BreakLines (Font, NoWrap ? INT_MAX : width, (uint8_t *)text);
@ -383,8 +383,8 @@ void DHUDMessage::Draw (int bottom, int visibility)
DrawSetup ();
int screen_width = SCREENWIDTH;
int screen_height = SCREENHEIGHT;
int screen_width = twod->GetWidth();
int screen_height = twod->GetHeight();
xscale = yscale = 1;
if (HUDWidth == 0)
{
@ -494,8 +494,8 @@ void DHUDMessage::DoDraw (int linenum, int x, int y, bool clean, int hudheight)
{
int scale = active_con_scaletext(twod);
DrawText(twod, Font, TextColor, x, y, Lines[linenum].Text,
DTA_VirtualWidth, SCREENWIDTH / scale,
DTA_VirtualHeight, SCREENHEIGHT / scale,
DTA_VirtualWidth, twod->GetWidth() / scale,
DTA_VirtualHeight, twod->GetHeight() / scale,
DTA_Alpha, Alpha,
DTA_RenderStyle, Style,
DTA_KeepRatio, true,
@ -587,8 +587,8 @@ void DHUDMessageFadeOut::DoDraw (int linenum, int x, int y, bool clean, int hudh
{
int scale = active_con_scaletext(twod);
DrawText(twod, Font, TextColor, x, y, Lines[linenum].Text,
DTA_VirtualWidth, SCREENWIDTH / scale,
DTA_VirtualHeight, SCREENHEIGHT / scale,
DTA_VirtualWidth, twod->GetWidth() / scale,
DTA_VirtualHeight, twod->GetHeight() / scale,
DTA_Alpha, trans,
DTA_RenderStyle, Style,
DTA_KeepRatio, true,
@ -676,8 +676,8 @@ void DHUDMessageFadeInOut::DoDraw (int linenum, int x, int y, bool clean, int hu
{
int scale = active_con_scaletext(twod);
DrawText(twod, Font, TextColor, x, y, Lines[linenum].Text,
DTA_VirtualWidth, SCREENWIDTH / scale,
DTA_VirtualHeight, SCREENHEIGHT / scale,
DTA_VirtualWidth, twod->GetWidth() / scale,
DTA_VirtualHeight, twod->GetHeight() / scale,
DTA_Alpha, trans,
DTA_RenderStyle, Style,
DTA_KeepRatio, true,
@ -860,8 +860,8 @@ void DHUDMessageTypeOnFadeOut::DoDraw (int linenum, int x, int y, bool clean, in
{
int scale = active_con_scaletext(twod);
DrawText(twod, Font, TextColor, x, y, Lines[linenum].Text,
DTA_VirtualWidth, SCREENWIDTH / scale,
DTA_VirtualHeight, SCREENHEIGHT / scale,
DTA_VirtualWidth, twod->GetWidth() / scale,
DTA_VirtualHeight, twod->GetHeight() / scale,
DTA_KeepRatio, true,
DTA_TextLen, LineVisible,
DTA_Alpha, Alpha,

View file

@ -965,11 +965,11 @@ void Popup::close()
inline void adjustRelCenter(bool relX, bool relY, const double &x, const double &y, double &outX, double &outY, double ScaleX, double ScaleY)
{
if(relX)
outX = x + (SCREENWIDTH/(ScaleX*2));
outX = x + (twod->GetWidth()/(ScaleX*2));
else
outX = x;
if(relY)
outY = y + (SCREENHEIGHT/(ScaleY*2));
outY = y + (twod->GetHeight()/(ScaleY*2));
else
outY = y;
}
@ -1294,9 +1294,9 @@ public:
h *= Scale.Y;
if(xright)
rx = SCREENWIDTH + rx;
rx = twod->GetWidth() + rx;
if(ybot)
ry = SCREENHEIGHT + ry;
ry = twod->GetHeight() + ry;
// Check for clipping
if(clip[0] != 0 || clip[1] != 0 || clip[2] != 0 || clip[3] != 0)
@ -1442,9 +1442,9 @@ public:
rh *= Scale.Y;
if(xright)
rx = SCREENWIDTH + rx;
rx = twod->GetWidth() + rx;
if(ybot)
ry = SCREENHEIGHT + ry;
ry = twod->GetHeight() + ry;
}
if(drawshadow)
{

View file

@ -1972,7 +1972,7 @@ class CommandAspectRatio : public SBarInfoCommandFlowControl
private:
int FindRatio()
{
float aspect = ActiveRatio(screen->GetWidth(), screen->GetHeight());
float aspect = ActiveRatio(twod->GetWidth(), twod->GetHeight());
static std::pair<float, int> ratioTypes[] =
{

View file

@ -165,8 +165,8 @@ void DBaseStatusBar::DrawAltHUD()
players[consoleplayer].inventorytics = 0;
int scale = GetUIScale(twod, hud_althudscale);
int hudwidth = SCREENWIDTH / scale;
int hudheight = hud_aspectscale ? int(SCREENHEIGHT / (scale*1.2)) : SCREENHEIGHT / scale;
int hudwidth = twod->GetWidth() / scale;
int hudheight = hud_aspectscale ? int(twod->GetHeight() / (scale*1.2)) : twod->GetHeight() / scale;
IFVM(AltHud, Draw)
{

View file

@ -178,7 +178,7 @@ void ST_LoadCrosshair(bool alwaysload)
{
num = -num;
}
size = (SCREENWIDTH < 640) ? 'S' : 'B';
size = (twod->GetWidth() < 640) ? 'S' : 'B';
mysnprintf (name, countof(name), "XHAIR%c%d", size, num);
FTextureID texid = TexMan.CheckForTexture(name, ETextureType::MiscPatch, FTextureManager::TEXMAN_TryAny | FTextureManager::TEXMAN_ShortNameOnly);
@ -430,7 +430,7 @@ void DBaseStatusBar::SetDrawSize(int reltop, int hres, int vres)
HorizontalResolution = hres;
VerticalResolution = vres;
int x, y;
ST_CalcCleanFacs(hres, vres, SCREENWIDTH, SCREENHEIGHT, &x, &y);
ST_CalcCleanFacs(hres, vres, twod->GetWidth(), twod->GetHeight(), &x, &y);
defaultScale = { (double)x, (double)y };
SetScale(); // recalculate positioning info.
@ -471,8 +471,8 @@ void DBaseStatusBar::SetScale ()
{
ValidateResolution(HorizontalResolution, VerticalResolution);
int w = SCREENWIDTH;
int h = SCREENHEIGHT;
int w = twod->GetWidth();
int h = twod->GetHeight();
if (st_scale < 0 || ForcedScale)
{
// This is the classic fullscreen scale with aspect ratio compensation.
@ -593,7 +593,7 @@ void DBaseStatusBar::DoDrawAutomapHUD(int crdefault, int highlight)
auto font = generic_ui ? NewSmallFont : SmallFont;
auto font2 = font;
auto vwidth = twod->GetWidth() / scale;
auto vheight = screen->GetHeight() / scale;
auto vheight = twod->GetHeight() / scale;
auto fheight = font->GetHeight();
FString textbuffer;
int sec;
@ -680,7 +680,7 @@ void DBaseStatusBar::DoDrawAutomapHUD(int crdefault, int highlight)
StatusbarToRealCoords(x, yy, w, h);
// Get the y coordinate for the first line of the map name text.
y = Scale(GetTopOfStatusbar() - int(h), vheight, screen->GetHeight()) - fheight * numlines;
y = Scale(GetTopOfStatusbar() - int(h), vheight, twod->GetHeight()) - fheight * numlines;
// Draw the texts centered above the status bar.
for (unsigned i = 0; i < numlines; i++)
@ -978,40 +978,40 @@ void DBaseStatusBar::RefreshBackground () const
{
int x, x2, y;
float ratio = ActiveRatio (SCREENWIDTH, SCREENHEIGHT);
float ratio = ActiveRatio (twod->GetWidth(), twod->GetHeight());
x = ST_X;
y = SBarTop;
if (x == 0 && y == SCREENHEIGHT) return;
if (x == 0 && y == twod->GetHeight()) return;
auto tex = GetBorderTexture(primaryLevel);
if(!CompleteBorder)
{
if(y < SCREENHEIGHT)
if(y < twod->GetHeight())
{
DrawBorder(twod, tex, x+1, y, SCREENWIDTH, y+1);
DrawBorder(twod, tex, x+1, SCREENHEIGHT-1, SCREENWIDTH, SCREENHEIGHT);
DrawBorder(twod, tex, x+1, y, twod->GetWidth(), y+1);
DrawBorder(twod, tex, x+1, twod->GetHeight()-1, twod->GetWidth(), twod->GetHeight());
}
}
else
{
x = SCREENWIDTH;
x = twod->GetWidth();
}
if (x > 0)
{
if(!CompleteBorder)
{
x2 = SCREENWIDTH - ST_X;
x2 = twod->GetWidth() - ST_X;
}
else
{
x2 = SCREENWIDTH;
x2 = twod->GetWidth();
}
DrawBorder(twod, tex, 0, y, x+1, SCREENHEIGHT);
DrawBorder(twod, tex, x2-1, y, SCREENWIDTH, SCREENHEIGHT);
DrawBorder(twod, tex, 0, y, x+1, twod->GetHeight());
DrawBorder(twod, tex, x2-1, y, twod->GetWidth(), twod->GetHeight());
if (setblocks >= 10)
{
@ -1019,7 +1019,7 @@ void DBaseStatusBar::RefreshBackground () const
if (p != NULL)
{
twod->AddFlatFill(0, y, x, y + p->GetDisplayHeight(), p, true);
twod->AddFlatFill(x2, y, SCREENWIDTH, y + p->GetDisplayHeight(), p, true);
twod->AddFlatFill(x2, y, twod->GetWidth(), y + p->GetDisplayHeight(), p, true);
}
}
}
@ -1058,7 +1058,7 @@ void DBaseStatusBar::DrawCrosshair ()
if (crosshairscale > 0.0f)
{
size = SCREENHEIGHT * crosshairscale / 200.;
size = twod->GetHeight() * crosshairscale / 200.;
}
else
{
@ -1234,8 +1234,8 @@ void DBaseStatusBar::DrawLog ()
{
// This uses the same scaling as regular HUD messages
auto scale = active_con_scaletext(twod, generic_ui || log_vgafont);
hudwidth = SCREENWIDTH / scale;
hudheight = SCREENHEIGHT / scale;
hudwidth = twod->GetWidth() / scale;
hudheight = twod->GetHeight() / scale;
FFont *font = (generic_ui || log_vgafont)? NewSmallFont : SmallFont;
int linelen = hudwidth<640? Scale(hudwidth,9,10)-40 : 560;
@ -1259,8 +1259,8 @@ void DBaseStatusBar::DrawLog ()
if (y<0) y=0;
w=600;
}
Dim(twod, 0, 0.5f, Scale(x, SCREENWIDTH, hudwidth), Scale(y, SCREENHEIGHT, hudheight),
Scale(w, SCREENWIDTH, hudwidth), Scale(height, SCREENHEIGHT, hudheight));
Dim(twod, 0, 0.5f, Scale(x, twod->GetWidth(), hudwidth), Scale(y, twod->GetHeight(), hudheight),
Scale(w, twod->GetWidth(), hudwidth), Scale(height, twod->GetHeight(), hudheight));
x+=20;
y+=10;
for (const FBrokenLines &line : lines)
@ -1305,7 +1305,7 @@ void DBaseStatusBar::SetMugShotState(const char *stateName, bool waitTillDone, b
void DBaseStatusBar::DrawBottomStuff (EHudState state)
{
primaryLevel->localEventManager->RenderUnderlay(state);
DrawMessages (HUDMSGLayer_UnderHUD, (state == HUD_StatusBar) ? GetTopOfStatusbar() : SCREENHEIGHT);
DrawMessages (HUDMSGLayer_UnderHUD, (state == HUD_StatusBar) ? GetTopOfStatusbar() : twod->GetHeight());
}
//---------------------------------------------------------------------------
@ -1338,9 +1338,9 @@ void DBaseStatusBar::DrawTopStuff (EHudState state)
if (automapactive && !viewactive)
{
DrawMessages (HUDMSGLayer_OverMap, (state == HUD_StatusBar) ? GetTopOfStatusbar() : SCREENHEIGHT);
DrawMessages (HUDMSGLayer_OverMap, (state == HUD_StatusBar) ? GetTopOfStatusbar() : twod->GetHeight());
}
DrawMessages (HUDMSGLayer_OverHUD, (state == HUD_StatusBar) ? GetTopOfStatusbar() : SCREENHEIGHT);
DrawMessages (HUDMSGLayer_OverHUD, (state == HUD_StatusBar) ? GetTopOfStatusbar() : twod->GetHeight());
primaryLevel->localEventManager->RenderOverlay(state);
DrawConsistancy ();
@ -1629,8 +1629,8 @@ void DBaseStatusBar::DrawGraphic(FTextureID texture, double x, double y, int fla
switch (flags & DI_SCREEN_VMASK)
{
default: orgy = 0; break;
case DI_SCREEN_VCENTER: orgy = screen->GetHeight() / 2; break;
case DI_SCREEN_BOTTOM: orgy = screen->GetHeight(); break;
case DI_SCREEN_VCENTER: orgy = twod->GetHeight() / 2; break;
case DI_SCREEN_BOTTOM: orgy = twod->GetHeight(); break;
}
// move stuff in the top right corner a bit down if the fps counter is on.
@ -1712,8 +1712,8 @@ void DBaseStatusBar::DrawString(FFont *font, const FString &cstring, double x, d
switch (flags & DI_SCREEN_VMASK)
{
default: orgy = 0; break;
case DI_SCREEN_VCENTER: orgy = screen->GetHeight() / 2; break;
case DI_SCREEN_BOTTOM: orgy = screen->GetHeight(); break;
case DI_SCREEN_VCENTER: orgy = twod->GetHeight() / 2; break;
case DI_SCREEN_BOTTOM: orgy = twod->GetHeight(); break;
}
// move stuff in the top right corner a bit down if the fps counter is on.
@ -1873,8 +1873,8 @@ void DBaseStatusBar::TransformRect(double &x, double &y, double &w, double &h, i
switch (flags & DI_SCREEN_VMASK)
{
default: orgy = 0; break;
case DI_SCREEN_VCENTER: orgy = screen->GetHeight() / 2; break;
case DI_SCREEN_BOTTOM: orgy = screen->GetHeight(); break;
case DI_SCREEN_VCENTER: orgy = twod->GetHeight() / 2; break;
case DI_SCREEN_BOTTOM: orgy = twod->GetHeight(); break;
}
// move stuff in the top right corner a bit down if the fps counter is on.

View file

@ -245,7 +245,7 @@ void HU_GetPlayerWidths(int &maxnamewidth, int &maxscorewidth, int &maxiconheigh
static void HU_DrawFontScaled(double x, double y, int color, const char *text)
{
DrawText(twod, displayFont, color, x / FontScale, y / FontScale, text, DTA_VirtualWidth, screen->GetWidth() / FontScale, DTA_VirtualHeight, screen->GetHeight() / FontScale, TAG_END);
DrawText(twod, displayFont, color, x / FontScale, y / FontScale, text, DTA_VirtualWidth, twod->GetWidth() / FontScale, DTA_VirtualHeight, twod->GetHeight() / FontScale, TAG_END);
}
static void HU_DoDrawScores (player_t *player, player_t *sortedplayers[MAXPLAYERS])
@ -303,7 +303,7 @@ static void HU_DoDrawScores (player_t *player, player_t *sortedplayers[MAXPLAYER
}
}
int scorexwidth = SCREENWIDTH / MAX(8, numTeams);
int scorexwidth = twod->GetWidth() / MAX(8, numTeams);
int numscores = 0;
int scorex;
@ -315,7 +315,7 @@ static void HU_DoDrawScores (player_t *player, player_t *sortedplayers[MAXPLAYER
}
}
scorex = (SCREENWIDTH - scorexwidth * (numscores - 1)) / 2;
scorex = (twod->GetWidth() - scorexwidth * (numscores - 1)) / 2;
for (i = 0; i < Teams.Size(); ++i)
{
@ -344,7 +344,7 @@ static void HU_DoDrawScores (player_t *player, player_t *sortedplayers[MAXPLAYER
col3 = col2 + (displayFont->StringWidth(text_frags) + 16) * FontScale;
col4 = col3 + maxscorewidth * FontScale;
col5 = col4 + (maxnamewidth + 16) * FontScale;
x = (SCREENWIDTH >> 1) - (((displayFont->StringWidth(text_delay) * FontScale) + col5) >> 1);
x = (twod->GetWidth() >> 1) - (((displayFont->StringWidth(text_delay) * FontScale) + col5) >> 1);
//HU_DrawFontScaled(x, y, color, text_color);
HU_DrawFontScaled(x + col2, y, color, text_frags);
@ -392,7 +392,7 @@ static void HU_DrawTimeRemaining (int y)
else
mysnprintf (str, countof(str), "Level ends in %d:%02d", minutes, seconds);
HU_DrawFontScaled(SCREENWIDTH / 2 - displayFont->StringWidth(str) / 2 * FontScale, y, CR_GRAY, str);
HU_DrawFontScaled(twod->GetWidth() / 2 - displayFont->StringWidth(str) / 2 * FontScale, y, CR_GRAY, str);
}
}
@ -469,9 +469,6 @@ void HU_DrawColorBar(int x, int y, int height, int playernum)
D_GetPlayerColor (playernum, &h, &s, &v, NULL);
HSVtoRGB (&r, &g, &b, h, s, v);
//float aspect = ActiveRatio(SCREENWIDTH, SCREENHEIGHT);
//if (!AspectTallerThanWide(aspect)) x += (screen->GetWidth() - AspectBaseWidth(aspect)) / 2;
ClearRect(twod, x, y, x + 24*FontScale, y + height, -1,
MAKEARGB(255,clamp(int(r*255.f),0,255),
clamp(int(g*255.f),0,255),

View file

@ -84,8 +84,8 @@ void DrawFullscreenSubtitle(const char *text)
// This uses the same scaling as regular HUD messages
auto scale = active_con_scaletext(twod, generic_ui);
int hudwidth = SCREENWIDTH / scale;
int hudheight = SCREENHEIGHT / scale;
int hudwidth = twod->GetWidth() / scale;
int hudheight = twod->GetHeight() / scale;
FFont *font = generic_ui? NewSmallFont : SmallFont;
int linelen = hudwidth < 640 ? Scale(hudwidth, 9, 10) - 40 : 560;
@ -109,8 +109,8 @@ void DrawFullscreenSubtitle(const char *text)
if (y < 0) y = 0;
w = 600;
}
Dim(twod, 0, 0.5f, Scale(x, SCREENWIDTH, hudwidth), Scale(y, SCREENHEIGHT, hudheight),
Scale(w, SCREENWIDTH, hudwidth), Scale(height, SCREENHEIGHT, hudheight));
Dim(twod, 0, 0.5f, Scale(x, twod->GetWidth(), hudwidth), Scale(y, twod->GetHeight(), hudheight),
Scale(w, twod->GetWidth(), hudwidth), Scale(height, twod->GetHeight(), hudheight));
x += 20;
y += 10;
for (const FBrokenLines &line : lines)
@ -220,12 +220,12 @@ void DIntermissionScreen::Drawer ()
}
else
{
twod->AddFlatFill(0,0, SCREENWIDTH, SCREENHEIGHT, TexMan.GetTexture(mBackground));
twod->AddFlatFill(0,0, twod->GetWidth(), twod->GetHeight(), TexMan.GetTexture(mBackground));
}
}
else
{
ClearRect(twod, 0, 0, SCREENWIDTH, SCREENHEIGHT, 0, 0);
ClearRect(twod, 0, 0, twod->GetWidth(), twod->GetHeight(), 0, 0);
}
for (unsigned i=0; i < mOverlays.Size(); i++)
{
@ -375,9 +375,9 @@ void DIntermissionScreenText::Drawer ()
// line feed characters.
int numrows;
auto font = generic_ui ? NewSmallFont : SmallFont;
auto fontscale = MAX(generic_ui ? MIN(screen->GetWidth() / 640, screen->GetHeight() / 400) : MIN(screen->GetWidth() / 400, screen->GetHeight() / 250), 1);
int cleanwidth = screen->GetWidth() / fontscale;
int cleanheight = screen->GetHeight() / fontscale;
auto fontscale = MAX(generic_ui ? MIN(twod->GetWidth() / 640, twod->GetHeight() / 400) : MIN(twod->GetWidth() / 400, twod->GetHeight() / 250), 1);
int cleanwidth = twod->GetWidth() / fontscale;
int cleanheight = twod->GetHeight() / fontscale;
int refwidth = generic_ui ? 640 : 320;
int refheight = generic_ui ? 400 : 200;
const int kerning = font->GetDefaultKerning();
@ -390,29 +390,29 @@ void DIntermissionScreenText::Drawer ()
int rowheight = font->GetHeight() * fontscale;
int rowpadding = (generic_ui? 2 : ((gameinfo.gametype & (GAME_DoomStrifeChex) ? 3 : -1))) * fontscale;
int cx = (mTextX - refwidth/2) * fontscale + screen->GetWidth() / 2;
int cy = (mTextY - refheight/2) * fontscale + screen->GetHeight() / 2;
int cx = (mTextX - refwidth/2) * fontscale + twod->GetWidth() / 2;
int cy = (mTextY - refheight/2) * fontscale + twod->GetHeight() / 2;
cx = MAX<int>(0, cx);
int startx = cx;
if (usesDefault)
{
int allheight;
while ((allheight = numrows * (rowheight + rowpadding)), allheight > screen->GetHeight() && rowpadding > 0)
while ((allheight = numrows * (rowheight + rowpadding)), allheight > twod->GetHeight() && rowpadding > 0)
{
rowpadding--;
}
allheight = numrows * (rowheight + rowpadding);
if (screen->GetHeight() - cy - allheight < cy)
if (twod->GetHeight() - cy - allheight < cy)
{
cy = (screen->GetHeight() - allheight) / 2;
cy = (twod->GetHeight() - allheight) / 2;
if (cy < 0) cy = 0;
}
}
else
{
// Does this text fall off the end of the screen? If so, try to eliminate some margins first.
while (rowpadding > 0 && cy + numrows * (rowheight + rowpadding) - rowpadding > screen->GetHeight())
while (rowpadding > 0 && cy + numrows * (rowheight + rowpadding) - rowpadding > twod->GetHeight())
{
rowpadding--;
}
@ -438,7 +438,7 @@ void DIntermissionScreenText::Drawer ()
pic = font->GetChar (c, mTextColor, &w);
w += kerning;
w *= fontscale;
if (cx + w > SCREENWIDTH)
if (cx + w > twod->GetWidth())
continue;
DrawChar(twod, font, mTextColor, cx/fontscale, cy/fontscale, c, DTA_KeepRatio, true, DTA_VirtualWidth, cleanwidth, DTA_VirtualHeight, cleanheight, TAG_DONE);
@ -630,8 +630,8 @@ void DIntermissionScreenCast::Drawer ()
auto font = generic_ui ? NewSmallFont : SmallFont;
if (*name == '$') name = GStrings(name+1);
DrawText(twod, font, CR_UNTRANSLATED,
(SCREENWIDTH - font->StringWidth (name) * CleanXfac)/2,
(SCREENHEIGHT * 180) / 200,
(twod->GetWidth() - font->StringWidth (name) * CleanXfac)/2,
(twod->GetHeight() * 180) / 200,
name,
DTA_CleanNoMove, true, TAG_DONE);
}

View file

@ -878,7 +878,7 @@ static void M_Dim()
amount = gameinfo.dimamount;
}
Dim(twod, dimmer, amount, 0, 0, screen->GetWidth(), screen->GetHeight());
Dim(twod, dimmer, amount, 0, 0, twod->GetWidth(), twod->GetHeight());
}

View file

@ -96,7 +96,7 @@ void Draw2D(F2DDrawer *drawer, FRenderState &state)
const auto &mScreenViewport = screen->mScreenViewport;
state.SetViewport(mScreenViewport.left, mScreenViewport.top, mScreenViewport.width, mScreenViewport.height);
screen->mViewpoints->Set2D(state, screen->GetWidth(), screen->GetHeight());
screen->mViewpoints->Set2D(state, twod->GetWidth(), twod->GetHeight());
state.EnableDepthTest(false);
state.EnableMultisampling(false);

View file

@ -113,6 +113,7 @@ void DFrameBuffer::SetSize(int width, int height)
{
Width = ViewportScaledWidth(width, height);
Height = ViewportScaledHeight(width, height);
m2DDrawer.SetSize(width, height);
}
//==========================================================================

View file

@ -1273,7 +1273,7 @@ void DoomSoundEngine::NoiseDebug()
for (chan = Channels; chan->NextChan != nullptr; chan = chan->NextChan)
{
}
while (y < SCREENHEIGHT - 16)
while (y < twod->GetHeight() - 16)
{
char temp[32];

View file

@ -604,12 +604,12 @@ void DInterBackground::drawBackground(int state, bool drawsplat, bool snl_pointe
}
else
{
twod->AddFlatFill(0, 0, SCREENWIDTH, SCREENHEIGHT, background);
twod->AddFlatFill(0, 0, twod->GetWidth(), twod->GetHeight(), background);
}
}
else
{
ClearRect(twod, 0, 0, SCREENWIDTH, SCREENHEIGHT, 0, 0);
ClearRect(twod, 0, 0, twod->GetWidth(), twod->GetHeight(), 0, 0);
}
for (i = 0; i<anims.Size(); i++)