[ScreenSelectProfile] Transplant menu input functions from ScreenSelectMaster.

This commit is contained in:
AJ Kelly
2010-07-08 23:26:47 -05:00
parent 15d333bec4
commit e1037c9717
3 changed files with 95 additions and 1 deletions
+6
View File
@@ -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
+82
View File
@@ -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 ) )
+7 -1
View File
@@ -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();