add environment variables that themes can use to save state
This commit is contained in:
@@ -62,6 +62,7 @@ public:
|
|||||||
bool IsCourseDifficultyShown( CourseDifficulty cd );
|
bool IsCourseDifficultyShown( CourseDifficulty cd );
|
||||||
Difficulty GetEasiestNotesDifficulty() const;
|
Difficulty GetEasiestNotesDifficulty() const;
|
||||||
RageTimer m_timeGameStarted; // from the moment the first player pressed Start
|
RageTimer m_timeGameStarted; // from the moment the first player pressed Start
|
||||||
|
map<CString,CString> m_mapEnv;
|
||||||
|
|
||||||
/* This is set to a random number per-game/round; it can be used for a random seed. */
|
/* This is set to a random number per-game/round; it can be used for a random seed. */
|
||||||
int m_iGameSeed, m_iRoundSeed;
|
int m_iGameSeed, m_iRoundSeed;
|
||||||
|
|||||||
@@ -75,6 +75,19 @@ int LuaFunc_##func( lua_State *L ) { \
|
|||||||
} \
|
} \
|
||||||
LuaFunction( func ); /* register it */
|
LuaFunction( func ); /* register it */
|
||||||
|
|
||||||
|
#define LuaFunction_StrStr( func, call ) \
|
||||||
|
int LuaFunc_##func( lua_State *L ) { \
|
||||||
|
REQ_ARGS( #func, 2 ); \
|
||||||
|
REQ_ARG( #func, 1, string ); \
|
||||||
|
REQ_ARG( #func, 2, string ); \
|
||||||
|
CString str1; \
|
||||||
|
CString str2; \
|
||||||
|
Lua::PopStack( L, str2 ); \
|
||||||
|
Lua::PopStack( L, str1 ); \
|
||||||
|
LUA_RETURN( call ); \
|
||||||
|
} \
|
||||||
|
LuaFunction( func ); /* register it */
|
||||||
|
|
||||||
/* Functions that take a single PlayerNumber argument: */
|
/* Functions that take a single PlayerNumber argument: */
|
||||||
#define LuaFunction_PlayerNumber( func, call ) \
|
#define LuaFunction_PlayerNumber( func, call ) \
|
||||||
int LuaFunc_##func( lua_State *L ) { \
|
int LuaFunc_##func( lua_State *L ) { \
|
||||||
|
|||||||
@@ -197,6 +197,12 @@ void ModeChoice::Load( int iIndex, CString sChoice )
|
|||||||
|
|
||||||
if( sName == "screen" )
|
if( sName == "screen" )
|
||||||
m_sScreen = sValue;
|
m_sScreen = sValue;
|
||||||
|
|
||||||
|
if( sName == "setenv" )
|
||||||
|
{
|
||||||
|
ASSERT( asBits.size() == 2 );
|
||||||
|
m_SetEnv[ asBits[0] ] = asBits[1];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !m_bInvalid && sSteps != "" )
|
if( !m_bInvalid && sSteps != "" )
|
||||||
@@ -383,9 +389,8 @@ bool ModeChoice::IsPlayable( CString *why ) const
|
|||||||
|
|
||||||
void ModeChoice::ApplyToAllPlayers() const
|
void ModeChoice::ApplyToAllPlayers() const
|
||||||
{
|
{
|
||||||
FOREACH_PlayerNumber( pn )
|
FOREACH_HumanPlayer( pn )
|
||||||
if( GAMESTATE->IsHumanPlayer(pn) )
|
Apply( pn);
|
||||||
Apply((PlayerNumber) pn);
|
|
||||||
|
|
||||||
if( m_sScreen != "" )
|
if( m_sScreen != "" )
|
||||||
SCREENMAN->SetNewScreen( m_sScreen );
|
SCREENMAN->SetNewScreen( m_sScreen );
|
||||||
@@ -458,6 +463,8 @@ void ModeChoice::Apply( PlayerNumber pn ) const
|
|||||||
GAMESTATE->ChangePreferredCourseDifficulty( pn, m_CourseDifficulty );
|
GAMESTATE->ChangePreferredCourseDifficulty( pn, m_CourseDifficulty );
|
||||||
if( m_pCharacter )
|
if( m_pCharacter )
|
||||||
GAMESTATE->m_pCurCharacters[pn] = m_pCharacter;
|
GAMESTATE->m_pCurCharacters[pn] = m_pCharacter;
|
||||||
|
for( map<CString,CString>::const_iterator i = m_SetEnv.begin(); i != m_SetEnv.end(); i++ )
|
||||||
|
GAMESTATE->m_mapEnv[ i->first ] = i->second;
|
||||||
|
|
||||||
// HACK: Set life type to BATTERY just once here so it happens once and
|
// HACK: Set life type to BATTERY just once here so it happens once and
|
||||||
// we don't override the user's changes if they back out.
|
// we don't override the user's changes if they back out.
|
||||||
|
|||||||
@@ -65,7 +65,6 @@ ScreenSelect::ScreenSelect( CString sClassName ) : ScreenWithMenuElements(sClass
|
|||||||
//
|
//
|
||||||
// Load codes
|
// Load codes
|
||||||
//
|
//
|
||||||
{
|
|
||||||
for( int c=0; c<NUM_CODES; c++ )
|
for( int c=0; c<NUM_CODES; c++ )
|
||||||
{
|
{
|
||||||
CodeItem code;
|
CodeItem code;
|
||||||
@@ -78,7 +77,6 @@ ScreenSelect::ScreenSelect( CString sClassName ) : ScreenWithMenuElements(sClass
|
|||||||
mc.Load( c, CODE_ACTION(c) );
|
mc.Load( c, CODE_ACTION(c) );
|
||||||
m_aCodeChoices.push_back( mc );
|
m_aCodeChoices.push_back( mc );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if( !m_aModeChoices.size() )
|
if( !m_aModeChoices.size() )
|
||||||
RageException::Throw( "Screen \"%s\" does not set any choices", m_sName.c_str() );
|
RageException::Throw( "Screen \"%s\" does not set any choices", m_sName.c_str() );
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include "UnlockSystem.h"
|
#include "UnlockSystem.h"
|
||||||
#include "ProductInfo.h"
|
#include "ProductInfo.h"
|
||||||
#include "LightsManager.h"
|
#include "LightsManager.h"
|
||||||
|
#include "CodeDetector.h"
|
||||||
|
|
||||||
|
|
||||||
#define LOGO_ON_COMMAND THEME->GetMetric("ScreenTitleMenu","LogoOnCommand")
|
#define LOGO_ON_COMMAND THEME->GetMetric("ScreenTitleMenu","LogoOnCommand")
|
||||||
@@ -298,7 +299,8 @@ void ScreenTitleMenu::Input( const DeviceInput& DeviceI, const InputEventType ty
|
|||||||
SCREENMAN->SystemMessage( ssprintf("Game: %s",GAMESTATE->GetCurrentGameDef()->m_szName) );
|
SCREENMAN->SystemMessage( ssprintf("Game: %s",GAMESTATE->GetCurrentGameDef()->m_szName) );
|
||||||
SCREENMAN->SetNewScreen( "ScreenTitleMenu" );
|
SCREENMAN->SetNewScreen( "ScreenTitleMenu" );
|
||||||
}
|
}
|
||||||
// Screen::Input( DeviceI, type, GameI, MenuI, StyleI );
|
|
||||||
|
ScreenSelect::Input( DeviceI, type, GameI, MenuI, StyleI );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenTitleMenu::Update( float fDelta )
|
void ScreenTitleMenu::Update( float fDelta )
|
||||||
|
|||||||
Reference in New Issue
Block a user