Don't respond to players joining by catching GB_START; other code can cause a join, too. Watch the Message_PlayerJoined message instead.
This commit is contained in:
@@ -11,6 +11,13 @@
|
|||||||
|
|
||||||
REGISTER_SCREEN_CLASS( ScreenContinue );
|
REGISTER_SCREEN_CLASS( ScreenContinue );
|
||||||
|
|
||||||
|
void ScreenContinue::Init()
|
||||||
|
{
|
||||||
|
ScreenWithMenuElements::Init();
|
||||||
|
|
||||||
|
this->SubscribeToMessage( Message_PlayerJoined );
|
||||||
|
}
|
||||||
|
|
||||||
void ScreenContinue::BeginScreen()
|
void ScreenContinue::BeginScreen()
|
||||||
{
|
{
|
||||||
GAMESTATE->SetCurrentStyle( NULL );
|
GAMESTATE->SetCurrentStyle( NULL );
|
||||||
@@ -45,25 +52,7 @@ void ScreenContinue::Input( const InputEventPlus &input )
|
|||||||
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) )
|
||||||
{
|
|
||||||
bool bAllPlayersAreEnabled = true;
|
|
||||||
FOREACH_ENUM( PlayerNumber, p )
|
|
||||||
{
|
|
||||||
if( !GAMESTATE->IsPlayerEnabled(p) )
|
|
||||||
bAllPlayersAreEnabled = false;
|
|
||||||
}
|
|
||||||
if( bAllPlayersAreEnabled )
|
|
||||||
{
|
|
||||||
m_MenuTimer->Stop();
|
|
||||||
if( !IsTransitioning() )
|
|
||||||
StartTransitioningScreen( SM_GoToNextScreen );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ResetTimer();
|
|
||||||
}
|
|
||||||
return; // handled
|
return; // handled
|
||||||
}
|
|
||||||
|
|
||||||
if( IsTransitioning() )
|
if( IsTransitioning() )
|
||||||
return;
|
return;
|
||||||
@@ -102,6 +91,30 @@ void ScreenContinue::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
ScreenWithMenuElements::HandleScreenMessage( SM );
|
ScreenWithMenuElements::HandleScreenMessage( SM );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScreenContinue::HandleMessage( const Message &msg )
|
||||||
|
{
|
||||||
|
if( msg == Message_PlayerJoined )
|
||||||
|
{
|
||||||
|
ResetTimer();
|
||||||
|
|
||||||
|
bool bAllPlayersAreEnabled = true;
|
||||||
|
FOREACH_ENUM( PlayerNumber, p )
|
||||||
|
{
|
||||||
|
if( !GAMESTATE->IsPlayerEnabled(p) )
|
||||||
|
bAllPlayersAreEnabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( bAllPlayersAreEnabled )
|
||||||
|
{
|
||||||
|
m_MenuTimer->Stop();
|
||||||
|
if( !IsTransitioning() )
|
||||||
|
StartTransitioningScreen( SM_GoToNextScreen );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ScreenWithMenuElements::HandleMessage( msg );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (c) 2004 Chris Danford
|
* (c) 2004 Chris Danford
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|||||||
@@ -8,9 +8,12 @@
|
|||||||
class ScreenContinue : public ScreenWithMenuElements
|
class ScreenContinue : public ScreenWithMenuElements
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
virtual void Init();
|
||||||
|
|
||||||
virtual void BeginScreen();
|
virtual void BeginScreen();
|
||||||
virtual void Input( const InputEventPlus &input );
|
virtual void Input( const InputEventPlus &input );
|
||||||
virtual void HandleScreenMessage( const ScreenMessage SM );
|
virtual void HandleScreenMessage( const ScreenMessage SM );
|
||||||
|
virtual void HandleMessage( const Message &msg );
|
||||||
virtual bool AllowLateJoin() const { return true; }
|
virtual bool AllowLateJoin() const { return true; }
|
||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user