lock Difficulty/Steps for all players in Rave

This commit is contained in:
Chris Danford
2004-05-07 04:37:47 +00:00
parent 2326324e8d
commit fec42c1a21
4 changed files with 65 additions and 65 deletions
+17 -7
View File
@@ -1578,6 +1578,21 @@ bool GameState::IsTimeToPlayAttractSounds()
return false;
}
bool GameState::DifficultiesLocked()
{
return GAMESTATE->m_PlayMode == PLAY_MODE_RAVE;
}
bool GameState::ChangeDifficulty( PlayerNumber pn, Difficulty dc )
{
this->m_PreferredDifficulty[pn] = dc;
if( DifficultiesLocked() )
for( int p = 0; p < NUM_PLAYERS; ++p )
m_PreferredDifficulty[p] = m_PreferredDifficulty[pn];
return true;
}
bool GameState::ChangeDifficulty( PlayerNumber pn, int dir )
{
// FIXME: This clamps to between the min and the max difficulty, but
@@ -1598,16 +1613,11 @@ bool GameState::ChangeDifficulty( PlayerNumber pn, int dir )
}
Difficulty diff = (Difficulty)(m_PreferredDifficulty[pn]+dir);
if( diff < mind || diff > maxd )
return false;
this->m_PreferredDifficulty[pn] = diff;
bool bLockDifficulties = m_PlayMode == PLAY_MODE_RAVE;
if( bLockDifficulties )
for( int p = 0; p < NUM_PLAYERS; ++p )
m_PreferredDifficulty[p] = m_PreferredDifficulty[pn];
return true;
return ChangeDifficulty( pn, diff );
}
bool GameState::ChangeCourseDifficulty( PlayerNumber pn, int dir )
+2
View File
@@ -61,6 +61,8 @@ public:
PlayerNumber m_MasterPlayerNumber; // used in Styles where one player controls both sides
bool m_bIsOnSystemMenu; // system screens will not be effected by the operator key -- Miryokuteki
CourseDifficulty m_PreferredCourseDifficulty[NUM_PLAYERS]; // used in nonstop
bool DifficultiesLocked();
bool ChangeDifficulty( PlayerNumber pn, Difficulty dc );
bool ChangeDifficulty( PlayerNumber pn, int dir );
bool ChangeCourseDifficulty( PlayerNumber pn, int dir );
RageTimer m_timeGameStarted; // from the moment the first player pressed Start
+45 -56
View File
@@ -828,7 +828,7 @@ void ScreenSelectMusic::Input( const DeviceInput& DeviceI, InputEventType type,
if( GAMESTATE->IsExtraStage() || GAMESTATE->IsExtraStage2() )
m_soundLocked.Play();
else
EasierDifficulty( pn );
ChangeDifficulty( pn, -1 );
return;
}
if( CodeDetector::EnteredHarderDifficulty(GameI.controller) )
@@ -836,7 +836,7 @@ void ScreenSelectMusic::Input( const DeviceInput& DeviceI, InputEventType type,
if( GAMESTATE->IsExtraStage() || GAMESTATE->IsExtraStage2() )
m_soundLocked.Play();
else
HarderDifficulty( pn );
ChangeDifficulty( pn, +1 );
return;
}
if( CodeDetector::EnteredSortMenu(GameI.controller) )
@@ -882,10 +882,9 @@ void ScreenSelectMusic::Input( const DeviceInput& DeviceI, InputEventType type,
}
}
void ScreenSelectMusic::EasierDifficulty( PlayerNumber pn )
void ScreenSelectMusic::ChangeDifficulty( PlayerNumber pn, int dir )
{
LOG->Trace( "ScreenSelectMusic::EasierDifficulty( %d )", pn );
LOG->Trace( "ScreenSelectMusic::ChangeDifficulty( %d, %d )", pn, dir );
if( !GAMESTATE->IsHumanPlayer(pn) )
return;
@@ -893,22 +892,40 @@ void ScreenSelectMusic::EasierDifficulty( PlayerNumber pn )
switch( m_MusicWheel.GetSelectedType() )
{
case TYPE_SONG:
if( m_iSelection[pn] == 0 )
if( dir > 0 && m_iSelection[pn] == int(m_arrayNotes.size()-1) )
return;
if( dir < 0 && m_iSelection[pn] == 0 )
return;
m_iSelection[pn]--;
m_iSelection[pn] += dir;
// the user explicity switched difficulties. Update the preferred difficulty
GAMESTATE->m_PreferredDifficulty[pn] = m_arrayNotes[ m_iSelection[pn] ]->GetDifficulty();
GAMESTATE->ChangeDifficulty( pn, m_arrayNotes[ m_iSelection[pn] ]->GetDifficulty() );
m_soundDifficultyEasier.Play();
if( dir < 0 )
m_soundDifficultyEasier.Play();
else
m_soundDifficultyHarder.Play();
AfterNotesChange( pn );
{
FOREACH_HumanPlayer( p )
{
if( pn == p || GAMESTATE->DifficultiesLocked() )
{
m_iSelection[p] = m_iSelection[pn];
AfterNotesChange( p );
}
}
}
break;
case TYPE_COURSE:
if( GAMESTATE->ChangeCourseDifficulty( pn, -1 ) )
if( GAMESTATE->ChangeCourseDifficulty( pn, dir ) )
{
m_soundDifficultyEasier.Play();
if( dir < 0 )
m_soundDifficultyEasier.Play();
else
m_soundDifficultyHarder.Play();
AfterMusicChange();
}
break;
@@ -916,51 +933,12 @@ void ScreenSelectMusic::EasierDifficulty( PlayerNumber pn )
case TYPE_RANDOM:
case TYPE_ROULETTE:
case TYPE_LEAP:
if( GAMESTATE->ChangeDifficulty( pn, -1 ) )
if( GAMESTATE->ChangeDifficulty( pn, dir ) )
{
m_soundDifficultyEasier.Play();
AfterMusicChange();
}
break;
}
}
void ScreenSelectMusic::HarderDifficulty( PlayerNumber pn )
{
LOG->Trace( "ScreenSelectMusic::HarderDifficulty( %d )", pn );
if( !GAMESTATE->IsHumanPlayer(pn) )
return;
switch( m_MusicWheel.GetSelectedType() )
{
case TYPE_SONG:
if( m_iSelection[pn] == int(m_arrayNotes.size()-1) )
return;
m_iSelection[pn]++;
// the user explicity switched difficulties. Update the preferred difficulty
GAMESTATE->m_PreferredDifficulty[pn] = m_arrayNotes[ m_iSelection[pn] ]->GetDifficulty();
m_soundDifficultyHarder.Play();
AfterNotesChange( pn );
break;
case TYPE_COURSE:
if( GAMESTATE->ChangeCourseDifficulty( pn, +1 ) )
{
m_soundDifficultyHarder.Play();
AfterMusicChange();
}
break;
case TYPE_RANDOM:
case TYPE_ROULETTE:
case TYPE_LEAP:
if( GAMESTATE->ChangeDifficulty( pn, +1 ) )
{
m_soundDifficultyHarder.Play();
if( dir < 0 )
m_soundDifficultyEasier.Play();
else
m_soundDifficultyHarder.Play();
AfterMusicChange();
}
break;
@@ -1271,6 +1249,17 @@ void ScreenSelectMusic::AfterMusicChange()
if( !m_MusicWheel.IsRouletting() )
m_MenuTimer->Stall();
// lock difficulties. When switching from arcade to rave, we need to
// enforce that all players are at the same difficulty.
if( GAMESTATE->DifficultiesLocked() )
{
FOREACH_HumanPlayer( p )
{
m_iSelection[p] = m_iSelection[0];
GAMESTATE->m_PreferredDifficulty[p] = GAMESTATE->m_PreferredDifficulty[0];
}
}
Song* pSong = m_MusicWheel.GetSelectedSong();
GAMESTATE->m_pCurSong = pSong;
+1 -2
View File
@@ -58,8 +58,7 @@ protected:
void SkipSongPartTweens();
void SkipCoursePartTweens();
void EasierDifficulty( PlayerNumber pn );
void HarderDifficulty( PlayerNumber pn );
void ChangeDifficulty( PlayerNumber pn, int dir );
void AfterNotesChange( PlayerNumber pn );
void SwitchToPreferredDifficulty();