diff --git a/stepmania/src/BitmapText.cpp b/stepmania/src/BitmapText.cpp index f09ca4d142..59ecbf058a 100644 --- a/stepmania/src/BitmapText.cpp +++ b/stepmania/src/BitmapText.cpp @@ -824,7 +824,7 @@ void ColorBitmapText::SetMaxLines( int iNumLines, int iDirection ) } // lua start - +#include "FontCharAliases.h" class LunaBitmapText: public Luna { public: @@ -833,7 +833,19 @@ public: static int wrapwidthpixels( T* p, lua_State *L ) { p->SetWrapWidthPixels( IArg(1) ); return 0; } static int maxwidth( T* p, lua_State *L ) { p->SetMaxWidth( FArg(1) ); return 0; } static int maxheight( T* p, lua_State *L ) { p->SetMaxHeight( FArg(1) ); return 0; } - static int settext( T* p, lua_State *L ) { p->SetText( SArg(1) ); return 0; } + static int settext( T* p, lua_State *L ) + { + CString s = SArg(1); + // XXX: Lua strings should simply use "\n" natively. However, some + // settext calls may be made from GetMetric() calls to other strings, + // and it's confusing for :: to work in some strings and not others. + // Eventually, all strings should be Lua expressions, but until then + // continue to support this. + s.Replace("::","\n"); + FontCharAliases::ReplaceMarkers( s ); + + p->SetText( s ); return 0; + } static int GetText( T* p, lua_State *L ) { lua_pushstring( L, p->GetText() ); return 1; } static void Register(lua_State *L) diff --git a/stepmania/src/HelpDisplay.cpp b/stepmania/src/HelpDisplay.cpp index ba2ed5419b..a81a7fdfe7 100644 --- a/stepmania/src/HelpDisplay.cpp +++ b/stepmania/src/HelpDisplay.cpp @@ -75,7 +75,7 @@ void HelpDisplay::Update( float fDeltaTime ) #include "LuaBinding.h" - +#include "FontCharAliases.h" class LunaHelpDisplay: public Luna { public: @@ -88,7 +88,12 @@ public: vector arrayTips; LuaHelpers::ReadArrayFromTable( arrayTips, L ); lua_pop( L, 1 ); - + for( unsigned i = 0; i < arrayTips.size(); ++i ) + { + // XXX: see BitmapText settext + arrayTips[i].Replace("::","\n"); + FontCharAliases::ReplaceMarkers( arrayTips[i] ); + } if( lua_gettop(L) > 1 && !lua_isnil( L, 2 ) ) { vector arrayTipsAlt; @@ -96,6 +101,11 @@ public: lua_pushvalue( L, 2 ); LuaHelpers::ReadArrayFromTable( arrayTipsAlt, L ); lua_pop( L, 1 ); + for( unsigned i = 0; i < arrayTipsAlt.size(); ++i ) + { + arrayTipsAlt[i].Replace("::","\n"); + FontCharAliases::ReplaceMarkers( arrayTipsAlt[i] ); + } p->SetTips( arrayTips, arrayTipsAlt ); }