Disable rave mode on ScreenSelectDifficulty when appropriate (doubles and solo)
This commit is contained in:
+20
-11
@@ -304,24 +304,33 @@ const StyleDef* GameState::GetCurrentStyleDef()
|
|||||||
|
|
||||||
bool GameState::IsPlayable( const ModeChoice& mc )
|
bool GameState::IsPlayable( const ModeChoice& mc )
|
||||||
{
|
{
|
||||||
|
// Mode doesn't interest the caller, presumably because
|
||||||
|
// a style has not been chosen yet.
|
||||||
|
if ( mc.pm == PLAY_MODE_INVALID )
|
||||||
|
return mc.numSidesJoinedToPlay == GAMESTATE->GetNumSidesJoined();
|
||||||
|
|
||||||
|
// A style has been chosen, so now consider modes
|
||||||
|
const Style &style = (mc.style != STYLE_INVALID) ? mc.style : m_CurStyle;
|
||||||
|
ASSERT(style != STYLE_INVALID);
|
||||||
|
|
||||||
if( mc.pm == PLAY_MODE_RAVE )
|
if( mc.pm == PLAY_MODE_RAVE )
|
||||||
{
|
{
|
||||||
// Can't play Rave without characters for attack definitions.
|
// Can't play Rave without characters for attack definitions.
|
||||||
if( m_pCharacters.empty() )
|
//X ... but we'll let ScreenSelectDifficulty give that message
|
||||||
|
//X (since that will give the user an explanation)
|
||||||
|
//X
|
||||||
|
//Xif( m_pCharacters.empty() )
|
||||||
|
//X return false;
|
||||||
|
|
||||||
|
// Can't play rave if there isn't enough room for two players.
|
||||||
|
// This is correct for dance (ie, no rave for solo and doubles),
|
||||||
|
// and should be okay for pump .. not sure about other game types.
|
||||||
|
if( GAMEMAN->GetStyleDefForStyle(style)->m_iColsPerPlayer >= 6 )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Can't play rave unless there is room for two players
|
|
||||||
if( mc.style != STYLE_INVALID &&
|
|
||||||
GAMEMAN->GetStyleDefForStyle(mc.style)->m_StyleType == StyleDef::ONE_PLAYER_TWO_CREDITS )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Can't play rave unless there is room for two players
|
|
||||||
if( m_CurStyle != STYLE_INVALID &&
|
|
||||||
GAMEMAN->GetStyleDefForStyle(m_CurStyle)->m_StyleType == StyleDef::ONE_PLAYER_TWO_CREDITS )
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return mc.numSidesJoinedToPlay == GAMESTATE->GetNumSidesJoined();
|
return true; // why not?
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GameState::IsPlayerEnabled( PlayerNumber pn )
|
bool GameState::IsPlayerEnabled( PlayerNumber pn )
|
||||||
|
|||||||
@@ -119,6 +119,8 @@ ScreenSelectDifficulty::ScreenSelectDifficulty() : ScreenSelect( "ScreenSelectDi
|
|||||||
|
|
||||||
m_fLockInputTime = LOCK_INPUT_SECONDS;
|
m_fLockInputTime = LOCK_INPUT_SECONDS;
|
||||||
|
|
||||||
|
this->UpdateSelectableChoices();
|
||||||
|
|
||||||
TweenOnScreen();
|
TweenOnScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,13 +190,25 @@ void ScreenSelectDifficulty::MenuLeft( PlayerNumber pn )
|
|||||||
// return;
|
// return;
|
||||||
if( m_bChosen[pn] )
|
if( m_bChosen[pn] )
|
||||||
return;
|
return;
|
||||||
if( m_iChoiceOnPage[pn] == 0 ) // can't go left any more
|
|
||||||
|
int iSwitchToIndex = -1;
|
||||||
|
for( int i=m_iChoiceOnPage[pn]-1; i>=0; i-- )
|
||||||
|
{
|
||||||
|
if( GAMESTATE->IsPlayable(m_ModeChoices[m_CurrentPage][i]))
|
||||||
|
{
|
||||||
|
iSwitchToIndex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( iSwitchToIndex == -1 )
|
||||||
{
|
{
|
||||||
if( m_CurrentPage > 0 )
|
if( m_CurrentPage > 0 )
|
||||||
ChangePage( (Page)(m_CurrentPage-1) );
|
ChangePage( (Page)(m_CurrentPage-1) );
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
ChangeWithinPage( pn, m_iChoiceOnPage[pn]-1, false );
|
ChangeWithinPage( pn, iSwitchToIndex, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -204,16 +218,28 @@ void ScreenSelectDifficulty::MenuRight( PlayerNumber pn )
|
|||||||
// return;
|
// return;
|
||||||
if( m_bChosen[pn] )
|
if( m_bChosen[pn] )
|
||||||
return;
|
return;
|
||||||
if( m_iChoiceOnPage[pn] == (int)m_ModeChoices[m_CurrentPage].size()-1 ) // can't go right any more
|
|
||||||
|
int iSwitchToIndex = -1;
|
||||||
|
for( int i=m_iChoiceOnPage[pn]+1; i<m_ModeChoices[m_CurrentPage].size(); i++ )
|
||||||
|
{
|
||||||
|
if( GAMESTATE->IsPlayable(m_ModeChoices[m_CurrentPage][i]))
|
||||||
|
{
|
||||||
|
iSwitchToIndex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( iSwitchToIndex == -1 )
|
||||||
{
|
{
|
||||||
if( m_ModeChoices[m_CurrentPage+1].size()==0 ) // there is no page 2
|
if( m_ModeChoices[m_CurrentPage+1].size()==0 ) // there is no page 2
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( m_CurrentPage < NUM_PAGES-1 )
|
if( m_CurrentPage < NUM_PAGES-1 )
|
||||||
ChangePage( (Page)(m_CurrentPage+1) );
|
ChangePage( (Page)(m_CurrentPage+1) );
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
ChangeWithinPage( pn, m_iChoiceOnPage[pn]+1, false );
|
ChangeWithinPage( pn, iSwitchToIndex, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenSelectDifficulty::ChangePage( Page newPage )
|
void ScreenSelectDifficulty::ChangePage( Page newPage )
|
||||||
@@ -235,10 +261,31 @@ void ScreenSelectDifficulty::ChangePage( Page newPage )
|
|||||||
m_soundDifficult.PlayRandom();
|
m_soundDifficult.PlayRandom();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Find the first Playable mode on the new page
|
||||||
|
int iSwitchToIndex = -1;
|
||||||
|
if( !bPageIncreasing ) {
|
||||||
|
for( int i=m_ModeChoices[newPage].size()-1; i>=0; i-- )
|
||||||
|
{
|
||||||
|
if( GAMESTATE->IsPlayable(m_ModeChoices[newPage][i]))
|
||||||
|
{
|
||||||
|
iSwitchToIndex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for( int i=0; i<m_ModeChoices[newPage].size(); i++ )
|
||||||
|
{
|
||||||
|
if( GAMESTATE->IsPlayable(m_ModeChoices[newPage][i]))
|
||||||
|
{
|
||||||
|
iSwitchToIndex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// change both players
|
// change both players
|
||||||
int iNewChoice = bPageIncreasing ? 0 : m_ModeChoices[m_CurrentPage].size()-1;
|
|
||||||
for( p=0; p<NUM_PLAYERS; p++ )
|
for( p=0; p<NUM_PLAYERS; p++ )
|
||||||
ChangeWithinPage( (PlayerNumber)p, iNewChoice, true );
|
ChangeWithinPage( (PlayerNumber)p, iSwitchToIndex, true );
|
||||||
|
|
||||||
m_soundChange.Play();
|
m_soundChange.Play();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user