From 7379443cb317ff4c1f73ac7cb6d2923df7828469 Mon Sep 17 00:00:00 2001 From: Henrik Andersson Date: Sun, 29 May 2011 20:40:28 +0200 Subject: [PATCH 1/3] The wheel merge result compiles! It also doesn't crash at runtime! --- src/MusicWheel.cpp | 247 ++++++++++++++++++++++++++++++++++++------ src/MusicWheel.h | 260 +++++++++++++++++++++++---------------------- 2 files changed, 347 insertions(+), 160 deletions(-) diff --git a/src/MusicWheel.cpp b/src/MusicWheel.cpp index 85dbc2000b..39634b8051 100644 --- a/src/MusicWheel.cpp +++ b/src/MusicWheel.cpp @@ -23,6 +23,7 @@ #include "MessageManager.h" static Preference g_bMoveRandomToEnd( "MoveRandomToEnd", false ); +static Preference g_bPrecacheAllSorts( "PreCacheAllWheelSorts", false); #define NUM_WHEEL_ITEMS ((int)ceil(NUM_WHEEL_ITEMS_TO_DRAW+2)) #define WHEEL_TEXT(s) THEME->GetString( "MusicWheel", ssprintf("%sText",s.c_str()) ); @@ -69,18 +70,18 @@ void MusicWheel::Load( RString sType ) { ROULETTE_SWITCH_SECONDS .Load(sType,"RouletteSwitchSeconds"); ROULETTE_SLOW_DOWN_SWITCHES .Load(sType,"RouletteSlowDownSwitches"); - NUM_SECTION_COLORS .Load(sType,"NumSectionColors"); + NUM_SECTION_COLORS .Load(sType,"NumSectionColors"); SONG_REAL_EXTRA_COLOR .Load(sType,"SongRealExtraColor"); - SORT_MENU_COLOR .Load(sType,"SortMenuColor"); - SHOW_ROULETTE .Load(sType,"ShowRoulette"); - SHOW_RANDOM .Load(sType,"ShowRandom"); - SHOW_PORTAL .Load(sType,"ShowPortal"); + SORT_MENU_COLOR .Load(sType,"SortMenuColor"); + SHOW_ROULETTE .Load(sType,"ShowRoulette"); + SHOW_RANDOM .Load(sType,"ShowRandom"); + SHOW_PORTAL .Load(sType,"ShowPortal"); RANDOM_PICKS_LOCKED_SONGS .Load(sType,"RandomPicksLockedSongs"); MOST_PLAYED_SONGS_TO_SHOW .Load(sType,"MostPlayedSongsToShow"); RECENT_SONGS_TO_SHOW .Load(sType,"RecentSongsToShow"); MODE_MENU_CHOICE_NAMES .Load(sType,"ModeMenuChoiceNames"); - SORT_ORDERS .Load(sType,"SortOrders"); - SHOW_EASY_FLAG .Load(sType,"UseEasyMarkerFlag"); + SORT_ORDERS .Load(sType,"SortOrders"); + SHOW_EASY_FLAG .Load(sType,"UseEasyMarkerFlag"); USE_SECTIONS_WITH_PREFERRED_GROUP .Load(sType,"UseSectionsWithPreferredGroup"); HIDE_INACTIVE_SECTIONS .Load(sType,"OnlyShowActiveSection"); REMIND_WHEEL_POSITIONS .Load(sType,"RemindWheelPositions"); @@ -113,25 +114,33 @@ void MusicWheel::Load( RString sType ) * stable_sort) from its output, and title will be the secondary sort, without having * to re-sort by title each time. */ SONGMAN->SortSongs(); + + + FOREACH_ENUM( SortOrder, so ) { + m_WheelItemDatasStatus[so]=INVALID; + } } void MusicWheel::BeginScreen() { RageTimer timer; + FOREACH_ENUM( SortOrder, so ) { RString times; - /* Build all of the wheel item data. Do this after selecting the extra stage, - * so it knows to always display it. */ - FOREACH_ENUM( SortOrder, so ) - { - BuildWheelItemDatas( m_WheelItemDatas[so], so ); + if(m_WheelItemDatasStatus[so]!=INVALID) { + m_WheelItemDatasStatus[so]=NEEDREFILTER; times += ssprintf( "%i:%.3f ", so, timer.GetDeltaTime() ); - } + } LOG->Trace( "MusicWheel sorting took: %s", times.c_str() ); - /* Set m_LastModeMenuItem to the first item that matches the current mode. (Do this - * after building wheel item data.) */ + if(g_bPrecacheAllSorts) { + readyWheelItemsData(so); + } + } + + // Set m_LastModeMenuItem to the first item that matches the current mode. (Do this + // after building wheel item data.) { - const vector &from = m_WheelItemDatas[SORT_MODE_MENU]; + const vector &from = getWheelItemsData(SORT_MODE_MENU); for( unsigned i=0; im_pAction ); @@ -227,14 +236,19 @@ void MusicWheel::BeginScreen() MusicWheel::~MusicWheel() { - FOREACH_ENUM( SortOrder, so ) - FOREACH( MusicWheelItemData*, m_WheelItemDatas[so], i ) + FOREACH_ENUM( SortOrder, so ) { + vector::iterator i = m__UnFilteredWheelItemDatas[so].begin(); + vector::iterator iEnd = m__UnFilteredWheelItemDatas[so].end(); + for( ; i != iEnd; ++i ) { delete *i; + } + + } } -/* If a song or course is set in GAMESTATE and available, select it. Otherwise, - * choose the first available song or course. Return true if an item was set, - * false if no items are available. */ +/* If a song or course is set in GAMESTATE and available, select it. Otherwise, choose the + * first available song or course. Return true if an item was set, false if no items are + * available. */ bool MusicWheel::SelectSongOrCourse() { if( GAMESTATE->m_pPreferredSong && SelectSong( GAMESTATE->m_pPreferredSong ) ) @@ -247,7 +261,7 @@ bool MusicWheel::SelectSongOrCourse() return true; // Select the first selectable song based on the sort order... - vector &wiWheelItems = m_WheelItemDatas[GAMESTATE->m_SortOrder]; + vector &wiWheelItems = getWheelItemsData(GAMESTATE->m_SortOrder); for( unsigned i = 0; i < wiWheelItems.size(); i++ ) { if( wiWheelItems[i]->m_pSong ) @@ -280,7 +294,7 @@ bool MusicWheel::SelectSong( const Song *p ) return false; unsigned i; - vector &from = m_WheelItemDatas[GAMESTATE->m_SortOrder]; + vector &from = getWheelItemsData(GAMESTATE->m_SortOrder); for( i=0; im_pSong == p ) @@ -308,7 +322,7 @@ bool MusicWheel::SelectCourse( const Course *p ) return false; unsigned i; - vector &from = m_WheelItemDatas[GAMESTATE->m_SortOrder]; + vector &from = getWheelItemsData(GAMESTATE->m_SortOrder); for( i=0; im_pCourse == p ) @@ -335,7 +349,7 @@ bool MusicWheel::SelectModeMenuItem() { // Select the last-chosen option. ASSERT( GAMESTATE->m_SortOrder == SORT_MODE_MENU ); - const vector &from = m_WheelItemDatas[GAMESTATE->m_SortOrder]; + const vector &from = getWheelItemsData(GAMESTATE->m_SortOrder); unsigned i; for( i=0; i &arrayWheelIt WID.m_Flags.iStagesForSong = 1; } } +} +vector & MusicWheel::getWheelItemsData(SortOrder so) { // Update the popularity and init icons. + readyWheelItemsData(so); + return m__WheelItemDatas[so]; +} + +void MusicWheel::readyWheelItemsData(SortOrder so) { + if(m_WheelItemDatasStatus[so]!=VALID) { + RageTimer timer; + + vector &aUnFilteredDatas=m__UnFilteredWheelItemDatas[so]; + + if(m_WheelItemDatasStatus[so]==INVALID) { + BuildWheelItemDatas( aUnFilteredDatas, so ); + } + FilterWheelItemDatas( aUnFilteredDatas, m__WheelItemDatas[so], so ); + m_WheelItemDatasStatus[so]=VALID; + + LOG->Trace( "MusicWheel sorting took: %f", timer.GetTimeSinceStart() ); + } + +} + +void MusicWheel::FilterWheelItemDatas(vector &aUnFilteredDatas, vector &aFilteredData, SortOrder so ) +{ + + unsigned unfilteredSize=aUnFilteredDatas.size(); + + /* Only add TYPE_PORTAL if there's at least one song on the list. */ + bool bFoundAnySong = false; + for( unsigned i=0; i < unfilteredSize; i++ ) { + if( aUnFilteredDatas[i]->m_Type == TYPE_SONG ) { + bFoundAnySong = true; + break; + } + } + + vector aiRemove; + aiRemove.insert( aiRemove.begin(), unfilteredSize, false ); + + const int iMaxStagesForSong = GAMESTATE->GetSmallestNumStagesLeftForAnyHumanPlayer(); + + Song *pExtraStageSong = NULL; + if( GAMESTATE->IsAnExtraStage() ) + { + Steps *pSteps; + SONGMAN->GetExtraStageInfo( GAMESTATE->IsExtraStage2(), GAMESTATE->GetCurrentStyle(), pExtraStageSong, pSteps ); + } + + /* Mark any songs that aren't playable in aiRemove. */ + + for( unsigned i=0; i< unfilteredSize; i++ ) + { + MusicWheelItemData& WID = *aUnFilteredDatas[i]; + + /* If we have no songs, remove Random and Portal. */ + if( WID.m_Type == TYPE_RANDOM || WID.m_Type == TYPE_PORTAL ) + { + if( !bFoundAnySong ) + aiRemove[i] = true; + continue; + } + + /* Filter songs that we don't have enough stages to play. */ + if( WID.m_Type == TYPE_SONG ) + { + Song* pSong = WID.m_pSong; + + /* Never remove the extra stage song. */ + if( pExtraStageSong && WID.m_pSong == pExtraStageSong ) + continue; + + /* Check that we have enough stages to play this song. */ + if( GAMESTATE->GetNumStagesMultiplierForSong(WID.m_pSong) > iMaxStagesForSong ) + { + aiRemove[i] = true; + continue; + } + + int iLocked = UNLOCKMAN->SongIsLocked( pSong ); + if( iLocked & LOCKED_DISABLED ) + { + aiRemove[i] = true; + continue; + } + + /* If we're on an extra stage, and this song is selected, ignore #SELECTABLE. */ + if( pSong != GAMESTATE->m_pCurSong || !GAMESTATE->IsAnExtraStage() ) + { + /* Hide songs that asked to be hidden via #SELECTABLE. */ + if( iLocked & LOCKED_SELECTABLE ) + { + aiRemove[i] = true; + continue; + } + if( so != SORT_ROULETTE && iLocked & LOCKED_ROULETTE ) + { + aiRemove[i] = true; + continue; + } + } + + /* Hide locked songs. If RANDOM_PICKS_LOCKED_SONGS, hide in Roulette and Random, + * too. */ + if( (so!=SORT_ROULETTE || !RANDOM_PICKS_LOCKED_SONGS) && iLocked ) + { + aiRemove[i] = true; + continue; + } + + /* If the song has no steps for the current style, remove it. */ + if( !pSong->HasStepsType(GAMESTATE->GetCurrentStyle()->m_StepsType) ) + { + aiRemove[i] = true; + continue; + } + } + + if( WID.m_Type == TYPE_COURSE ) + { + if( !WID.m_pCourse->IsPlayableIn(GAMESTATE->GetCurrentStyle()->m_StepsType) ) + aiRemove[i] = true; + } + } + + /* Filter out the songs we're removing. */ + + aFilteredData.reserve( unfilteredSize ); + for( unsigned i=0; i< unfilteredSize; i++ ) + { + if( aiRemove[i] ) + continue; + aFilteredData.push_back( aUnFilteredDatas[i] ); + } + + // Update the song count in each section header. + unsigned filteredSize=aFilteredData.size(); + for( unsigned i=0; i < filteredSize; ) + { + MusicWheelItemData& WID = *aFilteredData[i]; + ++i; + if( WID.m_Type != TYPE_SECTION ) + continue; + + // Count songs in this section + WID.m_iSectionCount = 0; + for( ; i < filteredSize && aFilteredData[i]->m_sText == WID.m_sText; ++i ) + ++WID.m_iSectionCount; + } + + // If we have any section headers with no songs, then we filtered all of the songs in that group, + // so remove it. This isn't optimized like the above since this is a rare case. + for( unsigned i=0; i < filteredSize; ++i ) + { + MusicWheelItemData& WID = *aFilteredData[i]; + if( WID.m_Type != TYPE_SECTION ) + continue; + if( WID.m_iSectionCount > 0 ) + continue; + aFilteredData.erase( aFilteredData.begin()+i, aFilteredData.begin()+i+1 ); + --i; + --filteredSize; + } + + /* Update the popularity. This is affected by filtering. */ if( so == SORT_POPULARITY ) { - for( unsigned i=0; i< min(3u,arrayWheelItemDatas.size()); i++ ) + for( unsigned i=0; i< min(3u,aFilteredData.size()); i++ ) { - MusicWheelItemData& WID = *arrayWheelItemDatas[i]; + MusicWheelItemData& WID = *aFilteredData[i]; WID.m_Flags.iPlayersBestNumber = i+1; } } // If we've filtered all items, insert a dummy. - if( arrayWheelItemDatas.empty() ) - arrayWheelItemDatas.push_back( new MusicWheelItemData(TYPE_SECTION, NULL, "- EMPTY -", NULL, RageColor(1,0,0,1), 0) ); + if( aFilteredData.empty() ) + aFilteredData.push_back( new MusicWheelItemData(TYPE_SECTION, NULL, "- EMPTY -", NULL, RageColor(1,0,0,1), 0) ); } void MusicWheel::UpdateSwitch() @@ -980,7 +1159,7 @@ bool MusicWheel::ChangeSort( SortOrder new_so ) // return true if change success return false; // Don't change to SORT_MODE_MENU if it doesn't have at least two choices. - if( new_so == SORT_MODE_MENU && m_WheelItemDatas[new_so].size() < 2 ) + if( new_so == SORT_MODE_MENU && getWheelItemsData(new_so).size() < 2 ) return false; switch( m_WheelState ) @@ -1116,7 +1295,7 @@ void MusicWheel::StartRandom() { // Shuffle and use the roulette wheel. RandomGen rnd; - random_shuffle( m_WheelItemDatas[SORT_ROULETTE].begin(), m_WheelItemDatas[SORT_ROULETTE].end(), rnd ); + random_shuffle( getWheelItemsData(SORT_ROULETTE).begin(), getWheelItemsData(SORT_ROULETTE).end(), rnd ); GAMESTATE->m_SortOrder.Set( SORT_ROULETTE ); } else @@ -1154,7 +1333,7 @@ void MusicWheel::SetOpenSection( RString group ) GAMEMAN->GetCompatibleStyles( GAMESTATE->m_pCurGame, GAMESTATE->GetNumPlayersEnabled(), vpPossibleStyles ); m_CurWheelItemData.clear(); - vector &from = m_WheelItemDatas[GAMESTATE->m_SortOrder]; + vector &from = getWheelItemsData(GAMESTATE->m_SortOrder); m_CurWheelItemData.reserve( from.size() ); for( unsigned i = 0; i < from.size(); ++i ) { @@ -1316,7 +1495,7 @@ void MusicWheel::PlayerJoined() // We need to rebuild the wheel item data in this situation. -aj if( !GAMESTATE->IsCourseMode() && !PREFSMAN->m_bAutogenSteps ) { - BuildWheelItemDatas( m_WheelItemDatas[GAMESTATE->m_SortOrder], GAMESTATE->m_SortOrder ); + m_WheelItemDatasStatus [GAMESTATE->m_SortOrder]=INVALID; } SetOpenSection( m_sExpandedSectionName ); @@ -1366,7 +1545,7 @@ Song *MusicWheel::GetPreferredSelectionForRandomOrPortal() } RString sPreferredGroup = m_sExpandedSectionName; - vector &wid = m_WheelItemDatas[GAMESTATE->m_SortOrder]; + vector &wid = getWheelItemsData(GAMESTATE->m_SortOrder); StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType; diff --git a/src/MusicWheel.h b/src/MusicWheel.h index 73e63deb0e..cf4db1b302 100644 --- a/src/MusicWheel.h +++ b/src/MusicWheel.h @@ -1,126 +1,134 @@ -/* MusicWheel - A wheel with song names used in the Select Music screen. */ - -#ifndef MUSIC_WHEEL_H -#define MUSIC_WHEEL_H - -#include "RageSound.h" -#include "GameConstantsAndTypes.h" -#include "MusicWheelItem.h" -#include "ThemeMetric.h" -#include "WheelBase.h" - -class Course; -class Song; - -struct CompareSongPointerArrayBySectionName; - -class MusicWheel : public WheelBase -{ - friend struct CompareSongPointerArrayBySectionName; - -public: - virtual ~MusicWheel(); - virtual void Load( RString sType ); - void BeginScreen(); - - bool ChangeSort( SortOrder new_so ); // return true if change successful - bool NextSort(); // return true if change successful - void StartRoulette(); - void StartRandom(); - bool IsRouletting() const; - - virtual bool Select(); // return true if this selection ends the screen - WheelItemDataType GetSelectedType() { return GetCurWheelItemData(m_iSelection)->m_Type; } - Song *GetSelectedSong(); - Course *GetSelectedCourse() { return GetCurWheelItemData(m_iSelection)->m_pCourse; } - RString GetSelectedSection() { return GetCurWheelItemData(m_iSelection)->m_sText; } - - Song *GetPreferredSelectionForRandomOrPortal(); - - bool SelectSong( const Song *p ); - bool SelectSection( const RString & SectionName ); - void SetOpenSection( RString group ); - SortOrder GetSortOrder() const { return m_SortOrder; } - virtual void ChangeMusic( int dist ); /* +1 or -1 */ //CHECK THIS - void FinishChangingSorts(); - void PlayerJoined(); - // sm-ssc additions - RString JumpToNextGroup(); - RString JumpToPrevGroup(); - const MusicWheelItemData *GetCurWheelItemData( int i ) { return (const MusicWheelItemData *) m_CurWheelItemData[i]; } - -protected: - MusicWheelItem *MakeItem(); - - void GetSongList( vector &arraySongs, SortOrder so ); - void BuildWheelItemDatas( vector &arrayWheelItems, SortOrder so ); - bool SelectSongOrCourse(); - bool SelectCourse( const Course *p ); - bool SelectModeMenuItem(); - //bool SelectCustomItem(); - - virtual void UpdateSwitch(); - - vector m_WheelItemDatas[NUM_SortOrder]; // aliases into m_UnfilteredWheelItemDatas - - RString m_sLastModeMenuItem; - SortOrder m_SortOrder; - RageSound m_soundChangeSort; - - bool WheelItemIsVisible(int n); - - ThemeMetric ROULETTE_SWITCH_SECONDS; - ThemeMetric ROULETTE_SLOW_DOWN_SWITCHES; - ThemeMetric NUM_SECTION_COLORS; - ThemeMetric SONG_REAL_EXTRA_COLOR; - ThemeMetric SORT_MENU_COLOR; - ThemeMetric SHOW_ROULETTE; - ThemeMetric SHOW_RANDOM; - ThemeMetric SHOW_PORTAL; - ThemeMetric RANDOM_PICKS_LOCKED_SONGS; - ThemeMetric MOST_PLAYED_SONGS_TO_SHOW; - ThemeMetric RECENT_SONGS_TO_SHOW; - ThemeMetric MODE_MENU_CHOICE_NAMES; - ThemeMetricMap CHOICE; - ThemeMetric1D SECTION_COLORS; - ThemeMetric SORT_ORDERS; - ThemeMetric SHOW_EASY_FLAG; - // sm-ssc additions: - ThemeMetric USE_SECTIONS_WITH_PREFERRED_GROUP; - ThemeMetric HIDE_INACTIVE_SECTIONS; - ThemeMetric REMIND_WHEEL_POSITIONS; - ThemeMetric ROULETTE_COLOR; - ThemeMetric RANDOM_COLOR; - ThemeMetric PORTAL_COLOR; - vector m_viWheelPositions; - ThemeMetric CUSTOM_WHEEL_ITEM_NAMES; - ThemeMetricMap CUSTOM_CHOICES; - ThemeMetricMap CUSTOM_CHOICE_COLORS; -}; - -#endif - -/* - * (c) 2001-2004 Chris Danford, Chris Gomez, Glenn Maynard - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +/* MusicWheel - A wheel with song names used in the Select Music screen. */ + +#ifndef MUSIC_WHEEL_H +#define MUSIC_WHEEL_H + +#include "RageSound.h" +#include "GameConstantsAndTypes.h" +#include "MusicWheelItem.h" +#include "ThemeMetric.h" +#include "WheelBase.h" + +class Course; +class Song; + +struct CompareSongPointerArrayBySectionName; + +class MusicWheel : public WheelBase +{ + friend struct CompareSongPointerArrayBySectionName; + +public: + virtual ~MusicWheel(); + virtual void Load( RString sType ); + void BeginScreen(); + + bool ChangeSort( SortOrder new_so ); // return true if change successful + bool NextSort(); // return true if change successful + void StartRoulette(); + void StartRandom(); + bool IsRouletting() const; + + virtual bool Select(); // return true if this selection ends the screen + WheelItemDataType GetSelectedType() { return GetCurWheelItemData(m_iSelection)->m_Type; } + Song *GetSelectedSong(); + Course *GetSelectedCourse() { return GetCurWheelItemData(m_iSelection)->m_pCourse; } + RString GetSelectedSection() { return GetCurWheelItemData(m_iSelection)->m_sText; } + + Song *GetPreferredSelectionForRandomOrPortal(); + + bool SelectSong( const Song *p ); + bool SelectSection( const RString & SectionName ); + void SetOpenSection( RString group ); + SortOrder GetSortOrder() const { return m_SortOrder; } + virtual void ChangeMusic( int dist ); /* +1 or -1 */ //CHECK THIS + void FinishChangingSorts(); + void PlayerJoined(); + // sm-ssc additions + RString JumpToNextGroup(); + RString JumpToPrevGroup(); + const MusicWheelItemData *GetCurWheelItemData( int i ) { return (const MusicWheelItemData *) m_CurWheelItemData[i]; } + +protected: + MusicWheelItem *MakeItem(); + + void GetSongList( vector &arraySongs, SortOrder so ); + bool SelectSongOrCourse(); + bool SelectCourse( const Course *p ); + bool SelectModeMenuItem(); + + virtual void UpdateSwitch(); + + vector & getWheelItemsData(SortOrder so); + void readyWheelItemsData(SortOrder so); + + RString m_sLastModeMenuItem; + SortOrder m_SortOrder; + RageSound m_soundChangeSort; + + bool WheelItemIsVisible(int n); + + ThemeMetric ROULETTE_SWITCH_SECONDS; + ThemeMetric ROULETTE_SLOW_DOWN_SWITCHES; + ThemeMetric NUM_SECTION_COLORS; + ThemeMetric SONG_REAL_EXTRA_COLOR; + ThemeMetric SORT_MENU_COLOR; + ThemeMetric SHOW_ROULETTE; + ThemeMetric SHOW_RANDOM; + ThemeMetric SHOW_PORTAL; + ThemeMetric RANDOM_PICKS_LOCKED_SONGS; + ThemeMetric MOST_PLAYED_SONGS_TO_SHOW; + ThemeMetric RECENT_SONGS_TO_SHOW; + ThemeMetric MODE_MENU_CHOICE_NAMES; + ThemeMetricMap CHOICE; + ThemeMetric1D SECTION_COLORS; + ThemeMetric SORT_ORDERS; + ThemeMetric SHOW_EASY_FLAG; + // sm-ssc additions: + ThemeMetric USE_SECTIONS_WITH_PREFERRED_GROUP; + ThemeMetric HIDE_INACTIVE_SECTIONS; + ThemeMetric REMIND_WHEEL_POSITIONS; + ThemeMetric ROULETTE_COLOR; + ThemeMetric RANDOM_COLOR; + ThemeMetric PORTAL_COLOR; + vector m_viWheelPositions; + ThemeMetric CUSTOM_WHEEL_ITEM_NAMES; + ThemeMetricMap CUSTOM_CHOICES; + ThemeMetricMap CUSTOM_CHOICE_COLORS; + +private: + //use getWheelItemsData instead of touching this one + enum {INVALID,NEEDREFILTER,VALID} m_WheelItemDatasStatus[NUM_SortOrder]; + vector m__WheelItemDatas[NUM_SortOrder]; + vector m__UnFilteredWheelItemDatas[NUM_SortOrder]; + + void BuildWheelItemDatas( vector &arrayWheelItems, SortOrder so ); + void FilterWheelItemDatas(vector &aUnFilteredDatas, vector &aFilteredData, SortOrder so ); +}; + +#endif + +/* + * (c) 2001-2004 Chris Danford, Chris Gomez, Glenn Maynard + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ From ca71c99f63ae26370ca45ebefbf70f07d7d7d1c4 Mon Sep 17 00:00:00 2001 From: Henrik Andersson Date: Mon, 30 May 2011 11:25:09 +0200 Subject: [PATCH 2/3] Cleaning up some merge junk that I missed. --- src/MusicWheel.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/MusicWheel.cpp b/src/MusicWheel.cpp index 39634b8051..77303f5286 100644 --- a/src/MusicWheel.cpp +++ b/src/MusicWheel.cpp @@ -124,18 +124,21 @@ void MusicWheel::Load( RString sType ) void MusicWheel::BeginScreen() { RageTimer timer; - FOREACH_ENUM( SortOrder, so ) { RString times; + FOREACH_ENUM( SortOrder, so ) { if(m_WheelItemDatasStatus[so]!=INVALID) { m_WheelItemDatasStatus[so]=NEEDREFILTER; - times += ssprintf( "%i:%.3f ", so, timer.GetDeltaTime() ); + } - LOG->Trace( "MusicWheel sorting took: %s", times.c_str() ); if(g_bPrecacheAllSorts) { readyWheelItemsData(so); + times += ssprintf( "%i:%.3f ", so, timer.GetDeltaTime() ); } } + if(g_bPrecacheAllSorts) { + LOG->Trace( "MusicWheel sorting took: %s", times.c_str() ); + } // Set m_LastModeMenuItem to the first item that matches the current mode. (Do this // after building wheel item data.) @@ -1495,7 +1498,10 @@ void MusicWheel::PlayerJoined() // We need to rebuild the wheel item data in this situation. -aj if( !GAMESTATE->IsCourseMode() && !PREFSMAN->m_bAutogenSteps ) { - m_WheelItemDatasStatus [GAMESTATE->m_SortOrder]=INVALID; + if(m_WheelItemDatasStatus[GAMESTATE->m_SortOrder]!=INVALID) + m_WheelItemDatasStatus[GAMESTATE->m_SortOrder]=NEEDREFILTER; + + RebuildWheelItems(); } SetOpenSection( m_sExpandedSectionName ); From f717de974ebc5ad9fc2a953d6b6e72a798e0c02b Mon Sep 17 00:00:00 2001 From: Henrik Andersson Date: Wed, 1 Jun 2011 14:58:27 +0200 Subject: [PATCH 3/3] Just tweaking some compiler switches. --- src/StepMania-net2010.vcxproj | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/StepMania-net2010.vcxproj b/src/StepMania-net2010.vcxproj index ae25c03b62..f954c274df 100644 --- a/src/StepMania-net2010.vcxproj +++ b/src/StepMania-net2010.vcxproj @@ -191,8 +191,7 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir) WIN32;NDEBUG;_WINDOWS;WINDOWS;RELEASE;GLEW_STATIC;%(PreprocessorDefinitions) true false - - + Sync MultiThreadedDLL false false @@ -208,7 +207,8 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir) true ProgramDatabase 4063;4100;4127;4201;4244;4275;4355;4505;4512;4702;4786;4996;%(DisableSpecificWarnings) - false + true + true NDEBUG;%(PreprocessorDefinitions) @@ -227,9 +227,10 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir) true Windows false - - + true SendErrorReport + UseLinkTimeCodeGeneration + true archutils\Win32\mapconv "$(IntDir)$(TargetName).map" "$(TargetDir)\StepMania.vdi"