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:
Glenn Maynard
2008-05-28 00:43:42 +00:00
parent 94f4ea32e4
commit e333836a89
2 changed files with 34 additions and 18 deletions
+31 -18
View File
@@ -11,6 +11,13 @@
REGISTER_SCREEN_CLASS( ScreenContinue );
void ScreenContinue::Init()
{
ScreenWithMenuElements::Init();
this->SubscribeToMessage( Message_PlayerJoined );
}
void ScreenContinue::BeginScreen()
{
GAMESTATE->SetCurrentStyle( NULL );
@@ -45,25 +52,7 @@ void ScreenContinue::Input( const InputEventPlus &input )
ResetTimer();
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
}
if( IsTransitioning() )
return;
@@ -102,6 +91,30 @@ void ScreenContinue::HandleScreenMessage( const ScreenMessage 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
* All rights reserved.