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

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

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);
}