allow opening options menu while choosing a song
This commit is contained in:
@@ -127,6 +127,8 @@ void OptionsList::Load( RString sType, PlayerNumber pn )
|
|||||||
{
|
{
|
||||||
m_pn = pn;
|
m_pn = pn;
|
||||||
|
|
||||||
|
m_Codes.Load( sType );
|
||||||
|
|
||||||
m_Cursor.Load( THEME->GetPathG(sType, "cursor") );
|
m_Cursor.Load( THEME->GetPathG(sType, "cursor") );
|
||||||
m_Cursor->SetName( "Cursor" );
|
m_Cursor->SetName( "Cursor" );
|
||||||
ActorUtil::LoadAllCommands( *m_Cursor, sType );
|
ActorUtil::LoadAllCommands( *m_Cursor, sType );
|
||||||
@@ -263,6 +265,10 @@ void OptionsList::SwitchMenu( int iDir )
|
|||||||
|
|
||||||
void OptionsList::Input( const InputEventPlus &input )
|
void OptionsList::Input( const InputEventPlus &input )
|
||||||
{
|
{
|
||||||
|
Message msg("");
|
||||||
|
if( m_Codes.InputMessage(input, msg) )
|
||||||
|
this->HandleMessage( msg );
|
||||||
|
|
||||||
if( input.type == IET_RELEASE )
|
if( input.type == IET_RELEASE )
|
||||||
return;
|
return;
|
||||||
if( input.type != IET_FIRST_PRESS )
|
if( input.type != IET_FIRST_PRESS )
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#include "OptionRowHandler.h"
|
#include "OptionRowHandler.h"
|
||||||
#include "BitmapText.h"
|
#include "BitmapText.h"
|
||||||
#include "OptionsCursor.h"
|
#include "OptionsCursor.h"
|
||||||
|
#include "CodeSet.h"
|
||||||
|
|
||||||
class OptionListRow: public ActorFrame
|
class OptionListRow: public ActorFrame
|
||||||
{
|
{
|
||||||
@@ -62,6 +63,8 @@ private:
|
|||||||
void ExportRow( RString sRow );
|
void ExportRow( RString sRow );
|
||||||
bool RowIsMenusOnly( RString sRow ) const;
|
bool RowIsMenusOnly( RString sRow ) const;
|
||||||
|
|
||||||
|
InputQueueCodeSet m_Codes;
|
||||||
|
|
||||||
vector<RString> m_asLoadedRows;
|
vector<RString> m_asLoadedRows;
|
||||||
map<RString, OptionRowHandler *> m_Rows;
|
map<RString, OptionRowHandler *> m_Rows;
|
||||||
map<RString, vector<bool> > m_bSelections;
|
map<RString, vector<bool> > m_bSelections;
|
||||||
|
|||||||
@@ -82,7 +82,10 @@ void ScreenSelectMusic::Init()
|
|||||||
GAMESTATE->FinishStage();
|
GAMESTATE->FinishStage();
|
||||||
|
|
||||||
FOREACH_ENUM( PlayerNumber, p )
|
FOREACH_ENUM( PlayerNumber, p )
|
||||||
|
{
|
||||||
m_bSelectIsDown[p] = false; // used by UpdateSelectButton
|
m_bSelectIsDown[p] = false; // used by UpdateSelectButton
|
||||||
|
m_bAcceptSelectRelease[p] = false;
|
||||||
|
}
|
||||||
|
|
||||||
ScreenWithMenuElements::Init();
|
ScreenWithMenuElements::Init();
|
||||||
|
|
||||||
@@ -386,7 +389,7 @@ void ScreenSelectMusic::Input( const InputEventPlus &input )
|
|||||||
|
|
||||||
|
|
||||||
// handle options list input
|
// handle options list input
|
||||||
if( USE_OPTIONS_LIST && m_SelectionState == SelectionState_SelectingSteps )
|
if( USE_OPTIONS_LIST )
|
||||||
{
|
{
|
||||||
PlayerNumber pn = input.pn;
|
PlayerNumber pn = input.pn;
|
||||||
if( pn != PLAYER_INVALID )
|
if( pn != PLAYER_INVALID )
|
||||||
@@ -402,27 +405,21 @@ void ScreenSelectMusic::Input( const InputEventPlus &input )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( input.type == IET_FIRST_PRESS && input.MenuI == GAME_BUTTON_SELECT )
|
if( input.type == IET_RELEASE && input.MenuI == GAME_BUTTON_SELECT && m_bAcceptSelectRelease[pn] )
|
||||||
{
|
|
||||||
OpenOptionsList( pn );
|
OpenOptionsList( pn );
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( input.MenuI == MENU_BUTTON_SELECT && input.type != IET_REPEAT )
|
||||||
|
m_bAcceptSelectRelease[input.pn] = (input.type == IET_FIRST_PRESS);
|
||||||
|
|
||||||
UpdateSelectButton();
|
if( SELECT_MENU_AVAILABLE && input.MenuI == MENU_BUTTON_SELECT && input.type != IET_REPEAT )
|
||||||
|
UpdateSelectButton( input.pn, input.type == IET_FIRST_PRESS );
|
||||||
|
|
||||||
if( input.MenuI == MENU_BUTTON_SELECT )
|
|
||||||
{
|
|
||||||
if( input.type == IET_FIRST_PRESS )
|
|
||||||
m_MusicWheel.Move( 0 );
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( SELECT_MENU_AVAILABLE && INPUTMAPPER->IsBeingPressed( MENU_BUTTON_SELECT, input.pn ) )
|
if( SELECT_MENU_AVAILABLE && m_bSelectIsDown[input.pn] )
|
||||||
{
|
{
|
||||||
if( input.type == IET_FIRST_PRESS )
|
if( input.type == IET_FIRST_PRESS )
|
||||||
{
|
{
|
||||||
@@ -430,23 +427,26 @@ void ScreenSelectMusic::Input( const InputEventPlus &input )
|
|||||||
{
|
{
|
||||||
case MENU_BUTTON_LEFT:
|
case MENU_BUTTON_LEFT:
|
||||||
ChangeDifficulty( input.pn, -1 );
|
ChangeDifficulty( input.pn, -1 );
|
||||||
return;
|
m_bAcceptSelectRelease[input.pn] = false;
|
||||||
|
break;
|
||||||
case MENU_BUTTON_RIGHT:
|
case MENU_BUTTON_RIGHT:
|
||||||
ChangeDifficulty( input.pn, +1 );
|
ChangeDifficulty( input.pn, +1 );
|
||||||
return;
|
m_bAcceptSelectRelease[input.pn] = false;
|
||||||
|
break;
|
||||||
case MENU_BUTTON_START:
|
case MENU_BUTTON_START:
|
||||||
|
m_bAcceptSelectRelease[input.pn] = false;
|
||||||
if( MODE_MENU_AVAILABLE )
|
if( MODE_MENU_AVAILABLE )
|
||||||
m_MusicWheel.NextSort();
|
m_MusicWheel.NextSort();
|
||||||
else
|
else
|
||||||
m_soundLocked.Play();
|
m_soundLocked.Play();
|
||||||
return;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
// return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_SelectionState == SelectionState_SelectingSong &&
|
if( m_SelectionState == SelectionState_SelectingSong &&
|
||||||
(input.MenuI == m_GameButtonNextSong || input.MenuI == m_GameButtonPreviousSong) )
|
(input.MenuI == m_GameButtonNextSong || input.MenuI == m_GameButtonPreviousSong || input.MenuI == MENU_BUTTON_SELECT) )
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
/* If we're rouletting, hands off. */
|
/* If we're rouletting, hands off. */
|
||||||
@@ -457,6 +457,11 @@ void ScreenSelectMusic::Input( const InputEventPlus &input )
|
|||||||
bool bRightIsDown = false;
|
bool bRightIsDown = false;
|
||||||
FOREACH_HumanPlayer( p )
|
FOREACH_HumanPlayer( p )
|
||||||
{
|
{
|
||||||
|
if( m_OptionsList[p].IsOpened() )
|
||||||
|
continue;
|
||||||
|
if( SELECT_MENU_AVAILABLE && INPUTMAPPER->IsBeingPressed(MENU_BUTTON_SELECT, p) )
|
||||||
|
continue;
|
||||||
|
|
||||||
bLeftIsDown |= INPUTMAPPER->IsBeingPressed( m_GameButtonPreviousSong, p );
|
bLeftIsDown |= INPUTMAPPER->IsBeingPressed( m_GameButtonPreviousSong, p );
|
||||||
bRightIsDown |= INPUTMAPPER->IsBeingPressed( m_GameButtonNextSong, p );
|
bRightIsDown |= INPUTMAPPER->IsBeingPressed( m_GameButtonNextSong, p );
|
||||||
}
|
}
|
||||||
@@ -577,21 +582,17 @@ bool ScreenSelectMusic::DetectCodes( const InputEventPlus &input )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenSelectMusic::UpdateSelectButton()
|
void ScreenSelectMusic::UpdateSelectButton( PlayerNumber pn, bool bSelectIsDown )
|
||||||
{
|
{
|
||||||
FOREACH_HumanPlayer( p )
|
if( !SELECT_MENU_AVAILABLE || !CanChangeSong() )
|
||||||
{
|
bSelectIsDown = false;
|
||||||
bool bSelectIsDown = INPUTMAPPER->IsBeingPressed( MENU_BUTTON_SELECT, p );
|
|
||||||
if( !SELECT_MENU_AVAILABLE || !CanChangeSong() )
|
|
||||||
bSelectIsDown = false;
|
|
||||||
|
|
||||||
if( m_bSelectIsDown[p] != bSelectIsDown )
|
if( m_bSelectIsDown[pn] != bSelectIsDown )
|
||||||
{
|
{
|
||||||
m_bSelectIsDown[p] = bSelectIsDown;
|
m_bSelectIsDown[pn] = bSelectIsDown;
|
||||||
Message msg( bSelectIsDown ? "SelectMenuOpened" : "SelectMenuClosed" );
|
Message msg( bSelectIsDown ? "SelectMenuOpened" : "SelectMenuClosed" );
|
||||||
msg.SetParam( "Player", p );
|
msg.SetParam( "Player", pn );
|
||||||
MESSAGEMAN->Broadcast( msg );
|
MESSAGEMAN->Broadcast( msg );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -678,10 +679,6 @@ void ScreenSelectMusic::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
if( m_MusicWheel.GetSelectedSong() == NULL && m_MusicWheel.GetSelectedCourse() == NULL )
|
if( m_MusicWheel.GetSelectedSong() == NULL && m_MusicWheel.GetSelectedCourse() == NULL )
|
||||||
m_MusicWheel.StartRandom();
|
m_MusicWheel.StartRandom();
|
||||||
|
|
||||||
FOREACH_ENUM( PlayerNumber, p )
|
|
||||||
if( m_OptionsList[p].IsOpened() )
|
|
||||||
CloseOptionsList(p);
|
|
||||||
|
|
||||||
MenuStart( InputEventPlus() );
|
MenuStart( InputEventPlus() );
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@@ -832,6 +829,16 @@ void ScreenSelectMusic::MenuStart( const InputEventPlus &input )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FOREACH_ENUM( PlayerNumber, p )
|
||||||
|
{
|
||||||
|
if( !TWO_PART_SELECTION || m_SelectionState == SelectionState_SelectingSteps )
|
||||||
|
{
|
||||||
|
if( m_OptionsList[p].IsOpened() )
|
||||||
|
CloseOptionsList(p);
|
||||||
|
}
|
||||||
|
UpdateSelectButton( p, false );
|
||||||
|
}
|
||||||
|
|
||||||
m_SelectionState = GetNextSelectionState();
|
m_SelectionState = GetNextSelectionState();
|
||||||
m_soundStart.Play();
|
m_soundStart.Play();
|
||||||
|
|
||||||
@@ -901,8 +908,12 @@ void ScreenSelectMusic::MenuStart( const InputEventPlus &input )
|
|||||||
}
|
}
|
||||||
else // !finalized. Set the timer for selecting difficulty and mods.
|
else // !finalized. Set the timer for selecting difficulty and mods.
|
||||||
{
|
{
|
||||||
m_MenuTimer->SetSeconds( 25 );
|
float fSeconds = m_MenuTimer->GetSeconds();
|
||||||
m_MenuTimer->Start();
|
if( fSeconds < 10 )
|
||||||
|
{
|
||||||
|
m_MenuTimer->SetSeconds( 10 );
|
||||||
|
m_MenuTimer->Start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
virtual bool GenericTweenOn() const { return true; }
|
virtual bool GenericTweenOn() const { return true; }
|
||||||
virtual bool GenericTweenOff() const { return true; }
|
virtual bool GenericTweenOff() const { return true; }
|
||||||
void UpdateSelectButton();
|
void UpdateSelectButton( PlayerNumber pn, bool bBeingPressed );
|
||||||
|
|
||||||
void ChangeDifficulty( PlayerNumber pn, int dir );
|
void ChangeDifficulty( PlayerNumber pn, int dir );
|
||||||
|
|
||||||
@@ -118,6 +118,7 @@ protected:
|
|||||||
float m_fSampleStartSeconds, m_fSampleLengthSeconds;
|
float m_fSampleStartSeconds, m_fSampleLengthSeconds;
|
||||||
bool m_bAllowOptionsMenu, m_bAllowOptionsMenuRepeat;
|
bool m_bAllowOptionsMenu, m_bAllowOptionsMenuRepeat;
|
||||||
bool m_bSelectIsDown[NUM_PLAYERS];
|
bool m_bSelectIsDown[NUM_PLAYERS];
|
||||||
|
bool m_bAcceptSelectRelease[NUM_PLAYERS];
|
||||||
|
|
||||||
RageSound m_soundStart;
|
RageSound m_soundStart;
|
||||||
RageSound m_soundDifficultyEasier;
|
RageSound m_soundDifficultyEasier;
|
||||||
|
|||||||
Reference in New Issue
Block a user