allow switching difficulties while on roulette, random, leap
tween off DifficultyList and CourseContents when in the sort and mode menus
This commit is contained in:
@@ -11,10 +11,11 @@
|
||||
#include "ThemeManager.h"
|
||||
#include "StepsUtil.h"
|
||||
|
||||
#define ITEMS_SPACING_Y THEME->GetMetricF(m_sName,"ItemsSpacingY")
|
||||
#define DESCRIPTION_MAX_WIDTH THEME->GetMetricF(m_sName,"DescriptionMaxWidth")
|
||||
#define NUM_SHOWN_ITEMS THEME->GetMetricI(m_sName,"NumShownItems")
|
||||
#define MOVE_COMMAND THEME->GetMetric (m_sName,"MoveCommand")
|
||||
#define ITEMS_SPACING_Y THEME->GetMetricF(m_sName,"ItemsSpacingY")
|
||||
#define DESCRIPTION_MAX_WIDTH THEME->GetMetricF(m_sName,"DescriptionMaxWidth")
|
||||
#define NUM_SHOWN_ITEMS THEME->GetMetricI(m_sName,"NumShownItems")
|
||||
#define MOVE_COMMAND THEME->GetMetric (m_sName,"MoveCommand")
|
||||
#define DIFFICULTIES_TO_SHOW THEME->GetMetric( "Common","DifficultiesToShow" )
|
||||
|
||||
#define MAX_METERS NUM_DIFFICULTIES + MAX_EDITS_PER_SONG
|
||||
|
||||
@@ -269,51 +270,72 @@ void DifficultyList::SetFromGameState()
|
||||
if( bSongChanged )
|
||||
{
|
||||
m_CurSong = song;
|
||||
if( !song )
|
||||
return;
|
||||
|
||||
for( int m = 0; m < MAX_METERS; ++m )
|
||||
{
|
||||
m_Lines[m].m_Meter.Unset();
|
||||
m_Lines[m].m_Description.SetText( "" );
|
||||
m_Lines[m].m_Number.SetText( "" );
|
||||
m_Lines[m].m_Description.SetText( "" );
|
||||
}
|
||||
|
||||
vector<Steps*> CurSteps;
|
||||
song->GetSteps( CurSteps, GAMESTATE->GetCurrentStyleDef()->m_StepsType );
|
||||
|
||||
/* Should match the sort in ScreenSelectMusic::AfterMusicChange. */
|
||||
StepsUtil::SortNotesArrayByDifficulty( CurSteps );
|
||||
|
||||
unsigned i;
|
||||
for( i = 0; i < m_Rows.size(); ++i )
|
||||
delete m_Rows[i];
|
||||
m_Rows.clear();
|
||||
|
||||
for( i = 0; i < CurSteps.size(); ++i )
|
||||
if( song == NULL )
|
||||
{
|
||||
m_Rows.push_back( new Row() );
|
||||
Row &row = *m_Rows[i];
|
||||
// FIXME: This clamps to between the min and the max difficulty, but
|
||||
// it really should round to the nearest difficulty that's in
|
||||
// DIFFICULTIES_TO_SHOW.
|
||||
CStringArray asDiff;
|
||||
split( DIFFICULTIES_TO_SHOW, ",", asDiff );
|
||||
Difficulty mind = (Difficulty)(NUM_DIFFICULTIES-1);
|
||||
Difficulty maxd = (Difficulty)0;
|
||||
for( unsigned i=0; i<asDiff.size(); i++ )
|
||||
{
|
||||
Difficulty d = StringToDifficulty( asDiff[i] );
|
||||
if( d == DIFFICULTY_INVALID )
|
||||
continue;
|
||||
|
||||
row.m_Steps = CurSteps[i];
|
||||
m_Lines[i].m_Meter.SetMeter( 3*(d), d );
|
||||
m_Lines[i].m_Number.SetText( "?" );
|
||||
m_Lines[i].m_Description.SetText( DifficultyToThemedString(d) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
vector<Steps*> CurSteps;
|
||||
song->GetSteps( CurSteps, GAMESTATE->GetCurrentStyleDef()->m_StepsType );
|
||||
|
||||
m_Lines[i].m_Meter.SetFromNotes( m_Rows[i]->m_Steps );
|
||||
/* Should match the sort in ScreenSelectMusic::AfterMusicChange. */
|
||||
StepsUtil::SortNotesArrayByDifficulty( CurSteps );
|
||||
|
||||
Difficulty dc = row.m_Steps->GetDifficulty();
|
||||
|
||||
CString s;
|
||||
if( row.m_Steps->GetDifficulty() == DIFFICULTY_EDIT )
|
||||
s = row.m_Steps->GetDescription();
|
||||
else
|
||||
s = DifficultyToThemedString(dc);
|
||||
m_Lines[i].m_Description.SetMaxWidth( DESCRIPTION_MAX_WIDTH );
|
||||
m_Lines[i].m_Description.SetText( s );
|
||||
/* Don't mess with alpha; it might be fading on. */
|
||||
m_Lines[i].m_Description.SetDiffuseColor( SONGMAN->GetDifficultyColor(dc) );
|
||||
|
||||
m_Lines[i].m_Number.SetZoomX(1);
|
||||
m_Lines[i].m_Number.SetDiffuseColor( SONGMAN->GetDifficultyColor(dc) );
|
||||
m_Lines[i].m_Number.SetText( ssprintf("%d",row.m_Steps->GetMeter()) );
|
||||
unsigned i;
|
||||
for( i = 0; i < m_Rows.size(); ++i )
|
||||
delete m_Rows[i];
|
||||
m_Rows.clear();
|
||||
|
||||
for( i = 0; i < CurSteps.size(); ++i )
|
||||
{
|
||||
m_Rows.push_back( new Row() );
|
||||
Row &row = *m_Rows[i];
|
||||
|
||||
row.m_Steps = CurSteps[i];
|
||||
|
||||
m_Lines[i].m_Meter.SetFromNotes( m_Rows[i]->m_Steps );
|
||||
|
||||
Difficulty dc = row.m_Steps->GetDifficulty();
|
||||
|
||||
CString s;
|
||||
if( row.m_Steps->GetDifficulty() == DIFFICULTY_EDIT )
|
||||
s = row.m_Steps->GetDescription();
|
||||
else
|
||||
s = DifficultyToThemedString(dc);
|
||||
m_Lines[i].m_Description.SetMaxWidth( DESCRIPTION_MAX_WIDTH );
|
||||
m_Lines[i].m_Description.SetText( s );
|
||||
/* Don't mess with alpha; it might be fading on. */
|
||||
m_Lines[i].m_Description.SetDiffuseColor( SONGMAN->GetDifficultyColor(dc) );
|
||||
|
||||
m_Lines[i].m_Number.SetZoomX(1);
|
||||
m_Lines[i].m_Number.SetDiffuseColor( SONGMAN->GetDifficultyColor(dc) );
|
||||
m_Lines[i].m_Number.SetText( ssprintf("%d",row.m_Steps->GetMeter()) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,9 +31,9 @@ public:
|
||||
void SetFromNotes( const Steps* pNotes );
|
||||
void SetFromCourse( const Course* pCourse, PlayerNumber pn );
|
||||
void Unset();
|
||||
void SetMeter( int iMeter, Difficulty dc );
|
||||
|
||||
private:
|
||||
void SetMeter( int iMeter, Difficulty dc );
|
||||
void SetDifficulty( CString diff );
|
||||
BitmapText m_textFeet;
|
||||
|
||||
|
||||
@@ -41,7 +41,8 @@
|
||||
|
||||
#include <ctime>
|
||||
|
||||
#define DEFAULT_MODIFIERS THEME->GetMetric( "Common","DefaultModifiers" )
|
||||
#define DEFAULT_MODIFIERS THEME->GetMetric( "Common","DefaultModifiers" )
|
||||
#define DIFFICULTIES_TO_SHOW THEME->GetMetric( "Common","DifficultiesToShow" )
|
||||
|
||||
GameState* GAMESTATE = NULL; // global and accessable from anywhere in our program
|
||||
|
||||
@@ -1577,6 +1578,38 @@ bool GameState::IsTimeToPlayAttractSounds()
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GameState::ChangeDifficulty( PlayerNumber pn, int dir )
|
||||
{
|
||||
// FIXME: This clamps to between the min and the max difficulty, but
|
||||
// it really should round to the nearest difficulty that's in
|
||||
// DIFFICULTIES_TO_SHOW.
|
||||
CStringArray asDiff;
|
||||
split( DIFFICULTIES_TO_SHOW, ",", asDiff );
|
||||
Difficulty mind = (Difficulty)(NUM_DIFFICULTIES-1);
|
||||
Difficulty maxd = (Difficulty)0;
|
||||
for( unsigned i=0; i<asDiff.size(); i++ )
|
||||
{
|
||||
Difficulty d = StringToDifficulty( asDiff[i] );
|
||||
if( d == DIFFICULTY_INVALID )
|
||||
continue;
|
||||
|
||||
mind = min( mind, d );
|
||||
maxd = max( maxd, d );
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
bool GameState::ChangeCourseDifficulty( PlayerNumber pn, int dir )
|
||||
{
|
||||
CourseDifficulty diff = (CourseDifficulty)(m_PreferredCourseDifficulty[pn]+dir);
|
||||
|
||||
@@ -61,6 +61,7 @@ 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 ChangeDifficulty( PlayerNumber pn, int dir );
|
||||
bool ChangeCourseDifficulty( PlayerNumber pn, int dir );
|
||||
RageTimer m_timeGameStarted; // from the moment the first player pressed Start
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ ScreenSelectMusic::ScreenSelectMusic( CString sClassName ) : ScreenWithMenuEleme
|
||||
|
||||
LIGHTSMAN->SetLightsMode( LIGHTSMODE_MENU );
|
||||
|
||||
m_bInCourseDisplayMode = GAMESTATE->IsCourseMode();
|
||||
m_DisplayMode = GAMESTATE->IsCourseMode() ? DISPLAY_COURSES : DISPLAY_SONGS;
|
||||
|
||||
/* Finish any previous stage. It's OK to call this when we havn't played a stage yet.
|
||||
* Do this before anything that might look at GAMESTATE->m_iCurrentStageIndex. */
|
||||
@@ -593,24 +593,37 @@ void ScreenSelectMusic::TweenOffScreen()
|
||||
|
||||
/* This hides elements that are only relevant when displaying a single song,
|
||||
* and shows elements for course display. XXX: Allow different tween commands. */
|
||||
void ScreenSelectMusic::EnterCourseDisplayMode()
|
||||
void ScreenSelectMusic::SwitchDisplayMode( DisplayMode dm )
|
||||
{
|
||||
if( m_bInCourseDisplayMode )
|
||||
if( m_DisplayMode == dm )
|
||||
return;
|
||||
m_bInCourseDisplayMode = true;
|
||||
|
||||
TweenSongPartsOffScreen( false );
|
||||
TweenCoursePartsOnScreen( false );
|
||||
}
|
||||
// tween off
|
||||
switch( m_DisplayMode )
|
||||
{
|
||||
case DISPLAY_SONGS:
|
||||
TweenSongPartsOffScreen( false );
|
||||
break;
|
||||
case DISPLAY_COURSES:
|
||||
TweenCoursePartsOffScreen( false );
|
||||
break;
|
||||
case DISPLAY_MODES:
|
||||
break;
|
||||
}
|
||||
|
||||
void ScreenSelectMusic::ExitCourseDisplayMode()
|
||||
{
|
||||
if( !m_bInCourseDisplayMode )
|
||||
return;
|
||||
m_bInCourseDisplayMode = false;
|
||||
|
||||
TweenSongPartsOnScreen( false );
|
||||
TweenCoursePartsOffScreen( false );
|
||||
// tween on
|
||||
m_DisplayMode = dm;
|
||||
switch( m_DisplayMode )
|
||||
{
|
||||
case DISPLAY_SONGS:
|
||||
TweenSongPartsOnScreen( false );
|
||||
break;
|
||||
case DISPLAY_COURSES:
|
||||
TweenCoursePartsOnScreen( false );
|
||||
break;
|
||||
case DISPLAY_MODES:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenSelectMusic::TweenScoreOnAndOffAfterChangeSort()
|
||||
@@ -629,14 +642,14 @@ void ScreenSelectMusic::TweenScoreOnAndOffAfterChangeSort()
|
||||
case SORT_NONSTOP_COURSES:
|
||||
case SORT_ONI_COURSES:
|
||||
case SORT_ENDLESS_COURSES:
|
||||
EnterCourseDisplayMode();
|
||||
SwitchDisplayMode( DISPLAY_COURSES );
|
||||
break;
|
||||
case SORT_SORT_MENU:
|
||||
case SORT_MODE_MENU:
|
||||
// do nothing
|
||||
SwitchDisplayMode( DISPLAY_MODES );
|
||||
break;
|
||||
default:
|
||||
ExitCourseDisplayMode();
|
||||
SwitchDisplayMode( DISPLAY_SONGS );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -877,31 +890,39 @@ void ScreenSelectMusic::EasierDifficulty( PlayerNumber pn )
|
||||
if( !GAMESTATE->IsHumanPlayer(pn) )
|
||||
return;
|
||||
|
||||
if( m_MusicWheel.GetSelectedType() == TYPE_COURSE )
|
||||
switch( m_MusicWheel.GetSelectedType() )
|
||||
{
|
||||
case TYPE_SONG:
|
||||
if( m_iSelection[pn] == 0 )
|
||||
return;
|
||||
|
||||
m_iSelection[pn]--;
|
||||
// the user explicity switched difficulties. Update the preferred difficulty
|
||||
GAMESTATE->m_PreferredDifficulty[pn] = m_arrayNotes[ m_iSelection[pn] ]->GetDifficulty();
|
||||
|
||||
m_soundDifficultyEasier.Play();
|
||||
|
||||
AfterNotesChange( pn );
|
||||
break;
|
||||
|
||||
case TYPE_COURSE:
|
||||
if( GAMESTATE->ChangeCourseDifficulty( pn, -1 ) )
|
||||
{
|
||||
m_soundDifficultyEasier.Play();
|
||||
AfterMusicChange();
|
||||
}
|
||||
return;
|
||||
break;
|
||||
|
||||
case TYPE_RANDOM:
|
||||
case TYPE_ROULETTE:
|
||||
case TYPE_LEAP:
|
||||
if( GAMESTATE->ChangeDifficulty( pn, -1 ) )
|
||||
{
|
||||
m_soundDifficultyEasier.Play();
|
||||
AfterMusicChange();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if( m_MusicWheel.GetSelectedType() != TYPE_SONG )
|
||||
return;
|
||||
|
||||
if( m_MusicWheel.GetSelectedType() != TYPE_SONG )
|
||||
return;
|
||||
if( m_iSelection[pn] == 0 )
|
||||
return;
|
||||
|
||||
m_iSelection[pn]--;
|
||||
// the user explicity switched difficulties. Update the preferred difficulty
|
||||
GAMESTATE->m_PreferredDifficulty[pn] = m_arrayNotes[ m_iSelection[pn] ]->GetDifficulty();
|
||||
|
||||
m_soundDifficultyEasier.Play();
|
||||
|
||||
AfterNotesChange( pn );
|
||||
}
|
||||
|
||||
void ScreenSelectMusic::HarderDifficulty( PlayerNumber pn )
|
||||
@@ -911,29 +932,39 @@ void ScreenSelectMusic::HarderDifficulty( PlayerNumber pn )
|
||||
if( !GAMESTATE->IsHumanPlayer(pn) )
|
||||
return;
|
||||
|
||||
if( m_MusicWheel.GetSelectedType() == TYPE_COURSE )
|
||||
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();
|
||||
}
|
||||
return;
|
||||
break;
|
||||
|
||||
case TYPE_RANDOM:
|
||||
case TYPE_ROULETTE:
|
||||
case TYPE_LEAP:
|
||||
if( GAMESTATE->ChangeDifficulty( pn, +1 ) )
|
||||
{
|
||||
m_soundDifficultyHarder.Play();
|
||||
AfterMusicChange();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if( m_MusicWheel.GetSelectedType() != TYPE_SONG )
|
||||
return;
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
|
||||
@@ -1241,8 +1272,7 @@ void ScreenSelectMusic::AfterMusicChange()
|
||||
m_MenuTimer->Stall();
|
||||
|
||||
Song* pSong = m_MusicWheel.GetSelectedSong();
|
||||
if( pSong )
|
||||
GAMESTATE->m_pCurSong = pSong;
|
||||
GAMESTATE->m_pCurSong = pSong;
|
||||
|
||||
m_GrooveGraph.SetFromSong( pSong );
|
||||
|
||||
|
||||
@@ -49,9 +49,8 @@ protected:
|
||||
void TweenOnScreen();
|
||||
void TweenOffScreen();
|
||||
void TweenScoreOnAndOffAfterChangeSort();
|
||||
void EnterCourseDisplayMode();
|
||||
void ExitCourseDisplayMode();
|
||||
bool m_bInCourseDisplayMode;
|
||||
enum DisplayMode { DISPLAY_SONGS, DISPLAY_COURSES, DISPLAY_MODES } m_DisplayMode;
|
||||
void SwitchDisplayMode( DisplayMode dm );
|
||||
void TweenSongPartsOnScreen( bool Initial );
|
||||
void TweenSongPartsOffScreen( bool Final );
|
||||
void TweenCoursePartsOnScreen( bool Initial );
|
||||
|
||||
Reference in New Issue
Block a user