add environment variables that themes can use to save state

This commit is contained in:
Chris Danford
2004-06-13 09:42:14 +00:00
parent d0361ce63f
commit a0411cc58a
5 changed files with 36 additions and 15 deletions
+1
View File
@@ -62,6 +62,7 @@ public:
bool IsCourseDifficultyShown( CourseDifficulty cd );
Difficulty GetEasiestNotesDifficulty() const;
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. */
int m_iGameSeed, m_iRoundSeed;
+13
View File
@@ -75,6 +75,19 @@ int LuaFunc_##func( lua_State *L ) { \
} \
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: */
#define LuaFunction_PlayerNumber( func, call ) \
int LuaFunc_##func( lua_State *L ) { \
+10 -3
View File
@@ -197,6 +197,12 @@ void ModeChoice::Load( int iIndex, CString sChoice )
if( sName == "screen" )
m_sScreen = sValue;
if( sName == "setenv" )
{
ASSERT( asBits.size() == 2 );
m_SetEnv[ asBits[0] ] = asBits[1];
}
}
if( !m_bInvalid && sSteps != "" )
@@ -383,9 +389,8 @@ bool ModeChoice::IsPlayable( CString *why ) const
void ModeChoice::ApplyToAllPlayers() const
{
FOREACH_PlayerNumber( pn )
if( GAMESTATE->IsHumanPlayer(pn) )
Apply((PlayerNumber) pn);
FOREACH_HumanPlayer( pn )
Apply( pn);
if( m_sScreen != "" )
SCREENMAN->SetNewScreen( m_sScreen );
@@ -458,6 +463,8 @@ void ModeChoice::Apply( PlayerNumber pn ) const
GAMESTATE->ChangePreferredCourseDifficulty( pn, m_CourseDifficulty );
if( 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
// we don't override the user's changes if they back out.
+9 -11
View File
@@ -65,19 +65,17 @@ ScreenSelect::ScreenSelect( CString sClassName ) : ScreenWithMenuElements(sClass
//
// Load codes
//
for( int c=0; c<NUM_CODES; c++ )
{
for( int c=0; c<NUM_CODES; c++ )
{
CodeItem code;
if( !code.Load( CODE(c) ) )
continue;
CodeItem code;
if( !code.Load( CODE(c) ) )
continue;
m_aCodes.push_back( code );
m_aCodeActions.push_back( CODE_ACTION(c) );
ModeChoice mc;
mc.Load( c, CODE_ACTION(c) );
m_aCodeChoices.push_back( mc );
}
m_aCodes.push_back( code );
m_aCodeActions.push_back( CODE_ACTION(c) );
ModeChoice mc;
mc.Load( c, CODE_ACTION(c) );
m_aCodeChoices.push_back( mc );
}
if( !m_aModeChoices.size() )
+3 -1
View File
@@ -19,6 +19,7 @@
#include "UnlockSystem.h"
#include "ProductInfo.h"
#include "LightsManager.h"
#include "CodeDetector.h"
#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->SetNewScreen( "ScreenTitleMenu" );
}
// Screen::Input( DeviceI, type, GameI, MenuI, StyleI );
ScreenSelect::Input( DeviceI, type, GameI, MenuI, StyleI );
}
void ScreenTitleMenu::Update( float fDelta )