fix duplicate start sounds
don't BeginFadingOut if the selected choice doesn't specify a screen
This commit is contained in:
@@ -180,7 +180,7 @@ bool Screen::ChangeCoinModeInput( const DeviceInput& DeviceI, const InputEventTy
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Screen::JoinInput( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
|
bool Screen::JoinInput( const MenuInput &MenuI )
|
||||||
{
|
{
|
||||||
if( !GAMESTATE->PlayersCanJoin() )
|
if( !GAMESTATE->PlayersCanJoin() )
|
||||||
return false;
|
return false;
|
||||||
@@ -206,7 +206,12 @@ bool Screen::JoinInput( const DeviceInput& DeviceI, const InputEventType type, c
|
|||||||
else
|
else
|
||||||
GAMESTATE->m_iCoins -= iCoinsToCharge;
|
GAMESTATE->m_iCoins -= iCoinsToCharge;
|
||||||
|
|
||||||
|
// HACK: Only play start sound for the 2nd player who joins. The
|
||||||
|
// start sound for the 1st player will be played by ScreenTitleMenu
|
||||||
|
// when the player makes a selection on the screen.
|
||||||
|
if( GAMESTATE->GetNumSidesJoined() > 0 )
|
||||||
SCREENMAN->PlayStartSound();
|
SCREENMAN->PlayStartSound();
|
||||||
|
|
||||||
GAMESTATE->JoinPlayer( MenuI.player );
|
GAMESTATE->JoinPlayer( MenuI.player );
|
||||||
|
|
||||||
// don't load memory card profiles here. It's slow and can cause a big skip.
|
// don't load memory card profiles here. It's slow and can cause a big skip.
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public:
|
|||||||
virtual bool UsesBackground() const { return true; } // override and set false if this screen shouldn't load a background
|
virtual bool UsesBackground() const { return true; } // override and set false if this screen shouldn't load a background
|
||||||
|
|
||||||
static bool ChangeCoinModeInput( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ); // return true if CoinMode changed
|
static bool ChangeCoinModeInput( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ); // return true if CoinMode changed
|
||||||
static bool JoinInput( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ); // return true if a player joined
|
static bool JoinInput( const MenuInput &MenuI ); // return true if a player joined
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// structure for holding messages sent to a Screen
|
// structure for holding messages sent to a Screen
|
||||||
|
|||||||
@@ -160,15 +160,19 @@ void ScreenSelect::Input( const DeviceInput& DeviceI, const InputEventType type,
|
|||||||
m_timerIdleComment.GetDeltaTime();
|
m_timerIdleComment.GetDeltaTime();
|
||||||
m_timerIdleTimeout.GetDeltaTime();
|
m_timerIdleTimeout.GetDeltaTime();
|
||||||
|
|
||||||
|
|
||||||
|
// HACK: Don't process JoinInput on the TitleMenu. Otherwise, if the user presses start
|
||||||
|
// on a choice that doesn't move to a new screen, the player will be joined and the
|
||||||
|
// user will still be on the title menu.
|
||||||
|
bool bAllowJoinInput = !ALLOW_DISABLED_PLAYER_INPUT;
|
||||||
|
|
||||||
if( MenuI.button == MENU_BUTTON_COIN ||
|
if( MenuI.button == MENU_BUTTON_COIN ||
|
||||||
Screen::JoinInput(DeviceI, type, GameI, MenuI, StyleI) )
|
(bAllowJoinInput && Screen::JoinInput(MenuI)) )
|
||||||
{
|
{
|
||||||
if( type == IET_FIRST_PRESS )
|
if( type == IET_FIRST_PRESS )
|
||||||
this->UpdateSelectableChoices();
|
this->UpdateSelectableChoices();
|
||||||
|
|
||||||
if( ALLOW_DISABLED_PLAYER_INPUT )
|
if( !ALLOW_DISABLED_PLAYER_INPUT )
|
||||||
;
|
|
||||||
else
|
|
||||||
return; // don't let the screen handle the MENU_START press
|
return; // don't let the screen handle the MENU_START press
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,7 +194,12 @@ void ScreenSelect::Input( const DeviceInput& DeviceI, const InputEventType type,
|
|||||||
Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); // default input handler
|
Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); // default input handler
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenSelect::FinalizeChoices()
|
void ScreenSelect::HandleScreenMessage( const ScreenMessage SM )
|
||||||
|
{
|
||||||
|
switch( SM )
|
||||||
|
{
|
||||||
|
/* Screen is starting to tween out. */
|
||||||
|
case SM_BeginFadingOut:
|
||||||
{
|
{
|
||||||
/* At this point, we're tweening out; we can't change the selection.
|
/* At this point, we're tweening out; we can't change the selection.
|
||||||
* We don't want to allow players to join if the style will be set,
|
* We don't want to allow players to join if the style will be set,
|
||||||
@@ -206,19 +215,10 @@ void ScreenSelect::FinalizeChoices()
|
|||||||
}
|
}
|
||||||
SCREENMAN->RefreshCreditsMessages();
|
SCREENMAN->RefreshCreditsMessages();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenSelect::HandleScreenMessage( const ScreenMessage SM )
|
|
||||||
{
|
|
||||||
switch( SM )
|
|
||||||
{
|
|
||||||
/* Screen is starting to tween out. */
|
|
||||||
case SM_BeginFadingOut:
|
|
||||||
FinalizeChoices();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* It's our turn to tween out. */
|
/* It's our turn to tween out. */
|
||||||
case SM_AllDoneChoosing:
|
case SM_AllDoneChoosing:
|
||||||
FinalizeChoices();
|
|
||||||
if( !IsTransitioning() )
|
if( !IsTransitioning() )
|
||||||
StartTransitioning( SM_GoToNextScreen );
|
StartTransitioning( SM_GoToNextScreen );
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
virtual int GetSelectionIndex( PlayerNumber pn ) = 0;
|
virtual int GetSelectionIndex( PlayerNumber pn ) = 0;
|
||||||
virtual void UpdateSelectableChoices() = 0; // derived screens must handle this
|
virtual void UpdateSelectableChoices() = 0; // derived screens must handle this
|
||||||
void FinalizeChoices();
|
|
||||||
|
|
||||||
vector<BGAnimation*> m_vpBGAnimations;
|
vector<BGAnimation*> m_vpBGAnimations;
|
||||||
vector<GameCommand> m_aGameCommands; // derived classes should look here for what choices are available
|
vector<GameCommand> m_aGameCommands; // derived classes should look here for what choices are available
|
||||||
|
|||||||
@@ -594,8 +594,23 @@ void ScreenSelectMaster::MenuStart( PlayerNumber pn )
|
|||||||
|
|
||||||
GameCommand &mc = m_aGameCommands[m_iChoice[pn]];
|
GameCommand &mc = m_aGameCommands[m_iChoice[pn]];
|
||||||
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())) );
|
||||||
|
|
||||||
|
if( mc.m_sSoundPath.empty() )
|
||||||
m_soundStart.Play();
|
m_soundStart.Play();
|
||||||
|
|
||||||
|
if( mc.m_sScreen.empty() )
|
||||||
|
{
|
||||||
|
mc.ApplyToAllPlayers();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the player isn't already joined, join them.
|
||||||
|
MenuInput MenuI;
|
||||||
|
MenuI.player = pn;
|
||||||
|
MenuI.button = MENU_BUTTON_START;
|
||||||
|
Screen::JoinInput( MenuI );
|
||||||
|
|
||||||
|
|
||||||
float fSecs = 0;
|
float fSecs = 0;
|
||||||
bool bAllDone = true;
|
bool bAllDone = true;
|
||||||
if( SHARED_PREVIEW_AND_CURSOR || GetCurrentPage() == PAGE_2 )
|
if( SHARED_PREVIEW_AND_CURSOR || GetCurrentPage() == PAGE_2 )
|
||||||
|
|||||||
Reference in New Issue
Block a user