From 194608310784743b143aa9542bc64e13307027e4 Mon Sep 17 00:00:00 2001 From: Steve Checkoway Date: Mon, 20 Feb 2006 04:25:53 +0000 Subject: [PATCH] Don't change player one's course difficulty preferenes. Play a sound when the difficulty changes. --- stepmania/src/GameState.cpp | 1 + stepmania/src/GameState.h | 1 + stepmania/src/MessageManager.cpp | 1 + stepmania/src/MessageManager.h | 1 + stepmania/src/ScreenOptionsEditCourse.cpp | 7 ++++--- stepmania/src/ScreenOptionsManageCourses.cpp | 22 ++++++++++++-------- stepmania/src/ScreenOptionsManageCourses.h | 5 +++++ 7 files changed, 26 insertions(+), 12 deletions(-) diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index 22167d7216..1c4f7074a1 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -76,6 +76,7 @@ GameState::GameState() : m_pCurTrail( Message_CurrentTrailP1Changed ), m_bGameplayLeadIn( Message_GameplayLeadInChanged ), m_stEdit( Message_EditStepsTypeChanged ), + m_cdEdit( Message_EditCourseDifficulityChanged ), m_pEditSourceSteps( Message_EditSourceStepsChanged ), m_stEditSource( Message_EditSourceStepsTypeChanged ), m_iEditCourseEntryIndex( Message_EditCourseEntryIndexChanged ), diff --git a/stepmania/src/GameState.h b/stepmania/src/GameState.h index 289d499af8..72098b9619 100644 --- a/stepmania/src/GameState.h +++ b/stepmania/src/GameState.h @@ -282,6 +282,7 @@ public: // Edit stuff // BroadcastOnChange m_stEdit; + BroadcastOnChange m_cdEdit; BroadcastOnChangePtr m_pEditSourceSteps; BroadcastOnChange m_stEditSource; BroadcastOnChange m_iEditCourseEntryIndex; diff --git a/stepmania/src/MessageManager.cpp b/stepmania/src/MessageManager.cpp index f1be601ab2..becf5d6154 100644 --- a/stepmania/src/MessageManager.cpp +++ b/stepmania/src/MessageManager.cpp @@ -23,6 +23,7 @@ static const char *MessageNames[] = { "CurrentTrailP2Changed", "GameplayLeadInChanged", "EditStepsTypeChanged", + "EditCourseDifficulityChanged", "EditSourceStepsChanged", "EditSourceStepsTypeChanged", "PreferredDifficutyP1Changed", diff --git a/stepmania/src/MessageManager.h b/stepmania/src/MessageManager.h index 788947f75b..dc2417b169 100644 --- a/stepmania/src/MessageManager.h +++ b/stepmania/src/MessageManager.h @@ -18,6 +18,7 @@ enum Message Message_CurrentTrailP2Changed, Message_GameplayLeadInChanged, Message_EditStepsTypeChanged, + Message_EditCourseDifficulityChanged, Message_EditSourceStepsChanged, Message_EditSourceStepsTypeChanged, Message_PreferredDifficultyP1Changed, diff --git a/stepmania/src/ScreenOptionsEditCourse.cpp b/stepmania/src/ScreenOptionsEditCourse.cpp index 8b60e87eb8..49bae42b85 100644 --- a/stepmania/src/ScreenOptionsEditCourse.cpp +++ b/stepmania/src/ScreenOptionsEditCourse.cpp @@ -45,7 +45,7 @@ REGISTER_SCREEN_CLASS( ScreenOptionsEditCourse ); void ScreenOptionsEditCourse::Init() { - ScreenOptions::Init(); + ScreenOptionsEditCourseSubMenu::Init(); } static LocalizedString ENTRY( "OptionTitles", "Entry %d" ); @@ -197,7 +197,7 @@ void ScreenOptionsEditCourse::AfterChangeValueInRow( int iRow, PlayerNumber pn ) // Regenerate Trails so that the new values propagate GAMESTATE->m_pCurTrail[PLAYER_1].Set( NULL ); - Trail *pTrail = pCourse->GetTrailForceRegenCache( GAMESTATE->m_stEdit, GAMESTATE->m_PreferredCourseDifficulty[PLAYER_1] ); + Trail *pTrail = pCourse->GetTrailForceRegenCache( GAMESTATE->m_stEdit, GAMESTATE->m_cdEdit ); // cause overlay elements to refresh by changing the course GAMESTATE->m_pCurCourse.Set( pCourse ); @@ -230,7 +230,7 @@ void ScreenOptionsEditCourse::ExportOptions( int iRow, const vectorm_pCurCourse; - + switch( iRow ) { case EditCourseRow_Type: @@ -249,6 +249,7 @@ void ScreenOptionsEditCourse::ExportOptions( int iRow, const vectorm_pCurCourse.Set( pCourse ); - Trail *pTrail = pCourse->GetTrail( GAMESTATE->m_stEdit, GAMESTATE->m_PreferredCourseDifficulty[PLAYER_1] ); + Trail *pTrail = pCourse->GetTrail( GAMESTATE->m_stEdit, GAMESTATE->m_cdEdit ); GAMESTATE->m_pCurTrail[PLAYER_1].Set( pTrail ); } @@ -43,7 +43,7 @@ static void SetNextCombination() } } - StepsTypeAndDifficulty curVal( GAMESTATE->m_stEdit, GAMESTATE->m_PreferredCourseDifficulty[PLAYER_1] ); + StepsTypeAndDifficulty curVal( GAMESTATE->m_stEdit, GAMESTATE->m_cdEdit ); vector::const_iterator iter = find( v.begin(), v.end(), curVal ); if( iter == v.end() || ++iter == v.end() ) iter = v.begin(); @@ -51,19 +51,23 @@ static void SetNextCombination() curVal = *iter; GAMESTATE->m_stEdit.Set( curVal.st ); - GAMESTATE->m_PreferredCourseDifficulty[PLAYER_1].Set( curVal.cd ); + GAMESTATE->m_cdEdit.Set( curVal.cd ); RefreshTrail(); } +void ScreenOptionsEditCourseSubMenu::Init() +{ + m_soundDifficultyChanged.Load( THEME->GetPathS("ScreenEditCourseSubmenu", "difficulty changed") ); + ScreenOptions::Init(); +} + void ScreenOptionsEditCourseSubMenu::MenuSelect( const InputEventPlus &input ) { if( input.type == IET_FIRST_PRESS ) { SetNextCombination(); - - SCREENMAN->PlayInvalidSound(); - + m_soundDifficultyChanged.Play(); return; } @@ -107,7 +111,7 @@ static bool ValidateEditCourseName( const RString &sAnswer, RString &sErrorOut ) FOREACH_CONST( Course*, v, c ) { if( GAMESTATE->m_pCurCourse.Get() == *c ) - continue; // don't comepare name against ourself + continue; // don't compare name against ourself if( (*c)->GetDisplayFullTitle() == sAnswer ) { @@ -124,7 +128,7 @@ REGISTER_SCREEN_CLASS( ScreenOptionsManageCourses ); void ScreenOptionsManageCourses::Init() { - ScreenOptions::Init(); + ScreenOptionsEditCourseSubMenu::Init(); EDIT_MODE.Load( m_sName,"EditMode" ); } @@ -132,7 +136,7 @@ void ScreenOptionsManageCourses::Init() void ScreenOptionsManageCourses::BeginScreen() { if( GAMESTATE->m_stEdit == STEPS_TYPE_INVALID || - GAMESTATE->m_PreferredCourseDifficulty[PLAYER_1] == DIFFICULTY_INVALID ) + GAMESTATE->m_cdEdit == DIFFICULTY_INVALID ) { SetNextCombination(); } diff --git a/stepmania/src/ScreenOptionsManageCourses.h b/stepmania/src/ScreenOptionsManageCourses.h index 3b9f259987..1166f0595e 100644 --- a/stepmania/src/ScreenOptionsManageCourses.h +++ b/stepmania/src/ScreenOptionsManageCourses.h @@ -3,12 +3,17 @@ #include "ScreenOptions.h" #include "GameConstantsAndTypes.h" +#include "RageSound.h" class Course; class ScreenOptionsEditCourseSubMenu : public ScreenOptions { + RageSound m_soundDifficultyChanged; + public: + virtual void Init(); + protected: virtual void MenuSelect( const InputEventPlus &input ); };