From 6ea2f37a367ab704abf54aa91070e2bbf1f47904 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 23 Sep 2005 00:44:52 +0000 Subject: [PATCH] Change MenuUp(pn,type) overrides to MenuUp(IEP), so info like DeviceI.ts is always accessible. --- stepmania/src/Screen.cpp | 31 +++++++----- stepmania/src/Screen.h | 16 +++---- stepmania/src/ScreenEditMenu.cpp | 4 +- stepmania/src/ScreenEditMenu.h | 4 +- stepmania/src/ScreenEz2SelectMusic.cpp | 4 +- stepmania/src/ScreenEz2SelectMusic.h | 4 +- stepmania/src/ScreenNameEntry.cpp | 2 +- stepmania/src/ScreenNameEntryTraditional.cpp | 27 +++++++---- stepmania/src/ScreenNameEntryTraditional.h | 9 ++-- stepmania/src/ScreenNetEvaluation.cpp | 12 ++--- stepmania/src/ScreenNetEvaluation.h | 8 ++-- stepmania/src/ScreenNetRoom.cpp | 20 ++++---- stepmania/src/ScreenNetRoom.h | 8 ++-- stepmania/src/ScreenNetSelectMusic.cpp | 26 ++++++---- stepmania/src/ScreenNetSelectMusic.h | 8 ++-- stepmania/src/ScreenNetworkOptions.cpp | 4 +- stepmania/src/ScreenNetworkOptions.h | 2 +- stepmania/src/ScreenOptions.cpp | 47 ++++++++++--------- stepmania/src/ScreenOptions.h | 17 +++---- stepmania/src/ScreenOptionsEditCourse.cpp | 2 +- stepmania/src/ScreenOptionsEditCourse.h | 2 +- .../src/ScreenOptionsEditCourseEntry.cpp | 2 +- stepmania/src/ScreenOptionsEditCourseEntry.h | 2 +- stepmania/src/ScreenOptionsEditProfile.cpp | 4 +- stepmania/src/ScreenOptionsEditProfile.h | 2 +- stepmania/src/ScreenOptionsManageCourses.cpp | 8 ++-- stepmania/src/ScreenOptionsManageCourses.h | 4 +- stepmania/src/ScreenOptionsManageProfiles.cpp | 2 +- stepmania/src/ScreenOptionsManageProfiles.h | 2 +- stepmania/src/ScreenPackages.cpp | 20 ++++---- stepmania/src/ScreenPackages.h | 8 ++-- stepmania/src/ScreenProfileOptions.cpp | 4 +- stepmania/src/ScreenProfileOptions.h | 2 +- stepmania/src/ScreenRanking.cpp | 11 ++--- stepmania/src/ScreenRanking.h | 16 +++---- stepmania/src/ScreenSMOnlineLogin.cpp | 4 +- stepmania/src/ScreenSMOnlineLogin.h | 2 +- stepmania/src/ScreenSelectMaster.cpp | 29 +++++++----- stepmania/src/ScreenSelectMaster.h | 8 ++-- stepmania/src/ScreenSelectMusic.cpp | 16 +++---- 40 files changed, 218 insertions(+), 185 deletions(-) diff --git a/stepmania/src/Screen.cpp b/stepmania/src/Screen.cpp index 4a642aa610..f02a729a86 100644 --- a/stepmania/src/Screen.cpp +++ b/stepmania/src/Screen.cpp @@ -135,12 +135,21 @@ void Screen::Update( float fDeltaTime ) } } -void Screen::MenuBack( PlayerNumber pn, const InputEventType type ) +void Screen::MenuUp( const InputEventPlus &input ) { if(input.type==IET_FIRST_PRESS) MenuUp(input.MenuI.player); } +void Screen::MenuDown( const InputEventPlus &input ) { if(input.type==IET_FIRST_PRESS) MenuDown(input.MenuI.player); } +void Screen::MenuLeft( const InputEventPlus &input ) { if(input.type==IET_FIRST_PRESS) MenuLeft(input.MenuI.player); } +void Screen::MenuRight( const InputEventPlus &input ) { if(input.type==IET_FIRST_PRESS) MenuRight(input.MenuI.player); } +void Screen::MenuStart( const InputEventPlus &input ) { if(input.type==IET_FIRST_PRESS) MenuStart(input.MenuI.player); } +void Screen::MenuSelect( const InputEventPlus &input ) { if(input.type==IET_FIRST_PRESS) MenuSelect(input.MenuI.player); } + +void Screen::MenuBack( const InputEventPlus &input ) { - if(!PREFSMAN->m_bDelayedBack || type==IET_SLOW_REPEAT || type==IET_FAST_REPEAT) - MenuBack(pn); + if(!PREFSMAN->m_bDelayedBack || input.type==IET_SLOW_REPEAT || input.type==IET_FAST_REPEAT) + MenuBack( input.MenuI.player) ; } +void Screen::MenuCoin( const InputEventPlus &input ) { if(input.type==IET_FIRST_PRESS) MenuCoin(input.MenuI.player); } + /* ScreenManager sends input here first. Overlay screens can use it to get a first * pass at input. Return true if the input was handled and should not be passed * to lower screens, or false if not handled. If true is returned, Input() will @@ -176,14 +185,14 @@ void Screen::Input( const InputEventPlus &input ) switch( input.MenuI.button ) { - case MENU_BUTTON_UP: this->MenuUp ( input.MenuI.player, input.type ); return; - case MENU_BUTTON_DOWN: this->MenuDown ( input.MenuI.player, input.type ); return; - case MENU_BUTTON_LEFT: this->MenuLeft ( input.MenuI.player, input.type ); return; - case MENU_BUTTON_RIGHT: this->MenuRight ( input.MenuI.player, input.type ); return; - case MENU_BUTTON_BACK: this->MenuBack ( input.MenuI.player, input.type ); return; - case MENU_BUTTON_START: this->MenuStart ( input.MenuI.player, input.type ); return; - case MENU_BUTTON_SELECT:this->MenuSelect( input.MenuI.player, input.type ); return; - case MENU_BUTTON_COIN: this->MenuCoin ( input.MenuI.player, input.type ); return; + case MENU_BUTTON_UP: this->MenuUp ( input ); return; + case MENU_BUTTON_DOWN: this->MenuDown ( input ); return; + case MENU_BUTTON_LEFT: this->MenuLeft ( input ); return; + case MENU_BUTTON_RIGHT: this->MenuRight ( input ); return; + case MENU_BUTTON_BACK: this->MenuBack ( input ); return; + case MENU_BUTTON_START: this->MenuStart ( input ); return; + case MENU_BUTTON_SELECT:this->MenuSelect( input ); return; + case MENU_BUTTON_COIN: this->MenuCoin ( input ); return; } } diff --git a/stepmania/src/Screen.h b/stepmania/src/Screen.h index d83225ebf8..ea8fea3309 100644 --- a/stepmania/src/Screen.h +++ b/stepmania/src/Screen.h @@ -84,14 +84,14 @@ protected: public: // let subclass override if they want - virtual void MenuUp( PlayerNumber pn, const InputEventType type ) { if(type==IET_FIRST_PRESS) MenuUp(pn); } - virtual void MenuDown( PlayerNumber pn, const InputEventType type ) { if(type==IET_FIRST_PRESS) MenuDown(pn); } - virtual void MenuLeft( PlayerNumber pn, const InputEventType type ) { if(type==IET_FIRST_PRESS) MenuLeft(pn); } - virtual void MenuRight( PlayerNumber pn, const InputEventType type ) { if(type==IET_FIRST_PRESS) MenuRight(pn); } - virtual void MenuStart( PlayerNumber pn, const InputEventType type ) { if(type==IET_FIRST_PRESS) MenuStart(pn); } - virtual void MenuSelect( PlayerNumber pn, const InputEventType type ) { if(type==IET_FIRST_PRESS) MenuSelect(pn); } - virtual void MenuBack( PlayerNumber pn, const InputEventType type ); - virtual void MenuCoin( PlayerNumber pn, const InputEventType type ) { if(type==IET_FIRST_PRESS) MenuCoin(pn); } + virtual void MenuUp( const InputEventPlus &input ); + virtual void MenuDown( const InputEventPlus &input ); + virtual void MenuLeft( const InputEventPlus &input ); + virtual void MenuRight( const InputEventPlus &input ); + virtual void MenuStart( const InputEventPlus &input ); + virtual void MenuSelect( const InputEventPlus &input ); + virtual void MenuBack( const InputEventPlus &input ); + virtual void MenuCoin( const InputEventPlus &input ); virtual void MenuUp( PlayerNumber pn ) {} virtual void MenuDown( PlayerNumber pn ) {} diff --git a/stepmania/src/ScreenEditMenu.cpp b/stepmania/src/ScreenEditMenu.cpp index f55f7ce298..92ed873d95 100644 --- a/stepmania/src/ScreenEditMenu.cpp +++ b/stepmania/src/ScreenEditMenu.cpp @@ -118,7 +118,7 @@ void ScreenEditMenu::MenuDown( PlayerNumber pn ) } } -void ScreenEditMenu::MenuLeft( PlayerNumber pn, const InputEventType type ) +void ScreenEditMenu::MenuLeft( const InputEventPlus &input ) { if( m_Selector.CanGoLeft() ) { @@ -126,7 +126,7 @@ void ScreenEditMenu::MenuLeft( PlayerNumber pn, const InputEventType type ) } } -void ScreenEditMenu::MenuRight( PlayerNumber pn, const InputEventType type ) +void ScreenEditMenu::MenuRight( const InputEventPlus &input ) { if( m_Selector.CanGoRight() ) { diff --git a/stepmania/src/ScreenEditMenu.h b/stepmania/src/ScreenEditMenu.h index a4ffb0559d..1cf28056a6 100644 --- a/stepmania/src/ScreenEditMenu.h +++ b/stepmania/src/ScreenEditMenu.h @@ -17,8 +17,8 @@ private: void MenuUp( PlayerNumber pn ); void MenuDown( PlayerNumber pn ); - void MenuLeft( PlayerNumber pn, const InputEventType type ); - void MenuRight( PlayerNumber pn, const InputEventType type ); + void MenuLeft( const InputEventPlus &input ); + void MenuRight( const InputEventPlus &input ); void MenuBack( PlayerNumber pn ); void MenuStart( PlayerNumber pn ); diff --git a/stepmania/src/ScreenEz2SelectMusic.cpp b/stepmania/src/ScreenEz2SelectMusic.cpp index 4f5e3f7373..011d9e26af 100644 --- a/stepmania/src/ScreenEz2SelectMusic.cpp +++ b/stepmania/src/ScreenEz2SelectMusic.cpp @@ -393,7 +393,7 @@ void ScreenEz2SelectMusic::HandleScreenMessage( const ScreenMessage SM ) } -void ScreenEz2SelectMusic::MenuRight( PlayerNumber pn, const InputEventType type ) +void ScreenEz2SelectMusic::MenuRight( const InputEventPlus &input ) { m_MenuTimer->Stall(); m_MusicBannerWheel.BannersRight(); @@ -438,7 +438,7 @@ void ScreenEz2SelectMusic::TweenOffScreen() } -void ScreenEz2SelectMusic::MenuLeft( PlayerNumber pn, const InputEventType type ) +void ScreenEz2SelectMusic::MenuLeft( const InputEventPlus &input ) { m_MenuTimer->Stall(); m_MusicBannerWheel.BannersLeft(); diff --git a/stepmania/src/ScreenEz2SelectMusic.h b/stepmania/src/ScreenEz2SelectMusic.h index 583b23a2e0..3b9ef46150 100644 --- a/stepmania/src/ScreenEz2SelectMusic.h +++ b/stepmania/src/ScreenEz2SelectMusic.h @@ -21,8 +21,8 @@ public: virtual void Input( const InputEventPlus &input ); virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void MenuStart( PlayerNumber pn ); - virtual void MenuLeft( PlayerNumber pn, const InputEventType type ); - virtual void MenuRight( PlayerNumber pn, const InputEventType type ); + virtual void MenuLeft( const InputEventPlus &input ); + virtual void MenuRight( const InputEventPlus &input ); virtual void MenuBack( PlayerNumber pn ); protected: diff --git a/stepmania/src/ScreenNameEntry.cpp b/stepmania/src/ScreenNameEntry.cpp index 2558a4ae13..55f232eee3 100644 --- a/stepmania/src/ScreenNameEntry.cpp +++ b/stepmania/src/ScreenNameEntry.cpp @@ -133,7 +133,7 @@ ScreenNameEntry::ScreenNameEntry( CString sClassName ) : Screen( sClassName ) { GAMESTATE->GetRankingFeats( p, aFeats[p] ); GAMESTATE->JoinPlayer( p ); - m_bStillEnteringName[p] = true;//aFeats[p].size()>0; + m_bStillEnteringName[p] = aFeats[p].size()>0; } if( !AnyStillEntering() ) diff --git a/stepmania/src/ScreenNameEntryTraditional.cpp b/stepmania/src/ScreenNameEntryTraditional.cpp index cb705928b4..9feae562d9 100644 --- a/stepmania/src/ScreenNameEntryTraditional.cpp +++ b/stepmania/src/ScreenNameEntryTraditional.cpp @@ -23,6 +23,7 @@ #include "Style.h" #include "ScreenDimensions.h" #include "Command.h" +#include "InputEventPlus.h" // // Defines specific to ScreenNameEntryTraditional @@ -561,7 +562,7 @@ void ScreenNameEntryTraditional::HandleScreenMessage( const ScreenMessage SM ) { FOREACH_PlayerNumber( p ) Finish( p ); - MenuStart( PLAYER_INVALID, IET_FIRST_PRESS ); + HandleStart( PLAYER_INVALID ); } } else if( SM == SM_ChangeDisplayedFeat ) @@ -610,7 +611,15 @@ void ScreenNameEntryTraditional::UpdateSelectionText( int pn ) m_textSelection[pn].SetText( WStringToCString(text) ); } -void ScreenNameEntryTraditional::MenuStart( PlayerNumber pn, const InputEventType type ) +void ScreenNameEntryTraditional::MenuStart( const InputEventPlus &input ) +{ + if( input.type != IET_FIRST_PRESS ) + return; // ignore + + HandleStart( input.MenuI.player ); +} + +void ScreenNameEntryTraditional::HandleStart( PlayerNumber pn ) { /* The screen may have started out with nobody entering, in which case we're * just showing scores and the first Start press moves on. */ @@ -622,8 +631,6 @@ void ScreenNameEntryTraditional::MenuStart( PlayerNumber pn, const InputEventTyp if( !m_bStillEnteringName[pn] ) return; // ignore - if( type != IET_FIRST_PRESS ) - return; // ignore const int CurrentSelection = m_SelectedChar[pn]; const int SelectedLetter = m_AlphabetLetter[pn][CurrentSelection]; @@ -656,11 +663,13 @@ void ScreenNameEntryTraditional::MenuStart( PlayerNumber pn, const InputEventTyp } } -void ScreenNameEntryTraditional::MenuSelect( PlayerNumber pn, const InputEventType type ) +void ScreenNameEntryTraditional::MenuSelect( const InputEventPlus &input ) { + PlayerNumber pn = input.MenuI.player; + if( !m_bStillEnteringName[pn] ) return; // ignore - if( type != IET_FIRST_PRESS ) + if( input.type != IET_FIRST_PRESS ) return; // ignore Backspace( pn ); @@ -693,8 +702,9 @@ void ScreenNameEntryTraditional::Backspace( PlayerNumber pn ) m_soundKey.Play(); } -void ScreenNameEntryTraditional::MenuLeft( PlayerNumber pn, const InputEventType type ) +void ScreenNameEntryTraditional::MenuLeft( const InputEventPlus &input ) { + PlayerNumber pn = input.MenuI.player; if( !m_bStillEnteringName[pn] || IsTransitioning() ) return; @@ -704,8 +714,9 @@ void ScreenNameEntryTraditional::MenuLeft( PlayerNumber pn, const InputEventType m_soundChange.Play(); } -void ScreenNameEntryTraditional::MenuRight( PlayerNumber pn, const InputEventType type ) +void ScreenNameEntryTraditional::MenuRight( const InputEventPlus &input ) { + PlayerNumber pn = input.MenuI.player; if( !m_bStillEnteringName[pn] || IsTransitioning() ) return; diff --git a/stepmania/src/ScreenNameEntryTraditional.h b/stepmania/src/ScreenNameEntryTraditional.h index 199d37b0ad..9faf64dbd9 100644 --- a/stepmania/src/ScreenNameEntryTraditional.h +++ b/stepmania/src/ScreenNameEntryTraditional.h @@ -49,10 +49,10 @@ public: void HandleScreenMessage( const ScreenMessage SM ); void Input( const InputEventPlus &input ); - void MenuStart( PlayerNumber pn, const InputEventType type ); - void MenuSelect( PlayerNumber pn, const InputEventType type ); - void MenuLeft( PlayerNumber pn, const InputEventType type ); - void MenuRight( PlayerNumber pn, const InputEventType type ); + void MenuStart( const InputEventPlus &input ); + void MenuSelect( const InputEventPlus &input ); + void MenuLeft( const InputEventPlus &input ); + void MenuRight( const InputEventPlus &input ); private: bool AnyStillEntering() const; @@ -63,6 +63,7 @@ private: void ChangeDisplayedFeat(); void SelectChar( PlayerNumber pn, int c ); void Backspace( PlayerNumber pn ); + void HandleStart( PlayerNumber pn ); ThemeMetric ALPHABET_GAP_X; ThemeMetric NUM_ALPHABET_DISPLAYED; diff --git a/stepmania/src/ScreenNetEvaluation.cpp b/stepmania/src/ScreenNetEvaluation.cpp index c90e0fa9c8..83248c2648 100644 --- a/stepmania/src/ScreenNetEvaluation.cpp +++ b/stepmania/src/ScreenNetEvaluation.cpp @@ -88,12 +88,12 @@ void ScreenNetEvaluation::RedoUserTexts() } } -void ScreenNetEvaluation::MenuLeft( PlayerNumber pn, const InputEventType type ) +void ScreenNetEvaluation::MenuLeft( const InputEventPlus &input ) { - MenuUp( pn, type ); + MenuUp( input ); } -void ScreenNetEvaluation::MenuUp( PlayerNumber pn, const InputEventType type ) +void ScreenNetEvaluation::MenuUp( const InputEventPlus &input ) { if ( m_iActivePlayers == 0 ) return; @@ -105,12 +105,12 @@ void ScreenNetEvaluation::MenuUp( PlayerNumber pn, const InputEventType type ) UpdateStats(); } -void ScreenNetEvaluation::MenuRight( PlayerNumber pn, const InputEventType type ) +void ScreenNetEvaluation::MenuRight( const InputEventPlus &input ) { - MenuDown( pn, type ); + MenuDown( input ); } -void ScreenNetEvaluation::MenuDown( PlayerNumber pn, const InputEventType type ) +void ScreenNetEvaluation::MenuDown( const InputEventPlus &input ) { if ( m_iActivePlayers == 0 ) return; diff --git a/stepmania/src/ScreenNetEvaluation.h b/stepmania/src/ScreenNetEvaluation.h index 4b898c9d08..9fbdab5b78 100644 --- a/stepmania/src/ScreenNetEvaluation.h +++ b/stepmania/src/ScreenNetEvaluation.h @@ -11,10 +11,10 @@ public: virtual void Init(); protected: - virtual void MenuLeft( PlayerNumber pn, const InputEventType type ); - virtual void MenuUp( PlayerNumber pn, const InputEventType type ); - virtual void MenuRight( PlayerNumber pn, const InputEventType type ); - virtual void MenuDown( PlayerNumber pn, const InputEventType type ); + virtual void MenuLeft( const InputEventPlus &input ); + virtual void MenuUp( const InputEventPlus &input ); + virtual void MenuRight( const InputEventPlus &input ); + virtual void MenuDown( const InputEventPlus &input ); virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void TweenOffScreen( ); diff --git a/stepmania/src/ScreenNetRoom.cpp b/stepmania/src/ScreenNetRoom.cpp index 58b25a9199..d081833c08 100644 --- a/stepmania/src/ScreenNetRoom.cpp +++ b/stepmania/src/ScreenNetRoom.cpp @@ -212,32 +212,32 @@ void ScreenNetRoom::MenuBack( PlayerNumber pn ) ScreenNetSelectBase::MenuBack( pn ); } -void ScreenNetRoom::MenuUp( PlayerNumber pn, const InputEventType type ) +void ScreenNetRoom::MenuUp( const InputEventPlus &input ) { - ScreenNetSelectBase::MenuUp( pn ); + ScreenNetSelectBase::MenuUp( input.MenuI.player ); } -void ScreenNetRoom::MenuDown( PlayerNumber pn, const InputEventType type ) +void ScreenNetRoom::MenuDown( const InputEventPlus &input ) { - ScreenNetSelectBase::MenuDown( pn ); + ScreenNetSelectBase::MenuDown( input.MenuI.player ); } -void ScreenNetRoom::MenuLeft( PlayerNumber pn, const InputEventType type ) +void ScreenNetRoom::MenuLeft( const InputEventPlus &input ) { - if (type == IET_FIRST_PRESS) + if( input.type == IET_FIRST_PRESS ) m_RoomWheel.Move(-1); - ScreenNetSelectBase::MenuLeft( pn ); + ScreenNetSelectBase::MenuLeft( input.MenuI.player ); } -void ScreenNetRoom::MenuRight( PlayerNumber pn, const InputEventType type ) +void ScreenNetRoom::MenuRight( const InputEventPlus &input ) { - if (type == IET_FIRST_PRESS) + if( input.type == IET_FIRST_PRESS ) { m_RoomWheel.Move(1); } - ScreenNetSelectBase::MenuRight( pn ); + ScreenNetSelectBase::MenuRight( input.MenuI.player ); } void ScreenNetRoom::UpdateRoomsList() diff --git a/stepmania/src/ScreenNetRoom.h b/stepmania/src/ScreenNetRoom.h index 7a3e818380..6bb998f5a1 100644 --- a/stepmania/src/ScreenNetRoom.h +++ b/stepmania/src/ScreenNetRoom.h @@ -39,8 +39,8 @@ public: protected: virtual void MenuStart( PlayerNumber pn ); - virtual void MenuUp( PlayerNumber pn, const InputEventType type ); - virtual void MenuDown( PlayerNumber pn, const InputEventType type ); + virtual void MenuUp( const InputEventPlus &input ); + virtual void MenuDown( const InputEventPlus &input ); virtual void MenuBack( PlayerNumber pn ); virtual void TweenOffScreen( ); @@ -48,8 +48,8 @@ protected: private: void UpdateRoomsList(); - void MenuLeft( PlayerNumber pn, const InputEventType type ); - void MenuRight( PlayerNumber pn, const InputEventType type ); + void MenuLeft( const InputEventPlus &input ); + void MenuRight( const InputEventPlus &input ); void CreateNewRoom( const CString& rName, const CString& rDesc ); void DeployInfoBox(); diff --git a/stepmania/src/ScreenNetSelectMusic.cpp b/stepmania/src/ScreenNetSelectMusic.cpp index 71b50cc31a..89d4feb1b8 100644 --- a/stepmania/src/ScreenNetSelectMusic.cpp +++ b/stepmania/src/ScreenNetSelectMusic.cpp @@ -310,45 +310,51 @@ done: ScreenNetSelectBase::HandleScreenMessage( SM ); } -void ScreenNetSelectMusic::MenuLeft( PlayerNumber pn, const InputEventType type ) +void ScreenNetSelectMusic::MenuLeft( const InputEventPlus &input ) { - bool bLeftPressed = INPUTMAPPER->IsButtonDown( MenuInput(pn, MENU_BUTTON_LEFT) ); - bool bRightPressed = INPUTMAPPER->IsButtonDown( MenuInput(pn, MENU_BUTTON_RIGHT) ); + bool bLeftPressed = INPUTMAPPER->IsButtonDown( MenuInput(input.MenuI.player, MENU_BUTTON_LEFT) ); + bool bRightPressed = INPUTMAPPER->IsButtonDown( MenuInput(input.MenuI.player, MENU_BUTTON_RIGHT) ); bool bLeftAndRightPressed = bLeftPressed && bRightPressed; - if ( type == IET_FIRST_PRESS ) + if( input.type == IET_FIRST_PRESS ) + { if ( bLeftAndRightPressed ) m_MusicWheel.ChangeSort( SORT_MODE_MENU ); else m_MusicWheel.Move( -1 ); + } } -void ScreenNetSelectMusic::MenuRight( PlayerNumber pn, const InputEventType type ) +void ScreenNetSelectMusic::MenuRight( const InputEventPlus &input ) { - bool bLeftPressed = INPUTMAPPER->IsButtonDown( MenuInput ( pn, MENU_BUTTON_LEFT ) ); - bool bRightPressed = INPUTMAPPER->IsButtonDown( MenuInput( pn, MENU_BUTTON_RIGHT )) ; + bool bLeftPressed = INPUTMAPPER->IsButtonDown( MenuInput (input.MenuI.player, MENU_BUTTON_LEFT) ); + bool bRightPressed = INPUTMAPPER->IsButtonDown( MenuInput(input.MenuI.player, MENU_BUTTON_RIGHT) ) ; bool bLeftAndRightPressed = bLeftPressed && bRightPressed; - if ( type == IET_FIRST_PRESS ) + if( input.type == IET_FIRST_PRESS ) + { if ( bLeftAndRightPressed ) m_MusicWheel.ChangeSort( SORT_MODE_MENU ); else m_MusicWheel.Move( +1 ); + } } -void ScreenNetSelectMusic::MenuUp( PlayerNumber pn, const InputEventType type ) +void ScreenNetSelectMusic::MenuUp( const InputEventPlus &input ) { NSMAN->ReportNSSOnOff(3); GAMESTATE->m_EditMode = EDIT_MODE_FULL; SCREENMAN->AddNewScreenToTop( "ScreenPlayerOptions", SM_BackFromPlayerOptions ); } -void ScreenNetSelectMusic::MenuDown( PlayerNumber pn, const InputEventType type ) +void ScreenNetSelectMusic::MenuDown( const InputEventPlus &input ) { /*Tricky: If we have a player on player 2, and there is only player 2, allow them to use player 1's controls to change their difficulty. */ + /* Why? Nothing else allows that. */ + PlayerNumber pn = input.MenuI.player; if ( GAMESTATE->IsPlayerEnabled( PLAYER_2 ) && !GAMESTATE->IsPlayerEnabled( PLAYER_1 ) ) pn = PLAYER_2; diff --git a/stepmania/src/ScreenNetSelectMusic.h b/stepmania/src/ScreenNetSelectMusic.h index 0138c554dc..dbd19ea844 100644 --- a/stepmania/src/ScreenNetSelectMusic.h +++ b/stepmania/src/ScreenNetSelectMusic.h @@ -53,10 +53,10 @@ private: protected: virtual void MenuStart( PlayerNumber pn ); - virtual void MenuLeft( PlayerNumber pn, const InputEventType type ); - virtual void MenuUp( PlayerNumber pn, const InputEventType type ); - virtual void MenuDown( PlayerNumber pn, const InputEventType type ); - virtual void MenuRight( PlayerNumber pn, const InputEventType type ); + virtual void MenuLeft( const InputEventPlus &input ); + virtual void MenuUp( const InputEventPlus &input ); + virtual void MenuDown( const InputEventPlus &input ); + virtual void MenuRight( const InputEventPlus &input ); virtual void MenuBack( PlayerNumber pn ); virtual void Update( float fDeltaTime ); diff --git a/stepmania/src/ScreenNetworkOptions.cpp b/stepmania/src/ScreenNetworkOptions.cpp index fb1c84d550..69896f5896 100644 --- a/stepmania/src/ScreenNetworkOptions.cpp +++ b/stepmania/src/ScreenNetworkOptions.cpp @@ -117,7 +117,7 @@ void ScreenNetworkOptions::HandleScreenMessage( const ScreenMessage SM ) } -void ScreenNetworkOptions::MenuStart( PlayerNumber pn, const InputEventType type ) +void ScreenNetworkOptions::MenuStart( const InputEventPlus &input ) { #if defined( WITHOUT_NETWORKING ) #else @@ -159,7 +159,7 @@ void ScreenNetworkOptions::MenuStart( PlayerNumber pn, const InputEventType type PREFSMAN->m_bEnableScoreboard.Set(false); break; default: - ScreenOptions::MenuStart( pn, type ); + ScreenOptions::MenuStart( input ); } #endif } diff --git a/stepmania/src/ScreenNetworkOptions.h b/stepmania/src/ScreenNetworkOptions.h index 7755ab90b2..12c273d419 100644 --- a/stepmania/src/ScreenNetworkOptions.h +++ b/stepmania/src/ScreenNetworkOptions.h @@ -11,7 +11,7 @@ public: virtual void HandleScreenMessage( const ScreenMessage SM ); - virtual void MenuStart( PlayerNumber pn, const InputEventType type ); + virtual void MenuStart( const InputEventPlus &input ); private: void ImportOptions( int iRow, const vector &vpns ); diff --git a/stepmania/src/ScreenOptions.cpp b/stepmania/src/ScreenOptions.cpp index cb5b8e6d48..971c12193b 100644 --- a/stepmania/src/ScreenOptions.cpp +++ b/stepmania/src/ScreenOptions.cpp @@ -863,9 +863,10 @@ bool ScreenOptions::AllAreOnLastRow() const return true; } -void ScreenOptions::MenuStart( PlayerNumber pn, const InputEventType type ) +void ScreenOptions::MenuStart( const InputEventPlus &input ) { - switch( type ) + PlayerNumber pn = input.MenuI.player; + switch( input.type ) { case IET_FIRST_PRESS: m_bGotAtLeastOneStartPressed[pn] = true; @@ -890,17 +891,18 @@ void ScreenOptions::MenuStart( PlayerNumber pn, const InputEventType type ) INPUTMAPPER->IsButtonDown( MenuInput(pn, MENU_BUTTON_LEFT) ); if( bHoldingLeftAndRight ) { - MoveRowRelative( pn, -1, type != IET_FIRST_PRESS ); + MoveRowRelative( pn, -1, input.type != IET_FIRST_PRESS ); return; } } } - this->ProcessMenuStart( pn, type ); + this->ProcessMenuStart( input ); } -void ScreenOptions::ProcessMenuStart( PlayerNumber pn, const InputEventType type ) +void ScreenOptions::ProcessMenuStart( const InputEventPlus &input ) { + PlayerNumber pn = input.MenuI.player; int iCurRow = m_iCurrentRow[pn]; OptionRow &row = *m_pRows[iCurRow]; @@ -919,7 +921,7 @@ void ScreenOptions::ProcessMenuStart( PlayerNumber pn, const InputEventType type bEndThisScreen = true; /* Don't accept START to go to the next screen if we're still transitioning in. */ - if( type != IET_FIRST_PRESS || IsTransitioning() ) + if( input.type != IET_FIRST_PRESS || IsTransitioning() ) bEndThisScreen = false; if( bEndThisScreen ) @@ -934,7 +936,7 @@ void ScreenOptions::ProcessMenuStart( PlayerNumber pn, const InputEventType type int iChoiceInRow = row.GetChoiceInRowWithFocus(pn); if( iChoiceInRow == 0 ) { - MenuDown( pn, type ); + MenuDown( input ); return; } } @@ -956,7 +958,7 @@ void ScreenOptions::ProcessMenuStart( PlayerNumber pn, const InputEventType type if( row.GetFirstItemGoesDown() ) { // move to the first choice in the row - ChangeValueInRowRelative( m_iCurrentRow[pn], pn, -row.GetChoiceInRowWithFocus(pn), type != IET_FIRST_PRESS ); + ChangeValueInRowRelative( m_iCurrentRow[pn], pn, -row.GetChoiceInRowWithFocus(pn), input.type != IET_FIRST_PRESS ); } } else // data.selectType != SELECT_MULTIPLE @@ -967,7 +969,7 @@ void ScreenOptions::ProcessMenuStart( PlayerNumber pn, const InputEventType type // don't wrap if( iCurRow == (int)m_pRows.size()-1 ) return; - MenuDown( pn, type ); + MenuDown( input ); break; case NAV_TOGGLE_THREE_KEY: case NAV_TOGGLE_FIVE_KEY: @@ -980,19 +982,19 @@ void ScreenOptions::ProcessMenuStart( PlayerNumber pn, const InputEventType type row.SetOneSelection( pn, iChoiceInRow ); } if( row.GetFirstItemGoesDown() ) - ChangeValueInRowRelative( m_iCurrentRow[pn], pn, -row.GetChoiceInRowWithFocus(pn), type != IET_FIRST_PRESS ); // move to the first choice + ChangeValueInRowRelative( m_iCurrentRow[pn], pn, -row.GetChoiceInRowWithFocus(pn), input.type != IET_FIRST_PRESS ); // move to the first choice else - ChangeValueInRowRelative( m_iCurrentRow[pn], pn, 0, type != IET_FIRST_PRESS ); + ChangeValueInRowRelative( m_iCurrentRow[pn], pn, 0, input.type != IET_FIRST_PRESS ); break; case NAV_THREE_KEY_MENU: /* Don't accept START to go to the next screen if we're still transitioning in. */ - if( type == IET_FIRST_PRESS && !IsTransitioning() ) + if( input.type == IET_FIRST_PRESS && !IsTransitioning() ) this->BeginFadingOut(); break; case NAV_FIVE_KEY: /* Jump to the exit row. (If everyone's already on the exit row, then * we'll have already gone to the next screen above.) */ - MoveRowRelative( pn, m_pRows.size()-m_iCurrentRow[pn]-1, type != IET_FIRST_PRESS ); + MoveRowRelative( pn, m_pRows.size()-m_iCurrentRow[pn]-1, input.type != IET_FIRST_PRESS ); break; } } @@ -1230,26 +1232,27 @@ void ScreenOptions::MoveRowAbsolute( PlayerNumber pn, int iRow, bool bRepeat ) MoveRowRelative( pn, iDir, bRepeat ); } -void ScreenOptions::MenuUp( PlayerNumber pn, const InputEventType type ) +void ScreenOptions::MenuUp( const InputEventPlus &input ) { - MenuUpDown( pn, type, -1 ); + MenuUpDown( input, -1 ); } -void ScreenOptions::MenuDown( PlayerNumber pn, const InputEventType type ) +void ScreenOptions::MenuDown( const InputEventPlus &input ) { - MenuUpDown( pn, type, +1 ); + MenuUpDown( input, +1 ); } -void ScreenOptions::MenuSelect( PlayerNumber pn, const InputEventType type ) +void ScreenOptions::MenuSelect( const InputEventPlus &input ) { - MenuUpDown( pn, type, -1 ); + MenuUpDown( input, -1 ); } -void ScreenOptions::MenuUpDown( PlayerNumber pn, const InputEventType type, int iDir ) +void ScreenOptions::MenuUpDown( const InputEventPlus &input, int iDir ) { ASSERT( iDir == -1 || iDir == +1 ); + PlayerNumber pn = input.MenuI.player; - if( type == IET_SLOW_REPEAT || type == IET_FAST_REPEAT ) + if( input.type == IET_SLOW_REPEAT || input.type == IET_FAST_REPEAT ) { /* If down is pressed, don't allow up to repeat, and vice versa. This prevents * holding both up and down from toggling repeatedly in-place. */ @@ -1267,7 +1270,7 @@ void ScreenOptions::MenuUpDown( PlayerNumber pn, const InputEventType type, int } } - bool bRepeat = type != IET_FIRST_PRESS; + bool bRepeat = input.type != IET_FIRST_PRESS; int iDest = -1; for( int r=1; r<(int)m_pRows.size(); r++ ) diff --git a/stepmania/src/ScreenOptions.h b/stepmania/src/ScreenOptions.h index 2d8959d902..6eba985b20 100644 --- a/stepmania/src/ScreenOptions.h +++ b/stepmania/src/ScreenOptions.h @@ -10,6 +10,7 @@ #include "OptionRow.h" #include "OptionsCursor.h" #include "LuaExpressionTransform.h" +#include "InputEventPlus.h" class OptionRowHandler; @@ -62,8 +63,8 @@ protected: void UpdateEnabledDisabled( int iRow ); virtual void MenuBack( PlayerNumber pn ); - virtual void MenuStart( PlayerNumber pn, const InputEventType type ); - virtual void ProcessMenuStart( PlayerNumber pn, const InputEventType type ); + virtual void MenuStart( const InputEventPlus &input ); + virtual void ProcessMenuStart( const InputEventPlus &input ); virtual void BeginFadingOut() { this->PostScreenMessage( SM_BeginFadingOut, 0 ); } @@ -75,12 +76,12 @@ protected: virtual void AfterChangeRow( PlayerNumber pn ); // override this to detect when the row has changed virtual void AfterChangeValueOrRow( PlayerNumber pn ); - virtual void MenuLeft( PlayerNumber pn, const InputEventType type ) { ChangeValueInRowRelative(m_iCurrentRow[pn],pn,-1,type != IET_FIRST_PRESS); } - virtual void MenuRight( PlayerNumber pn, const InputEventType type ) { ChangeValueInRowRelative(m_iCurrentRow[pn],pn,+1,type != IET_FIRST_PRESS); } - virtual void MenuUp( PlayerNumber pn, const InputEventType type ); - virtual void MenuDown( PlayerNumber pn, const InputEventType type ); - virtual void MenuSelect( PlayerNumber pn, const InputEventType type ); - virtual void MenuUpDown( PlayerNumber pn, const InputEventType type, int iDir ); // iDir == -1 or iDir == +1 + virtual void MenuLeft( const InputEventPlus &input ) { ChangeValueInRowRelative(m_iCurrentRow[input.MenuI.player],input.MenuI.player,-1, input.type != IET_FIRST_PRESS); } + virtual void MenuRight( const InputEventPlus &input ) { ChangeValueInRowRelative(m_iCurrentRow[input.MenuI.player], input.MenuI.player,+1, input.type != IET_FIRST_PRESS); } + virtual void MenuUp( const InputEventPlus &input ); + virtual void MenuDown( const InputEventPlus &input ); + virtual void MenuSelect( const InputEventPlus &input ); + virtual void MenuUpDown( const InputEventPlus &input, int iDir ); // iDir == -1 or iDir == +1 /* Returns -1 if on a row with no OptionRowDefinition (eg. EXIT). */ int GetCurrentRow(PlayerNumber pn = PLAYER_1) const; diff --git a/stepmania/src/ScreenOptionsEditCourse.cpp b/stepmania/src/ScreenOptionsEditCourse.cpp index 271a377149..aa511f31ed 100644 --- a/stepmania/src/ScreenOptionsEditCourse.cpp +++ b/stepmania/src/ScreenOptionsEditCourse.cpp @@ -238,7 +238,7 @@ void ScreenOptionsEditCourse::ExportOptions( int iRow, const vectorm_pCurCourse; diff --git a/stepmania/src/ScreenOptionsEditCourse.h b/stepmania/src/ScreenOptionsEditCourse.h index 427287ab3b..e0db988b1c 100644 --- a/stepmania/src/ScreenOptionsEditCourse.h +++ b/stepmania/src/ScreenOptionsEditCourse.h @@ -20,7 +20,7 @@ protected: virtual void AfterChangeRow( PlayerNumber pn ); virtual void AfterChangeValueInRow( int iRow, PlayerNumber pn ); - virtual void ProcessMenuStart( PlayerNumber pn, const InputEventType type ); + virtual void ProcessMenuStart( const InputEventPlus &input ); int GetCourseEntryIndexWithFocus() const; diff --git a/stepmania/src/ScreenOptionsEditCourseEntry.cpp b/stepmania/src/ScreenOptionsEditCourseEntry.cpp index 5143345025..4812199ca5 100644 --- a/stepmania/src/ScreenOptionsEditCourseEntry.cpp +++ b/stepmania/src/ScreenOptionsEditCourseEntry.cpp @@ -388,7 +388,7 @@ void ScreenOptionsEditCourseEntry::ExportOptions( int iRow, const vectorm_MasterPlayerNumber] ) { diff --git a/stepmania/src/ScreenOptionsEditCourseEntry.h b/stepmania/src/ScreenOptionsEditCourseEntry.h index 589af2b71c..700d823c8f 100644 --- a/stepmania/src/ScreenOptionsEditCourseEntry.h +++ b/stepmania/src/ScreenOptionsEditCourseEntry.h @@ -21,7 +21,7 @@ protected: virtual void ExportOptions( int iRow, const vector &vpns ); virtual void AfterChangeValueInRow( int iRow, PlayerNumber pn ); - virtual void ProcessMenuStart( PlayerNumber pn, const InputEventType type ); + virtual void ProcessMenuStart( const InputEventPlus &input ); vector m_vpDisplayedSongs; // corresponds with the choices in the Song row diff --git a/stepmania/src/ScreenOptionsEditProfile.cpp b/stepmania/src/ScreenOptionsEditProfile.cpp index 694c9ea0cc..7cbe137ffc 100644 --- a/stepmania/src/ScreenOptionsEditProfile.cpp +++ b/stepmania/src/ScreenOptionsEditProfile.cpp @@ -129,7 +129,7 @@ void ScreenOptionsEditProfile::AfterChangeValueInRow( int iRow, PlayerNumber pn GAMESTATE->m_sEditLocalProfileID.Set( GAMESTATE->m_sEditLocalProfileID ); } -void ScreenOptionsEditProfile::ProcessMenuStart( PlayerNumber pn, const InputEventType type ) +void ScreenOptionsEditProfile::ProcessMenuStart( const InputEventPlus &input ) { int iRow = GetCurrentRow();; //OptionRow &row = *m_pRows[iRow]; @@ -141,7 +141,7 @@ void ScreenOptionsEditProfile::ProcessMenuStart( PlayerNumber pn, const InputEve } break; default: - ScreenOptions::ProcessMenuStart( pn, type ); + ScreenOptions::ProcessMenuStart( input ); break; } } diff --git a/stepmania/src/ScreenOptionsEditProfile.h b/stepmania/src/ScreenOptionsEditProfile.h index fbafe00df8..fcea873a8d 100644 --- a/stepmania/src/ScreenOptionsEditProfile.h +++ b/stepmania/src/ScreenOptionsEditProfile.h @@ -23,7 +23,7 @@ private: virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void AfterChangeValueInRow( int iRow, PlayerNumber pn ); - virtual void ProcessMenuStart( PlayerNumber pn, const InputEventType type ); + virtual void ProcessMenuStart( const InputEventPlus &input ); Profile m_Original; // restore this on revert }; diff --git a/stepmania/src/ScreenOptionsManageCourses.cpp b/stepmania/src/ScreenOptionsManageCourses.cpp index 409494f381..2ebe92b293 100644 --- a/stepmania/src/ScreenOptionsManageCourses.cpp +++ b/stepmania/src/ScreenOptionsManageCourses.cpp @@ -67,9 +67,9 @@ ScreenOptionsEditCourseSubMenu::ScreenOptionsEditCourseSubMenu( CString sName ) } -void ScreenOptionsEditCourseSubMenu::MenuSelect( PlayerNumber pn, const InputEventType type ) +void ScreenOptionsEditCourseSubMenu::MenuSelect( const InputEventPlus &input ) { - if( type == IET_FIRST_PRESS ) + if( input.type == IET_FIRST_PRESS ) { SetNextCombination(); @@ -78,7 +78,7 @@ void ScreenOptionsEditCourseSubMenu::MenuSelect( PlayerNumber pn, const InputEve return; } - ScreenOptions::MenuSelect( pn, type ); + ScreenOptions::MenuSelect( input ); } @@ -343,7 +343,7 @@ void ScreenOptionsManageCourses::AfterChangeRow( PlayerNumber pn ) ScreenOptions::AfterChangeRow( pn ); } -void ScreenOptionsManageCourses::ProcessMenuStart( PlayerNumber pn, const InputEventType type ) +void ScreenOptionsManageCourses::ProcessMenuStart( const InputEventPlus &input ) { int iCurRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber]; diff --git a/stepmania/src/ScreenOptionsManageCourses.h b/stepmania/src/ScreenOptionsManageCourses.h index e536ff1c72..ad1480febd 100644 --- a/stepmania/src/ScreenOptionsManageCourses.h +++ b/stepmania/src/ScreenOptionsManageCourses.h @@ -11,7 +11,7 @@ public: ScreenOptionsEditCourseSubMenu( CString sName ); protected: - virtual void MenuSelect( PlayerNumber pn, const InputEventType type ); + virtual void MenuSelect( const InputEventPlus &input ); }; class ScreenOptionsManageCourses : public ScreenOptionsEditCourseSubMenu @@ -29,7 +29,7 @@ protected: virtual void ExportOptions( int iRow, const vector &vpns ); virtual void AfterChangeRow( PlayerNumber pn ); - virtual void ProcessMenuStart( PlayerNumber pn, const InputEventType type ); + virtual void ProcessMenuStart( const InputEventPlus &input ); Course *GetCourseWithFocus() const; diff --git a/stepmania/src/ScreenOptionsManageProfiles.cpp b/stepmania/src/ScreenOptionsManageProfiles.cpp index 60009acf6f..a3ea362d31 100644 --- a/stepmania/src/ScreenOptionsManageProfiles.cpp +++ b/stepmania/src/ScreenOptionsManageProfiles.cpp @@ -344,7 +344,7 @@ void ScreenOptionsManageProfiles::AfterChangeRow( PlayerNumber pn ) ScreenOptions::AfterChangeRow( pn ); } -void ScreenOptionsManageProfiles::ProcessMenuStart( PlayerNumber pn, const InputEventType type ) +void ScreenOptionsManageProfiles::ProcessMenuStart( const InputEventPlus &input ) { int iCurRow = m_iCurrentRow[GAMESTATE->m_MasterPlayerNumber]; OptionRow &row = *m_pRows[iCurRow]; diff --git a/stepmania/src/ScreenOptionsManageProfiles.h b/stepmania/src/ScreenOptionsManageProfiles.h index 5c308178f4..be25537143 100644 --- a/stepmania/src/ScreenOptionsManageProfiles.h +++ b/stepmania/src/ScreenOptionsManageProfiles.h @@ -22,7 +22,7 @@ protected: virtual void ExportOptions( int iRow, const vector &vpns ); virtual void AfterChangeRow( PlayerNumber pn ); - virtual void ProcessMenuStart( PlayerNumber pn, const InputEventType type ); + virtual void ProcessMenuStart( const InputEventPlus &input ); int GetLocalProfileIndexWithFocus() const; CString GetLocalProfileIDWithFocus() const; diff --git a/stepmania/src/ScreenPackages.cpp b/stepmania/src/ScreenPackages.cpp index fb9e4c0d8d..3d8820b21c 100644 --- a/stepmania/src/ScreenPackages.cpp +++ b/stepmania/src/ScreenPackages.cpp @@ -171,7 +171,7 @@ void ScreenPackages::MenuStart( PlayerNumber pn ) ScreenWithMenuElements::MenuStart( pn ); } -void ScreenPackages::MenuUp( PlayerNumber pn, const InputEventType type ) +void ScreenPackages::MenuUp( const InputEventPlus &input ) { if ( m_bIsDownloading ) return; @@ -191,10 +191,10 @@ void ScreenPackages::MenuUp( PlayerNumber pn, const InputEventType type ) UpdateLinksList(); } } - ScreenWithMenuElements::MenuUp( pn, type ); + ScreenWithMenuElements::MenuUp( input ); } -void ScreenPackages::MenuDown( PlayerNumber pn, const InputEventType type ) +void ScreenPackages::MenuDown( const InputEventPlus &input ) { if ( m_bIsDownloading ) return; @@ -215,10 +215,10 @@ void ScreenPackages::MenuDown( PlayerNumber pn, const InputEventType type ) UpdateLinksList(); } } - ScreenWithMenuElements::MenuDown( pn, type ); + ScreenWithMenuElements::MenuDown( input ); } -void ScreenPackages::MenuLeft( PlayerNumber pn, const InputEventType type ) +void ScreenPackages::MenuLeft( const InputEventPlus &input ) { if ( m_bIsDownloading ) return; @@ -240,15 +240,17 @@ void ScreenPackages::MenuLeft( PlayerNumber pn, const InputEventType type ) COMMAND( m_sprExistingBG, "Back" ); COMMAND( m_sprWebBG, "Away" ); } - ScreenWithMenuElements::MenuLeft( pn, type ); + ScreenWithMenuElements::MenuLeft( input ); } -void ScreenPackages::MenuRight( PlayerNumber pn, const InputEventType type ) +void ScreenPackages::MenuRight( const InputEventPlus &input ) { if ( m_bIsDownloading ) return; - MenuLeft( pn, type ); - ScreenWithMenuElements::MenuRight( pn, type ); + + /* Huh? */ + MenuLeft( input ); + ScreenWithMenuElements::MenuRight( input ); } void ScreenPackages::MenuBack( PlayerNumber pn ) diff --git a/stepmania/src/ScreenPackages.h b/stepmania/src/ScreenPackages.h index dcc83d508d..080b0bec97 100644 --- a/stepmania/src/ScreenPackages.h +++ b/stepmania/src/ScreenPackages.h @@ -19,10 +19,10 @@ public: virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void MenuStart( PlayerNumber pn ); - virtual void MenuUp( PlayerNumber pn, const InputEventType type ); - virtual void MenuDown( PlayerNumber pn, const InputEventType type ); - virtual void MenuLeft( PlayerNumber pn, const InputEventType type ); - virtual void MenuRight( PlayerNumber pn, const InputEventType type ); + virtual void MenuUp( const InputEventPlus &input ); + virtual void MenuDown( const InputEventPlus &input ); + virtual void MenuLeft( const InputEventPlus &input ); + virtual void MenuRight( const InputEventPlus &input ); virtual void MenuBack( PlayerNumber pn ); virtual void TweenOffScreen( ); diff --git a/stepmania/src/ScreenProfileOptions.cpp b/stepmania/src/ScreenProfileOptions.cpp index e10861e653..2a92c7ca4e 100644 --- a/stepmania/src/ScreenProfileOptions.cpp +++ b/stepmania/src/ScreenProfileOptions.cpp @@ -186,7 +186,7 @@ void ScreenProfileOptions::HandleScreenMessage( const ScreenMessage SM ) } -void ScreenProfileOptions::MenuStart( PlayerNumber pn, const InputEventType type ) +void ScreenProfileOptions::MenuStart( const InputEventPlus &input ) { switch( GetCurrentRow() ) { @@ -216,7 +216,7 @@ void ScreenProfileOptions::MenuStart( PlayerNumber pn, const InputEventType type break; } default: - ScreenOptions::MenuStart( pn, type ); + ScreenOptions::MenuStart( input ); } } diff --git a/stepmania/src/ScreenProfileOptions.h b/stepmania/src/ScreenProfileOptions.h index b04d160b01..845b712ea1 100644 --- a/stepmania/src/ScreenProfileOptions.h +++ b/stepmania/src/ScreenProfileOptions.h @@ -11,7 +11,7 @@ public: virtual void HandleScreenMessage( const ScreenMessage SM ); - virtual void MenuStart( PlayerNumber pn, const InputEventType type ); + virtual void MenuStart( const InputEventPlus &input ); private: void ImportOptions( int iRow, const vector &vpns ); diff --git a/stepmania/src/ScreenRanking.cpp b/stepmania/src/ScreenRanking.cpp index e6cb05d738..17702b603d 100644 --- a/stepmania/src/ScreenRanking.cpp +++ b/stepmania/src/ScreenRanking.cpp @@ -95,7 +95,8 @@ static void GetAllCoursesToShow( vector &vpOut, CourseType ct, bool bSh CString STEPS_TYPE_COLOR_NAME( size_t i ) { return ssprintf("StepsTypeColor%d",int(i+1)); } REGISTER_SCREEN_CLASS( ScreenRanking ); -ScreenRanking::ScreenRanking( CString sClassName ) : ScreenAttract( sClassName, false/*dont reset GAMESTATE*/ ), +ScreenRanking::ScreenRanking( CString sClassName ): + ScreenAttract( sClassName, false /*dont reset GAMESTATE*/ ), STEPS_TYPES_TO_SHOW (m_sName,"StepsTypesToHide"), DIFFICULTIES_TO_SHOW (m_sName,"DifficultiesToShow"), @@ -327,10 +328,6 @@ void ScreenRanking::Init() } } -ScreenRanking::~ScreenRanking() -{ -} - void ScreenRanking::BeginScreen() { SET_XY( m_textStepsType ); @@ -641,7 +638,7 @@ float ScreenRanking::SetPage( PageToShow pts ) BitmapText* pTextStepsScore = &item.m_textScore[*cd]; const Trail *pTrail = pCourse->GetTrail( pts.st, *cd ); - if( pTrail && UNLOCKMAN->CourseIsLocked(pCourse) ) + if( UNLOCKMAN->CourseIsLocked(pCourse) ) pTrail = NULL; pTextStepsScore->SetHidden( pTrail==NULL ); if( pTrail == NULL ) @@ -677,7 +674,7 @@ float ScreenRanking::SetPage( PageToShow pts ) } /* - * (c) 2001-2004 Chris Danford + * (c) 2001-2005 Chris Danford, Glenn Maynard * All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a diff --git a/stepmania/src/ScreenRanking.h b/stepmania/src/ScreenRanking.h index 745d94fca1..e3c742e15f 100644 --- a/stepmania/src/ScreenRanking.h +++ b/stepmania/src/ScreenRanking.h @@ -29,7 +29,7 @@ enum PageType const CString& PageTypeToString( PageType pt ); PageType StringToPageType( const CString& s ); -const int NUM_RANKING_LINES = 5; +static const int NUM_RANKING_LINES = 5; class ScreenRanking : public ScreenAttract { @@ -37,22 +37,20 @@ public: ScreenRanking( CString sName ); virtual void Init(); virtual void BeginScreen(); - ~ScreenRanking(); virtual void Input( const InputEventPlus &input ); - virtual void MenuLeft( PlayerNumber pn, const InputEventType type ) { Scroll(-1); } - virtual void MenuRight( PlayerNumber pn, const InputEventType type ) { Scroll(+1); } - virtual void MenuUp( PlayerNumber pn, const InputEventType type ) { Scroll(-1); } - virtual void MenuDown( PlayerNumber pn, const InputEventType type ) { Scroll(+1); } - virtual void Scroll( int iDir ); + virtual void MenuLeft( const InputEventPlus &input ) { Scroll(-1); } + virtual void MenuRight( const InputEventPlus &input ) { Scroll(+1); } + virtual void MenuUp( const InputEventPlus &input ) { Scroll(-1); } + virtual void MenuDown( const InputEventPlus &input ) { Scroll(+1); } virtual void MenuStart( PlayerNumber pn ); virtual void MenuBack( PlayerNumber pn ); - void HandleScreenMessage( const ScreenMessage SM ); protected: virtual bool GenericTweenOn() const { return true; } + virtual void Scroll( int iDir ); struct PageToShow { @@ -147,7 +145,7 @@ protected: #endif /* - * (c) 2001-2004 Chris Danford, Ben Nordstrom + * (c) 2001-2005 Chris Danford, Ben Nordstrom, Glenn Maynard * All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a diff --git a/stepmania/src/ScreenSMOnlineLogin.cpp b/stepmania/src/ScreenSMOnlineLogin.cpp index fd9f072d1b..250160e37e 100644 --- a/stepmania/src/ScreenSMOnlineLogin.cpp +++ b/stepmania/src/ScreenSMOnlineLogin.cpp @@ -156,9 +156,9 @@ void ScreenSMOnlineLogin::HandleScreenMessage(const ScreenMessage SM) ScreenOptions::HandleScreenMessage(SM); } -void ScreenSMOnlineLogin::MenuStart(PlayerNumber pn,const InputEventType type) +void ScreenSMOnlineLogin::MenuStart( const InputEventPlus &input ) { - ScreenOptions::MenuStart(pn,type); + ScreenOptions::MenuStart( input ); } CString ScreenSMOnlineLogin::GetSelectedProfileID() diff --git a/stepmania/src/ScreenSMOnlineLogin.h b/stepmania/src/ScreenSMOnlineLogin.h index 349dedf74f..9edcf46fde 100644 --- a/stepmania/src/ScreenSMOnlineLogin.h +++ b/stepmania/src/ScreenSMOnlineLogin.h @@ -9,7 +9,7 @@ public: ScreenSMOnlineLogin(CString sName); virtual void Init(); virtual void HandleScreenMessage(const ScreenMessage SM); - virtual void MenuStart(PlayerNumber pn,const InputEventType type); + virtual void MenuStart( const InputEventPlus &input ); void SendLogin(CString sPassword); private: diff --git a/stepmania/src/ScreenSelectMaster.cpp b/stepmania/src/ScreenSelectMaster.cpp index c580be8244..74c195ac54 100644 --- a/stepmania/src/ScreenSelectMaster.cpp +++ b/stepmania/src/ScreenSelectMaster.cpp @@ -13,6 +13,7 @@ #include #include "Foreach.h" #include "RageSoundManager.h" +#include "InputEventPlus.h" AutoScreenMessage( SM_PlayPostSwitchPage ) @@ -406,13 +407,14 @@ try_again: return ChangeSelection( pn, dir, iSwitchToIndex ); } -void ScreenSelectMaster::MenuLeft( PlayerNumber pn, const InputEventType type ) +void ScreenSelectMaster::MenuLeft( const InputEventPlus &input ) { + PlayerNumber pn = input.MenuI.player; if( m_fLockInputSecs > 0 || m_bChosen[pn] ) return; - if( type == IET_RELEASE ) + if( input.type == IET_RELEASE ) return; - if( !ALLOW_REPEATING_INPUT && type != IET_FIRST_PRESS ) + if( !ALLOW_REPEATING_INPUT && input.type != IET_FIRST_PRESS ) return; if( Move(pn, MENU_DIR_LEFT) ) { @@ -421,13 +423,14 @@ void ScreenSelectMaster::MenuLeft( PlayerNumber pn, const InputEventType type ) } } -void ScreenSelectMaster::MenuRight( PlayerNumber pn, const InputEventType type ) +void ScreenSelectMaster::MenuRight( const InputEventPlus &input ) { + PlayerNumber pn = input.MenuI.player; if( m_fLockInputSecs > 0 || m_bChosen[pn] ) return; - if( type == IET_RELEASE ) + if( input.type == IET_RELEASE ) return; - if( !ALLOW_REPEATING_INPUT && type != IET_FIRST_PRESS ) + if( !ALLOW_REPEATING_INPUT && input.type != IET_FIRST_PRESS ) return; if( Move(pn, MENU_DIR_RIGHT) ) { @@ -436,13 +439,14 @@ void ScreenSelectMaster::MenuRight( PlayerNumber pn, const InputEventType type ) } } -void ScreenSelectMaster::MenuUp( PlayerNumber pn, const InputEventType type ) +void ScreenSelectMaster::MenuUp( const InputEventPlus &input ) { + PlayerNumber pn = input.MenuI.player; if( m_fLockInputSecs > 0 || m_bChosen[pn] ) return; - if( type == IET_RELEASE ) + if( input.type == IET_RELEASE ) return; - if( !ALLOW_REPEATING_INPUT && type != IET_FIRST_PRESS ) + if( !ALLOW_REPEATING_INPUT && input.type != IET_FIRST_PRESS ) return; if( Move(pn, MENU_DIR_UP) ) { @@ -451,13 +455,14 @@ void ScreenSelectMaster::MenuUp( PlayerNumber pn, const InputEventType type ) } } -void ScreenSelectMaster::MenuDown( PlayerNumber pn, const InputEventType type ) +void ScreenSelectMaster::MenuDown( const InputEventPlus &input ) { + PlayerNumber pn = input.MenuI.player; if( m_fLockInputSecs > 0 || m_bChosen[pn] ) return; - if( type == IET_RELEASE ) + if( input.type == IET_RELEASE ) return; - if( !ALLOW_REPEATING_INPUT && type != IET_FIRST_PRESS ) + if( !ALLOW_REPEATING_INPUT && input.type != IET_FIRST_PRESS ) return; if( Move(pn, MENU_DIR_DOWN) ) { diff --git a/stepmania/src/ScreenSelectMaster.h b/stepmania/src/ScreenSelectMaster.h index 21f0560e61..fe50c6f9d3 100644 --- a/stepmania/src/ScreenSelectMaster.h +++ b/stepmania/src/ScreenSelectMaster.h @@ -18,10 +18,10 @@ public: virtual void Update( float fDelta ); - virtual void MenuLeft( PlayerNumber pn, const InputEventType type ); - virtual void MenuRight( PlayerNumber pn, const InputEventType type ); - virtual void MenuUp( PlayerNumber pn, const InputEventType type ); - virtual void MenuDown( PlayerNumber pn, const InputEventType type ); + virtual void MenuLeft( const InputEventPlus &input ); + virtual void MenuRight( const InputEventPlus &input ); + virtual void MenuUp( const InputEventPlus &input ); + virtual void MenuDown( const InputEventPlus &input ); virtual void MenuStart( PlayerNumber pn ); void TweenOursOnScreen(); void TweenOursOffScreen(); diff --git a/stepmania/src/ScreenSelectMusic.cpp b/stepmania/src/ScreenSelectMusic.cpp index d87ff72fca..c1dd33eeb2 100644 --- a/stepmania/src/ScreenSelectMusic.cpp +++ b/stepmania/src/ScreenSelectMusic.cpp @@ -854,20 +854,20 @@ void ScreenSelectMusic::Input( const InputEventPlus &input ) // Start as "move to the next screen" if it was just part of a code. switch( input.MenuI.button ) { - case MENU_BUTTON_UP: this->MenuUp( input.MenuI.player, input.type ); break; - case MENU_BUTTON_DOWN: this->MenuDown( input.MenuI.player, input.type ); break; - case MENU_BUTTON_LEFT: this->MenuLeft( input.MenuI.player, input.type ); break; - case MENU_BUTTON_RIGHT: this->MenuRight( input.MenuI.player, input.type ); break; + case MENU_BUTTON_UP: this->MenuUp( input ); break; + case MENU_BUTTON_DOWN: this->MenuDown( input ); break; + case MENU_BUTTON_LEFT: this->MenuLeft( input ); break; + case MENU_BUTTON_RIGHT: this->MenuRight( input ); break; case MENU_BUTTON_BACK: /* Don't make the user hold the back button if they're pressing escape and escape is the back button. */ if( input.DeviceI.device == DEVICE_KEYBOARD && input.DeviceI.button == KEY_ESC ) this->MenuBack( input.MenuI.player ); else - Screen::MenuBack( input.MenuI.player, input.type ); + Screen::MenuBack( input ); break; // Do the default handler for Start after detecting codes. -// case MENU_BUTTON_START: this->MenuStart( MenuI.player, type ); break; - case MENU_BUTTON_COIN: this->MenuCoin( input.MenuI.player, input.type ); break; +// case MENU_BUTTON_START: this->MenuStart( input ); break; + case MENU_BUTTON_COIN: this->MenuCoin( input ); break; } @@ -916,7 +916,7 @@ void ScreenSelectMusic::Input( const InputEventPlus &input ) switch( input.MenuI.button ) { - case MENU_BUTTON_START: Screen::MenuStart( input.MenuI.player, input.type ); break; + case MENU_BUTTON_START: Screen::MenuStart( input ); break; } }