From 13d6d5f116b6589415ea73fce24619791c0849e0 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 6 Sep 2002 08:56:28 +0000 Subject: [PATCH] Couples stuff. Not complete, but functional; more coming and this stuff needs testing. --- stepmania/src/Course.cpp | 7 +- stepmania/src/GameManager.cpp | 141 ++++++++++++++++------------ stepmania/src/GameManager.h | 3 +- stepmania/src/MusicWheel.cpp | 10 +- stepmania/src/NoteData.cpp | 3 +- stepmania/src/ScreenEdit.cpp | 3 +- stepmania/src/ScreenEditMenu.cpp | 5 +- stepmania/src/ScreenSelectGroup.cpp | 13 +-- stepmania/src/ScreenSelectMusic.cpp | 30 +++--- stepmania/src/ScreenSelectMusic.h | 2 +- stepmania/src/Song.cpp | 21 ++++- stepmania/src/SongManager.cpp | 8 +- stepmania/src/SongManager.h | 2 +- stepmania/src/SongSelector.cpp | 46 ++++----- stepmania/src/SongSelector.h | 11 ++- stepmania/src/StyleDef.cpp | 10 ++ stepmania/src/StyleDef.h | 18 +++- stepmania/src/song.h | 6 +- 18 files changed, 203 insertions(+), 136 deletions(-) diff --git a/stepmania/src/Course.cpp b/stepmania/src/Course.cpp index 0fecadb4ac..9404f9b8b9 100644 --- a/stepmania/src/Course.cpp +++ b/stepmania/src/Course.cpp @@ -140,8 +140,10 @@ Notes* Course::GetNotesForStage( int iStage ) for( int i=0; im_apNotes.GetSize(); i++ ) { Notes* pNotes = pSong->m_apNotes[i]; + /* XXX: hmm. We need to match the first player, then set up other players + * later ... */ if( 0==stricmp(pNotes->m_sDescription, sDescription) && - pNotes->m_NotesType == GAMESTATE->GetCurrentStyleDef()->m_NotesType ) + GAMESTATE->GetCurrentStyleDef()->MatchesNotesType(pNotes->m_NotesType, 0) ) return pNotes; } @@ -152,7 +154,8 @@ Notes* Course::GetNotesForStage( int iStage ) for( i=0; im_apNotes.GetSize(); i++ ) { Notes* pNotes = pSong->m_apNotes[i]; - if( pNotes->m_DifficultyClass == dc && pNotes->m_NotesType == GAMESTATE->GetCurrentStyleDef()->m_NotesType ) + if( pNotes->m_DifficultyClass == dc && + GAMESTATE->GetCurrentStyleDef()->MatchesNotesType(pNotes->m_NotesType, 0) ) return pNotes; } diff --git a/stepmania/src/GameManager.cpp b/stepmania/src/GameManager.cpp index aeca823ec0..db251053d1 100644 --- a/stepmania/src/GameManager.cpp +++ b/stepmania/src/GameManager.cpp @@ -298,8 +298,9 @@ StyleDef g_StyleDefs[NUM_STYLES] = GAME_DANCE, // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit - "Single", // m_szName - NOTES_TYPE_DANCE_SINGLE, // m_NotesType + "DDR Single", // m_szName + { NOTES_TYPE_DANCE_SINGLE,NOTES_TYPE_DANCE_SINGLE }, // m_NotesTypes + NOTES_TYPE_INVALID, // m_FallbackNotesType StyleDef::ONE_PLAYER_ONE_CREDIT, // m_StyleType { 160, 480 }, // m_iCenterX 4, // m_iColsPerPlayer @@ -325,8 +326,9 @@ StyleDef g_StyleDefs[NUM_STYLES] = GAME_DANCE, // m_Game true, // m_bUsedForGameplay false, // m_bUsedForEdit - "Versus", // m_szName - NOTES_TYPE_DANCE_SINGLE, // m_NotesType + "DDR Versus", // m_szName + { NOTES_TYPE_DANCE_SINGLE,NOTES_TYPE_DANCE_SINGLE }, // m_NotesTypes + NOTES_TYPE_INVALID, // m_FallbackNotesType StyleDef::TWO_PLAYERS_TWO_CREDITS, // m_StyleType { 160, 480 }, // m_iCenterX 4, // m_iColsPerPlayer @@ -352,8 +354,9 @@ StyleDef g_StyleDefs[NUM_STYLES] = GAME_DANCE, // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit - "Double", // m_szName - NOTES_TYPE_DANCE_DOUBLE, // m_NotesType + "DDR Double", // m_szName + { NOTES_TYPE_DANCE_DOUBLE,NOTES_TYPE_DANCE_DOUBLE }, // m_NotesTypes + NOTES_TYPE_INVALID, StyleDef::ONE_PLAYER_TWO_CREDITS, // m_StyleType { 320, 320 }, // m_iCenterX 8, // m_iColsPerPlayer @@ -387,8 +390,9 @@ StyleDef g_StyleDefs[NUM_STYLES] = GAME_DANCE, // m_Game true, // m_bUsedForGameplay false, // m_bUsedForEdit - "Couple", // m_szName - NOTES_TYPE_DANCE_COUPLE, // m_NotesType + "DDR Couple", // m_szName + { NOTES_TYPE_DANCE_COUPLE, NOTES_TYPE_DANCE_COUPLE }, // m_NotesTypes + NOTES_TYPE_INVALID, // m_FallbackNotesType StyleDef::TWO_PLAYERS_TWO_CREDITS, // m_StyleType { 160, 480 }, // m_iCenterX 4, // m_iColsPerPlayer @@ -414,8 +418,9 @@ StyleDef g_StyleDefs[NUM_STYLES] = GAME_DANCE, // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit - "Solo", // m_szName - NOTES_TYPE_DANCE_SOLO, // m_NotesType + "DDR Solo", // m_szName + { NOTES_TYPE_DANCE_SOLO,NOTES_TYPE_DANCE_SOLO }, // m_NotesTypes + NOTES_TYPE_INVALID, // m_FallbackNotesType StyleDef::ONE_PLAYER_ONE_CREDIT, // m_StyleType { 320, 320 }, // m_iCenterX 6, // m_iColsPerPlayer @@ -441,12 +446,13 @@ StyleDef g_StyleDefs[NUM_STYLES] = 0,1,2,3,4,5 }, }, - { // STYLE_DANCE_DOUBLE + { // STYLE_DANCE_COUPLE GAME_DANCE, // m_Game false, // m_bUsedForGameplay true, // m_bUsedForEdit - "EditCouple", // m_szName - NOTES_TYPE_DANCE_COUPLE, // m_NotesType + "DDR Couple", // m_szName + { NOTES_TYPE_DANCE_COUPLE, NOTES_TYPE_DANCE_COUPLE }, // m_NotesTypes + NOTES_TYPE_INVALID, // m_FallbackNotesType StyleDef::ONE_PLAYER_TWO_CREDITS, // m_StyleType { 320, 320 }, // m_iCenterX 8, // m_iColsPerPlayer @@ -508,8 +514,9 @@ StyleDef g_StyleDefs[NUM_STYLES] = GAME_PUMP, // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit - "Single", // m_szName - NOTES_TYPE_PUMP_SINGLE, // m_NotesType + "Pump Single", // m_szName + { NOTES_TYPE_PUMP_SINGLE,NOTES_TYPE_PUMP_SINGLE }, // m_NotesTypes + NOTES_TYPE_INVALID, // m_FallbackNotesType StyleDef::ONE_PLAYER_ONE_CREDIT, // m_StyleType { 160, 480 }, // m_iCenterX 5, // m_iColsPerPlayer @@ -537,9 +544,10 @@ StyleDef g_StyleDefs[NUM_STYLES] = GAME_PUMP, // m_Game true, // m_bUsedForGameplay false, // m_bUsedForEdit - "Versus", // m_szName - NOTES_TYPE_PUMP_SINGLE, // m_NotesType - StyleDef::TWO_PLAYERS_TWO_CREDITS, // m_StyleType + "Pump Versus", // m_szName + { NOTES_TYPE_PUMP_SINGLE,NOTES_TYPE_PUMP_SINGLE }, // m_NotesTypes + NOTES_TYPE_INVALID, // m_FallbackNotesType + StyleDef::TWO_PLAYERS_TWO_CREDITS, // m_StyleType { 160, 480 }, // m_iCenterX 5, // m_iColsPerPlayer { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; @@ -566,9 +574,10 @@ StyleDef g_StyleDefs[NUM_STYLES] = GAME_PUMP, // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit - "Double", // m_szName - NOTES_TYPE_PUMP_DOUBLE, // m_NotesType - StyleDef::ONE_PLAYER_TWO_CREDITS, // m_StyleType + "Pump Double", // m_szName + { NOTES_TYPE_PUMP_DOUBLE,NOTES_TYPE_PUMP_DOUBLE }, // m_NotesTypes + NOTES_TYPE_INVALID, // m_FallbackNotesType + StyleDef::ONE_PLAYER_TWO_CREDITS, // m_StyleType { 320, 480 }, // m_iCenterX 10, // m_iColsPerPlayer { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; @@ -606,8 +615,8 @@ StyleDef g_StyleDefs[NUM_STYLES] = true, // m_bUsedForGameplay false, // m_bUsedForEdit "pump-couple", // m_szName - NOTES_TYPE_PUMP_COUPLE, // m_NotesType - StyleDef::TWO_PLAYERS_TWO_CREDITS, // m_StyleType + NOTES_TYPE_PUMP_COUPLE, // m_NotesTypes + StyleDef::TWO_PLAYERS_TWO_CREDITS, // m_StyleType { 160, 480 }, // m_iCenterX 5, // m_iColsPerPlayer { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; @@ -636,9 +645,10 @@ StyleDef g_StyleDefs[NUM_STYLES] = GAME_EZ2, // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit - "Single", // m_szName - NOTES_TYPE_EZ2_SINGLE, // m_NotesType - StyleDef::ONE_PLAYER_ONE_CREDIT, // m_StyleType + "EZ2 Single", // m_szName + { NOTES_TYPE_EZ2_SINGLE,NOTES_TYPE_EZ2_SINGLE }, // m_NotesTypes + NOTES_TYPE_INVALID, // m_FallbackNotesType + StyleDef::ONE_PLAYER_ONE_CREDIT, // m_StyleType { 160, 480 }, // m_iCenterX 5, // m_iColsPerPlayer { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; @@ -665,9 +675,10 @@ StyleDef g_StyleDefs[NUM_STYLES] = GAME_EZ2, // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit - "SingleHard", // m_szName - NOTES_TYPE_EZ2_SINGLE_HARD, // m_NotesType - StyleDef::ONE_PLAYER_ONE_CREDIT, // m_StyleType + "EZ2 SingleHard", // m_szName + { NOTES_TYPE_EZ2_SINGLE_HARD,NOTES_TYPE_EZ2_SINGLE_HARD}, // m_NotesTypes + NOTES_TYPE_INVALID, // m_FallbackNotesType + StyleDef::ONE_PLAYER_ONE_CREDIT, // m_StyleType { 160, 480 }, // m_iCenterX 5, // m_iColsPerPlayer { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; @@ -694,9 +705,10 @@ StyleDef g_StyleDefs[NUM_STYLES] = GAME_EZ2, // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit - "Double", // m_szName - NOTES_TYPE_EZ2_DOUBLE, // m_NotesType - StyleDef::ONE_PLAYER_TWO_CREDITS, // m_StyleType + "EZ2Double", // m_szName + { NOTES_TYPE_EZ2_DOUBLE,NOTES_TYPE_EZ2_DOUBLE }, // m_NotesTypes + NOTES_TYPE_INVALID, // m_FallbackNotesType + StyleDef::ONE_PLAYER_TWO_CREDITS, // m_StyleType { 160, 480 }, // m_iCenterX 10, // m_iColsPerPlayer { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; @@ -733,9 +745,10 @@ StyleDef g_StyleDefs[NUM_STYLES] = GAME_EZ2, // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit - "Real", // m_szName - NOTES_TYPE_EZ2_REAL, // m_NotesType - StyleDef::ONE_PLAYER_ONE_CREDIT, // m_StyleType + "EZ2 Real", // m_szName + { NOTES_TYPE_EZ2_REAL,NOTES_TYPE_EZ2_REAL }, // m_NotesTypes + NOTES_TYPE_INVALID, // m_FallbackNotesType + StyleDef::ONE_PLAYER_ONE_CREDIT, // m_StyleType { 160, 480 }, // m_iCenterX 7, // m_iColsPerPlayer { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; @@ -766,9 +779,10 @@ StyleDef g_StyleDefs[NUM_STYLES] = GAME_EZ2, // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit - "Versus", // m_szName - NOTES_TYPE_EZ2_SINGLE, // m_NotesType - StyleDef::TWO_PLAYERS_TWO_CREDITS, // m_StyleType + "EZ2 Versus", // m_szName + { NOTES_TYPE_EZ2_SINGLE,NOTES_TYPE_EZ2_SINGLE }, // m_NotesTypes + NOTES_TYPE_INVALID, // m_FallbackNotesType + StyleDef::TWO_PLAYERS_TWO_CREDITS, // m_StyleType { 160, 480 }, // m_iCenterX 5, // m_iColsPerPlayer { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; @@ -795,9 +809,10 @@ StyleDef g_StyleDefs[NUM_STYLES] = GAME_EZ2, // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit - "VersusHard", // m_szName - NOTES_TYPE_EZ2_SINGLE_HARD, // m_NotesType - StyleDef::TWO_PLAYERS_TWO_CREDITS, // m_StyleType + "EZ2 VersusHard", // m_szName + { NOTES_TYPE_EZ2_SINGLE_HARD,NOTES_TYPE_EZ2_SINGLE_HARD }, // m_NotesTypes + NOTES_TYPE_INVALID, // m_FallbackNotesType + StyleDef::TWO_PLAYERS_TWO_CREDITS, // m_StyleType { 160, 480 }, // m_iCenterX 5, // m_iColsPerPlayer { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; @@ -824,9 +839,10 @@ StyleDef g_StyleDefs[NUM_STYLES] = GAME_EZ2, // m_Game true, // m_bUsedForGameplay true, // m_bUsedForEdit - "VersusReal", // m_szName - NOTES_TYPE_EZ2_REAL, // m_NotesType - StyleDef::TWO_PLAYERS_TWO_CREDITS, // m_StyleType + "EZ2 VersusReal", // m_szName + { NOTES_TYPE_EZ2_REAL,NOTES_TYPE_EZ2_REAL }, // m_NotesTypes + NOTES_TYPE_INVALID, // m_FallbackNotesType + StyleDef::TWO_PLAYERS_TWO_CREDITS, // m_StyleType { 160, 480 }, // m_iCenterX 7, // m_iColsPerPlayer { // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER]; @@ -873,34 +889,39 @@ const StyleDef* GameManager::GetStyleDefForStyle( Style s ) return &g_StyleDefs[ s ]; } -Style GameManager::GetEditStyleThatPlaysNotesType( NotesType nt ) +void GameManager::GetGameplayStylesForGame( Game game, CArray& aStylesAddTo, bool editor ) { - for( int i=0; i& aStylesAddTo ) -{ - for( int s=0; s& aNotesTypeAddTo ) { for( int nt=0; nt& aStylesAddTo ); // do not include edit-specific + void GetGameplayStylesForGame( Game game, CArray& aStylesAddTo, bool editor=false ); void GetNotesTypesForGame( Game game, CArray& aNotesTypeAddTo ); // only look at edit-specific styles - Style GetEditStyleThatPlaysNotesType( NotesType nt ); // void GetGameNames( CStringArray &AddTo ); // bool DoesGameExist( CString sGameName ); diff --git a/stepmania/src/MusicWheel.cpp b/stepmania/src/MusicWheel.cpp index 3a5e7d8e9b..cf5fd7e7fa 100644 --- a/stepmania/src/MusicWheel.cpp +++ b/stepmania/src/MusicWheel.cpp @@ -184,10 +184,11 @@ void WheelItemDisplay::RefreshGrades() continue; } + /* XXX: Don't really want separate grades for each player in couples. */ if( m_pSong ) // this is a song display { const DifficultyClass dc = GAMESTATE->m_PreferredDifficultyClass[p]; - const Grade grade = m_pSong->GetGradeForDifficultyClass( GAMESTATE->GetCurrentStyleDef()->m_NotesType, dc ); + const Grade grade = m_pSong->GetGradeForDifficultyClass( GAMESTATE->GetCurrentStyleDef(), p, dc ); m_GradeDisplay[p].SetGrade( (PlayerNumber)p, grade ); //m_GradeDisplay[p].SetDiffuse( PlayerToColor((PlayerNumber)p) ); } @@ -330,7 +331,7 @@ MusicWheel::MusicWheel() SONGMAN->GetExtraStageInfo( GAMESTATE->IsExtraStage2(), GAMESTATE->m_sPreferredGroup, - GAMESTATE->GetCurrentStyleDef()->m_NotesType, + GAMESTATE->GetCurrentStyleDef(), pSong, pNotes, po, @@ -344,6 +345,7 @@ MusicWheel::MusicWheel() GAMESTATE->m_PlayerOptions[p] = po; } } + /* XXX: Set up couples correctly */ GAMESTATE->m_SongOptions = so; } @@ -443,7 +445,7 @@ void MusicWheel::BuildWheelItemDatas( CArray &arr } CArray arraySteps; - pSong->GetNotesThatMatch( GAMESTATE->GetCurrentStyleDef()->m_NotesType, arraySteps ); + pSong->GetNotesThatMatch( GAMESTATE->GetCurrentStyleDef(), 0, arraySteps ); if( arraySteps.GetSize() > 0 ) arraySongs.Add( pSong ); @@ -577,7 +579,7 @@ void MusicWheel::BuildWheelItemDatas( CArray &arr continue; WheelItemData& WID = arrayWheelItemDatas[i]; - bool bIsEasy = pSong->IsEasy( GAMESTATE->GetCurrentStyleDef()->m_NotesType ); + bool bIsEasy = pSong->IsEasy( GAMESTATE->GetCurrentStyleDef()->m_NotesTypes[0] ); WID.m_IconType = bIsEasy ? MusicStatusDisplay::easy : MusicStatusDisplay::none; } diff --git a/stepmania/src/NoteData.cpp b/stepmania/src/NoteData.cpp index 529b4bd465..f1c5cabb7d 100644 --- a/stepmania/src/NoteData.cpp +++ b/stepmania/src/NoteData.cpp @@ -476,7 +476,8 @@ void NoteData::Turn( PlayerOptions::TurnType tt ) case PlayerOptions::TURN_LEFT: case PlayerOptions::TURN_RIGHT: // HACK: TurnRight does the same thing as TurnLeft. I'll fix this later... // Chris: Handling each NotesType case is a terrible way to do this, but oh well... - switch( GAMESTATE->GetCurrentStyleDef()->m_NotesType ) + /* XXX: This assumes each NotesType in a style turns the same. */ + switch( GAMESTATE->GetCurrentStyleDef()->m_NotesTypes[0] ) { case NOTES_TYPE_DANCE_SINGLE: case NOTES_TYPE_DANCE_DOUBLE: diff --git a/stepmania/src/ScreenEdit.cpp b/stepmania/src/ScreenEdit.cpp index c30777254d..f234b175bd 100644 --- a/stepmania/src/ScreenEdit.cpp +++ b/stepmania/src/ScreenEdit.cpp @@ -168,7 +168,8 @@ ScreenEdit::ScreenEdit() { m_pNotes = new Notes; m_pNotes->m_DifficultyClass = CLASS_MEDIUM; - m_pNotes->m_NotesType = GAMESTATE->GetCurrentStyleDef()->m_NotesType; + /* XXX: figure out how to handle second player couples in the editor */ + m_pNotes->m_NotesType = GAMESTATE->GetCurrentStyleDef()->m_NotesTypes[0]; m_pNotes->m_sDescription = "Untitled"; // Dro Kulix: If m_pNotes->m_NotesType is not changed here, // the edit mode is somehow stuck only being able to edit diff --git a/stepmania/src/ScreenEditMenu.cpp b/stepmania/src/ScreenEditMenu.cpp index 1880e22fac..017083fafd 100644 --- a/stepmania/src/ScreenEditMenu.cpp +++ b/stepmania/src/ScreenEditMenu.cpp @@ -106,8 +106,7 @@ void ScreenEditMenu::HandleScreenMessage( const ScreenMessage SM ) // Find the first Style that will play the selected notes type. // Set the current Style, then let ScreenEdit infer the desired // NotesType from that Style. - NotesType nt = Selector.GetSelectedNotesType(); - Style style = GAMEMAN->GetEditStyleThatPlaysNotesType( nt ); + Style style = Selector.GetSelectedStyle(); GAMESTATE->m_CurStyle = style; GAMESTATE->m_CurGame = GAMEMAN->GetStyleDefForStyle(style)->m_Game; @@ -144,7 +143,7 @@ void ScreenEditMenu::MenuStart( PlayerNumber pn ) // find the first style that matches this notes type GameDef* pGameDef = GAMESTATE->GetCurrentGameDef(); - GAMESTATE->m_CurStyle = GAMEMAN->GetEditStyleThatPlaysNotesType( Selector.GetSelectedNotesType() ); + GAMESTATE->m_CurStyle = Selector.GetSelectedStyle(); GAMESTATE->m_pCurNotes[PLAYER_1] = Selector.GetSelectedNotes(); m_soundSelect.PlayRandom(); diff --git a/stepmania/src/ScreenSelectGroup.cpp b/stepmania/src/ScreenSelectGroup.cpp index 8cd7e809b8..2464919cb8 100644 --- a/stepmania/src/ScreenSelectGroup.cpp +++ b/stepmania/src/ScreenSelectGroup.cpp @@ -70,16 +70,13 @@ ScreenSelectGroup::ScreenSelectGroup() aAllSongs.Copy( SONGMAN->m_pSongs ); // Filter out Songs that can't be played by the current Style + for( i=aAllSongs.GetSize()-1; i>=0; i-- ) // foreach Song, back to front { - NotesType nt = GAMESTATE->GetCurrentStyleDef()->m_NotesType; - for( i=aAllSongs.GetSize()-1; i>=0; i-- ) // foreach Song, back to front - { - if( aAllSongs[i]->SongHasNotesType(nt) && - aAllSongs[i]->NormallyDisplayed() ) - continue; + if( aAllSongs[i]->SongCompleteForStyle(GAMESTATE->GetCurrentStyleDef()) && + aAllSongs[i]->NormallyDisplayed() ) + continue; - aAllSongs.RemoveAt( i ); - } + aAllSongs.RemoveAt( i ); } // Get group names by thowing them into a hash diff --git a/stepmania/src/ScreenSelectMusic.cpp b/stepmania/src/ScreenSelectMusic.cpp index 8395da0fb7..57e0e25683 100644 --- a/stepmania/src/ScreenSelectMusic.cpp +++ b/stepmania/src/ScreenSelectMusic.cpp @@ -458,14 +458,14 @@ void ScreenSelectMusic::EasierDifficulty( PlayerNumber pn ) if( !GAMESTATE->IsPlayerEnabled(pn) ) return; - if( m_arrayNotes.GetSize() == 0 ) + if( m_arrayNotes[pn].GetSize() == 0 ) return; if( m_iSelection[pn] == 0 ) return; m_iSelection[pn]--; // the user explicity switched difficulties. Update the preferred difficulty - GAMESTATE->m_PreferredDifficultyClass[pn] = m_arrayNotes[ m_iSelection[pn] ]->m_DifficultyClass; + GAMESTATE->m_PreferredDifficultyClass[pn] = m_arrayNotes[pn][ m_iSelection[pn] ]->m_DifficultyClass; m_soundChangeNotes.Play(); @@ -478,14 +478,14 @@ void ScreenSelectMusic::HarderDifficulty( PlayerNumber pn ) if( !GAMESTATE->IsPlayerEnabled(pn) ) return; - if( m_arrayNotes.GetSize() == 0 ) + if( m_arrayNotes[pn].GetSize() == 0 ) return; - if( m_iSelection[pn] == m_arrayNotes.GetSize()-1 ) + if( m_iSelection[pn] == m_arrayNotes[pn].GetSize()-1 ) return; m_iSelection[pn]++; // the user explicity switched difficulties. Update the preferred difficulty - GAMESTATE->m_PreferredDifficultyClass[pn] = m_arrayNotes[ m_iSelection[pn] ]->m_DifficultyClass; + GAMESTATE->m_PreferredDifficultyClass[pn] = m_arrayNotes[pn][ m_iSelection[pn] ]->m_DifficultyClass; m_soundChangeNotes.Play(); @@ -681,9 +681,9 @@ void ScreenSelectMusic::AfterNotesChange( PlayerNumber pn ) if( !GAMESTATE->IsPlayerEnabled(pn) ) return; - m_iSelection[pn] = clamp( m_iSelection[pn], 0, m_arrayNotes.GetSize()-1 ); // bounds clamping + m_iSelection[pn] = clamp( m_iSelection[pn], 0, m_arrayNotes[pn].GetSize()-1 ); // bounds clamping - Notes* pNotes = m_arrayNotes.GetSize()>0 ? m_arrayNotes[m_iSelection[pn]] : NULL; + Notes* pNotes = m_arrayNotes[pn].GetSize()>0 ? m_arrayNotes[pn][m_iSelection[pn]] : NULL; GAMESTATE->m_pCurNotes[pn] = pNotes; @@ -711,7 +711,9 @@ void ScreenSelectMusic::AfterMusicChange() Song* pSong = m_MusicWheel.GetSelectedSong(); GAMESTATE->m_pCurSong = pSong; - m_arrayNotes.RemoveAll(); + int pn; + for( pn = 0; pn < NUM_PLAYERS; ++pn) + m_arrayNotes[pn].RemoveAll(); switch( m_MusicWheel.GetSelectedType() ) { @@ -730,8 +732,10 @@ void ScreenSelectMusic::AfterMusicChange() break; case TYPE_SONG: { - pSong->GetNotesThatMatch( GAMESTATE->GetCurrentStyleDef()->m_NotesType, m_arrayNotes ); - SortNotesArrayByDifficulty( m_arrayNotes ); + for( int pn = 0; pn < NUM_PLAYERS; ++pn) { + pSong->GetNotesThatMatch( GAMESTATE->GetCurrentStyleDef(), pn, m_arrayNotes[pn] ); + SortNotesArrayByDifficulty( m_arrayNotes[pn] ); + } m_Banner.SetFromSong( pSong ); @@ -747,11 +751,11 @@ void ScreenSelectMusic::AfterMusicChange() { if( !GAMESTATE->IsPlayerEnabled( PlayerNumber(p) ) ) continue; - for( int i=0; im_DifficultyClass == GAMESTATE->m_PreferredDifficultyClass[p] ) + for( int i=0; im_DifficultyClass == GAMESTATE->m_PreferredDifficultyClass[p] ) m_iSelection[p] = i; - m_iSelection[p] = clamp( m_iSelection[p], 0, m_arrayNotes.GetSize() ) ; + m_iSelection[p] = clamp( m_iSelection[p], 0, m_arrayNotes[p].GetSize() ) ; } } break; diff --git a/stepmania/src/ScreenSelectMusic.h b/stepmania/src/ScreenSelectMusic.h index 3af9117d80..cbcb2d3084 100644 --- a/stepmania/src/ScreenSelectMusic.h +++ b/stepmania/src/ScreenSelectMusic.h @@ -57,7 +57,7 @@ protected: void UpdateOptionsDisplays(); - CArray m_arrayNotes; + CArray m_arrayNotes[NUM_PLAYERS]; int m_iSelection[NUM_PLAYERS]; MenuElements m_Menu; diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index cabe276924..5c8e03a45c 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -1232,14 +1232,25 @@ void Song::TidyUpData() } } - -void Song::GetNotesThatMatch( NotesType nt, CArray& arrayAddTo ) const +/* Get Notes that match a given style and player. */ +void Song::GetNotesThatMatch( const StyleDef *s, int p, CArray& arrayAddTo ) const { for( int i=0; im_NotesType == nt ) + if( m_apNotes[i]->m_NotesType == s->m_NotesTypes[p] ) arrayAddTo.Add( m_apNotes[i] ); } +/* Return whether the song is playable in the given style. */ +bool Song::SongCompleteForStyle( const StyleDef *st ) const +{ + for( int pn = 0; pn < NUM_PLAYERS; ++pn ) + { + if(st->m_NotesTypes[pn] == NOTES_TYPE_INVALID) continue; /* unused */ + if(!SongHasNotesType(st->m_NotesTypes[pn])) return false; + } + return true; +} + bool Song::SongHasNotesType( NotesType nt ) const { for( int i=0; i < m_apNotes.GetSize(); i++ ) // foreach Notes @@ -1464,10 +1475,10 @@ void Song::AddAutoGenNotes() } } -Grade Song::GetGradeForDifficultyClass( NotesType nt, DifficultyClass dc ) const +Grade Song::GetGradeForDifficultyClass( const StyleDef *st, int p, DifficultyClass dc ) const { CArray aNotes; - this->GetNotesThatMatch( nt, aNotes ); + this->GetNotesThatMatch( st, p, aNotes ); SortNotesArrayByDifficulty( aNotes ); for( int i=0; i apNotes; - pSong->GetNotesThatMatch( nt, apNotes ); + pSong->GetNotesThatMatch( sd, 0, apNotes ); for( int n=0; nm_apNotes.GetSize() == 0 ) continue; + /* XXX: This assumes we're set to a style that doesn't use separate + * notes for each player, such as VERSUS. */ Notes* pNotes = pSong->m_apNotes[ rand()%pSong->m_apNotes.GetSize() ]; - if( pNotes->m_NotesType != GAMESTATE->GetCurrentStyleDef()->m_NotesType ) + if( pNotes->m_NotesType != GAMESTATE->GetCurrentStyleDef()->m_NotesTypes[0] ) continue; // found something we can use! diff --git a/stepmania/src/SongManager.h b/stepmania/src/SongManager.h index dc18939baf..bb4dd77600 100644 --- a/stepmania/src/SongManager.h +++ b/stepmania/src/SongManager.h @@ -56,7 +56,7 @@ public: void InitCoursesFromDisk(); void ReloadCourses(); - void GetExtraStageInfo( bool bExtra2, CString sPreferredGroup, NotesType nt, + void GetExtraStageInfo( bool bExtra2, CString sPreferredGroup, const StyleDef *s, Song*& pSongOut, Notes*& pNotesOut, PlayerOptions& po_out, SongOptions& so_out ); /* Choose a random song from the current style. Return true diff --git a/stepmania/src/SongSelector.cpp b/stepmania/src/SongSelector.cpp index ecd04876d8..545e529756 100644 --- a/stepmania/src/SongSelector.cpp +++ b/stepmania/src/SongSelector.cpp @@ -68,11 +68,11 @@ SongSelector::SongSelector() m_sprArrowRight.SetDiffuse( D3DXCOLOR(1,1,1,0) ); this->AddChild( &m_sprArrowRight ); - m_textNotesType.LoadFromFont( THEME->GetPathTo("Fonts","header1") ); - m_textNotesType.SetXY( GAME_STYLE_X, GAME_STYLE_Y ); - m_textNotesType.SetDiffuse( D3DXCOLOR(0.7f,0.7f,0.7f,1) ); - m_textNotesType.SetText( "blah" ); - this->AddChild( &m_textNotesType ); + m_textStyle.LoadFromFont( THEME->GetPathTo("Fonts","header1") ); + m_textStyle.SetXY( GAME_STYLE_X, GAME_STYLE_Y ); + m_textStyle.SetDiffuse( D3DXCOLOR(0.7f,0.7f,0.7f,1) ); + m_textStyle.SetText( "blah" ); + this->AddChild( &m_textStyle ); m_textNotes.LoadFromFont( THEME->GetPathTo("Fonts","header1") ); m_textNotes.SetXY( STEPS_X, STEPS_Y ); @@ -84,8 +84,8 @@ SongSelector::SongSelector() ChangeSelectedRow(ROW_GROUP); SONGMAN->GetGroupNames( m_sGroups ); - GAMEMAN->GetNotesTypesForGame( GAMESTATE->m_CurGame, m_NotesTypes ); - m_iSelectedGroup = m_iSelectedSong = m_iSelectedNotesType = m_iSelectedNotes = 0; + GAMEMAN->GetGameplayStylesForGame( GAMESTATE->m_CurGame, m_Styles, true ); + m_iSelectedGroup = m_iSelectedSong = m_iSelectedStyle = m_iSelectedNotes = 0; if( GAMESTATE->m_pCurSong ) { @@ -101,9 +101,11 @@ SongSelector::SongSelector() m_iSelectedSong = i; OnSongChange(); - for( i=0; iGetCurrentStyleDef()->m_NotesType == m_NotesTypes[i] ) - m_iSelectedNotesType = i; + for( i=0; iGetCurrentStyleDef() == GAMEMAN->GetStyleDefForStyle(m_Styles[i]) ) + m_iSelectedStyle = i; + } OnNotesTypeChange(); for( i=0; iGetStyleDefForStyle(GetSelectedStyle())->m_szName ); m_pNotess.RemoveAll(); - GetSelectedSong()->GetNotesThatMatch( GetSelectedNotesType(), m_pNotess ); + /* XXX. We should display couples if either side exists ... */ + GetSelectedSong()->GetNotesThatMatch( GAMEMAN->GetStyleDefForStyle(GetSelectedStyle()), 0, m_pNotess ); SortNotesArrayByDifficulty( m_pNotess ); m_pNotess.Add( NULL ); // marker for "(NEW)" m_iSelectedNotes = 0; diff --git a/stepmania/src/SongSelector.h b/stepmania/src/SongSelector.h index a7688c0098..6b5598d7d5 100644 --- a/stepmania/src/SongSelector.h +++ b/stepmania/src/SongSelector.h @@ -32,7 +32,7 @@ public: CString GetSelectedGroup() { return m_sGroups[m_iSelectedGroup]; }; Song* GetSelectedSong() { return m_pSongs[m_iSelectedSong]; }; - NotesType GetSelectedNotesType() { return m_NotesTypes[m_iSelectedNotesType]; }; + Style GetSelectedStyle() { return m_Styles[m_iSelectedStyle]; }; Notes* GetSelectedNotes() { return m_pNotess[m_iSelectedNotes]; }; /* not used yet */ @@ -40,7 +40,7 @@ public: void AllowNewNotes(bool NewNotes_=true) { NewNotes = NewNotes; } private: - enum SelectedRow { ROW_GROUP, ROW_SONG, ROW_NOTES_TYPE, ROW_STEPS, NUM_ROWS }; + enum SelectedRow { ROW_GROUP, ROW_SONG, ROW_STYLE, ROW_STEPS, NUM_ROWS }; SelectedRow m_SelectedRow; CStringArray m_sGroups; @@ -54,9 +54,10 @@ private: Sprite m_sprArrowLeft; Sprite m_sprArrowRight; - CArray m_NotesTypes; - int m_iSelectedNotesType; // index into m_NotesTypes - BitmapText m_textNotesType; + + CArray m_Styles; + int m_iSelectedStyle; // index into m_Styles + BitmapText m_textStyle; CArray m_pNotess; int m_iSelectedNotes; // index into m_pNotess diff --git a/stepmania/src/StyleDef.cpp b/stepmania/src/StyleDef.cpp index 3ce7060846..e4b8de0531 100644 --- a/stepmania/src/StyleDef.cpp +++ b/stepmania/src/StyleDef.cpp @@ -80,3 +80,13 @@ PlayerNumber StyleDef::ControllerToPlayerNumber( GameController controller ) con return PLAYER_INVALID; } } + +bool StyleDef::MatchesNotesType( NotesType type, int pn ) const +{ + if(type == m_NotesTypes[pn]) return true; + if(type == m_FallbackNotesType) return true; + + return false; + +} + diff --git a/stepmania/src/StyleDef.h b/stepmania/src/StyleDef.h index a2f4668f66..65a4bb58df 100644 --- a/stepmania/src/StyleDef.h +++ b/stepmania/src/StyleDef.h @@ -41,15 +41,25 @@ public: /* The name of the style. (This is currently unused.) */ char m_szName[60]; - NotesType m_NotesType; // the notes format that this style reads. - // For example, the "dance versus" reads the Notes with the tag "dance-single". + + /* m_NotesTypes[] defines the notes format used for each player. For + * example, the "dance versus" reads the Notes with the tag "dance-single". + * For most modes, this will be the same for all styles; it's different + * for each player in couples. */ + NotesType m_NotesTypes[NUM_PLAYERS]; + + /* This type is used as a fallback; if, for any player, m_StyleType[p] isn't + * available, this type will be used. Use NOTES_TYPE_INVALID for no fallback. */ + NotesType m_FallbackNotesType; enum StyleType { ONE_PLAYER_ONE_CREDIT, // e.g. single TWO_PLAYERS_TWO_CREDITS, // e.g. versus ONE_PLAYER_TWO_CREDITS, // e.g. double }; - StyleType m_StyleType; // Defines how many players are allowed to play this Style. + + + StyleType m_StyleType; int m_iCenterX[NUM_PLAYERS]; // center of the player int m_iColsPerPlayer; // number of total tracks this style expects (e.g. 4 for versus, but 8 for double) struct ColumnInfo @@ -68,5 +78,7 @@ public: PlayerNumber ControllerToPlayerNumber( GameController controller ) const; void GetTransformedNoteDataForStyle( PlayerNumber pn, NoteData* pOriginal, NoteData* pNoteDataOut ) const; + + bool MatchesNotesType( NotesType type, int pn ) const; }; diff --git a/stepmania/src/song.h b/stepmania/src/song.h index 7fb89fccee..bcf89399ac 100644 --- a/stepmania/src/song.h +++ b/stepmania/src/song.h @@ -14,6 +14,7 @@ #include "GameConstantsAndTypes.h" #include "RageUtil.h" +#include "StyleDef.h" extern const int FILE_CACHE_VERSION; @@ -174,9 +175,10 @@ public: CArray m_apNotes; + bool SongCompleteForStyle( const StyleDef *st ) const; bool SongHasNotesType( NotesType nt ) const; bool SongHasNotesTypeAndDifficulty( NotesType nt, DifficultyClass dc ) const; - void GetNotesThatMatch( NotesType nt, CArray& arrayAddTo ) const; + void GetNotesThatMatch( const StyleDef *s, int p, CArray& arrayAddTo ) const; int GetNumTimesPlayed() const { int iTotalNumTimesPlayed = 0; @@ -188,7 +190,7 @@ public: } bool IsNew() const; bool IsEasy( NotesType nt ) const; - Grade GetGradeForDifficultyClass( NotesType nt, DifficultyClass dc ) const; + Grade GetGradeForDifficultyClass( const StyleDef *s, int p, DifficultyClass dc ) const; bool NormallyDisplayed() const; bool RouletteDisplayed() const; };