TTextBox: fixed DrawText texts getting overwritten by full redraw.

This bug is from the original 3DPB.
This commit is contained in:
Muzychenko Andrey 2021-10-30 18:25:49 +03:00
parent c0ec8ec932
commit 1c1fbcb811
4 changed files with 17 additions and 3 deletions

View File

@ -153,7 +153,7 @@ void TTextBox::Display(const wchar_t* text, float time)
} }
} }
void TTextBox::Draw() void TTextBox::Draw(bool redraw)
{ {
auto bmp = BgBmp; auto bmp = BgBmp;
if (bmp) if (bmp)
@ -172,6 +172,12 @@ void TTextBox::Draw()
bool display = false; bool display = false;
while (Message1) while (Message1)
{ {
if (redraw)
{
display = true;
break;
}
if (Message1->Time == -1.0f) if (Message1->Time == -1.0f)
{ {
if (!Message1->NextMessage) if (!Message1->NextMessage)
@ -183,6 +189,8 @@ void TTextBox::Draw()
} }
else if (Message1->TimeLeft() >= -2.0f) else if (Message1->TimeLeft() >= -2.0f)
{ {
if (Timer > 0)
timer::kill(Timer);
Timer = timer::set(max(Message1->TimeLeft(), 0.25f), this, TimerExpired); Timer = timer::set(max(Message1->TimeLeft(), 0.25f), this, TimerExpired);
display = true; display = true;
break; break;

View File

@ -22,7 +22,7 @@ public:
int Message(int code, float value) override; int Message(int code, float value) override;
void Clear(); void Clear();
void Display(const wchar_t* text, float time); void Display(const wchar_t* text, float time);
void Draw(); void Draw(bool redraw = false);
static void TimerExpired(int timerId, void* tb); static void TimerExpired(int timerId, void* tb);
}; };

View File

@ -377,7 +377,7 @@ void fullscrn::paint()
fillRect(WindowRect1.right, menuHeight + WindowRect1.bottom, 0, 0); fillRect(WindowRect1.right, menuHeight + WindowRect1.bottom, 0, 0);
} }
} }
render::paint(); pb::paint();
fullscrn_flag1 = 0; fullscrn_flag1 = 0;
} }

View File

@ -135,6 +135,12 @@ void pb::firsttime_setup()
void pb::paint() void pb::paint()
{ {
render::paint(); render::paint();
if (score::msg_fontp == nullptr)
{
// DrawText writes to screen directly, text gets overwritten by full vScreen blit.
pinball::InfoTextBox->Draw(true);
pinball::MissTextBox->Draw(true);
}
} }
void pb::mode_change(int mode) void pb::mode_change(int mode)