diff --git a/stepmania/Themes/default/metrics.ini b/stepmania/Themes/default/metrics.ini index 3e9c9095ef..b9dc132e47 100644 --- a/stepmania/Themes/default/metrics.ini +++ b/stepmania/Themes/default/metrics.ini @@ -884,3 +884,19 @@ MachineOptions= GraphicOptions= GameplayOptions= AppearanceOptions= + +[TextBanner] +Width=180 +Height=40 +HorizAlign=0 +ArtistPrependString=/ +TwoLinesTitleZoom=1.0 +TwoLinesArtistZoom=0.6 +ThreeLinesTitleZoom=1.0 +ThreeLinesSubTitleZoom=0.5 +ThreeLinesArtistZoom=0.6 +TwoLinesTitleY=-8 +TwoLinesArtistY=8 +ThreeLinesTitleY=-10 +ThreeLinesSubTitleY=0 +ThreeLinesArtistY=10 diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index 6946232c1f..37984224a7 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -20,6 +20,7 @@ #include "RageLog.h" #include "ThemeManager.h" #include "RageUtil.h" +#include "SongManager.h" GameState* GAMESTATE = NULL; // global and accessable from anywhere in our program @@ -120,11 +121,20 @@ int GameState::GetStageIndex() return m_iCurrentStageIndex; } +int GameState::GetNumStagesLeft() +{ + return PREFSMAN->m_iNumArcadeStages - m_iCurrentStageIndex; +} + bool GameState::IsFinalStage() { if( PREFSMAN->m_bEventMode ) return false; - return m_iCurrentStageIndex == PREFSMAN->m_iNumArcadeStages-1; + int iPredictedStageForCurSong = 1; + if( m_pCurSong != NULL ) + iPredictedStageForCurSong = SongManager::GetNumStagesForSong( m_pCurSong ); + + return m_iCurrentStageIndex + iPredictedStageForCurSong == PREFSMAN->m_iNumArcadeStages; } bool GameState::IsExtraStage() diff --git a/stepmania/src/GameState.h b/stepmania/src/GameState.h index ec36f84e85..27c0bd0d36 100644 --- a/stepmania/src/GameState.h +++ b/stepmania/src/GameState.h @@ -70,6 +70,7 @@ public: int m_iCurrentStageIndex; // incremented on Eval screen int GetStageIndex(); + int GetNumStagesLeft(); bool IsFinalStage(); bool IsExtraStage(); bool IsExtraStage2(); diff --git a/stepmania/src/MusicBannerWheel.cpp b/stepmania/src/MusicBannerWheel.cpp index e3cfc95d51..9506bd368e 100644 --- a/stepmania/src/MusicBannerWheel.cpp +++ b/stepmania/src/MusicBannerWheel.cpp @@ -51,25 +51,10 @@ MusicBannerWheel::MusicBannerWheel() this->AddChild( &m_ScrollingList ); if( 0 == stricmp(GAMESTATE->m_sPreferredGroup, "All Music") ) - { - SONGMAN->GetAllSongs( arraySongs ); - } + SONGMAN->GetSongs( arraySongs, GAMESTATE->GetNumStagesLeft() ); else // Get the Group They Want - { - vector apAllSongs; - SONGMAN->GetAllSongs( apAllSongs ); + SONGMAN->GetSongs( arraySongs, GAMESTATE->m_sPreferredGroup, GAMESTATE->GetNumStagesLeft() ); - for( unsigned i=0; im_sPreferredGroup != "ALL MUSIC" && pSong->m_sGroupName != GAMESTATE->m_sPreferredGroup ) - continue; - else - arraySongs.push_back(pSong); - } - - } if( arraySongs.size() > 0) { diff --git a/stepmania/src/MusicStatusDisplay.cpp b/stepmania/src/MusicStatusDisplay.cpp index 29cf7c4861..5122abc45a 100644 --- a/stepmania/src/MusicStatusDisplay.cpp +++ b/stepmania/src/MusicStatusDisplay.cpp @@ -20,64 +20,66 @@ #include "ThemeManager.h" + MusicStatusDisplay::MusicStatusDisplay() { - Load( THEME->GetPathTo("Graphics","music status icons 1x5") ); + Load( THEME->GetPathTo("Graphics","music status icons 4x2") ); StopAnimating(); - - SetType( none ); } -void MusicStatusDisplay::SetType( Type type ) +void MusicStatusDisplay::SetFlags( Flags flags ) { - m_type = type; + m_vIconsToShow.clear(); - SetDiffuse( RageColor(1,1,1,1) ); + // push onto vector in highest to lowest priority - switch( type ) + switch( flags.iPlayersBestNumber ) { - case none: - SetEffectNone(); - SetDiffuse( RageColor(1,1,1,0) ); - break; - case easy: - SetEffectNone(); - SetState( 0 ); - break; - case crown1: - SetState( 1 ); - break; - case crown2: - SetState( 2 ); - break; - case crown3: - SetState( 3 ); - break; - default: - ASSERT(0); + case 1: m_vIconsToShow.push_back( best1 ); break; + case 2: m_vIconsToShow.push_back( best2 ); break; + case 3: m_vIconsToShow.push_back( best3 ); break; } -} -void MusicStatusDisplay::Update( float fDeltaTime ) -{ - Sprite::Update( fDeltaTime ); + if( flags.bEdits ) + m_vIconsToShow.push_back( edits ); + + switch( flags.iStagesForSong ) + { + case 1: break; + case 2: m_vIconsToShow.push_back( long_ver ); break; + case 3: m_vIconsToShow.push_back( marathon ); break; + default: ASSERT(0); + } + + if( flags.bHasBeginnerOr1Meter ) + m_vIconsToShow.push_back( training ); + + + // HACK: Make players best blink if it's the only icon + if( m_vIconsToShow.size() == 1 ) + { + if( m_vIconsToShow[0] >= best1 && m_vIconsToShow[0] <= best3 ) + m_vIconsToShow.push_back( empty ); + } + + + m_vIconsToShow.resize( min(m_vIconsToShow.size(),2u) ); // crop to most important 2 + + if( m_vIconsToShow.size() == 0 ) + Sprite::SetDiffuse( RageColor(1,1,1,0) ); + else + Sprite::SetDiffuse( RageColor(1,1,1,1) ); } void MusicStatusDisplay::DrawPrimitives() { - switch( m_type ) + float fSecondFraction = fmodf(RageTimer::GetTimeSinceStart(), 1 ); + if( m_vIconsToShow.size() > 0 ) { - case none: - case easy: - break; - case crown1: - case crown2: - case crown3: - if( fmodf(RageTimer::GetTimeSinceStart(), 1) > 0.5f ) - return; // blink - break; - default: - ASSERT(0); + int index = (int)(fSecondFraction*m_vIconsToShow.size()); + Sprite::SetState( m_vIconsToShow[index] ); } + Sprite::DrawPrimitives(); } + diff --git a/stepmania/src/MusicStatusDisplay.h b/stepmania/src/MusicStatusDisplay.h index 1dba2e8518..1eee7da834 100644 --- a/stepmania/src/MusicStatusDisplay.h +++ b/stepmania/src/MusicStatusDisplay.h @@ -21,14 +21,23 @@ class MusicStatusDisplay : public Sprite public: MusicStatusDisplay(); - enum Type { none, easy, crown1, crown2, crown3, edits }; - void SetType( Type type ); + struct Flags + { + Flags() { bHasBeginnerOr1Meter = bEdits = false; iPlayersBestNumber = iStagesForSong = 0; } + bool bHasBeginnerOr1Meter; + int iPlayersBestNumber; + bool bEdits; + int iStagesForSong; + }; + + void SetFlags( Flags flags ); - virtual void Update( float fDeltaTime ); virtual void DrawPrimitives(); - + protected: - Type m_type; + enum Icons { training=0, best1, best2, best3, edits, long_ver, marathon, empty }; + + vector m_vIconsToShow; }; #endif diff --git a/stepmania/src/MusicWheel.cpp b/stepmania/src/MusicWheel.cpp index e189f9f42b..03ad382b87 100644 --- a/stepmania/src/MusicWheel.cpp +++ b/stepmania/src/MusicWheel.cpp @@ -1,13 +1,14 @@ #include "stdafx.h" /* ----------------------------------------------------------------------------- - Class: MusicWheel + Class: MusicWheelItem Desc: See header. Copyright (c) 2001-2003 by the person(s) listed below. All rights reserved. Chris Danford Chris Gomez + Glenn Maynard ----------------------------------------------------------------------------- */ @@ -25,18 +26,6 @@ #include "ThemeManager.h" -// WheelItem stuff -#define ICON_X THEME->GetMetricF("WheelItemDisplay","IconX") -#define SONG_NAME_X THEME->GetMetricF("WheelItemDisplay","SongNameX") -#define SECTION_NAME_X THEME->GetMetricF("WheelItemDisplay","SectionNameX") -#define SECTION_ZOOM THEME->GetMetricF("WheelItemDisplay","SectionZoom") -#define ROULETTE_X THEME->GetMetricF("WheelItemDisplay","RouletteX") -#define ROULETTE_ZOOM THEME->GetMetricF("WheelItemDisplay","RouletteZoom") -#define COURSE_X THEME->GetMetricF("WheelItemDisplay","CourseX") -#define COURSE_ZOOM THEME->GetMetricF("WheelItemDisplay","CourseZoom") -#define GRADE_X( p ) THEME->GetMetricF("WheelItemDisplay",ssprintf("GradeP%dX",p+1)) -#define DEFAULT_SCROLL_DIRECTION THEME->GetMetricI("Notes","DefaultScrollDirection") - // MusicWheel stuff #define FADE_SECONDS THEME->GetMetricF("MusicWheel","FadeSeconds") #define SWITCH_SECONDS THEME->GetMetricF("MusicWheel","SwitchSeconds") @@ -49,6 +38,8 @@ #define ITEM_SPACING_Y THEME->GetMetricF("MusicWheel","ItemSpacingY") #define NUM_SECTION_COLORS THEME->GetMetricI("MusicWheel","NumSectionColors") #define SECTION_COLORS( i ) THEME->GetMetricC("MusicWheel",ssprintf("SectionColor%d",i+1)) +#define DEFAULT_SCROLL_DIRECTION THEME->GetMetricI("Notes","DefaultScrollDirection") + const int MAX_WHEEL_SOUND_SPEED = 15; float g_fItemSpacingY, g_fItemCurveX; // cache @@ -60,233 +51,6 @@ inline RageColor GetNextSectionColor() { } -WheelItemData::WheelItemData( WheelItemType wit, Song* pSong, const CString &sSectionName, Course* pCourse, const RageColor color ) -{ - m_WheelItemType = wit; - m_pSong = pSong; - m_sSectionName = sSectionName; - m_pCourse = pCourse; - m_color = color; - m_Type = MusicStatusDisplay::none; -} - - -WheelItemDisplay::WheelItemDisplay() -{ - data = NULL; - - m_fPercentGray = 0; - m_MusicStatusDisplay.SetXY( ICON_X, 0 ); - - m_TextBanner.SetHorizAlign( align_left ); - m_TextBanner.SetXY( SONG_NAME_X, 0 ); - - m_sprSongBar.Load( THEME->GetPathTo("Graphics","select music song bar") ); - m_sprSongBar.SetXY( 0, 0 ); - - m_sprSectionBar.Load( THEME->GetPathTo("Graphics","select music section bar") ); - m_sprSectionBar.SetXY( 0, 0 ); - - m_textSectionName.LoadFromFont( THEME->GetPathTo("Fonts","musicwheel section") ); - m_textSectionName.TurnShadowOff(); - m_textSectionName.SetVertAlign( align_middle ); - m_textSectionName.SetXY( SECTION_NAME_X, 0 ); - m_textSectionName.SetZoom( SECTION_ZOOM ); - - - m_textRoulette.LoadFromFont( THEME->GetPathTo("Fonts","musicwheel roulette") ); - m_textRoulette.TurnShadowOff(); - m_textRoulette.TurnRainbowOn(); - m_textRoulette.SetZoom( ROULETTE_ZOOM ); - m_textRoulette.SetXY( ROULETTE_X, 0 ); - - for( int p=0; pGetPathTo("Fonts","musicwheel course") ); - m_textCourse.TurnShadowOff(); - m_textCourse.SetZoom( COURSE_ZOOM ); - m_textCourse.SetHorizAlign( align_left ); - m_textCourse.SetXY( COURSE_X, 0 ); -} - - -void WheelItemDisplay::LoadFromWheelItemData( WheelItemData* pWID ) -{ - ASSERT( pWID != NULL ); - - - - data = pWID; - /* - // copy all data items - this->m_WheelItemType = pWID->m_WheelItemType; - this->m_sSectionName = pWID->m_sSectionName; - this->m_pCourse = pWID->m_pCourse; - this->m_pSong = pWID->m_pSong; - this->m_color = pWID->m_color; - this->m_Type = pWID->m_Type; */ - - - // init type specific stuff - switch( pWID->m_WheelItemType ) - { - case TYPE_SECTION: - case TYPE_COURSE: - { - CString sDisplayName; - BitmapText *bt; - if(pWID->m_WheelItemType == TYPE_SECTION) - { - sDisplayName = SONGMAN->ShortenGroupName(data->m_sSectionName); - bt = &m_textSectionName; - } - else - { - sDisplayName = data->m_pCourse->m_sName; - bt = &m_textCourse; - } - bt->SetZoom( 1 ); - bt->SetText( sDisplayName ); - bt->SetDiffuse( data->m_color ); - bt->TurnRainbowOff(); - - float fSourcePixelWidth = (float)bt->GetWidestLineWidthInSourcePixels(); - float fMaxTextWidth = 200; - if( fSourcePixelWidth > fMaxTextWidth ) - bt->SetZoomX( fMaxTextWidth / fSourcePixelWidth ); - } - break; - case TYPE_SONG: - { - m_TextBanner.LoadFromSong( data->m_pSong ); - m_TextBanner.SetDiffuse( data->m_color ); - m_MusicStatusDisplay.SetType( data->m_Type ); - RefreshGrades(); - } - break; - case TYPE_ROULETTE: - m_textRoulette.SetText( "ROULETTE" ); - break; - - case TYPE_RANDOM: - m_textRoulette.SetText( "RANDOM" ); - break; - - default: - ASSERT( 0 ); // invalid type - } -} - -void WheelItemDisplay::RefreshGrades() -{ - // Refresh Grades - for( int p=0; pm_pSong || // this isn't a song display - !GAMESTATE->IsPlayerEnabled(p) || - !SONGMAN->IsUsingMemoryCard((PlayerNumber)p) ) - { - m_GradeDisplay[p].SetDiffuse( RageColor(1,1,1,0) ); - continue; - } - - Difficulty dc; - if( GAMESTATE->m_pCurNotes[p] ) - dc = GAMESTATE->m_pCurNotes[p]->GetDifficulty(); - else - dc = GAMESTATE->m_PreferredDifficulty[p]; - const Grade grade = data->m_pSong->GetGradeForDifficulty( GAMESTATE->GetCurrentStyleDef(), (PlayerNumber)p, dc ); - m_GradeDisplay[p].SetGrade( (PlayerNumber)p, grade ); - } - -} - - -void WheelItemDisplay::Update( float fDeltaTime ) -{ - Actor::Update( fDeltaTime ); - - switch( data->m_WheelItemType ) - { - case TYPE_SECTION: - m_sprSectionBar.Update( fDeltaTime ); - m_textSectionName.Update( fDeltaTime ); - break; - case TYPE_ROULETTE: - case TYPE_RANDOM: - m_sprSectionBar.Update( fDeltaTime ); - m_textRoulette.Update( fDeltaTime ); - break; - case TYPE_SONG: - { - m_sprSongBar.Update( fDeltaTime ); - m_MusicStatusDisplay.Update( fDeltaTime ); - m_TextBanner.Update( fDeltaTime ); - for( int p=0; pm_WheelItemType ) - { - case TYPE_SECTION: - case TYPE_ROULETTE: - case TYPE_RANDOM: bar = &m_sprSectionBar; break; - case TYPE_SONG: - case TYPE_COURSE: bar = &m_sprSongBar; break; - default: ASSERT(0); - } - - bar->Draw(); - - switch( data->m_WheelItemType ) - { - case TYPE_SECTION: - m_textSectionName.Draw(); - break; - case TYPE_ROULETTE: - case TYPE_RANDOM: - m_textRoulette.Draw(); - break; - case TYPE_SONG: - m_TextBanner.Draw(); - m_MusicStatusDisplay.Draw(); - int p; - for( p=0; p 0 ) - { - bar->SetGlow( RageColor(0,0,0,m_fPercentGray) ); - bar->SetDiffuse( RageColor(0,0,0,0) ); - bar->Draw(); - bar->SetDiffuse( RageColor(0,0,0,1) ); - bar->SetGlow( RageColor(0,0,0,0) ); - } -} - MusicWheel::MusicWheel() { LOG->Trace( "MusicWheel::MusicWheel()" ); @@ -331,7 +95,7 @@ MusicWheel::MusicWheel() // init m_mapGroupNameToBannerColor vector arraySongs; - SONGMAN->GetAllSongs( arraySongs ); + SONGMAN->GetSongs( arraySongs, GAMESTATE->GetNumStagesLeft() ); SortSongPointerArrayByGroup( arraySongs ); m_iSelection = 0; @@ -479,7 +243,7 @@ bool MusicWheel::SelectCourse( const Course *p ) void MusicWheel::GetSongList(vector &arraySongs, bool bRoulette ) { vector apAllSongs; - SONGMAN->GetAllSongs( apAllSongs ); + SONGMAN->GetSongs( apAllSongs, GAMESTATE->GetNumStagesLeft() ); // copy only songs that have at least one Notes for the current GameMode for( unsigned i=0; i &arraySongs, bool bRoulette ) } vector arraySteps; - pSong->GetNotesThatMatch( GAMESTATE->GetCurrentStyleDef()->m_NotesType, arraySteps ); + pSong->GetNotes( arraySteps, GAMESTATE->GetCurrentStyleDef()->m_NotesType ); if( !arraySteps.empty() ) arraySongs.push_back( pSong ); @@ -670,25 +434,27 @@ void MusicWheel::BuildWheelItemDatas( vector &arrayWheelItemDatas ASSERT(0); // invalid PlayMode } - // init crowns + // init music status icons for( i=0; iIsEasy( GAMESTATE->GetCurrentStyleDef()->m_NotesType ); WheelItemData& WID = arrayWheelItemDatas[i]; - WID.m_Type = bIsEasy ? MusicStatusDisplay::easy : MusicStatusDisplay::none; + WID.m_Flags.bHasBeginnerOr1Meter = pSong->IsEasy( NOTES_TYPE_DANCE_SINGLE ); + WID.m_Flags.bEdits = pSong->HasEdits( NOTES_TYPE_DANCE_SINGLE ); + WID.m_Flags.iStagesForSong = SongManager::GetNumStagesForSong( pSong ); } + // init crowns if( so == SORT_MOST_PLAYED ) { // init crown icons for( i=0; i< min(3u,arrayWheelItemDatas.size()); i++ ) { WheelItemData& WID = arrayWheelItemDatas[i]; - WID.m_Type = MusicStatusDisplay::Type(MusicStatusDisplay::crown1 + i); + WID.m_Flags.iPlayersBestNumber = i+1; } } diff --git a/stepmania/src/MusicWheel.h b/stepmania/src/MusicWheel.h index 255b91441f..abc444a1c2 100644 --- a/stepmania/src/MusicWheel.h +++ b/stepmania/src/MusicWheel.h @@ -27,6 +27,7 @@ #include "ScrollBar.h" #include "Course.h" #include "RageTimer.h" +#include "MusicWheelItem.h" const int NUM_WHEEL_ITEMS_TO_DRAW = 13; @@ -36,54 +37,6 @@ const ScreenMessage SM_SongChanged = ScreenMessage(SM_User+47); // this should const ScreenMessage SM_SortOrderChanged = ScreenMessage(SM_User+48); -enum WheelItemType { TYPE_SECTION, TYPE_SONG, TYPE_ROULETTE, TYPE_RANDOM, TYPE_COURSE }; - - -struct WheelItemData -{ -public: - WheelItemData() {} - WheelItemData( WheelItemType wit, Song* pSong, const CString &sSectionName, Course* pCourse, const RageColor color ); - - WheelItemType m_WheelItemType; - CString m_sSectionName; - Course* m_pCourse; - Song* m_pSong; - RageColor m_color; // either text color or section background color - MusicStatusDisplay::Type m_Type; -}; - - -class WheelItemDisplay: public ActorFrame -{ -public: - WheelItemDisplay(); - - virtual void Update( float fDeltaTime ); - virtual void DrawPrimitives(); - - void LoadFromWheelItemData( WheelItemData* pWID ); - void RefreshGrades(); - - WheelItemData *data; - float m_fPercentGray; - - // for TYPE_SECTION and TYPE_ROULETTE - Sprite m_sprSectionBar; - // for TYPE_SECTION - BitmapText m_textSectionName; - // for TYPE_ROULETTE - BitmapText m_textRoulette; - - // for a TYPE_MUSIC - Sprite m_sprSongBar; - MusicStatusDisplay m_MusicStatusDisplay; - TextBanner m_TextBanner; - SmallGradeDisplay m_GradeDisplay[NUM_PLAYERS]; - - // for TYPE_COURSE - BitmapText m_textCourse; -}; enum { SORT_ROULETTE = NUM_SORT_ORDERS+1 }; diff --git a/stepmania/src/MusicWheelItem.cpp b/stepmania/src/MusicWheelItem.cpp new file mode 100644 index 0000000000..bae14bfd2d --- /dev/null +++ b/stepmania/src/MusicWheelItem.cpp @@ -0,0 +1,268 @@ +#include "stdafx.h" +/* +----------------------------------------------------------------------------- + Class: MusicWheelItem + + Desc: See header. + + Copyright (c) 2001-2003 by the person(s) listed below. All rights reserved. + Chris Danford + Chris Gomez + Glenn Maynard +----------------------------------------------------------------------------- +*/ + +#include "MusicWheel.h" +#include "RageUtil.h" +#include "SongManager.h" +#include "GameManager.h" +#include "PrefsManager.h" +#include "RageSoundManager.h" +#include "ScreenManager.h" // for sending SM_PlayMusicSample +#include "RageLog.h" +#include "GameConstantsAndTypes.h" +#include "GameState.h" +#include +#include "ThemeManager.h" + + +// WheelItem stuff +#define ICON_X THEME->GetMetricF("WheelItemDisplay","IconX") +#define SONG_NAME_X THEME->GetMetricF("WheelItemDisplay","SongNameX") +#define SECTION_NAME_X THEME->GetMetricF("WheelItemDisplay","SectionNameX") +#define SECTION_ZOOM THEME->GetMetricF("WheelItemDisplay","SectionZoom") +#define ROULETTE_X THEME->GetMetricF("WheelItemDisplay","RouletteX") +#define ROULETTE_ZOOM THEME->GetMetricF("WheelItemDisplay","RouletteZoom") +#define COURSE_X THEME->GetMetricF("WheelItemDisplay","CourseX") +#define COURSE_ZOOM THEME->GetMetricF("WheelItemDisplay","CourseZoom") +#define GRADE_X( p ) THEME->GetMetricF("WheelItemDisplay",ssprintf("GradeP%dX",p+1)) + + + + +WheelItemData::WheelItemData( WheelItemType wit, Song* pSong, const CString &sSectionName, Course* pCourse, const RageColor color ) +{ + m_WheelItemType = wit; + m_pSong = pSong; + m_sSectionName = sSectionName; + m_pCourse = pCourse; + m_color = color; + m_Flags = MusicStatusDisplay::Flags(); +} + + +WheelItemDisplay::WheelItemDisplay() +{ + data = NULL; + + m_fPercentGray = 0; + m_MusicStatusDisplay.SetXY( ICON_X, 0 ); + + m_TextBanner.SetHorizAlign( align_left ); + m_TextBanner.SetXY( SONG_NAME_X, 0 ); + + m_sprSongBar.Load( THEME->GetPathTo("Graphics","select music song bar") ); + m_sprSongBar.SetXY( 0, 0 ); + + m_sprSectionBar.Load( THEME->GetPathTo("Graphics","select music section bar") ); + m_sprSectionBar.SetXY( 0, 0 ); + + m_textSectionName.LoadFromFont( THEME->GetPathTo("Fonts","musicwheel section") ); + m_textSectionName.TurnShadowOff(); + m_textSectionName.SetVertAlign( align_middle ); + m_textSectionName.SetXY( SECTION_NAME_X, 0 ); + m_textSectionName.SetZoom( SECTION_ZOOM ); + + + m_textRoulette.LoadFromFont( THEME->GetPathTo("Fonts","musicwheel roulette") ); + m_textRoulette.TurnShadowOff(); + m_textRoulette.TurnRainbowOn(); + m_textRoulette.SetZoom( ROULETTE_ZOOM ); + m_textRoulette.SetXY( ROULETTE_X, 0 ); + + for( int p=0; pGetPathTo("Fonts","musicwheel course") ); + m_textCourse.TurnShadowOff(); + m_textCourse.SetZoom( COURSE_ZOOM ); + m_textCourse.SetHorizAlign( align_left ); + m_textCourse.SetXY( COURSE_X, 0 ); +} + + +void WheelItemDisplay::LoadFromWheelItemData( WheelItemData* pWID ) +{ + ASSERT( pWID != NULL ); + + + + data = pWID; + /* + // copy all data items + this->m_WheelItemType = pWID->m_WheelItemType; + this->m_sSectionName = pWID->m_sSectionName; + this->m_pCourse = pWID->m_pCourse; + this->m_pSong = pWID->m_pSong; + this->m_color = pWID->m_color; + this->m_Type = pWID->m_Type; */ + + + // init type specific stuff + switch( pWID->m_WheelItemType ) + { + case TYPE_SECTION: + case TYPE_COURSE: + { + CString sDisplayName; + BitmapText *bt; + if(pWID->m_WheelItemType == TYPE_SECTION) + { + sDisplayName = SONGMAN->ShortenGroupName(data->m_sSectionName); + bt = &m_textSectionName; + } + else + { + sDisplayName = data->m_pCourse->m_sName; + bt = &m_textCourse; + } + bt->SetZoom( 1 ); + bt->SetText( sDisplayName ); + bt->SetDiffuse( data->m_color ); + bt->TurnRainbowOff(); + + float fSourcePixelWidth = (float)bt->GetWidestLineWidthInSourcePixels(); + float fMaxTextWidth = 200; + if( fSourcePixelWidth > fMaxTextWidth ) + bt->SetZoomX( fMaxTextWidth / fSourcePixelWidth ); + } + break; + case TYPE_SONG: + { + m_TextBanner.LoadFromSong( data->m_pSong ); + m_TextBanner.SetDiffuse( data->m_color ); + m_MusicStatusDisplay.SetFlags( data->m_Flags ); + RefreshGrades(); + } + break; + case TYPE_ROULETTE: + m_textRoulette.SetText( "ROULETTE" ); + break; + + case TYPE_RANDOM: + m_textRoulette.SetText( "RANDOM" ); + break; + + default: + ASSERT( 0 ); // invalid type + } +} + +void WheelItemDisplay::RefreshGrades() +{ + // Refresh Grades + for( int p=0; pm_pSong || // this isn't a song display + !GAMESTATE->IsPlayerEnabled(p) || + !SONGMAN->IsUsingMemoryCard((PlayerNumber)p) ) + { + m_GradeDisplay[p].SetDiffuse( RageColor(1,1,1,0) ); + continue; + } + + Difficulty dc; + if( GAMESTATE->m_pCurNotes[p] ) + dc = GAMESTATE->m_pCurNotes[p]->GetDifficulty(); + else + dc = GAMESTATE->m_PreferredDifficulty[p]; + const Grade grade = data->m_pSong->GetGradeForDifficulty( GAMESTATE->GetCurrentStyleDef(), (PlayerNumber)p, dc ); + m_GradeDisplay[p].SetGrade( (PlayerNumber)p, grade ); + } + +} + + +void WheelItemDisplay::Update( float fDeltaTime ) +{ + Actor::Update( fDeltaTime ); + + switch( data->m_WheelItemType ) + { + case TYPE_SECTION: + m_sprSectionBar.Update( fDeltaTime ); + m_textSectionName.Update( fDeltaTime ); + break; + case TYPE_ROULETTE: + case TYPE_RANDOM: + m_sprSectionBar.Update( fDeltaTime ); + m_textRoulette.Update( fDeltaTime ); + break; + case TYPE_SONG: + { + m_sprSongBar.Update( fDeltaTime ); + m_MusicStatusDisplay.Update( fDeltaTime ); + m_TextBanner.Update( fDeltaTime ); + for( int p=0; pm_WheelItemType ) + { + case TYPE_SECTION: + case TYPE_ROULETTE: + case TYPE_RANDOM: bar = &m_sprSectionBar; break; + case TYPE_SONG: + case TYPE_COURSE: bar = &m_sprSongBar; break; + default: ASSERT(0); + } + + bar->Draw(); + + switch( data->m_WheelItemType ) + { + case TYPE_SECTION: + m_textSectionName.Draw(); + break; + case TYPE_ROULETTE: + case TYPE_RANDOM: + m_textRoulette.Draw(); + break; + case TYPE_SONG: + m_TextBanner.Draw(); + m_MusicStatusDisplay.Draw(); + int p; + for( p=0; p 0 ) + { + bar->SetGlow( RageColor(0,0,0,m_fPercentGray) ); + bar->SetDiffuse( RageColor(0,0,0,0) ); + bar->Draw(); + bar->SetDiffuse( RageColor(0,0,0,1) ); + bar->SetGlow( RageColor(0,0,0,0) ); + } +} diff --git a/stepmania/src/MusicWheelItem.h b/stepmania/src/MusicWheelItem.h new file mode 100644 index 0000000000..ef9c257671 --- /dev/null +++ b/stepmania/src/MusicWheelItem.h @@ -0,0 +1,80 @@ +#ifndef MUSICWHEELITEM_H +#define MUSICWHEELITEM_H +/* +----------------------------------------------------------------------------- + Class: MusicWheelItem + + Desc: An item on the music wheel + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +//#include "Sprite.h" +//#include "Song.h" +//#include "ActorFrame.h" +//#include "BitmapText.h" +//#include "Quad.h" +//#include "TextBanner.h" +//#include "RandomSample.h" +//#include "SmallGradeDisplay.h" +//#include "GameConstantsAndTypes.h" +//#include "MusicSortDisplay.h" +//#include "MusicStatusDisplay.h" +//#include "Screen.h" // for ScreenMessage +//#include "ScoreDisplayNormal.h" +//#include "ScrollBar.h" +//#include "Course.h" +//#include "RageTimer.h" + + +enum WheelItemType { TYPE_SECTION, TYPE_SONG, TYPE_ROULETTE, TYPE_RANDOM, TYPE_COURSE }; + +struct WheelItemData +{ +public: + WheelItemData() {} + WheelItemData( WheelItemType wit, Song* pSong, const CString &sSectionName, Course* pCourse, const RageColor color ); + + WheelItemType m_WheelItemType; + CString m_sSectionName; + Course* m_pCourse; + Song* m_pSong; + RageColor m_color; // either text color or section background color + MusicStatusDisplay::Flags m_Flags; +}; + + +class WheelItemDisplay: public ActorFrame +{ +public: + WheelItemDisplay(); + + virtual void Update( float fDeltaTime ); + virtual void DrawPrimitives(); + + void LoadFromWheelItemData( WheelItemData* pWID ); + void RefreshGrades(); + + WheelItemData *data; + float m_fPercentGray; + + // for TYPE_SECTION and TYPE_ROULETTE + Sprite m_sprSectionBar; + // for TYPE_SECTION + BitmapText m_textSectionName; + // for TYPE_ROULETTE + BitmapText m_textRoulette; + + // for a TYPE_MUSIC + Sprite m_sprSongBar; + MusicStatusDisplay m_MusicStatusDisplay; + TextBanner m_TextBanner; + SmallGradeDisplay m_GradeDisplay[NUM_PLAYERS]; + + // for TYPE_COURSE + BitmapText m_textCourse; +}; + +#endif diff --git a/stepmania/src/PrefsManager.cpp b/stepmania/src/PrefsManager.cpp index 0cf413d49f..2123cf0df4 100644 --- a/stepmania/src/PrefsManager.cpp +++ b/stepmania/src/PrefsManager.cpp @@ -87,6 +87,9 @@ PrefsManager::PrefsManager() * stage CRS files) don't get it changed around on them */ m_bPickExtraStage = false; + m_fLongVerSongSeconds = 60*3; + m_fMarathonVerSongSeconds = 60*5; + /* I'd rather get occasional people asking for support for this even though it's * already here than lots of people asking why songs aren't being displayed. */ m_bHiddenSongs = false; @@ -158,6 +161,9 @@ void PrefsManager::ReadGlobalPrefsFromDisk( bool bSwitchToLastPlayedGame ) ini.GetValueI( "Options", "BoostAppPriority", m_iBoostAppPriority ); ini.GetValueI( "Options", "PolygonRadar", m_iPolygonRadar ); ini.GetValueB( "Options", "PickExtraStage", m_bPickExtraStage ); + ini.GetValueF( "Options", "LongVerSeconds", m_fLongVerSongSeconds ); + ini.GetValueF( "Options", "MarathonVerSeconds", m_fMarathonVerSongSeconds ); + m_asAdditionalSongFolders.clear(); CString sAdditionalSongFolders; @@ -224,6 +230,8 @@ void PrefsManager::SaveGlobalPrefsToDisk() ini.SetValueI( "Options", "BoostAppPriority", m_iBoostAppPriority ); ini.SetValueI( "Options", "PolygonRadar", m_iPolygonRadar ); ini.SetValueB( "Options", "PickExtraStage", m_bPickExtraStage ); + ini.SetValueF( "Options", "LongVerSeconds", m_fLongVerSongSeconds ); + ini.SetValueF( "Options", "MarathonVerSeconds", m_fMarathonVerSongSeconds ); /* Only write these if they aren't the default. This ensures that we can change * the default and have it take effect for everyone (except people who diff --git a/stepmania/src/PrefsManager.h b/stepmania/src/PrefsManager.h index d6514e13f9..33904f131f 100644 --- a/stepmania/src/PrefsManager.h +++ b/stepmania/src/PrefsManager.h @@ -63,7 +63,8 @@ public: int m_iCoinsPerCredit; bool m_bJointPremium; bool m_bPickExtraStage; - + float m_fLongVerSongSeconds; + float m_fMarathonVerSongSeconds; /* 0 = no; 1 = yes; -1 = auto (do whatever is appropriate for the arch). */ diff --git a/stepmania/src/ScreenDemonstration.cpp b/stepmania/src/ScreenDemonstration.cpp index cb147f4b25..35e8b04a0a 100644 --- a/stepmania/src/ScreenDemonstration.cpp +++ b/stepmania/src/ScreenDemonstration.cpp @@ -62,7 +62,7 @@ bool SetUpSongOptions() // always return true. continue; // skip vector apNotes; - pSong->GetNotesThatMatch( GAMESTATE->GetCurrentStyleDef()->m_NotesType, apNotes ); + pSong->GetNotes( apNotes, GAMESTATE->GetCurrentStyleDef()->m_NotesType ); if( apNotes.empty() ) continue; // skip diff --git a/stepmania/src/ScreenEvaluation.cpp b/stepmania/src/ScreenEvaluation.cpp index 810d533e8d..fb14f61c7a 100644 --- a/stepmania/src/ScreenEvaluation.cpp +++ b/stepmania/src/ScreenEvaluation.cpp @@ -810,9 +810,7 @@ void ScreenEvaluation::MenuStart( PlayerNumber pn ) m_Menu.TweenOffScreenToMenu( SM_GoToSelectMusic ); else if( m_ResultMode == RM_ARCADE_STAGE ) { - if( GAMESTATE->m_iCurrentStageIndex < PREFSMAN->m_iNumArcadeStages-1 ) - m_Menu.TweenOffScreenToMenu( SM_GoToSelectMusic ); - else + if( GAMESTATE->IsFinalStage() ) { /* Tween the screen out, but leave the MenuElements where they are. * Play the "swoosh" sound manually (would normally be played by the ME @@ -821,6 +819,10 @@ void ScreenEvaluation::MenuStart( PlayerNumber pn ) TweenOffScreen(); SCREENMAN->SendMessageToTopScreen( SM_GoToFinalEvaluation, MENU_ELEMENTS_TWEEN_TIME ); } + else + { + m_Menu.TweenOffScreenToMenu( SM_GoToSelectMusic ); + } } else m_Menu.TweenOffScreenToBlack( SM_GoToGameFinished, false ); @@ -829,7 +831,10 @@ void ScreenEvaluation::MenuStart( PlayerNumber pn ) switch( m_ResultMode ) { case RM_ARCADE_STAGE: - GAMESTATE->m_iCurrentStageIndex++; // Increment the stage counter. + // Increment the stage counter. + int iNumStagesOfLastSong; + iNumStagesOfLastSong = SongManager::GetNumStagesForSong( GAMESTATE->m_pCurSong ); + GAMESTATE->m_iCurrentStageIndex += iNumStagesOfLastSong; // add current stage stats to accumulated total only if this song was passed { diff --git a/stepmania/src/ScreenEz2SelectMusic.cpp b/stepmania/src/ScreenEz2SelectMusic.cpp index cc9f831517..974ac12762 100644 --- a/stepmania/src/ScreenEz2SelectMusic.cpp +++ b/stepmania/src/ScreenEz2SelectMusic.cpp @@ -472,7 +472,7 @@ void ScreenEz2SelectMusic::MusicChanged() for( pn = 0; pn < NUM_PLAYERS; ++pn) { - pSong->GetNotesThatMatch( GAMESTATE->GetCurrentStyleDef()->m_NotesType, m_arrayNotes[pn] ); + pSong->GetNotes( m_arrayNotes[pn], GAMESTATE->GetCurrentStyleDef()->m_NotesType ); SortNotesArrayByDifficulty( m_arrayNotes[pn] ); } diff --git a/stepmania/src/ScreenJukebox.cpp b/stepmania/src/ScreenJukebox.cpp index 11dcca79d5..3c3776320b 100644 --- a/stepmania/src/ScreenJukebox.cpp +++ b/stepmania/src/ScreenJukebox.cpp @@ -58,7 +58,7 @@ bool PrepareForJukebox() // always return true. continue; // skip vector apNotes; - pSong->GetNotesThatMatch( GAMESTATE->GetCurrentStyleDef()->m_NotesType, apNotes ); + pSong->GetNotes( apNotes, GAMESTATE->GetCurrentStyleDef()->m_NotesType ); if( apNotes.empty() ) continue; // skip diff --git a/stepmania/src/ScreenMusicScroll.cpp b/stepmania/src/ScreenMusicScroll.cpp index 8cd49aa0bd..56a712cad6 100644 --- a/stepmania/src/ScreenMusicScroll.cpp +++ b/stepmania/src/ScreenMusicScroll.cpp @@ -150,7 +150,7 @@ ScreenMusicScroll::ScreenMusicScroll() vector arraySongs; - SONGMAN->GetAllSongs( arraySongs ); + SONGMAN->GetSongs( arraySongs ); SortSongPointerArrayByTitle( arraySongs ); m_iNumLines = 0; diff --git a/stepmania/src/ScreenNameEntry.cpp b/stepmania/src/ScreenNameEntry.cpp index 82c3eb7a0a..8e98a3308e 100644 --- a/stepmania/src/ScreenNameEntry.cpp +++ b/stepmania/src/ScreenNameEntry.cpp @@ -117,10 +117,11 @@ ScreenNameEntry::ScreenNameEntry() // reset Player and Song Options - for( int p=0; pm_PlayerOptions[p] = PlayerOptions(); - GAMESTATE->m_SongOptions = SongOptions(); - + { + for( int p=0; pm_PlayerOptions[p] = PlayerOptions(); + GAMESTATE->m_SongOptions = SongOptions(); + } // Find out if any of the players deserve to enter their name @@ -186,7 +187,7 @@ ScreenNameEntry::ScreenNameEntry() m_Background.LoadFromAniDir( THEME->GetPathTo("BGAnimations","name entry") ); this->AddChild( &m_Background ); - for( p=0; pm_iLastRankingIndex[p] != -1; m_bStillEnteringName[p] = bNewHighScore; // false if they made a new high score diff --git a/stepmania/src/ScreenRanking.cpp b/stepmania/src/ScreenRanking.cpp index a7ec2b57c9..4212748bcf 100644 --- a/stepmania/src/ScreenRanking.cpp +++ b/stepmania/src/ScreenRanking.cpp @@ -185,7 +185,7 @@ void ScreenRanking::SetPage( PageToShow pts ) CString sName = SONGMAN->m_MachineScores[pts.nt][pts.category][l].sName; float fScore = SONGMAN->m_MachineScores[pts.nt][pts.category][l].fScore; m_textNames[l].SetText( sName ); - m_textScores[l].SetText( ssprintf("%.0f",fScore) ); + m_textScores[l].SetText( ssprintf("%9.0f",fScore) ); m_textNames[l].SetDiffuse( NAMES_COLOR ); m_textScores[l].SetDiffuse( SCORES_COLOR ); @@ -220,7 +220,7 @@ void ScreenRanking::SetPage( PageToShow pts ) CString sName = pts.pCourse->m_MachineScores[pts.nt][l].sName; int iDancePoints = pts.pCourse->m_MachineScores[pts.nt][l].iDancePoints; m_textNames[l].SetText( sName ); - m_textScores[l].SetText( ssprintf("%d",iDancePoints) ); + m_textScores[l].SetText( ssprintf("%4d",iDancePoints) ); m_textNames[l].SetDiffuse( NAMES_COLOR ); m_textScores[l].SetDiffuse( SCORES_COLOR ); for( int p=0; p aAllSongs; - SONGMAN->GetAllSongs( aAllSongs ); + SONGMAN->GetSongs( aAllSongs ); // Filter out Songs that can't be played by the current Style for( j=aAllSongs.size()-1; j>=0; j-- ) // foreach Song, back to front diff --git a/stepmania/src/ScreenSelectMusic.cpp b/stepmania/src/ScreenSelectMusic.cpp index ff528b6850..77d212c027 100644 --- a/stepmania/src/ScreenSelectMusic.cpp +++ b/stepmania/src/ScreenSelectMusic.cpp @@ -109,13 +109,10 @@ ScreenSelectMusic::ScreenSelectMusic() m_BPMDisplay.SetZoom( BPM_ZOOM ); this->AddChild( &m_BPMDisplay ); - m_textStage.LoadFromFont( THEME->GetPathTo("Fonts","Header2") ); - m_textStage.TurnShadowOff(); - m_textStage.SetZoom( STAGE_ZOOM ); - m_textStage.SetXY( STAGE_X, STAGE_Y ); - m_textStage.SetText( GAMESTATE->GetStageText() ); - m_textStage.SetDiffuse( GAMESTATE->GetStageColor() ); - this->AddChild( &m_textStage ); + m_StageDisplay.SetZoom( STAGE_ZOOM ); + m_StageDisplay.SetXY( STAGE_X, STAGE_Y ); + m_StageDisplay.Refresh(); + this->AddChild( &m_StageDisplay ); m_sprCDTitle.Load( THEME->GetPathTo("Graphics","fallback cd title") ); m_sprCDTitle.TurnShadowOff(); @@ -266,7 +263,7 @@ void ScreenSelectMusic::TweenOnScreen() m_sprBannerFrame.FadeOn( 0, "bounce left", TWEEN_TIME ); m_Banner.FadeOn( 0, "bounce left", TWEEN_TIME ); m_BPMDisplay.FadeOn( 0, "bounce left", TWEEN_TIME ); - m_textStage.FadeOn( 0, "bounce left", TWEEN_TIME ); + m_StageDisplay.FadeOn( 0, "bounce left", TWEEN_TIME ); m_sprCDTitle.FadeOn( 0, "bounce left", TWEEN_TIME ); for( p=0; pm_pCurSong = pSong; + m_StageDisplay.Refresh(); + int pn; for( pn = 0; pn < NUM_PLAYERS; ++pn) m_arrayNotes[pn].clear(); @@ -813,7 +812,7 @@ void ScreenSelectMusic::AfterMusicChange() m_fPlaySampleCountdown = SAMPLE_MUSIC_DELAY; for( int pn = 0; pn < NUM_PLAYERS; ++pn) { - pSong->GetNotesThatMatch( GAMESTATE->GetCurrentStyleDef()->m_NotesType, m_arrayNotes[pn] ); + pSong->GetNotes( m_arrayNotes[pn], GAMESTATE->GetCurrentStyleDef()->m_NotesType ); SortNotesArrayByDifficulty( m_arrayNotes[pn] ); } diff --git a/stepmania/src/ScreenSelectMusic.h b/stepmania/src/ScreenSelectMusic.h index 0f23ab5eaf..3e9c9febce 100644 --- a/stepmania/src/ScreenSelectMusic.h +++ b/stepmania/src/ScreenSelectMusic.h @@ -22,6 +22,7 @@ #include "DifficultyIcon.h" #include "FootMeter.h" #include "OptionIconRow.h" +#include "StageDisplay.h" class ScreenSelectMusic : public Screen @@ -63,7 +64,7 @@ protected: Sprite m_sprBannerFrame; FadingBanner m_Banner; BPMDisplay m_BPMDisplay; - BitmapText m_textStage; + StageDisplay m_StageDisplay; Sprite m_sprCDTitle; Sprite m_sprDifficultyFrame[NUM_PLAYERS]; DifficultyIcon m_DifficultyIcon[NUM_PLAYERS]; diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index 047ea0ade2..a067dcd7e7 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -758,7 +758,7 @@ void Song::ReCalculateRadarValuesAndLastBeat() } } -void Song::GetNotesThatMatch( NotesType nt, vector& arrayAddTo, bool bIncludeAutoGen ) const +void Song::GetNotes( vector& arrayAddTo, NotesType nt, bool bIncludeAutoGen ) const { for( unsigned i=0; im_NotesType == nt ) @@ -766,7 +766,7 @@ void Song::GetNotesThatMatch( NotesType nt, vector& arrayAddTo, bool bIn arrayAddTo.push_back( m_apNotes[i] ); } -Notes* Song::GetNotesThatMatch( NotesType nt, Difficulty dc, bool bIncludeAutoGen ) const +Notes* Song::GetNotes( NotesType nt, Difficulty dc, bool bIncludeAutoGen ) const { for( unsigned i=0; im_NotesType==nt && m_apNotes[i]->GetDifficulty()==dc ) @@ -775,6 +775,11 @@ Notes* Song::GetNotesThatMatch( NotesType nt, Difficulty dc, bool bIncludeAutoGe return NULL; } +void Song::GetEdits( vector& arrayAddTo, NotesType nt, bool bIncludeAutoGen ) const +{ +} + + /* Return whether the song is playable in the given style. */ bool Song::SongCompleteForStyle( const StyleDef *st ) const { @@ -879,7 +884,7 @@ void Song::AddAutoGenNotes() for( NotesType nt=(NotesType)0; nt apNotes; - this->GetNotesThatMatch( nt, apNotes ); + this->GetNotes( apNotes, nt ); if(apNotes.empty() || apNotes[0]->IsAutogen()) continue; /* can't autogen from other autogen */ @@ -931,7 +936,7 @@ Grade Song::GetGradeForDifficulty( const StyleDef *st, PlayerNumber pn, Difficul { // return max grade of notes in difficulty class vector aNotes; - this->GetNotesThatMatch( st->m_NotesType, aNotes ); + this->GetNotes( aNotes, st->m_NotesType ); SortNotesArrayByDifficulty( aNotes ); Grade grade = GRADE_NO_DATA; @@ -966,6 +971,13 @@ bool Song::IsEasy( NotesType nt ) const return false; } +bool Song::HasEdits( NotesType nt ) const +{ + vector vpNotes; + this->GetEdits( vpNotes, nt ); + return vpNotes.size() > 0; +} + ///////////////////////////////////// // Sorting ///////////////////////////////////// @@ -995,8 +1007,8 @@ int CompareSongPointersByDifficulty(const Song *pSong1, const Song *pSong2) vector aNotes1; vector aNotes2; - pSong1->GetNotesThatMatch( GAMESTATE->GetCurrentStyleDef()->m_NotesType, aNotes1 ); - pSong2->GetNotesThatMatch( GAMESTATE->GetCurrentStyleDef()->m_NotesType, aNotes2 ); + pSong1->GetNotes( aNotes1, GAMESTATE->GetCurrentStyleDef()->m_NotesType ); + pSong2->GetNotes( aNotes2, GAMESTATE->GetCurrentStyleDef()->m_NotesType ); int iEasiestMeter1 = 1000; // infinity int iEasiestMeter2 = 1000; // infinity diff --git a/stepmania/src/SongManager.cpp b/stepmania/src/SongManager.cpp index 074f9c778e..8ce8492fcb 100644 --- a/stepmania/src/SongManager.cpp +++ b/stepmania/src/SongManager.cpp @@ -372,22 +372,14 @@ RageColor SongManager::GetSongColor( const Song* pSong ) return GetGroupColor( pSong->m_sGroupName ); } - -void SongManager::GetAllSongs( vector &AddTo ) const -{ - AddTo = m_pSongs; -} - -void SongManager::GetSongsInGroup( const CString sGroupName, vector &AddTo ) +void SongManager::GetSongs( vector &AddTo, CString sGroupName, int iMaxStages ) const { AddTo.clear(); for( unsigned i=0; im_sGroupName ) - AddTo.push_back( pSong ); - } + if( sGroupName=="" || sGroupName==m_pSongs[i]->m_sGroupName ) + if( GetNumStagesForSong(m_pSongs[i])<=iMaxStages ) + AddTo.push_back( m_pSongs[i] ); } int SongManager::GetNumSongs() const @@ -400,25 +392,35 @@ int SongManager::GetNumGroups() const return m_arrayGroupNames.size(); } -CString SongManager::ShortenGroupName( const CString &sOrigGroupName ) +CString SongManager::ShortenGroupName( CString sLongGroupName ) { - CString sShortName = sOrigGroupName; - sShortName.Replace( "Dance Dance Revolution", "DDR" ); - sShortName.Replace( "dance dance revolution", "DDR" ); - sShortName.Replace( "DANCE DANCE REVOLUTION", "DDR" ); - sShortName.Replace( "Pump It Up", "PIU" ); - sShortName.Replace( "pump it up", "PIU" ); - sShortName.Replace( "PUMP IT UP", "PIU" ); - sShortName.Replace( "ParaParaParadise", "PPP" ); - sShortName.Replace( "paraparaparadise", "PPP" ); - sShortName.Replace( "PARAPARAPARADISE", "PPP" ); - sShortName.Replace( "Para Para Paradise", "PPP" ); - sShortName.Replace( "para para paradise", "PPP" ); - sShortName.Replace( "PARA PARA PARADISE", "PPP" ); - sShortName.Replace( "Dancing Stage", "DS" ); - sShortName.Replace( "Dancing Stage", "DS" ); - sShortName.Replace( "Dancing Stage", "DS" ); - return sShortName; + sLongGroupName.Replace( "Dance Dance Revolution", "DDR" ); + sLongGroupName.Replace( "dance dance revolution", "DDR" ); + sLongGroupName.Replace( "DANCE DANCE REVOLUTION", "DDR" ); + sLongGroupName.Replace( "Pump It Up", "PIU" ); + sLongGroupName.Replace( "pump it up", "PIU" ); + sLongGroupName.Replace( "PUMP IT UP", "PIU" ); + sLongGroupName.Replace( "ParaParaParadise", "PPP" ); + sLongGroupName.Replace( "paraparaparadise", "PPP" ); + sLongGroupName.Replace( "PARAPARAPARADISE", "PPP" ); + sLongGroupName.Replace( "Para Para Paradise", "PPP" ); + sLongGroupName.Replace( "para para paradise", "PPP" ); + sLongGroupName.Replace( "PARA PARA PARADISE", "PPP" ); + sLongGroupName.Replace( "Dancing Stage", "DS" ); + sLongGroupName.Replace( "Dancing Stage", "DS" ); + sLongGroupName.Replace( "Dancing Stage", "DS" ); + return sLongGroupName; +} + +int SongManager::GetNumStagesForSong( const Song* pSong ) +{ + ASSERT( pSong ); + if( pSong->m_fMusicLengthSeconds > PREFSMAN->m_fMarathonVerSongSeconds ) + return 3; + if( pSong->m_fMusicLengthSeconds > PREFSMAN->m_fLongVerSongSeconds ) + return 2; + else + return 1; } void SongManager::InitCoursesFromDisk() @@ -448,7 +450,7 @@ void SongManager::InitCoursesFromDisk() { CString sGroupName = saGroupNames[g]; vector apGroupSongs; - GetSongsInGroup( sGroupName, apGroupSongs ); + GetSongs( apGroupSongs, sGroupName ); for( Difficulty dc=DIFFICULTY_EASY; dc<=DIFFICULTY_HARD; dc=Difficulty(dc+1) ) // foreach Difficulty { @@ -597,13 +599,14 @@ void SongManager::GetExtraStageInfo( bool bExtra2, CString sPreferredGroup, cons Notes* pExtra2Notes = NULL; vector apSongs; - SONGMAN->GetSongsInGroup( (GAMESTATE->m_sPreferredGroup == "ALL MUSIC" ? GAMESTATE->m_pCurSong->m_sGroupName : GAMESTATE->m_sPreferredGroup), apSongs ); + CString sGroup = GAMESTATE->m_sPreferredGroup=="ALL MUSIC" ? GAMESTATE->m_pCurSong->m_sGroupName : GAMESTATE->m_sPreferredGroup; + SONGMAN->GetSongs( apSongs, sGroup ); for( unsigned s=0; s apNotes; - pSong->GetNotesThatMatch( sd->m_NotesType, apNotes ); + pSong->GetNotes( apNotes, sd->m_NotesType ); for( unsigned n=0; n &AddTo ) const; const vector &GetAllSongs() const { return m_pSongs; } - void GetSongsInGroup( const CString sGroupName, vector &AddTo ); + void GetSongs( vector &AddTo, CString sGroupName, int iMaxStages = 100000 /*inf*/ ) const; + void GetSongs( vector &AddTo, int iMaxStages ) const { GetSongs(AddTo,"",iMaxStages); } + void GetSongs( vector &AddTo ) const { GetSongs(AddTo,"",100000 /*inf*/ ); } int GetNumSongs() const; int GetNumGroups() const; Song* GetRandomSong(); diff --git a/stepmania/src/SongSelector.cpp b/stepmania/src/SongSelector.cpp index 84f825dd54..c029ac973b 100644 --- a/stepmania/src/SongSelector.cpp +++ b/stepmania/src/SongSelector.cpp @@ -234,7 +234,7 @@ void SongSelector::OnRowValueChanged( Row row ) m_textValue[ROW_GROUP].SetText( SONGMAN->ShortenGroupName(GetSelectedGroup()) ); m_GroupBanner.LoadFromGroup( GetSelectedGroup() ); m_pSongs.clear(); - SONGMAN->GetSongsInGroup( GetSelectedGroup(), m_pSongs ); + SONGMAN->GetSongs( m_pSongs, GetSelectedGroup() ); m_iSelection[ROW_SONG] = 0; // fall through case ROW_SONG: @@ -289,10 +289,10 @@ void SongSelector::OnRowValueChanged( Row row ) Notes* SongSelector::GetSelectedNotes() { - return GetSelectedSong()->GetNotesThatMatch(GetSelectedNotesType(),GetSelectedDifficulty(), false); + return GetSelectedSong()->GetNotes(GetSelectedNotesType(),GetSelectedDifficulty(), false); } Notes* SongSelector::GetSelectedSourceNotes() { - return GetSelectedSong()->GetNotesThatMatch(GetSelectedSourceNotesType(),GetSelectedSourceDifficulty(), false); + return GetSelectedSong()->GetNotes(GetSelectedSourceNotesType(),GetSelectedSourceDifficulty(), false); } diff --git a/stepmania/src/StageDisplay.cpp b/stepmania/src/StageDisplay.cpp new file mode 100644 index 0000000000..4a35d661b6 --- /dev/null +++ b/stepmania/src/StageDisplay.cpp @@ -0,0 +1,29 @@ +#include "stdafx.h" +/* +----------------------------------------------------------------------------- + Class: StageDisplay + + Desc: See header. + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "StageDisplay.h" +#include "GameState.h" +#include "ThemeManager.h" + + +StageDisplay::StageDisplay() +{ + LoadFromFont( THEME->GetPathTo("Fonts","Header2") ); + TurnShadowOff(); + Refresh(); +} + +void StageDisplay::Refresh() +{ + SetText( GAMESTATE->GetStageText() ); + SetDiffuse( GAMESTATE->GetStageColor() ); +} diff --git a/stepmania/src/StageDisplay.h b/stepmania/src/StageDisplay.h new file mode 100644 index 0000000000..ab9dea2c1b --- /dev/null +++ b/stepmania/src/StageDisplay.h @@ -0,0 +1,30 @@ +#ifndef StageDisplay_H +#define StageDisplay_H +/* +----------------------------------------------------------------------------- + Class: StageDisplay + + Desc: Shows stage number + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "Sprite.h" +#include "Song.h" +#include "BitmapText.h" +#include "PrefsManager.h" + + +class StageDisplay : public BitmapText +{ +public: + StageDisplay(); + + void Refresh(); + +private: +}; + +#endif diff --git a/stepmania/src/StepMania.dsp b/stepmania/src/StepMania.dsp index cca9f45fbc..642d4672ef 100644 --- a/stepmania/src/StepMania.dsp +++ b/stepmania/src/StepMania.dsp @@ -57,10 +57,10 @@ LINK32=link.exe # SUBTRACT LINK32 /verbose /pdb:none # Begin Special Build Tool IntDir=.\../Release6 -TargetDir=\Stepmania\stepmania +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 @@ -92,10 +92,10 @@ LINK32=link.exe # SUBTRACT LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib # Begin Special Build Tool IntDir=.\../Debug6 -TargetDir=\Stepmania\stepmania +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 @@ -1060,6 +1060,14 @@ SOURCE=.\MusicWheel.h # End Source File # Begin Source File +SOURCE=.\MusicWheelItem.cpp +# End Source File +# Begin Source File + +SOURCE=.\MusicWheelItem.h +# End Source File +# Begin Source File + SOURCE=.\OptionIcon.cpp # End Source File # Begin Source File @@ -1124,6 +1132,14 @@ SOURCE=.\SongSelector.h # End Source File # Begin Source File +SOURCE=.\StageDisplay.cpp +# End Source File +# Begin Source File + +SOURCE=.\StageDisplay.h +# End Source File +# Begin Source File + SOURCE=.\TextBanner.cpp # End Source File # Begin Source File diff --git a/stepmania/src/StepMania.vcproj b/stepmania/src/StepMania.vcproj index bfa654832a..544aa4aeca 100644 --- a/stepmania/src/StepMania.vcproj +++ b/stepmania/src/StepMania.vcproj @@ -1020,6 +1020,12 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ + + + + @@ -1074,6 +1080,12 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ + + + + diff --git a/stepmania/src/TextBanner.cpp b/stepmania/src/TextBanner.cpp index fe1919020a..e12d063ba5 100644 --- a/stepmania/src/TextBanner.cpp +++ b/stepmania/src/TextBanner.cpp @@ -15,25 +15,69 @@ #include "Song.h" #include "PrefsManager.h" #include "ThemeManager.h" +#include "SongManager.h" -const float TEXT_BANNER_WIDTH = 180; -const float TEXT_BANNER_HEIGHT = 40; +#define WIDTH THEME->GetMetricF("TextBanner","Width") +#define HEIGHT THEME->GetMetricF("TextBanner","Height") +#define HORIZ_ALIGN THEME->GetMetricI("TextBanner","HorizAlign") +#define ARTIST_PREPEND_STRING THEME->GetMetric( "TextBanner","ArtistPrependString") +#define TWO_LINES_TITLE_ZOOM THEME->GetMetricF("TextBanner","TwoLinesTitleZoom") +#define TWO_LINES_ARTIST_ZOOM THEME->GetMetricF("TextBanner","TwoLinesArtistZoom") +#define THREE_LINES_TITLE_ZOOM THEME->GetMetricF("TextBanner","ThreeLinesTitleZoom") +#define THREE_LINES_SUB_TITLE_ZOOM THEME->GetMetricF("TextBanner","ThreeLinesSubTitleZoom") +#define THREE_LINES_ARTIST_ZOOM THEME->GetMetricF("TextBanner","ThreeLinesArtistZoom") +#define TWO_LINES_TITLE_Y THEME->GetMetricF("TextBanner","TwoLinesTitleY") +#define TWO_LINES_ARTIST_Y THEME->GetMetricF("TextBanner","TwoLinesArtistY") +#define THREE_LINES_TITLE_Y THEME->GetMetricF("TextBanner","ThreeLinesTitleY") +#define THREE_LINES_SUB_TITLE_Y THEME->GetMetricF("TextBanner","ThreeLinesSubTitleY") +#define THREE_LINES_ARTIST_Y THEME->GetMetricF("TextBanner","ThreeLinesArtistY") + +// metrics cache +float g_fWidth; +float g_fHeight; +int g_iHorizAlign; +CString g_sArtistPrependString; +float g_fTwoLinesTitleZoom; +float g_fTwoLinesArtistZoom; +float g_fThreeLinesTitleZoom; +float g_fThreeLinesSubTitleZoom; +float g_fThreeLinesArtistZoom; +float g_fTwoLinesTitleY; +float g_fTwoLinesArtistY; +float g_fThreeLinesTitleY; +float g_fThreeLinesSubTitleY; +float g_fThreeLinesArtistY; TextBanner::TextBanner() { + g_fWidth = WIDTH; + g_fHeight = HEIGHT; + g_iHorizAlign = HORIZ_ALIGN; + g_sArtistPrependString = ARTIST_PREPEND_STRING; + g_fTwoLinesTitleZoom = TWO_LINES_TITLE_ZOOM; + g_fTwoLinesArtistZoom = TWO_LINES_ARTIST_ZOOM; + g_fThreeLinesTitleZoom = THREE_LINES_TITLE_ZOOM; + g_fThreeLinesSubTitleZoom = THREE_LINES_SUB_TITLE_ZOOM; + g_fThreeLinesArtistZoom = THREE_LINES_ARTIST_ZOOM; + g_fTwoLinesTitleY = TWO_LINES_TITLE_Y; + g_fTwoLinesArtistY = TWO_LINES_ARTIST_Y; + g_fThreeLinesTitleY = THREE_LINES_TITLE_Y; + g_fThreeLinesSubTitleY = THREE_LINES_SUB_TITLE_Y; + g_fThreeLinesArtistY = THREE_LINES_ARTIST_Y; + m_textTitle.LoadFromFont( THEME->GetPathTo("Fonts","musicwheel text banner") ); m_textSubTitle.LoadFromFont( THEME->GetPathTo("Fonts","musicwheel text banner") ); m_textArtist.LoadFromFont( THEME->GetPathTo("Fonts","musicwheel text banner") ); - m_textTitle.SetX( -TEXT_BANNER_WIDTH/2 ); - m_textSubTitle.SetX( -TEXT_BANNER_WIDTH/2 ); - m_textArtist.SetX( -TEXT_BANNER_WIDTH/2 ); + m_textTitle.SetX( -g_fWidth/2 ); + m_textSubTitle.SetX( -g_fWidth/2 ); + m_textArtist.SetX( -g_fWidth/2 ); - m_textTitle.SetHorizAlign( align_left ); - m_textSubTitle.SetHorizAlign( align_left ); - m_textArtist.SetHorizAlign( align_left ); + m_textTitle.SetHorizAlign( (Actor::HorizAlign)g_iHorizAlign ); + m_textSubTitle.SetHorizAlign( (Actor::HorizAlign)g_iHorizAlign ); + m_textArtist.SetHorizAlign( (Actor::HorizAlign)g_iHorizAlign ); m_textTitle.TurnShadowOff(); m_textSubTitle.TurnShadowOff(); @@ -45,7 +89,7 @@ TextBanner::TextBanner() } -bool TextBanner::LoadFromSong( Song* pSong ) +bool TextBanner::LoadFromSong( const Song* pSong ) { if( pSong == NULL ) { @@ -55,60 +99,36 @@ bool TextBanner::LoadFromSong( Song* pSong ) return true; } - CString sMainTitle = pSong->m_sMainTitle; - CString sSubTitle = pSong->m_sSubTitle; + m_textTitle.SetText( pSong->m_sMainTitle ); + m_textSubTitle.SetText( pSong->m_sSubTitle ); + m_textArtist.SetText( g_sArtistPrependString + pSong->m_sArtist ); - m_textTitle.SetText( sMainTitle ); - m_textSubTitle.SetText( sSubTitle ); - m_textArtist.SetText( "/" + pSong->m_sArtist ); + bool bTwoLines = pSong->m_sSubTitle.length() == 0; + float fTitleZoom = bTwoLines ? g_fTwoLinesTitleZoom : g_fThreeLinesTitleZoom; + float fSubTitleZoom = bTwoLines ? 0 : g_fThreeLinesSubTitleZoom; + float fArtistZoom = bTwoLines ? g_fTwoLinesArtistZoom : g_fThreeLinesArtistZoom; - float fTitleZoom, fSubTitleZoom, fArtistZoom; + m_textTitle.SetZoomY( fTitleZoom ); + m_textSubTitle.SetZoomY( fSubTitleZoom ); + m_textArtist.SetZoomY( fArtistZoom ); - if( sSubTitle == "" ) - { - fTitleZoom = 1.0f; - fSubTitleZoom = 0.0f; - fArtistZoom = 0.6f; - } - else - { - fTitleZoom = 1.0f; - fSubTitleZoom = 0.5f; - fArtistZoom = 0.6f; - } + fTitleZoom = min( fTitleZoom, g_fWidth/m_textTitle.GetWidestLineWidthInSourcePixels() ); + fSubTitleZoom = min( fSubTitleZoom, g_fWidth/m_textSubTitle.GetWidestLineWidthInSourcePixels() ); + fArtistZoom = min( fArtistZoom, g_fWidth/m_textArtist.GetWidestLineWidthInSourcePixels() ); - m_textTitle.SetZoom( fTitleZoom ); - m_textSubTitle.SetZoom( fSubTitleZoom ); - m_textArtist.SetZoom( fArtistZoom ); + m_textTitle.SetZoomX( fTitleZoom ); + m_textSubTitle.SetZoomX( fSubTitleZoom ); + m_textArtist.SetZoomX( fArtistZoom ); + float fTitleY = bTwoLines ? g_fTwoLinesTitleY : g_fThreeLinesTitleY; + float fSubTitleY = bTwoLines ? 0 : g_fThreeLinesSubTitleY; + float fArtistY = bTwoLines ? g_fTwoLinesArtistY : g_fThreeLinesArtistY; - float fZoomedTitleWidth = m_textTitle.GetWidestLineWidthInSourcePixels() * fTitleZoom; - float fZoomedSubTitleWidth = m_textSubTitle.GetWidestLineWidthInSourcePixels() * fSubTitleZoom; - float fZoomedArtistWidth = m_textArtist.GetWidestLineWidthInSourcePixels() * fArtistZoom; + m_textTitle.SetY( fTitleY ); + m_textSubTitle.SetY( fSubTitleY ); + m_textArtist.SetY( fArtistY ); - // check to see if any of the lines run over the edge of the banner - if( fZoomedTitleWidth > TEXT_BANNER_WIDTH ) - m_textTitle.SetZoomX( TEXT_BANNER_WIDTH / m_textTitle.GetWidestLineWidthInSourcePixels() ); - if( fZoomedSubTitleWidth > TEXT_BANNER_WIDTH ) - m_textSubTitle.SetZoomX( TEXT_BANNER_WIDTH / m_textSubTitle.GetWidestLineWidthInSourcePixels() ); - if( fZoomedArtistWidth > TEXT_BANNER_WIDTH ) - m_textArtist.SetZoomX( TEXT_BANNER_WIDTH / m_textArtist.GetWidestLineWidthInSourcePixels() ); - - - - if( sSubTitle == "" ) - { - m_textTitle.SetY( -8 ); - m_textSubTitle.SetY( 0 ); - m_textArtist.SetY( 8 ); - } - else - { - m_textTitle.SetY( -10 ); - m_textSubTitle.SetY( 0 ); - m_textArtist.SetY( 10 ); - } return true; } diff --git a/stepmania/src/TextBanner.h b/stepmania/src/TextBanner.h index 77498d1d36..67b936b8a1 100644 --- a/stepmania/src/TextBanner.h +++ b/stepmania/src/TextBanner.h @@ -19,7 +19,7 @@ class TextBanner : public ActorFrame { public: TextBanner(); - bool LoadFromSong( Song* pSong ); + bool LoadFromSong( const Song* pSong ); private: BitmapText m_textTitle, m_textSubTitle, m_textArtist; diff --git a/stepmania/src/song.h b/stepmania/src/song.h index 6ce8e26266..ac883fb8e6 100644 --- a/stepmania/src/song.h +++ b/stepmania/src/song.h @@ -195,11 +195,13 @@ public: bool SongCompleteForStyle( const StyleDef *st ) const; bool SongHasNotesType( NotesType nt ) const; bool SongHasNotesTypeAndDifficulty( NotesType nt, Difficulty dc ) const; - void GetNotesThatMatch( NotesType nt, vector& arrayAddTo, bool bIncludeAutoGen = true ) const; - Notes* GetNotesThatMatch( NotesType nt, Difficulty dc, bool bIncludeAutoGen = true ) const; + void GetNotes( vector& arrayAddTo, NotesType nt, bool bIncludeAutoGen = true ) const; + Notes* GetNotes( NotesType nt, Difficulty dc, bool bIncludeAutoGen = true ) const; + void GetEdits( vector& arrayAddTo, NotesType nt, bool bIncludeAutoGen = true ) const; int GetNumTimesPlayed() const; bool IsNew() const; bool IsEasy( NotesType nt ) const; + bool HasEdits( NotesType nt ) const; Grade GetGradeForDifficulty( const StyleDef *s, PlayerNumber pn, Difficulty dc ) const; bool NormallyDisplayed() const; bool RouletteDisplayed() const; diff --git a/stepmania/stepmania.nsi b/stepmania/stepmania.nsi index 6df993a226..b01c5fb48e 100644 --- a/stepmania/stepmania.nsi +++ b/stepmania/stepmania.nsi @@ -19,7 +19,7 @@ !define PRODUCT_NAME_VER "${PRODUCT_NAME} ${VERSION}" Name "${PRODUCT_NAME}" -OutFile "stepmania-CVS-20030205.exe" +OutFile "stepmania-CVS-20030207.exe" ;OutFile "stepmania301.exe" ; Some default compiler settings (uncomment and change at will): @@ -136,9 +136,11 @@ RMDir /r "$INSTDIR\NoteSkins\dance\note" SetOutPath "$INSTDIR\NoteSkins" File "NoteSkins\instructions.txt" CreateDirectory "$INSTDIR\NoteSkins\dance\default" +CreateDirectory "$INSTDIR\NoteSkins\dance\flat" CreateDirectory "$INSTDIR\NoteSkins\dance\note" SetOutPath "$INSTDIR\NoteSkins\dance" File /r "NoteSkins\dance\default" +File /r "NoteSkins\dance\flat" File /r "NoteSkins\dance\note" SetOutPath "$INSTDIR\NoteSkins\pump" @@ -295,13 +297,14 @@ Delete "$INSTDIR\zliba.dll" Delete "$INSTDIR\SDL.dll" Delete "$INSTDIR\SDL_image.dll" Delete "$INSTDIR\COPYING.txt" -Delete "$INSTDIR\README-FIRST.TXT" +Delete "$INSTDIR\README-FIRST.htm" Delete "$INSTDIR\NEWS" Delete "$INSTDIR\stepmania.exe" Delete "$INSTDIR\stepmania.ini" Delete "$INSTDIR\smpackage.exe" Delete "$INSTDIR\StepMania.vdi" Delete "$INSTDIR\log.txt" +Delete "$INSTDIR\info.txt" RMDir "$INSTDIR" ; will delete only if empty