From 4562695854abe745cc5e867cf930ed2fd3a4d4ba Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 12 Feb 2017 14:28:38 +0100 Subject: [PATCH] - fixed stringtable access in menus. --- src/v_text.cpp | 4 +++- wadsrc/static/zscript/base.txt | 2 +- wadsrc/static/zscript/menu/optionmenuitems.txt | 5 +++-- wadsrc/static/zscript/strife/coin.txt | 2 +- wadsrc/static/zscript/strife/thingstoblowup.txt | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/v_text.cpp b/src/v_text.cpp index 85b3de7db..a80a566ab 100644 --- a/src/v_text.cpp +++ b/src/v_text.cpp @@ -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; } diff --git a/wadsrc/static/zscript/base.txt b/wadsrc/static/zscript/base.txt index 1465f5b3a..e7820583b 100644 --- a/wadsrc/static/zscript/base.txt +++ b/wadsrc/static/zscript/base.txt @@ -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. diff --git a/wadsrc/static/zscript/menu/optionmenuitems.txt b/wadsrc/static/zscript/menu/optionmenuitems.txt index 89cdbdd3c..7c482e3e9 100644 --- a/wadsrc/static/zscript/menu/optionmenuitems.txt +++ b/wadsrc/static/zscript/menu/optionmenuitems.txt @@ -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)); } diff --git a/wadsrc/static/zscript/strife/coin.txt b/wadsrc/static/zscript/strife/coin.txt index b94a3f1d1..b6a83ecf2 100644 --- a/wadsrc/static/zscript/strife/coin.txt +++ b/wadsrc/static/zscript/strife/coin.txt @@ -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; } diff --git a/wadsrc/static/zscript/strife/thingstoblowup.txt b/wadsrc/static/zscript/strife/thingstoblowup.txt index bb268838c..a2b515efb 100644 --- a/wadsrc/static/zscript/strife/thingstoblowup.txt +++ b/wadsrc/static/zscript/strife/thingstoblowup.txt @@ -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.