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; 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 ) bool GameState::ChangeDifficulty( PlayerNumber pn, int dir )
{ {
// FIXME: This clamps to between the min and the max difficulty, but // 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); Difficulty diff = (Difficulty)(m_PreferredDifficulty[pn]+dir);
if( diff < mind || diff > maxd ) if( diff < mind || diff > maxd )
return false; return false;
this->m_PreferredDifficulty[pn] = diff; return ChangeDifficulty( 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;
} }
bool GameState::ChangeCourseDifficulty( PlayerNumber pn, int dir ) 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 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 bool m_bIsOnSystemMenu; // system screens will not be effected by the operator key -- Miryokuteki
CourseDifficulty m_PreferredCourseDifficulty[NUM_PLAYERS]; // used in nonstop CourseDifficulty m_PreferredCourseDifficulty[NUM_PLAYERS]; // used in nonstop
bool DifficultiesLocked();
bool ChangeDifficulty( PlayerNumber pn, Difficulty dc );
bool ChangeDifficulty( PlayerNumber pn, int dir ); bool ChangeDifficulty( PlayerNumber pn, int dir );
bool ChangeCourseDifficulty( PlayerNumber pn, int dir ); bool ChangeCourseDifficulty( PlayerNumber pn, int dir );
RageTimer m_timeGameStarted; // from the moment the first player pressed Start RageTimer m_timeGameStarted; // from the moment the first player pressed Start
+41 -52
View File
@@ -828,7 +828,7 @@ void ScreenSelectMusic::Input( const DeviceInput& DeviceI, InputEventType type,
if( GAMESTATE->IsExtraStage() || GAMESTATE->IsExtraStage2() ) if( GAMESTATE->IsExtraStage() || GAMESTATE->IsExtraStage2() )
m_soundLocked.Play(); m_soundLocked.Play();
else else
EasierDifficulty( pn ); ChangeDifficulty( pn, -1 );
return; return;
} }
if( CodeDetector::EnteredHarderDifficulty(GameI.controller) ) if( CodeDetector::EnteredHarderDifficulty(GameI.controller) )
@@ -836,7 +836,7 @@ void ScreenSelectMusic::Input( const DeviceInput& DeviceI, InputEventType type,
if( GAMESTATE->IsExtraStage() || GAMESTATE->IsExtraStage2() ) if( GAMESTATE->IsExtraStage() || GAMESTATE->IsExtraStage2() )
m_soundLocked.Play(); m_soundLocked.Play();
else else
HarderDifficulty( pn ); ChangeDifficulty( pn, +1 );
return; return;
} }
if( CodeDetector::EnteredSortMenu(GameI.controller) ) if( CodeDetector::EnteredSortMenu(GameI.controller) )
@@ -882,10 +882,9 @@ void ScreenSelectMusic::Input( const DeviceInput& DeviceI, InputEventType type,
} }
} }
void ScreenSelectMusic::ChangeDifficulty( PlayerNumber pn, int dir )
void ScreenSelectMusic::EasierDifficulty( PlayerNumber pn )
{ {
LOG->Trace( "ScreenSelectMusic::EasierDifficulty( %d )", pn ); LOG->Trace( "ScreenSelectMusic::ChangeDifficulty( %d, %d )", pn, dir );
if( !GAMESTATE->IsHumanPlayer(pn) ) if( !GAMESTATE->IsHumanPlayer(pn) )
return; return;
@@ -893,63 +892,39 @@ void ScreenSelectMusic::EasierDifficulty( PlayerNumber pn )
switch( m_MusicWheel.GetSelectedType() ) switch( m_MusicWheel.GetSelectedType() )
{ {
case TYPE_SONG: 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; return;
m_iSelection[pn]--; m_iSelection[pn] += dir;
// the user explicity switched difficulties. Update the preferred difficulty // 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() );
if( dir < 0 )
m_soundDifficultyEasier.Play(); m_soundDifficultyEasier.Play();
else
AfterNotesChange( pn );
break;
case TYPE_COURSE:
if( GAMESTATE->ChangeCourseDifficulty( pn, -1 ) )
{
m_soundDifficultyEasier.Play();
AfterMusicChange();
}
break;
case TYPE_RANDOM:
case TYPE_ROULETTE:
case TYPE_LEAP:
if( GAMESTATE->ChangeDifficulty( pn, -1 ) )
{
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(); m_soundDifficultyHarder.Play();
AfterNotesChange( pn ); {
FOREACH_HumanPlayer( p )
{
if( pn == p || GAMESTATE->DifficultiesLocked() )
{
m_iSelection[p] = m_iSelection[pn];
AfterNotesChange( p );
}
}
}
break; break;
case TYPE_COURSE: case TYPE_COURSE:
if( GAMESTATE->ChangeCourseDifficulty( pn, +1 ) ) if( GAMESTATE->ChangeCourseDifficulty( pn, dir ) )
{ {
if( dir < 0 )
m_soundDifficultyEasier.Play();
else
m_soundDifficultyHarder.Play(); m_soundDifficultyHarder.Play();
AfterMusicChange(); AfterMusicChange();
} }
@@ -958,8 +933,11 @@ void ScreenSelectMusic::HarderDifficulty( PlayerNumber pn )
case TYPE_RANDOM: case TYPE_RANDOM:
case TYPE_ROULETTE: case TYPE_ROULETTE:
case TYPE_LEAP: case TYPE_LEAP:
if( GAMESTATE->ChangeDifficulty( pn, +1 ) ) if( GAMESTATE->ChangeDifficulty( pn, dir ) )
{ {
if( dir < 0 )
m_soundDifficultyEasier.Play();
else
m_soundDifficultyHarder.Play(); m_soundDifficultyHarder.Play();
AfterMusicChange(); AfterMusicChange();
} }
@@ -1271,6 +1249,17 @@ void ScreenSelectMusic::AfterMusicChange()
if( !m_MusicWheel.IsRouletting() ) if( !m_MusicWheel.IsRouletting() )
m_MenuTimer->Stall(); 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(); Song* pSong = m_MusicWheel.GetSelectedSong();
GAMESTATE->m_pCurSong = pSong; GAMESTATE->m_pCurSong = pSong;
+1 -2
View File
@@ -58,8 +58,7 @@ protected:
void SkipSongPartTweens(); void SkipSongPartTweens();
void SkipCoursePartTweens(); void SkipCoursePartTweens();
void EasierDifficulty( PlayerNumber pn ); void ChangeDifficulty( PlayerNumber pn, int dir );
void HarderDifficulty( PlayerNumber pn );
void AfterNotesChange( PlayerNumber pn ); void AfterNotesChange( PlayerNumber pn );
void SwitchToPreferredDifficulty(); void SwitchToPreferredDifficulty();