From 69d97d461b146bf1415f7b8691dd5118f262377a Mon Sep 17 00:00:00 2001 From: Kevin Slaughter Date: Sat, 8 Mar 2003 08:03:22 +0000 Subject: [PATCH] ScreenSelectMaxType2 had a small veriable error that would not let it compile.. renamed `p` to `pl` is all..nuthin big --- stepmania/src/ScreenGameplay.cpp | 40 +++++++++++---- stepmania/src/ScreenGameplay.h | 9 +++- stepmania/src/ScreenSelectDifficultyEX.cpp | 12 ++--- stepmania/src/ScreenSelectDifficultyEX.h | 2 +- stepmania/src/ScreenSelectMaxType2.cpp | 4 +- stepmania/src/Song.cpp | 59 +++++++++++++++++++++- stepmania/src/StepMania.dsp | 20 +++++++- stepmania/src/song.h | 21 ++++++-- 8 files changed, 140 insertions(+), 27 deletions(-) diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index 64a92e2b4e..d501034cd6 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -106,6 +106,12 @@ ScreenGameplay::ScreenGameplay( bool bDemonstration ) { LOG->Trace( "ScreenGameplay::ScreenGameplay()" ); + + m_textLyrics.LoadFromFont( THEME->GetPathTo("Fonts","normal") ); + m_textLyrics.SetXY( 100,100 ); + m_textLyrics.SetDiffuse( RageColor(1,1,1,1) ); + + if( GAMESTATE->m_pCurSong == NULL && GAMESTATE->m_pCurCourse == NULL ) return; // ScreenDemonstration will move us to the next scren. We just need to survive for one update without crashing. @@ -183,18 +189,23 @@ ScreenGameplay::ScreenGameplay( bool bDemonstration ) - // If this is beginner mode, show the helper - /* !! Working on this.. having probs loading the BG sequences -- Miryokuteki - - m_sprBH.Load( THEME->GetPathTo("BGAnimations","beginner helper up") ); - this->AddChild( &m_sprBH ); - m_sprBH.SetXY( 100,100 ); - m_sprBH.StartAnimating(); - this->AddChild( &m_bgaBeginnerHelper ); - m_bgaBH.SetXY( 100,100 ); - m_Background.AddChild(&m_bgaBH); - */ + + + // If this is beginner mode, show the helper + /* !! Working on this.. having probs loading the BG sequences -- Miryokuteki */ + + //this->AddChild( &m_bhDancer ); + //m_bhDancer.Load( THEME->GetPathTo("Graphics", "select difficulty ex picture easy") ); + //m_bhDancer.SetXY( -100,-100 ); //<-- causing entire screen to offset! + //m_bhDancer.SetDiffuse( RageColor(1,1,1,1) ); + //m_bhDancer.SetEffectGlowShift( 0.5f ); + //m_bhDancer.BeginDraw(); + + /* */ + + + @@ -391,6 +402,7 @@ ScreenGameplay::ScreenGameplay( bool bDemonstration ) m_textDebug.SetXY( DEBUG_X, DEBUG_Y ); m_textDebug.SetDiffuse( RageColor(1,1,1,1) ); this->AddChild( &m_textDebug ); + this->AddChild( &m_textLyrics ); for( int s=0; sm_PreferredDifficulty[p] = DIFFICULTY_BEGINNER; break; case CHOICE_EX_EASY: GAMESTATE->m_PreferredDifficulty[p] = DIFFICULTY_EASY; break; case CHOICE_EX_NONSTOP: // need to set preferred difficulty even for courses - case CHOICE_EX_BATTLE: + //case CHOICE_EX_BATTLE: case CHOICE_EX_ONI: case CHOICE_EX_ENDLESS: case CHOICE_EX_MEDIUM: GAMESTATE->m_PreferredDifficulty[p] = DIFFICULTY_MEDIUM; break; @@ -204,7 +204,7 @@ void ScreenSelectDifficultyEX::HandleScreenMessage( const ScreenMessage SM ) case CHOICE_EX_NONSTOP: GAMESTATE->m_PlayMode = PLAY_MODE_NONSTOP; break; case CHOICE_EX_ONI: GAMESTATE->m_PlayMode = PLAY_MODE_ONI; break; case CHOICE_EX_ENDLESS: GAMESTATE->m_PlayMode = PLAY_MODE_ENDLESS; break; - case CHOICE_EX_BATTLE: GAMESTATE->m_PlayMode = PLAY_MODE_BATTLE; break; + //case CHOICE_EX_BATTLE: GAMESTATE->m_PlayMode = PLAY_MODE_BATTLE; break; default: ASSERT(0); // bad selection } @@ -259,7 +259,7 @@ bool ScreenSelectDifficultyEX::AnyPlayerIsOnCourse() { case CHOICE_EX_NONSTOP: case CHOICE_EX_ONI: - case CHOICE_EX_BATTLE: + //case CHOICE_EX_BATTLE: case CHOICE_EX_ENDLESS: return true; break; } } @@ -273,7 +273,7 @@ bool ScreenSelectDifficultyEX::PlayerIsOnCourse( PlayerNumber pl ) { case CHOICE_EX_NONSTOP: case CHOICE_EX_ONI: - case CHOICE_EX_BATTLE: + //case CHOICE_EX_BATTLE: case CHOICE_EX_ENDLESS: return true; break; } return false; diff --git a/stepmania/src/ScreenSelectDifficultyEX.h b/stepmania/src/ScreenSelectDifficultyEX.h index cafad51c84..339cff8c54 100644 --- a/stepmania/src/ScreenSelectDifficultyEX.h +++ b/stepmania/src/ScreenSelectDifficultyEX.h @@ -33,7 +33,7 @@ public: CHOICE_EX_NONSTOP, CHOICE_EX_ONI, CHOICE_EX_ENDLESS, - CHOICE_EX_BATTLE, + //CHOICE_EX_BATTLE, NUM_CHOICES_EX }; diff --git a/stepmania/src/ScreenSelectMaxType2.cpp b/stepmania/src/ScreenSelectMaxType2.cpp index 8655155881..0cc5eda1e6 100644 --- a/stepmania/src/ScreenSelectMaxType2.cpp +++ b/stepmania/src/ScreenSelectMaxType2.cpp @@ -329,9 +329,9 @@ void ScreenSelectMaxType2::MenuStart( PlayerNumber pn ) // check to see if everyone has chosen - for( p=0; pIsPlayerEnabled((PlayerNumber)p) && m_bChosen[p] == false ) + if( GAMESTATE->IsPlayerEnabled((PlayerNumber)pl) && m_bChosen[pl] == false ) return; } this->SendScreenMessage( SM_BeginFadingOut, SLEEP_AFTER_CHOICE_SECONDS ); // tell our owner it's time to move on diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index 25d9ffb661..b00b597c69 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -25,7 +25,6 @@ #include "GameManager.h" #include "PrefsManager.h" #include "StyleDef.h" -#include "Notes.h" #include "GameState.h" #include "FontCharAliases.h" #include "TitleSubstitution.h" @@ -37,6 +36,8 @@ #include "NotesWriterDWI.h" #include "NotesWriterSM.h" +#include "LyricsLoader.h" + #include "SDL.h" #include "SDL_image.h" @@ -76,6 +77,16 @@ void SortBackgroundChangesArray( vector &arrayBackgroundChange sort( arrayBackgroundChanges.begin(), arrayBackgroundChanges.end(), CompareBackgroundChanges ); } +static int CompareLyricSegments(const LyricSegment &seg1, const LyricSegment &seg2) +{ + return seg1.m_fStartTime < seg2.m_fStartTime; +} + +void SortLyricSegmentsArray( vector &arrayLyricSegments ) +{ + sort( arrayLyricSegments.begin(), arrayLyricSegments.end(), CompareLyricSegments ); +} + ////////////////////////////// // Song @@ -122,6 +133,14 @@ void Song::AddBackgroundChange( BackgroundChange seg ) SortBackgroundChangesArray( m_BackgroundChanges ); } + +void Song::AddLyricSegment( LyricSegment seg ) +{ + m_LyricSegments.push_back( seg ); + SortLyricSegmentsArray( m_LyricSegments ); +} + + float Song::GetMusicStartBeat() const { float fBPS = m_BPMSegments[0].m_fBPM / 60.0f; @@ -290,6 +309,16 @@ bool Song::LoadWithoutCache( CString sDir ) bool success = ld->LoadFromDir( sDir, *this ); delete ld; + LOG->Trace("\n\n\n SONG NAME:: %s", this->GetDisplayMainTitle().GetBuffer() ); + if( this->GetDisplayMainTitle().GetBuffer() == "Future Girls" ) + { + LOG->Trace("AAA"); + } + if( HasLyrics() ) + { + LOG->Trace("\n\n\n LOAD LYRICS HERE!! \n\n\n"); + } + if(!success) return false; @@ -490,6 +519,7 @@ void Song::TidyUpData() m_fMusicSampleStartSeconds = this->GetElapsedTimeFromBeat( (float)iBeat ); } } + /* Some DWIs have lengths in ms when they meant seconds, eg. #SAMPLELENGTH:10;. * If the sample length is way too short, change it. */ @@ -553,6 +583,26 @@ void Song::TidyUpData() } + + + LOG->Trace("Looking for lyrics.."); + //if( HasLyrics() ) + //{ + //Check if there is a lyric file in here + CStringArray arrayLyricFiles; + GetDirListing(m_sSongDir + CString("*.lrc"), arrayLyricFiles ); + if( !arrayLyricFiles.empty() ) + { + m_sLyricsFile = m_sSongDir+arrayLyricFiles[0]; + LyricsLoader ll; + ll.LoadFromLRCFile(m_sLyricsFile.GetBuffer(), *GAMESTATE->m_pCurSong); + } + //} + + + + + // // Now, For the images we still haven't found, look at the image dimensions of the remaining unclassified images. // @@ -1126,6 +1176,7 @@ bool Song::RouletteDisplayed() const bool Song::HasMusic() const {return m_sMusicFile != "" && IsAFile(GetMusicPath()); } bool Song::HasBanner() const {return m_sBannerFile != "" && IsAFile(GetBannerPath()); } +bool Song::HasLyrics() const {return m_sLyricsFile != "" && IsAFile(GetLyricsPath()); } bool Song::HasBackground() const {return m_sBackgroundFile != "" && IsAFile(GetBackgroundPath()); } bool Song::HasCDTitle() const {return m_sCDTitleFile != "" && IsAFile(GetCDTitlePath()); } bool Song::HasBGChanges() const {return !m_BackgroundChanges.empty(); } @@ -1189,6 +1240,12 @@ CString Song::GetBannerPath() const return m_sSongDir+m_sBannerFile; } +CString Song::GetLyricsPath() const +{ + LOG->Trace("\n\n\n TRYING TO GET LYRICS FROM:: %s", m_sSongDir+m_sBannerFile); + return m_sSongDir+m_sLyricsFile; +} + CString Song::GetCDTitlePath() const { if( m_sCDTitleFile.Find('/') == -1) diff --git a/stepmania/src/StepMania.dsp b/stepmania/src/StepMania.dsp index b4922fec31..d89fb6fb25 100644 --- a/stepmania/src/StepMania.dsp +++ b/stepmania/src/StepMania.dsp @@ -57,7 +57,7 @@ LINK32=link.exe # SUBTRACT LINK32 /verbose /pdb:none # Begin Special Build Tool IntDir=.\../Release6 -TargetDir=\stepmania\stepmania +TargetDir=\stepmania TargetName=StepMania SOURCE="$(InputPath)" PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ @@ -92,7 +92,7 @@ LINK32=link.exe # SUBTRACT LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib # Begin Special Build Tool IntDir=.\../Debug6 -TargetDir=\stepmania\stepmania +TargetDir=\stepmania TargetName=StepMania-debug SOURCE="$(InputPath)" PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ @@ -371,6 +371,14 @@ SOURCE=.\Inventory.h # End Source File # Begin Source File +SOURCE=.\LyricsLoader.cpp +# End Source File +# Begin Source File + +SOURCE=.\LyricsLoader.h +# End Source File +# Begin Source File + SOURCE=.\ModeChoice.h # End Source File # Begin Source File @@ -551,6 +559,14 @@ SOURCE=.\IniFile.h # End Source File # Begin Source File +SOURCE=.\LRCFile.cpp +# End Source File +# Begin Source File + +SOURCE=.\LRCFile.h +# End Source File +# Begin Source File + SOURCE=.\MsdFile.cpp # End Source File # Begin Source File diff --git a/stepmania/src/song.h b/stepmania/src/song.h index 5bb5de04b0..fe6b12baa5 100644 --- a/stepmania/src/song.h +++ b/stepmania/src/song.h @@ -17,6 +17,7 @@ struct Notes; class StyleDef; class NotesLoader; +class LyricsLoader; extern const int FILE_CACHE_VERSION; @@ -46,6 +47,15 @@ struct BackgroundChange CString m_sBGName; }; +struct LyricSegment +{ + LyricSegment() { m_fStartTime = -1; }; + LyricSegment( float a, CString m_sLyric, CString m_sStartTime ) { m_fStartTime = a, m_sLyric = m_sLyric, m_sStartTime = m_sStartTime; }; + float m_fStartTime; // For the sorting routine + CString m_sLyric; + CString m_sStartTime; +}; + class Song { @@ -131,11 +141,13 @@ public: float GetMusicStartBeat() const; CString m_sBannerFile; + CString m_sLyricsFile; CString m_sBackgroundFile; CString m_sCDTitleFile; CString GetMusicPath() const; CString GetBannerPath() const; + CString GetLyricsPath() const; CString GetBackgroundPath() const; CString GetCDTitlePath() const; @@ -146,14 +158,17 @@ public: bool HasCDTitle() const; bool HasMovieBackground() const; bool HasBGChanges() const; + bool HasLyrics() const; - vector m_BPMSegments; // this must be sorted before gameplay - vector m_StopSegments; // this must be sorted before gameplay - vector m_BackgroundChanges; // this must be sorted before gameplay + vector m_BPMSegments; // this must be sorted before gameplay + vector m_StopSegments; // this must be sorted before gameplay + vector m_BackgroundChanges; // this must be sorted before gameplay + vector m_LyricSegments; // same void AddBPMSegment( BPMSegment seg ); void AddStopSegment( StopSegment seg ); void AddBackgroundChange( BackgroundChange seg ); + void AddLyricSegment( LyricSegment seg ); void GetMinMaxBPM( float &fMinBPM, float &fMaxBPM ) const {