1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-22 17:49:43 +01:00

Fix setfont() changing font of fading out text boxes

Closes #925.

My fix here is to delay the font change until all fading-out textboxes
have disappeared. See it as adding a sort of `untilbars` or `untilfade`
for text box fadeout, into setfont.

This doesn't prevent every possible way to change the font of an
existing textbox, but you would need to use internal scripting to still
do it (and basically be doing it on purpose) - the problem in
simplified scripting when you simply do textbox-setfont-textbox is
gone.
This commit is contained in:
Dav999 2023-08-28 03:19:57 +02:00 committed by Misa Elizabeth Kai
parent 68b6bd07ba
commit 135934289e

View file

@ -2416,13 +2416,29 @@ void scriptclass::run(void)
} }
else if (words[0] == "setfont") else if (words[0] == "setfont")
{ {
if (words[1] == "") // If any textbox is currently fading out, wait for that first
bool blocked = false;
for (size_t i = 0; i < graphics.textboxes.size(); i++)
{ {
font::set_level_font(cl.level_font_name.c_str()); if (graphics.textboxes[i].tm == 2)
{
scriptdelay = 1;
position--;
blocked = true;
break;
}
} }
else
if (!blocked)
{ {
font::set_level_font(raw_words[1].c_str()); if (words[1] == "")
{
font::set_level_font(cl.level_font_name.c_str());
}
else
{
font::set_level_font(raw_words[1].c_str());
}
} }
} }