Merge branch 'SetGame' of https://github.com/sigatrev/stepmania into ChangeGame
This commit is contained in:
@@ -723,6 +723,8 @@
|
||||
<Function name='GetFirstStepsTypeForGame'/>
|
||||
<Function name='IsGameEnabled'/>
|
||||
<Function name='StepsTypeToLocalizedString'/>
|
||||
<Function name='SetGame'/>
|
||||
<Function name='GetEnabledGames'/>
|
||||
</Class>
|
||||
<Class name='GameSoundManager'>
|
||||
<Function name='DimMusic'/>
|
||||
|
||||
@@ -2177,6 +2177,12 @@ save yourself some time, copy this for undocumented things:
|
||||
<Function name='StepsTypeToLocalizedString' return='string' arguments='StepsType st'>
|
||||
Return the localized string representation of <code>st</code>.
|
||||
</Function>
|
||||
<Function name='GetEnabledGames' return='{string}'>
|
||||
Returns a table of all selectable games.
|
||||
</Function>
|
||||
<Function name='SetGame' return='void' arguments='string Game, string Theme' >
|
||||
Sets the current game to <code>Game</code>. The second argument is optional, and if provided will determine which theme is loaded when the game changes. If Stepmania was run with a commandline argument setting the theme, that will override the second argument of this function.
|
||||
</Function>
|
||||
</Class>
|
||||
<Class name='GameSoundManager'>
|
||||
<Function name='DimMusic' return='void' arguments='float fVolume, float fDuration'>
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#include "global.h"
|
||||
#include "Stepmania.h"
|
||||
#include "arch/Dialog/Dialog.h"
|
||||
#include "GameManager.h"
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "GameInput.h" // for GameButton constants
|
||||
@@ -3157,11 +3159,49 @@ public:
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int GetEnabledGames( T* p, lua_State *L )
|
||||
{
|
||||
vector<const Game*> aGames;
|
||||
GAMEMAN->GetEnabledGames( aGames );
|
||||
|
||||
vector<RString> vsGames;
|
||||
FOREACH( const Game*, aGames, g )
|
||||
{
|
||||
RString sGameName = (*g)->m_szName;
|
||||
vsGames.push_back( sGameName );
|
||||
}
|
||||
LuaHelpers::CreateTableFromArray<RString>( vsGames, L );
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int SetGame( T* p, lua_State *L )
|
||||
{
|
||||
const Game *pGame = p->StringToGame(SArg(1));
|
||||
RString sTheme;
|
||||
if( lua_gettop(L) >= 2 && !lua_isnil(L, 2) )
|
||||
{
|
||||
sTheme = SArg(2);
|
||||
}
|
||||
if( pGame )
|
||||
{
|
||||
StepMania::ChangeCurrentGame( pGame, sTheme );
|
||||
THEME->ReloadMetrics();
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG->Warn( "SetGame: Invalid Game, %s", pGame->m_szName );
|
||||
Dialog::OK( "SetGame: Invalid Game, %s", pGame->m_szName );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
LunaGameManager()
|
||||
{
|
||||
ADD_METHOD( StepsTypeToLocalizedString );
|
||||
ADD_METHOD( GetFirstStepsTypeForGame );
|
||||
ADD_METHOD( IsGameEnabled );
|
||||
ADD_METHOD( GetEnabledGames );
|
||||
ADD_METHOD( SetGame );
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
+4
-2
@@ -808,7 +808,7 @@ static void SwitchToLastPlayedGame()
|
||||
StepMania::ChangeCurrentGame( pGame );
|
||||
}
|
||||
|
||||
void StepMania::ChangeCurrentGame( const Game* g )
|
||||
void StepMania::ChangeCurrentGame( const Game* g, RString Theme )
|
||||
{
|
||||
ASSERT( g != NULL );
|
||||
ASSERT( GAMESTATE != NULL );
|
||||
@@ -825,7 +825,9 @@ void StepMania::ChangeCurrentGame( const Game* g )
|
||||
sAnnouncer = GAMESTATE->GetCurrentGame()->m_szName;
|
||||
if( sTheme.empty() )
|
||||
sTheme = GAMESTATE->GetCurrentGame()->m_szName;
|
||||
|
||||
if( Theme.size() )
|
||||
sTheme = Theme;
|
||||
|
||||
// process theme and language command line arguments;
|
||||
// these change the preferences in order for transparent loading -aj
|
||||
RString argTheme;
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ namespace StepMania
|
||||
void ResetGame();
|
||||
RString GetInitialScreen();
|
||||
RString GetSelectMusicScreen();
|
||||
void ChangeCurrentGame( const Game* g );
|
||||
void ChangeCurrentGame( const Game* g, RString Theme = "" );
|
||||
|
||||
// If successful, return filename of screenshot in sDir, else return ""
|
||||
RString SaveScreenshot( RString Dir, bool SaveCompressed, bool MakeSignature, RString NamePrefix, RString NameSuffix );
|
||||
|
||||
Reference in New Issue
Block a user