From 48d631d6ca44d874de80994bd07a8d4f256e86d8 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 19 Mar 2007 00:03:20 +0000 Subject: [PATCH] support bOneChoiceForAllPlayers --- stepmania/src/OptionsList.cpp | 22 +++++++++++++++++----- stepmania/src/OptionsList.h | 5 +++++ stepmania/src/ScreenSelectMusic.cpp | 2 ++ 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/stepmania/src/OptionsList.cpp b/stepmania/src/OptionsList.cpp index 353b746b60..6966cf8b31 100644 --- a/stepmania/src/OptionsList.cpp +++ b/stepmania/src/OptionsList.cpp @@ -168,6 +168,7 @@ void OptionListRow::PositionCursor( Actor *pCursor, int iSelection ) OptionsList::OptionsList() { m_iCurrentRow = 0; + m_pLinked = NULL; } OptionsList::~OptionsList() @@ -595,13 +596,24 @@ void OptionsList::SelectItem( const RString &sRowName, int iMenuItem ) bSelections[iMenuItem] = true; } + if( pHandler->m_Def.m_bOneChoiceForAllPlayers && m_pLinked != NULL ) + { + vector &bLinkedSelections = m_pLinked->m_bSelections[sRowName]; + bLinkedSelections = bSelections; + if( m_pLinked->IsOpened() ) + m_pLinked->UpdateMenuFromSelections(); + } + ExportRow( sRowName ); - { - const vector &bCurrentSelections = m_bSelections.find(GetCurrentRow())->second; - m_Row[m_iCurrentRow].SetUnderlines( bCurrentSelections, GetCurrentHandler() ); - m_Row[m_iCurrentRow].SetTextFromHandler( GetCurrentHandler() ); - } + UpdateMenuFromSelections(); +} + +void OptionsList::UpdateMenuFromSelections() +{ + const vector &bCurrentSelections = m_bSelections.find(GetCurrentRow())->second; + m_Row[m_iCurrentRow].SetUnderlines( bCurrentSelections, GetCurrentHandler() ); + m_Row[m_iCurrentRow].SetTextFromHandler( GetCurrentHandler() ); } bool OptionsList::Start() diff --git a/stepmania/src/OptionsList.h b/stepmania/src/OptionsList.h index 8e207926bb..28379d8698 100644 --- a/stepmania/src/OptionsList.h +++ b/stepmania/src/OptionsList.h @@ -45,6 +45,8 @@ public: void Load( RString sType, PlayerNumber pn ); + void Link( OptionsList *pLink ) { m_pLinked = pLink; } + /* Show the top-level menu. */ void Open(); @@ -61,6 +63,7 @@ private: void MoveItem( const RString &sRowName, int iMove ); void SwitchMenu( int iDir ); void PositionCursor(); + void UpdateMenuFromSelections(); RString GetCurrentRow() const; const OptionRowHandler *GetCurrentHandler(); int GetOneSelection( RString sRow, bool bAllowFail=false ) const; @@ -75,6 +78,8 @@ private: InputQueueCodeSet m_Codes; + OptionsList *m_pLinked; + bool m_bStartIsDown; bool m_bAcceptStartRelease; diff --git a/stepmania/src/ScreenSelectMusic.cpp b/stepmania/src/ScreenSelectMusic.cpp index 8235cf9cf1..536cbc4740 100644 --- a/stepmania/src/ScreenSelectMusic.cpp +++ b/stepmania/src/ScreenSelectMusic.cpp @@ -140,6 +140,8 @@ void ScreenSelectMusic::Init() ActorUtil::LoadAllCommands( m_OptionsList[p], m_sName ); this->AddChild( &m_OptionsList[p] ); } + m_OptionsList[PLAYER_1].Link( &m_OptionsList[PLAYER_2] ); + m_OptionsList[PLAYER_2].Link( &m_OptionsList[PLAYER_1] ); } // this is loaded SetSong and TweenToSong