Use fallbcak notes; some fixes for it.

This commit is contained in:
Glenn Maynard
2002-09-10 04:59:53 +00:00
parent 5dbd96f447
commit a0dc7ec5bf
4 changed files with 32 additions and 11 deletions
+4 -4
View File
@@ -471,9 +471,9 @@ StyleDef g_StyleDefs[NUM_STYLES] =
GAME_DANCE, // m_Game
true, // m_bUsedForGameplay
false, // m_bUsedForEdit
"DDR Couple", // m_szName
"DDR Couples", // m_szName
{ NOTES_TYPE_DANCE_COUPLE_1, NOTES_TYPE_DANCE_COUPLE_2 }, // m_NotesTypes
NOTES_TYPE_INVALID, // m_FallbackNotesType
NOTES_TYPE_DANCE_SINGLE, // m_FallbackNotesType
StyleDef::TWO_PLAYERS_TWO_CREDITS, // m_StyleType
{ 160, 480 }, // m_iCenterX
4, // m_iColsPerPlayer
@@ -716,8 +716,8 @@ StyleDef g_StyleDefs[NUM_STYLES] =
true, // m_bUsedForGameplay
false, // m_bUsedForEdit
"Pump Couples", // m_szName
{ NOTES_TYPE_PUMP_SINGLE,NOTES_TYPE_PUMP_COUPLE_2}, // m_NotesTypes
NOTES_TYPE_INVALID, // m_FallbackNotesType
{ NOTES_TYPE_PUMP_COUPLE_1,NOTES_TYPE_PUMP_COUPLE_2}, // m_NotesTypes
NOTES_TYPE_PUMP_SINGLE, // m_FallbackNotesType
StyleDef::TWO_PLAYERS_TWO_CREDITS, // m_StyleType
{ 160, 480 }, // m_iCenterX
5, // m_iColsPerPlayer
+24 -4
View File
@@ -556,15 +556,35 @@ void Song::TidyUpData()
}
}
/* Get Notes that match a given style and player. */
void Song::GetNotesThatMatch( const StyleDef *s, int p, CArray<Notes*, Notes*>& arrayAddTo ) const
/* Get Notes that match a given style and player.
*
* If UseFallbacks is true, fallback notes will be returned if (and
* only if) no non-fallback notes are found at all.
*
* If UseFallbacks is false, fallback notes will never be returned.
*/
void Song::GetNotesThatMatch( const StyleDef *s, int p, CArray<Notes*, Notes*>& arrayAddTo, bool UseFallbacks ) const
{
int cnt = GetNotesThatMatch( s->m_NotesTypes[p], arrayAddTo );
if ( UseFallbacks && !cnt )
GetNotesThatMatch( s->m_FallbackNotesType, arrayAddTo );
}
/* Get note patterns of the given type; return the number of patterns returned. */
int Song::GetNotesThatMatch( NotesType nt, CArray<Notes*, Notes*>& arrayAddTo ) const
{
int ret=0;
for( int i=0; i<m_apNotes.GetSize(); i++ ) // for each of the Song's Notes
{
if( m_apNotes[i]->m_NotesType == s->m_NotesTypes[p] ||
m_apNotes[i]->m_NotesType == s->m_FallbackNotesType )
if( m_apNotes[i]->m_NotesType == nt )
{
arrayAddTo.Add( m_apNotes[i] );
ret++;
}
}
return ret;
}
/* Return whether the song is playable in the given style. */
+2 -2
View File
@@ -265,8 +265,8 @@ void SongSelector::OnNotesTypeChange()
m_textStyle.SetText( GAMEMAN->GetStyleDefForStyle(GetSelectedStyle())->m_szName );
m_pNotess.RemoveAll();
/* XXX. This will list fallback notes, which we don't want. */
GetSelectedSong()->GetNotesThatMatch( GAMEMAN->GetStyleDefForStyle(GetSelectedStyle()), 0, m_pNotess );
/* Only get primary notes in this style, not fallback notes. */
GetSelectedSong()->GetNotesThatMatch( GAMEMAN->GetStyleDefForStyle(GetSelectedStyle()), 0, m_pNotess, false );
SortNotesArrayByDifficulty( m_pNotess );
m_pNotess.Add( NULL ); // marker for "(NEW)"
m_iSelectedNotes = 0;
+2 -1
View File
@@ -174,7 +174,8 @@ public:
bool SongCompleteForStyle( const StyleDef *st ) const;
bool SongHasNotesType( NotesType nt ) const;
bool SongHasNotesTypeAndDifficulty( NotesType nt, DifficultyClass dc ) const;
void GetNotesThatMatch( const StyleDef *s, int p, CArray<Notes*, Notes*>& arrayAddTo ) const;
void GetNotesThatMatch( const StyleDef *s, int p, CArray<Notes*, Notes*>& arrayAddTo, bool UseFallbacks = true) const;
int GetNotesThatMatch( NotesType nt, CArray<Notes*, Notes*>& arrayAddTo ) const;
int GetNumTimesPlayed() const;
bool IsNew() const;
bool IsEasy( NotesType nt ) const;