Merge pull request #110 from sigatrev/Save/LoadProfile

Expose Save/load profile to Lua. This deprecates ScreenProfile{Load,Save} completely, but those are going to be left in until post-5.0
This commit is contained in:
Colby Klein
2014-04-02 17:12:28 -07:00
3 changed files with 42 additions and 0 deletions
+4
View File
@@ -769,6 +769,8 @@
<Function name='GetStageSeed'/>
<Function name='GetWorkoutGoalComplete'/>
<Function name='HasEarnedExtraStage'/>
<Function name='HaveProfileToLoad'/>
<Function name='HaveProfileToSave'/>
<Function name='InStepEditor'/>
<Function name='IsAnExtraStage'/>
<Function name='IsAnyHumanPlayerUsingMemoryCard'/>
@@ -786,12 +788,14 @@
<Function name='IsWinner'/>
<Function name='JoinPlayer'/>
<Function name='JoinInput'/>
<Function name='LoadProfiles'/>
<Function name='PlayerIsUsingModifier'/>
<Function name='PlayersCanJoin'/>
<Function name='RefreshNoteSkinData'/>
<Function name='Reset'/>
<Function name='ResetPlayerOptions'/>
<Function name='SaveLocalData'/>
<Function name='SaveProfiles'/>
<Function name='SetCharacter'/>
<Function name='SetCurrentCourse'/>
<Function name='SetCurrentSong'/>
+12
View File
@@ -2289,6 +2289,12 @@ save yourself some time, copy this for undocumented things:
<Function name='HasEarnedExtraStage' return='bool' arguments=''>
Returns <code>true</code> if an extra stage was earned.
</Function>
<Function name='HaveProfileToLoad' return='bool' arguments=''>
Returns <code>true</code> if either player does not have a profile loaded, and there is a loadable profile.
</Function>
<Function name='HaveProfileToSave' return='bool' arguments=''>
Returns <code>true</code> if either player has a profile loaded.
</Function>
<Function name='InStepEditor' return='bool' arguments=''>
Returns <code>true</code> if we are specifically in the Step Editor's
editing portion. If in recording or playing mode, this will return
@@ -2342,6 +2348,9 @@ save yourself some time, copy this for undocumented things:
<Function name='JoinInput' return='bool' arguments='PlayerNumber pn'>
Similar to JoinPlayer, but checks whether the player is allowed to join and returns false if the player is not allowed to join. Also deducts coins for joining. A player can't join if PlayersCanJoin() returns false, or that side is already joined (is true for both sides when in a style that is OnePlayerTwoSides), or there are not enough coins.
</Function>
<Function name='LoadProfiles' return='void' arguments='bool LoadEdits'>
If profiles are not loaded, this will load the profiles for each player. It will load from memory cards if they are present, and local profiles otherwise. It will load edits if <code>LoadEdits</code> is true, or by default if the argument is omitted.
</Function>
<Function name='PlayerIsUsingModifier' return='bool' arguments='PlayerNumber pn, string sModifier'>
Returns <code>true</code> if player <code>pn</code> is using modifier <code>sModifier</code>.
</Function>
@@ -2357,6 +2366,9 @@ save yourself some time, copy this for undocumented things:
<Function name='ResetPlayerOptions' return='void' arguments='PlayerNumber pn'>
Resets the specific Player's mods to the default settings.
</Function>
<Function name='SaveProfiles' return='void' arguments='bool LoadEdits'>
Save profiles.
</Function>
<Function name='SaveLocalData' return='void' arguments=''>
Saves the bookkeeping and machine profile data.
</Function>
+26
View File
@@ -2545,6 +2545,28 @@ public:
return 1;
}
static int LoadProfiles( T* p, lua_State *L )
{
bool LoadEdits = true;
if(lua_isboolean(L, 1))
{
LoadEdits = BArg(1);
}
p->LoadProfiles( LoadEdits );
SCREENMAN->ZeroNextUpdate();
return 0;
}
static int SaveProfiles( T* p, lua_State *L )
{
p->SavePlayerProfiles();
SCREENMAN->ZeroNextUpdate();
return 0;
}
DEFINE_METHOD( HaveProfileToLoad, HaveProfileToLoad() )
DEFINE_METHOD( HaveProfileToSave, HaveProfileToSave() )
LunaGameState()
{
ADD_METHOD( IsPlayerEnabled );
@@ -2655,6 +2677,10 @@ public:
ADD_METHOD( ResetPlayerOptions );
ADD_METHOD( RefreshNoteSkinData );
ADD_METHOD( Dopefish );
ADD_METHOD( LoadProfiles );
ADD_METHOD( SaveProfiles );
ADD_METHOD( HaveProfileToLoad );
ADD_METHOD( HaveProfileToSave );
}
};