From 56f503e29b8e151492730d874ed37f1c525fc920 Mon Sep 17 00:00:00 2001 From: AJ Kelly Date: Sat, 30 Apr 2011 19:35:51 -0500 Subject: [PATCH] [UnlockManager] Added GetPoints(UnlockRequirement), GetPointsForProfile(Profile,UnlockRequirement) Lua bindings. --- Docs/Changelog_sm-ssc.txt | 2 ++ src/UnlockManager.cpp | 33 +++++++++++++++++++++++++-------- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/Docs/Changelog_sm-ssc.txt b/Docs/Changelog_sm-ssc.txt index 11c3298de0..4e1f21e55e 100644 --- a/Docs/Changelog_sm-ssc.txt +++ b/Docs/Changelog_sm-ssc.txt @@ -22,6 +22,8 @@ sm-ssc v1.2.5 | 20110??? * [UnlockEntry] Added GetCourse, GetCode Lua bindings. [AJ] * [UnlockManager] Added UnlockRequirement_NumUnlocked enum. [AJ] * [Song] Added Origin (#ORIGIN tag in .ssc) [AJ] +* [UnlockManager] Added GetPoints(UnlockRequirement), + GetPointsForProfile(Profile,UnlockRequirement) Lua bindings. [AJ] 20110428 -------- diff --git a/src/UnlockManager.cpp b/src/UnlockManager.cpp index 7fd8dbe82d..79b21989ca 100644 --- a/src/UnlockManager.cpp +++ b/src/UnlockManager.cpp @@ -685,6 +685,7 @@ public: return 1; } + // internal static int GetArgs( T* p, lua_State *L ) { Command cmd; @@ -761,7 +762,7 @@ public: static int GetStepsUnlockedByEntryID( T* p, lua_State *L ) { - // Return the song each steps are associated with, too. + // Return the Song each Steps are associated with, too. vector apSongs; vector apDifficulty; UNLOCKMAN->GetStepsUnlockedByEntryID( apSongs, apDifficulty, SArg(1) ); @@ -770,20 +771,36 @@ public: return 2; } + static int GetPoints( T* p, lua_State *L ) { + float fScores[NUM_UnlockRequirement]; + UNLOCKMAN->GetPoints( PROFILEMAN->GetMachineProfile(), fScores ); + lua_pushnumber( fScores[Enum::Check(L, 1)] ); + return 1; + } + + static int GetPointsForProfile( T* p, lua_State *L ) { + float fScores[NUM_UnlockRequirement]; + UNLOCKMAN->GetPoints( Luna::check(L,1), fScores ); + lua_pushnumber( fScores[Enum::Check(L, 2)] ); + return 1; + } + LunaUnlockManager() { - ADD_METHOD( GetPointsUntilNextUnlock ); + ADD_METHOD( AnyUnlocksToCelebrate ); ADD_METHOD( FindEntryID ); - ADD_METHOD( UnlockEntryID ); - ADD_METHOD( UnlockEntryIndex ); - ADD_METHOD( PreferUnlockEntryID ); ADD_METHOD( GetNumUnlocks ); ADD_METHOD( GetNumUnlocked ); - ADD_METHOD( GetUnlockEntryIndexToCelebrate ); - ADD_METHOD( AnyUnlocksToCelebrate ); - ADD_METHOD( GetUnlockEntry ); + ADD_METHOD( GetPoints ); + ADD_METHOD( GetPointsForProfile ); + ADD_METHOD( GetPointsUntilNextUnlock ); ADD_METHOD( GetSongsUnlockedByEntryID ); ADD_METHOD( GetStepsUnlockedByEntryID ); + ADD_METHOD( GetUnlockEntry ); + ADD_METHOD( GetUnlockEntryIndexToCelebrate ); + ADD_METHOD( PreferUnlockEntryID ); + ADD_METHOD( UnlockEntryID ); + ADD_METHOD( UnlockEntryIndex ); } };