From 6ed1d938e7b5d20c58efca37e61c02acc5dabfcc Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Mon, 11 Feb 2002 04:46:31 +0000 Subject: [PATCH] Added synchronize --- stepmania/src/Background.cpp | 10 +-- stepmania/src/Background.h | 2 +- stepmania/src/BitmapText.cpp | 4 +- stepmania/src/GhostArrow.cpp | 2 +- stepmania/src/GhostArrowBright.cpp | 2 +- stepmania/src/Grade.cpp | 4 +- stepmania/src/GradeDisplay.h | 2 +- stepmania/src/MusicSortDisplay.cpp | 2 +- stepmania/src/MusicWheel.cpp | 10 +-- stepmania/src/Player.cpp | 2 +- stepmania/src/RageSound.cpp | 16 ++-- stepmania/src/Song.cpp | 127 +++++++++++++++++++++++++++-- stepmania/src/Sprite.cpp | 4 +- stepmania/src/StepMania.dsp | 16 ++++ stepmania/src/ThemeManager.cpp | 2 + stepmania/src/ThemeManager.h | 2 + stepmania/src/Transition.h | 2 +- stepmania/src/song.h | 16 ++-- 18 files changed, 180 insertions(+), 45 deletions(-) diff --git a/stepmania/src/Background.cpp b/stepmania/src/Background.cpp index 60f29443b4..348a632e72 100644 --- a/stepmania/src/Background.cpp +++ b/stepmania/src/Background.cpp @@ -32,12 +32,12 @@ Background::Background() m_sprDangerBackground.StretchTo( CRect(SCREEN_LEFT, SCREEN_TOP, SCREEN_RIGHT, SCREEN_BOTTOM) ); } -bool Background::LoadFromSong( Song &song ) +bool Background::LoadFromSong( Song* pSong, bool bDisableVisualizations ) { - if( song.HasBackgroundMovie() ) + if( pSong->HasBackgroundMovie() ) { // load the movie backgound, and don't load a visualization - m_sprSongBackground.Load( song.HasBackground() ); + m_sprSongBackground.Load( pSong->HasBackground() ); m_sprSongBackground.StretchTo( CRect( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ) ); m_sprSongBackground.SetZoomY( -1 ); m_sprSongBackground.SetDiffuseColor( D3DXCOLOR(0,0,0,1) ); @@ -46,7 +46,7 @@ bool Background::LoadFromSong( Song &song ) else { // load the static background (if available), and a visualization - if( song.HasBackground() ) m_sprSongBackground.Load( song.GetBackgroundPath(), HINT_DITHER ); + if( pSong->HasBackground() ) m_sprSongBackground.Load( pSong->GetBackgroundPath(), HINT_DITHER ); else m_sprSongBackground.Load( THEME->GetPathTo(GRAPHIC_FALLBACK_BACKGROUND), HINT_DITHER ); m_sprSongBackground.StretchTo( CRect( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ) ); @@ -54,7 +54,7 @@ bool Background::LoadFromSong( Song &song ) this->AddActor( &m_sprSongBackground ); - if( GAMEINFO->m_GameOptions.m_bRandomVis ) + if( GAMEINFO->m_GameOptions.m_bRandomVis && !bDisableVisualizations ) { // load a random visualization CStringArray sVisualizationPaths; diff --git a/stepmania/src/Background.h b/stepmania/src/Background.h index f00146d367..569ff1b9b1 100644 --- a/stepmania/src/Background.h +++ b/stepmania/src/Background.h @@ -22,7 +22,7 @@ class Background : public ActorFrame public: Background(); - virtual bool LoadFromSong( Song &song ); + virtual bool LoadFromSong( Song *pSong, bool bDisableVisualizations = false ); virtual void Update( float fDeltaTime ); virtual void RenderPrimitives(); diff --git a/stepmania/src/BitmapText.cpp b/stepmania/src/BitmapText.cpp index 575a861a98..42425f4bf4 100644 --- a/stepmania/src/BitmapText.cpp +++ b/stepmania/src/BitmapText.cpp @@ -219,7 +219,7 @@ void BitmapText::RebuildVertexBuffer() case align_top: fY = -(m_sTextLines.GetSize()) * fHeight / 2; break; case align_middle: fY = 0; break; case align_bottom: fY = (m_sTextLines.GetSize()) * fHeight / 2; break; - default: ASSERT( true ); + default: ASSERT( false ); } @@ -234,7 +234,7 @@ void BitmapText::RebuildVertexBuffer() case align_left: fX = 0; break; case align_center: fX = -(fLineWidth/2); break; case align_right: fX = -fLineWidth; break; - default: ASSERT( true ); + default: ASSERT( false ); } for( int j=0; j arraySongs; + CArray arraySongs; arraySongs.Copy( GAMEINFO->m_pSongs ); SortSongPointerArrayByGroup( arraySongs ); @@ -283,7 +283,7 @@ void MusicWheel::BuildWheelItemDatas( CArray &arr /////////////////////////////////// // Make an array of Song*, then sort them /////////////////////////////////// - CArray arraySongs; + CArray arraySongs; // copy only song that have at least one Steps for the current GameMode for( int i=0; im_pSongs.GetSize(); i++ ) @@ -317,7 +317,7 @@ void MusicWheel::BuildWheelItemDatas( CArray &arr SortSongPointerArrayByMostPlayed( arraySongs ); break; default: - ASSERT( true ); // unhandled SORT_ORDER + ASSERT( false ); // unhandled SORT_ORDER } @@ -379,7 +379,7 @@ void MusicWheel::BuildWheelItemDatas( CArray &arr } break; default: - ASSERT( true ); // unhandled SORT_ORDER + ASSERT( false ); // unhandled SORT_ORDER } // init crowns diff --git a/stepmania/src/Player.cpp b/stepmania/src/Player.cpp index 7064d74770..ddc05d25da 100644 --- a/stepmania/src/Player.cpp +++ b/stepmania/src/Player.cpp @@ -163,7 +163,7 @@ Player::Player() m_ColumnToRotation[7] = mapStepToRotation[STEP_PAD2_RIGHT]; break; default: - ASSERT( true ); // invalid GameMode + ASSERT( false ); // invalid GameMode } diff --git a/stepmania/src/RageSound.cpp b/stepmania/src/RageSound.cpp index 2982d802ec..d23d0e6f40 100644 --- a/stepmania/src/RageSound.cpp +++ b/stepmania/src/RageSound.cpp @@ -32,15 +32,13 @@ RageSound::RageSound( HWND hWnd ) if( !BASS_Init( -1, 44100, BASS_DEVICE_LEAVEVOL, m_hWndApp ) ) { - MessageBox( NULL, - "There was an error while initializing your sound card.\n\n" - "The most likely cause of this problem is that you do not have a sound card\n" - "installed, or that you have not yet installed a driver for your sound card.\n" - "Before running this program again, please verify that your sound card is\n" - "is working in other Windows applications.", - "Sound error", - MB_ICONSTOP ); - RageError( "BASS can't initialize sound device." ); + RageError( + "There was an error while initializing your sound card.\n\n" + "The most likely cause of this problem is that you do not have a sound card\n" + "installed, or that you have not yet installed a driver for your sound card.\n" + "Before running this program again, please verify that your sound card is\n" + "is working in other Windows applications." + ); } BASS_Start(); diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index 0f433caea9..b2a211ad32 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -220,7 +220,7 @@ bool Song::LoadSongInfoFromBMSDir( CString sDir ) // Load the Song info from the first BMS file. Silly BMS duplicates the song info in every // file. So, we read the song data from only the first BMS file and assume that the info // is identical for every BMS file in the directory. - CString sBMSFilePath = m_sSongDir + arrayBMSFileNames[0]; + m_sSongFilePath = m_sSongDir + arrayBMSFileNames[0]; // load the Steps from the rest of the BMS files for( int i=0; i &arraySongPointers ) +void SortSongPointerArrayByTitle( CArray &arraySongPointers ) { qsort( arraySongPointers.GetData(), arraySongPointers.GetSize(), sizeof(Song*), CompareSongPointersByTitle ); } @@ -728,7 +839,7 @@ int CompareSongPointersByBPM(const void *arg1, const void *arg2) return 1; } -void SortSongPointerArrayByBPM( CArray &arraySongPointers ) +void SortSongPointerArrayByBPM( CArray &arraySongPointers ) { qsort( arraySongPointers.GetData(), arraySongPointers.GetSize(), sizeof(Song*), CompareSongPointersByBPM ); } @@ -751,7 +862,7 @@ int CompareSongPointersByArtist(const void *arg1, const void *arg2) return CompareCStrings( (void*)&sCompareString1, (void*)&sCompareString2 ); } -void SortSongPointerArrayByArtist( CArray &arraySongPointers ) +void SortSongPointerArrayByArtist( CArray &arraySongPointers ) { qsort( arraySongPointers.GetData(), arraySongPointers.GetSize(), sizeof(Song*), CompareSongPointersByArtist ); } @@ -773,7 +884,7 @@ int CompareSongPointersByGroup(const void *arg1, const void *arg2) return CompareCStrings( (void*)&sCompareString1, (void*)&sCompareString2 ); } -void SortSongPointerArrayByGroup( CArray &arraySongPointers ) +void SortSongPointerArrayByGroup( CArray &arraySongPointers ) { qsort( arraySongPointers.GetData(), arraySongPointers.GetSize(), sizeof(Song*), CompareSongPointersByGroup ); } @@ -797,7 +908,7 @@ int CompareSongPointersByMostPlayed(const void *arg1, const void *arg2) return 1; } -void SortSongPointerArrayByMostPlayed( CArray &arraySongPointers ) +void SortSongPointerArrayByMostPlayed( CArray &arraySongPointers ) { qsort( arraySongPointers.GetData(), arraySongPointers.GetSize(), sizeof(Song*), CompareSongPointersByMostPlayed ); } diff --git a/stepmania/src/Sprite.cpp b/stepmania/src/Sprite.cpp index 43337cfa60..fd5b67059e 100644 --- a/stepmania/src/Sprite.cpp +++ b/stepmania/src/Sprite.cpp @@ -255,7 +255,7 @@ void Sprite::RenderPrimitives() case align_top: quadVerticies.left = 0; quadVerticies.right = m_size.x; break; case align_middle: quadVerticies.left = -m_size.x/2; quadVerticies.right = m_size.x/2; break; case align_bottom: quadVerticies.left = -m_size.x; quadVerticies.right = 0; break; - default: ASSERT( true ); + default: ASSERT( false ); } switch( m_VertAlign ) @@ -263,7 +263,7 @@ void Sprite::RenderPrimitives() case align_bottom: quadVerticies.top = 0; quadVerticies.bottom = m_size.y; break; case align_middle: quadVerticies.top = -m_size.y/2; quadVerticies.bottom = m_size.y/2; break; case align_top: quadVerticies.top = -m_size.y; quadVerticies.bottom = 0; break; - default: ASSERT( true ); + default: ASSERT( false ); } diff --git a/stepmania/src/StepMania.dsp b/stepmania/src/StepMania.dsp index 7466e240b5..63f60b95a6 100644 --- a/stepmania/src/StepMania.dsp +++ b/stepmania/src/StepMania.dsp @@ -332,6 +332,22 @@ SOURCE=.\WindowSongOptions.h # End Source File # Begin Source File +SOURCE=.\WindowSynchronize.cpp +# End Source File +# Begin Source File + +SOURCE=.\WindowSynchronize.h +# End Source File +# Begin Source File + +SOURCE=.\WindowSynchronizeMenu.cpp +# End Source File +# Begin Source File + +SOURCE=.\WindowSynchronizeMenu.h +# End Source File +# Begin Source File + SOURCE=.\WindowTitleMenu.cpp # End Source File # Begin Source File diff --git a/stepmania/src/ThemeManager.cpp b/stepmania/src/ThemeManager.cpp index 0af9d9b254..64ffbe4e63 100644 --- a/stepmania/src/ThemeManager.cpp +++ b/stepmania/src/ThemeManager.cpp @@ -69,6 +69,8 @@ CString ThemeManager::ElementToAssetPath( ThemeElement te ) case GRAPHIC_MUSIC_STATUS_ICONS: sAssetPath = "Graphics\\music status icons 1x4"; break; case GRAPHIC_DANGER_TEXT: sAssetPath = "Graphics\\danger text"; break; case GRAPHIC_DANGER_BACKGROUND: sAssetPath = "Graphics\\danger background"; break; + case GRAPHIC_ARROWS_LEFT: sAssetPath = "Graphics\\arrows left 1x4"; break; + case GRAPHIC_ARROWS_RIGHT: sAssetPath = "Graphics\\arrows right 1x4"; break; case SOUND_FAILED: sAssetPath = "Sounds\\failed"; break; case SOUND_ASSIST: sAssetPath = "Sounds\\Assist"; break; diff --git a/stepmania/src/ThemeManager.h b/stepmania/src/ThemeManager.h index bf923e1a78..5bec0c1b9c 100644 --- a/stepmania/src/ThemeManager.h +++ b/stepmania/src/ThemeManager.h @@ -63,6 +63,8 @@ enum ThemeElement { GRAPHIC_MUSIC_STATUS_ICONS, GRAPHIC_DANGER_TEXT, GRAPHIC_DANGER_BACKGROUND, + GRAPHIC_ARROWS_LEFT, + GRAPHIC_ARROWS_RIGHT, SOUND_FAILED, SOUND_ASSIST, diff --git a/stepmania/src/Transition.h b/stepmania/src/Transition.h index 03f2dcf8c1..dace317322 100644 --- a/stepmania/src/Transition.h +++ b/stepmania/src/Transition.h @@ -79,7 +79,7 @@ protected: case closed: return 1; default: - ASSERT( true ); + ASSERT( false ); return 0; } }; diff --git a/stepmania/src/song.h b/stepmania/src/song.h index 2bbd71ee55..a13f8ac65c 100644 --- a/stepmania/src/song.h +++ b/stepmania/src/song.h @@ -43,6 +43,9 @@ public: bool LoadFromSongDir( CString sDir ); bool LoadSongInfoFromDWIFile( CString sPath ); bool LoadSongInfoFromBMSDir( CString sDir ); + + void SaveOffsetChangeToDisk(); + private: void TidyUpData(); @@ -93,6 +96,9 @@ public: return iTotalNumTimesPlayed; } + bool HasChangedSinceLastSave() { return m_bChangedSinceSave; } + void SetChangedSinceLastSave() { m_bChangedSinceSave = true; } + private: CString m_sSongFilePath; CString m_sSongDir; @@ -118,11 +124,11 @@ public: }; -void SortSongPointerArrayByTitle( CArray &arraySongPointers ); -void SortSongPointerArrayByBPM( CArray &arraySongPointers ); -void SortSongPointerArrayByArtist( CArray &arraySongPointers ); -void SortSongPointerArrayByGroup( CArray &arraySongPointers ); -void SortSongPointerArrayByMostPlayed( CArray &arraySongPointers ); +void SortSongPointerArrayByTitle( CArray &arraySongPointers ); +void SortSongPointerArrayByBPM( CArray &arraySongPointers ); +void SortSongPointerArrayByArtist( CArray &arraySongPointers ); +void SortSongPointerArrayByGroup( CArray &arraySongPointers ); +void SortSongPointerArrayByMostPlayed( CArray &arraySongPointers );