Show banners while MusicWheel is moving fast.

Broke SORT_GROUP into SORT_PREFERRED/SORT_GROUP (like DDREX)
This commit is contained in:
Chris Danford
2003-04-19 18:51:13 +00:00
parent c939d40ae5
commit 1b38fe101c
20 changed files with 197 additions and 86 deletions
+6 -1
View File
@@ -15,6 +15,8 @@
#include "RageBitmapTexture.h"
#include "ThemeManager.h"
#include "RageUtil.h"
#include "Song.h"
#include "RageTextureManager.h"
Banner::Banner()
@@ -22,7 +24,10 @@ Banner::Banner()
m_bScrolling = false;
m_fPercentScrolling = 0;
// LoadFallback();
TEXTUREMAN->CacheTexture( THEME->GetPathToG("Banner all music") );
TEXTUREMAN->CacheTexture( THEME->GetPathToG("Common fallback banner") );
TEXTUREMAN->CacheTexture( THEME->GetPathToG("Banner roulette") );
TEXTUREMAN->CacheTexture( THEME->GetPathToG("Banner random") );
}
bool Banner::Load( RageTextureID ID )
+1 -1
View File
@@ -12,7 +12,7 @@
*/
#include "CroppedSprite.h"
#include "song.h"
class Song;
class Course;
+5
View File
@@ -730,3 +730,8 @@ void SortCoursePointerArrayByDifficulty( vector<Course*> &apCourses )
{
sort( apCourses.begin(), apCourses.end(), CompareCoursePointersByDifficulty );
}
bool Course::HasBanner() const
{
return m_sBannerPath != "" && IsAFile(m_sBannerPath);
}
+3
View File
@@ -47,6 +47,9 @@ public:
bool m_bIsAutogen; // was this created by AutoGen?
CString m_sPath;
CString m_sName;
bool HasBanner() const;
CString m_sBannerPath;
CString m_sCDTitlePath;
+1
View File
@@ -17,6 +17,7 @@
#include "ThemeManager.h"
#include "GameManager.h"
#include "Notes.h"
#include "Song.h"
//
// Defines specific to EditMenu
+62 -22
View File
@@ -13,47 +13,87 @@
#include "FadingBanner.h"
FadingBanner::FadingBanner()
{
m_iIndexFront = 0;
}
void FadingBanner::SetCroppedSize( float fWidth, float fHeight )
{
m_FrontBanner.SetCroppedSize( fWidth, fHeight );
Banner::SetCroppedSize( fWidth, fHeight );
for( int i=0; i<2; i++ )
m_Banner[i].SetCroppedSize( fWidth, fHeight );
}
void FadingBanner::Update( float fDeltaTime )
{
m_FrontBanner.Update(fDeltaTime);
Banner::Update( fDeltaTime );
Actor::Update( fDeltaTime );
for( int i=0; i<2; i++ )
m_Banner[i].Update( fDeltaTime );
}
void FadingBanner::DrawPrimitives()
{
Banner::DrawPrimitives();
m_FrontBanner.Draw();
Actor::DrawPrimitives();
m_Banner[GetBackIndex()].Draw();
m_Banner[m_iIndexFront].Draw();
}
bool FadingBanner::Load( RageTextureID ID )
{
BeforeChange();
if(!Banner::Load(ID))
return false;
Update(0);
return true;
return m_Banner[m_iIndexFront].Load(ID);
}
void FadingBanner::BeforeChange()
{
// move the back banner to the front in preparation for a cross fade
if( this->GetTexture() )
{
m_FrontBanner.Load( this->GetTexture()->GetID() );
m_FrontBanner.SetScrolling( this->IsScrolling(), this->ScrollingPercent() );
}
m_Banner[m_iIndexFront].SetDiffuse( RageColor(1,1,1,1) );
m_FrontBanner.SetDiffuse( RageColor(1,1,1,1) );
m_FrontBanner.StopTweening();
m_FrontBanner.BeginTweening( 0.25f ); // fade out
m_FrontBanner.SetDiffuse( RageColor(1,1,1,0) );
m_iIndexFront = GetBackIndex();
m_Banner[m_iIndexFront].SetDiffuse( RageColor(1,1,1,1) );
m_Banner[m_iIndexFront].StopTweening();
m_Banner[m_iIndexFront].BeginTweening( 0.25f ); // fade out
m_Banner[m_iIndexFront].SetDiffuse( RageColor(1,1,1,0) );
}
void FadingBanner::LoadFromSong( Song* pSong )
{
BeforeChange();
m_Banner[GetBackIndex()].LoadFromSong( pSong );
}
void FadingBanner::LoadAllMusic()
{
BeforeChange();
m_Banner[GetBackIndex()].LoadAllMusic();
}
void FadingBanner::LoadFromGroup( CString sGroupName )
{
BeforeChange();
m_Banner[GetBackIndex()].LoadFromGroup( sGroupName );
}
void FadingBanner::LoadFromCourse( Course* pCourse )
{
BeforeChange();
m_Banner[GetBackIndex()].LoadFromCourse( pCourse );
}
void FadingBanner::LoadRoulette()
{
BeforeChange();
m_Banner[GetBackIndex()].LoadRoulette();
}
void FadingBanner::LoadRandom()
{
BeforeChange();
m_Banner[GetBackIndex()].LoadRandom();
}
void FadingBanner::LoadFallback()
{
BeforeChange();
m_Banner[GetBackIndex()].LoadFallback();
}
+14 -3
View File
@@ -13,20 +13,31 @@
#include "Banner.h"
class FadingBanner : public Banner
class FadingBanner : public Actor
{
public:
virtual ~FadingBanner() { }
FadingBanner();
virtual bool Load( RageTextureID ID );
void SetCroppedSize( float fWidth, float fHeight );
void LoadFromSong( Song* pSong ); // NULL means no song
void LoadAllMusic();
void LoadFromGroup( CString sGroupName );
void LoadFromCourse( Course* pCourse );
void LoadRoulette();
void LoadRandom();
void LoadFallback();
virtual void Update( float fDeltaTime );
virtual void DrawPrimitives();
protected:
void BeforeChange();
Banner m_FrontBanner;
Banner m_Banner[2];
int m_iIndexFront;
int GetBackIndex() { return m_iIndexFront==0 ? 1 : 0; }
};
#endif
+1
View File
@@ -101,6 +101,7 @@ PlayMode StringToPlayMode( CString s );
enum SongSortOrder {
SORT_PREFERRED,
SORT_GROUP,
SORT_TITLE,
SORT_BPM,
+1 -1
View File
@@ -58,7 +58,7 @@ void GameState::Reset()
m_sPreferredGroup = GROUP_ALL_MUSIC;
for( p=0; p<NUM_PLAYERS; p++ )
m_PreferredDifficulty[p] = DIFFICULTY_INVALID;
m_SongSortOrder = SORT_GROUP;
m_SongSortOrder = SORT_PREFERRED;
m_PlayMode = PLAY_MODE_INVALID;
m_bEditing = false;
m_bDemonstrationOrJukebox = false;
+1
View File
@@ -18,6 +18,7 @@
#include "ThemeManager.h"
#include "RageSoundManager.h"
#include "StyleDef.h"
#include "Song.h"
#define BANNERSPACING 200
#define MAXSONGSINBUFFER 5
+2 -1
View File
@@ -21,7 +21,7 @@
MusicSortDisplay::MusicSortDisplay()
{
Load( THEME->GetPathToG("MusicSortDisplay icons 1x4") );
Load( THEME->GetPathToG("MusicSortDisplay icons 1x5") );
StopAnimating();
}
@@ -29,6 +29,7 @@ void MusicSortDisplay::Set( SongSortOrder so )
{
switch( so )
{
case SORT_PREFERRED:
case SORT_GROUP:
case SORT_TITLE:
case SORT_BPM:
+46 -24
View File
@@ -27,6 +27,7 @@
#include "song.h"
#include "Course.h"
#include "RageDisplay.h"
#include "RageTextureManager.h"
#define NUM_WHEEL_ITEMS min( MAX_WHEEL_ITEMS, THEME->GetMetricI("MusicWheel","NumWheelItems") )
@@ -98,12 +99,6 @@ MusicWheel::MusicWheel()
m_soundStart.Load( THEME->GetPathToS("Common start") );
m_soundLocked.Load( THEME->GetPathToS("MusicWheel locked") );
// init m_mapGroupNameToBannerColor
vector<Song*> arraySongs;
SONGMAN->GetSongs( arraySongs, GAMESTATE->GetNumStagesLeft() );
SortSongPointerArrayByGroup( arraySongs );
m_iSelection = 0;
@@ -247,10 +242,13 @@ bool MusicWheel::SelectCourse( const Course *p )
return true;
}
void MusicWheel::GetSongList(vector<Song*> &arraySongs, bool bRoulette )
void MusicWheel::GetSongList(vector<Song*> &arraySongs, SongSortOrder so, CString sPreferredGroup )
{
vector<Song*> apAllSongs;
SONGMAN->GetSongs( apAllSongs, GAMESTATE->GetNumStagesLeft() );
if( so==SORT_PREFERRED && GAMESTATE->m_sPreferredGroup!=GROUP_ALL_MUSIC)
SONGMAN->GetSongs( apAllSongs, GAMESTATE->m_sPreferredGroup, GAMESTATE->GetNumStagesLeft() );
else
SONGMAN->GetSongs( apAllSongs, GAMESTATE->GetNumStagesLeft() );
// copy only songs that have at least one Notes for the current GameMode
for( unsigned i=0; i<apAllSongs.size(); i++ )
@@ -262,9 +260,9 @@ void MusicWheel::GetSongList(vector<Song*> &arraySongs, bool bRoulette )
if( pSong != GAMESTATE->m_pCurSong ||
(!GAMESTATE->IsExtraStage() && !GAMESTATE->IsExtraStage2()) ) {
/* Hide songs that asked to be hidden via #SELECTABLE. */
if( !bRoulette && !pSong->NormallyDisplayed() )
if( so!=SORT_ROULETTE && !pSong->NormallyDisplayed() )
continue;
if( bRoulette && !pSong->RouletteDisplayed() )
if( so==SORT_ROULETTE && !pSong->RouletteDisplayed() )
continue;
}
@@ -327,14 +325,17 @@ void MusicWheel::BuildWheelItemDatas( vector<WheelItemData> &arrayWheelItemDatas
///////////////////////////////////
vector<Song*> arraySongs;
GetSongList(arraySongs, so == SORT_ROULETTE);
GetSongList(arraySongs, so, GAMESTATE->m_sPreferredGroup );
// sort the songs
switch( so )
{
case SORT_GROUP:
case SORT_PREFERRED:
case SORT_ROULETTE:
SortSongPointerArrayByGroup( arraySongs );
SortSongPointerArrayByGroupAndDifficulty( arraySongs );
break;
case SORT_GROUP:
SortSongPointerArrayByGroupAndTitle( arraySongs );
break;
case SORT_TITLE:
SortSongPointerArrayByTitle( arraySongs );
@@ -342,9 +343,6 @@ void MusicWheel::BuildWheelItemDatas( vector<WheelItemData> &arrayWheelItemDatas
case SORT_BPM:
SortSongPointerArrayByBPM( arraySongs );
break;
// case SORT_ARTIST:
// SortSongPointerArrayByArtist( arraySongs );
// break;
case SORT_MOST_PLAYED:
SortSongPointerArrayByMostPlayed( arraySongs );
if( arraySongs.size() > 30 )
@@ -355,7 +353,6 @@ void MusicWheel::BuildWheelItemDatas( vector<WheelItemData> &arrayWheelItemDatas
}
///////////////////////////////////
// Build an array of WheelItemDatas from the sorted list of Song*'s
///////////////////////////////////
@@ -364,9 +361,10 @@ void MusicWheel::BuildWheelItemDatas( vector<WheelItemData> &arrayWheelItemDatas
bool bUseSections = false;
switch( so )
{
case SORT_PREFERRED: bUseSections = false; break;
case SORT_MOST_PLAYED: bUseSections = false; break;
case SORT_BPM: bUseSections = false; break;
case SORT_GROUP: bUseSections = GAMESTATE->m_sPreferredGroup == GROUP_ALL_MUSIC; break;
case SORT_GROUP: bUseSections = true; break;
case SORT_TITLE: bUseSections = true; break;
case SORT_ROULETTE: bUseSections = false; break;
default: ASSERT( 0 );
@@ -377,7 +375,7 @@ void MusicWheel::BuildWheelItemDatas( vector<WheelItemData> &arrayWheelItemDatas
if( bUseSections )
{
/* We're using sections, so use the section name as the top-levle
/* We're using sections, so use the section name as the top-level
* sort. */
stable_sort(arraySongs.begin(), arraySongs.end(),
CompareSongPointerArrayBySectionName(so));
@@ -391,9 +389,6 @@ void MusicWheel::BuildWheelItemDatas( vector<WheelItemData> &arrayWheelItemDatas
CString sThisSection = GetSectionNameFromSongAndSort( pSong, so );
int iSectionColorIndex = 0;
if( GAMESTATE->m_sPreferredGroup != GROUP_ALL_MUSIC && pSong->m_sGroupName != GAMESTATE->m_sPreferredGroup )
continue;
if( sThisSection != sLastSection) // new section, make a section item
{
colorSection = (so==SORT_GROUP) ? SONGMAN->GetGroupColor(pSong->m_sGroupName) : SECTION_COLORS(iSectionColorIndex);
@@ -410,8 +405,6 @@ void MusicWheel::BuildWheelItemDatas( vector<WheelItemData> &arrayWheelItemDatas
for( unsigned i=0; i<arraySongs.size(); i++ )
{
Song* pSong = arraySongs[i];
if( GAMESTATE->m_sPreferredGroup != GROUP_ALL_MUSIC && pSong->m_sGroupName != GAMESTATE->m_sPreferredGroup )
continue; // skip
arrayWheelItemDatas.push_back( WheelItemData(TYPE_SONG, pSong, "", NULL, SONGMAN->GetSongColor(pSong)) );
}
}
@@ -1051,6 +1044,35 @@ void MusicWheel::SetOpenGroup(CString group, SongSortOrder so)
continue;
m_CurWheelItemData.push_back(&from[i]);
//
// cache banners
//
switch( from[i].m_Type )
{
case TYPE_SONG:
{
Song* pSong = from[i].m_pSong;
if( pSong->HasBanner() )
TEXTUREMAN->CacheTexture( pSong->GetBannerPath() );
}
break;
case TYPE_COURSE:
{
Course* pCourse = from[i].m_pCourse;
if( pCourse->HasBanner() )
TEXTUREMAN->CacheTexture( pCourse->m_sBannerPath );
}
break;
case TYPE_SECTION:
{
CString sPath = SONGMAN->GetGroupBannerPath( from[i].m_sSectionName );
if( !sPath.empty() )
TEXTUREMAN->CacheTexture( sPath );
}
break;
default:
break;
}
}
m_iSelection = 0;
+1 -4
View File
@@ -28,13 +28,10 @@ class Song;
const int MAX_WHEEL_ITEMS = 15;
const ScreenMessage SM_SongChanged = ScreenMessage(SM_User+47); // this should be unique!
const ScreenMessage SM_SortOrderChanged = ScreenMessage(SM_User+48);
struct CompareSongPointerArrayBySectionName;
class MusicWheel : public ActorFrame
@@ -76,7 +73,7 @@ public:
void RebuildMusicWheelItems();
protected:
void GetSongList(vector<Song*> &arraySongs, bool bRoulette );
void GetSongList(vector<Song*> &arraySongs, SongSortOrder so, CString sPreferredGroup );
void BuildWheelItemDatas( vector<WheelItemData> &arrayWheelItems, SongSortOrder so );
void SetOpenGroup(CString group, SongSortOrder so = NUM_SORT_ORDERS);
bool SelectSong(const Song *p);
+1 -1
View File
@@ -93,7 +93,7 @@ RageTexture* RageTextureManager::LoadTexture( RageTextureID ID )
else
pTexture = new RageBitmapTexture( ID );
// LOG->Trace( "RageTextureManager: Loaded '%s'.", ID.filename.GetString() );
LOG->Trace( "RageTextureManager: Loaded '%s'.", ID.filename.GetString() );
m_mapPathToTexture[ID] = pTexture;
+4
View File
@@ -38,6 +38,7 @@ ScreenSelectGroup::ScreenSelectGroup() : Screen("ScreenSelectGroup")
if( !PREFSMAN->m_bShowSelectGroup )
{
GAMESTATE->m_sPreferredGroup = GROUP_ALL_MUSIC;
GAMESTATE->m_SongSortOrder = SORT_GROUP;
HandleScreenMessage( SM_GoToNextScreen );
return;
}
@@ -255,6 +256,9 @@ void ScreenSelectGroup::MenuStart( PlayerNumber pn )
GAMESTATE->m_pCurSong = NULL;
GAMESTATE->m_sPreferredGroup = (m_GroupList.GetSelectionName()=="ALL MUSIC" ? GROUP_ALL_MUSIC : m_GroupList.GetSelectionName() );
if( GAMESTATE->m_sPreferredGroup == GROUP_ALL_MUSIC )
GAMESTATE->m_SongSortOrder = SORT_GROUP;
if( GAMESTATE->m_sPreferredGroup == GROUP_ALL_MUSIC )
SOUNDMAN->PlayOnceFromDir( ANNOUNCER->GetPathTo("select group comment all music") );
else
+1 -1
View File
@@ -46,7 +46,7 @@ private:
Sprite m_sprExplanation;
Sprite m_sprFrame;
Banner m_Banner;
FadingBanner m_Banner;
BitmapText m_textNumber;
Sprite m_sprContents;
+12 -12
View File
@@ -734,18 +734,18 @@ void ScreenSelectMusic::AfterMusicChange()
/* If we're rouletting, and we're moving fast, don't touch the banner. */
bool no_banner_change = false;
if(m_MusicWheel.IsMoving())
{
/* We're moving fast. Don't change banners if we're rouletting, or if
* we've been told to never change banners when moving fast.
*
* XXX: When we're not changing banners and not rouletting, show some
* kind of "moving fast" fallback banner. (When rouletting, just keep
* showing the roulette banner.) */
if(m_MusicWheel.IsRouletting() ||
(m_MusicWheel.IsMoving() && !PREFSMAN->m_bChangeBannersWhenFast))
no_banner_change = true;
}
// if(m_MusicWheel.IsMoving())
// {
// /* We're moving fast. Don't change banners if we're rouletting, or if
// * we've been told to never change banners when moving fast.
// *
// * XXX: When we're not changing banners and not rouletting, show some
// * kind of "moving fast" fallback banner. (When rouletting, just keep
// * showing the roulette banner.) */
// if(m_MusicWheel.IsRouletting() ||
// (m_MusicWheel.IsMoving() && !PREFSMAN->m_bChangeBannersWhenFast))
// no_banner_change = true;
// }
m_sprMarathonBalloon.StopTweening();
OFF_COMMAND( m_sprMarathonBalloon );
+23 -4
View File
@@ -11,12 +11,12 @@
-----------------------------------------------------------------------------
*/
#include "song.h"
#include "Notes.h"
#include "RageUtil.h"
#include <math.h> // for fmod
#include "RageLog.h"
#include "IniFile.h"
#include "song.h"
#include "NoteData.h"
#include "MsdFile.h"
#include "RageSound.h"
@@ -1071,7 +1071,7 @@ void SortSongPointerArrayByArtist( vector<Song*> &arraySongPointers )
sort( arraySongPointers.begin(), arraySongPointers.end(), CompareSongPointersByArtist );
}
int CompareSongPointersByGroup(const Song *pSong1, const Song *pSong2)
int CompareSongPointersByGroupAndDifficulty(const Song *pSong1, const Song *pSong2)
{
const CString &sGroup1 = pSong1->m_sGroupName;
const CString &sGroup2 = pSong2->m_sGroupName;
@@ -1085,9 +1085,28 @@ int CompareSongPointersByGroup(const Song *pSong1, const Song *pSong2)
return CompareSongPointersByDifficulty( pSong1, pSong2 );
}
void SortSongPointerArrayByGroup( vector<Song*> &arraySongPointers )
void SortSongPointerArrayByGroupAndDifficulty( vector<Song*> &arraySongPointers )
{
sort( arraySongPointers.begin(), arraySongPointers.end(), CompareSongPointersByGroup );
sort( arraySongPointers.begin(), arraySongPointers.end(), CompareSongPointersByGroupAndDifficulty );
}
int CompareSongPointersByGroupAndTitle(const Song *pSong1, const Song *pSong2)
{
const CString &sGroup1 = pSong1->m_sGroupName;
const CString &sGroup2 = pSong2->m_sGroupName;
if( sGroup1 < sGroup2 )
return true;
if( sGroup1 > sGroup2 )
return false;
/* Same group; compare by name. */
return CompareSongPointersByTitle( pSong1, pSong2 );
}
void SortSongPointerArrayByGroupAndTitle( vector<Song*> &arraySongPointers )
{
sort( arraySongPointers.begin(), arraySongPointers.end(), CompareSongPointersByGroupAndTitle );
}
bool CompareSongPointersByMostPlayed(const Song *pSong1, const Song *pSong2)
+10 -10
View File
@@ -60,7 +60,7 @@ IntDir=.\../Release6
TargetDir=\stepmania\stepmania
TargetName=StepMania
SOURCE="$(InputPath)"
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi
# End Special Build Tool
@@ -95,7 +95,7 @@ IntDir=.\../Debug6
TargetDir=\stepmania\stepmania
TargetName=StepMania-debug
SOURCE="$(InputPath)"
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi
# End Special Build Tool
@@ -1040,6 +1040,14 @@ SOURCE=.\CroppedSprite.h
# End Source File
# Begin Source File
SOURCE=.\FadingBanner.cpp
# End Source File
# Begin Source File
SOURCE=.\FadingBanner.h
# End Source File
# Begin Source File
SOURCE=.\Transition.cpp
# End Source File
# Begin Source File
@@ -1328,14 +1336,6 @@ SOURCE=.\EditMenu.h
# End Source File
# Begin Source File
SOURCE=.\FadingBanner.cpp
# End Source File
# Begin Source File
SOURCE=.\FadingBanner.h
# End Source File
# Begin Source File
SOURCE=.\GradeDisplay.cpp
# End Source File
# Begin Source File
+2 -1
View File
@@ -250,7 +250,8 @@ void SortSongPointerArrayByDifficulty( vector<Song*> &arraySongPointers );
void SortSongPointerArrayByTitle( vector<Song*> &arraySongPointers );
void SortSongPointerArrayByBPM( vector<Song*> &arraySongPointers );
void SortSongPointerArrayByArtist( vector<Song*> &arraySongPointers );
void SortSongPointerArrayByGroup( vector<Song*> &arraySongPointers );
void SortSongPointerArrayByGroupAndDifficulty( vector<Song*> &arraySongPointers );
void SortSongPointerArrayByGroupAndTitle( vector<Song*> &arraySongPointers );
void SortSongPointerArrayByMostPlayed( vector<Song*> &arraySongPointers );