From c8476738f5600b47ccb7fba6c10a0895d5e237b8 Mon Sep 17 00:00:00 2001 From: Kyzentun Date: Mon, 12 May 2014 22:01:22 -0600 Subject: [PATCH] Exposed GAMESTATE:StoreRankingName and Profile:SetLastUsedHighScoreName to Lua. StoreRankingName no longer forces uppercase. --- Docs/Luadoc/Lua.xml | 2 ++ Docs/Luadoc/LuaDocumentation.xml | 6 ++++++ src/GameState.cpp | 10 +++++++++- src/Profile.cpp | 6 ++++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Docs/Luadoc/Lua.xml b/Docs/Luadoc/Lua.xml index 82734843a4..5829bb544e 100644 --- a/Docs/Luadoc/Lua.xml +++ b/Docs/Luadoc/Lua.xml @@ -831,6 +831,7 @@ + @@ -1179,6 +1180,7 @@ + diff --git a/Docs/Luadoc/LuaDocumentation.xml b/Docs/Luadoc/LuaDocumentation.xml index b45c75352a..e3bab0269c 100644 --- a/Docs/Luadoc/LuaDocumentation.xml +++ b/Docs/Luadoc/LuaDocumentation.xml @@ -2490,6 +2490,9 @@ save yourself some time, copy this for undocumented things: Turns temporary Event Mode on or off, depending on bOn. + + Stores the ranking name for the player. Use this at the end of a round, on a name entry screen or similar, to set the name for the high scores the player has earned. + Determines if Judgment W1 should be shown based on bOn. @@ -3340,6 +3343,9 @@ save yourself some time, copy this for undocumented things: Sets the current goal type to gt. + + Sets last used high score name. + Sets how much the player weighs (in pounds) to weightPounds. diff --git a/src/GameState.cpp b/src/GameState.cpp index fd135343d8..7d1757bd9a 100644 --- a/src/GameState.cpp +++ b/src/GameState.cpp @@ -1841,7 +1841,8 @@ bool GameState::AnyPlayerHasRankingFeats() const void GameState::StoreRankingName( PlayerNumber pn, RString sName ) { - sName.MakeUpper(); + // The theme can upper it if desired. -Kyz + // sName.MakeUpper(); if( USE_NAME_BLACKLIST ) { @@ -2577,6 +2578,12 @@ public: return 0; } + static int StoreRankingName( T* p, lua_State *L ) + { + p->StoreRankingName(Enum::Check(L, 1), SArg(2)); + return 0; + } + DEFINE_METHOD( HaveProfileToLoad, HaveProfileToLoad() ) DEFINE_METHOD( HaveProfileToSave, HaveProfileToSave() ) @@ -2695,6 +2702,7 @@ public: ADD_METHOD( SaveProfiles ); ADD_METHOD( HaveProfileToLoad ); ADD_METHOD( HaveProfileToSave ); + ADD_METHOD( StoreRankingName ); } }; diff --git a/src/Profile.cpp b/src/Profile.cpp index 25ca4123b7..9a5d8ad973 100644 --- a/src/Profile.cpp +++ b/src/Profile.cpp @@ -1993,6 +1993,11 @@ class LunaProfile: public Luna public: static int GetDisplayName( T* p, lua_State *L ) { lua_pushstring(L, p->m_sDisplayName ); return 1; } static int GetLastUsedHighScoreName( T* p, lua_State *L ) { lua_pushstring(L, p->m_sLastUsedHighScoreName ); return 1; } + static int SetLastUsedHighScoreName( T* p, lua_State *L ) + { + p->m_sLastUsedHighScoreName= SArg(1); + return 0; + } static int GetHighScoreList( T* p, lua_State *L ) { if( LuaBinding::CheckLuaObjectType(L, 1, "Song") ) @@ -2117,6 +2122,7 @@ public: { ADD_METHOD( GetDisplayName ); ADD_METHOD( GetLastUsedHighScoreName ); + ADD_METHOD( SetLastUsedHighScoreName ); ADD_METHOD( GetHighScoreList ); ADD_METHOD( GetCategoryHighScoreList ); ADD_METHOD( GetCharacter );