From e333836a896dee730896e2eae863124901756219 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 28 May 2008 00:43:42 +0000 Subject: [PATCH] Don't respond to players joining by catching GB_START; other code can cause a join, too. Watch the Message_PlayerJoined message instead. --- stepmania/src/ScreenContinue.cpp | 49 ++++++++++++++++++++------------ stepmania/src/ScreenContinue.h | 3 ++ 2 files changed, 34 insertions(+), 18 deletions(-) diff --git a/stepmania/src/ScreenContinue.cpp b/stepmania/src/ScreenContinue.cpp index 36b91b6554..52f85473ac 100644 --- a/stepmania/src/ScreenContinue.cpp +++ b/stepmania/src/ScreenContinue.cpp @@ -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. diff --git a/stepmania/src/ScreenContinue.h b/stepmania/src/ScreenContinue.h index e217725121..29d8ca0f66 100644 --- a/stepmania/src/ScreenContinue.h +++ b/stepmania/src/ScreenContinue.h @@ -8,9 +8,12 @@ class ScreenContinue : public ScreenWithMenuElements { public: + virtual void Init(); + virtual void BeginScreen(); virtual void Input( const InputEventPlus &input ); virtual void HandleScreenMessage( const ScreenMessage SM ); + virtual void HandleMessage( const Message &msg ); virtual bool AllowLateJoin() const { return true; } private: };