Add DisplayString "flags" and "translated" support, as well as some things I forgot to commit earlier.

This commit is contained in:
hispidence 2021-08-29 20:25:13 +01:00
parent 9a1831bc8f
commit fa5a6fd443
4 changed files with 107 additions and 12 deletions

View file

@ -357,6 +357,7 @@ To be used with @{DisplayString:GetPos}.
*/
m_lua->set_function(ScriptReserved_ScreenToPercent, &ScreenToPercent);
MakeReadOnlyTable(ScriptReserved_ObjID, kObjIDs);
MakeReadOnlyTable(ScriptReserved_DisplayStringOption, kDisplayStringOptionNames);
ResetLevelTables();
@ -626,9 +627,18 @@ void GameScript::ProcessDisplayStrings(float dt)
{
if (!endOfLife || str.m_isInfinite)
{
m_callbackDrawSring(g_GameFlow->GetString(str.m_key.c_str()), str.m_color, str.m_x, str.m_y, str.m_flags);
if (!endOfLife)
str.m_timeRemaining -= dt;
char const* cstr = str.m_isTranslated ? g_GameFlow->GetString(str.m_key.c_str()) : str.m_key.c_str();
int flags = 0;
if (str.m_flags[static_cast<size_t>(DisplayStringOptions::CENTER)])
flags |= PRINTSTRING_CENTER;
if (str.m_flags[static_cast<size_t>(DisplayStringOptions::OUTLINE)])
flags |= PRINTSTRING_OUTLINE;
m_callbackDrawSring(cstr, str.m_color, str.m_x, str.m_y, flags);
str.m_timeRemaining -= dt;
}
++it;
}