require 2 players to join before continuing

This commit is contained in:
Chris Danford
2005-08-23 20:58:24 +00:00
parent 995b441180
commit ed0ffb679a
+24 -1
View File
@@ -11,6 +11,8 @@ class Style;
#include "InputMapper.h" #include "InputMapper.h"
#include "GameSoundManager.h" #include "GameSoundManager.h"
#include "GameCommand.h" #include "GameCommand.h"
#include "ScreenPrompt.h"
#include "ScreenManager.h"
enum MultiPlayerStatus enum MultiPlayerStatus
{ {
@@ -49,11 +51,15 @@ void ScreenJoinMultiplayer::Init()
{ {
ScreenWithMenuElements::Init(); ScreenWithMenuElements::Init();
GAMESTATE->m_bMultiplayer = true;
// Set Style to the first style (should be a one player style) // Set Style to the first style (should be a one player style)
vector<const Style*> v; vector<const Style*> v;
GAMEMAN->GetStylesForGame( GAMESTATE->m_pCurGame, v, false ); GAMEMAN->GetStylesForGame( GAMESTATE->m_pCurGame, v, false );
GAMESTATE->m_pCurStyle.Set( v[0] ); GAMESTATE->m_pCurStyle.Set( v[0] );
GAMESTATE->m_PlayMode.Set( PLAY_MODE_REGULAR );
FOREACH_MultiPlayer( p ) FOREACH_MultiPlayer( p )
{ {
GameCommand gc; GameCommand gc;
@@ -218,7 +224,24 @@ void ScreenJoinMultiplayer::MenuBack( PlayerNumber pn )
void ScreenJoinMultiplayer::MenuStart( PlayerNumber pn ) void ScreenJoinMultiplayer::MenuStart( PlayerNumber pn )
{ {
this->StartTransitioning( SM_BeginFadingOut ); int iNumJoinedPlayers = 0;
FOREACH_MultiPlayer( p )
{
bool bJoined = g_MultiPlayerStatus[p] == MultiPlayerStatus_Joined;
GAMESTATE->m_bIsMultiPlayerJoined[p] = bJoined;
if( bJoined )
iNumJoinedPlayers++;
}
SCREENMAN->PlayStartSound();
if( iNumJoinedPlayers < 2 )
{
ScreenPrompt::Prompt( SM_None, "You must join 2 or more players before continuing." );
return;
}
this->StartTransitioning( SM_GoToNextScreen );
} }