- validate text data before drawing the console.

This commit is contained in:
Christoph Oelckers 2023-09-14 16:45:06 +02:00
parent ffa7891719
commit 30c2524742

View file

@ -648,48 +648,51 @@ void C_DrawConsole ()
conbuffer->FormatText(CurrentConsoleFont, ConWidth / textScale);
unsigned int consolelines = conbuffer->GetFormattedLineCount();
FBrokenLines *blines = conbuffer->GetLines();
FBrokenLines *printline = blines + consolelines - 1 - RowAdjust;
int bottomline = ConBottom / textScale - CurrentConsoleFont->GetHeight()*2 - 4;
for(FBrokenLines *p = printline; p >= blines && lines > 0; p--, lines--)
if (blines != nullptr)
{
if (textScale == 1)
{
DrawText(twod, CurrentConsoleFont, CR_TAN, LEFTMARGIN, offset + lines * CurrentConsoleFont->GetHeight(), p->Text, TAG_DONE);
}
else
{
DrawText(twod, CurrentConsoleFont, CR_TAN, LEFTMARGIN, offset + lines * CurrentConsoleFont->GetHeight(), p->Text,
DTA_VirtualWidth, twod->GetWidth() / textScale,
DTA_VirtualHeight, twod->GetHeight() / textScale,
DTA_KeepRatio, true, TAG_DONE);
}
}
FBrokenLines* printline = blines + consolelines - 1 - RowAdjust;
if (ConBottom >= 20)
{
if (gamestate != GS_STARTUP)
int bottomline = ConBottom / textScale - CurrentConsoleFont->GetHeight() * 2 - 4;
for (FBrokenLines* p = printline; p >= blines && lines > 0; p--, lines--)
{
auto now = I_msTime();
if (now > CursorTicker)
{
CursorTicker = now + 500;
cursoron = !cursoron;
}
CmdLine.Draw(left, bottomline, textScale, cursoron);
}
if (RowAdjust && ConBottom >= CurrentConsoleFont->GetHeight()*7/2)
{
// Indicate that the view has been scrolled up (10)
// and if we can scroll no further (12)
if (textScale == 1)
DrawChar(twod, CurrentConsoleFont, CR_GREEN, 0, bottomline, RowAdjust == conbuffer->GetFormattedLineCount() ? 12 : 10, TAG_DONE);
{
DrawText(twod, CurrentConsoleFont, CR_TAN, LEFTMARGIN, offset + lines * CurrentConsoleFont->GetHeight(), p->Text, TAG_DONE);
}
else
DrawChar(twod, CurrentConsoleFont, CR_GREEN, 0, bottomline, RowAdjust == conbuffer->GetFormattedLineCount() ? 12 : 10,
{
DrawText(twod, CurrentConsoleFont, CR_TAN, LEFTMARGIN, offset + lines * CurrentConsoleFont->GetHeight(), p->Text,
DTA_VirtualWidth, twod->GetWidth() / textScale,
DTA_VirtualHeight, twod->GetHeight() / textScale,
DTA_KeepRatio, true, TAG_DONE);
}
}
if (ConBottom >= 20)
{
if (gamestate != GS_STARTUP)
{
auto now = I_msTime();
if (now > CursorTicker)
{
CursorTicker = now + 500;
cursoron = !cursoron;
}
CmdLine.Draw(left, bottomline, textScale, cursoron);
}
if (RowAdjust && ConBottom >= CurrentConsoleFont->GetHeight() * 7 / 2)
{
// Indicate that the view has been scrolled up (10)
// and if we can scroll no further (12)
if (textScale == 1)
DrawChar(twod, CurrentConsoleFont, CR_GREEN, 0, bottomline, RowAdjust == conbuffer->GetFormattedLineCount() ? 12 : 10, TAG_DONE);
else
DrawChar(twod, CurrentConsoleFont, CR_GREEN, 0, bottomline, RowAdjust == conbuffer->GetFormattedLineCount() ? 12 : 10,
DTA_VirtualWidth, twod->GetWidth() / textScale,
DTA_VirtualHeight, twod->GetHeight() / textScale,
DTA_KeepRatio, true, TAG_DONE);
}
}
}
}