fix choosing rave mode in the default theme with only P1 active
simplify make having course modes in the center of other objects work
This commit is contained in:
@@ -189,6 +189,20 @@ void ScreenSelectDifficulty::UpdateSelectableChoices()
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static BothPlayersModeChoice( const ModeChoice &mc )
|
||||||
|
{
|
||||||
|
switch( mc.m_pm )
|
||||||
|
{
|
||||||
|
case PLAY_MODE_ONI:
|
||||||
|
case PLAY_MODE_NONSTOP:
|
||||||
|
case PLAY_MODE_ENDLESS:
|
||||||
|
case PLAY_MODE_RAVE:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void ScreenSelectDifficulty::MenuLeft( PlayerNumber pn )
|
void ScreenSelectDifficulty::MenuLeft( PlayerNumber pn )
|
||||||
{
|
{
|
||||||
// if( m_fLockInputTime > 0 )
|
// if( m_fLockInputTime > 0 )
|
||||||
@@ -196,20 +210,18 @@ void ScreenSelectDifficulty::MenuLeft( PlayerNumber pn )
|
|||||||
if( m_bChosen[pn] )
|
if( m_bChosen[pn] )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
unsigned c; // GCC is bitching again.
|
bool AnotherPlayerSelected = false;
|
||||||
for( c=0; c<m_iaChoicesToIgnore.size(); c++ )
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||||
{
|
if( p != pn && m_bChosen[p] )
|
||||||
if(m_iChoiceOnPage[pn]-1 == m_iaChoicesToIgnore[c])
|
AnotherPlayerSelected = true;
|
||||||
{
|
|
||||||
return; // disallow to change to ignored details
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int iSwitchToIndex = -1;
|
int iSwitchToIndex = -1;
|
||||||
for( int i=m_iChoiceOnPage[pn]-1; i>=0; i-- )
|
for( int i=m_iChoiceOnPage[pn]-1; i>=0; i-- )
|
||||||
{
|
{
|
||||||
if( m_ModeChoices[m_CurrentPage][i].IsPlayable() )
|
const ModeChoice &mc = m_ModeChoices[m_CurrentPage][i];
|
||||||
|
if( AnotherPlayerSelected && BothPlayersModeChoice(mc) )
|
||||||
|
continue;
|
||||||
|
if( mc.IsPlayable() )
|
||||||
{
|
{
|
||||||
iSwitchToIndex = i;
|
iSwitchToIndex = i;
|
||||||
break;
|
break;
|
||||||
@@ -222,7 +234,8 @@ void ScreenSelectDifficulty::MenuLeft( PlayerNumber pn )
|
|||||||
ChangePage( (Page)(m_CurrentPage-1) );
|
ChangePage( (Page)(m_CurrentPage-1) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ChangeWithinPage( pn, iSwitchToIndex, false );
|
if( ChangeWithinPage( pn, iSwitchToIndex, false ) )
|
||||||
|
m_soundChange.Play();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -233,20 +246,18 @@ void ScreenSelectDifficulty::MenuRight( PlayerNumber pn )
|
|||||||
if( m_bChosen[pn] )
|
if( m_bChosen[pn] )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
unsigned c; // GCC is bitching again.
|
bool AnotherPlayerSelected = false;
|
||||||
for( c=0; c<m_iaChoicesToIgnore.size(); c++ )
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||||
{
|
if( p != pn && m_bChosen[p] )
|
||||||
if(m_iChoiceOnPage[pn]+1 == m_iaChoicesToIgnore[c])
|
AnotherPlayerSelected = true;
|
||||||
{
|
|
||||||
return; // disallow to change to ignored details
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int iSwitchToIndex = -1;
|
int iSwitchToIndex = -1;
|
||||||
for( int i=m_iChoiceOnPage[pn]+1; i<(int) m_ModeChoices[m_CurrentPage].size(); i++ )
|
for( int i=m_iChoiceOnPage[pn]+1; i<(int) m_ModeChoices[m_CurrentPage].size(); i++ )
|
||||||
{
|
{
|
||||||
if( m_ModeChoices[m_CurrentPage][i].IsPlayable() )
|
const ModeChoice &mc = m_ModeChoices[m_CurrentPage][i];
|
||||||
|
if( AnotherPlayerSelected && BothPlayersModeChoice(mc) )
|
||||||
|
continue;
|
||||||
|
if( mc.IsPlayable() )
|
||||||
{
|
{
|
||||||
iSwitchToIndex = i;
|
iSwitchToIndex = i;
|
||||||
break;
|
break;
|
||||||
@@ -263,7 +274,8 @@ void ScreenSelectDifficulty::MenuRight( PlayerNumber pn )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ChangeWithinPage( pn, iSwitchToIndex, false );
|
if( ChangeWithinPage( pn, iSwitchToIndex, false ) )
|
||||||
|
m_soundChange.Play();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenSelectDifficulty::ChangePage( Page newPage )
|
void ScreenSelectDifficulty::ChangePage( Page newPage )
|
||||||
@@ -319,8 +331,9 @@ void ScreenSelectDifficulty::ChangePage( Page newPage )
|
|||||||
m_framePages.SetX( (float)newPage*-SCREEN_WIDTH );
|
m_framePages.SetX( (float)newPage*-SCREEN_WIDTH );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenSelectDifficulty::ChangeWithinPage( PlayerNumber pn, int iNewChoice, bool bChangingPages )
|
bool ScreenSelectDifficulty::ChangeWithinPage( PlayerNumber pn, int iNewChoice, bool bChangingPages )
|
||||||
{
|
{
|
||||||
|
bool bAnyChanged = false;
|
||||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||||
{
|
{
|
||||||
if( !GAMESTATE->IsHumanPlayer(p) )
|
if( !GAMESTATE->IsHumanPlayer(p) )
|
||||||
@@ -328,7 +341,10 @@ void ScreenSelectDifficulty::ChangeWithinPage( PlayerNumber pn, int iNewChoice,
|
|||||||
|
|
||||||
if( p!=pn && m_CurrentPage==PAGE_1 )
|
if( p!=pn && m_CurrentPage==PAGE_1 )
|
||||||
continue; // skip
|
continue; // skip
|
||||||
|
if( m_iChoiceOnPage[p] == iNewChoice )
|
||||||
|
continue; // skip
|
||||||
|
|
||||||
|
bAnyChanged = true;
|
||||||
m_iChoiceOnPage[p] = iNewChoice;
|
m_iChoiceOnPage[p] = iNewChoice;
|
||||||
|
|
||||||
float fCursorX = GetCursorX( (PlayerNumber)p );
|
float fCursorX = GetCursorX( (PlayerNumber)p );
|
||||||
@@ -345,10 +361,7 @@ void ScreenSelectDifficulty::ChangeWithinPage( PlayerNumber pn, int iNewChoice,
|
|||||||
m_sprShadow[p].SetY( fCursorY + SHADOW_LENGTH_Y );
|
m_sprShadow[p].SetY( fCursorY + SHADOW_LENGTH_Y );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we're changing pages, it's ChangePage's responsibility to play this
|
return bAnyChanged;
|
||||||
* (so we don't play it more than once). */
|
|
||||||
if(!bChangingPages)
|
|
||||||
m_soundChange.Play();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenSelectDifficulty::MenuStart( PlayerNumber pn )
|
void ScreenSelectDifficulty::MenuStart( PlayerNumber pn )
|
||||||
@@ -363,83 +376,86 @@ void ScreenSelectDifficulty::MenuStart( PlayerNumber pn )
|
|||||||
OFF_COMMAND( m_sprMore[page] );
|
OFF_COMMAND( m_sprMore[page] );
|
||||||
|
|
||||||
const ModeChoice& mc = m_ModeChoices[m_CurrentPage][m_iChoiceOnPage[pn]];
|
const ModeChoice& mc = m_ModeChoices[m_CurrentPage][m_iChoiceOnPage[pn]];
|
||||||
/* Don't play sound if we're on the second page and another player
|
|
||||||
* has already selected, since it just played. */
|
|
||||||
bool AnotherPlayerSelected = false;
|
|
||||||
int p;
|
|
||||||
for( p=0; p<NUM_PLAYERS; p++ )
|
|
||||||
if(p != pn && m_bChosen[p])
|
|
||||||
AnotherPlayerSelected = true;
|
|
||||||
|
|
||||||
if(m_CurrentPage != PAGE_2 || !AnotherPlayerSelected)
|
/* Don't play sound if we're recursive, since it just played. */
|
||||||
|
static bool bPlaySelect = true;
|
||||||
|
if( bPlaySelect )
|
||||||
{
|
{
|
||||||
SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo(ssprintf("ScreenSelectDifficulty comment %s",mc.m_sName.c_str())) );
|
SOUND->PlayOnceFromDir( ANNOUNCER->GetPathTo(ssprintf("ScreenSelectDifficulty comment %s",mc.m_sName.c_str())) );
|
||||||
m_soundSelect.Play();
|
m_soundSelect.Play();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int p;
|
||||||
|
|
||||||
// courses should be selected for both players at all times
|
// courses should be selected for both players at all times
|
||||||
if( mc.m_pm == PLAY_MODE_ONI || mc.m_pm == PLAY_MODE_NONSTOP || mc.m_pm == PLAY_MODE_ENDLESS)
|
if( BothPlayersModeChoice(mc) )
|
||||||
{
|
{
|
||||||
float fCursorX = GetCursorX( (PlayerNumber)pn );
|
|
||||||
float fCursorY = GetCursorY( (PlayerNumber)pn );
|
|
||||||
for( p=0; p<NUM_PLAYERS; p++ )
|
for( p=0; p<NUM_PLAYERS; p++ )
|
||||||
{
|
{
|
||||||
if(p != pn)
|
if( m_bChosen[p] || !GAMESTATE->IsHumanPlayer((PlayerNumber)p) || p == pn )
|
||||||
{
|
continue;
|
||||||
m_iChoiceOnPage[p] = m_iChoiceOnPage[pn]; // have all players agree to the option
|
|
||||||
|
|
||||||
// move all cursors to the oni/nonstop selection so it graphically looks as if all players selected the same option.
|
// move all cursors to the oni/nonstop selection so it graphically looks as if all players selected the same option.
|
||||||
m_sprCursor[p].StopTweening();
|
ChangeWithinPage( (PlayerNumber)p, m_iChoiceOnPage[pn], false );
|
||||||
m_sprCursor[p].SetX( fCursorX );
|
bPlaySelect = false;
|
||||||
m_sprCursor[p].SetY( fCursorY );
|
MenuStart( (PlayerNumber)p ); // agree everyone
|
||||||
|
bPlaySelect = true;
|
||||||
m_sprShadow[p].StopTweening();
|
|
||||||
m_sprShadow[p].SetX( fCursorX + SHADOW_LENGTH_X );
|
|
||||||
m_sprShadow[p].SetY( fCursorY + SHADOW_LENGTH_Y );
|
|
||||||
MenuStart( (PlayerNumber)p ); // agree everyone
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // someone must have chosen arcade style play so oni/nonstop/endless must be disabled
|
else // someone must have chosen arcade style play so oni/nonstop/endless must be disabled
|
||||||
{
|
{
|
||||||
for( p=0; p<NUM_PLAYERS; p++ )
|
for( p=0; p<NUM_PLAYERS; p++ )
|
||||||
{
|
{
|
||||||
if(p != pn && !m_bChosen[p]) // if theyve not chosen
|
if( m_bChosen[p] || !GAMESTATE->IsHumanPlayer((PlayerNumber)p) || p == pn )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if( !BothPlayersModeChoice(m_ModeChoices[m_CurrentPage][m_iChoiceOnPage[p]]) )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* This player is currently on a choice that is no longer available due to
|
||||||
|
* the selection just made. */
|
||||||
|
int iSwitchToIndex = -1;
|
||||||
|
for( int i=m_iChoiceOnPage[p]+1; iSwitchToIndex == -1 && i < (int) m_ModeChoices[m_CurrentPage].size(); ++i )
|
||||||
|
if( m_ModeChoices[m_CurrentPage][i].IsPlayable() )
|
||||||
|
iSwitchToIndex = i;
|
||||||
|
if( iSwitchToIndex == -1 )
|
||||||
{
|
{
|
||||||
PlayMode iPlaymode = m_ModeChoices[m_CurrentPage][m_iChoiceOnPage[p]].m_pm;
|
for( i=m_iChoiceOnPage[p]-1; iSwitchToIndex == -1 && i >= 0; --i )
|
||||||
// if they're currently highlighting an option that is a nonstop
|
if( m_ModeChoices[m_CurrentPage][i].IsPlayable() )
|
||||||
if( iPlaymode == PLAY_MODE_ONI || iPlaymode == PLAY_MODE_NONSTOP || iPlaymode == PLAY_MODE_ENDLESS)
|
iSwitchToIndex = i;
|
||||||
{
|
|
||||||
m_iChoiceOnPage[p] = 0;
|
|
||||||
|
|
||||||
|
|
||||||
// move the cursor
|
|
||||||
float fCursorX = GetCursorX( (PlayerNumber)p );
|
|
||||||
float fCursorY = GetCursorY( (PlayerNumber)p );
|
|
||||||
|
|
||||||
m_sprCursor[p].StopTweening();
|
|
||||||
m_sprCursor[p].SetX( fCursorX );
|
|
||||||
m_sprCursor[p].SetY( fCursorY );
|
|
||||||
|
|
||||||
m_sprShadow[p].StopTweening();
|
|
||||||
m_sprShadow[p].SetX( fCursorX + SHADOW_LENGTH_X );
|
|
||||||
m_sprShadow[p].SetY( fCursorY + SHADOW_LENGTH_Y );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
/* We should always find a place to go--we should at least be able to choose
|
||||||
|
* the same thing pn picked. */
|
||||||
|
ASSERT( iSwitchToIndex != -1 );
|
||||||
|
|
||||||
|
// move the cursor
|
||||||
|
ChangeWithinPage( (PlayerNumber) p, iSwitchToIndex, false );
|
||||||
}
|
}
|
||||||
unsigned c; // GCC is bitching again.
|
|
||||||
for( c=0; c<m_ModeChoices[PAGE_1].size(); c++ )
|
|
||||||
{
|
|
||||||
ModeChoice mc = m_ModeChoices[PAGE_1][c];
|
|
||||||
if(mc.m_pm == PLAY_MODE_ONI || mc.m_pm == PLAY_MODE_NONSTOP || mc.m_pm == PLAY_MODE_ENDLESS)
|
|
||||||
{
|
|
||||||
m_iaChoicesToIgnore.push_back(c);
|
|
||||||
m_sprPicture[PAGE_1][c].Command( IGNORED_ELEMENT_COMMAND );
|
|
||||||
m_sprInfo[PAGE_1][c].Command( IGNORED_ELEMENT_COMMAND );
|
|
||||||
|
|
||||||
// IGNORED_ELEMENT_COMMAND
|
/* If the other player is active and hasn't yet chosen, gray out unselectable options.
|
||||||
|
* Otherwise, don't do this, so we don't gray out stuff when nothing else can be selected
|
||||||
|
* anyway. */
|
||||||
|
bool bAnyPlayersLeft = false;
|
||||||
|
for( p=0; p<NUM_PLAYERS; p++ )
|
||||||
|
{
|
||||||
|
if( !GAMESTATE->IsHumanPlayer((PlayerNumber)p) || m_bChosen[p] || p == pn )
|
||||||
|
continue;
|
||||||
|
bAnyPlayersLeft = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( bAnyPlayersLeft )
|
||||||
|
{
|
||||||
|
for( unsigned c=0; c<m_ModeChoices[PAGE_1].size(); c++ )
|
||||||
|
{
|
||||||
|
if( BothPlayersModeChoice(m_ModeChoices[PAGE_1][c]) )
|
||||||
|
{
|
||||||
|
m_sprPicture[PAGE_1][c].Command( IGNORED_ELEMENT_COMMAND );
|
||||||
|
m_sprInfo[PAGE_1][c].Command( IGNORED_ELEMENT_COMMAND );
|
||||||
|
|
||||||
|
// IGNORED_ELEMENT_COMMAND
|
||||||
|
}
|
||||||
|
// m_ModeChoices[PAGE_1].push_back( m_aModeChoices[c] );
|
||||||
}
|
}
|
||||||
// m_ModeChoices[PAGE_1].push_back( m_aModeChoices[c] );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -451,13 +467,15 @@ void ScreenSelectDifficulty::MenuStart( PlayerNumber pn )
|
|||||||
if( m_bChosen[p] )
|
if( m_bChosen[p] )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
bPlaySelect = false;
|
||||||
MenuStart( (PlayerNumber)p );
|
MenuStart( (PlayerNumber)p );
|
||||||
|
bPlaySelect = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
m_sprCursor[pn].Command( CURSOR_CHOOSE_COMMAND );
|
m_sprCursor[pn].Command( CURSOR_CHOOSE_COMMAND );
|
||||||
m_sprOK[pn].SetXY( m_sprShadow[pn].GetX(), m_sprShadow[pn].GetY() );
|
m_sprOK[pn].SetXY( m_sprShadow[pn].GetDestX(), m_sprShadow[pn].GetDestY() );
|
||||||
m_sprOK[pn].Command( OK_CHOOSE_COMMAND );
|
m_sprOK[pn].Command( OK_CHOOSE_COMMAND );
|
||||||
m_sprShadow[pn].Command( SHADOW_CHOOSE_COMMAND );
|
m_sprShadow[pn].Command( SHADOW_CHOOSE_COMMAND );
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ protected:
|
|||||||
|
|
||||||
float GetCursorX( PlayerNumber pn );
|
float GetCursorX( PlayerNumber pn );
|
||||||
float GetCursorY( PlayerNumber pn );
|
float GetCursorY( PlayerNumber pn );
|
||||||
void ChangeWithinPage( PlayerNumber pn, int iNewChoice, bool bChangingPages );
|
bool ChangeWithinPage( PlayerNumber pn, int iNewChoice, bool bChangingPages );
|
||||||
void ChangePage( Page newPage );
|
void ChangePage( Page newPage );
|
||||||
|
|
||||||
ActorFrame m_framePages; // to hold the 2 pages
|
ActorFrame m_framePages; // to hold the 2 pages
|
||||||
@@ -66,8 +66,6 @@ protected:
|
|||||||
|
|
||||||
vector<ModeChoice> m_ModeChoices[NUM_PAGES];
|
vector<ModeChoice> m_ModeChoices[NUM_PAGES];
|
||||||
|
|
||||||
vector<int> m_iaChoicesToIgnore;
|
|
||||||
|
|
||||||
Page m_CurrentPage;
|
Page m_CurrentPage;
|
||||||
int m_iChoiceOnPage[NUM_PLAYERS];
|
int m_iChoiceOnPage[NUM_PLAYERS];
|
||||||
bool m_bChosen[NUM_PLAYERS];
|
bool m_bChosen[NUM_PLAYERS];
|
||||||
|
|||||||
Reference in New Issue
Block a user