diff --git a/Docs/Changelog_sm-ssc.txt b/Docs/Changelog_sm-ssc.txt index 68d32d4f4c..ebd5bf15b9 100644 --- a/Docs/Changelog_sm-ssc.txt +++ b/Docs/Changelog_sm-ssc.txt @@ -14,6 +14,12 @@ sm-ssc v1.0 Release Candidate 2 | 201007xx -------------------------------------------------------------------------------- (work in progress, it's not out yet [hence the "xx" above].) +20100708 +-------- +* [ScreenSelectProfile] Transplant menu input functions from ScreenSelectMaster. + Now you no longer have to rely on stuffing the directions into the Codeset. + (Of course, you still have to handle Start and Back yourself.) + 20100706 -------- * [ScreenSelectMusic] add a code for closing the current folder from any diff --git a/src/ScreenSelectProfile.cpp b/src/ScreenSelectProfile.cpp index 2ea7bf6c42..cdf1bfd21d 100644 --- a/src/ScreenSelectProfile.cpp +++ b/src/ScreenSelectProfile.cpp @@ -4,6 +4,7 @@ #include "ProfileManager.h" #include "GameState.h" #include "MemoryCardManager.h" +#include "InputEventPlus.h" REGISTER_SCREEN_CLASS( ScreenSelectProfile ); @@ -14,6 +15,7 @@ void ScreenSelectProfile::Init() // no selection initially m_iSelectedProfiles[p]=-1; } + m_TrackingRepeatingInput = GameButton_Invalid; ScreenWithMenuElements::Init(); } @@ -25,6 +27,86 @@ void ScreenSelectProfile::Input( const InputEventPlus &input ) ScreenWithMenuElements::Input( input ); } +void ScreenSelectProfile::MenuLeft( const InputEventPlus &input ) +{ + PlayerNumber pn = input.pn; + if( m_fLockInputSecs > 0 ) + return; + if( input.type == IET_RELEASE ) + return; + if( input.type != IET_FIRST_PRESS ) + { + /* + if( !ALLOW_REPEATING_INPUT ) + return; + */ + if( m_TrackingRepeatingInput != input.MenuI ) + return; + } + m_TrackingRepeatingInput = input.MenuI; + MESSAGEMAN->Broadcast( (MessageID)(Message_MenuLeftP1+pn) ); +} + +void ScreenSelectProfile::MenuRight( const InputEventPlus &input ) +{ + PlayerNumber pn = input.pn; + if( m_fLockInputSecs > 0 ) + return; + if( input.type == IET_RELEASE ) + return; + if( input.type != IET_FIRST_PRESS ) + { + /* + if( !ALLOW_REPEATING_INPUT ) + return; + */ + if( m_TrackingRepeatingInput != input.MenuI ) + return; + } + m_TrackingRepeatingInput = input.MenuI; + MESSAGEMAN->Broadcast( (MessageID)(Message_MenuRightP1+pn) ); +} + +void ScreenSelectProfile::MenuUp( const InputEventPlus &input ) +{ + PlayerNumber pn = input.pn; + if( m_fLockInputSecs > 0 ) + return; + if( input.type == IET_RELEASE ) + return; + if( input.type != IET_FIRST_PRESS ) + { + /* + if( !ALLOW_REPEATING_INPUT ) + return; + */ + if( m_TrackingRepeatingInput != input.MenuI ) + return; + } + m_TrackingRepeatingInput = input.MenuI; + MESSAGEMAN->Broadcast( (MessageID)(Message_MenuUpP1+pn) ); +} + +void ScreenSelectProfile::MenuDown( const InputEventPlus &input ) +{ + PlayerNumber pn = input.pn; + if( m_fLockInputSecs > 0 ) + return; + if( input.type == IET_RELEASE ) + return; + if( input.type != IET_FIRST_PRESS ) + { + /* + if( !ALLOW_REPEATING_INPUT ) + return; + */ + if( m_TrackingRepeatingInput != input.MenuI ) + return; + } + m_TrackingRepeatingInput = input.MenuI; + MESSAGEMAN->Broadcast( (MessageID)(Message_MenuDownP1+pn) ); +} + bool ScreenSelectProfile::SetProfileIndex( PlayerNumber pn, int iProfileIndex ) { if( !GAMESTATE->IsHumanPlayer( pn ) ) diff --git a/src/ScreenSelectProfile.h b/src/ScreenSelectProfile.h index 854c48f51c..1fdfe1a310 100644 --- a/src/ScreenSelectProfile.h +++ b/src/ScreenSelectProfile.h @@ -10,10 +10,16 @@ class ScreenSelectProfile : public ScreenWithMenuElements public: virtual void Init(); virtual void Input( const InputEventPlus &input ); + virtual void MenuLeft( const InputEventPlus &input ); + virtual void MenuRight( const InputEventPlus &input ); + virtual void MenuUp( const InputEventPlus &input ); + virtual void MenuDown( const InputEventPlus &input ); + + GameButton m_TrackingRepeatingInput; // Lua void PushSelf( lua_State *L ); - bool SetProfileIndex( PlayerNumber pn, int iProfileIndex ); + bool SetProfileIndex( PlayerNumber pn, int iProfileIndex ); int GetProfileIndex( PlayerNumber pn ) { return m_iSelectedProfiles[pn]; } bool Finish();