From 3f776c5bb585743a86a0f3a5cfbe5e9bccda4231 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 6 Apr 2007 15:44:39 +0000 Subject: [PATCH] ResetToDefaultPlayerOptions, ResetToDefaultSongOptions --- stepmania/src/GameState.cpp | 7 +++++++ stepmania/src/GameState.h | 1 + stepmania/src/PlayerState.cpp | 7 +++++++ stepmania/src/PlayerState.h | 1 + stepmania/src/ScreenPlayerOptions.cpp | 4 +--- 5 files changed, 17 insertions(+), 3 deletions(-) diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index 02a9eeb38c..47f17785f3 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -1259,6 +1259,13 @@ void GameState::GetDefaultSongOptions( SongOptions &so ) so.FromString( CommonMetrics::DEFAULT_MODIFIERS ); } +void GameState::ResetToDefaultSongOptions( ModsLevel l ) +{ + SongOptions so; + GetDefaultSongOptions( so ); + m_SongOptions.Assign( l, so ); +} + void GameState::ApplyPreferredModifiers( PlayerNumber pn, RString sModifiers ) { m_pPlayerState[pn]->m_PlayerOptions.FromString( ModsLevel_Preferred, sModifiers ); diff --git a/stepmania/src/GameState.h b/stepmania/src/GameState.h index dd11228050..941b282114 100644 --- a/stepmania/src/GameState.h +++ b/stepmania/src/GameState.h @@ -224,6 +224,7 @@ public: void GetDefaultPlayerOptions( PlayerOptions &po ); void GetDefaultSongOptions( SongOptions &so ); + void ResetToDefaultSongOptions( ModsLevel l ); void ApplyPreferredModifiers( PlayerNumber pn, RString sModifiers ); void ApplyStageModifiers( PlayerNumber pn, RString sModifiers ); void ResetOptions(); diff --git a/stepmania/src/PlayerState.cpp b/stepmania/src/PlayerState.cpp index aa3bda7032..319cf80509 100644 --- a/stepmania/src/PlayerState.cpp +++ b/stepmania/src/PlayerState.cpp @@ -89,6 +89,13 @@ void PlayerState::Update( float fDelta ) m_fSecondsUntilAttacksPhasedOut = max( 0, m_fSecondsUntilAttacksPhasedOut - fDelta ); } +void PlayerState::ResetToDefaultPlayerOptions( ModsLevel l ) +{ + PlayerOptions po; + GAMESTATE->GetDefaultPlayerOptions( po ); + m_PlayerOptions.Assign( l, po ); +} + /* This is called to launch an attack, or to queue an attack if a.fStartSecond * is set. This is also called by GameState::Update when activating a queued attack. */ void PlayerState::LaunchAttack( const Attack& a ) diff --git a/stepmania/src/PlayerState.h b/stepmania/src/PlayerState.h index 415ba99ee3..24875248c4 100644 --- a/stepmania/src/PlayerState.h +++ b/stepmania/src/PlayerState.h @@ -25,6 +25,7 @@ public: MultiPlayer m_mp; + void ResetToDefaultPlayerOptions( ModsLevel l ); ModsGroup m_PlayerOptions; // diff --git a/stepmania/src/ScreenPlayerOptions.cpp b/stepmania/src/ScreenPlayerOptions.cpp index 997cf35526..2f80085998 100644 --- a/stepmania/src/ScreenPlayerOptions.cpp +++ b/stepmania/src/ScreenPlayerOptions.cpp @@ -76,9 +76,7 @@ void ScreenPlayerOptions::Input( const InputEventPlus &input ) if( GAMESTATE->IsHumanPlayer(pn) && CodeDetector::EnteredCode(input.GameI.controller,CODE_CANCEL_ALL_PLAYER_OPTIONS) ) { // apply the game default mods, but not the Profile saved mods - PlayerOptions po; - GAMESTATE->GetDefaultPlayerOptions( po ); - GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions.Assign( ModsLevel_Preferred, po ); + GAMESTATE->m_pPlayerState[pn]->ResetToDefaultPlayerOptions( ModsLevel_Preferred ); MESSAGEMAN->Broadcast( ssprintf("CancelAllP%i", pn+1) );