diff --git a/stepmania/src/GameState.h b/stepmania/src/GameState.h index 836e4553de..eff242015c 100644 --- a/stepmania/src/GameState.h +++ b/stepmania/src/GameState.h @@ -62,6 +62,7 @@ public: bool IsCourseDifficultyShown( CourseDifficulty cd ); Difficulty GetEasiestNotesDifficulty() const; RageTimer m_timeGameStarted; // from the moment the first player pressed Start + map 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; diff --git a/stepmania/src/LuaFunctions.h b/stepmania/src/LuaFunctions.h index b7751c99ed..cc0819f42b 100644 --- a/stepmania/src/LuaFunctions.h +++ b/stepmania/src/LuaFunctions.h @@ -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 ) { \ diff --git a/stepmania/src/ModeChoice.cpp b/stepmania/src/ModeChoice.cpp index 6aa3c7e0f4..e273b74edd 100644 --- a/stepmania/src/ModeChoice.cpp +++ b/stepmania/src/ModeChoice.cpp @@ -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::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. diff --git a/stepmania/src/ScreenSelect.cpp b/stepmania/src/ScreenSelect.cpp index b8a44b1978..53ea26fc8c 100644 --- a/stepmania/src/ScreenSelect.cpp +++ b/stepmania/src/ScreenSelect.cpp @@ -65,19 +65,17 @@ ScreenSelect::ScreenSelect( CString sClassName ) : ScreenWithMenuElements(sClass // // Load codes // + for( int c=0; cGetMetric("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 )