- fixed stringtable access in menus.

This commit is contained in:
Christoph Oelckers 2017-02-12 14:28:38 +01:00
parent bb6def820f
commit 4562695854
5 changed files with 9 additions and 6 deletions

View File

@ -141,6 +141,8 @@ void DCanvas::DrawTextCommon(FFont *font, int normalcolor, double x, double y, c
int kerning;
FTexture *pic;
assert(string[0] != '$');
if (parms.celly == 0) parms.celly = font->GetHeight() + 1;
parms.celly *= parms.scaley;
@ -240,7 +242,7 @@ DEFINE_ACTION_FUNCTION(_Screen, DrawText)
PARAM_STRING(chr);
VMVa_List args = { param + 5, 0, numparam - 5 };
const char *txt = chr[0] == '$' ? GStrings(chr) : chr.GetChars();
const char *txt = chr[0] == '$' ? GStrings(&chr[1]) : chr.GetChars();
screen->DrawText(font, cr, x, y, txt, args);
return 0;
}

View File

@ -409,7 +409,7 @@ struct LevelLocals native
struct StringTable native
{
native static String Localize(String val, bool prefixed = false);
native static String Localize(String val, bool prefixed = true);
}
// a few values of this need to be readable by the play code.

View File

@ -47,6 +47,7 @@ class OptionMenuItem : MenuItemBase
protected void drawLabel(int indent, int y, int color, bool grayed = false)
{
String label = Stringtable.Localize(mLabel);
int overlay = grayed? Color(96,48,0,0) : 0;
int x;
@ -302,7 +303,7 @@ class OptionMenuItemOption : OptionMenuItemOptionBase
int cnt = OptionValues.GetCount(mValues);
if (cnt > 0 && mCVar != null)
{
if (OptionValues.GetText(mValues, 0).Length() > 0)
if (OptionValues.GetTextValue(mValues, 0).Length() == 0)
{
let f = mCVar.GetFloat();
for(int i = 0; i < cnt; i++)
@ -335,7 +336,7 @@ class OptionMenuItemOption : OptionMenuItemOptionBase
int cnt = OptionValues.GetCount(mValues);
if (cnt > 0 && mCVar != null)
{
if (OptionValues.GetText(mValues, 0).Length() > 0)
if (OptionValues.GetTextValue(mValues, 0).Length() == 0)
{
mCVar.SetFloat(OptionValues.GetValue(mValues, Selection));
}

View File

@ -31,7 +31,7 @@ class Coin : Inventory
}
else
{
String msg = StringTable.Localize("TXT_XGOLD");
String msg = StringTable.Localize("$TXT_XGOLD");
msg.Replace("%d", "" .. Amount);
return msg;
}

View File

@ -27,7 +27,7 @@ extend class Actor
}
}
String msgid = "TXT_QUEST_" .. questitem;
String msgid = "$TXT_QUEST_" .. questitem;
String msg = StringTable.Localize(msgid);
if (msg != msgid) // if both are identical there was no message of this name in the stringtable.