- made console notification scrolling independent of the global game ticker variable.

This commit is contained in:
Christoph Oelckers 2020-04-11 18:07:33 +02:00
parent d7a9bdc858
commit 5dd89541fe

View file

@ -514,6 +514,7 @@ static int HistSize;
struct FNotifyText struct FNotifyText
{ {
int TimeOut; int TimeOut;
int Ticker;
int PrintLevel; int PrintLevel;
FString Text; FString Text;
}; };
@ -819,7 +820,8 @@ void FNotifyBuffer::AddString(int printlevel, FString source)
FNotifyText newline; FNotifyText newline;
newline.Text = line.Text; newline.Text = line.Text;
newline.TimeOut = gametic + int(con_notifytime * TICRATE); newline.TimeOut = int(con_notifytime * GameTicRate);
newline.Ticker = 0;
newline.PrintLevel = printlevel; newline.PrintLevel = printlevel;
if (AddType == NEWLINE || Text.Size() == 0) if (AddType == NEWLINE || Text.Size() == 0)
{ {
@ -1057,12 +1059,19 @@ void FNotifyBuffer::Tick()
unsigned i; unsigned i;
for (i = 0; i < Text.Size(); ++i) for (i = 0; i < Text.Size(); ++i)
{ {
if (Text[i].TimeOut != 0 && Text[i].TimeOut > gametic) Text[i].Ticker++;
}
for (i = 0; i < Text.Size(); ++i)
{
if (Text[i].TimeOut != 0 && Text[i].TimeOut > Text[i].Ticker)
break; break;
} }
if (i > 0) if (i > 0)
{ {
Text.Delete(0, i); Text.Delete(0, i);
FFont* font = generic_ui ? NewSmallFont : AlternativeSmallFont;
Top += font->GetHeight();
} }
} }
@ -1072,7 +1081,7 @@ void FNotifyBuffer::Draw()
int line, lineadv, color, j; int line, lineadv, color, j;
bool canskip; bool canskip;
if (gamestate == GS_FULLCONSOLE || gamestate == GS_DEMOSCREEN/* || menuactive != MENU_Off*/) if (gamestate == GS_FULLCONSOLE || gamestate == GS_DEMOSCREEN)
return; return;
FFont* font = generic_ui ? NewSmallFont : AlternativeSmallFont; FFont* font = generic_ui ? NewSmallFont : AlternativeSmallFont;
@ -1089,7 +1098,7 @@ void FNotifyBuffer::Draw()
if (notify.TimeOut == 0) if (notify.TimeOut == 0)
continue; continue;
j = notify.TimeOut - gametic; j = notify.TimeOut - notify.Ticker;
if (j > 0) if (j > 0)
{ {
if (!show_messages && notify.PrintLevel != 128) if (!show_messages && notify.PrintLevel != 128)
@ -1122,11 +1131,6 @@ void FNotifyBuffer::Draw()
} }
else else
{ {
if (canskip)
{
Top += lineadv;
line += lineadv;
}
notify.TimeOut = 0; notify.TimeOut = 0;
} }
} }