modify Input() on screens to return boolean

This commit is contained in:
Devin J. Pohly
2013-01-12 22:48:38 -05:00
parent 79583090ac
commit d13ac7e7a2
98 changed files with 861 additions and 697 deletions
+16 -15
View File
@@ -363,7 +363,7 @@ void OptionsList::MoveItem( const RString &sRowName, int iMove )
{ {
} }
void OptionsList::Input( const InputEventPlus &input ) bool OptionsList::Input( const InputEventPlus &input )
{ {
Message msg(""); Message msg("");
if( m_Codes.InputMessage(input, msg) ) if( m_Codes.InputMessage(input, msg) )
@@ -377,14 +377,14 @@ void OptionsList::Input( const InputEventPlus &input )
if( input.MenuI == GAME_BUTTON_LEFT || input.MenuI == GAME_BUTTON_RIGHT ) if( input.MenuI == GAME_BUTTON_LEFT || input.MenuI == GAME_BUTTON_RIGHT )
{ {
if( input.type != IET_FIRST_PRESS ) if( input.type != IET_FIRST_PRESS )
return; return false;
m_bAcceptStartRelease = false; m_bAcceptStartRelease = false;
const RString &sCurrentRow = m_asMenuStack.back(); const RString &sCurrentRow = m_asMenuStack.back();
vector<bool> &bSelections = m_bSelections[sCurrentRow]; vector<bool> &bSelections = m_bSelections[sCurrentRow];
if( m_iMenuStackSelection == (int)bSelections.size() ) if( m_iMenuStackSelection == (int)bSelections.size() )
return; return false;
RString sDest = pHandler->GetScreen( m_iMenuStackSelection ); RString sDest = pHandler->GetScreen( m_iMenuStackSelection );
if( m_setDirectRows.find(sDest) != m_setDirectRows.end() && sDest.size() ) if( m_setDirectRows.find(sDest) != m_setDirectRows.end() && sDest.size() )
@@ -406,20 +406,20 @@ void OptionsList::Input( const InputEventPlus &input )
MESSAGEMAN->Broadcast( lMsg ); MESSAGEMAN->Broadcast( lMsg );
} }
} }
return; return true;
} }
} }
if( input.MenuI == GAME_BUTTON_LEFT ) if( input.MenuI == GAME_BUTTON_LEFT )
{ {
if( input.type == IET_RELEASE ) if( input.type == IET_RELEASE )
return; return false;
if( INPUTMAPPER->IsBeingPressed(GAME_BUTTON_RIGHT, pn) ) if( INPUTMAPPER->IsBeingPressed(GAME_BUTTON_RIGHT, pn) )
{ {
if( input.type == IET_FIRST_PRESS ) if( input.type == IET_FIRST_PRESS )
SwitchMenu( -1 ); SwitchMenu( -1 );
return; return true;
} }
--m_iMenuStackSelection; --m_iMenuStackSelection;
@@ -429,18 +429,18 @@ void OptionsList::Input( const InputEventPlus &input )
Message lMsg("OptionsListLeft"); Message lMsg("OptionsListLeft");
lMsg.SetParam( "Player", input.pn ); lMsg.SetParam( "Player", input.pn );
MESSAGEMAN->Broadcast( lMsg ); MESSAGEMAN->Broadcast( lMsg );
return; return true;
} }
else if( input.MenuI == GAME_BUTTON_RIGHT ) else if( input.MenuI == GAME_BUTTON_RIGHT )
{ {
if( input.type == IET_RELEASE ) if( input.type == IET_RELEASE )
return; return false;
if( INPUTMAPPER->IsBeingPressed(GAME_BUTTON_LEFT, pn) ) if( INPUTMAPPER->IsBeingPressed(GAME_BUTTON_LEFT, pn) )
{ {
if( input.type == IET_FIRST_PRESS ) if( input.type == IET_FIRST_PRESS )
SwitchMenu( +1 ); SwitchMenu( +1 );
return; return true;
} }
++m_iMenuStackSelection; ++m_iMenuStackSelection;
@@ -450,7 +450,7 @@ void OptionsList::Input( const InputEventPlus &input )
Message lMsg("OptionsListRight"); Message lMsg("OptionsListRight");
lMsg.SetParam( "Player", input.pn ); lMsg.SetParam( "Player", input.pn );
MESSAGEMAN->Broadcast( lMsg ); MESSAGEMAN->Broadcast( lMsg );
return; return true;
} }
else if( input.MenuI == GAME_BUTTON_START ) else if( input.MenuI == GAME_BUTTON_START )
{ {
@@ -458,7 +458,7 @@ void OptionsList::Input( const InputEventPlus &input )
{ {
m_bStartIsDown = true; m_bStartIsDown = true;
m_bAcceptStartRelease = true; m_bAcceptStartRelease = true;
return; return true;
} }
if( input.type == IET_RELEASE ) if( input.type == IET_RELEASE )
{ {
@@ -467,19 +467,20 @@ void OptionsList::Input( const InputEventPlus &input )
m_bStartIsDown = false; m_bStartIsDown = false;
} }
return; return true;
} }
else if( input.MenuI == GAME_BUTTON_SELECT ) else if( input.MenuI == GAME_BUTTON_SELECT )
{ {
if( input.type != IET_FIRST_PRESS ) if( input.type != IET_FIRST_PRESS )
return; return false;
// if( input.type == IET_RELEASE ) // if( input.type == IET_RELEASE )
{ {
Close(); Close();
return; return true;
} }
return; return true;
} }
return false;
} }
void OptionsList::SwitchToCurrentRow() void OptionsList::SwitchToCurrentRow()
+1 -1
View File
@@ -55,7 +55,7 @@ public:
/** @brief Close all menus (for menu timer). */ /** @brief Close all menus (for menu timer). */
void Close(); void Close();
void Input( const InputEventPlus &input ); bool Input( const InputEventPlus &input );
bool IsOpened() const { return m_asMenuStack.size() > 0; } bool IsOpened() const { return m_asMenuStack.size() > 0; }
bool Start(); // return true if the last menu was popped in response to this press bool Start(); // return true if the last menu was popped in response to this press
+14 -13
View File
@@ -186,13 +186,14 @@ bool Screen::OverlayInput( const InputEventPlus &input )
return false; return false;
} }
void Screen::Input( const InputEventPlus &input ) /* Returns true if the input was handled, or false if not handled. */
bool Screen::Input( const InputEventPlus &input )
{ {
Message msg(""); Message msg("");
if( m_Codes.InputMessage(input, msg) ) if( m_Codes.InputMessage(input, msg) )
{ {
this->HandleMessage( msg ); this->HandleMessage( msg );
return; return true;
} }
// Don't send release messages with the default handler. // Don't send release messages with the default handler.
@@ -202,7 +203,7 @@ void Screen::Input( const InputEventPlus &input )
case IET_REPEAT: case IET_REPEAT:
break; // OK break; // OK
default: default:
return; // don't care return false; // don't care
} }
// Always broadcast mouse input so themers can grab it. -aj // Always broadcast mouse input so themers can grab it. -aj
@@ -221,22 +222,22 @@ void Screen::Input( const InputEventPlus &input )
// default input handler used by most menus // default input handler used by most menus
switch( input.MenuI ) switch( input.MenuI )
{ {
case GAME_BUTTON_MENUUP: this->MenuUp ( input ); return; case GAME_BUTTON_MENUUP: return this->MenuUp ( input );
case GAME_BUTTON_MENUDOWN: this->MenuDown ( input ); return; case GAME_BUTTON_MENUDOWN: return this->MenuDown ( input );
case GAME_BUTTON_MENULEFT: this->MenuLeft ( input ); return; case GAME_BUTTON_MENULEFT: return this->MenuLeft ( input );
case GAME_BUTTON_MENURIGHT: this->MenuRight ( input ); return; case GAME_BUTTON_MENURIGHT: return this->MenuRight( input );
case GAME_BUTTON_BACK: case GAME_BUTTON_BACK:
// Don't make the user hold the back button if they're pressing escape and escape is the back button. // Don't make the user hold the back button if they're pressing escape and escape is the back button.
if( !PREFSMAN->m_bDelayedBack || input.type==IET_REPEAT || (input.DeviceI.device == DEVICE_KEYBOARD && input.DeviceI.button == KEY_ESC) ) if( !PREFSMAN->m_bDelayedBack || input.type==IET_REPEAT || (input.DeviceI.device == DEVICE_KEYBOARD && input.DeviceI.button == KEY_ESC) )
{ {
if( HANDLE_BACK_BUTTON ) if( HANDLE_BACK_BUTTON )
this->MenuBack( input ); return this->MenuBack( input );
} }
return; return false;
case GAME_BUTTON_START: this->MenuStart ( input ); return; case GAME_BUTTON_START: return this->MenuStart ( input );
case GAME_BUTTON_SELECT:this->MenuSelect( input ); return; case GAME_BUTTON_SELECT: return this->MenuSelect( input );
case GAME_BUTTON_COIN: this->MenuCoin ( input ); return; case GAME_BUTTON_COIN: return this->MenuCoin ( input );
default: return; default: return false;
} }
} }
+14 -14
View File
@@ -60,7 +60,7 @@ public:
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime );
virtual bool OverlayInput( const InputEventPlus &input ); virtual bool OverlayInput( const InputEventPlus &input );
virtual void Input( const InputEventPlus &input ); virtual bool Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void HandleScreenMessage( const ScreenMessage SM );
void SetLockInputSecs( float f ) { m_fLockInputSecs = f; } void SetLockInputSecs( float f ) { m_fLockInputSecs = f; }
@@ -126,20 +126,20 @@ public:
RString GetPrevScreen() const; RString GetPrevScreen() const;
// let subclass override if they want // let subclass override if they want
virtual void MenuUp(const InputEventPlus &) { } virtual bool MenuUp(const InputEventPlus &) { return false; }
virtual void MenuDown(const InputEventPlus &) { } virtual bool MenuDown(const InputEventPlus &) { return false; }
virtual void MenuLeft(const InputEventPlus &) { } virtual bool MenuLeft(const InputEventPlus &) { return false; }
virtual void MenuRight(const InputEventPlus &) { } virtual bool MenuRight(const InputEventPlus &) { return false; }
virtual void MenuStart(const InputEventPlus &) { } virtual bool MenuStart(const InputEventPlus &) { return false; }
virtual void MenuSelect(const InputEventPlus &) { } virtual bool MenuSelect(const InputEventPlus &) { return false; }
virtual void MenuBack(const InputEventPlus &) { } virtual bool MenuBack(const InputEventPlus &) { return false; }
virtual void MenuCoin(const InputEventPlus &) { } virtual bool MenuCoin(const InputEventPlus &) { return false; }
// todo? -aj // todo? -aj
//virtual void LeftClick(const InputEventPlus &) { } //virtual bool LeftClick(const InputEventPlus &) { }
//virtual void RightClick(const InputEventPlus &) { } //virtual bool RightClick(const InputEventPlus &) { }
//virtual void MiddleClick(const InputEventPlus &) { } //virtual bool MiddleClick(const InputEventPlus &) { }
//virtual void MouseWheelUp(const InputEventPlus &) { } //virtual bool MouseWheelUp(const InputEventPlus &) { }
//virtual void MouseWheelDown(const InputEventPlus &) { } //virtual bool MouseWheelDown(const InputEventPlus &) { }
}; };
#endif #endif
+13 -12
View File
@@ -36,13 +36,15 @@ void ScreenAttract::BeginScreen()
ScreenWithMenuElements::BeginScreen(); ScreenWithMenuElements::BeginScreen();
} }
void ScreenAttract::Input( const InputEventPlus &input ) bool ScreenAttract::Input( const InputEventPlus &input )
{ {
bool handled;
// LOG->Trace( "ScreenAttract::Input()" ); // LOG->Trace( "ScreenAttract::Input()" );
AttractInput( input, this ); handled = AttractInput( input, this );
ScreenWithMenuElements::Input( input ); // Always run both AttractInput and ScreenWithMenuElements::Input
return ScreenWithMenuElements::Input( input ) || handled;
} }
void ScreenAttract::SetAttractVolume( bool bInAttract ) void ScreenAttract::SetAttractVolume( bool bInAttract )
@@ -68,10 +70,10 @@ void ScreenAttract::Cancel( ScreenMessage smSendWhenDone )
ScreenWithMenuElements::Cancel( smSendWhenDone ); ScreenWithMenuElements::Cancel( smSendWhenDone );
} }
void ScreenAttract::AttractInput( const InputEventPlus &input, ScreenWithMenuElements *pScreen ) bool ScreenAttract::AttractInput( const InputEventPlus &input, ScreenWithMenuElements *pScreen )
{ {
if( input.type != IET_FIRST_PRESS ) if( input.type != IET_FIRST_PRESS )
return; // don't care return false; // don't care
switch( input.MenuI ) switch( input.MenuI )
{ {
@@ -89,37 +91,36 @@ void ScreenAttract::AttractInput( const InputEventPlus &input, ScreenWithMenuEle
PREFSMAN->m_iCoinsPerCredit.Get(), PREFSMAN->m_iCoinsPerCredit.Get(),
GAMESTATE->GetNumSidesJoined() ); GAMESTATE->GetNumSidesJoined() );
if( GAMESTATE->m_iCoins < PREFSMAN->m_iCoinsPerCredit && GAMESTATE->GetNumSidesJoined() == 0 ) if( GAMESTATE->m_iCoins < PREFSMAN->m_iCoinsPerCredit && GAMESTATE->GetNumSidesJoined() == 0 )
break; // don't fall through return true;
// fall through // fall through
case CoinMode_Home: case CoinMode_Home:
case CoinMode_Free: case CoinMode_Free:
if( pScreen->IsTransitioning() ) if( pScreen->IsTransitioning() )
return; return false;
// HandleGlobalInputs() already played the coin sound. Don't play it again. // HandleGlobalInputs() already played the coin sound. Don't play it again.
if( input.MenuI != GAME_BUTTON_COIN ) if( input.MenuI != GAME_BUTTON_COIN )
SCREENMAN->PlayStartSound(); SCREENMAN->PlayStartSound();
pScreen->Cancel( SM_GoToStartScreen ); pScreen->Cancel( SM_GoToStartScreen );
break; return true;
default: FAIL_M("Invalid Coin Mode! Aborting..."); default: FAIL_M("Invalid Coin Mode! Aborting...");
} }
default: break; default: break;
} }
if( pScreen->IsTransitioning() ) if( pScreen->IsTransitioning() )
return; return false;
switch( input.MenuI ) switch( input.MenuI )
{ {
case GAME_BUTTON_LEFT: case GAME_BUTTON_LEFT:
case GAME_BUTTON_RIGHT: case GAME_BUTTON_RIGHT:
SCREENMAN->PostMessageToTopScreen( SM_BeginFadingOut, 0 ); SCREENMAN->PostMessageToTopScreen( SM_BeginFadingOut, 0 );
return true;
default: default:
break; return false;
} }
// Screen::Input( input );
} }
void ScreenAttract::StartPlayingMusic() void ScreenAttract::StartPlayingMusic()
+2 -2
View File
@@ -13,11 +13,11 @@ public:
virtual void Init(); virtual void Init();
virtual void BeginScreen(); virtual void BeginScreen();
static void AttractInput( const InputEventPlus &input, ScreenWithMenuElements *pScreen ); static bool AttractInput( const InputEventPlus &input, ScreenWithMenuElements *pScreen );
static void GoToStartScreen( RString sScreenName ); static void GoToStartScreen( RString sScreenName );
static void SetAttractVolume( bool bInAttract ); static void SetAttractVolume( bool bInAttract );
virtual void Input( const InputEventPlus &input ); virtual bool Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void HandleScreenMessage( const ScreenMessage SM );
virtual void Cancel( ScreenMessage smSendWhenDone ); virtual void Cancel( ScreenMessage smSendWhenDone );
+23 -19
View File
@@ -68,53 +68,57 @@ void ScreenBookkeeping::Update( float fDelta )
ScreenWithMenuElements::Update( fDelta ); ScreenWithMenuElements::Update( fDelta );
} }
void ScreenBookkeeping::Input( const InputEventPlus &input ) bool ScreenBookkeeping::Input( const InputEventPlus &input )
{ {
if( input.type != IET_FIRST_PRESS && input.type != IET_REPEAT ) if( input.type != IET_FIRST_PRESS && input.type != IET_REPEAT )
return; // ignore return false; // ignore
Screen::Input( input ); // default handler return Screen::Input( input ); // default handler
} }
void ScreenBookkeeping::MenuLeft( const InputEventPlus &input ) bool ScreenBookkeeping::MenuLeft( const InputEventPlus &input )
{ {
m_iViewIndex--; m_iViewIndex--;
CLAMP( m_iViewIndex, 0, m_vBookkeepingViews.size()-1 ); CLAMP( m_iViewIndex, 0, m_vBookkeepingViews.size()-1 );
UpdateView(); UpdateView();
return true;
} }
void ScreenBookkeeping::MenuRight( const InputEventPlus &input ) bool ScreenBookkeeping::MenuRight( const InputEventPlus &input )
{ {
m_iViewIndex++; m_iViewIndex++;
CLAMP( m_iViewIndex, 0, m_vBookkeepingViews.size()-1 ); CLAMP( m_iViewIndex, 0, m_vBookkeepingViews.size()-1 );
UpdateView(); UpdateView();
return true;
} }
void ScreenBookkeeping::MenuStart( const InputEventPlus &input ) bool ScreenBookkeeping::MenuStart( const InputEventPlus &input )
{ {
if( !IsTransitioning() ) if( IsTransitioning() )
{ return false;
SCREENMAN->PlayStartSound();
StartTransitioningScreen( SM_GoToNextScreen ); SCREENMAN->PlayStartSound();
} StartTransitioningScreen( SM_GoToNextScreen );
return true;
} }
void ScreenBookkeeping::MenuBack( const InputEventPlus &input ) bool ScreenBookkeeping::MenuBack( const InputEventPlus &input )
{ {
if( !IsTransitioning() ) if( IsTransitioning() )
{ return false;
SCREENMAN->PlayStartSound();
StartTransitioningScreen( SM_GoToPrevScreen ); SCREENMAN->PlayStartSound();
} StartTransitioningScreen( SM_GoToPrevScreen );
return true;
} }
void ScreenBookkeeping::MenuCoin( const InputEventPlus &input ) bool ScreenBookkeeping::MenuCoin( const InputEventPlus &input )
{ {
UpdateView(); UpdateView();
Screen::MenuCoin( input ); return Screen::MenuCoin( input );
} }
static LocalizedString ALL_TIME ( "ScreenBookkeeping", "All-time Coin Total:" ); static LocalizedString ALL_TIME ( "ScreenBookkeeping", "All-time Coin Total:" );
+6 -6
View File
@@ -25,13 +25,13 @@ public:
virtual void Init(); virtual void Init();
virtual void Update( float fDelta ); virtual void Update( float fDelta );
virtual void Input( const InputEventPlus &input ); virtual bool Input( const InputEventPlus &input );
virtual void MenuLeft( const InputEventPlus &input ); virtual bool MenuLeft( const InputEventPlus &input );
virtual void MenuRight( const InputEventPlus &input ); virtual bool MenuRight( const InputEventPlus &input );
virtual void MenuStart( const InputEventPlus &input ); virtual bool MenuStart( const InputEventPlus &input );
virtual void MenuBack( const InputEventPlus &input ); virtual bool MenuBack( const InputEventPlus &input );
virtual void MenuCoin( const InputEventPlus &input ); virtual bool MenuCoin( const InputEventPlus &input );
private: private:
+5 -5
View File
@@ -48,16 +48,16 @@ void ScreenContinue::BeginScreen()
ScreenWithMenuElementsSimple::BeginScreen(); ScreenWithMenuElementsSimple::BeginScreen();
} }
void ScreenContinue::Input( const InputEventPlus &input ) bool ScreenContinue::Input( const InputEventPlus &input )
{ {
if( input.MenuI == GAME_BUTTON_COIN && input.type == IET_FIRST_PRESS ) if( input.MenuI == GAME_BUTTON_COIN && input.type == IET_FIRST_PRESS )
ResetTimer(); ResetTimer();
if( input.MenuI == GAME_BUTTON_START && input.type == IET_FIRST_PRESS && GAMESTATE->JoinInput(input.pn) ) if( input.MenuI == GAME_BUTTON_START && input.type == IET_FIRST_PRESS && GAMESTATE->JoinInput(input.pn) )
return; // handled return true; // handled
if( IsTransitioning() ) if( IsTransitioning() )
return; return true;
if( input.type == IET_FIRST_PRESS && GAMESTATE->IsHumanPlayer(input.pn) && FORCE_TIMER_WAIT ) if( input.type == IET_FIRST_PRESS && GAMESTATE->IsHumanPlayer(input.pn) && FORCE_TIMER_WAIT )
{ {
@@ -75,13 +75,13 @@ void ScreenContinue::Input( const InputEventPlus &input )
Message msg("HurryTimer"); Message msg("HurryTimer");
msg.SetParam( "PlayerNumber", input.pn ); msg.SetParam( "PlayerNumber", input.pn );
this->HandleMessage( msg ); this->HandleMessage( msg );
return; // handled return true; // handled
} }
default: break; default: break;
} }
} }
ScreenWithMenuElementsSimple::Input( input ); return ScreenWithMenuElementsSimple::Input( input );
} }
void ScreenContinue::HandleScreenMessage( const ScreenMessage SM ) void ScreenContinue::HandleScreenMessage( const ScreenMessage SM )
+1 -1
View File
@@ -11,7 +11,7 @@ public:
virtual void Init(); virtual void Init();
virtual void BeginScreen(); virtual void BeginScreen();
virtual void Input( const InputEventPlus &input ); virtual bool Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void HandleScreenMessage( const ScreenMessage SM );
virtual void HandleMessage( const Message &msg ); virtual void HandleMessage( const Message &msg );
virtual bool AllowLateJoin() const { return true; } virtual bool AllowLateJoin() const { return true; }
+118 -120
View File
@@ -1714,17 +1714,17 @@ void ScreenEdit::DrawPrimitives()
} }
void ScreenEdit::Input( const InputEventPlus &input ) bool ScreenEdit::Input( const InputEventPlus &input )
{ {
// LOG->Trace( "ScreenEdit::Input()" ); // LOG->Trace( "ScreenEdit::Input()" );
// invalidate input if cmd/meta is being held. // invalidate input if cmd/meta is being held.
if( INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_LMETA)) || if( INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_LMETA)) ||
INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_RMETA)) ) INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_RMETA)) )
return; return false;
if( m_In.IsTransitioning() || m_Out.IsTransitioning() ) if( m_In.IsTransitioning() || m_Out.IsTransitioning() )
return; return false;
EditButton EditB = DeviceToEdit( input.DeviceI ); EditButton EditB = DeviceToEdit( input.DeviceI );
if( EditB == EditButton_Invalid ) if( EditB == EditButton_Invalid )
@@ -1743,18 +1743,14 @@ void ScreenEdit::Input( const InputEventPlus &input )
{ {
DEFAULT_FAIL( m_EditState ); DEFAULT_FAIL( m_EditState );
case STATE_EDITING: case STATE_EDITING:
InputEdit( input, EditB );
m_bTextInfoNeedsUpdate = true; m_bTextInfoNeedsUpdate = true;
break; return InputEdit( input, EditB );
case STATE_RECORDING: case STATE_RECORDING:
InputRecord( input, EditB ); return InputRecord( input, EditB );
break;
case STATE_RECORDING_PAUSED: case STATE_RECORDING_PAUSED:
InputRecordPaused( input, EditB ); return InputRecordPaused( input, EditB );
break;
case STATE_PLAYING: case STATE_PLAYING:
InputPlay( input, EditB ); return InputPlay( input, EditB );
break;
} }
} }
@@ -1779,13 +1775,15 @@ static LocalizedString SWITCHED_TO ( "ScreenEdit", "Switched to" );
static LocalizedString NO_BACKGROUNDS_AVAILABLE ( "ScreenEdit", "No backgrounds available" ); static LocalizedString NO_BACKGROUNDS_AVAILABLE ( "ScreenEdit", "No backgrounds available" );
static ThemeMetric<bool> INVERT_SCROLL_BUTTONS ( "ScreenEdit", "InvertScrollSpeedButtons" ); static ThemeMetric<bool> INVERT_SCROLL_BUTTONS ( "ScreenEdit", "InvertScrollSpeedButtons" );
void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB ) bool ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
{ {
if( input.type == IET_RELEASE ) if( input.type == IET_RELEASE )
{ {
if( EditPressed( EDIT_BUTTON_SCROLL_SELECT, input.DeviceI ) ) if( EditPressed( EDIT_BUTTON_SCROLL_SELECT, input.DeviceI ) )
m_iShiftAnchor = -1; m_iShiftAnchor = -1;
return; // XXX Key releases usually don't count as "handled," but what
// does it mean in this case?
return false;
} }
TimingData &sTiming = GetAppropriateTiming(); TimingData &sTiming = GetAppropriateTiming();
float playerBeat = GetAppropriatePosition().m_fSongBeat; float playerBeat = GetAppropriatePosition().m_fSongBeat;
@@ -1805,7 +1803,7 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
case EDIT_BUTTON_COLUMN_9: case EDIT_BUTTON_COLUMN_9:
{ {
if( input.type != IET_FIRST_PRESS ) if( input.type != IET_FIRST_PRESS )
break; // We only care about first presses return false; // We only care about first presses
int iCol = EditB - EDIT_BUTTON_COLUMN_0; int iCol = EditB - EDIT_BUTTON_COLUMN_0;
@@ -1815,7 +1813,7 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
ShiftToRightSide( iCol, m_NoteDataEdit.GetNumTracks() ); ShiftToRightSide( iCol, m_NoteDataEdit.GetNumTracks() );
if( iCol >= m_NoteDataEdit.GetNumTracks() ) if( iCol >= m_NoteDataEdit.GetNumTracks() )
break; // this button is not in the range of columns for this Style return false; // this button is not in the range of columns for this Style
const float fSongBeat = GetBeat(); const float fSongBeat = GetBeat();
const int iSongIndex = BeatToNoteRow( fSongBeat ); const int iSongIndex = BeatToNoteRow( fSongBeat );
@@ -1854,7 +1852,7 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
CheckNumberOfNotesAndUndo(); CheckNumberOfNotesAndUndo();
} }
} }
break; return true;
case EDIT_BUTTON_CYCLE_TAP_LEFT: case EDIT_BUTTON_CYCLE_TAP_LEFT:
{ {
@@ -1866,7 +1864,7 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
case TapNote::fake: m_selectedTap = TAP_ORIGINAL_LIFT; break; case TapNote::fake: m_selectedTap = TAP_ORIGINAL_LIFT; break;
DEFAULT_FAIL( m_selectedTap.type ); DEFAULT_FAIL( m_selectedTap.type );
} }
break; return true;
} }
case EDIT_BUTTON_CYCLE_TAP_RIGHT: case EDIT_BUTTON_CYCLE_TAP_RIGHT:
{ {
@@ -1878,21 +1876,21 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
case TapNote::fake: m_selectedTap = TAP_ORIGINAL_TAP; break; case TapNote::fake: m_selectedTap = TAP_ORIGINAL_TAP; break;
DEFAULT_FAIL( m_selectedTap.type ); DEFAULT_FAIL( m_selectedTap.type );
} }
break; return true;
} }
case EDIT_BUTTON_CYCLE_SEGMENT_LEFT: case EDIT_BUTTON_CYCLE_SEGMENT_LEFT:
{ {
int tmp = enum_add2( this->currentCycleSegment, -1 ); int tmp = enum_add2( this->currentCycleSegment, -1 );
wrap( *ConvertValue<int>(&tmp), NUM_TimingSegmentType ); wrap( *ConvertValue<int>(&tmp), NUM_TimingSegmentType );
currentCycleSegment = (TimingSegmentType)tmp; currentCycleSegment = (TimingSegmentType)tmp;
break; return true;
} }
case EDIT_BUTTON_CYCLE_SEGMENT_RIGHT: case EDIT_BUTTON_CYCLE_SEGMENT_RIGHT:
{ {
int tmp = enum_add2( this->currentCycleSegment, +1 ); int tmp = enum_add2( this->currentCycleSegment, +1 );
wrap( *ConvertValue<int>(&tmp), NUM_TimingSegmentType ); wrap( *ConvertValue<int>(&tmp), NUM_TimingSegmentType );
currentCycleSegment = (TimingSegmentType)tmp; currentCycleSegment = (TimingSegmentType)tmp;
break; return true;
} }
case EDIT_BUTTON_SCROLL_SPEED_UP: case EDIT_BUTTON_SCROLL_SPEED_UP:
case EDIT_BUTTON_SCROLL_SPEED_DOWN: case EDIT_BUTTON_SCROLL_SPEED_DOWN:
@@ -1930,16 +1928,15 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
} }
PO_GROUP_ASSIGN( pPlayerState->m_PlayerOptions, ModsLevel_Song, m_fScrollSpeed, fScrollSpeed ); PO_GROUP_ASSIGN( pPlayerState->m_PlayerOptions, ModsLevel_Song, m_fScrollSpeed, fScrollSpeed );
break;
} }
break; return true;
case EDIT_BUTTON_SCROLL_HOME: case EDIT_BUTTON_SCROLL_HOME:
ScrollTo( 0 ); ScrollTo( 0 );
break; return true;
case EDIT_BUTTON_SCROLL_END: case EDIT_BUTTON_SCROLL_END:
ScrollTo( m_NoteDataEdit.GetLastBeat() ); ScrollTo( m_NoteDataEdit.GetLastBeat() );
break; return true;
case EDIT_BUTTON_SCROLL_UP_LINE: case EDIT_BUTTON_SCROLL_UP_LINE:
case EDIT_BUTTON_SCROLL_UP_PAGE: case EDIT_BUTTON_SCROLL_UP_PAGE:
case EDIT_BUTTON_SCROLL_UP_TS: case EDIT_BUTTON_SCROLL_UP_TS:
@@ -1979,20 +1976,20 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
ScrollTo( fDestinationBeat ); ScrollTo( fDestinationBeat );
} }
break; return true;
case EDIT_BUTTON_SCROLL_NEXT_MEASURE: case EDIT_BUTTON_SCROLL_NEXT_MEASURE:
{ {
float fDestinationBeat = GetBeat() + beatsPerMeasure; float fDestinationBeat = GetBeat() + beatsPerMeasure;
fDestinationBeat = ftruncf( fDestinationBeat, (float)beatsPerMeasure ); fDestinationBeat = ftruncf( fDestinationBeat, (float)beatsPerMeasure );
ScrollTo( fDestinationBeat ); ScrollTo( fDestinationBeat );
break; return true;
} }
case EDIT_BUTTON_SCROLL_PREV_MEASURE: case EDIT_BUTTON_SCROLL_PREV_MEASURE:
{ {
float fDestinationBeat = QuantizeUp( GetBeat(), (float)beatsPerMeasure ); float fDestinationBeat = QuantizeUp( GetBeat(), (float)beatsPerMeasure );
fDestinationBeat -= (float)beatsPerMeasure; fDestinationBeat -= (float)beatsPerMeasure;
ScrollTo( fDestinationBeat ); ScrollTo( fDestinationBeat );
break; return true;
} }
case EDIT_BUTTON_SCROLL_NEXT: case EDIT_BUTTON_SCROLL_NEXT:
{ {
@@ -2000,38 +1997,38 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
NoteDataUtil::GetNextEditorPosition( m_NoteDataEdit, iRow ); NoteDataUtil::GetNextEditorPosition( m_NoteDataEdit, iRow );
ScrollTo( NoteRowToBeat(iRow) ); ScrollTo( NoteRowToBeat(iRow) );
} }
break; return true;
case EDIT_BUTTON_SCROLL_PREV: case EDIT_BUTTON_SCROLL_PREV:
{ {
int iRow = BeatToNoteRow( GetBeat() ); int iRow = BeatToNoteRow( GetBeat() );
NoteDataUtil::GetPrevEditorPosition( m_NoteDataEdit, iRow ); NoteDataUtil::GetPrevEditorPosition( m_NoteDataEdit, iRow );
ScrollTo( NoteRowToBeat(iRow) ); ScrollTo( NoteRowToBeat(iRow) );
} }
break; return true;
case EDIT_BUTTON_SEGMENT_NEXT: case EDIT_BUTTON_SEGMENT_NEXT:
{ {
// TODO: Work around Stops and Delays. We MAY have to separate them. // TODO: Work around Stops and Delays. We MAY have to separate them.
TimingData &timing = GetAppropriateTiming(); TimingData &timing = GetAppropriateTiming();
ScrollTo(timing.GetNextSegmentBeatAtBeat(this->currentCycleSegment, ScrollTo(timing.GetNextSegmentBeatAtBeat(this->currentCycleSegment,
GetBeat()));
}
break;
case EDIT_BUTTON_SEGMENT_PREV:
{
// TODO: Work around Stops and Delays. We MAY have to separate them.
TimingData &timing = GetAppropriateTiming();
ScrollTo(timing.GetPreviousSegmentBeatAtBeat(this->currentCycleSegment,
GetBeat())); GetBeat()));
} }
break; return true;
case EDIT_BUTTON_SEGMENT_PREV:
{
// TODO: Work around Stops and Delays. We MAY have to separate them.
TimingData &timing = GetAppropriateTiming();
ScrollTo(timing.GetPreviousSegmentBeatAtBeat(this->currentCycleSegment,
GetBeat()));
}
return true;
case EDIT_BUTTON_SNAP_NEXT: case EDIT_BUTTON_SNAP_NEXT:
if( m_SnapDisplay.PrevSnapMode() ) if( m_SnapDisplay.PrevSnapMode() )
OnSnapModeChange(); OnSnapModeChange();
break; return true;
case EDIT_BUTTON_SNAP_PREV: case EDIT_BUTTON_SNAP_PREV:
if( m_SnapDisplay.NextSnapMode() ) if( m_SnapDisplay.NextSnapMode() )
OnSnapModeChange(); OnSnapModeChange();
break; return true;
case EDIT_BUTTON_LAY_SELECT: case EDIT_BUTTON_LAY_SELECT:
{ {
const int iCurrentRow = BeatToNoteRow(GetAppropriatePosition().m_fSongBeat); const int iCurrentRow = BeatToNoteRow(GetAppropriatePosition().m_fSongBeat);
@@ -2059,7 +2056,7 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
} }
m_soundMarker.Play(); m_soundMarker.Play();
} }
break; return true;
case EDIT_BUTTON_OPEN_AREA_MENU: case EDIT_BUTTON_OPEN_AREA_MENU:
{ {
// TODO: Improve behavior if timing changes are shifted down on beat 0. // TODO: Improve behavior if timing changes are shifted down on beat 0.
@@ -2069,7 +2066,7 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
g_AreaMenu.rows[undo].bEnabled = m_bHasUndo; g_AreaMenu.rows[undo].bEnabled = m_bHasUndo;
EditMiniMenu( &g_AreaMenu, SM_BackFromAreaMenu ); EditMiniMenu( &g_AreaMenu, SM_BackFromAreaMenu );
} }
break; return true;
case EDIT_BUTTON_OPEN_ALTER_MENU: case EDIT_BUTTON_OPEN_ALTER_MENU:
{ {
bool bAreaSelected = m_NoteFieldEdit.m_iBeginMarker!=-1 && m_NoteFieldEdit.m_iEndMarker!=-1; bool bAreaSelected = m_NoteFieldEdit.m_iBeginMarker!=-1 && m_NoteFieldEdit.m_iEndMarker!=-1;
@@ -2089,19 +2086,19 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
g_AlterMenu.rows[routine_mirror_2_to_1].bEnabled = isRoutine; g_AlterMenu.rows[routine_mirror_2_to_1].bEnabled = isRoutine;
EditMiniMenu(&g_AlterMenu, SM_BackFromAlterMenu); EditMiniMenu(&g_AlterMenu, SM_BackFromAlterMenu);
} }
break; return true;
} }
case EDIT_BUTTON_OPEN_EDIT_MENU: case EDIT_BUTTON_OPEN_EDIT_MENU:
EditMiniMenu( &g_MainMenu, SM_BackFromMainMenu ); EditMiniMenu( &g_MainMenu, SM_BackFromMainMenu );
break; return true;
case EDIT_BUTTON_OPEN_INPUT_HELP: case EDIT_BUTTON_OPEN_INPUT_HELP:
DoHelp(); DoHelp();
break; return true;
case EDIT_BUTTON_OPEN_TIMING_MENU: case EDIT_BUTTON_OPEN_TIMING_MENU:
{ {
DisplayTimingMenu(); DisplayTimingMenu();
break; return true;
} }
case EDIT_BUTTON_OPEN_NEXT_STEPS: case EDIT_BUTTON_OPEN_NEXT_STEPS:
case EDIT_BUTTON_OPEN_PREV_STEPS: case EDIT_BUTTON_OPEN_PREV_STEPS:
@@ -2136,7 +2133,7 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
if( it==vSteps.begin() ) if( it==vSteps.begin() )
{ {
SCREENMAN->PlayInvalidSound(); SCREENMAN->PlayInvalidSound();
return; return true;
} }
it--; it--;
break; break;
@@ -2145,7 +2142,7 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
if( it==vSteps.end() ) if( it==vSteps.end() )
{ {
SCREENMAN->PlayInvalidSound(); SCREENMAN->PlayInvalidSound();
return; return true;
} }
break; break;
} }
@@ -2167,7 +2164,7 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
ScrollTo( GetAppropriateTiming().GetBeatFromElapsedTime(curSecond) ); ScrollTo( GetAppropriateTiming().GetBeatFromElapsedTime(curSecond) );
} }
break; return true;
case EDIT_BUTTON_BPM_UP: case EDIT_BUTTON_BPM_UP:
case EDIT_BUTTON_BPM_DOWN: case EDIT_BUTTON_BPM_DOWN:
{ {
@@ -2196,7 +2193,7 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
(fDelta>0 ? m_soundValueIncrease : m_soundValueDecrease).Play(); (fDelta>0 ? m_soundValueIncrease : m_soundValueDecrease).Play();
SetDirty( true ); SetDirty( true );
} }
break; return true;
case EDIT_BUTTON_STOP_UP: case EDIT_BUTTON_STOP_UP:
case EDIT_BUTTON_STOP_DOWN: case EDIT_BUTTON_STOP_DOWN:
{ {
@@ -2228,7 +2225,7 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
if( fDelta > 0 ) if( fDelta > 0 )
timing.AddSegment( StopSegment(GetRow(), fDelta) ); timing.AddSegment( StopSegment(GetRow(), fDelta) );
else else
break; return false;
} }
else else
{ {
@@ -2241,7 +2238,7 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
(fDelta>0 ? m_soundValueIncrease : m_soundValueDecrease).Play(); (fDelta>0 ? m_soundValueIncrease : m_soundValueDecrease).Play();
SetDirty( true ); SetDirty( true );
} }
break; return true;
// TODO: Combine the stop and delay call somehow? // TODO: Combine the stop and delay call somehow?
case EDIT_BUTTON_DELAY_UP: case EDIT_BUTTON_DELAY_UP:
case EDIT_BUTTON_DELAY_DOWN: case EDIT_BUTTON_DELAY_DOWN:
@@ -2274,7 +2271,7 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
if( fDelta > 0 ) if( fDelta > 0 )
timing.AddSegment( DelaySegment(GetRow(), fDelta) ); timing.AddSegment( DelaySegment(GetRow(), fDelta) );
else else
break; return false;
} }
else else
{ {
@@ -2287,7 +2284,7 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
(fDelta>0 ? m_soundValueIncrease : m_soundValueDecrease).Play(); (fDelta>0 ? m_soundValueIncrease : m_soundValueDecrease).Play();
SetDirty( true ); SetDirty( true );
} }
break; return true;
case EDIT_BUTTON_OFFSET_UP: case EDIT_BUTTON_OFFSET_UP:
case EDIT_BUTTON_OFFSET_DOWN: case EDIT_BUTTON_OFFSET_DOWN:
{ {
@@ -2322,7 +2319,7 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
} }
SetDirty( true ); SetDirty( true );
} }
break; return true;
case EDIT_BUTTON_SAMPLE_START_UP: case EDIT_BUTTON_SAMPLE_START_UP:
case EDIT_BUTTON_SAMPLE_START_DOWN: case EDIT_BUTTON_SAMPLE_START_DOWN:
case EDIT_BUTTON_SAMPLE_LENGTH_DOWN: case EDIT_BUTTON_SAMPLE_LENGTH_DOWN:
@@ -2359,10 +2356,10 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
(fDelta>0 ? m_soundValueIncrease : m_soundValueDecrease).Play(); (fDelta>0 ? m_soundValueIncrease : m_soundValueDecrease).Play();
SetDirty( true ); SetDirty( true );
} }
break; return true;
case EDIT_BUTTON_PLAY_SAMPLE_MUSIC: case EDIT_BUTTON_PLAY_SAMPLE_MUSIC:
PlayPreviewMusic(); PlayPreviewMusic();
break; return true;
case EDIT_BUTTON_OPEN_BGCHANGE_LAYER1_MENU: case EDIT_BUTTON_OPEN_BGCHANGE_LAYER1_MENU:
case EDIT_BUTTON_OPEN_BGCHANGE_LAYER2_MENU: case EDIT_BUTTON_OPEN_BGCHANGE_LAYER2_MENU:
if( !GAMESTATE->m_bIsUsingStepTiming ) if( !GAMESTATE->m_bIsUsingStepTiming )
@@ -2469,7 +2466,7 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
SCREENMAN->SystemMessage( BG_CHANGE_STEP_TIMING ); SCREENMAN->SystemMessage( BG_CHANGE_STEP_TIMING );
SCREENMAN->PlayInvalidSound(); SCREENMAN->PlayInvalidSound();
} }
break; return true;
case EDIT_BUTTON_OPEN_COURSE_MENU: case EDIT_BUTTON_OPEN_COURSE_MENU:
{ {
@@ -2501,18 +2498,18 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
EditMiniMenu( &g_CourseMode, SM_BackFromCourseModeMenu ); EditMiniMenu( &g_CourseMode, SM_BackFromCourseModeMenu );
} }
break; return true;
case EDIT_BUTTON_OPEN_STEP_ATTACK_MENU: case EDIT_BUTTON_OPEN_STEP_ATTACK_MENU:
{ {
this->DoStepAttackMenu(); this->DoStepAttackMenu();
break; return true;
} }
case EDIT_BUTTON_OPEN_COURSE_ATTACK_MENU: case EDIT_BUTTON_OPEN_COURSE_ATTACK_MENU:
{ {
// TODO: Give Song/Step Timing switches/functions here? // TODO: Give Song/Step Timing switches/functions here?
Course *pCourse = GAMESTATE->m_pCurCourse; Course *pCourse = GAMESTATE->m_pCurCourse;
if( pCourse == NULL ) if( pCourse == NULL )
break; return false;
CourseEntry &ce = pCourse->m_vEntries[GAMESTATE->m_iEditCourseEntryIndex]; CourseEntry &ce = pCourse->m_vEntries[GAMESTATE->m_iEditCourseEntryIndex];
float fStartTime = m_pSteps->m_Timing.GetElapsedTimeFromBeat( GAMESTATE->m_pPlayerState[PLAYER_1]->m_Position.m_fSongBeat ); float fStartTime = m_pSteps->m_Timing.GetElapsedTimeFromBeat( GAMESTATE->m_pPlayerState[PLAYER_1]->m_Position.m_fSongBeat );
int iAttack = FindAttackAtTime( ce.attacks, fStartTime ); int iAttack = FindAttackAtTime( ce.attacks, fStartTime );
@@ -2537,7 +2534,7 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
EditMiniMenu( &g_InsertCourseAttack, SM_BackFromInsertCourseAttack ); EditMiniMenu( &g_InsertCourseAttack, SM_BackFromInsertCourseAttack );
} }
break; return true;
case EDIT_BUTTON_ADD_STEP_MODS: case EDIT_BUTTON_ADD_STEP_MODS:
{ {
float start = -1; float start = -1;
@@ -2576,7 +2573,7 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
g_fLastInsertAttackDurationSeconds = end - start; g_fLastInsertAttackDurationSeconds = end - start;
toEdit.Assign( ModsLevel_Stage, po ); toEdit.Assign( ModsLevel_Stage, po );
SCREENMAN->AddNewScreenToTop( "ScreenPlayerOptions", SM_BackFromInsertStepAttackPlayerOptions ); SCREENMAN->AddNewScreenToTop( "ScreenPlayerOptions", SM_BackFromInsertStepAttackPlayerOptions );
break; return true;
} }
case EDIT_BUTTON_ADD_COURSE_MODS: case EDIT_BUTTON_ADD_COURSE_MODS:
{ {
@@ -2584,7 +2581,7 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
PlayerOptions po; PlayerOptions po;
const Course *pCourse = GAMESTATE->m_pCurCourse; const Course *pCourse = GAMESTATE->m_pCurCourse;
if( pCourse == NULL ) if( pCourse == NULL )
break; return false;
const CourseEntry &ce = pCourse->m_vEntries[GAMESTATE->m_iEditCourseEntryIndex]; const CourseEntry &ce = pCourse->m_vEntries[GAMESTATE->m_iEditCourseEntryIndex];
if( m_NoteFieldEdit.m_iBeginMarker == -1 ) if( m_NoteFieldEdit.m_iBeginMarker == -1 )
@@ -2613,7 +2610,7 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
SCREENMAN->AddNewScreenToTop( "ScreenPlayerOptions", SM_BackFromInsertCourseAttackPlayerOptions ); SCREENMAN->AddNewScreenToTop( "ScreenPlayerOptions", SM_BackFromInsertCourseAttackPlayerOptions );
} }
break; return true;
case EDIT_BUTTON_BAKE_RANDOM_FROM_SONG_GROUP: case EDIT_BUTTON_BAKE_RANDOM_FROM_SONG_GROUP:
case EDIT_BUTTON_BAKE_RANDOM_FROM_SONG_GROUP_AND_GENRE: case EDIT_BUTTON_BAKE_RANDOM_FROM_SONG_GROUP_AND_GENRE:
{ {
@@ -2643,19 +2640,19 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
m_soundMarker.Play(); m_soundMarker.Play();
} }
} }
break; return true;
case EDIT_BUTTON_PLAY_FROM_START: case EDIT_BUTTON_PLAY_FROM_START:
HandleMainMenuChoice( play_whole_song ); HandleMainMenuChoice( play_whole_song );
break; return true;
case EDIT_BUTTON_PLAY_FROM_CURSOR: case EDIT_BUTTON_PLAY_FROM_CURSOR:
HandleMainMenuChoice( play_current_beat_to_end ); HandleMainMenuChoice( play_current_beat_to_end );
break; return true;
case EDIT_BUTTON_PLAY_SELECTION: case EDIT_BUTTON_PLAY_SELECTION:
HandleMainMenuChoice( play_selection ); HandleMainMenuChoice( play_selection );
break; return true;
case EDIT_BUTTON_RECORD_SELECTION: case EDIT_BUTTON_RECORD_SELECTION:
if( m_NoteFieldEdit.m_iBeginMarker!=-1 && m_NoteFieldEdit.m_iEndMarker!=-1 ) if( m_NoteFieldEdit.m_iBeginMarker!=-1 && m_NoteFieldEdit.m_iEndMarker!=-1 )
{ {
@@ -2680,80 +2677,80 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
if( m_iStartPlayingAt >= m_iStopPlayingAt ) if( m_iStartPlayingAt >= m_iStopPlayingAt )
{ {
SCREENMAN->PlayInvalidSound(); SCREENMAN->PlayInvalidSound();
return; return true;
} }
TransitionEditState( STATE_RECORDING ); TransitionEditState( STATE_RECORDING );
} }
break; return true;
case EDIT_BUTTON_RECORD_FROM_CURSOR: case EDIT_BUTTON_RECORD_FROM_CURSOR:
m_iStartPlayingAt = BeatToNoteRow(GetAppropriatePosition().m_fSongBeat); m_iStartPlayingAt = BeatToNoteRow(GetAppropriatePosition().m_fSongBeat);
m_iStopPlayingAt = max( m_iStartPlayingAt, m_NoteDataEdit.GetLastRow() ); m_iStopPlayingAt = max( m_iStartPlayingAt, m_NoteDataEdit.GetLastRow() );
TransitionEditState( STATE_RECORDING ); TransitionEditState( STATE_RECORDING );
break; return true;
case EDIT_BUTTON_INSERT: case EDIT_BUTTON_INSERT:
HandleAreaMenuChoice( insert_and_shift ); HandleAreaMenuChoice( insert_and_shift );
SCREENMAN->PlayInvalidSound(); SCREENMAN->PlayInvalidSound();
break; return true;
case EDIT_BUTTON_INSERT_SHIFT_PAUSES: case EDIT_BUTTON_INSERT_SHIFT_PAUSES:
HandleAreaMenuChoice( shift_pauses_forward ); HandleAreaMenuChoice( shift_pauses_forward );
SCREENMAN->PlayInvalidSound(); SCREENMAN->PlayInvalidSound();
break; return true;
case EDIT_BUTTON_DELETE: case EDIT_BUTTON_DELETE:
HandleAreaMenuChoice( delete_and_shift ); HandleAreaMenuChoice( delete_and_shift );
SCREENMAN->PlayInvalidSound(); SCREENMAN->PlayInvalidSound();
break; return true;
case EDIT_BUTTON_DELETE_SHIFT_PAUSES: case EDIT_BUTTON_DELETE_SHIFT_PAUSES:
HandleAreaMenuChoice( shift_pauses_backward ); HandleAreaMenuChoice( shift_pauses_backward );
SCREENMAN->PlayInvalidSound(); SCREENMAN->PlayInvalidSound();
break; return true;
case EDIT_BUTTON_SAVE: case EDIT_BUTTON_SAVE:
HandleMainMenuChoice( ScreenEdit::save ); HandleMainMenuChoice( ScreenEdit::save );
break; return true;
case EDIT_BUTTON_UNDO: case EDIT_BUTTON_UNDO:
Undo(); Undo();
break; return true;
case EDIT_BUTTON_SWITCH_PLAYERS: case EDIT_BUTTON_SWITCH_PLAYERS:
if( m_InputPlayerNumber != PLAYER_INVALID ) if( m_InputPlayerNumber == PLAYER_INVALID )
{ return false;
enum_add( m_InputPlayerNumber, 1 ); enum_add( m_InputPlayerNumber, 1 );
if( m_InputPlayerNumber == NUM_PLAYERS ) if( m_InputPlayerNumber == NUM_PLAYERS )
m_InputPlayerNumber = PLAYER_1; m_InputPlayerNumber = PLAYER_1;
m_soundSwitchPlayer.Play(); m_soundSwitchPlayer.Play();
} return true;
break;
case EDIT_BUTTON_SWITCH_TIMINGS: case EDIT_BUTTON_SWITCH_TIMINGS:
GAMESTATE->m_bIsUsingStepTiming = !GAMESTATE->m_bIsUsingStepTiming; GAMESTATE->m_bIsUsingStepTiming = !GAMESTATE->m_bIsUsingStepTiming;
m_soundSwitchTiming.Play(); m_soundSwitchTiming.Play();
break; return true;
default: break; default:
return false;
} }
} }
void ScreenEdit::InputRecord( const InputEventPlus &input, EditButton EditB ) bool ScreenEdit::InputRecord( const InputEventPlus &input, EditButton EditB )
{ {
if( input.type == IET_FIRST_PRESS && EditB == EDIT_BUTTON_RETURN_TO_EDIT ) if( input.type == IET_FIRST_PRESS && EditB == EDIT_BUTTON_RETURN_TO_EDIT )
{ {
TransitionEditState( STATE_EDITING ); TransitionEditState( STATE_EDITING );
return; return true;
} }
if( input.pn != PLAYER_1 ) if( input.pn != PLAYER_1 )
return; // ignore return false; // ignore
const int iCol = GAMESTATE->GetCurrentStyle()->GameInputToColumn( input.GameI ); const int iCol = GAMESTATE->GetCurrentStyle()->GameInputToColumn( input.GameI );
//Is this actually a column? If not, ignore the input. //Is this actually a column? If not, ignore the input.
if( iCol == -1 ) if( iCol == -1 )
return; return false;
switch( input.type ) switch( input.type )
{ {
@@ -2763,7 +2760,7 @@ void ScreenEdit::InputRecord( const InputEventPlus &input, EditButton EditB )
if( EditIsBeingPressed(EDIT_BUTTON_REMOVE_NOTE) ) if( EditIsBeingPressed(EDIT_BUTTON_REMOVE_NOTE) )
{ {
// Remove notes in Update. // Remove notes in Update.
break; return false;
} }
// Add a tap // Add a tap
@@ -2772,11 +2769,11 @@ void ScreenEdit::InputRecord( const InputEventPlus &input, EditButton EditB )
const int iRow = BeatToNoteRow( fBeat ); const int iRow = BeatToNoteRow( fBeat );
if( iRow < 0 ) if( iRow < 0 )
break; return false;
// Don't add outside of the range. // Don't add outside of the range.
if( iRow < m_iStartPlayingAt || iRow >= m_iStopPlayingAt ) if( iRow < m_iStartPlayingAt || iRow >= m_iStopPlayingAt )
return; return false;
// Remove hold if any so that we don't have taps inside of a hold. // Remove hold if any so that we don't have taps inside of a hold.
int iHeadRow; int iHeadRow;
@@ -2788,18 +2785,18 @@ void ScreenEdit::InputRecord( const InputEventPlus &input, EditButton EditB )
m_NoteDataRecord.SetTapNote( iCol, iRow, tn ); m_NoteDataRecord.SetTapNote( iCol, iRow, tn );
m_NoteFieldRecord.Step( iCol, TNS_W1 ); m_NoteFieldRecord.Step( iCol, TNS_W1 );
} }
break; return true;
case IET_REPEAT: case IET_REPEAT:
case IET_RELEASE: case IET_RELEASE:
// don't add or extend holds here; we do it in Update() // don't add or extend holds here; we do it in Update()
break; return false;
} }
} }
void ScreenEdit::InputRecordPaused( const InputEventPlus &input, EditButton EditB ) bool ScreenEdit::InputRecordPaused( const InputEventPlus &input, EditButton EditB )
{ {
if( input.type != IET_FIRST_PRESS ) if( input.type != IET_FIRST_PRESS )
return; // don't care return false; // don't care
switch( EditB ) switch( EditB )
{ {
@@ -2808,15 +2805,15 @@ void ScreenEdit::InputRecordPaused( const InputEventPlus &input, EditButton Edit
* to do to undo is Undo() as usual, and copy the note data back in. */ * to do to undo is Undo() as usual, and copy the note data back in. */
Undo(); Undo();
m_NoteDataRecord.CopyAll( m_NoteDataEdit ); m_NoteDataRecord.CopyAll( m_NoteDataEdit );
break; return true;
case EDIT_BUTTON_PLAY_SELECTION: case EDIT_BUTTON_PLAY_SELECTION:
TransitionEditState( STATE_PLAYING ); TransitionEditState( STATE_PLAYING );
break; return true;
case EDIT_BUTTON_RECORD_SELECTION: case EDIT_BUTTON_RECORD_SELECTION:
TransitionEditState( STATE_RECORDING ); TransitionEditState( STATE_RECORDING );
break; return true;
case EDIT_BUTTON_RECORD_FROM_CURSOR: case EDIT_BUTTON_RECORD_FROM_CURSOR:
if( GAMESTATE->m_pCurSteps[0]->IsAnEdit() ) if( GAMESTATE->m_pCurSteps[0]->IsAnEdit() )
@@ -2826,7 +2823,7 @@ void ScreenEdit::InputRecordPaused( const InputEventPlus &input, EditButton Edit
{ {
// We're already at the end. // We're already at the end.
SCREENMAN->PlayInvalidSound(); SCREENMAN->PlayInvalidSound();
return; return true;
} }
} }
@@ -2841,16 +2838,17 @@ void ScreenEdit::InputRecordPaused( const InputEventPlus &input, EditButton Edit
} }
TransitionEditState( STATE_RECORDING ); TransitionEditState( STATE_RECORDING );
break; return true;
case EDIT_BUTTON_RETURN_TO_EDIT: case EDIT_BUTTON_RETURN_TO_EDIT:
TransitionEditState( STATE_EDITING ); TransitionEditState( STATE_EDITING );
break; return true;
default: break; default:
return false;
} }
} }
void ScreenEdit::InputPlay( const InputEventPlus &input, EditButton EditB ) bool ScreenEdit::InputPlay( const InputEventPlus &input, EditButton EditB )
{ {
switch( input.type ) switch( input.type )
{ {
@@ -2858,7 +2856,7 @@ void ScreenEdit::InputPlay( const InputEventPlus &input, EditButton EditB )
case IET_FIRST_PRESS: case IET_FIRST_PRESS:
break; break;
default: default:
return; return false;
} }
GameButtonType gbt = GAMESTATE->m_pCurGame->GetPerButtonInfo(input.GameI.button)->m_gbt; GameButtonType gbt = GAMESTATE->m_pCurGame->GetPerButtonInfo(input.GameI.button)->m_gbt;
@@ -2879,22 +2877,21 @@ void ScreenEdit::InputPlay( const InputEventPlus &input, EditButton EditB )
{ {
switch( gbt ) switch( gbt )
{ {
case GameButtonType_INVALID:
break;
case GameButtonType_Step: case GameButtonType_Step:
if( iCol != -1 ) if( iCol != -1 )
m_Player->Step( iCol, -1, input.DeviceI.ts, false, bRelease ); m_Player->Step( iCol, -1, input.DeviceI.ts, false, bRelease );
break; return true;
case GameButtonType_Fret: case GameButtonType_Fret:
if( iCol != -1 ) if( iCol != -1 )
m_Player->Fret( iCol, -1, input.DeviceI.ts, false, bRelease ); m_Player->Fret( iCol, -1, input.DeviceI.ts, false, bRelease );
break; return true;
case GameButtonType_Strum: case GameButtonType_Strum:
m_Player->Strum( iCol, -1, input.DeviceI.ts, false, bRelease ); m_Player->Strum( iCol, -1, input.DeviceI.ts, false, bRelease );
return true;
default:
break; break;
} }
} }
break;
default: break; default: break;
} }
} }
@@ -2907,7 +2904,7 @@ void ScreenEdit::InputPlay( const InputEventPlus &input, EditButton EditB )
/* When exiting play mode manually, leave the cursor where it is. */ /* When exiting play mode manually, leave the cursor where it is. */
m_fBeatToReturnTo = GetAppropriatePosition().m_fSongBeat; m_fBeatToReturnTo = GetAppropriatePosition().m_fSongBeat;
TransitionEditState( STATE_EDITING ); TransitionEditState( STATE_EDITING );
break; return true;
case EDIT_BUTTON_OFFSET_UP: case EDIT_BUTTON_OFFSET_UP:
case EDIT_BUTTON_OFFSET_DOWN: case EDIT_BUTTON_OFFSET_DOWN:
{ {
@@ -2937,10 +2934,11 @@ void ScreenEdit::InputPlay( const InputEventPlus &input, EditButton EditB )
GAMESTATE->m_pCurSong->m_fMusicSampleStartSeconds += fOffsetDelta; GAMESTATE->m_pCurSong->m_fMusicSampleStartSeconds += fOffsetDelta;
} }
} }
break; return true;
default: break; default: break;
} }
} }
return false;
} }
void ScreenEdit::TransitionEditState( EditState em ) void ScreenEdit::TransitionEditState( EditState em )
+5 -5
View File
@@ -202,11 +202,11 @@ public:
virtual ~ScreenEdit(); virtual ~ScreenEdit();
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime );
virtual void DrawPrimitives(); virtual void DrawPrimitives();
virtual void Input( const InputEventPlus &input ); virtual bool Input( const InputEventPlus &input );
void InputEdit( const InputEventPlus &input, EditButton EditB ); bool InputEdit( const InputEventPlus &input, EditButton EditB );
void InputRecord( const InputEventPlus &input, EditButton EditB ); bool InputRecord( const InputEventPlus &input, EditButton EditB );
void InputRecordPaused( const InputEventPlus &input, EditButton EditB ); bool InputRecordPaused( const InputEventPlus &input, EditButton EditB );
void InputPlay( const InputEventPlus &input, EditButton EditB ); bool InputPlay( const InputEventPlus &input, EditButton EditB );
virtual void HandleMessage( const Message &msg ); virtual void HandleMessage( const Message &msg );
virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void HandleScreenMessage( const ScreenMessage SM );
+18 -13
View File
@@ -100,38 +100,42 @@ void ScreenEditMenu::HandleScreenMessage( const ScreenMessage SM )
ScreenWithMenuElements::HandleScreenMessage( SM ); ScreenWithMenuElements::HandleScreenMessage( SM );
} }
void ScreenEditMenu::MenuUp( const InputEventPlus & ) bool ScreenEditMenu::MenuUp( const InputEventPlus & )
{ {
if( m_Selector.CanGoUp() ) if( m_Selector.CanGoUp() )
{ {
m_Selector.Up(); m_Selector.Up();
RefreshExplanationText(); RefreshExplanationText();
} }
return true;
} }
void ScreenEditMenu::MenuDown( const InputEventPlus & ) bool ScreenEditMenu::MenuDown( const InputEventPlus & )
{ {
if( m_Selector.CanGoDown() ) if( m_Selector.CanGoDown() )
{ {
m_Selector.Down(); m_Selector.Down();
RefreshExplanationText(); RefreshExplanationText();
} }
return true;
} }
void ScreenEditMenu::MenuLeft( const InputEventPlus & ) bool ScreenEditMenu::MenuLeft( const InputEventPlus & )
{ {
if( m_Selector.CanGoLeft() ) if( m_Selector.CanGoLeft() )
{ {
m_Selector.Left(); m_Selector.Left();
} }
return true;
} }
void ScreenEditMenu::MenuRight( const InputEventPlus & ) bool ScreenEditMenu::MenuRight( const InputEventPlus & )
{ {
if( m_Selector.CanGoRight() ) if( m_Selector.CanGoRight() )
{ {
m_Selector.Right(); m_Selector.Right();
} }
return true;
} }
static RString GetCopyDescription( const Steps *pSourceSteps ) static RString GetCopyDescription( const Steps *pSourceSteps )
@@ -158,16 +162,16 @@ static LocalizedString STEPS_WILL_BE_LOST ( "ScreenEditMenu", "These steps will
static LocalizedString CONTINUE_WITH_DELETE ( "ScreenEditMenu", "Continue with delete?" ); static LocalizedString CONTINUE_WITH_DELETE ( "ScreenEditMenu", "Continue with delete?" );
static LocalizedString ENTER_EDIT_DESCRIPTION ( "ScreenEditMenu", "Enter a description for this edit."); static LocalizedString ENTER_EDIT_DESCRIPTION ( "ScreenEditMenu", "Enter a description for this edit.");
void ScreenEditMenu::MenuStart( const InputEventPlus & ) bool ScreenEditMenu::MenuStart( const InputEventPlus & )
{ {
if( IsTransitioning() ) if( IsTransitioning() )
return; return false;
if( m_Selector.CanGoDown() ) if( m_Selector.CanGoDown() )
{ {
m_Selector.Down(); m_Selector.Down();
RefreshExplanationText(); RefreshExplanationText();
return; return true;
} }
Song* pSong = m_Selector.GetSelectedSong(); Song* pSong = m_Selector.GetSelectedSong();
@@ -188,7 +192,7 @@ void ScreenEditMenu::MenuStart( const InputEventPlus & )
if( !pSong->HasMusic() ) if( !pSong->HasMusic() )
{ {
ScreenPrompt::Prompt( SM_None, MISSING_MUSIC_FILE ); ScreenPrompt::Prompt( SM_None, MISSING_MUSIC_FILE );
return; return true;
} }
switch( m_Selector.EDIT_MODE ) switch( m_Selector.EDIT_MODE )
@@ -201,7 +205,7 @@ void ScreenEditMenu::MenuStart( const InputEventPlus & )
if( !file.Open( sTempFile, RageFile::WRITE ) ) if( !file.Open( sTempFile, RageFile::WRITE ) )
{ {
ScreenPrompt::Prompt( SM_None, SONG_DIR_READ_ONLY ); ScreenPrompt::Prompt( SM_None, SONG_DIR_READ_ONLY );
return; return true;
} }
file.Close(); file.Close();
@@ -221,7 +225,7 @@ void ScreenEditMenu::MenuStart( const InputEventPlus & )
{ {
SCREENMAN->PlayInvalidSound(); SCREENMAN->PlayInvalidSound();
SCREENMAN->SystemMessage( DELETED_AUTOGEN_STEPS.GetValue() ); SCREENMAN->SystemMessage( DELETED_AUTOGEN_STEPS.GetValue() );
return; return true;
} }
} }
default: break; default: break;
@@ -314,17 +318,18 @@ void ScreenEditMenu::MenuStart( const InputEventPlus & )
StartTransitioningScreen( SM_GoToNextScreen ); StartTransitioningScreen( SM_GoToNextScreen );
} }
} }
break; return true;
case EditMenuAction_Delete: case EditMenuAction_Delete:
break; return true;
default: default:
FAIL_M(ssprintf("Invalid edit menu action: %i", action)); FAIL_M(ssprintf("Invalid edit menu action: %i", action));
} }
} }
void ScreenEditMenu::MenuBack( const InputEventPlus &input ) bool ScreenEditMenu::MenuBack( const InputEventPlus &input )
{ {
Cancel( SM_GoToPrevScreen ); Cancel( SM_GoToPrevScreen );
return true;
} }
void ScreenEditMenu::RefreshExplanationText() void ScreenEditMenu::RefreshExplanationText()
+6 -6
View File
@@ -14,12 +14,12 @@ public:
private: private:
void MenuUp( const InputEventPlus &input ); bool MenuUp( const InputEventPlus &input );
void MenuDown( const InputEventPlus &input ); bool MenuDown( const InputEventPlus &input );
void MenuLeft( const InputEventPlus &input ); bool MenuLeft( const InputEventPlus &input );
void MenuRight( const InputEventPlus &input ); bool MenuRight( const InputEventPlus &input );
void MenuBack( const InputEventPlus &input ); bool MenuBack( const InputEventPlus &input );
void MenuStart( const InputEventPlus &input ); bool MenuStart( const InputEventPlus &input );
void RefreshExplanationText(); void RefreshExplanationText();
void RefreshNumStepsLoadedFromProfile(); void RefreshNumStepsLoadedFromProfile();
+4 -2
View File
@@ -109,20 +109,22 @@ void ScreenEnding::Init()
GAMESTATE->Reset(); GAMESTATE->Reset();
} }
void ScreenEnding::Input( const InputEventPlus &input ) bool ScreenEnding::Input( const InputEventPlus &input )
{ {
bool handled = false;
if( !IsTransitioning() ) if( !IsTransitioning() )
{ {
switch( input.MenuI ) switch( input.MenuI )
{ {
case GAME_BUTTON_START: case GAME_BUTTON_START:
SCREENMAN->PostMessageToTopScreen( SM_BeginFadingOut, 0 ); SCREENMAN->PostMessageToTopScreen( SM_BeginFadingOut, 0 );
handled = true;
default: default:
break; break;
} }
} }
ScreenAttract::Input( input ); return ScreenAttract::Input( input ) || handled;
} }
/* /*
+1 -1
View File
@@ -10,7 +10,7 @@ class ScreenEnding : public ScreenAttract
public: public:
ScreenEnding(); ScreenEnding();
virtual void Init(); virtual void Init();
virtual void Input( const InputEventPlus &input ); virtual bool Input( const InputEventPlus &input );
private: private:
Sprite m_sprRemoveMemoryCard[NUM_PLAYERS]; Sprite m_sprRemoveMemoryCard[NUM_PLAYERS];
+9 -8
View File
@@ -684,10 +684,10 @@ void ScreenEvaluation::Init()
} }
} }
void ScreenEvaluation::Input( const InputEventPlus &input ) bool ScreenEvaluation::Input( const InputEventPlus &input )
{ {
if( IsTransitioning() ) if( IsTransitioning() )
return; return false;
if( input.GameI.IsValid() ) if( input.GameI.IsValid() )
{ {
@@ -722,12 +722,12 @@ void ScreenEvaluation::Input( const InputEventPlus &input )
MEMCARDMAN->UnmountCard( pn ); MEMCARDMAN->UnmountCard( pn );
m_bSavedScreenshot[pn] = true; m_bSavedScreenshot[pn] = true;
return; // handled return true; // handled
} }
} }
} }
ScreenWithMenuElements::Input( input ); return ScreenWithMenuElements::Input( input );
} }
void ScreenEvaluation::HandleScreenMessage( const ScreenMessage SM ) void ScreenEvaluation::HandleScreenMessage( const ScreenMessage SM )
@@ -740,19 +740,20 @@ void ScreenEvaluation::HandleScreenMessage( const ScreenMessage SM )
ScreenWithMenuElements::HandleScreenMessage( SM ); ScreenWithMenuElements::HandleScreenMessage( SM );
} }
void ScreenEvaluation::MenuBack( const InputEventPlus &input ) bool ScreenEvaluation::MenuBack( const InputEventPlus &input )
{ {
MenuStart( input ); return MenuStart( input );
} }
void ScreenEvaluation::MenuStart( const InputEventPlus &input ) bool ScreenEvaluation::MenuStart( const InputEventPlus &input )
{ {
if( IsTransitioning() ) if( IsTransitioning() )
return; return false;
m_soundStart.Play(); m_soundStart.Play();
HandleMenuStart(); HandleMenuStart();
return true;
} }
void ScreenEvaluation::HandleMenuStart() void ScreenEvaluation::HandleMenuStart()
+3 -3
View File
@@ -50,11 +50,11 @@ class ScreenEvaluation : public ScreenWithMenuElements
{ {
public: public:
virtual void Init(); virtual void Init();
virtual void Input( const InputEventPlus &input ); virtual bool Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void HandleScreenMessage( const ScreenMessage SM );
virtual void MenuBack( const InputEventPlus &input ); virtual bool MenuBack( const InputEventPlus &input );
virtual void MenuStart( const InputEventPlus &input ); virtual bool MenuStart( const InputEventPlus &input );
virtual void PushSelf( lua_State *L ); virtual void PushSelf( lua_State *L );
StageStats *GetStageStats() { return m_pStageStats; } StageStats *GetStageStats() { return m_pStageStats; }
+17 -11
View File
@@ -2155,7 +2155,7 @@ void ScreenGameplay::AbortGiveUp( bool bShowText )
} }
void ScreenGameplay::Input( const InputEventPlus &input ) bool ScreenGameplay::Input( const InputEventPlus &input )
{ {
//LOG->Trace( "ScreenGameplay::Input()" ); //LOG->Trace( "ScreenGameplay::Input()" );
@@ -2171,10 +2171,14 @@ void ScreenGameplay::Input( const InputEventPlus &input )
if( m_PauseController == GameController_Invalid || m_PauseController == input.GameI.controller ) if( m_PauseController == GameController_Invalid || m_PauseController == input.GameI.controller )
{ {
// IMO, it's better to have this configurable. -DaisuMaster // IMO, it's better to have this configurable. -DaisuMaster
if( UNPAUSE_WITH_START ) this->PauseGame( false ); if( UNPAUSE_WITH_START )
{
this->PauseGame( false );
return true;
}
} }
} }
return; return false;
} }
if( m_DancingState != STATE_OUTRO && if( m_DancingState != STATE_OUTRO &&
@@ -2206,7 +2210,7 @@ void ScreenGameplay::Input( const InputEventPlus &input )
m_GiveUpTimer.Touch(); // start the timer m_GiveUpTimer.Touch(); // start the timer
} }
return; return true;
} }
/* Only handle GAME_BUTTON_BACK as a regular BACK button if BACK_GIVES_UP is /* Only handle GAME_BUTTON_BACK as a regular BACK button if BACK_GIVES_UP is
@@ -2236,13 +2240,13 @@ void ScreenGameplay::Input( const InputEventPlus &input )
m_textDebug.PlayCommand( "TweenOff" ); m_textDebug.PlayCommand( "TweenOff" );
} }
return; return true;
} }
} }
bool bRelease = input.type == IET_RELEASE; bool bRelease = input.type == IET_RELEASE;
if( !input.GameI.IsValid() ) if( !input.GameI.IsValid() )
return; return false;
int iCol = GAMESTATE->GetCurrentStyle()->GameInputToColumn( input.GameI ); int iCol = GAMESTATE->GetCurrentStyle()->GameInputToColumn( input.GameI );
@@ -2253,7 +2257,7 @@ void ScreenGameplay::Input( const InputEventPlus &input )
case IET_RELEASE: case IET_RELEASE:
break; break;
default: default:
return; return false;
} }
if( GAMESTATE->m_bMultiplayer ) if( GAMESTATE->m_bMultiplayer )
@@ -2265,6 +2269,7 @@ void ScreenGameplay::Input( const InputEventPlus &input )
if( input.mp == pi->m_mp ) if( input.mp == pi->m_mp )
pi->m_pPlayer->Step( iCol, -1, input.DeviceI.ts, false, bRelease ); pi->m_pPlayer->Step( iCol, -1, input.DeviceI.ts, false, bRelease );
} }
return true;
} }
} }
else else
@@ -2284,22 +2289,23 @@ void ScreenGameplay::Input( const InputEventPlus &input )
switch( gbt ) switch( gbt )
{ {
case GameButtonType_INVALID: case GameButtonType_INVALID:
break; return false;
case GameButtonType_Step: case GameButtonType_Step:
if( iCol != -1 ) if( iCol != -1 )
pi.m_pPlayer->Step( iCol, -1, input.DeviceI.ts, false, bRelease ); pi.m_pPlayer->Step( iCol, -1, input.DeviceI.ts, false, bRelease );
break; return true;
case GameButtonType_Fret: case GameButtonType_Fret:
if( iCol != -1 ) if( iCol != -1 )
pi.m_pPlayer->Fret( iCol, -1, input.DeviceI.ts, false, bRelease ); pi.m_pPlayer->Fret( iCol, -1, input.DeviceI.ts, false, bRelease );
break; return true;
case GameButtonType_Strum: case GameButtonType_Strum:
pi.m_pPlayer->Strum( iCol, -1, input.DeviceI.ts, false, bRelease ); pi.m_pPlayer->Strum( iCol, -1, input.DeviceI.ts, false, bRelease );
break; return true;
} }
} }
} }
} }
return false;
} }
+1 -1
View File
@@ -147,7 +147,7 @@ public:
virtual void BeginScreen(); virtual void BeginScreen();
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime );
virtual void Input( const InputEventPlus &input ); virtual bool Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void HandleScreenMessage( const ScreenMessage SM );
virtual void HandleMessage( const Message &msg ); virtual void HandleMessage( const Message &msg );
virtual void Cancel( ScreenMessage smSendWhenDone ); virtual void Cancel( ScreenMessage smSendWhenDone );
+10 -8
View File
@@ -63,19 +63,19 @@ void ScreenGameplayLesson::Init()
pi->GetPlayerState()->m_PlayerController = PC_AUTOPLAY; pi->GetPlayerState()->m_PlayerController = PC_AUTOPLAY;
} }
void ScreenGameplayLesson::Input( const InputEventPlus &input ) bool ScreenGameplayLesson::Input( const InputEventPlus &input )
{ {
//LOG->Trace( "ScreenGameplayLesson::Input()" ); //LOG->Trace( "ScreenGameplayLesson::Input()" );
if( m_iCurrentPageIndex != -1 ) if( m_iCurrentPageIndex != -1 )
{ {
// show a lesson page // show a lesson page
Screen::Input( input ); return Screen::Input( input );
} }
else else
{ {
// in the "your turn" section" // in the "your turn" section"
ScreenGameplay::Input( input ); return ScreenGameplay::Input( input );
} }
} }
@@ -126,25 +126,27 @@ void ScreenGameplayLesson::HandleScreenMessage( const ScreenMessage SM )
ScreenGameplay::HandleScreenMessage( SM ); ScreenGameplay::HandleScreenMessage( SM );
} }
void ScreenGameplayLesson::MenuStart( const InputEventPlus &input ) bool ScreenGameplayLesson::MenuStart( const InputEventPlus &input )
{ {
// XXX: Allow repeats? // XXX: Allow repeats?
if( m_iCurrentPageIndex == -1 ) if( m_iCurrentPageIndex == -1 )
return; return false;
ChangeLessonPage( +1 ); ChangeLessonPage( +1 );
return true;
} }
void ScreenGameplayLesson::MenuBack( const InputEventPlus &input ) bool ScreenGameplayLesson::MenuBack( const InputEventPlus &input )
{ {
// XXX: Allow repeats? // XXX: Allow repeats?
if( m_iCurrentPageIndex == 0 ) if( m_iCurrentPageIndex == 0 )
{ {
BeginBackingOutFromGameplay(); BeginBackingOutFromGameplay();
return; return true;
} }
if( m_iCurrentPageIndex == -1 ) if( m_iCurrentPageIndex == -1 )
return; return false;
ChangeLessonPage( -1 ); ChangeLessonPage( -1 );
return true;
} }
void ScreenGameplayLesson::ChangeLessonPage( int iDir ) void ScreenGameplayLesson::ChangeLessonPage( int iDir )
+3 -3
View File
@@ -11,11 +11,11 @@ public:
ScreenGameplayLesson(); ScreenGameplayLesson();
virtual void Init(); virtual void Init();
virtual void Input( const InputEventPlus &input ); virtual bool Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void HandleScreenMessage( const ScreenMessage SM );
virtual void MenuStart( const InputEventPlus &input ); virtual bool MenuStart( const InputEventPlus &input );
virtual void MenuBack( const InputEventPlus &input ); virtual bool MenuBack( const InputEventPlus &input );
protected: protected:
void ChangeLessonPage( int iDir ); void ChangeLessonPage( int iDir );
+2 -2
View File
@@ -67,7 +67,7 @@ void ScreenGameplaySyncMachine::Update( float fDelta )
RefreshText(); RefreshText();
} }
void ScreenGameplaySyncMachine::Input( const InputEventPlus &input ) bool ScreenGameplaySyncMachine::Input( const InputEventPlus &input )
{ {
// Hack to make this work from Player2's controls // Hack to make this work from Player2's controls
InputEventPlus _input = input; InputEventPlus _input = input;
@@ -77,7 +77,7 @@ void ScreenGameplaySyncMachine::Input( const InputEventPlus &input )
if( _input.pn != PLAYER_INVALID ) if( _input.pn != PLAYER_INVALID )
_input.pn = PLAYER_1; _input.pn = PLAYER_1;
ScreenGameplay::Input( _input ); return ScreenGameplay::Input( _input );
} }
void ScreenGameplaySyncMachine::HandleScreenMessage( const ScreenMessage SM ) void ScreenGameplaySyncMachine::HandleScreenMessage( const ScreenMessage SM )
+1 -1
View File
@@ -10,7 +10,7 @@ public:
virtual void Init(); virtual void Init();
virtual void Update( float fDelta ); virtual void Update( float fDelta );
virtual void Input( const InputEventPlus &input ); virtual bool Input( const InputEventPlus &input );
virtual ScreenType GetScreenType() const { return system_menu; } virtual ScreenType GetScreenType() const { return system_menu; }
+10 -8
View File
@@ -273,17 +273,17 @@ void ScreenHighScores::BeginScreen()
} }
} }
void ScreenHighScores::Input( const InputEventPlus &input ) bool ScreenHighScores::Input( const InputEventPlus &input )
{ {
//LOG->Trace( "ScreenRanking::Input()" ); //LOG->Trace( "ScreenRanking::Input()" );
if( IsTransitioning() ) if( IsTransitioning() )
return; return false;
// If manually scrolling, pass the input to Screen::Input so it will call Menu* // If manually scrolling, pass the input to Screen::Input so it will call Menu*
if( (bool)MANUAL_SCROLLING ) if( (bool)MANUAL_SCROLLING )
Screen::Input( input ); return Screen::Input( input );
else else
ScreenAttract::Input( input ); return ScreenAttract::Input( input );
} }
void ScreenHighScores::HandleScreenMessage( const ScreenMessage SM ) void ScreenHighScores::HandleScreenMessage( const ScreenMessage SM )
@@ -296,22 +296,24 @@ void ScreenHighScores::HandleScreenMessage( const ScreenMessage SM )
ScreenAttract::HandleScreenMessage( SM ); ScreenAttract::HandleScreenMessage( SM );
} }
void ScreenHighScores::MenuStart( const InputEventPlus &input ) bool ScreenHighScores::MenuStart( const InputEventPlus &input )
{ {
if( !MANUAL_SCROLLING ) if( !MANUAL_SCROLLING )
return; return false;
if( !IsTransitioning() ) if( !IsTransitioning() )
StartTransitioningScreen( SM_GoToNextScreen ); StartTransitioningScreen( SM_GoToNextScreen );
SCREENMAN->PlayStartSound(); SCREENMAN->PlayStartSound();
return true;
} }
void ScreenHighScores::MenuBack( const InputEventPlus &input ) bool ScreenHighScores::MenuBack( const InputEventPlus &input )
{ {
if( !MANUAL_SCROLLING ) if( !MANUAL_SCROLLING )
return; return false;
if( !IsTransitioning() ) if( !IsTransitioning() )
StartTransitioningScreen( SM_GoToNextScreen ); StartTransitioningScreen( SM_GoToNextScreen );
SCREENMAN->PlayStartSound(); SCREENMAN->PlayStartSound();
return true;
} }
void ScreenHighScores::DoScroll( int iDir ) void ScreenHighScores::DoScroll( int iDir )
+7 -7
View File
@@ -55,13 +55,13 @@ public:
virtual void BeginScreen(); virtual void BeginScreen();
void HandleScreenMessage( const ScreenMessage SM ); void HandleScreenMessage( const ScreenMessage SM );
virtual void Input( const InputEventPlus &input ); virtual bool Input( const InputEventPlus &input );
virtual void MenuStart( const InputEventPlus &input ); virtual bool MenuStart( const InputEventPlus &input );
virtual void MenuBack( const InputEventPlus &input ); virtual bool MenuBack( const InputEventPlus &input );
virtual void MenuLeft( const InputEventPlus &input ) { DoScroll(-1); } virtual bool MenuLeft( const InputEventPlus &input ) { DoScroll(-1); return true; }
virtual void MenuRight( const InputEventPlus &input ) { DoScroll(+1); } virtual bool MenuRight( const InputEventPlus &input ) { DoScroll(+1); return true; }
virtual void MenuUp( const InputEventPlus &input ) { DoScroll(-1); } virtual bool MenuUp( const InputEventPlus &input ) { DoScroll(-1); return true; }
virtual void MenuDown( const InputEventPlus &input ) { DoScroll(+1); } virtual bool MenuDown( const InputEventPlus &input ) { DoScroll(+1); return true; }
private: private:
void DoScroll( int iDir ); void DoScroll( int iDir );
+7 -5
View File
@@ -4,23 +4,25 @@
REGISTER_SCREEN_CLASS( ScreenInstructions ); REGISTER_SCREEN_CLASS( ScreenInstructions );
void ScreenInstructions::Input( const InputEventPlus &input ) bool ScreenInstructions::Input( const InputEventPlus &input )
{ {
if( IsTransitioning() ) if( IsTransitioning() )
return; return false;
// default input handler // default input handler
Screen::Input( input ); return Screen::Input( input );
} }
void ScreenInstructions::MenuBack( const InputEventPlus &input ) bool ScreenInstructions::MenuBack( const InputEventPlus &input )
{ {
Cancel( SM_GoToPrevScreen ); Cancel( SM_GoToPrevScreen );
return true;
} }
void ScreenInstructions::MenuStart( const InputEventPlus &input ) bool ScreenInstructions::MenuStart( const InputEventPlus &input )
{ {
StartTransitioningScreen( SM_GoToNextScreen ); StartTransitioningScreen( SM_GoToNextScreen );
return true;
} }
/* /*
+3 -3
View File
@@ -6,10 +6,10 @@
class ScreenInstructions : public ScreenWithMenuElements class ScreenInstructions : public ScreenWithMenuElements
{ {
public: public:
virtual void Input( const InputEventPlus &input ); virtual bool Input( const InputEventPlus &input );
virtual void MenuBack( const InputEventPlus &input ); virtual bool MenuBack( const InputEventPlus &input );
virtual void MenuStart( const InputEventPlus &input ); virtual bool MenuStart( const InputEventPlus &input );
}; };
+4 -4
View File
@@ -239,24 +239,24 @@ void ScreenJukebox::Init()
m_DancingState = STATE_DANCING; m_DancingState = STATE_DANCING;
} }
void ScreenJukebox::Input( const InputEventPlus &input ) bool ScreenJukebox::Input( const InputEventPlus &input )
{ {
//LOG->Trace( "ScreenJukebox::Input()" ); //LOG->Trace( "ScreenJukebox::Input()" );
if( input.type != IET_FIRST_PRESS ) if( input.type != IET_FIRST_PRESS )
return; // ignore return false; // ignore
switch( input.MenuI ) switch( input.MenuI )
{ {
case GAME_BUTTON_LEFT: case GAME_BUTTON_LEFT:
case GAME_BUTTON_RIGHT: case GAME_BUTTON_RIGHT:
SCREENMAN->PostMessageToTopScreen( SM_NotesEnded, 0 ); SCREENMAN->PostMessageToTopScreen( SM_NotesEnded, 0 );
return; return true;
default: default:
break; break;
} }
ScreenAttract::AttractInput( input, this ); return ScreenAttract::AttractInput( input, this );
} }
void ScreenJukebox::HandleScreenMessage( const ScreenMessage SM ) void ScreenJukebox::HandleScreenMessage( const ScreenMessage SM )
+1 -1
View File
@@ -11,7 +11,7 @@ public:
ScreenJukebox(); ScreenJukebox();
virtual void Init(); virtual void Init();
virtual void Input( const InputEventPlus &input ); virtual bool Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void HandleScreenMessage( const ScreenMessage SM );
void SetSong(); void SetSong();
+15 -6
View File
@@ -228,20 +228,21 @@ static bool IsAxis( const DeviceInput& DeviceI )
return false; return false;
} }
void ScreenMapControllers::Input( const InputEventPlus &input ) bool ScreenMapControllers::Input( const InputEventPlus &input )
{ {
if( m_fLockInputSecs > 0 ) if( m_fLockInputSecs > 0 )
return; return false;
if( input.type != IET_FIRST_PRESS && input.type != IET_REPEAT ) if( input.type != IET_FIRST_PRESS && input.type != IET_REPEAT )
return; // ignore return false; // ignore
if( IsTransitioning() ) if( IsTransitioning() )
return; // ignore return false; // ignore
LOG->Trace( "ScreenMapControllers::Input(): device: %d, button: %d", LOG->Trace( "ScreenMapControllers::Input(): device: %d, button: %d",
input.DeviceI.device, input.DeviceI.button ); input.DeviceI.device, input.DeviceI.button );
int button = input.DeviceI.button; int button = input.DeviceI.button;
bool bHandled = false;
/* TRICKY: Some adapters map the PlayStation digital d-pad to both axes and /* TRICKY: Some adapters map the PlayStation digital d-pad to both axes and
* buttons. We want buttons to be used for any mappings where possible * buttons. We want buttons to be used for any mappings where possible
@@ -253,7 +254,7 @@ void ScreenMapControllers::Input( const InputEventPlus &input )
if( !m_WaitingForPress.IsZero() ) if( !m_WaitingForPress.IsZero() )
{ {
if( input.type != IET_FIRST_PRESS ) if( input.type != IET_FIRST_PRESS )
return; return false;
// Don't allow function keys to be mapped. // Don't allow function keys to be mapped.
if( input.DeviceI.device == DEVICE_KEYBOARD && (input.DeviceI.button >= KEY_F1 && input.DeviceI.button <= KEY_F12) ) if( input.DeviceI.device == DEVICE_KEYBOARD && (input.DeviceI.button >= KEY_F1 && input.DeviceI.button <= KEY_F12) )
@@ -268,7 +269,7 @@ void ScreenMapControllers::Input( const InputEventPlus &input )
IsAxis(input.DeviceI) ) IsAxis(input.DeviceI) )
{ {
LOG->Trace("Ignored input; non-axis event already received"); LOG->Trace("Ignored input; non-axis event already received");
return; // ignore this press return false; // ignore this press
} }
m_DeviceIToMap = input.DeviceI; m_DeviceIToMap = input.DeviceI;
@@ -304,6 +305,7 @@ void ScreenMapControllers::Input( const InputEventPlus &input )
// commit to disk after each change // commit to disk after each change
INPUTMAPPER->SaveMappingsToDisk(); INPUTMAPPER->SaveMappingsToDisk();
bHandled = true;
} }
break; break;
case KEY_LEFT: // Move the selection left, wrapping up. case KEY_LEFT: // Move the selection left, wrapping up.
@@ -320,6 +322,7 @@ void ScreenMapControllers::Input( const InputEventPlus &input )
} }
AfterChangeFocus(); AfterChangeFocus();
m_soundChange.Play(); m_soundChange.Play();
bHandled = true;
break; break;
case KEY_RIGHT: // Move the selection right, wrapping down. case KEY_RIGHT: // Move the selection right, wrapping down.
if( m_iCurButton == (int) m_KeysToMap.size() ) if( m_iCurButton == (int) m_KeysToMap.size() )
@@ -335,6 +338,7 @@ void ScreenMapControllers::Input( const InputEventPlus &input )
} }
AfterChangeFocus(); AfterChangeFocus();
m_soundChange.Play(); m_soundChange.Play();
bHandled = true;
break; break;
case KEY_UP: // Move the selection up. case KEY_UP: // Move the selection up.
if( m_iCurButton == 0 ) if( m_iCurButton == 0 )
@@ -343,6 +347,7 @@ void ScreenMapControllers::Input( const InputEventPlus &input )
m_iCurButton--; m_iCurButton--;
AfterChangeFocus(); AfterChangeFocus();
m_soundChange.Play(); m_soundChange.Play();
bHandled = true;
break; break;
case KEY_DOWN: // Move the selection down. case KEY_DOWN: // Move the selection down.
if( m_iCurButton == (int) m_KeysToMap.size() ) if( m_iCurButton == (int) m_KeysToMap.size() )
@@ -351,10 +356,12 @@ void ScreenMapControllers::Input( const InputEventPlus &input )
m_iCurButton++; m_iCurButton++;
AfterChangeFocus(); AfterChangeFocus();
m_soundChange.Play(); m_soundChange.Play();
bHandled = true;
break; break;
case KEY_ESC: // Quit the screen. case KEY_ESC: // Quit the screen.
SCREENMAN->PlayStartSound(); SCREENMAN->PlayStartSound();
StartTransitioningScreen( SM_GoToNextScreen ); StartTransitioningScreen( SM_GoToNextScreen );
bHandled = true;
break; break;
case KEY_ENTER: // Change the selection. case KEY_ENTER: // Change the selection.
case KEY_KP_ENTER: case KEY_KP_ENTER:
@@ -373,6 +380,7 @@ void ScreenMapControllers::Input( const InputEventPlus &input )
m_WaitingForPress.Touch(); m_WaitingForPress.Touch();
m_DeviceIToMap.MakeInvalid(); m_DeviceIToMap.MakeInvalid();
SCREENMAN->PlayStartSound(); SCREENMAN->PlayStartSound();
bHandled = true;
break; break;
} }
} }
@@ -382,6 +390,7 @@ void ScreenMapControllers::Input( const InputEventPlus &input )
LOG->Trace( "m_iCurSlot: %d m_iCurController: %d m_iCurButton: %d", m_iCurSlot, m_iCurController, m_iCurButton ); LOG->Trace( "m_iCurSlot: %d m_iCurController: %d m_iCurButton: %d", m_iCurSlot, m_iCurController, m_iCurButton );
Refresh(); Refresh();
return bHandled;
} }
Actor *ScreenMapControllers::GetActorWithFocus() Actor *ScreenMapControllers::GetActorWithFocus()
+1 -1
View File
@@ -17,7 +17,7 @@ public:
virtual void BeginScreen(); virtual void BeginScreen();
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime );
virtual void Input( const InputEventPlus &input ); virtual bool Input( const InputEventPlus &input );
private: private:
virtual void HandleMessage( const Message &msg ); virtual void HandleMessage( const Message &msg );
+4 -4
View File
@@ -37,11 +37,11 @@ public:
//virtual void EndScreen(); //virtual void EndScreen();
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime );
virtual void Input( const InputEventPlus &input ); virtual bool Input( const InputEventPlus &input );
virtual void MenuUp( const InputEventPlus &input ); virtual bool MenuUp( const InputEventPlus &input );
virtual void MenuDown( const InputEventPlus &input ); virtual bool MenuDown( const InputEventPlus &input );
virtual void MenuStart( const InputEventPlus &input ); virtual bool MenuStart( const InputEventPlus &input );
virtual void TweenOnScreen(); virtual void TweenOnScreen();
MapControlsState GetMapControlsState(){ return m_MapControlsState; } MapControlsState GetMapControlsState(){ return m_MapControlsState; }
+9 -6
View File
@@ -330,15 +330,16 @@ void ScreenNameEntry::Update( float fDelta )
ScreenWithMenuElements::Update(fDelta); ScreenWithMenuElements::Update(fDelta);
} }
void ScreenNameEntry::Input( const InputEventPlus &input ) bool ScreenNameEntry::Input( const InputEventPlus &input )
{ {
if( IsTransitioning() ) if( IsTransitioning() )
return; return false;
if( input.type != IET_FIRST_PRESS || !input.GameI.IsValid() ) if( input.type != IET_FIRST_PRESS || !input.GameI.IsValid() )
return; // ignore return false; // ignore
const int iCol = GAMESTATE->GetCurrentStyle()->GameInputToColumn( input.GameI ); const int iCol = GAMESTATE->GetCurrentStyle()->GameInputToColumn( input.GameI );
bool bHandled = false;
if( iCol != Column_Invalid && m_bStillEnteringName[input.pn] ) if( iCol != Column_Invalid && m_bStillEnteringName[input.pn] )
{ {
int iStringIndex = m_ColToStringIndex[input.pn][iCol]; int iStringIndex = m_ColToStringIndex[input.pn][iCol];
@@ -350,9 +351,10 @@ void ScreenNameEntry::Input( const InputEventPlus &input )
m_textSelectedChars[input.pn][iCol].SetText( RString(1, c) ); m_textSelectedChars[input.pn][iCol].SetText( RString(1, c) );
m_sSelectedName[input.pn][iStringIndex] = c; m_sSelectedName[input.pn][iStringIndex] = c;
} }
bHandled = true;
} }
ScreenWithMenuElements::Input( input ); return ScreenWithMenuElements::Input( input ) || bHandled;
} }
void ScreenNameEntry::HandleScreenMessage( const ScreenMessage SM ) void ScreenNameEntry::HandleScreenMessage( const ScreenMessage SM )
@@ -374,12 +376,12 @@ void ScreenNameEntry::HandleScreenMessage( const ScreenMessage SM )
} }
void ScreenNameEntry::MenuStart( const InputEventPlus &input ) bool ScreenNameEntry::MenuStart( const InputEventPlus &input )
{ {
PlayerNumber pn = input.pn; PlayerNumber pn = input.pn;
if( !m_bStillEnteringName[pn] ) if( !m_bStillEnteringName[pn] )
return; return false;
m_bStillEnteringName[pn] = false; m_bStillEnteringName[pn] = false;
m_Text[pn].SetDone(); m_Text[pn].SetDone();
@@ -395,6 +397,7 @@ void ScreenNameEntry::MenuStart( const InputEventPlus &input )
if( !AnyStillEntering() && !m_Out.IsTransitioning() ) if( !AnyStillEntering() && !m_Out.IsTransitioning() )
StartTransitioningScreen( SM_GoToNextScreen ); StartTransitioningScreen( SM_GoToNextScreen );
return true;
} }
/* /*
+2 -2
View File
@@ -13,10 +13,10 @@ public:
ScreenNameEntry(); ScreenNameEntry();
virtual void Init(); virtual void Init();
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime );
virtual void Input( const InputEventPlus &input ); virtual bool Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void HandleScreenMessage( const ScreenMessage SM );
virtual void MenuStart( const InputEventPlus &input ); virtual bool MenuStart( const InputEventPlus &input );
private: private:
class ScrollingText : public Actor class ScrollingText : public Actor
{ {
+3 -3
View File
@@ -139,12 +139,12 @@ bool ScreenNameEntryTraditional::AnyEntering() const
return false; return false;
} }
void ScreenNameEntryTraditional::Input( const InputEventPlus &input ) bool ScreenNameEntryTraditional::Input( const InputEventPlus &input )
{ {
if( IsTransitioning() ) if( IsTransitioning() )
return; return false;
ScreenWithMenuElements::Input( input ); return ScreenWithMenuElements::Input( input );
} }
bool ScreenNameEntryTraditional::Finish( PlayerNumber pn ) bool ScreenNameEntryTraditional::Finish( PlayerNumber pn )
+1 -1
View File
@@ -13,7 +13,7 @@ public:
virtual void BeginScreen(); virtual void BeginScreen();
virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void HandleScreenMessage( const ScreenMessage SM );
virtual void Input( const InputEventPlus &input ); virtual bool Input( const InputEventPlus &input );
bool EnterKey( PlayerNumber pn, wchar_t sLetter ); bool EnterKey( PlayerNumber pn, wchar_t sLetter );
bool Backspace( PlayerNumber pn ); bool Backspace( PlayerNumber pn );
+10 -8
View File
@@ -88,36 +88,38 @@ void ScreenNetEvaluation::RedoUserTexts()
} }
} }
void ScreenNetEvaluation::MenuLeft( const InputEventPlus &input ) bool ScreenNetEvaluation::MenuLeft( const InputEventPlus &input )
{ {
MenuUp( input ); return MenuUp( input );
} }
void ScreenNetEvaluation::MenuUp( const InputEventPlus &input ) bool ScreenNetEvaluation::MenuUp( const InputEventPlus &input )
{ {
if( m_iActivePlayers == 0 || !m_bHasStats ) if( m_iActivePlayers == 0 || !m_bHasStats )
return; return false;
COMMAND( m_textUsers[m_iCurrentPlayer], "DeSel" ); COMMAND( m_textUsers[m_iCurrentPlayer], "DeSel" );
m_iCurrentPlayer = (m_iCurrentPlayer + m_iActivePlayers - 1) % m_iActivePlayers; m_iCurrentPlayer = (m_iCurrentPlayer + m_iActivePlayers - 1) % m_iActivePlayers;
COMMAND( m_textUsers[m_iCurrentPlayer], "Sel" ); COMMAND( m_textUsers[m_iCurrentPlayer], "Sel" );
UpdateStats(); UpdateStats();
return true;
} }
void ScreenNetEvaluation::MenuRight( const InputEventPlus &input ) bool ScreenNetEvaluation::MenuRight( const InputEventPlus &input )
{ {
MenuDown( input ); return MenuDown( input );
} }
void ScreenNetEvaluation::MenuDown( const InputEventPlus &input ) bool ScreenNetEvaluation::MenuDown( const InputEventPlus &input )
{ {
if ( m_iActivePlayers == 0 || !m_bHasStats ) if ( m_iActivePlayers == 0 || !m_bHasStats )
return; return false;
COMMAND( m_textUsers[m_iCurrentPlayer], "DeSel" ); COMMAND( m_textUsers[m_iCurrentPlayer], "DeSel" );
m_iCurrentPlayer = (m_iCurrentPlayer + 1) % m_iActivePlayers; m_iCurrentPlayer = (m_iCurrentPlayer + 1) % m_iActivePlayers;
COMMAND( m_textUsers[m_iCurrentPlayer], "Sel" ); COMMAND( m_textUsers[m_iCurrentPlayer], "Sel" );
UpdateStats(); UpdateStats();
return true;
} }
void ScreenNetEvaluation::HandleScreenMessage( const ScreenMessage SM ) void ScreenNetEvaluation::HandleScreenMessage( const ScreenMessage SM )
+4 -4
View File
@@ -18,10 +18,10 @@ public:
virtual void PushSelf( lua_State *L ); virtual void PushSelf( lua_State *L );
protected: protected:
virtual void MenuLeft( const InputEventPlus &input ); virtual bool MenuLeft( const InputEventPlus &input );
virtual void MenuUp( const InputEventPlus &input ); virtual bool MenuUp( const InputEventPlus &input );
virtual void MenuRight( const InputEventPlus &input ); virtual bool MenuRight( const InputEventPlus &input );
virtual void MenuDown( const InputEventPlus &input ); virtual bool MenuDown( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void HandleScreenMessage( const ScreenMessage SM );
virtual void TweenOffScreen( ); virtual void TweenOffScreen( );
+18 -8
View File
@@ -52,12 +52,12 @@ void ScreenNetRoom::Init()
NSMAN->ReportNSSOnOff( 7 ); NSMAN->ReportNSSOnOff( 7 );
} }
void ScreenNetRoom::Input( const InputEventPlus &input ) bool ScreenNetRoom::Input( const InputEventPlus &input )
{ {
if( (input.MenuI == GAME_BUTTON_LEFT || input.MenuI == GAME_BUTTON_RIGHT) && input.type == IET_RELEASE ) if( (input.MenuI == GAME_BUTTON_LEFT || input.MenuI == GAME_BUTTON_RIGHT) && input.type == IET_RELEASE )
m_RoomWheel.Move( 0 ); m_RoomWheel.Move( 0 );
ScreenNetSelectBase::Input( input ); return ScreenNetSelectBase::Input( input );
} }
void ScreenNetRoom::HandleScreenMessage( const ScreenMessage SM ) void ScreenNetRoom::HandleScreenMessage( const ScreenMessage SM )
@@ -191,7 +191,7 @@ void ScreenNetRoom::TweenOffScreen()
NSMAN->ReportNSSOnOff( 6 ); NSMAN->ReportNSSOnOff( 6 );
} }
void ScreenNetRoom::MenuStart( const InputEventPlus &input ) bool ScreenNetRoom::MenuStart( const InputEventPlus &input )
{ {
m_RoomWheel.Select(); m_RoomWheel.Select();
RoomWheelItemData* rwd = dynamic_cast<RoomWheelItemData*>( m_RoomWheel.LastSelected() ); RoomWheelItemData* rwd = dynamic_cast<RoomWheelItemData*>( m_RoomWheel.LastSelected() );
@@ -212,31 +212,41 @@ void ScreenNetRoom::MenuStart( const InputEventPlus &input )
} }
} }
ScreenNetSelectBase::MenuStart( input ); ScreenNetSelectBase::MenuStart( input );
return true;
} }
void ScreenNetRoom::MenuBack( const InputEventPlus &input ) bool ScreenNetRoom::MenuBack( const InputEventPlus &input )
{ {
TweenOffScreen(); TweenOffScreen();
Cancel( SM_GoToPrevScreen ); Cancel( SM_GoToPrevScreen );
ScreenNetSelectBase::MenuBack( input ); ScreenNetSelectBase::MenuBack( input );
return true;
} }
void ScreenNetRoom::MenuLeft( const InputEventPlus &input ) bool ScreenNetRoom::MenuLeft( const InputEventPlus &input )
{ {
bool bHandled = false;
if( input.type == IET_FIRST_PRESS ) if( input.type == IET_FIRST_PRESS )
{
m_RoomWheel.Move( -1 ); m_RoomWheel.Move( -1 );
bHandled = true;
}
ScreenNetSelectBase::MenuLeft( input ); return ScreenNetSelectBase::MenuLeft( input ) || bHandled;
} }
void ScreenNetRoom::MenuRight( const InputEventPlus &input ) bool ScreenNetRoom::MenuRight( const InputEventPlus &input )
{ {
bool bHandled = false;
if( input.type == IET_FIRST_PRESS ) if( input.type == IET_FIRST_PRESS )
{
m_RoomWheel.Move( 1 ); m_RoomWheel.Move( 1 );
bHandled = true;
}
ScreenNetSelectBase::MenuRight( input ); return ScreenNetSelectBase::MenuRight( input ) || bHandled;
} }
void ScreenNetRoom::UpdateRoomsList() void ScreenNetRoom::UpdateRoomsList()
+5 -5
View File
@@ -30,19 +30,19 @@ class ScreenNetRoom : public ScreenNetSelectBase
{ {
public: public:
virtual void Init(); virtual void Init();
virtual void Input( const InputEventPlus &input ); virtual bool Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void HandleScreenMessage( const ScreenMessage SM );
protected: protected:
virtual void MenuStart( const InputEventPlus &input ); virtual bool MenuStart( const InputEventPlus &input );
virtual void MenuBack( const InputEventPlus &input ); virtual bool MenuBack( const InputEventPlus &input );
virtual void TweenOffScreen( ); virtual void TweenOffScreen( );
private: private:
void UpdateRoomsList(); void UpdateRoomsList();
void MenuLeft( const InputEventPlus &input ); bool MenuLeft( const InputEventPlus &input );
void MenuRight( const InputEventPlus &input ); bool MenuRight( const InputEventPlus &input );
void CreateNewRoom( const RString& rName, const RString& rDesc, const RString& rPass ); void CreateNewRoom( const RString& rName, const RString& rDesc, const RString& rPass );
RageSound m_soundChangeSel; RageSound m_soundChangeSel;
+6 -6
View File
@@ -68,13 +68,13 @@ void ScreenNetSelectBase::Init()
return; return;
} }
void ScreenNetSelectBase::Input( const InputEventPlus &input ) bool ScreenNetSelectBase::Input( const InputEventPlus &input )
{ {
if( m_In.IsTransitioning() || m_Out.IsTransitioning() ) if( m_In.IsTransitioning() || m_Out.IsTransitioning() )
return; return false;
if( input.type != IET_FIRST_PRESS && input.type != IET_REPEAT ) if( input.type != IET_FIRST_PRESS && input.type != IET_REPEAT )
return; return false;
bool bHoldingCtrl = bool bHoldingCtrl =
INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_LCTRL)) || INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_LCTRL)) ||
@@ -91,7 +91,7 @@ void ScreenNetSelectBase::Input( const InputEventPlus &input )
NSMAN->SendChat( m_sTextInput ); NSMAN->SendChat( m_sTextInput );
m_sTextInput=""; m_sTextInput="";
UpdateTextInput(); UpdateTextInput();
return; return true;
} }
break; break;
case KEY_BACK: case KEY_BACK:
@@ -116,10 +116,10 @@ void ScreenNetSelectBase::Input( const InputEventPlus &input )
break; break;
if( c >= ' ' ) if( c >= ' ' )
return; return true;
break; break;
} }
Screen::Input( input ); return Screen::Input( input );
} }
void ScreenNetSelectBase::HandleScreenMessage( const ScreenMessage SM ) void ScreenNetSelectBase::HandleScreenMessage( const ScreenMessage SM )
+1 -1
View File
@@ -33,7 +33,7 @@ class ScreenNetSelectBase : public ScreenWithMenuElements
public: public:
virtual void Init(); virtual void Init();
void Input( const InputEventPlus &input ); bool Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void HandleScreenMessage( const ScreenMessage SM );
virtual void TweenOffScreen(); virtual void TweenOffScreen();
+23 -15
View File
@@ -90,19 +90,19 @@ void ScreenNetSelectMusic::Init()
m_bAllowInput = false; m_bAllowInput = false;
} }
void ScreenNetSelectMusic::Input( const InputEventPlus &input ) bool ScreenNetSelectMusic::Input( const InputEventPlus &input )
{ {
if( !m_bAllowInput || IsTransitioning() ) if( !m_bAllowInput || IsTransitioning() )
return; return false;
if( input.type == IET_RELEASE ) if( input.type == IET_RELEASE )
{ {
m_MusicWheel.Move(0); m_MusicWheel.Move(0);
return; return true;
} }
if( input.type != IET_FIRST_PRESS && input.type != IET_REPEAT ) if( input.type != IET_FIRST_PRESS && input.type != IET_REPEAT )
return; return false;
bool bHoldingCtrl = bool bHoldingCtrl =
INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_LCTRL)) || INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_LCTRL)) ||
@@ -113,6 +113,7 @@ void ScreenNetSelectMusic::Input( const InputEventPlus &input )
MakeUpper( &c, 1 ); MakeUpper( &c, 1 );
// Ctrl+[A-Z] to go to that letter of the alphabet // Ctrl+[A-Z] to go to that letter of the alphabet
bool handled = false;
if( bHoldingCtrl && ( c >= 'A' ) && ( c <= 'Z' ) ) if( bHoldingCtrl && ( c >= 'A' ) && ( c <= 'Z' ) )
{ {
SortOrder so = GAMESTATE->m_SortOrder; SortOrder so = GAMESTATE->m_SortOrder;
@@ -130,9 +131,10 @@ void ScreenNetSelectMusic::Input( const InputEventPlus &input )
m_MusicWheel.ChangeSort( so ); m_MusicWheel.ChangeSort( so );
m_MusicWheel.SetOpenSection( ssprintf("%c", c ) ); m_MusicWheel.SetOpenSection( ssprintf("%c", c ) );
m_MusicWheel.Move(+1); m_MusicWheel.Move(+1);
handled = true;
} }
ScreenNetSelectBase::Input( input ); return ScreenNetSelectBase::Input( input ) || handled;
} }
void ScreenNetSelectMusic::HandleScreenMessage( const ScreenMessage SM ) void ScreenNetSelectMusic::HandleScreenMessage( const ScreenMessage SM )
@@ -301,7 +303,7 @@ bool ScreenNetSelectMusic::LeftAndRightPressed( const PlayerNumber pn )
&& INPUTMAPPER->IsBeingPressed( GAME_BUTTON_RIGHT, pn ); && INPUTMAPPER->IsBeingPressed( GAME_BUTTON_RIGHT, pn );
} }
void ScreenNetSelectMusic::MenuLeft( const InputEventPlus &input ) bool ScreenNetSelectMusic::MenuLeft( const InputEventPlus &input )
{ {
PlayerNumber pn = input.pn; PlayerNumber pn = input.pn;
@@ -309,9 +311,10 @@ void ScreenNetSelectMusic::MenuLeft( const InputEventPlus &input )
m_MusicWheel.ChangeSort( SORT_MODE_MENU ); m_MusicWheel.ChangeSort( SORT_MODE_MENU );
else else
m_MusicWheel.Move( -1 ); m_MusicWheel.Move( -1 );
return true;
} }
void ScreenNetSelectMusic::MenuRight( const InputEventPlus &input ) bool ScreenNetSelectMusic::MenuRight( const InputEventPlus &input )
{ {
PlayerNumber pn = input.pn; PlayerNumber pn = input.pn;
@@ -319,16 +322,18 @@ void ScreenNetSelectMusic::MenuRight( const InputEventPlus &input )
m_MusicWheel.ChangeSort( SORT_MODE_MENU ); m_MusicWheel.ChangeSort( SORT_MODE_MENU );
else else
m_MusicWheel.Move( +1 ); m_MusicWheel.Move( +1 );
return true;
} }
void ScreenNetSelectMusic::MenuUp( const InputEventPlus &input ) bool ScreenNetSelectMusic::MenuUp( const InputEventPlus &input )
{ {
NSMAN->ReportNSSOnOff(3); NSMAN->ReportNSSOnOff(3);
GAMESTATE->m_EditMode = EditMode_Full; GAMESTATE->m_EditMode = EditMode_Full;
SCREENMAN->AddNewScreenToTop( PLAYER_OPTIONS_SCREEN, SM_BackFromPlayerOptions ); SCREENMAN->AddNewScreenToTop( PLAYER_OPTIONS_SCREEN, SM_BackFromPlayerOptions );
return true;
} }
void ScreenNetSelectMusic::MenuDown( const InputEventPlus &input ) bool ScreenNetSelectMusic::MenuDown( const InputEventPlus &input )
{ {
/* Tricky: If we have a player on player 2, and there is only player 2, /* 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. */ * allow them to use player 1's controls to change their difficulty. */
@@ -341,7 +346,7 @@ void ScreenNetSelectMusic::MenuDown( const InputEventPlus &input )
pn = PLAYER_2; pn = PLAYER_2;
if( GAMESTATE->m_pCurSong == NULL ) if( GAMESTATE->m_pCurSong == NULL )
return; return false;
StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType; StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType;
vector <Steps *> MultiSteps; vector <Steps *> MultiSteps;
MultiSteps = GAMESTATE->m_pCurSong->GetStepsByStepsType( st ); MultiSteps = GAMESTATE->m_pCurSong->GetStepsByStepsType( st );
@@ -383,22 +388,23 @@ void ScreenNetSelectMusic::MenuDown( const InputEventPlus &input )
} }
UpdateDifficulties( pn ); UpdateDifficulties( pn );
GAMESTATE->m_PreferredDifficulty[pn].Set( m_DC[pn] ); GAMESTATE->m_PreferredDifficulty[pn].Set( m_DC[pn] );
return true;
} }
void ScreenNetSelectMusic::MenuStart( const InputEventPlus &input ) bool ScreenNetSelectMusic::MenuStart( const InputEventPlus &input )
{ {
bool bResult = m_MusicWheel.Select(); bool bResult = m_MusicWheel.Select();
if( !bResult ) if( !bResult )
return; return true;
if( m_MusicWheel.GetSelectedType() != WheelItemDataType_Song ) if( m_MusicWheel.GetSelectedType() != WheelItemDataType_Song )
return; return true;
Song * pSong = m_MusicWheel.GetSelectedSong(); Song * pSong = m_MusicWheel.GetSelectedSong();
if( pSong == NULL ) if( pSong == NULL )
return; return false;
GAMESTATE->m_pCurSong.Set( pSong ); GAMESTATE->m_pCurSong.Set( pSong );
@@ -412,14 +418,16 @@ void ScreenNetSelectMusic::MenuStart( const InputEventPlus &input )
} }
else else
StartSelectedSong(); StartSelectedSong();
return true;
} }
void ScreenNetSelectMusic::MenuBack( const InputEventPlus &input ) bool ScreenNetSelectMusic::MenuBack( const InputEventPlus &input )
{ {
SOUND->StopMusic(); SOUND->StopMusic();
TweenOffScreen(); TweenOffScreen();
Cancel( SM_GoToPrevScreen ); Cancel( SM_GoToPrevScreen );
return true;
} }
void ScreenNetSelectMusic::TweenOffScreen() void ScreenNetSelectMusic::TweenOffScreen()
+7 -7
View File
@@ -18,18 +18,18 @@ class ScreenNetSelectMusic : public ScreenNetSelectBase
public: public:
virtual void Init(); virtual void Init();
virtual void Input( const InputEventPlus &input ); virtual bool Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void HandleScreenMessage( const ScreenMessage SM );
void StartSelectedSong(); void StartSelectedSong();
protected: protected:
virtual void MenuStart( const InputEventPlus &input ); virtual bool MenuStart( const InputEventPlus &input );
virtual void MenuBack( const InputEventPlus &input ); virtual bool MenuBack( const InputEventPlus &input );
virtual void MenuLeft( const InputEventPlus &input ); virtual bool MenuLeft( const InputEventPlus &input );
virtual void MenuRight( const InputEventPlus &input ); virtual bool MenuRight( const InputEventPlus &input );
virtual void MenuUp( const InputEventPlus &input ); virtual bool MenuUp( const InputEventPlus &input );
virtual void MenuDown( const InputEventPlus &input ); virtual bool MenuDown( const InputEventPlus &input );
bool LeftAndRightPressed( const PlayerNumber pn ); bool LeftAndRightPressed( const PlayerNumber pn );
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime );
+5 -5
View File
@@ -107,7 +107,7 @@ void ScreenNetworkOptions::HandleScreenMessage( const ScreenMessage SM )
ScreenOptions::HandleScreenMessage( SM ); ScreenOptions::HandleScreenMessage( SM );
} }
void ScreenNetworkOptions::MenuStart( const InputEventPlus &input ) bool ScreenNetworkOptions::MenuStart( const InputEventPlus &input )
{ {
switch( GetCurrentRow() ) switch( GetCurrentRow() )
{ {
@@ -122,13 +122,13 @@ void ScreenNetworkOptions::MenuStart( const InputEventPlus &input )
SCREENMAN->SystemMessage( DISCONNECTED ); SCREENMAN->SystemMessage( DISCONNECTED );
UpdateConnectStatus( ); UpdateConnectStatus( );
} }
break; return true;
case PO_SCOREBOARD: case PO_SCOREBOARD:
if (m_pRows[PO_SCOREBOARD]->GetOneSharedSelection() == NO_SCOREBOARD_ON) if (m_pRows[PO_SCOREBOARD]->GetOneSharedSelection() == NO_SCOREBOARD_ON)
PREFSMAN->m_bEnableScoreboard.Set(true); PREFSMAN->m_bEnableScoreboard.Set(true);
else else
PREFSMAN->m_bEnableScoreboard.Set(false); PREFSMAN->m_bEnableScoreboard.Set(false);
break; return true;
/* /*
case NetworkOptionRow::PO_SERVERS: case NetworkOptionRow::PO_SERVERS:
if ( !AllServers.empty() ) if ( !AllServers.empty() )
@@ -143,10 +143,10 @@ void ScreenNetworkOptions::MenuStart( const InputEventPlus &input )
//If the server list is empty, keep passing the message on so exit works //If the server list is empty, keep passing the message on so exit works
ScreenOptions::MenuStart( input ); ScreenOptions::MenuStart( input );
} }
break; return true;
*/ */
default: default:
ScreenOptions::MenuStart( input ); return ScreenOptions::MenuStart( input );
} }
} }
+1 -1
View File
@@ -10,7 +10,7 @@ public:
virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void HandleScreenMessage( const ScreenMessage SM );
virtual void MenuStart( const InputEventPlus &input ); virtual bool MenuStart( const InputEventPlus &input );
private: private:
void ImportOptions( int iRow, const vector<PlayerNumber> &vpns ); void ImportOptions( int iRow, const vector<PlayerNumber> &vpns );
+22 -16
View File
@@ -492,7 +492,7 @@ void ScreenOptions::Update( float fDeltaTime )
ScreenWithMenuElements::Update( fDeltaTime ); ScreenWithMenuElements::Update( fDeltaTime );
} }
void ScreenOptions::Input( const InputEventPlus &input ) bool ScreenOptions::Input( const InputEventPlus &input )
{ {
// HACK: This screen eats mouse inputs if we don't check for them first. // HACK: This screen eats mouse inputs if we don't check for them first.
bool mouse_evt = false; bool mouse_evt = false;
@@ -503,17 +503,16 @@ void ScreenOptions::Input( const InputEventPlus &input )
} }
if (mouse_evt) if (mouse_evt)
{ {
ScreenWithMenuElements::Input(input); return ScreenWithMenuElements::Input(input);
return;
} }
/* Allow input when transitioning in (m_In.IsTransitioning()), but ignore it /* Allow input when transitioning in (m_In.IsTransitioning()), but ignore it
* when we're transitioning out. */ * when we're transitioning out. */
if( m_Cancel.IsTransitioning() || m_Out.IsTransitioning() || m_fLockInputSecs > 0 ) if( m_Cancel.IsTransitioning() || m_Out.IsTransitioning() || m_fLockInputSecs > 0 )
return; return false;
if( !GAMESTATE->IsHumanPlayer(input.pn) ) if( !GAMESTATE->IsHumanPlayer(input.pn) )
return; return false;
if( input.type == IET_RELEASE ) if( input.type == IET_RELEASE )
{ {
@@ -532,7 +531,7 @@ void ScreenOptions::Input( const InputEventPlus &input )
} }
// default input handler // default input handler
Screen::Input( input ); return Screen::Input( input );
} }
void ScreenOptions::HandleScreenMessage( const ScreenMessage SM ) void ScreenOptions::HandleScreenMessage( const ScreenMessage SM )
@@ -766,9 +765,10 @@ void ScreenOptions::AfterChangeValueOrRow( PlayerNumber pn )
} }
void ScreenOptions::MenuBack( const InputEventPlus & ) bool ScreenOptions::MenuBack( const InputEventPlus & )
{ {
Cancel( SM_GoToPrevScreen ); Cancel( SM_GoToPrevScreen );
return true;
} }
bool ScreenOptions::AllAreOnLastRow() const bool ScreenOptions::AllAreOnLastRow() const
@@ -781,7 +781,7 @@ bool ScreenOptions::AllAreOnLastRow() const
return true; return true;
} }
void ScreenOptions::MenuStart( const InputEventPlus &input ) bool ScreenOptions::MenuStart( const InputEventPlus &input )
{ {
PlayerNumber pn = input.pn; PlayerNumber pn = input.pn;
switch( input.type ) switch( input.type )
@@ -790,10 +790,10 @@ void ScreenOptions::MenuStart( const InputEventPlus &input )
m_bGotAtLeastOneStartPressed[pn] = true; m_bGotAtLeastOneStartPressed[pn] = true;
break; break;
case IET_RELEASE: case IET_RELEASE:
return; // ignore return false; // ignore
default: // repeat type default: // repeat type
if( !m_bGotAtLeastOneStartPressed[pn] ) if( !m_bGotAtLeastOneStartPressed[pn] )
return; // don't allow repeat return false; // don't allow repeat
break; break;
} }
@@ -811,13 +811,14 @@ void ScreenOptions::MenuStart( const InputEventPlus &input )
{ {
if( MoveRowRelative(pn, -1, input.type != IET_FIRST_PRESS) ) if( MoveRowRelative(pn, -1, input.type != IET_FIRST_PRESS) )
m_SoundPrevRow.Play(); m_SoundPrevRow.Play();
return; return true;
} }
} }
default: break; default: break;
} }
this->ProcessMenuStart( input ); this->ProcessMenuStart( input );
return true;
} }
void ScreenOptions::ProcessMenuStart( const InputEventPlus &input ) void ScreenOptions::ProcessMenuStart( const InputEventPlus &input )
@@ -1244,7 +1245,7 @@ bool ScreenOptions::MoveRowAbsolute( PlayerNumber pn, int iRow )
return bChanged; return bChanged;
} }
void ScreenOptions::MenuLeft( const InputEventPlus &input ) bool ScreenOptions::MenuLeft( const InputEventPlus &input )
{ {
if( m_OptionsNavigation == NAV_THREE_KEY_ALT ) if( m_OptionsNavigation == NAV_THREE_KEY_ALT )
MenuUpDown( input, -1 ); MenuUpDown( input, -1 );
@@ -1253,9 +1254,10 @@ void ScreenOptions::MenuLeft( const InputEventPlus &input )
PlayerNumber pn = input.pn; PlayerNumber pn = input.pn;
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuLeftP1+pn) ); MESSAGEMAN->Broadcast( (MessageID)(Message_MenuLeftP1+pn) );
return true;
} }
void ScreenOptions::MenuRight( const InputEventPlus &input ) bool ScreenOptions::MenuRight( const InputEventPlus &input )
{ {
if( m_OptionsNavigation == NAV_THREE_KEY_ALT ) if( m_OptionsNavigation == NAV_THREE_KEY_ALT )
MenuUpDown( input, +1 ); MenuUpDown( input, +1 );
@@ -1264,25 +1266,29 @@ void ScreenOptions::MenuRight( const InputEventPlus &input )
PlayerNumber pn = input.pn; PlayerNumber pn = input.pn;
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuRightP1+pn) ); MESSAGEMAN->Broadcast( (MessageID)(Message_MenuRightP1+pn) );
return true;
} }
void ScreenOptions::MenuUp( const InputEventPlus &input ) bool ScreenOptions::MenuUp( const InputEventPlus &input )
{ {
MenuUpDown( input, -1 ); MenuUpDown( input, -1 );
PlayerNumber pn = input.pn; PlayerNumber pn = input.pn;
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuUpP1+pn) ); MESSAGEMAN->Broadcast( (MessageID)(Message_MenuUpP1+pn) );
return true;
} }
void ScreenOptions::MenuDown( const InputEventPlus &input ) bool ScreenOptions::MenuDown( const InputEventPlus &input )
{ {
MenuUpDown( input, +1 ); MenuUpDown( input, +1 );
PlayerNumber pn = input.pn; PlayerNumber pn = input.pn;
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuDownP1+pn) ); MESSAGEMAN->Broadcast( (MessageID)(Message_MenuDownP1+pn) );
return true;
} }
void ScreenOptions::MenuSelect( const InputEventPlus &input ) bool ScreenOptions::MenuSelect( const InputEventPlus &input )
{ {
MenuUpDown( input, -1 ); MenuUpDown( input, -1 );
return true;
} }
void ScreenOptions::MenuUpDown( const InputEventPlus &input, int iDir ) void ScreenOptions::MenuUpDown( const InputEventPlus &input, int iDir )
+8 -8
View File
@@ -40,7 +40,7 @@ public:
void InitMenu( const vector<OptionRowHandler*> &vHands ); void InitMenu( const vector<OptionRowHandler*> &vHands );
virtual ~ScreenOptions(); virtual ~ScreenOptions();
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime );
virtual void Input( const InputEventPlus &input ); virtual bool Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void HandleScreenMessage( const ScreenMessage SM );
virtual void TweenOnScreen(); virtual void TweenOnScreen();
@@ -84,14 +84,14 @@ protected:
virtual void AfterChangeRow( PlayerNumber pn ); virtual void AfterChangeRow( PlayerNumber pn );
virtual void AfterChangeValueOrRow( PlayerNumber pn ); virtual void AfterChangeValueOrRow( PlayerNumber pn );
virtual void MenuBack( const InputEventPlus &input ); virtual bool MenuBack( const InputEventPlus &input );
virtual void MenuStart( const InputEventPlus &input ); virtual bool MenuStart( const InputEventPlus &input );
virtual void ProcessMenuStart( const InputEventPlus &input ); virtual void ProcessMenuStart( const InputEventPlus &input );
virtual void MenuLeft( const InputEventPlus &input ); virtual bool MenuLeft( const InputEventPlus &input );
virtual void MenuRight( const InputEventPlus &input ); virtual bool MenuRight( const InputEventPlus &input );
virtual void MenuUp( const InputEventPlus &input ); virtual bool MenuUp( const InputEventPlus &input );
virtual void MenuDown( const InputEventPlus &input ); virtual bool MenuDown( const InputEventPlus &input );
virtual void MenuSelect( const InputEventPlus &input ); virtual bool MenuSelect( const InputEventPlus &input );
virtual void MenuUpDown( const InputEventPlus &input, int iDir ); // iDir == -1 or iDir == +1 virtual void MenuUpDown( const InputEventPlus &input, int iDir ); // iDir == -1 or iDir == +1
int GetCurrentRow( PlayerNumber pn = PLAYER_1 ) const { return m_iCurrentRow[pn]; } int GetCurrentRow( PlayerNumber pn = PLAYER_1 ) const { return m_iCurrentRow[pn]; }
+3 -2
View File
@@ -203,12 +203,13 @@ void ScreenOptionsManageCourses::AfterChangeRow( PlayerNumber pn )
ScreenOptions::AfterChangeRow( pn ); ScreenOptions::AfterChangeRow( pn );
} }
void ScreenOptionsManageCourses::MenuSelect( const InputEventPlus &input ) bool ScreenOptionsManageCourses::MenuSelect( const InputEventPlus &input )
{ {
if( input.type != IET_FIRST_PRESS ) if( input.type != IET_FIRST_PRESS )
return; return false;
SetNextCombination(); SetNextCombination();
m_soundDifficultyChanged.Play(); m_soundDifficultyChanged.Play();
return true;
} }
static LocalizedString YOU_HAVE_MAX( "ScreenOptionsManageCourses", "You have %d, the maximum number allowed." ); static LocalizedString YOU_HAVE_MAX( "ScreenOptionsManageCourses", "You have %d, the maximum number allowed." );
+1 -1
View File
@@ -13,7 +13,7 @@ public:
void Init(); void Init();
virtual void BeginScreen(); virtual void BeginScreen();
virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void HandleScreenMessage( const ScreenMessage SM );
virtual void MenuSelect( const InputEventPlus &input ); virtual bool MenuSelect( const InputEventPlus &input );
protected: protected:
virtual void ImportOptions( int iRow, const vector<PlayerNumber> &vpns ); virtual void ImportOptions( int iRow, const vector<PlayerNumber> &vpns );
+18 -12
View File
@@ -159,7 +159,7 @@ void ScreenPackages::Update( float fDeltaTime )
} }
static LocalizedString ENTER_URL ("ScreenPackages","Enter URL"); static LocalizedString ENTER_URL ("ScreenPackages","Enter URL");
void ScreenPackages::MenuStart( const InputEventPlus &input ) bool ScreenPackages::MenuStart( const InputEventPlus &input )
{ {
if ( m_iDLorLST == 1 ) if ( m_iDLorLST == 1 )
{ {
@@ -169,12 +169,13 @@ void ScreenPackages::MenuStart( const InputEventPlus &input )
EnterURL( m_Links[m_iLinksPos] ); EnterURL( m_Links[m_iLinksPos] );
} }
ScreenWithMenuElements::MenuStart( input ); ScreenWithMenuElements::MenuStart( input );
return true;
} }
void ScreenPackages::MenuUp( const InputEventPlus &input ) bool ScreenPackages::MenuUp( const InputEventPlus &input )
{ {
if ( m_bIsDownloading ) if ( m_bIsDownloading )
return; return false;
if ( m_iDLorLST == 0) if ( m_iDLorLST == 0)
{ {
if ( m_iPackagesPos > 0) if ( m_iPackagesPos > 0)
@@ -192,12 +193,13 @@ void ScreenPackages::MenuUp( const InputEventPlus &input )
} }
} }
ScreenWithMenuElements::MenuUp( input ); ScreenWithMenuElements::MenuUp( input );
return true;
} }
void ScreenPackages::MenuDown( const InputEventPlus &input ) bool ScreenPackages::MenuDown( const InputEventPlus &input )
{ {
if ( m_bIsDownloading ) if ( m_bIsDownloading )
return; return false;
if ( m_iDLorLST == 0) if ( m_iDLorLST == 0)
{ {
@@ -216,14 +218,15 @@ void ScreenPackages::MenuDown( const InputEventPlus &input )
} }
} }
ScreenWithMenuElements::MenuDown( input ); ScreenWithMenuElements::MenuDown( input );
return true;
} }
void ScreenPackages::MenuLeft( const InputEventPlus &input ) bool ScreenPackages::MenuLeft( const InputEventPlus &input )
{ {
if ( m_bIsDownloading ) if ( m_bIsDownloading )
return; return false;
if ( !m_bCanDL ) if ( !m_bCanDL )
return; return false;
/* /*
m_sprExistingBG.StopTweening(); m_sprExistingBG.StopTweening();
@@ -243,12 +246,13 @@ void ScreenPackages::MenuLeft( const InputEventPlus &input )
COMMAND( m_sprWebBG, "Away" ); COMMAND( m_sprWebBG, "Away" );
} }
ScreenWithMenuElements::MenuLeft( input ); ScreenWithMenuElements::MenuLeft( input );
return true;
} }
void ScreenPackages::MenuRight( const InputEventPlus &input ) bool ScreenPackages::MenuRight( const InputEventPlus &input )
{ {
if ( m_bIsDownloading ) if ( m_bIsDownloading )
return; return false;
// Huh? // Huh?
//MenuLeft( input ); //MenuLeft( input );
@@ -267,21 +271,23 @@ void ScreenPackages::MenuRight( const InputEventPlus &input )
} }
ScreenWithMenuElements::MenuRight( input ); ScreenWithMenuElements::MenuRight( input );
return true;
} }
static LocalizedString DOWNLOAD_CANCELLED( "ScreenPackages", "Download cancelled." ); static LocalizedString DOWNLOAD_CANCELLED( "ScreenPackages", "Download cancelled." );
void ScreenPackages::MenuBack( const InputEventPlus &input ) bool ScreenPackages::MenuBack( const InputEventPlus &input )
{ {
if ( m_bIsDownloading ) if ( m_bIsDownloading )
{ {
SCREENMAN->SystemMessage( DOWNLOAD_CANCELLED ); SCREENMAN->SystemMessage( DOWNLOAD_CANCELLED );
CancelDownload( ); CancelDownload( );
return; return true;
} }
TweenOffScreen(); TweenOffScreen();
Cancel( SM_GoToPrevScreen ); Cancel( SM_GoToPrevScreen );
ScreenWithMenuElements::MenuBack( input ); ScreenWithMenuElements::MenuBack( input );
return true;
} }
void ScreenPackages::TweenOffScreen( ) void ScreenPackages::TweenOffScreen( )
+6 -6
View File
@@ -18,12 +18,12 @@ public:
virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void HandleScreenMessage( const ScreenMessage SM );
virtual void MenuStart( const InputEventPlus &input ); virtual bool MenuStart( const InputEventPlus &input );
virtual void MenuUp( const InputEventPlus &input ); virtual bool MenuUp( const InputEventPlus &input );
virtual void MenuDown( const InputEventPlus &input ); virtual bool MenuDown( const InputEventPlus &input );
virtual void MenuLeft( const InputEventPlus &input ); virtual bool MenuLeft( const InputEventPlus &input );
virtual void MenuRight( const InputEventPlus &input ); virtual bool MenuRight( const InputEventPlus &input );
virtual void MenuBack( const InputEventPlus &input ); virtual bool MenuBack( const InputEventPlus &input );
virtual void TweenOffScreen( ); virtual void TweenOffScreen( );
virtual void Update(float f); virtual void Update(float f);
+4 -3
View File
@@ -24,16 +24,17 @@ void ScreenPackagesSSC::HandleScreenMessage( const ScreenMessage SM )
ScreenWithMenuElements::HandleScreenMessage( SM ); ScreenWithMenuElements::HandleScreenMessage( SM );
} }
void ScreenPackagesSSC::Input( const InputEventPlus &input ) bool ScreenPackagesSSC::Input( const InputEventPlus &input )
{ {
ScreenWithMenuElements::Input( input ); return ScreenWithMenuElements::Input( input );
} }
void ScreenPackagesSSC::MenuBack( const InputEventPlus &input ) bool ScreenPackagesSSC::MenuBack( const InputEventPlus &input )
{ {
TweenOffScreen(); TweenOffScreen();
Cancel( SM_GoToPrevScreen ); Cancel( SM_GoToPrevScreen );
ScreenWithMenuElements::MenuBack( input ); ScreenWithMenuElements::MenuBack( input );
return true;
} }
void ScreenPackagesSSC::Update( float fDeltaTime ) void ScreenPackagesSSC::Update( float fDeltaTime )
+2 -2
View File
@@ -16,8 +16,8 @@ public:
virtual void Init(); virtual void Init();
/* Input stuff */ /* Input stuff */
virtual void Input( const InputEventPlus &input ); virtual bool Input( const InputEventPlus &input );
virtual void MenuBack( const InputEventPlus &input ); virtual bool MenuBack( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void HandleScreenMessage( const ScreenMessage SM );
virtual void Update(float f); virtual void Update(float f);
+7 -2
View File
@@ -57,8 +57,10 @@ void ScreenPlayerOptions::BeginScreen()
} }
} }
void ScreenPlayerOptions::Input( const InputEventPlus &input ) bool ScreenPlayerOptions::Input( const InputEventPlus &input )
{ {
bool bHandled = false;
if( m_bAskOptionsMessage && if( m_bAskOptionsMessage &&
input.type == IET_FIRST_PRESS && input.type == IET_FIRST_PRESS &&
!m_In.IsTransitioning() && !m_In.IsTransitioning() &&
@@ -69,6 +71,7 @@ void ScreenPlayerOptions::Input( const InputEventPlus &input )
m_bGoToOptions = true; m_bGoToOptions = true;
this->PlayCommand( "GoToOptions" ); this->PlayCommand( "GoToOptions" );
SCREENMAN->PlayStartSound(); SCREENMAN->PlayStartSound();
bHandled = true;
} }
} }
@@ -90,9 +93,10 @@ void ScreenPlayerOptions::Input( const InputEventPlus &input )
this->UpdateDisqualified( r, pn ); this->UpdateDisqualified( r, pn );
m_pRows[r]->SetChoiceInRowWithFocus( pn, iOldFocus ); m_pRows[r]->SetChoiceInRowWithFocus( pn, iOldFocus );
} }
bHandled = true;
} }
ScreenOptionsMaster::Input( input ); bHandled = ScreenOptionsMaster::Input( input ) || bHandled;
// UGLY: Update m_Disqualified whenever Start is pressed // UGLY: Update m_Disqualified whenever Start is pressed
if( GAMESTATE->IsHumanPlayer(pn) && input.MenuI == GAME_BUTTON_START ) if( GAMESTATE->IsHumanPlayer(pn) && input.MenuI == GAME_BUTTON_START )
@@ -100,6 +104,7 @@ void ScreenPlayerOptions::Input( const InputEventPlus &input )
int row = m_iCurrentRow[pn]; int row = m_iCurrentRow[pn];
UpdateDisqualified( row, pn ); UpdateDisqualified( row, pn );
} }
return bHandled;
} }
void ScreenPlayerOptions::HandleScreenMessage( const ScreenMessage SM ) void ScreenPlayerOptions::HandleScreenMessage( const ScreenMessage SM )
+1 -1
View File
@@ -11,7 +11,7 @@ public:
virtual void Init(); virtual void Init();
virtual void BeginScreen(); virtual void BeginScreen();
virtual void Input( const InputEventPlus &input ); virtual bool Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void HandleScreenMessage( const ScreenMessage SM );
bool GetGoToOptions() const { return m_bGoToOptions; } bool GetGoToOptions() const { return m_bGoToOptions; }
+2 -1
View File
@@ -19,8 +19,9 @@ void ScreenProfileLoad::BeginScreen()
ScreenWithMenuElements::BeginScreen(); ScreenWithMenuElements::BeginScreen();
} }
void ScreenProfileLoad::Input( const InputEventPlus &input ) bool ScreenProfileLoad::Input( const InputEventPlus &input )
{ {
return false;
} }
void ScreenProfileLoad::Continue() void ScreenProfileLoad::Continue()
+1 -1
View File
@@ -8,7 +8,7 @@ class ScreenProfileLoad: public ScreenWithMenuElements
public: public:
virtual void Init(); virtual void Init();
virtual void BeginScreen(); virtual void BeginScreen();
virtual void Input( const InputEventPlus &input ); virtual bool Input( const InputEventPlus &input );
void Continue(); void Continue();
virtual void PushSelf( lua_State *L ); virtual void PushSelf( lua_State *L );
+2 -1
View File
@@ -10,8 +10,9 @@ void ScreenProfileSave::BeginScreen()
ScreenWithMenuElements::BeginScreen(); ScreenWithMenuElements::BeginScreen();
} }
void ScreenProfileSave::Input( const InputEventPlus &input ) bool ScreenProfileSave::Input( const InputEventPlus &input )
{ {
return false;
} }
void ScreenProfileSave::Continue() void ScreenProfileSave::Continue()
+1 -1
View File
@@ -7,7 +7,7 @@ class ScreenProfileSave: public ScreenWithMenuElements
{ {
public: public:
virtual void BeginScreen(); virtual void BeginScreen();
virtual void Input( const InputEventPlus &input ); virtual bool Input( const InputEventPlus &input );
void Continue(); void Continue();
virtual void PushSelf( lua_State *L ); virtual void PushSelf( lua_State *L );
+23 -15
View File
@@ -106,29 +106,27 @@ void ScreenPrompt::BeginScreen()
PositionCursor(); PositionCursor();
} }
void ScreenPrompt::Input( const InputEventPlus &input ) bool ScreenPrompt::Input( const InputEventPlus &input )
{ {
if( IsTransitioning() ) if( IsTransitioning() )
return; return false;
if( input.type == IET_RELEASE ) if( input.type == IET_RELEASE )
return; return false;
if( input.DeviceI.device==DEVICE_KEYBOARD ) if( input.DeviceI.device==DEVICE_KEYBOARD )
{ {
switch( input.DeviceI.button ) switch( input.DeviceI.button )
{ {
case KEY_LEFT: case KEY_LEFT:
this->MenuLeft( input ); return this->MenuLeft( input );
return;
case KEY_RIGHT: case KEY_RIGHT:
this->MenuRight( input ); return this->MenuRight( input );
return;
default: break; default: break;
} }
} }
ScreenWithMenuElements::Input( input ); return ScreenWithMenuElements::Input( input );
} }
bool ScreenPrompt::CanGoRight() bool ScreenPrompt::CanGoRight()
@@ -157,30 +155,39 @@ void ScreenPrompt::Change( int dir )
m_sndChange.Play(); m_sndChange.Play();
} }
void ScreenPrompt::MenuLeft( const InputEventPlus &input ) bool ScreenPrompt::MenuLeft( const InputEventPlus &input )
{ {
if( CanGoLeft() ) if( CanGoLeft() )
{
Change( -1 ); Change( -1 );
return true;
}
return false;
} }
void ScreenPrompt::MenuRight( const InputEventPlus &input ) bool ScreenPrompt::MenuRight( const InputEventPlus &input )
{ {
if( CanGoRight() ) if( CanGoRight() )
{
Change( +1 ); Change( +1 );
return true;
}
return false;
} }
void ScreenPrompt::MenuStart( const InputEventPlus &input ) bool ScreenPrompt::MenuStart( const InputEventPlus &input )
{ {
if( m_Out.IsTransitioning() || m_Cancel.IsTransitioning() ) if( m_Out.IsTransitioning() || m_Cancel.IsTransitioning() )
return; return false;
End( false ); End( false );
return true;
} }
void ScreenPrompt::MenuBack( const InputEventPlus &input ) bool ScreenPrompt::MenuBack( const InputEventPlus &input )
{ {
if( m_Out.IsTransitioning() || m_Cancel.IsTransitioning() ) if( m_Out.IsTransitioning() || m_Cancel.IsTransitioning() )
return; return false;
switch( g_PromptType ) switch( g_PromptType )
{ {
@@ -190,8 +197,9 @@ void ScreenPrompt::MenuBack( const InputEventPlus &input )
break; break;
case PROMPT_YES_NO_CANCEL: case PROMPT_YES_NO_CANCEL:
End( true ); End( true );
break; return true;
} }
return false;
} }
void ScreenPrompt::End( bool bCancelled ) void ScreenPrompt::End( bool bCancelled )
+5 -5
View File
@@ -30,7 +30,7 @@ public:
virtual void Init(); virtual void Init();
virtual void BeginScreen(); virtual void BeginScreen();
virtual void Input( const InputEventPlus &input ); virtual bool Input( const InputEventPlus &input );
static PromptAnswer s_LastAnswer; static PromptAnswer s_LastAnswer;
static bool s_bCancelledLast; static bool s_bCancelledLast;
@@ -42,10 +42,10 @@ protected:
bool CanGoLeft() { return m_Answer > 0; } bool CanGoLeft() { return m_Answer > 0; }
bool CanGoRight(); bool CanGoRight();
void Change( int dir ); void Change( int dir );
void MenuLeft( const InputEventPlus &input ); bool MenuLeft( const InputEventPlus &input );
void MenuRight( const InputEventPlus &input ); bool MenuRight( const InputEventPlus &input );
void MenuBack( const InputEventPlus &input ); bool MenuBack( const InputEventPlus &input );
void MenuStart( const InputEventPlus &input ); bool MenuStart( const InputEventPlus &input );
virtual void End( bool bCancelled ); virtual void End( bool bCancelled );
void PositionCursor(); void PositionCursor();
+2 -2
View File
@@ -185,9 +185,9 @@ void ScreenSMOnlineLogin::HandleScreenMessage(const ScreenMessage SM)
ScreenOptions::HandleScreenMessage(SM); ScreenOptions::HandleScreenMessage(SM);
} }
void ScreenSMOnlineLogin::MenuStart( const InputEventPlus &input ) bool ScreenSMOnlineLogin::MenuStart( const InputEventPlus &input )
{ {
ScreenOptions::MenuStart( input ); return ScreenOptions::MenuStart( input );
} }
RString ScreenSMOnlineLogin::GetSelectedProfileID() RString ScreenSMOnlineLogin::GetSelectedProfileID()
+1 -1
View File
@@ -8,7 +8,7 @@ class ScreenSMOnlineLogin : public ScreenOptions
public: public:
virtual void Init(); virtual void Init();
virtual void HandleScreenMessage(const ScreenMessage SM); virtual void HandleScreenMessage(const ScreenMessage SM);
virtual void MenuStart( const InputEventPlus &input ); virtual bool MenuStart( const InputEventPlus &input );
void SendLogin( RString sPassword ); void SendLogin( RString sPassword );
private: private:
+2 -2
View File
@@ -22,9 +22,9 @@ void ScreenSandbox::HandleScreenMessage( const ScreenMessage SM )
Screen::HandleScreenMessage( SM ); Screen::HandleScreenMessage( SM );
} }
void ScreenSandbox::Input( const InputEventPlus &input ) bool ScreenSandbox::Input( const InputEventPlus &input )
{ {
Screen::Input( input ); return Screen::Input( input );
} }
void ScreenSandbox::Update( float fDeltaTime ) void ScreenSandbox::Update( float fDeltaTime )
+1 -1
View File
@@ -6,7 +6,7 @@
class ScreenSandbox : public Screen class ScreenSandbox : public Screen
{ {
public: public:
virtual void Input( const InputEventPlus &input ); virtual bool Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void HandleScreenMessage( const ScreenMessage SM );
virtual void Update(float f); virtual void Update(float f);
virtual void DrawPrimitives(); virtual void DrawPrimitives();
+7 -6
View File
@@ -93,7 +93,7 @@ void ScreenSelect::Update( float fDelta )
ScreenWithMenuElements::Update( fDelta ); ScreenWithMenuElements::Update( fDelta );
} }
void ScreenSelect::Input( const InputEventPlus &input ) bool ScreenSelect::Input( const InputEventPlus &input )
{ {
// LOG->Trace( "ScreenSelect::Input()" ); // LOG->Trace( "ScreenSelect::Input()" );
@@ -114,14 +114,14 @@ void ScreenSelect::Input( const InputEventPlus &input )
SCREENMAN->PlayStartSound(); SCREENMAN->PlayStartSound();
if( !ALLOW_DISABLED_PLAYER_INPUT ) if( !ALLOW_DISABLED_PLAYER_INPUT )
return; // don't let the screen handle the MENU_START press return false; // don't let the screen handle the MENU_START press
} }
if( !GAMESTATE->IsPlayerEnabled(input.pn) ) if( !GAMESTATE->IsPlayerEnabled(input.pn) )
{ {
// block input of disabled players // block input of disabled players
if( !ALLOW_DISABLED_PLAYER_INPUT ) if( !ALLOW_DISABLED_PLAYER_INPUT )
return; return false;
/* Never allow a START press by a player that's still not joined, even if /* Never allow a START press by a player that's still not joined, even if
* ALLOW_DISABLED_PLAYER_INPUT would allow other types of input. If we * ALLOW_DISABLED_PLAYER_INPUT would allow other types of input. If we
@@ -129,10 +129,10 @@ void ScreenSelect::Input( const InputEventPlus &input )
* players joined (eg. if ScreenTitleJoin is started in pay with no * players joined (eg. if ScreenTitleJoin is started in pay with no
* credits). */ * credits). */
if( input.MenuI == GAME_BUTTON_START ) if( input.MenuI == GAME_BUTTON_START )
return; return false;
} }
ScreenWithMenuElements::Input( input ); // default input handler return ScreenWithMenuElements::Input( input ); // default input handler
} }
void ScreenSelect::HandleScreenMessage( const ScreenMessage SM ) void ScreenSelect::HandleScreenMessage( const ScreenMessage SM )
@@ -195,9 +195,10 @@ void ScreenSelect::HandleMessage( const Message &msg )
ScreenWithMenuElements::HandleMessage( msg ); ScreenWithMenuElements::HandleMessage( msg );
} }
void ScreenSelect::MenuBack( const InputEventPlus &input ) bool ScreenSelect::MenuBack( const InputEventPlus &input )
{ {
Cancel( SM_GoToPrevScreen ); Cancel( SM_GoToPrevScreen );
return true;
} }
/* /*
+2 -2
View File
@@ -13,11 +13,11 @@ public:
virtual ~ScreenSelect(); virtual ~ScreenSelect();
virtual void Update( float fDelta ); virtual void Update( float fDelta );
virtual void Input( const InputEventPlus &input ); virtual bool Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void HandleScreenMessage( const ScreenMessage SM );
virtual void HandleMessage( const Message &msg ); virtual void HandleMessage( const Message &msg );
virtual void MenuBack( const InputEventPlus &input ); virtual bool MenuBack( const InputEventPlus &input );
protected: protected:
virtual int GetSelectionIndex( PlayerNumber pn ) = 0; virtual int GetSelectionIndex( PlayerNumber pn ) = 0;
+15 -11
View File
@@ -157,14 +157,14 @@ ScreenSelectCharacter::~ScreenSelectCharacter()
} }
void ScreenSelectCharacter::Input( const InputEventPlus &input ) bool ScreenSelectCharacter::Input( const InputEventPlus &input )
{ {
LOG->Trace( "ScreenSelectCharacter::Input()" ); LOG->Trace( "ScreenSelectCharacter::Input()" );
if( IsTransitioning() ) if( IsTransitioning() )
return; return false;
ScreenWithMenuElements::Input( input ); // default input handler return ScreenWithMenuElements::Input( input ); // default input handler
} }
void ScreenSelectCharacter::HandleScreenMessage( const ScreenMessage SM ) void ScreenSelectCharacter::HandleScreenMessage( const ScreenMessage SM )
@@ -273,25 +273,27 @@ void ScreenSelectCharacter::AfterValueChange( PlayerNumber pn )
} }
void ScreenSelectCharacter::MenuLeft( const InputEventPlus &input ) bool ScreenSelectCharacter::MenuLeft( const InputEventPlus &input )
{ {
MenuUp( input ); return MenuUp( input );
} }
void ScreenSelectCharacter::MenuRight( const InputEventPlus &input ) bool ScreenSelectCharacter::MenuRight( const InputEventPlus &input )
{ {
MenuDown( input ); return MenuDown( input );
} }
void ScreenSelectCharacter::MenuUp( const InputEventPlus &input ) bool ScreenSelectCharacter::MenuUp( const InputEventPlus &input )
{ {
Move( input.pn, -1 ); Move( input.pn, -1 );
return true;
} }
void ScreenSelectCharacter::MenuDown( const InputEventPlus &input ) bool ScreenSelectCharacter::MenuDown( const InputEventPlus &input )
{ {
Move( input.pn, +1 ); Move( input.pn, +1 );
return true;
} }
void ScreenSelectCharacter::Move( PlayerNumber pn, int deltaValue ) void ScreenSelectCharacter::Move( PlayerNumber pn, int deltaValue )
@@ -322,9 +324,10 @@ bool ScreenSelectCharacter::AllAreFinishedChoosing() const
return true; return true;
} }
void ScreenSelectCharacter::MenuStart( const InputEventPlus &input ) bool ScreenSelectCharacter::MenuStart( const InputEventPlus &input )
{ {
MakeSelection( input.pn ); MakeSelection( input.pn );
return true;
} }
void ScreenSelectCharacter::MakeSelection( PlayerNumber pn ) void ScreenSelectCharacter::MakeSelection( PlayerNumber pn )
@@ -364,9 +367,10 @@ void ScreenSelectCharacter::MakeSelection( PlayerNumber pn )
} }
} }
void ScreenSelectCharacter::MenuBack( const InputEventPlus &input ) bool ScreenSelectCharacter::MenuBack( const InputEventPlus &input )
{ {
Cancel( SM_GoToPrevScreen ); Cancel( SM_GoToPrevScreen );
return true;
} }
void ScreenSelectCharacter::TweenOffScreen() void ScreenSelectCharacter::TweenOffScreen()
+7 -7
View File
@@ -19,15 +19,15 @@ public:
virtual void Init(); virtual void Init();
virtual ~ScreenSelectCharacter(); virtual ~ScreenSelectCharacter();
virtual void Input( const InputEventPlus &input ); virtual bool Input( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void HandleScreenMessage( const ScreenMessage SM );
void MenuLeft( const InputEventPlus &input ); bool MenuLeft( const InputEventPlus &input );
void MenuRight( const InputEventPlus &input ); bool MenuRight( const InputEventPlus &input );
void MenuUp( const InputEventPlus &input ); bool MenuUp( const InputEventPlus &input );
void MenuDown( const InputEventPlus &input ); bool MenuDown( const InputEventPlus &input );
void MenuStart( const InputEventPlus &input ); bool MenuStart( const InputEventPlus &input );
void MenuBack( const InputEventPlus &input ); bool MenuBack( const InputEventPlus &input );
void TweenOffScreen(); void TweenOffScreen();
+4 -3
View File
@@ -42,7 +42,7 @@ void ScreenSelectLanguage::BeginScreen()
ScreenSelectMaster::BeginScreen(); ScreenSelectMaster::BeginScreen();
} }
void ScreenSelectLanguage::MenuStart( const InputEventPlus &input ) bool ScreenSelectLanguage::MenuStart( const InputEventPlus &input )
{ {
int iIndex = this->GetSelectionIndex( input.pn ); int iIndex = this->GetSelectionIndex( input.pn );
RString sLangCode = m_aGameCommands[iIndex].m_sName; RString sLangCode = m_aGameCommands[iIndex].m_sName;
@@ -52,11 +52,12 @@ void ScreenSelectLanguage::MenuStart( const InputEventPlus &input )
m_soundStart.Play(); m_soundStart.Play();
this->PostScreenMessage( SM_BeginFadingOut, 0 ); this->PostScreenMessage( SM_BeginFadingOut, 0 );
return true;
} }
void ScreenSelectLanguage::MenuBack( const InputEventPlus &input ) bool ScreenSelectLanguage::MenuBack( const InputEventPlus &input )
{ {
return; // ignore the press return false; // ignore the press
} }
/* /*
+2 -2
View File
@@ -10,8 +10,8 @@ public:
virtual void Init(); virtual void Init();
virtual RString GetDefaultChoice(); virtual RString GetDefaultChoice();
virtual void BeginScreen(); virtual void BeginScreen();
virtual void MenuStart( const InputEventPlus &input ); virtual bool MenuStart( const InputEventPlus &input );
virtual void MenuBack( const InputEventPlus &input ); virtual bool MenuBack( const InputEventPlus &input );
}; };
#endif #endif
+38 -29
View File
@@ -408,19 +408,19 @@ try_again:
return ChangeSelection( pn, dir, iSwitchToIndex ); return ChangeSelection( pn, dir, iSwitchToIndex );
} }
void ScreenSelectMaster::MenuLeft( const InputEventPlus &input ) bool ScreenSelectMaster::MenuLeft( const InputEventPlus &input )
{ {
PlayerNumber pn = input.pn; PlayerNumber pn = input.pn;
if( m_fLockInputSecs > 0 || m_bChosen[pn] ) if( m_fLockInputSecs > 0 || m_bChosen[pn] )
return; return false;
if( input.type == IET_RELEASE ) if( input.type == IET_RELEASE )
return; return false;
if( input.type != IET_FIRST_PRESS ) if( input.type != IET_FIRST_PRESS )
{ {
if( !ALLOW_REPEATING_INPUT ) if( !ALLOW_REPEATING_INPUT )
return; return false;
if( m_TrackingRepeatingInput != input.MenuI ) if( m_TrackingRepeatingInput != input.MenuI )
return; return false;
} }
if( Move(pn, MenuDir_Left) ) if( Move(pn, MenuDir_Left) )
{ {
@@ -434,22 +434,24 @@ void ScreenSelectMaster::MenuLeft( const InputEventPlus &input )
{ {
m_bDoubleChoice[pn] = false; // player has cancelled their selection m_bDoubleChoice[pn] = false; // player has cancelled their selection
} }
return true;
} }
return false;
} }
void ScreenSelectMaster::MenuRight( const InputEventPlus &input ) bool ScreenSelectMaster::MenuRight( const InputEventPlus &input )
{ {
PlayerNumber pn = input.pn; PlayerNumber pn = input.pn;
if( m_fLockInputSecs > 0 || m_bChosen[pn] ) if( m_fLockInputSecs > 0 || m_bChosen[pn] )
return; return false;
if( input.type == IET_RELEASE ) if( input.type == IET_RELEASE )
return; return false;
if( input.type != IET_FIRST_PRESS ) if( input.type != IET_FIRST_PRESS )
{ {
if( !ALLOW_REPEATING_INPUT ) if( !ALLOW_REPEATING_INPUT )
return; return false;
if( m_TrackingRepeatingInput != input.MenuI ) if( m_TrackingRepeatingInput != input.MenuI )
return; return false;
} }
if( Move(pn, MenuDir_Right) ) if( Move(pn, MenuDir_Right) )
{ {
@@ -463,22 +465,24 @@ void ScreenSelectMaster::MenuRight( const InputEventPlus &input )
{ {
m_bDoubleChoice[pn] = false; // player has cancelled their selection m_bDoubleChoice[pn] = false; // player has cancelled their selection
} }
return true;
} }
return false;
} }
void ScreenSelectMaster::MenuUp( const InputEventPlus &input ) bool ScreenSelectMaster::MenuUp( const InputEventPlus &input )
{ {
PlayerNumber pn = input.pn; PlayerNumber pn = input.pn;
if( m_fLockInputSecs > 0 || m_bChosen[pn] ) if( m_fLockInputSecs > 0 || m_bChosen[pn] )
return; return false;
if( input.type == IET_RELEASE ) if( input.type == IET_RELEASE )
return; return false;
if( input.type != IET_FIRST_PRESS ) if( input.type != IET_FIRST_PRESS )
{ {
if( !ALLOW_REPEATING_INPUT ) if( !ALLOW_REPEATING_INPUT )
return; return false;
if( m_TrackingRepeatingInput != input.MenuI ) if( m_TrackingRepeatingInput != input.MenuI )
return; return false;
} }
if( Move(pn, MenuDir_Up) ) if( Move(pn, MenuDir_Up) )
{ {
@@ -492,22 +496,24 @@ void ScreenSelectMaster::MenuUp( const InputEventPlus &input )
{ {
m_bDoubleChoice[pn] = false; // player has cancelled their selection m_bDoubleChoice[pn] = false; // player has cancelled their selection
} }
return true;
} }
return false;
} }
void ScreenSelectMaster::MenuDown( const InputEventPlus &input ) bool ScreenSelectMaster::MenuDown( const InputEventPlus &input )
{ {
PlayerNumber pn = input.pn; PlayerNumber pn = input.pn;
if( m_fLockInputSecs > 0 || m_bChosen[pn] ) if( m_fLockInputSecs > 0 || m_bChosen[pn] )
return; return false;
if( input.type == IET_RELEASE ) if( input.type == IET_RELEASE )
return; return false;
if( input.type != IET_FIRST_PRESS ) if( input.type != IET_FIRST_PRESS )
{ {
if( !ALLOW_REPEATING_INPUT ) if( !ALLOW_REPEATING_INPUT )
return; return false;
if( m_TrackingRepeatingInput != input.MenuI ) if( m_TrackingRepeatingInput != input.MenuI )
return; return false;
} }
if( Move(pn, MenuDir_Down) ) if( Move(pn, MenuDir_Down) )
{ {
@@ -521,7 +527,9 @@ void ScreenSelectMaster::MenuDown( const InputEventPlus &input )
{ {
m_bDoubleChoice[pn] = false; // player has cancelled their selection m_bDoubleChoice[pn] = false; // player has cancelled their selection
} }
return true;
} }
return false;
} }
bool ScreenSelectMaster::ChangePage( int iNewChoice ) bool ScreenSelectMaster::ChangePage( int iNewChoice )
@@ -775,29 +783,29 @@ float ScreenSelectMaster::DoMenuStart( PlayerNumber pn )
return fSecs; return fSecs;
} }
void ScreenSelectMaster::MenuStart( const InputEventPlus &input ) bool ScreenSelectMaster::MenuStart( const InputEventPlus &input )
{ {
if( input.type != IET_FIRST_PRESS ) if( input.type != IET_FIRST_PRESS )
return; return false;
PlayerNumber pn = input.pn; PlayerNumber pn = input.pn;
if( m_fLockInputSecs > 0 ) if( m_fLockInputSecs > 0 )
return; return false;
if( SHARED_SELECTION || GetCurrentPage() == PAGE_2 ) if( SHARED_SELECTION || GetCurrentPage() == PAGE_2 )
{ {
// Return if any player has chosen // Return if any player has chosen
FOREACH_EnabledPlayer( p ) FOREACH_EnabledPlayer( p )
{ {
if( m_bChosen[p] ) if( m_bChosen[p] )
return; return false;
} }
} }
else if( m_bChosen[pn] ) else if( m_bChosen[pn] )
// Return if this player has already chosen // Return if this player has already chosen
return; return false;
if( !ProcessMenuStart( pn ) ) if( !ProcessMenuStart( pn ) )
return; return false;
// double press is enabled and the player hasn't made their first press // double press is enabled and the player hasn't made their first press
if(DOUBLE_PRESS_TO_SELECT && !m_bDoubleChoice[pn]) if(DOUBLE_PRESS_TO_SELECT && !m_bDoubleChoice[pn])
@@ -811,7 +819,7 @@ void ScreenSelectMaster::MenuStart( const InputEventPlus &input )
vScroll[m_iChoice[pn]]->PlayCommand( "InitialSelection" ); vScroll[m_iChoice[pn]]->PlayCommand( "InitialSelection" );
} }
return; return true;
} }
const GameCommand &mc = m_aGameCommands[m_iChoice[pn]]; const GameCommand &mc = m_aGameCommands[m_iChoice[pn]];
@@ -819,7 +827,7 @@ void ScreenSelectMaster::MenuStart( const InputEventPlus &input )
/* If no options are playable, then we're just waiting for one to become available. /* If no options are playable, then we're just waiting for one to become available.
* If any options are playable, then the selection must be playable. */ * If any options are playable, then the selection must be playable. */
if( !AnyOptionsArePlayable() ) if( !AnyOptionsArePlayable() )
return; return false;
SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo(ssprintf("%s comment %s",m_sName.c_str(), mc.m_sName.c_str())) ); SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo(ssprintf("%s comment %s",m_sName.c_str(), mc.m_sName.c_str())) );
@@ -835,7 +843,7 @@ void ScreenSelectMaster::MenuStart( const InputEventPlus &input )
Message msg( MessageIDToString((MessageID)(Message_MenuStartP1+pn)) ); Message msg( MessageIDToString((MessageID)(Message_MenuStartP1+pn)) );
msg.SetParam( "ScreenEmpty", true ); msg.SetParam( "ScreenEmpty", true );
MESSAGEMAN->Broadcast( msg ); MESSAGEMAN->Broadcast( msg );
return; return true;
} }
float fSecs = 0; float fSecs = 0;
@@ -863,6 +871,7 @@ void ScreenSelectMaster::MenuStart( const InputEventPlus &input )
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuStartP1+pn) ); MESSAGEMAN->Broadcast( (MessageID)(Message_MenuStartP1+pn) );
this->PostScreenMessage( SM_BeginFadingOut, fSecs );// tell our owner it's time to move on this->PostScreenMessage( SM_BeginFadingOut, fSecs );// tell our owner it's time to move on
} }
return true;
} }
/* We want all items to always run OnCommand and either GainFocus or LoseFocus /* We want all items to always run OnCommand and either GainFocus or LoseFocus
+5 -5
View File
@@ -30,11 +30,11 @@ public:
virtual RString GetDefaultChoice(); virtual RString GetDefaultChoice();
virtual void BeginScreen(); virtual void BeginScreen();
virtual void MenuLeft( const InputEventPlus &input ); virtual bool MenuLeft( const InputEventPlus &input );
virtual void MenuRight( const InputEventPlus &input ); virtual bool MenuRight( const InputEventPlus &input );
virtual void MenuUp( const InputEventPlus &input ); virtual bool MenuUp( const InputEventPlus &input );
virtual void MenuDown( const InputEventPlus &input ); virtual bool MenuDown( const InputEventPlus &input );
virtual void MenuStart( const InputEventPlus &input ); virtual bool MenuStart( const InputEventPlus &input );
virtual void TweenOnScreen(); virtual void TweenOnScreen();
virtual void TweenOffScreen(); virtual void TweenOffScreen();
+34 -35
View File
@@ -392,7 +392,7 @@ void ScreenSelectMusic::Update( float fDeltaTime )
CheckBackgroundRequests( false ); CheckBackgroundRequests( false );
} }
void ScreenSelectMusic::Input( const InputEventPlus &input ) bool ScreenSelectMusic::Input( const InputEventPlus &input )
{ {
// HACK: This screen eats mouse inputs if we don't check for them first. // HACK: This screen eats mouse inputs if we don't check for them first.
bool mouse_evt = false; bool mouse_evt = false;
@@ -403,8 +403,7 @@ void ScreenSelectMusic::Input( const InputEventPlus &input )
} }
if (mouse_evt) if (mouse_evt)
{ {
ScreenWithMenuElements::Input(input); return ScreenWithMenuElements::Input(input);
return;
} }
// LOG->Trace( "ScreenSelectMusic::Input()" ); // LOG->Trace( "ScreenSelectMusic::Input()" );
@@ -416,11 +415,11 @@ void ScreenSelectMusic::Input( const InputEventPlus &input )
if( input.DeviceI.device == DEVICE_KEYBOARD && input.DeviceI.button == KEY_F9 ) if( input.DeviceI.device == DEVICE_KEYBOARD && input.DeviceI.button == KEY_F9 )
{ {
if( input.type != IET_FIRST_PRESS ) if( input.type != IET_FIRST_PRESS )
return; return false;
PREFSMAN->m_bShowNativeLanguage.Set( !PREFSMAN->m_bShowNativeLanguage ); PREFSMAN->m_bShowNativeLanguage.Set( !PREFSMAN->m_bShowNativeLanguage );
MESSAGEMAN->Broadcast( "DisplayLanguageChanged" ); MESSAGEMAN->Broadcast( "DisplayLanguageChanged" );
m_MusicWheel.RebuildWheelItems(); m_MusicWheel.RebuildWheelItems();
return; return true;
} }
if( !IsTransitioning() && m_SelectionState != SelectionState_Finalized ) if( !IsTransitioning() && m_SelectionState != SelectionState_Finalized )
@@ -454,20 +453,20 @@ void ScreenSelectMusic::Input( const InputEventPlus &input )
m_MusicWheel.ChangeSort( so ); m_MusicWheel.ChangeSort( so );
m_MusicWheel.SetOpenSection( ssprintf("%c", c ) ); m_MusicWheel.SetOpenSection( ssprintf("%c", c ) );
AfterMusicChange(); AfterMusicChange();
return; return true;
} }
} }
} }
if( !input.GameI.IsValid() ) if( !input.GameI.IsValid() )
return; // don't care return false; // don't care
// Handle late joining // Handle late joining
if( m_SelectionState != SelectionState_Finalized && input.MenuI == GAME_BUTTON_START && input.type == IET_FIRST_PRESS && GAMESTATE->JoinInput(input.pn) ) if( m_SelectionState != SelectionState_Finalized && input.MenuI == GAME_BUTTON_START && input.type == IET_FIRST_PRESS && GAMESTATE->JoinInput(input.pn) )
return; // don't handle this press again below return true; // don't handle this press again below
if( !GAMESTATE->IsHumanPlayer(input.pn) ) if( !GAMESTATE->IsHumanPlayer(input.pn) )
return; return false;
// Check for "Press START again for options" button press // Check for "Press START again for options" button press
if( m_SelectionState == SelectionState_Finalized && if( m_SelectionState == SelectionState_Finalized &&
@@ -476,13 +475,13 @@ void ScreenSelectMusic::Input( const InputEventPlus &input )
OPTIONS_MENU_AVAILABLE.GetValue() ) OPTIONS_MENU_AVAILABLE.GetValue() )
{ {
if( m_bGoToOptions ) if( m_bGoToOptions )
return; // got it already return false; // got it already
if( !m_bAllowOptionsMenu ) if( !m_bAllowOptionsMenu )
return; // not allowed return false; // not allowed
if( !m_bAllowOptionsMenuRepeat && input.type == IET_REPEAT ) if( !m_bAllowOptionsMenuRepeat && input.type == IET_REPEAT )
{ {
return; // not allowed yet return false; // not allowed yet
} }
m_bGoToOptions = true; m_bGoToOptions = true;
@@ -495,11 +494,11 @@ void ScreenSelectMusic::Input( const InputEventPlus &input )
this->ClearMessageQueue( SM_BeginFadingOut ); this->ClearMessageQueue( SM_BeginFadingOut );
this->PostScreenMessage( SM_BeginFadingOut, this->GetTweenTimeLeft() ); this->PostScreenMessage( SM_BeginFadingOut, this->GetTweenTimeLeft() );
return; return true;
} }
if( IsTransitioning() ) if( IsTransitioning() )
return; // ignore return false; // ignore
// Handle unselect steps // Handle unselect steps
// xxx: select button could conflict with OptionsList here -aj // xxx: select button could conflict with OptionsList here -aj
@@ -510,12 +509,12 @@ void ScreenSelectMusic::Input( const InputEventPlus &input )
msg.SetParam( "Player", input.pn ); msg.SetParam( "Player", input.pn );
MESSAGEMAN->Broadcast( msg ); MESSAGEMAN->Broadcast( msg );
m_bStepsChosen[input.pn] = false; m_bStepsChosen[input.pn] = false;
return; return true;
} }
if( m_SelectionState == SelectionState_Finalized || if( m_SelectionState == SelectionState_Finalized ||
m_bStepsChosen[input.pn] ) m_bStepsChosen[input.pn] )
return; // ignore return false; // ignore
if( USE_PLAYER_SELECT_MENU ) if( USE_PLAYER_SELECT_MENU )
{ {
@@ -533,9 +532,7 @@ void ScreenSelectMusic::Input( const InputEventPlus &input )
{ {
if( m_OptionsList[pn].IsOpened() ) if( m_OptionsList[pn].IsOpened() )
{ {
m_OptionsList[pn].Input( input ); return m_OptionsList[pn].Input( input );
return;
} }
else else
{ {
@@ -587,7 +584,7 @@ void ScreenSelectMusic::Input( const InputEventPlus &input )
g_CanOpenOptionsList.Touch(); g_CanOpenOptionsList.Touch();
if( g_CanOpenOptionsList.Ago() > OPTIONS_LIST_TIMEOUT ) if( g_CanOpenOptionsList.Ago() > OPTIONS_LIST_TIMEOUT )
m_bAcceptSelectRelease[input.pn] = false; m_bAcceptSelectRelease[input.pn] = false;
return; return true;
} }
if( m_SelectionState == SelectionState_SelectingSong && if( m_SelectionState == SelectionState_SelectingSong &&
@@ -596,7 +593,7 @@ void ScreenSelectMusic::Input( const InputEventPlus &input )
{ {
// If we're rouletting, hands off. // If we're rouletting, hands off.
if( m_MusicWheel.IsRouletting() ) if( m_MusicWheel.IsRouletting() )
return; return false;
bool bLeftIsDown = false; bool bLeftIsDown = false;
bool bRightIsDown = false; bool bRightIsDown = false;
@@ -669,7 +666,7 @@ void ScreenSelectMusic::Input( const InputEventPlus &input )
{ {
// Avoid any event not being first press // Avoid any event not being first press
if( input.type != IET_FIRST_PRESS ) if( input.type != IET_FIRST_PRESS )
return; return false;
if( m_SelectionState == SelectionState_SelectingSong ) if( m_SelectionState == SelectionState_SelectingSong )
{ {
@@ -695,7 +692,7 @@ void ScreenSelectMusic::Input( const InputEventPlus &input )
if( CHANGE_GROUPS_WITH_GAME_BUTTONS ) if( CHANGE_GROUPS_WITH_GAME_BUTTONS )
{ {
if( input.type != IET_FIRST_PRESS) if( input.type != IET_FIRST_PRESS)
return; return false;
if( m_SelectionState == SelectionState_SelectingSong ) if( m_SelectionState == SelectionState_SelectingSong )
{ {
@@ -856,9 +853,9 @@ void ScreenSelectMusic::Input( const InputEventPlus &input )
} }
if( input.type == IET_FIRST_PRESS && DetectCodes(input) ) if( input.type == IET_FIRST_PRESS && DetectCodes(input) )
return; return true;
ScreenWithMenuElements::Input( input ); return ScreenWithMenuElements::Input( input );
} }
bool ScreenSelectMusic::DetectCodes( const InputEventPlus &input ) bool ScreenSelectMusic::DetectCodes( const InputEventPlus &input )
@@ -1168,21 +1165,21 @@ void ScreenSelectMusic::HandleScreenMessage( const ScreenMessage SM )
ScreenWithMenuElements::HandleScreenMessage( SM ); ScreenWithMenuElements::HandleScreenMessage( SM );
} }
void ScreenSelectMusic::MenuStart( const InputEventPlus &input ) bool ScreenSelectMusic::MenuStart( const InputEventPlus &input )
{ {
if( input.type != IET_FIRST_PRESS ) if( input.type != IET_FIRST_PRESS )
return; return false;
/* If select is being pressed at the same time, this is probably an attempt /* If select is being pressed at the same time, this is probably an attempt
* to change the sort, not to pick a song or difficulty. If it gets here, * to change the sort, not to pick a song or difficulty. If it gets here,
* the actual select press was probably hit during a tween and ignored. * the actual select press was probably hit during a tween and ignored.
* Ignore it. */ * Ignore it. */
if( input.pn != PLAYER_INVALID && INPUTMAPPER->IsBeingPressed(GAME_BUTTON_SELECT, input.pn) ) if( input.pn != PLAYER_INVALID && INPUTMAPPER->IsBeingPressed(GAME_BUTTON_SELECT, input.pn) )
return; return false;
// Honor locked input for start presses. // Honor locked input for start presses.
if( m_fLockInputSecs > 0 ) if( m_fLockInputSecs > 0 )
return; return false;
switch( m_SelectionState ) switch( m_SelectionState )
{ {
@@ -1190,7 +1187,7 @@ void ScreenSelectMusic::MenuStart( const InputEventPlus &input )
case SelectionState_SelectingSong: case SelectionState_SelectingSong:
// If false, we don't have a selection just yet. // If false, we don't have a selection just yet.
if( !m_MusicWheel.Select() ) if( !m_MusicWheel.Select() )
return; return false;
// a song was selected // a song was selected
if( m_MusicWheel.GetSelectedSong() != NULL ) if( m_MusicWheel.GetSelectedSong() != NULL )
@@ -1258,7 +1255,7 @@ void ScreenSelectMusic::MenuStart( const InputEventPlus &input )
else else
{ {
// We haven't made a selection yet. // We haven't made a selection yet.
return; return false;
} }
// I believe this is for those who like pump pro. -aj // I believe this is for those who like pump pro. -aj
MESSAGEMAN->Broadcast("SongChosen"); MESSAGEMAN->Broadcast("SongChosen");
@@ -1355,7 +1352,7 @@ void ScreenSelectMusic::MenuStart( const InputEventPlus &input )
{ {
/* They selected non-Routine steps, so we can't /* They selected non-Routine steps, so we can't
* select Routine steps. */ * select Routine steps. */
return; return false;
} }
} }
} }
@@ -1371,7 +1368,7 @@ void ScreenSelectMusic::MenuStart( const InputEventPlus &input )
Message msg("StepsChosen"); Message msg("StepsChosen");
msg.SetParam( "Player", pn ); msg.SetParam( "Player", pn );
MESSAGEMAN->Broadcast( msg ); MESSAGEMAN->Broadcast( msg );
return; return true;
} }
} }
break; break;
@@ -1485,10 +1482,11 @@ void ScreenSelectMusic::MenuStart( const InputEventPlus &input )
m_MenuTimer->Start(); m_MenuTimer->Start();
} }
} }
return true;
} }
void ScreenSelectMusic::MenuBack( const InputEventPlus & /* input */ ) bool ScreenSelectMusic::MenuBack( const InputEventPlus & /* input */ )
{ {
// Handle unselect song (ffff) // Handle unselect song (ffff)
// todo: this isn't right at all. -aj // todo: this isn't right at all. -aj
@@ -1506,13 +1504,14 @@ void ScreenSelectMusic::MenuBack( const InputEventPlus & /* input */ )
msg.SetParam( "Player", input.pn ); msg.SetParam( "Player", input.pn );
MESSAGEMAN->Broadcast( msg ); MESSAGEMAN->Broadcast( msg );
m_SelectionState = SelectionState_SelectingSong; m_SelectionState = SelectionState_SelectingSong;
return; return true;
} }
*/ */
m_BackgroundLoader.Abort(); m_BackgroundLoader.Abort();
Cancel( SM_GoToPrevScreen ); Cancel( SM_GoToPrevScreen );
return true;
} }
void ScreenSelectMusic::AfterStepsOrTrailChange( const vector<PlayerNumber> &vpns ) void ScreenSelectMusic::AfterStepsOrTrailChange( const vector<PlayerNumber> &vpns )
+3 -3
View File
@@ -33,13 +33,13 @@ public:
virtual void BeginScreen(); virtual void BeginScreen();
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime );
virtual void Input( const InputEventPlus &input ); virtual bool Input( const InputEventPlus &input );
virtual void HandleMessage( const Message &msg ); virtual void HandleMessage( const Message &msg );
virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void HandleScreenMessage( const ScreenMessage SM );
virtual bool AllowLateJoin() const { return true; } virtual bool AllowLateJoin() const { return true; }
virtual void MenuStart( const InputEventPlus &input ); virtual bool MenuStart( const InputEventPlus &input );
virtual void MenuBack( const InputEventPlus &input ); virtual bool MenuBack( const InputEventPlus &input );
// ScreenWithMenuElements override: never play music here; we do it ourself. // ScreenWithMenuElements override: never play music here; we do it ourself.
virtual void StartPlayingMusic() { } virtual void StartPlayingMusic() { }
+27 -23
View File
@@ -19,92 +19,96 @@ void ScreenSelectProfile::Init()
ScreenWithMenuElements::Init(); ScreenWithMenuElements::Init();
} }
void ScreenSelectProfile::Input( const InputEventPlus &input ) bool ScreenSelectProfile::Input( const InputEventPlus &input )
{ {
if( IsTransitioning() ) if( IsTransitioning() )
return; return false;
ScreenWithMenuElements::Input( input ); return ScreenWithMenuElements::Input( input );
} }
void ScreenSelectProfile::MenuLeft( const InputEventPlus &input ) bool ScreenSelectProfile::MenuLeft( const InputEventPlus &input )
{ {
PlayerNumber pn = input.pn; PlayerNumber pn = input.pn;
if( m_fLockInputSecs > 0 ) if( m_fLockInputSecs > 0 )
return; return false;
if( input.type == IET_RELEASE ) if( input.type == IET_RELEASE )
return; return false;
if( input.type != IET_FIRST_PRESS ) if( input.type != IET_FIRST_PRESS )
{ {
/* /*
if( !ALLOW_REPEATING_INPUT ) if( !ALLOW_REPEATING_INPUT )
return; return false;
*/ */
if( m_TrackingRepeatingInput != input.MenuI ) if( m_TrackingRepeatingInput != input.MenuI )
return; return false;
} }
m_TrackingRepeatingInput = input.MenuI; m_TrackingRepeatingInput = input.MenuI;
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuLeftP1+pn) ); MESSAGEMAN->Broadcast( (MessageID)(Message_MenuLeftP1+pn) );
return true;
} }
void ScreenSelectProfile::MenuRight( const InputEventPlus &input ) bool ScreenSelectProfile::MenuRight( const InputEventPlus &input )
{ {
PlayerNumber pn = input.pn; PlayerNumber pn = input.pn;
if( m_fLockInputSecs > 0 ) if( m_fLockInputSecs > 0 )
return; return false;
if( input.type == IET_RELEASE ) if( input.type == IET_RELEASE )
return; return false;
if( input.type != IET_FIRST_PRESS ) if( input.type != IET_FIRST_PRESS )
{ {
/* /*
if( !ALLOW_REPEATING_INPUT ) if( !ALLOW_REPEATING_INPUT )
return; return false;
*/ */
if( m_TrackingRepeatingInput != input.MenuI ) if( m_TrackingRepeatingInput != input.MenuI )
return; return false;
} }
m_TrackingRepeatingInput = input.MenuI; m_TrackingRepeatingInput = input.MenuI;
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuRightP1+pn) ); MESSAGEMAN->Broadcast( (MessageID)(Message_MenuRightP1+pn) );
return true;
} }
void ScreenSelectProfile::MenuUp( const InputEventPlus &input ) bool ScreenSelectProfile::MenuUp( const InputEventPlus &input )
{ {
PlayerNumber pn = input.pn; PlayerNumber pn = input.pn;
if( m_fLockInputSecs > 0 ) if( m_fLockInputSecs > 0 )
return; return false;
if( input.type == IET_RELEASE ) if( input.type == IET_RELEASE )
return; return false;
if( input.type != IET_FIRST_PRESS ) if( input.type != IET_FIRST_PRESS )
{ {
/* /*
if( !ALLOW_REPEATING_INPUT ) if( !ALLOW_REPEATING_INPUT )
return; return false;
*/ */
if( m_TrackingRepeatingInput != input.MenuI ) if( m_TrackingRepeatingInput != input.MenuI )
return; return false;
} }
m_TrackingRepeatingInput = input.MenuI; m_TrackingRepeatingInput = input.MenuI;
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuUpP1+pn) ); MESSAGEMAN->Broadcast( (MessageID)(Message_MenuUpP1+pn) );
return true;
} }
void ScreenSelectProfile::MenuDown( const InputEventPlus &input ) bool ScreenSelectProfile::MenuDown( const InputEventPlus &input )
{ {
PlayerNumber pn = input.pn; PlayerNumber pn = input.pn;
if( m_fLockInputSecs > 0 ) if( m_fLockInputSecs > 0 )
return; return false;
if( input.type == IET_RELEASE ) if( input.type == IET_RELEASE )
return; return false;
if( input.type != IET_FIRST_PRESS ) if( input.type != IET_FIRST_PRESS )
{ {
/* /*
if( !ALLOW_REPEATING_INPUT ) if( !ALLOW_REPEATING_INPUT )
return; return false;
*/ */
if( m_TrackingRepeatingInput != input.MenuI ) if( m_TrackingRepeatingInput != input.MenuI )
return; return false;
} }
m_TrackingRepeatingInput = input.MenuI; m_TrackingRepeatingInput = input.MenuI;
MESSAGEMAN->Broadcast( (MessageID)(Message_MenuDownP1+pn) ); MESSAGEMAN->Broadcast( (MessageID)(Message_MenuDownP1+pn) );
return true;
} }
bool ScreenSelectProfile::SetProfileIndex( PlayerNumber pn, int iProfileIndex ) bool ScreenSelectProfile::SetProfileIndex( PlayerNumber pn, int iProfileIndex )
+5 -5
View File
@@ -9,11 +9,11 @@ class ScreenSelectProfile : public ScreenWithMenuElements
{ {
public: public:
virtual void Init(); virtual void Init();
virtual void Input( const InputEventPlus &input ); virtual bool Input( const InputEventPlus &input );
virtual void MenuLeft( const InputEventPlus &input ); virtual bool MenuLeft( const InputEventPlus &input );
virtual void MenuRight( const InputEventPlus &input ); virtual bool MenuRight( const InputEventPlus &input );
virtual void MenuUp( const InputEventPlus &input ); virtual bool MenuUp( const InputEventPlus &input );
virtual void MenuDown( const InputEventPlus &input ); virtual bool MenuDown( const InputEventPlus &input );
virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void HandleScreenMessage( const ScreenMessage SM );
GameButton m_TrackingRepeatingInput; GameButton m_TrackingRepeatingInput;
+18 -11
View File
@@ -100,15 +100,15 @@ void ScreenSetTime::Update( float fDelta )
m_textValue[day] .SetText( ssprintf("%02d",now.tm_mday) ); m_textValue[day] .SetText( ssprintf("%02d",now.tm_mday) );
} }
void ScreenSetTime::Input( const InputEventPlus &input ) bool ScreenSetTime::Input( const InputEventPlus &input )
{ {
if( input.type != IET_FIRST_PRESS && input.type != IET_REPEAT ) if( input.type != IET_FIRST_PRESS && input.type != IET_REPEAT )
return; // ignore return false; // ignore
if( IsTransitioning() ) if( IsTransitioning() )
return; return false;
Screen::Input( input ); // default handler return Screen::Input( input ); // default handler
} }
void ScreenSetTime::ChangeValue( int iDirection ) void ScreenSetTime::ChangeValue( int iDirection )
@@ -159,27 +159,31 @@ void ScreenSetTime::ChangeSelection( int iDirection )
m_soundChangeSelection.Play(); m_soundChangeSelection.Play();
} }
void ScreenSetTime::MenuUp( const InputEventPlus &input ) bool ScreenSetTime::MenuUp( const InputEventPlus &input )
{ {
ChangeSelection( -1 ); ChangeSelection( -1 );
return true;
} }
void ScreenSetTime::MenuDown( const InputEventPlus &input ) bool ScreenSetTime::MenuDown( const InputEventPlus &input )
{ {
ChangeSelection( +1 ); ChangeSelection( +1 );
return true;
} }
void ScreenSetTime::MenuLeft( const InputEventPlus &input ) bool ScreenSetTime::MenuLeft( const InputEventPlus &input )
{ {
ChangeValue( -1 ); ChangeValue( -1 );
return true;
} }
void ScreenSetTime::MenuRight( const InputEventPlus &input ) bool ScreenSetTime::MenuRight( const InputEventPlus &input )
{ {
ChangeValue( +1 ); ChangeValue( +1 );
return true;
} }
void ScreenSetTime::MenuStart( const InputEventPlus &input ) bool ScreenSetTime::MenuStart( const InputEventPlus &input )
{ {
bool bHoldingLeftAndRight = bool bHoldingLeftAndRight =
INPUTMAPPER->IsBeingPressed( GAME_BUTTON_RIGHT, input.pn ) && INPUTMAPPER->IsBeingPressed( GAME_BUTTON_RIGHT, input.pn ) &&
@@ -218,16 +222,19 @@ void ScreenSetTime::MenuStart( const InputEventPlus &input )
} }
else else
ChangeSelection( +1 ); ChangeSelection( +1 );
return true;
} }
void ScreenSetTime::MenuSelect( const InputEventPlus &input ) bool ScreenSetTime::MenuSelect( const InputEventPlus &input )
{ {
ChangeSelection( -1 ); ChangeSelection( -1 );
return true;
} }
void ScreenSetTime::MenuBack( const InputEventPlus &input ) bool ScreenSetTime::MenuBack( const InputEventPlus &input )
{ {
StartTransitioningScreen( SM_GoToPrevScreen ); StartTransitioningScreen( SM_GoToPrevScreen );
return true;
} }
/* /*
+8 -8
View File
@@ -23,15 +23,15 @@ public:
virtual void Init(); virtual void Init();
virtual void Update( float fDelta ); virtual void Update( float fDelta );
virtual void Input( const InputEventPlus &input ); virtual bool Input( const InputEventPlus &input );
virtual void MenuUp( const InputEventPlus &input ); virtual bool MenuUp( const InputEventPlus &input );
virtual void MenuDown( const InputEventPlus &input ); virtual bool MenuDown( const InputEventPlus &input );
virtual void MenuLeft( const InputEventPlus &input ); virtual bool MenuLeft( const InputEventPlus &input );
virtual void MenuRight( const InputEventPlus &input ); virtual bool MenuRight( const InputEventPlus &input );
virtual void MenuStart( const InputEventPlus &input ); virtual bool MenuStart( const InputEventPlus &input );
virtual void MenuSelect( const InputEventPlus &input ); virtual bool MenuSelect( const InputEventPlus &input );
virtual void MenuBack( const InputEventPlus &input ); virtual bool MenuBack( const InputEventPlus &input );
private: private:
SetTimeSelection m_Selection; SetTimeSelection m_Selection;
+6 -4
View File
@@ -34,18 +34,20 @@ void ScreenSplash::HandleScreenMessage( const ScreenMessage SM )
ScreenWithMenuElements::HandleScreenMessage( SM ); ScreenWithMenuElements::HandleScreenMessage( SM );
} }
void ScreenSplash::MenuBack( const InputEventPlus &input ) bool ScreenSplash::MenuBack( const InputEventPlus &input )
{ {
Cancel( SM_GoToPrevScreen ); Cancel( SM_GoToPrevScreen );
return true;
} }
void ScreenSplash::MenuStart( const InputEventPlus &input ) bool ScreenSplash::MenuStart( const InputEventPlus &input )
{ {
if( IsTransitioning() ) if( IsTransitioning() )
return; return false;
if( !ALLOW_START_TO_SKIP ) if( !ALLOW_START_TO_SKIP )
return; return false;
StartTransitioningScreen( SM_GoToNextScreen ); StartTransitioningScreen( SM_GoToNextScreen );
return true;
} }
/* /*
+2 -2
View File
@@ -13,8 +13,8 @@ public:
virtual void BeginScreen(); virtual void BeginScreen();
virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void HandleScreenMessage( const ScreenMessage SM );
virtual void MenuBack( const InputEventPlus &input ); virtual bool MenuBack( const InputEventPlus &input );
virtual void MenuStart( const InputEventPlus &input ); virtual bool MenuStart( const InputEventPlus &input );
protected: protected:
ThemeMetric<bool> ALLOW_START_TO_SKIP; ThemeMetric<bool> ALLOW_START_TO_SKIP;
+13 -11
View File
@@ -90,9 +90,10 @@ REGISTER_ACTOR_CLASS( InputList );
REGISTER_SCREEN_CLASS( ScreenTestInput ); REGISTER_SCREEN_CLASS( ScreenTestInput );
void ScreenTestInput::Input( const InputEventPlus &input ) bool ScreenTestInput::Input( const InputEventPlus &input )
{ {
RString sMessage = input.DeviceI.ToString(); RString sMessage = input.DeviceI.ToString();
bool bHandled = false;
switch( input.type ) switch( input.type )
{ {
case IET_FIRST_PRESS: case IET_FIRST_PRESS:
@@ -105,29 +106,30 @@ void ScreenTestInput::Input( const InputEventPlus &input )
default: break; default: break;
} }
MESSAGEMAN->Broadcast( sMessage ); MESSAGEMAN->Broadcast( sMessage );
bHandled = true;
break; break;
} }
default: break; default: break;
} }
Screen::Input( input ); // default handler return Screen::Input( input ) || bHandled; // default handler
} }
void ScreenTestInput::MenuStart( const InputEventPlus &input ) bool ScreenTestInput::MenuStart( const InputEventPlus &input )
{ {
MenuBack( input ); return MenuBack( input );
} }
void ScreenTestInput::MenuBack( const InputEventPlus &input ) bool ScreenTestInput::MenuBack( const InputEventPlus &input )
{ {
if( input.type != IET_REPEAT ) if( input.type != IET_REPEAT )
return; // ignore return false; // ignore
if( !IsTransitioning() ) if( IsTransitioning() )
{ return false;
SCREENMAN->PlayStartSound(); SCREENMAN->PlayStartSound();
StartTransitioningScreen( SM_GoToPrevScreen ); StartTransitioningScreen( SM_GoToPrevScreen );
} return true;
} }
/* /*
+3 -3
View File
@@ -10,10 +10,10 @@
class ScreenTestInput : public ScreenWithMenuElements class ScreenTestInput : public ScreenWithMenuElements
{ {
public: public:
virtual void Input( const InputEventPlus &input ); virtual bool Input( const InputEventPlus &input );
virtual void MenuStart( const InputEventPlus &input ); virtual bool MenuStart( const InputEventPlus &input );
virtual void MenuBack( const InputEventPlus &input ); virtual bool MenuBack( const InputEventPlus &input );
}; };
#endif #endif
+15 -13
View File
@@ -88,15 +88,15 @@ void ScreenTestLights::Update( float fDeltaTime )
} }
void ScreenTestLights::Input( const InputEventPlus &input ) bool ScreenTestLights::Input( const InputEventPlus &input )
{ {
if( input.type != IET_FIRST_PRESS && input.type != IET_REPEAT ) if( input.type != IET_FIRST_PRESS && input.type != IET_REPEAT )
return; // ignore return false; // ignore
ScreenWithMenuElements::Input( input ); // default handler return ScreenWithMenuElements::Input( input ); // default handler
} }
void ScreenTestLights::MenuLeft( const InputEventPlus &input ) bool ScreenTestLights::MenuLeft( const InputEventPlus &input )
{ {
if( LIGHTSMAN->GetLightsMode() != LIGHTSMODE_TEST_MANUAL_CYCLE ) if( LIGHTSMAN->GetLightsMode() != LIGHTSMODE_TEST_MANUAL_CYCLE )
LIGHTSMAN->SetLightsMode( LIGHTSMODE_TEST_MANUAL_CYCLE ); LIGHTSMAN->SetLightsMode( LIGHTSMODE_TEST_MANUAL_CYCLE );
@@ -105,9 +105,10 @@ void ScreenTestLights::MenuLeft( const InputEventPlus &input )
else else
LIGHTSMAN->PrevTestGameButtonLight(); LIGHTSMAN->PrevTestGameButtonLight();
m_timerBackToAutoCycle.Touch(); m_timerBackToAutoCycle.Touch();
return true;
} }
void ScreenTestLights::MenuRight( const InputEventPlus &input ) bool ScreenTestLights::MenuRight( const InputEventPlus &input )
{ {
if( LIGHTSMAN->GetLightsMode() != LIGHTSMODE_TEST_MANUAL_CYCLE ) if( LIGHTSMAN->GetLightsMode() != LIGHTSMODE_TEST_MANUAL_CYCLE )
LIGHTSMAN->SetLightsMode( LIGHTSMODE_TEST_MANUAL_CYCLE ); LIGHTSMAN->SetLightsMode( LIGHTSMODE_TEST_MANUAL_CYCLE );
@@ -116,20 +117,21 @@ void ScreenTestLights::MenuRight( const InputEventPlus &input )
else else
LIGHTSMAN->NextTestGameButtonLight(); LIGHTSMAN->NextTestGameButtonLight();
m_timerBackToAutoCycle.Touch(); m_timerBackToAutoCycle.Touch();
return true;
} }
void ScreenTestLights::MenuStart( const InputEventPlus &input ) bool ScreenTestLights::MenuStart( const InputEventPlus &input )
{ {
MenuBack( input ); return MenuBack( input );
} }
void ScreenTestLights::MenuBack( const InputEventPlus &input ) bool ScreenTestLights::MenuBack( const InputEventPlus &input )
{ {
if( !IsTransitioning() ) if( IsTransitioning() )
{ return false;
SCREENMAN->PlayStartSound(); SCREENMAN->PlayStartSound();
StartTransitioningScreen( SM_GoToPrevScreen ); StartTransitioningScreen( SM_GoToPrevScreen );
} return true;
} }
/* /*
+5 -5
View File
@@ -13,12 +13,12 @@ public:
virtual void EndScreen(); virtual void EndScreen();
virtual void Update( float fDelta ); virtual void Update( float fDelta );
virtual void Input( const InputEventPlus &input ); virtual bool Input( const InputEventPlus &input );
virtual void MenuLeft( const InputEventPlus &input ); virtual bool MenuLeft( const InputEventPlus &input );
virtual void MenuRight( const InputEventPlus &input ); virtual bool MenuRight( const InputEventPlus &input );
virtual void MenuStart( const InputEventPlus &input ); virtual bool MenuStart( const InputEventPlus &input );
virtual void MenuBack( const InputEventPlus &input ); virtual bool MenuBack( const InputEventPlus &input );
private: private:
BitmapText m_textInputs; BitmapText m_textInputs;
+7 -5
View File
@@ -127,10 +127,10 @@ void ScreenTestSound::Update(float f)
} }
} }
void ScreenTestSound::Input( const InputEventPlus &input ) bool ScreenTestSound::Input( const InputEventPlus &input )
{ {
if( input.type != IET_FIRST_PRESS ) if( input.type != IET_FIRST_PRESS )
return; // ignore return false; // ignore
switch( input.DeviceI.device ) switch( input.DeviceI.device )
{ {
@@ -197,11 +197,13 @@ void ScreenTestSound::Input( const InputEventPlus &input )
obj.SetY(obj.GetY() + 10); obj.SetY(obj.GetY() + 10);
break; break;
*/ */
default: break; default:
return false;
} }
default: break; default:
return false;
} }
return true;
} }
/* /*
+1 -1
View File
@@ -14,7 +14,7 @@ public:
virtual void Init(); virtual void Init();
~ScreenTestSound(); ~ScreenTestSound();
virtual void Input( const InputEventPlus &input ); virtual bool Input( const InputEventPlus &input );
void Update(float f); void Update(float f);
void UpdateText(int n); void UpdateText(int n);
+49 -10
View File
@@ -191,11 +191,12 @@ void ScreenTextEntry::Update( float fDelta )
} }
} }
void ScreenTextEntry::Input( const InputEventPlus &input ) bool ScreenTextEntry::Input( const InputEventPlus &input )
{ {
if( IsTransitioning() ) if( IsTransitioning() )
return; return false;
bool bHandled = false;
if( input.DeviceI == DeviceInput(DEVICE_KEYBOARD, KEY_BACK) ) if( input.DeviceI == DeviceInput(DEVICE_KEYBOARD, KEY_BACK) )
{ {
switch( input.type ) switch( input.type )
@@ -203,6 +204,7 @@ void ScreenTextEntry::Input( const InputEventPlus &input )
case IET_FIRST_PRESS: case IET_FIRST_PRESS:
case IET_REPEAT: case IET_REPEAT:
BackspaceInAnswer(); BackspaceInAnswer();
bHandled = true;
default: default:
break; break;
} }
@@ -216,10 +218,11 @@ void ScreenTextEntry::Input( const InputEventPlus &input )
TryAppendToAnswer( WStringToRString(wstring()+c) ); TryAppendToAnswer( WStringToRString(wstring()+c) );
TextEnteredDirectly(); TextEnteredDirectly();
bHandled = true;
} }
} }
ScreenWithMenuElements::Input( input ); return ScreenWithMenuElements::Input( input ) || bHandled;
} }
void ScreenTextEntry::TryAppendToAnswer( RString s ) void ScreenTextEntry::TryAppendToAnswer( RString s )
@@ -257,11 +260,15 @@ void ScreenTextEntry::BackspaceInAnswer()
UpdateAnswerText(); UpdateAnswerText();
} }
void ScreenTextEntry::MenuStart( const InputEventPlus &input ) bool ScreenTextEntry::MenuStart( const InputEventPlus &input )
{ {
// HACK: Only allow the screen to end on the Enter key.-aj // HACK: Only allow the screen to end on the Enter key.-aj
if( input.DeviceI == DeviceInput(DEVICE_KEYBOARD, KEY_ENTER) && input.type==IET_FIRST_PRESS ) if( input.DeviceI == DeviceInput(DEVICE_KEYBOARD, KEY_ENTER) && input.type==IET_FIRST_PRESS )
{
End( false ); End( false );
return true;
}
return false;
} }
void ScreenTextEntry::End( bool bCancelled ) void ScreenTextEntry::End( bool bCancelled )
@@ -303,10 +310,12 @@ void ScreenTextEntry::End( bool bCancelled )
s_sLastAnswer = bCancelled ? RString("") : WStringToRString(m_sAnswer); s_sLastAnswer = bCancelled ? RString("") : WStringToRString(m_sAnswer);
} }
void ScreenTextEntry::MenuBack( const InputEventPlus &input ) bool ScreenTextEntry::MenuBack( const InputEventPlus &input )
{ {
if( input.type == IET_FIRST_PRESS ) if( input.type != IET_FIRST_PRESS )
End( true ); return false;
End( true );
return true;
} }
void ScreenTextEntry::TextEntrySettings::FromStack( lua_State *L ) void ScreenTextEntry::TextEntrySettings::FromStack( lua_State *L )
@@ -698,10 +707,39 @@ void ScreenTextEntryVisual::MoveY( int iDir )
PositionCursor(); PositionCursor();
} }
void ScreenTextEntryVisual::MenuStart( const InputEventPlus &input ) bool ScreenTextEntryVisual::MenuLeft( const InputEventPlus &input )
{ {
if( input.type != IET_FIRST_PRESS ) if( input.type != IET_FIRST_PRESS )
return; return false;
MoveX(-1);
return true;
}
bool ScreenTextEntryVisual::MenuRight( const InputEventPlus &input )
{
if( input.type != IET_FIRST_PRESS )
return false;
MoveX(+1);
return true;
}
bool ScreenTextEntryVisual::MenuUp( const InputEventPlus &input )
{
if( input.type != IET_FIRST_PRESS )
return false;
MoveY(-1);
return true;
}
bool ScreenTextEntryVisual::MenuDown( const InputEventPlus &input )
{
if( input.type != IET_FIRST_PRESS )
return false;
MoveY(+1);
return true;
}
bool ScreenTextEntryVisual::MenuStart( const InputEventPlus &input )
{
if( input.type != IET_FIRST_PRESS )
return false;
if( m_iFocusY == KEYBOARD_ROW_SPECIAL ) if( m_iFocusY == KEYBOARD_ROW_SPECIAL )
{ {
switch( m_iFocusX ) switch( m_iFocusX )
@@ -719,13 +757,14 @@ void ScreenTextEntryVisual::MenuStart( const InputEventPlus &input )
End( false ); End( false );
break; break;
default: default:
break; return false;
} }
} }
else else
{ {
TryAppendToAnswer( g_szKeys[m_iFocusY][m_iFocusX] ); TryAppendToAnswer( g_szKeys[m_iFocusY][m_iFocusX] );
} }
return true;
} }
/* /*
+8 -8
View File
@@ -102,7 +102,7 @@ public:
virtual void BeginScreen(); virtual void BeginScreen();
virtual void Update( float fDelta ); virtual void Update( float fDelta );
virtual void Input( const InputEventPlus &input ); virtual bool Input( const InputEventPlus &input );
static RString s_sLastAnswer; static RString s_sLastAnswer;
static bool s_bCancelledLast; static bool s_bCancelledLast;
@@ -117,8 +117,8 @@ protected:
virtual void End( bool bCancelled ); virtual void End( bool bCancelled );
private: private:
virtual void MenuStart( const InputEventPlus &input ); virtual bool MenuStart( const InputEventPlus &input );
virtual void MenuBack( const InputEventPlus &input ); virtual bool MenuBack( const InputEventPlus &input );
void UpdateAnswerText(); void UpdateAnswerText();
@@ -151,12 +151,12 @@ protected:
virtual void TextEnteredDirectly(); virtual void TextEnteredDirectly();
virtual void MenuLeft( const InputEventPlus &input ) { if(input.type==IET_FIRST_PRESS) MoveX(-1); } virtual bool MenuLeft( const InputEventPlus &input );
virtual void MenuRight( const InputEventPlus &input ) { if(input.type==IET_FIRST_PRESS) MoveX(+1); } virtual bool MenuRight( const InputEventPlus &input );
virtual void MenuUp( const InputEventPlus &input ) { if(input.type==IET_FIRST_PRESS) MoveY(-1); } virtual bool MenuUp( const InputEventPlus &input );
virtual void MenuDown( const InputEventPlus &input ) { if(input.type==IET_FIRST_PRESS) MoveY(+1); } virtual bool MenuDown( const InputEventPlus &input );
virtual void MenuStart( const InputEventPlus &input ); virtual bool MenuStart( const InputEventPlus &input );
int m_iFocusX; int m_iFocusX;
KeyboardRow m_iFocusY; KeyboardRow m_iFocusY;
+6 -3
View File
@@ -41,15 +41,16 @@ void ScreenTitleMenu::Init()
static LocalizedString THEME_ ("ScreenTitleMenu","Theme"); static LocalizedString THEME_ ("ScreenTitleMenu","Theme");
static LocalizedString ANNOUNCER_ ("ScreenTitleMenu","Announcer"); static LocalizedString ANNOUNCER_ ("ScreenTitleMenu","Announcer");
void ScreenTitleMenu::Input( const InputEventPlus &input ) bool ScreenTitleMenu::Input( const InputEventPlus &input )
{ {
#if defined(DEBUG) #if defined(DEBUG)
LOG->Trace( "ScreenTitleMenu::Input( %d-%d )", input.DeviceI.device, input.DeviceI.button ); // debugging gameport joystick problem LOG->Trace( "ScreenTitleMenu::Input( %d-%d )", input.DeviceI.device, input.DeviceI.button ); // debugging gameport joystick problem
#endif #endif
if( m_In.IsTransitioning() || m_Cancel.IsTransitioning() ) /* not m_Out */ if( m_In.IsTransitioning() || m_Cancel.IsTransitioning() ) /* not m_Out */
return; return false;
bool bHandled = false;
if( input.type == IET_FIRST_PRESS ) if( input.type == IET_FIRST_PRESS )
{ {
// detect codes // detect codes
@@ -57,6 +58,7 @@ void ScreenTitleMenu::Input( const InputEventPlus &input )
CodeDetector::EnteredCode(input.GameI.controller,CODE_NEXT_THEME2) ) CodeDetector::EnteredCode(input.GameI.controller,CODE_NEXT_THEME2) )
{ {
GameLoop::ChangeTheme( THEME->GetNextSelectableTheme(), m_sName ); GameLoop::ChangeTheme( THEME->GetNextSelectableTheme(), m_sName );
bHandled = true;
} }
if( CodeDetector::EnteredCode(input.GameI.controller,CODE_NEXT_ANNOUNCER) || if( CodeDetector::EnteredCode(input.GameI.controller,CODE_NEXT_ANNOUNCER) ||
CodeDetector::EnteredCode(input.GameI.controller,CODE_NEXT_ANNOUNCER2) ) CodeDetector::EnteredCode(input.GameI.controller,CODE_NEXT_ANNOUNCER2) )
@@ -66,10 +68,11 @@ void ScreenTitleMenu::Input( const InputEventPlus &input )
if( sName=="" ) sName = "(none)"; if( sName=="" ) sName = "(none)";
SCREENMAN->SystemMessage( ANNOUNCER_.GetValue()+": "+sName ); SCREENMAN->SystemMessage( ANNOUNCER_.GetValue()+": "+sName );
SCREENMAN->SetNewScreen( m_sName ); SCREENMAN->SetNewScreen( m_sName );
bHandled = true;
} }
} }
ScreenSelectMaster::Input( input ); return ScreenSelectMaster::Input( input ) || bHandled;
} }
void ScreenTitleMenu::HandleMessage( const Message &msg ) void ScreenTitleMenu::HandleMessage( const Message &msg )
+1 -1
View File
@@ -11,7 +11,7 @@ public:
ScreenTitleMenu(); ScreenTitleMenu();
virtual void Init(); virtual void Init();
virtual void Input( const InputEventPlus &input ); virtual bool Input( const InputEventPlus &input );
virtual void HandleMessage( const Message &msg ); virtual void HandleMessage( const Message &msg );
}; };
+2 -1
View File
@@ -46,10 +46,11 @@ void ScreenUnlockBrowse::BeginScreen()
HandleMessage( Message(MessageIDToString(Message_MenuSelectionChanged)) ); HandleMessage( Message(MessageIDToString(Message_MenuSelectionChanged)) );
} }
void ScreenUnlockBrowse::MenuStart( const InputEventPlus &input ) bool ScreenUnlockBrowse::MenuStart( const InputEventPlus &input )
{ {
m_soundStart.Play(); m_soundStart.Play();
this->PostScreenMessage( SM_BeginFadingOut, 0 ); this->PostScreenMessage( SM_BeginFadingOut, 0 );
return true;
} }
void ScreenUnlockBrowse::HandleMessage( const Message &msg ) void ScreenUnlockBrowse::HandleMessage( const Message &msg )
+1 -1
View File
@@ -9,7 +9,7 @@ class ScreenUnlockBrowse : public ScreenSelectMaster
public: public:
virtual void Init(); virtual void Init();
virtual void BeginScreen(); virtual void BeginScreen();
virtual void MenuStart( const InputEventPlus &input ); virtual bool MenuStart( const InputEventPlus &input );
virtual void HandleMessage( const Message &msg ); virtual void HandleMessage( const Message &msg );
+5 -5
View File
@@ -7,11 +7,11 @@ class ScreenUnlockCelebrate : public ScreenUnlockBrowse
{ {
public: public:
virtual void Init(); virtual void Init();
virtual void MenuLeft( const InputEventPlus &input ) { } virtual bool MenuLeft( const InputEventPlus &input ) { return false; }
virtual void MenuRight( const InputEventPlus &input ) { } virtual bool MenuRight( const InputEventPlus &input ) { return false; }
virtual void MenuUp( const InputEventPlus &input ) { } virtual bool MenuUp( const InputEventPlus &input ) { return false; }
virtual void MenuDown( const InputEventPlus &input ) { } virtual bool MenuDown( const InputEventPlus &input ) { return false; }
virtual void MenuBack( const InputEventPlus &input ) { MenuStart( input ); } virtual bool MenuBack( const InputEventPlus &input ) { return MenuStart( input ); }
protected: protected:
}; };
+8 -6
View File
@@ -347,24 +347,26 @@ void ScreenWithMenuElements::StopTimer()
REGISTER_SCREEN_CLASS( ScreenWithMenuElementsSimple ); REGISTER_SCREEN_CLASS( ScreenWithMenuElementsSimple );
void ScreenWithMenuElementsSimple::MenuStart( const InputEventPlus &input ) bool ScreenWithMenuElementsSimple::MenuStart( const InputEventPlus &input )
{ {
if( IsTransitioning() ) if( IsTransitioning() )
return; return false;
if( m_fLockInputSecs > 0 ) if( m_fLockInputSecs > 0 )
return; return false;
StartTransitioningScreen( SM_GoToNextScreen ); StartTransitioningScreen( SM_GoToNextScreen );
return true;
} }
void ScreenWithMenuElementsSimple::MenuBack( const InputEventPlus &input ) bool ScreenWithMenuElementsSimple::MenuBack( const InputEventPlus &input )
{ {
if( IsTransitioning() ) if( IsTransitioning() )
return; return false;
if( m_fLockInputSecs > 0 ) if( m_fLockInputSecs > 0 )
return; return false;
Cancel( SM_GoToPrevScreen ); Cancel( SM_GoToPrevScreen );
return true;
} }
// lua start // lua start
+2 -2
View File
@@ -62,8 +62,8 @@ private:
class ScreenWithMenuElementsSimple: public ScreenWithMenuElements class ScreenWithMenuElementsSimple: public ScreenWithMenuElements
{ {
public: public:
void MenuStart( const InputEventPlus &input ); bool MenuStart( const InputEventPlus &input );
void MenuBack( const InputEventPlus &input ); bool MenuBack( const InputEventPlus &input );
// Lua // Lua
virtual void PushSelf( lua_State *L ); virtual void PushSelf( lua_State *L );