Thrown together Initial working implementation of pack.ini
# Conflicts: # src/MusicWheel.cpp
This commit is contained in:
+69
-15
@@ -542,7 +542,8 @@ void MusicWheel::BuildWheelItemDatas( std::vector<MusicWheelItemData *> &arrayWh
|
||||
split( MODE_MENU_CHOICE_NAMES, ",", vsNames );
|
||||
for( unsigned i=0; i<vsNames.size(); ++i )
|
||||
{
|
||||
MusicWheelItemData wid( WheelItemDataType_Sort, nullptr, "", nullptr, SORT_MENU_COLOR, 0 );
|
||||
LOG->Trace( "Adding mode menu item %s", vsNames[i].c_str() );
|
||||
MusicWheelItemData wid( WheelItemDataType_Sort, nullptr, "", nullptr, nullptr, SORT_MENU_COLOR, 0 );
|
||||
wid.m_pAction = HiddenPtr<GameCommand>( new GameCommand );
|
||||
wid.m_pAction->m_sName = vsNames[i];
|
||||
wid.m_pAction->Load( i, ParseCommands(CHOICE.GetValue(vsNames[i])) );
|
||||
@@ -725,11 +726,11 @@ void MusicWheel::BuildWheelItemDatas( std::vector<MusicWheelItemData *> &arrayWh
|
||||
RageColor colorSection = SECTION_COLORS.GetValue(iSectionColorIndex);
|
||||
iSectionColorIndex = (iSectionColorIndex+1) % NUM_SECTION_COLORS;
|
||||
// Add the section item
|
||||
arrayWheelItemDatas.push_back( new MusicWheelItemData(WheelItemDataType_Section, nullptr, sectionName, nullptr, colorSection, songs.size()) );
|
||||
arrayWheelItemDatas.push_back( new MusicWheelItemData(WheelItemDataType_Section, nullptr, sectionName, nullptr, nullptr, colorSection, songs.size()) );
|
||||
// Add all the songs in this section
|
||||
for (auto const& song : songs)
|
||||
{
|
||||
arrayWheelItemDatas.push_back( new MusicWheelItemData(WheelItemDataType_Song, song, sectionName, nullptr, SONGMAN->GetSongColor(song), 0) );
|
||||
arrayWheelItemDatas.push_back( new MusicWheelItemData(WheelItemDataType_Song, song, sectionName, nullptr, nullptr, SONGMAN->GetSongColor(song), 0) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -742,15 +743,66 @@ void MusicWheel::BuildWheelItemDatas( std::vector<MusicWheelItemData *> &arrayWh
|
||||
RageColor colorSection = SECTION_COLORS.GetValue(iSectionColorIndex);
|
||||
iSectionColorIndex = (iSectionColorIndex+1) % NUM_SECTION_COLORS;
|
||||
// Add the section item
|
||||
arrayWheelItemDatas.push_back( new MusicWheelItemData(WheelItemDataType_Section, nullptr, ssprintf("%d",sectionName), nullptr, colorSection, songs.size()) );
|
||||
arrayWheelItemDatas.push_back( new MusicWheelItemData(WheelItemDataType_Section, nullptr, ssprintf("%d",sectionName), nullptr, nullptr, colorSection, songs.size()) );
|
||||
// Add all the songs in this section
|
||||
for (auto const& song : songs)
|
||||
{
|
||||
arrayWheelItemDatas.push_back( new MusicWheelItemData(WheelItemDataType_Song, song, ssprintf("%d",sectionName), nullptr, SONGMAN->GetSongColor(song), 0) );
|
||||
arrayWheelItemDatas.push_back( new MusicWheelItemData(WheelItemDataType_Song, song, ssprintf("%d",sectionName), nullptr, nullptr, SONGMAN->GetSongColor(song), 0) );
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SORT_GROUP:
|
||||
for( unsigned i=0; i< arraySongs.size(); i++ )
|
||||
{
|
||||
Song* pSong = arraySongs[i];
|
||||
LOG->Trace("SORT_GROUP PREPACK");
|
||||
Pack* pPack = pSong->GetPack();
|
||||
if( bUseSections )
|
||||
{
|
||||
// Print out everything about the pack and song
|
||||
LOG->Trace("Sort Title: %s", pPack->m_sSortTitle);
|
||||
LOG->Trace("Group Name: %s", pPack->m_sGroupName);
|
||||
LOG->Trace("Has PackIni: %s", pPack->m_bHasPackIni ? "true" : "false");
|
||||
LOG->Trace("Display Title: %s", pPack->m_sDisplayTitle);
|
||||
LOG->Trace("Song Title: %s", pSong->GetDisplayFullTitle());
|
||||
LOG->Trace("Group Name from Song: %s", pSong->m_sGroupName.c_str());
|
||||
LOG->Trace("Offset: %d", pPack->m_iSyncOffset);
|
||||
RString sThisSection = pSong->GetPack()->m_sSortTitle;
|
||||
if (pPack->m_bHasPackIni) {
|
||||
LOG->Trace("HE GOT DA INI");
|
||||
sThisSection = pPack->m_sGroupName;
|
||||
}
|
||||
if( sThisSection != sLastSection )
|
||||
{
|
||||
int iSectionCount = 0;
|
||||
// Count songs in this section
|
||||
unsigned j;
|
||||
LOG->Trace("SORT_GROUP AYA21YA: %s", sThisSection.c_str());
|
||||
for( j=i; j < arraySongs.size(); j++ )
|
||||
{
|
||||
if( SongUtil::GetSectionNameFromSongAndSort( arraySongs[j], so ) != sThisSection )
|
||||
break;
|
||||
}
|
||||
LOG->Trace("SORT_GROUP AYA22YA: %s", sThisSection.c_str());
|
||||
iSectionCount = j-i;
|
||||
|
||||
// new section, make a section item
|
||||
// todo: preferred sort section color handling? -aj
|
||||
RageColor colorSection = (so==SORT_GROUP) ? SONGMAN->GetSongGroupColor(sThisSection) : SECTION_COLORS.GetValue(iSectionColorIndex);
|
||||
iSectionColorIndex = (iSectionColorIndex+1) % NUM_SECTION_COLORS;
|
||||
LOG->Trace("SORT_GROUP BEFORE: %s", sThisSection.c_str());
|
||||
arrayWheelItemDatas.push_back( new MusicWheelItemData(WheelItemDataType_Section, nullptr, sThisSection, nullptr, pPack, colorSection, iSectionCount) );
|
||||
sLastSection = sThisSection;
|
||||
LOG->Trace("SORT_GROUP AFTER: %s", sLastSection.c_str());
|
||||
}
|
||||
}
|
||||
LOG->Trace("SORT_GROUP AYAYA: %s", sLastSection.c_str());
|
||||
arrayWheelItemDatas.push_back( new MusicWheelItemData(WheelItemDataType_Song, pSong, sLastSection, nullptr, pPack, SONGMAN->GetSongColor(pSong), 0) );
|
||||
LOG->Trace("SORT_GROUP Pushed back Successfully: %s", sLastSection.c_str());
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
for( unsigned i=0; i< arraySongs.size(); i++ )
|
||||
{
|
||||
@@ -773,13 +825,13 @@ void MusicWheel::BuildWheelItemDatas( std::vector<MusicWheelItemData *> &arrayWh
|
||||
|
||||
// new section, make a section item
|
||||
// todo: preferred sort section color handling? -aj
|
||||
RageColor colorSection = (so==SORT_GROUP) ? SONGMAN->GetSongGroupColor(pSong->m_sGroupName) : SECTION_COLORS.GetValue(iSectionColorIndex);
|
||||
RageColor colorSection = (so==SORT_GROUP) ? SONGMAN->GetSongGroupColor(sThisSection) : SECTION_COLORS.GetValue(iSectionColorIndex);
|
||||
iSectionColorIndex = (iSectionColorIndex+1) % NUM_SECTION_COLORS;
|
||||
arrayWheelItemDatas.push_back( new MusicWheelItemData(WheelItemDataType_Section, nullptr, sThisSection, nullptr, colorSection, iSectionCount) );
|
||||
arrayWheelItemDatas.push_back( new MusicWheelItemData(WheelItemDataType_Section, nullptr, sThisSection, nullptr, nullptr, colorSection, iSectionCount) );
|
||||
sLastSection = sThisSection;
|
||||
}
|
||||
}
|
||||
arrayWheelItemDatas.push_back( new MusicWheelItemData(WheelItemDataType_Song, pSong, sLastSection, nullptr, SONGMAN->GetSongColor(pSong), 0) );
|
||||
arrayWheelItemDatas.push_back( new MusicWheelItemData(WheelItemDataType_Song, pSong, sLastSection, nullptr, pSong->GetPack(), SONGMAN->GetSongColor(pSong), 0) );
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -788,7 +840,7 @@ void MusicWheel::BuildWheelItemDatas( std::vector<MusicWheelItemData *> &arrayWh
|
||||
{
|
||||
// todo: allow themers to change the order of the items. -aj
|
||||
if( SHOW_ROULETTE )
|
||||
arrayWheelItemDatas.push_back( new MusicWheelItemData(WheelItemDataType_Roulette, nullptr, "", nullptr, ROULETTE_COLOR, 0) );
|
||||
arrayWheelItemDatas.push_back( new MusicWheelItemData(WheelItemDataType_Roulette, nullptr, "", nullptr, nullptr, ROULETTE_COLOR, 0) );
|
||||
|
||||
// Only add WheelItemDataType_Random and WheelItemDataType_Portal if there's at least
|
||||
// one song on the list.
|
||||
@@ -798,17 +850,18 @@ void MusicWheel::BuildWheelItemDatas( std::vector<MusicWheelItemData *> &arrayWh
|
||||
bFoundAnySong = true;
|
||||
|
||||
if( SHOW_RANDOM && bFoundAnySong )
|
||||
arrayWheelItemDatas.push_back( new MusicWheelItemData(WheelItemDataType_Random, nullptr, "", nullptr, RANDOM_COLOR, 0) );
|
||||
arrayWheelItemDatas.push_back( new MusicWheelItemData(WheelItemDataType_Random, nullptr, "", nullptr, nullptr, RANDOM_COLOR, 0) );
|
||||
LOG->Trace("CRINGLEBINGLE3");
|
||||
|
||||
if( SHOW_PORTAL && bFoundAnySong )
|
||||
arrayWheelItemDatas.push_back( new MusicWheelItemData(WheelItemDataType_Portal, nullptr, "", nullptr, PORTAL_COLOR, 0) );
|
||||
arrayWheelItemDatas.push_back( new MusicWheelItemData(WheelItemDataType_Portal, nullptr, "", nullptr, nullptr, PORTAL_COLOR, 0) );
|
||||
|
||||
// add custom wheel items
|
||||
std::vector<RString> vsNames;
|
||||
split( CUSTOM_WHEEL_ITEM_NAMES, ",", vsNames );
|
||||
for( unsigned i=0; i<vsNames.size(); ++i )
|
||||
{
|
||||
MusicWheelItemData wid( WheelItemDataType_Custom, nullptr, "", nullptr, CUSTOM_CHOICE_COLORS.GetValue(vsNames[i]), 0 );
|
||||
MusicWheelItemData wid( WheelItemDataType_Custom, nullptr, "", nullptr, nullptr, CUSTOM_CHOICE_COLORS.GetValue(vsNames[i]), 0 );
|
||||
wid.m_pAction = HiddenPtr<GameCommand>( new GameCommand );
|
||||
wid.m_pAction->m_sName = vsNames[i];
|
||||
wid.m_pAction->Load( i, ParseCommands(CUSTOM_CHOICES.GetValue(vsNames[i])) );
|
||||
@@ -934,12 +987,13 @@ void MusicWheel::BuildWheelItemDatas( std::vector<MusicWheelItemData *> &arrayWh
|
||||
{
|
||||
RageColor c = SECTION_COLORS.GetValue(iSectionColorIndex);
|
||||
iSectionColorIndex = (iSectionColorIndex+1) % NUM_SECTION_COLORS;
|
||||
arrayWheelItemDatas.push_back( new MusicWheelItemData(WheelItemDataType_Section, nullptr, sThisSection, nullptr, c, 0) );
|
||||
LOG->Trace("CRINGLEBINGLE7");
|
||||
arrayWheelItemDatas.push_back( new MusicWheelItemData(WheelItemDataType_Section, nullptr, sThisSection, nullptr, nullptr, c, 0) );
|
||||
sLastSection = sThisSection;
|
||||
}
|
||||
|
||||
RageColor c = ( pCourse->m_sGroupName.size() == 0 ) ? pCourse->GetColor() : SONGMAN->GetCourseColor(pCourse);
|
||||
arrayWheelItemDatas.push_back( new MusicWheelItemData(WheelItemDataType_Course, nullptr, sThisSection, pCourse, c, 0) );
|
||||
arrayWheelItemDatas.push_back( new MusicWheelItemData(WheelItemDataType_Course, nullptr, sThisSection, pCourse, nullptr, c, 0) );
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1153,7 +1207,7 @@ void MusicWheel::FilterWheelItemDatas(std::vector<MusicWheelItemData *> &aUnFilt
|
||||
|
||||
// If we've filtered all items, insert a dummy.
|
||||
if( aFilteredData.empty() )
|
||||
aFilteredData.push_back( new MusicWheelItemData(WheelItemDataType_Section, nullptr, EMPTY_STRING, nullptr, EMPTY_COLOR, 0) );
|
||||
aFilteredData.push_back( new MusicWheelItemData(WheelItemDataType_Section, nullptr, EMPTY_STRING, nullptr, nullptr, EMPTY_COLOR, 0) );
|
||||
}
|
||||
|
||||
void MusicWheel::UpdateSwitch()
|
||||
|
||||
Reference in New Issue
Block a user