mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-02-22 12:01:13 +00:00
- validate text data before drawing the console.
This commit is contained in:
parent
ffa7891719
commit
30c2524742
1 changed files with 37 additions and 34 deletions
|
@ -648,48 +648,51 @@ void C_DrawConsole ()
|
||||||
conbuffer->FormatText(CurrentConsoleFont, ConWidth / textScale);
|
conbuffer->FormatText(CurrentConsoleFont, ConWidth / textScale);
|
||||||
unsigned int consolelines = conbuffer->GetFormattedLineCount();
|
unsigned int consolelines = conbuffer->GetFormattedLineCount();
|
||||||
FBrokenLines *blines = conbuffer->GetLines();
|
FBrokenLines *blines = conbuffer->GetLines();
|
||||||
FBrokenLines *printline = blines + consolelines - 1 - RowAdjust;
|
if (blines != nullptr)
|
||||||
|
|
||||||
int bottomline = ConBottom / textScale - CurrentConsoleFont->GetHeight()*2 - 4;
|
|
||||||
|
|
||||||
for(FBrokenLines *p = printline; p >= blines && lines > 0; p--, lines--)
|
|
||||||
{
|
{
|
||||||
if (textScale == 1)
|
FBrokenLines* printline = blines + consolelines - 1 - RowAdjust;
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ConBottom >= 20)
|
int bottomline = ConBottom / textScale - CurrentConsoleFont->GetHeight() * 2 - 4;
|
||||||
{
|
|
||||||
if (gamestate != GS_STARTUP)
|
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)
|
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
|
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_VirtualWidth, twod->GetWidth() / textScale,
|
||||||
DTA_VirtualHeight, twod->GetHeight() / textScale,
|
DTA_VirtualHeight, twod->GetHeight() / textScale,
|
||||||
DTA_KeepRatio, true, TAG_DONE);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue