ScrollingBannerList should now load up no matter how many songs you have in a folder. Including < 5 and 0 songs.
This commit is contained in:
@@ -28,6 +28,7 @@ MusicBannerWheel::MusicBannerWheel()
|
|||||||
currentPos=0;
|
currentPos=0;
|
||||||
scrlistPos=0;
|
scrlistPos=0;
|
||||||
SongsExist=0;
|
SongsExist=0;
|
||||||
|
SingleLoad=0;
|
||||||
|
|
||||||
m_ScrollingList.UseSpriteType(BANNERTYPE);
|
m_ScrollingList.UseSpriteType(BANNERTYPE);
|
||||||
m_ScrollingList.SetXY( 0, 0 );
|
m_ScrollingList.SetXY( 0, 0 );
|
||||||
@@ -97,6 +98,29 @@ void MusicBannerWheel::LoadSongData()
|
|||||||
{
|
{
|
||||||
Song* pSong;
|
Song* pSong;
|
||||||
CStringArray asGraphicPaths;
|
CStringArray asGraphicPaths;
|
||||||
|
|
||||||
|
if(MAXSONGSINBUFFER >= arraySongs.size() && SingleLoad != 1) // less than the MAXSONGSINBUFFER means we can get away with loading the lot in one go
|
||||||
|
{
|
||||||
|
SingleLoad=2;
|
||||||
|
int difference=0;
|
||||||
|
// find out just how short of a full buffer we are =)
|
||||||
|
difference = MAXSONGSINBUFFER - arraySongs.size();
|
||||||
|
for(int i=0; i<=difference; i++)
|
||||||
|
{
|
||||||
|
for(int c=0; c<arraySongs.size(); c++)
|
||||||
|
{
|
||||||
|
pSong = arraySongs[c];
|
||||||
|
|
||||||
|
if( pSong == NULL ) asGraphicPaths.push_back(THEME->GetPathTo("Graphics","fallback banner"));
|
||||||
|
else if (pSong->HasBanner()) asGraphicPaths.push_back(pSong->GetBannerPath());
|
||||||
|
else if (PREFSMAN->m_bUseBGIfNoBanner && pSong->HasBackground() ) asGraphicPaths.push_back(pSong->GetBannerPath());
|
||||||
|
else asGraphicPaths.push_back(THEME->GetPathTo("Graphics","fallback banner"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(SingleLoad==0)
|
||||||
|
{
|
||||||
for(int count=0; count<MAXSONGSINBUFFER; count++)
|
for(int count=0; count<MAXSONGSINBUFFER; count++)
|
||||||
{
|
{
|
||||||
/* In essence, this element is the central one so we want the scrolling list
|
/* In essence, this element is the central one so we want the scrolling list
|
||||||
@@ -144,7 +168,11 @@ void MusicBannerWheel::LoadSongData()
|
|||||||
else if (PREFSMAN->m_bUseBGIfNoBanner && pSong->HasBackground() ) asGraphicPaths.push_back(pSong->GetBannerPath());
|
else if (PREFSMAN->m_bUseBGIfNoBanner && pSong->HasBackground() ) asGraphicPaths.push_back(pSong->GetBannerPath());
|
||||||
else asGraphicPaths.push_back(THEME->GetPathTo("Graphics","fallback banner"));
|
else asGraphicPaths.push_back(THEME->GetPathTo("Graphics","fallback banner"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if(SingleLoad != 1)
|
||||||
m_ScrollingList.Load( asGraphicPaths );
|
m_ScrollingList.Load( asGraphicPaths );
|
||||||
|
if(SingleLoad == 2)
|
||||||
|
SingleLoad = 1;
|
||||||
PlayMusicSample();
|
PlayMusicSample();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,10 +203,14 @@ void MusicBannerWheel::BannersLeft()
|
|||||||
currentPos--;
|
currentPos--;
|
||||||
|
|
||||||
if(scrlistPos==0)
|
if(scrlistPos==0)
|
||||||
|
if(SingleLoad == 0)
|
||||||
scrlistPos = MAXSONGSINBUFFER-1;
|
scrlistPos = MAXSONGSINBUFFER-1;
|
||||||
|
else
|
||||||
|
scrlistPos = arraySongs.size()-1;
|
||||||
else
|
else
|
||||||
scrlistPos--;
|
scrlistPos--;
|
||||||
|
|
||||||
|
if(SingleLoad == 0)
|
||||||
m_ScrollingList.Unload();
|
m_ScrollingList.Unload();
|
||||||
LoadSongData();
|
LoadSongData();
|
||||||
m_debugtext.SetText(ssprintf("currentPos: %d scrlistPos: %d",currentPos,scrlistPos));
|
m_debugtext.SetText(ssprintf("currentPos: %d scrlistPos: %d",currentPos,scrlistPos));
|
||||||
@@ -198,6 +230,7 @@ void MusicBannerWheel::BannersRight()
|
|||||||
else
|
else
|
||||||
scrlistPos++;
|
scrlistPos++;
|
||||||
|
|
||||||
|
if(SingleLoad == 0)
|
||||||
m_ScrollingList.Unload();
|
m_ScrollingList.Unload();
|
||||||
LoadSongData();
|
LoadSongData();
|
||||||
m_debugtext.SetText(ssprintf("currentPos: %d scrlistPos: %d",currentPos,scrlistPos));
|
m_debugtext.SetText(ssprintf("currentPos: %d scrlistPos: %d",currentPos,scrlistPos));
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ private:
|
|||||||
int scrlistPos;
|
int scrlistPos;
|
||||||
|
|
||||||
int SongsExist;
|
int SongsExist;
|
||||||
|
int SingleLoad;
|
||||||
|
|
||||||
CArray<Song*, Song*> arraySongs;
|
CArray<Song*, Song*> arraySongs;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user