diff --git a/stepmania/NEWS b/stepmania/NEWS index ec19910971..c555ede93a 100644 --- a/stepmania/NEWS +++ b/stepmania/NEWS @@ -1,6 +1,7 @@ ------------------------CVS after 3.00 beta 6---------------- CHANGE: While AutoPlay is on, life, score, and dance points will not accumulate. +CHANGE: DWI save support added to editor. NEW FEATURE: Editor can edit BackgroundChanges. Use the 'B' key. NEW FEATURE: Delayed escape/back key is now optional. CHANGE: Slow-motion is now ~ instead of LShift. diff --git a/stepmania/Themes/default/metrics.ini b/stepmania/Themes/default/metrics.ini index ba15ced4b0..6e2ce36529 100644 --- a/stepmania/Themes/default/metrics.ini +++ b/stepmania/Themes/default/metrics.ini @@ -209,7 +209,9 @@ SurviveTimeX=320 SurviveTimeY=340 DebugX=320 DebugY=240 -SecondsBetweenComments=13 +AutoPlayX=320 +AutoPlayY=360 +SecondsBetweenComments=10 DemonstrationSeconds=30 [Evaluation] diff --git a/stepmania/src/ArrowEffects.cpp b/stepmania/src/ArrowEffects.cpp index aa3f2d5486..839806e33a 100644 --- a/stepmania/src/ArrowEffects.cpp +++ b/stepmania/src/ArrowEffects.cpp @@ -20,7 +20,7 @@ #include "NoteDisplay.h" -float ArrowGetYOffset2( const PlayerNumber pn, float fNoteBeat ) +float ArrowGetYOffset( const PlayerNumber pn, float fNoteBeat ) { float fSongBeat = GAMESTATE->m_fSongBeat; float fBeatsUntilStep = fNoteBeat - fSongBeat; diff --git a/stepmania/src/ArrowEffects.h b/stepmania/src/ArrowEffects.h index a8ab261cda..f9c7dfe16a 100644 --- a/stepmania/src/ArrowEffects.h +++ b/stepmania/src/ArrowEffects.h @@ -21,7 +21,7 @@ const float ARROW_GAP = ARROW_SIZE;// + 2; // fYOffset is a vertical position in pixels relative to the center. // (positive if has not yet been stepped on, negative if has already passed). // The ArrowEffect is applied in this stage. -float ArrowGetYOffset2( const PlayerNumber pn, float fNoteBeat ); +float ArrowGetYOffset( const PlayerNumber pn, float fNoteBeat ); // fRotation is Z rotation of an arrow. This will depend on the column of diff --git a/stepmania/src/Background.cpp b/stepmania/src/Background.cpp index d8df60c8d2..6843396e29 100644 --- a/stepmania/src/Background.cpp +++ b/stepmania/src/Background.cpp @@ -33,11 +33,11 @@ const int BACKGROUND_BOTTOM = 480; #define RECT_BACKGROUND CRect(BACKGROUND_LEFT,BACKGROUND_TOP,BACKGROUND_RIGHT,BACKGROUND_BOTTOM) -int CompareAnimSegs(const void *arg1, const void *arg2) +int CompareBGSegments(const void *arg1, const void *arg2) { // arg1 and arg2 are of type Step** - AnimSeg* seg1 = (AnimSeg*)arg1; - AnimSeg* seg2 = (AnimSeg*)arg2; + BGSegment* seg1 = (BGSegment*)arg1; + BGSegment* seg2 = (BGSegment*)arg2; float score1 = seg1->m_fStartBeat; float score2 = seg2->m_fStartBeat; @@ -50,15 +50,15 @@ int CompareAnimSegs(const void *arg1, const void *arg2) return 1; } -void SortAnimSegArray( CArray &arrayAnimSegs ) +void SortBGSegmentArray( CArray &arrayBGSegments ) { - qsort( arrayAnimSegs.GetData(), arrayAnimSegs.GetSize(), sizeof(AnimSeg), CompareAnimSegs ); + qsort( arrayBGSegments.GetData(), arrayBGSegments.GetSize(), sizeof(BGSegment), CompareBGSegments ); } Background::Background() { - m_iCurAnimSegment = 0; + m_iCurBGSegment = 0; m_bInDanger = false; m_BackgroundMode = MODE_STATIC_BG; @@ -123,155 +123,207 @@ void Background::LoadFromSong( Song* pSong ) // Load the static background that will before notes start and after notes end // BackgroundAnimation* pTempBGA; + pTempBGA = new BackgroundAnimation; pTempBGA->LoadFromStaticGraphic( pSong->HasBackground() ? pSong->GetBackgroundPath() : THEME->GetPathTo("Graphics","fallback background") ); m_BackgroundAnimations.Add( pTempBGA ); - // - // Load animations that will play while notes are active - // - switch( m_BackgroundMode ) + if( pSong->HasBGChanges() ) { - case MODE_STATIC_BG: - break; - case MODE_MOVIE_BG: + // start off showing the static song background + m_aBGSegments.Add( BGSegment(-10000,0) ); + + + // Load the animations used by the song's pre-defined animation plan. + // the song has a plan. Use it. + for( int i=0; im_BackgroundChanges.GetSize(); i++ ) { - pTempBGA = new BackgroundAnimation; - pTempBGA->LoadFromMovieBG( pSong->GetMovieBackgroundPath() ); - m_BackgroundAnimations.Add( pTempBGA ); - } - break; - case MODE_MOVIE_VIS: - { - CStringArray arrayPossibleMovies; - GetDirListing( VISUALIZATIONS_DIR + "*.avi", arrayPossibleMovies, false, true ); - GetDirListing( VISUALIZATIONS_DIR + "*.mpg", arrayPossibleMovies, false, true ); - GetDirListing( VISUALIZATIONS_DIR + "*.mpeg", arrayPossibleMovies, false, true ); - while( arrayPossibleMovies.GetSize() > 0 && m_BackgroundAnimations.GetSize() < 2 ) + const BackgroundChange& aniseg = pSong->m_BackgroundChanges[i]; + + // Using aniseg.m_sBGName, search for the corresponding animation. + // Look in this order: movies in song dir, BGAnims in song dir + // movies in RandomMovies dir, BGAnims in BGAnimsDir. + CStringArray asFiles; + + // Look for movies in the song dir + GetDirListing( pSong->m_sSongDir+"movies\\"+aniseg.m_sBGName+".avi", asFiles, false, true ); + GetDirListing( pSong->m_sSongDir+"movies\\"+aniseg.m_sBGName+".mpg", asFiles, false, true ); + GetDirListing( pSong->m_sSongDir+"movies\\"+aniseg.m_sBGName+".mpeg", asFiles, false, true ); + if( asFiles.GetSize() > 0 ) { - int index = rand() % arrayPossibleMovies.GetSize(); pTempBGA = new BackgroundAnimation; - pTempBGA->LoadFromVisualization( arrayPossibleMovies[index], pSong->HasBackground() ? pSong->GetBackgroundPath() : THEME->GetPathTo("Graphics","fallback background") ); + pTempBGA->LoadFromMovie( asFiles[0], true, true ); m_BackgroundAnimations.Add( pTempBGA ); - arrayPossibleMovies.RemoveAt( index ); - } - } - break; - case MODE_ANIMATIONS: - { - CStringArray arrayPossibleAnims; - GetDirListing( BG_ANIMS_DIR+"*.*", arrayPossibleAnims, true, true ); - while( arrayPossibleAnims.GetSize() > 0 && m_BackgroundAnimations.GetSize() < 5 ) + + m_aBGSegments.Add( BGSegment(aniseg.m_fStartBeat, m_BackgroundAnimations.GetSize()-1) ); // add to the plan + continue; // stop looking for this background + } + + // Look for BGAnims in the song dir + GetDirListing( pSong->m_sSongDir+aniseg.m_sBGName, asFiles, true, true ); + if( asFiles.GetSize() > 0 ) { - int index = rand() % arrayPossibleAnims.GetSize(); pTempBGA = new BackgroundAnimation; - pTempBGA->LoadFromAniDir( arrayPossibleAnims[index], pSong->HasBackground() ? pSong->GetBackgroundPath() : THEME->GetPathTo("Graphics","fallback background") ); + pTempBGA->LoadFromAniDir( asFiles[0], pSong->HasBackground() ? pSong->GetBackgroundPath() : THEME->GetPathTo("Graphics","fallback background") ); m_BackgroundAnimations.Add( pTempBGA ); - arrayPossibleAnims.RemoveAt( index ); + + m_aBGSegments.Add( BGSegment(aniseg.m_fStartBeat, m_BackgroundAnimations.GetSize()-1) ); // add to the plan + continue; // stop looking for this background + } + + // Look for movies in the RandomMovies dir + GetDirListing( RANDOMMOVIES_DIR+aniseg.m_sBGName+".avi", asFiles, false, true ); + GetDirListing( RANDOMMOVIES_DIR+aniseg.m_sBGName+".mpg", asFiles, false, true ); + GetDirListing( RANDOMMOVIES_DIR+aniseg.m_sBGName+".mpeg", asFiles, false, true ); + if( asFiles.GetSize() > 0 ) + { + pTempBGA = new BackgroundAnimation; + pTempBGA->LoadFromMovie( asFiles[0], true, false ); + m_BackgroundAnimations.Add( pTempBGA ); + + m_aBGSegments.Add( BGSegment(aniseg.m_fStartBeat, m_BackgroundAnimations.GetSize()-1) ); // add to the plan + continue; // stop looking for this background + } + + // Look for BGAnims in the BGAnims dir + GetDirListing( BG_ANIMS_DIR+aniseg.m_sBGName, asFiles, true, true ); + if( asFiles.GetSize() > 0 ) + { + pTempBGA = new BackgroundAnimation; + pTempBGA->LoadFromAniDir( asFiles[0], pSong->HasBackground() ? pSong->GetBackgroundPath() : THEME->GetPathTo("Graphics","fallback background") ); + m_BackgroundAnimations.Add( pTempBGA ); + + m_aBGSegments.Add( BGSegment(aniseg.m_fStartBeat, m_BackgroundAnimations.GetSize()-1) ); // add to the plan + continue; // stop looking for this background } } - break; - case MODE_RANDOMMOVIES: + + // end showing the static song background + m_aBGSegments.Add( BGSegment(pSong->m_fLastBeat,0) ); + + SortBGSegmentArray( m_aBGSegments ); // Need to sort in case the song has a background change after the last beat + } + else // pSong doesn't have an animation plan + { + // + // Load animations that will play while notes are active + // + switch( m_BackgroundMode ) { - CStringArray arrayPossibleMovies; - GetDirListing( RANDOMMOVIES_DIR + "*.avi", arrayPossibleMovies, false, true ); - GetDirListing( RANDOMMOVIES_DIR + "*.mpg", arrayPossibleMovies, false, true ); - GetDirListing( RANDOMMOVIES_DIR + "*.mpeg", arrayPossibleMovies, false, true ); - while( arrayPossibleMovies.GetSize() > 0 && m_BackgroundAnimations.GetSize() < 5 ) + case MODE_STATIC_BG: + break; + case MODE_MOVIE_BG: { - int index = rand() % arrayPossibleMovies.GetSize(); pTempBGA = new BackgroundAnimation; - pTempBGA->LoadFromRandomMovie( arrayPossibleMovies[index] ); + pTempBGA->LoadFromMovie( pSong->GetMovieBackgroundPath(), false, true ); m_BackgroundAnimations.Add( pTempBGA ); - arrayPossibleMovies.RemoveAt( index ); - } - } - break; - default: - ASSERT(0); - } - - // At this point, m_BackgroundAnimations[0] is the song background, and everything else - // in m_BackgroundAnimations should be cycled through randomly while notes are playing. - // - // Generate an animation plan - // - if( m_BackgroundMode == MODE_MOVIE_VIS ) - { - m_aAnimSegs.Add( AnimSeg(-10000,1) ); - return; - } - - // start off showing the static song background - m_aAnimSegs.Add( AnimSeg(-10000,0) ); - - // change BG every 4 bars - const float fFirstBeat = m_BackgroundMode==MODE_MOVIE_BG ? 0 : pSong->m_fFirstBeat; - const float fLastBeat = pSong->m_fLastBeat; - for( float f=fFirstBeat; fm_BPMSegments.GetSize(); i++ ) - { - const BPMSegment& bpmseg = pSong->m_BPMSegments[i]; - - if( bpmseg.m_fStartBeat < fFirstBeat || bpmseg.m_fStartBeat > fLastBeat ) - continue; // skip] - - int index; - if( m_BackgroundAnimations.GetSize()==1 ) - index = 0; - else - index = 1 + int(bpmseg.m_fBPM)%(m_BackgroundAnimations.GetSize()-1); - m_aAnimSegs.Add( AnimSeg(bpmseg.m_fStartBeat,index) ); - } - - // end showing the static song background - m_aAnimSegs.Add( AnimSeg(pSong->m_fLastBeat,0) ); - - // sort segments - SortAnimSegArray( m_aAnimSegs ); -// for( int i=0; im_AnimationSegments.GetSize() > 0 ) + } + break; + case MODE_MOVIE_VIS: { - // the song has a plan. Use it. - for( int i=0; im_AnimationSegments.GetSize(); i++ ) + CStringArray arrayPossibleMovies; + GetDirListing( VISUALIZATIONS_DIR + "*.avi", arrayPossibleMovies, false, true ); + GetDirListing( VISUALIZATIONS_DIR + "*.mpg", arrayPossibleMovies, false, true ); + GetDirListing( VISUALIZATIONS_DIR + "*.mpeg", arrayPossibleMovies, false, true ); + while( arrayPossibleMovies.GetSize() > 0 && m_BackgroundAnimations.GetSize() < 2 ) { - const AnimationSegment& aniseg = pSong->m_AnimationSegments[i]; - - int iIndex = -1; - for( int j=0; jLoadFromVisualization( arrayPossibleMovies[index], pSong->HasBackground() ? pSong->GetBackgroundPath() : THEME->GetPathTo("Graphics","fallback background") ); + m_BackgroundAnimations.Add( pTempBGA ); + arrayPossibleMovies.RemoveAt( index ); + } + } + break; + case MODE_ANIMATIONS: + { + CStringArray arrayPossibleAnims; + GetDirListing( BG_ANIMS_DIR+"*.*", arrayPossibleAnims, true, true ); + while( arrayPossibleAnims.GetSize() > 0 && m_BackgroundAnimations.GetSize() < 5 ) + { + int index = rand() % arrayPossibleAnims.GetSize(); + pTempBGA = new BackgroundAnimation; + pTempBGA->LoadFromAniDir( arrayPossibleAnims[index], pSong->HasBackground() ? pSong->GetBackgroundPath() : THEME->GetPathTo("Graphics","fallback background") ); + m_BackgroundAnimations.Add( pTempBGA ); + arrayPossibleAnims.RemoveAt( index ); } - SortAnimSegArray( m_aAnimSegs ); // this should already be sorted -*/ + } + break; + case MODE_RANDOMMOVIES: + { + CStringArray arrayPossibleMovies; + GetDirListing( RANDOMMOVIES_DIR + "*.avi", arrayPossibleMovies, false, true ); + GetDirListing( RANDOMMOVIES_DIR + "*.mpg", arrayPossibleMovies, false, true ); + GetDirListing( RANDOMMOVIES_DIR + "*.mpeg", arrayPossibleMovies, false, true ); + while( arrayPossibleMovies.GetSize() > 0 && m_BackgroundAnimations.GetSize() < 5 ) + { + int index = rand() % arrayPossibleMovies.GetSize(); + pTempBGA = new BackgroundAnimation; + pTempBGA->LoadFromMovie( arrayPossibleMovies[index], true, false ); + m_BackgroundAnimations.Add( pTempBGA ); + arrayPossibleMovies.RemoveAt( index ); + } + } + break; + default: + ASSERT(0); + } + + + // At this point, m_BackgroundAnimations[0] is the song background, and everything else + // in m_BackgroundAnimations should be cycled through randomly while notes are playing. + // + // Generate an animation plan + // + if( m_BackgroundMode == MODE_MOVIE_VIS ) + { + m_aBGSegments.Add( BGSegment(-10000,1) ); + return; + } + + // start off showing the static song background + m_aBGSegments.Add( BGSegment(-10000,0) ); + + // change BG every 4 bars + const float fFirstBeat = m_BackgroundMode==MODE_MOVIE_BG ? 0 : pSong->m_fFirstBeat; + const float fLastBeat = pSong->m_fLastBeat; + for( float f=fFirstBeat; fm_BPMSegments.GetSize(); i++ ) + { + const BPMSegment& bpmseg = pSong->m_BPMSegments[i]; + + if( bpmseg.m_fStartBeat < fFirstBeat || bpmseg.m_fStartBeat > fLastBeat ) + continue; // skip] + + int index; + if( m_BackgroundAnimations.GetSize()==1 ) + index = 0; + else + index = 1 + int(bpmseg.m_fBPM)%(m_BackgroundAnimations.GetSize()-1); + m_aBGSegments.Add( BGSegment(bpmseg.m_fStartBeat,index) ); + } + + // end showing the static song background + m_aBGSegments.Add( BGSegment(pSong->m_fLastBeat,0) ); + + // sort segments + SortBGSegmentArray( m_aBGSegments ); + + + } + + } @@ -289,17 +341,17 @@ void Background::Update( float fDeltaTime ) if( GAMESTATE->m_bFreeze ) return; - // Find the AnimSeg we're in - for( int i=0; im_fSongBeat < m_aAnimSegs[i+1].m_fStartBeat ) + // Find the BGSegment we're in + for( int i=0; im_fSongBeat < m_aBGSegments[i+1].m_fStartBeat ) break; - ASSERT( i >= 0 && i= 0 && i m_iCurAnimSegment ) + if( i > m_iCurBGSegment ) { -// printf( "%d, %d, %f, %f\n", m_iCurAnimSegment, i, m_aAnimSegs[i].m_fStartBeat, GAMESTATE->m_fSongBeat ); +// printf( "%d, %d, %f, %f\n", m_iCurBGSegment, i, m_aBGSegments[i].m_fStartBeat, GAMESTATE->m_fSongBeat ); GetCurBGA()->LosingFocus(); - m_iCurAnimSegment = i; + m_iCurBGSegment = i; GetCurBGA()->GainingFocus(); } diff --git a/stepmania/src/Background.h b/stepmania/src/Background.h index 4d44f7e972..2fd632aac0 100644 --- a/stepmania/src/Background.h +++ b/stepmania/src/Background.h @@ -19,12 +19,12 @@ #include "BackgroundAnimation.h" -struct AnimSeg +struct BGSegment // like a BGChange, but holds index of a background instead of name { - AnimSeg() {}; - AnimSeg( float b, int i ) { m_fStartBeat = b; m_iAnimationIndex = i; }; + BGSegment() {}; + BGSegment( float b, int i ) { m_fStartBeat = b; m_iBGIndex = i; }; float m_fStartBeat; - int m_iAnimationIndex; + int m_iBGIndex; }; @@ -61,9 +61,9 @@ protected: // used in all BackgroundModes except OFF CArray m_BackgroundAnimations; - CArray m_aAnimSegs; - int m_iCurAnimSegment; // this increases as we move into new segments - BackgroundAnimation* GetCurBGA() { int index = m_aAnimSegs[m_iCurAnimSegment].m_iAnimationIndex; return m_BackgroundAnimations[index]; }; + CArray m_aBGSegments; + int m_iCurBGSegment; // this increases as we move into new segments + BackgroundAnimation* GetCurBGA() { int index = m_aBGSegments[m_iCurBGSegment].m_iBGIndex; return m_BackgroundAnimations[index]; }; Quad m_quadBGBrightness; diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index 52d1389655..7dcde3a9cf 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -70,7 +70,6 @@ void GameState::Reset() m_fSecondsBeforeFail[p] = -1; m_iSongsBeforeFail[p] = 0; } - m_bUsedAutoPlayer = false; for( p=0; p m_apSongsPlayed; // an array of completed songs. // This is useful for the final evaluation screen, // and used to calculate the time into a course - bool m_bUsedAutoPlayer; // Used autoplayer at any time during any stage/course/song // Only used in final evaluation screen in play mode Arcade. // Before being displayed, these values should be normalized by dividing by number of stages diff --git a/stepmania/src/LifeMeter.h b/stepmania/src/LifeMeter.h index e70ae50662..5f296945dd 100644 --- a/stepmania/src/LifeMeter.h +++ b/stepmania/src/LifeMeter.h @@ -29,6 +29,7 @@ public: virtual void SongEnded() {}; virtual void ChangeLife( TapNoteScore score ) = 0; + virtual void ChangeLife( HoldNoteScore score ) = 0; virtual void OnDancePointsChange() = 0; // look in GAMESTATE and update the display virtual bool IsInDanger() = 0; virtual bool IsHot() = 0; diff --git a/stepmania/src/LifeMeterBar.cpp b/stepmania/src/LifeMeterBar.cpp index aca1d21966..0e4c7e7097 100644 --- a/stepmania/src/LifeMeterBar.cpp +++ b/stepmania/src/LifeMeterBar.cpp @@ -46,8 +46,8 @@ LifeMeterBar::LifeMeterBar() m_fDangerThreshold = DANGER_THRESHOLD; m_quadBlackBackground.SetDiffuseColor( D3DXCOLOR(0,0,0,1) ); - m_quadBlackBackground.SetZoomX( m_iMeterWidth ); - m_quadBlackBackground.SetZoomY( m_iMeterHeight ); + m_quadBlackBackground.SetZoomX( (float)m_iMeterWidth ); + m_quadBlackBackground.SetZoomY( (float)m_iMeterHeight ); m_frame.AddSubActor( &m_quadBlackBackground ); m_sprStreamNormal.Load( THEME->GetPathTo("Graphics","gameplay lifemeter stream normal") ); @@ -129,6 +129,11 @@ void LifeMeterBar::ChangeLife( TapNoteScore score ) ResetBarVelocity(); } +void LifeMeterBar::ChangeLife( HoldNoteScore score ) +{ + // do nothing +} + void LifeMeterBar::ResetBarVelocity() { // update bar animation diff --git a/stepmania/src/LifeMeterBar.h b/stepmania/src/LifeMeterBar.h index b4e3a44ad9..d23a7da33e 100644 --- a/stepmania/src/LifeMeterBar.h +++ b/stepmania/src/LifeMeterBar.h @@ -26,6 +26,7 @@ public: virtual void DrawPrimitives(); virtual void ChangeLife( TapNoteScore score ); + virtual void ChangeLife( HoldNoteScore score ); virtual void OnDancePointsChange() {}; // this life meter doesn't care virtual bool IsInDanger(); virtual bool IsHot(); diff --git a/stepmania/src/LifeMeterBattery.cpp b/stepmania/src/LifeMeterBattery.cpp index 35bf3ce1d4..7560701e1e 100644 --- a/stepmania/src/LifeMeterBattery.cpp +++ b/stepmania/src/LifeMeterBattery.cpp @@ -125,6 +125,11 @@ void LifeMeterBattery::ChangeLife( TapNoteScore score ) m_bFailedEarlier = true; } +void LifeMeterBattery::ChangeLife( HoldNoteScore score ) +{ + // do nothing +} + void LifeMeterBattery::OnDancePointsChange() { int iActualDancePoints = GAMESTATE->m_iActualDancePoints[m_PlayerNumber]; diff --git a/stepmania/src/LifeMeterBattery.h b/stepmania/src/LifeMeterBattery.h index 2bdf207f2f..954b17f0fd 100644 --- a/stepmania/src/LifeMeterBattery.h +++ b/stepmania/src/LifeMeterBattery.h @@ -28,6 +28,7 @@ public: virtual void SongEnded(); virtual void ChangeLife( TapNoteScore score ); + virtual void ChangeLife( HoldNoteScore score ); virtual void OnDancePointsChange(); // look in GAMESTATE and update the display virtual bool IsInDanger(); virtual bool IsHot(); diff --git a/stepmania/src/NoteData.cpp b/stepmania/src/NoteData.cpp index e337c283a7..baf50e4827 100644 --- a/stepmania/src/NoteData.cpp +++ b/stepmania/src/NoteData.cpp @@ -104,48 +104,21 @@ CString NoteData::GetSMNoteDataString() for( int m=0; m<=iLastMeasure; m++ ) // foreach measure { - int iMeasureStartIndex = m * ELEMENTS_PER_MEASURE; - int iMeasureLastIndex = (m+1) * ELEMENTS_PER_MEASURE - 1; - - // probe to find the smallest note type - NoteType nt; - int iNoteIndexSpacing; - for( nt=(NoteType)0; nt= NOTE_12TH ) + if( !IsRowEmpty(r) && GetNoteType(r) >= NOTE_TYPE_12TH ) iNumChaosNotes++; } @@ -804,3 +777,39 @@ void NoteData::LoadTransformed( const NoteData* pOriginal, int iNewNumTracks, co } +NoteType NoteData::GetSmallestNoteTypeForMeasure( int iMeasureIndex ) +{ + const int iMeasureStartIndex = iMeasureIndex * ROWS_PER_MEASURE; + const int iMeasureLastIndex = (iMeasureIndex+1) * ROWS_PER_MEASURE - 1; + + // probe to find the smallest note type + NoteType nt; + for( nt=(NoteType)0; nt= NOTE_12TH ) + if( !IsRowEmpty(r) && IsRowComplete(r) && GetNoteType(r) >= NOTE_TYPE_12TH ) iNumChaosNotesCompleted++; } diff --git a/stepmania/src/NoteDisplay.cpp b/stepmania/src/NoteDisplay.cpp index 532b8856ea..091e971af4 100644 --- a/stepmania/src/NoteDisplay.cpp +++ b/stepmania/src/NoteDisplay.cpp @@ -498,9 +498,9 @@ void NoteDisplay::DrawList( int iCount, NoteDisplayInstance cni[], bool bDrawAdd void NoteDisplay::DrawHold( const HoldNote& hn, const bool bActive, const float fLife, const float fPercentFadeToFail ) { const int iCol = hn.m_iTrack; - const float fStartYOffset = ArrowGetYOffset2( m_PlayerNumber, hn.m_fStartBeat ); + const float fStartYOffset = ArrowGetYOffset( m_PlayerNumber, hn.m_fStartBeat ); const float fStartYPos = ArrowGetYPos( m_PlayerNumber, fStartYOffset ); - const float fEndYOffset = ArrowGetYOffset2( m_PlayerNumber, hn.m_fEndBeat ); + const float fEndYOffset = ArrowGetYOffset( m_PlayerNumber, hn.m_fEndBeat ); const float fEndYPos = ArrowGetYPos( m_PlayerNumber, fEndYOffset ); // draw from bottom to top @@ -624,7 +624,7 @@ void NoteDisplay::DrawHold( const HoldNote& hn, const bool bActive, const float void NoteDisplay::DrawTap( const int iCol, const float fBeat, const bool bUseHoldColor, const float fPercentFadeToFail ) { - const float fYOffset = ArrowGetYOffset2( m_PlayerNumber, fBeat ); + const float fYOffset = ArrowGetYOffset( m_PlayerNumber, fBeat ); const float fYPos = ArrowGetYPos( m_PlayerNumber, fYOffset ); const float fRotation = ArrowGetRotation( m_PlayerNumber, iCol, fYOffset ); const float fXPos = ArrowGetXPos2( m_PlayerNumber, iCol, fYPos ); diff --git a/stepmania/src/NoteField.cpp b/stepmania/src/NoteField.cpp index bead96c335..b614608367 100644 --- a/stepmania/src/NoteField.cpp +++ b/stepmania/src/NoteField.cpp @@ -23,7 +23,7 @@ const float HOLD_NOTE_BITS_PER_BEAT = 6; -const float HOLD_NOTE_BITS_PER_ROW = HOLD_NOTE_BITS_PER_BEAT / ELEMENTS_PER_BEAT; +const float HOLD_NOTE_BITS_PER_ROW = HOLD_NOTE_BITS_PER_BEAT / ROWS_PER_BEAT; const float ROWS_BETWEEN_HOLD_BITS = 1 / HOLD_NOTE_BITS_PER_ROW; NoteField::NoteField() @@ -120,7 +120,7 @@ void NoteField::DrawMeasureBar( int iMeasureIndex ) const int iMeasureNoDisplay = iMeasureIndex+1; const float fBeat = float(iMeasureIndex * BEATS_PER_MEASURE); - const float fYOffset = ArrowGetYOffset2( m_PlayerNumber, fBeat ); + const float fYOffset = ArrowGetYOffset( m_PlayerNumber, fBeat ); const float fYPos = ArrowGetYPos( m_PlayerNumber, fYOffset ); m_rectMeasureBar.SetXY( 0, fYPos ); @@ -138,7 +138,7 @@ void NoteField::DrawMeasureBar( int iMeasureIndex ) void NoteField::DrawMarkerBar( const float fBeat ) { - const float fYOffset = ArrowGetYOffset2( m_PlayerNumber, fBeat ); + const float fYOffset = ArrowGetYOffset( m_PlayerNumber, fBeat ); const float fYPos = ArrowGetYPos( m_PlayerNumber, fYOffset ); m_rectMarkerBar.SetXY( 0, fYPos ); @@ -150,7 +150,7 @@ void NoteField::DrawMarkerBar( const float fBeat ) void NoteField::DrawBPMText( const float fBeat, const float fBPM ) { - const float fYOffset = ArrowGetYOffset2( m_PlayerNumber, fBeat ); + const float fYOffset = ArrowGetYOffset( m_PlayerNumber, fBeat ); const float fYPos = ArrowGetYPos( m_PlayerNumber, fYOffset ); m_textMeasureNumber.SetDiffuseColor( D3DXCOLOR(1,0,0,1) ); @@ -162,7 +162,7 @@ void NoteField::DrawBPMText( const float fBeat, const float fBPM ) void NoteField::DrawFreezeText( const float fBeat, const float fSecs ) { - const float fYOffset = ArrowGetYOffset2( m_PlayerNumber, fBeat ); + const float fYOffset = ArrowGetYOffset( m_PlayerNumber, fBeat ); const float fYPos = ArrowGetYPos( m_PlayerNumber, fYOffset ); m_textMeasureNumber.SetDiffuseColor( D3DXCOLOR(0.8f,0.8f,0,1) ); @@ -172,6 +172,18 @@ void NoteField::DrawFreezeText( const float fBeat, const float fSecs ) m_textMeasureNumber.Draw(); } +void NoteField::DrawBGChangeText( const float fBeat, const CString sNewBGName ) +{ + const float fYOffset = ArrowGetYOffset( m_PlayerNumber, fBeat ); + const float fYPos = ArrowGetYPos( m_PlayerNumber, fYOffset ); + + m_textMeasureNumber.SetDiffuseColor( D3DXCOLOR(0,1,0,1) ); + m_textMeasureNumber.SetGlowColor( D3DXCOLOR(1,1,1,cosf(TIMER->GetTimeSinceStart()*2)/2+0.5f) ); + m_textMeasureNumber.SetText( sNewBGName ); + m_textMeasureNumber.SetXY( +m_rectMeasureBar.GetZoomedWidth()/2 + 10, fYPos ); + m_textMeasureNumber.Draw(); +} + void NoteField::DrawPrimitives() { //LOG->Trace( "NoteField::DrawPrimitives()" ); @@ -213,6 +225,13 @@ void NoteField::DrawPrimitives() for( i=0; i &aBackgroundChanges = GAMESTATE->m_pCurSong->m_BackgroundChanges; + for( i=0; i 0, then it was completed and don't draw it! -// if( hn.m_iEndIndex < BeatToNoteRow(fSongBeat) && fLife > 0 && m_bIsHoldingHoldNote[i] ) -// continue; // skip - - /* - // parts of the hold - const float fStartDrawingAtBeat = froundf( (float)hn.m_iStartIndex, ROWS_BETWEEN_HOLD_BITS/GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_fArrowScrollSpeed ); - for( float j=fStartDrawingAtBeat; - j<=hn.m_iEndIndex; - j+=ROWS_BETWEEN_HOLD_BITS/GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_fArrowScrollSpeed ) // for each bit of the hold - { - // check if this arrow is off the the screen - if( j < iIndexFirstArrowToDraw || iIndexLastArrowToDraw < j) - continue; // skip this arrow - - if( bActive && NoteRowToBeat(j) < fSongBeat ) - continue; - - CreateHoldNoteInstance( instances[iCount++], bActive, (float)j, hn, fHoldNoteLife ); - } - */ - } -// const bool bDrawAddPass = GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_AppearanceType != PlayerOptions::APPEARANCE_VISIBLE; -// if( iCount > 0 ) -// m_ColorNote[c].DrawList( iCount, instances, bDrawAddPass ); - - - -// iCount = 0; // reset count /////////////////////////////////// // Draw all TapNotes in this column @@ -330,8 +302,6 @@ void NoteField::DrawPrimitives() } } - - m_NoteDisplay[c].DrawTap( c, NoteRowToBeat(i), bHoldNoteBeginsOnThisBeat, m_fPercentFadeToFail ); } } @@ -339,8 +309,6 @@ void NoteField::DrawPrimitives() } - - void NoteField::RemoveTapNoteRow( int iIndex ) { for( int c=0; cTrace( "Notes::WriteDWINotesTag" ); + switch( m_NotesType ) { case NOTES_TYPE_DANCE_SINGLE: fprintf( fp, "#SINGLE:" ); break; @@ -679,33 +681,86 @@ void Notes::WriteDWINotesTag( FILE* fp ) this->GetNoteData( ¬edata ); notedata.ConvertHoldNotesTo2sAnd3s(); - fprintf( fp, "<" ); // begin a 48th note series - for( int r=0; r" ); + break; + } + fprintf( fp, "\n" ); } } - fprintf( fp, "<" ); // end a 48th note series - if( m_NotesType == NOTES_TYPE_DANCE_COUPLE || m_NotesType == NOTES_TYPE_DANCE_DOUBLE ) - { - fprintf( fp, ":" ); - fprintf( fp, "<" ); // begin a 48th note series - for( int r=0; r" ); // end series + fprintf( fp, ";\n" ); } void Notes::SetNoteData( NoteData* pNewNoteData ) diff --git a/stepmania/src/Player.cpp b/stepmania/src/Player.cpp index 59db1c53b9..d2c9b8361f 100644 --- a/stepmania/src/Player.cpp +++ b/stepmania/src/Player.cpp @@ -417,8 +417,6 @@ void Player::OnRowDestroyed( int col, int iIndexThatWasSteppedOn ) // update the judgement, score, and life m_Judgement.SetJudgement( score ); - if( m_pLifeMeter ) - m_pLifeMeter->ChangeLife( score ); // zoom the judgement and combo like a heart beat float fStartZoom; @@ -463,9 +461,6 @@ int Player::UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat ) bFoundAMissInThisRow = true; HandleNoteScore( TNS_MISS ); } - if( bFoundAMissInThisRow ) - if( m_pLifeMeter ) - m_pLifeMeter->ChangeLife( TNS_MISS ); } } @@ -496,9 +491,15 @@ void Player::CrossedRow( int iNoteRow ) void Player::HandleNoteScore( TapNoteScore score ) { + // don't accumulate points if AutoPlay is on. + if( PREFSMAN->m_bAutoPlay && !GAMESTATE->m_bDemonstration ) + return; + // update dance points for Oni lifemeter GAMESTATE->m_iActualDancePoints[m_PlayerNumber] += TapNoteScoreToDancePoints( score ); GAMESTATE->m_TapNoteScores[m_PlayerNumber][score]++; + if( m_pLifeMeter ) + m_pLifeMeter->ChangeLife( score ); if( m_pLifeMeter ) m_pLifeMeter->OnDancePointsChange(); @@ -566,11 +567,18 @@ void Player::HandleNoteScore( TapNoteScore score ) void Player::HandleNoteScore( HoldNoteScore score ) { + // don't accumulate points if AutoPlay is on. + if( PREFSMAN->m_bAutoPlay && !GAMESTATE->m_bDemonstration ) + return; + // update dance points for Oni lifemeter GAMESTATE->m_iActualDancePoints[m_PlayerNumber] += HoldNoteScoreToDancePoints( score ); GAMESTATE->m_HoldNoteScores[m_PlayerNumber][score]++; + if( m_pLifeMeter ) - m_pLifeMeter->OnDancePointsChange(); + m_pLifeMeter->ChangeLife( score ); + if( m_pLifeMeter ) + m_pLifeMeter->OnDancePointsChange(); // HoldNoteScores don't effect m_fScore } diff --git a/stepmania/src/RageInput.cpp b/stepmania/src/RageInput.cpp index f7e20f0d0b..94ef51eae4 100644 --- a/stepmania/src/RageInput.cpp +++ b/stepmania/src/RageInput.cpp @@ -267,9 +267,84 @@ bool DeviceInput::fromString( const CString &s ) device = (InputDevice)atoi( a[0] ); button = atoi( a[1] ); return true; -}; - +} +char DeviceInput::ToChar() const +{ + switch( device ) + { + case DEVICE_KEYBOARD: + switch( button ) + { + case DIK_1: return '1'; + case DIK_2: return '2'; + case DIK_3: return '3'; + case DIK_4: return '4'; + case DIK_5: return '5'; + case DIK_6: return '6'; + case DIK_7: return '7'; + case DIK_8: return '8'; + case DIK_9: return '9'; + case DIK_0: return '0'; + case DIK_MINUS: return '-'; + case DIK_EQUALS: return '='; + case DIK_Q: return 'Q'; + case DIK_W: return 'W'; + case DIK_E: return 'E'; + case DIK_R: return 'R'; + case DIK_T: return 'T'; + case DIK_Y: return 'Y'; + case DIK_U: return 'U'; + case DIK_I: return 'I'; + case DIK_O: return 'O'; + case DIK_P: return 'P'; + case DIK_LBRACKET: return '['; + case DIK_RBRACKET: return ']'; + case DIK_A: return 'A'; + case DIK_S: return 'S'; + case DIK_D: return 'D'; + case DIK_F: return 'F'; + case DIK_G: return 'G'; + case DIK_H: return 'H'; + case DIK_J: return 'J'; + case DIK_K: return 'K'; + case DIK_L: return 'L'; + case DIK_SEMICOLON: return ';'; + case DIK_APOSTROPHE:return '\''; + case DIK_BACKSLASH: return '\\'; + case DIK_Z: return 'Z'; + case DIK_X: return 'X'; + case DIK_C: return 'C'; + case DIK_V: return 'V'; + case DIK_B: return 'B'; + case DIK_N: return 'N'; + case DIK_M: return 'M'; + case DIK_COMMA: return ','; + case DIK_PERIOD: return '.'; + case DIK_SLASH: return '/'; + case DIK_MULTIPLY: return '*'; + case DIK_SPACE: return ' '; + case DIK_NUMPAD7: return '7'; + case DIK_NUMPAD8: return '8'; + case DIK_NUMPAD9: return '9'; + case DIK_SUBTRACT: return '-'; + case DIK_NUMPAD4: return '4'; + case DIK_NUMPAD5: return '5'; + case DIK_NUMPAD6: return '6'; + case DIK_ADD: return '+'; + case DIK_NUMPAD1: return '1'; + case DIK_NUMPAD2: return '2'; + case DIK_NUMPAD3: return '3'; + case DIK_NUMPAD0: return '0'; + case DIK_DECIMAL: return '.'; + default: + return '\0'; + } + break; + default: + return '\0'; + } +} //----------------------------------------------------------------------------- diff --git a/stepmania/src/RageInput.h b/stepmania/src/RageInput.h index 10f8a830fa..bfa422fd8e 100644 --- a/stepmania/src/RageInput.h +++ b/stepmania/src/RageInput.h @@ -94,6 +94,8 @@ public: bool IsValid() const { return device != DEVICE_NONE; }; void MakeInvalid() { device = DEVICE_NONE; }; + char ToChar() const; + static int NumButtons(InputDevice device); }; diff --git a/stepmania/src/ScreenEdit.cpp b/stepmania/src/ScreenEdit.cpp index 2fd69b9069..53b82a571b 100644 --- a/stepmania/src/ScreenEdit.cpp +++ b/stepmania/src/ScreenEdit.cpp @@ -23,6 +23,7 @@ #include "GameConstantsAndTypes.h" #include "RageLog.h" #include "GameState.h" +#include "ScreenTextEntry.h" // @@ -38,8 +39,8 @@ const float DEBUG_Y = CENTER_Y-100; const float HELP_X = SCREEN_LEFT + 10; const float HELP_Y = SCREEN_BOTTOM - 10; -const float SHORTCUTS_X = SCREEN_LEFT + 10; -const float SHORTCUTS_Y = SCREEN_TOP + 8; +const float SHORTCUTS_X = CENTER_X - 150; +const float SHORTCUTS_Y = CENTER_Y; const float INFO_X = SCREEN_RIGHT - 10 ; const float INFO_Y = SCREEN_BOTTOM - 10; @@ -53,11 +54,11 @@ const float PLAYER_Y = SCREEN_TOP; const float MENU_ITEM_X = CENTER_X-200; const float MENU_ITEM_START_Y = SCREEN_TOP + 30; -const float MENU_ITEM_SPACING_Y = 24; +const float MENU_ITEM_SPACING_Y = 20; const CString HELP_TEXT = "Esc: show menu\n" - "Hold F1 to show keyboard shortcuts\n" + "Hold F1 to show more commands\n" "Up/Down: change beat\n" "Left/Right: change snap\n" "PgUp/PgDn: jump 1 measure\n" @@ -68,7 +69,7 @@ const CString HELP_TEXT = const CString SHORTCUT_TEXT = "S: save changes\n" - "I: save as SM and DWI (lossy)\n" + "W: save as SM and DWI (lossy)\n" "Enter/Space: set begin/end selection markers\n" "G/H/J/K/L: Snap selection to nearest\n" " 4th / 8th / 12th / 16th / 12th or 16th\n" @@ -92,11 +93,6 @@ const CString SHORTCUT_TEXT = const CString MENU_ITEM_TEXT[NUM_MENU_ITEMS] = { "Set begin marker (Enter)", "Set end marker (Space)", - "Snap selection to nearest quarter note (G)", - "Snap selection to nearest eighth note (H)", - "Snap selection to nearest triplet (J)", - "Snap selection to nearest sixteenth note (K)", - "Snap selection to nearest triplet or sixteenth note (L)", "(P)lay selection", "(R)ecord in selection", "(T)oggle Play/Record rate", @@ -104,20 +100,22 @@ const CString MENU_ITEM_TEXT[NUM_MENU_ITEMS] = { "Copy selection (C)", "Paste clipboard at current beat (V)", "Toggle (D)ifficulty", + "Add (B)ackground change", "(Ins)ert blank beat and shift down", "(Del)ete blank beat and shift up", + "Snap selection to nearest quarter note (G)", + "Snap selection to nearest eighth note (H)", + "Snap selection to nearest triplet (J)", + "Snap selection to nearest sixteenth note (K)", + "Snap selection to nearest triplet or sixteenth note (L)", "Play sample (M)usic", "(S)ave changes", + "Save as D(W)I and SM (lossy)", "(Q)uit" }; int MENU_ITEM_KEY[NUM_MENU_ITEMS] = { DIK_RETURN, DIK_SPACE, - DIK_G, - DIK_H, - DIK_J, - DIK_K, - DIK_L, DIK_P, DIK_R, DIK_T, @@ -125,10 +123,17 @@ int MENU_ITEM_KEY[NUM_MENU_ITEMS] = { DIK_C, DIK_V, DIK_D, + DIK_B, DIK_INSERT, DIK_DELETE, + DIK_G, + DIK_H, + DIK_J, + DIK_K, + DIK_L, DIK_M, DIK_S, + DIK_W, DIK_Q, }; @@ -241,10 +246,13 @@ ScreenEdit::ScreenEdit() m_textHelp.SetShadowLength( 2 ); m_textHelp.SetText( HELP_TEXT ); + m_rectShortcutsBack.StretchTo( CRect(SCREEN_LEFT, SCREEN_TOP, SCREEN_RIGHT, SCREEN_BOTTOM) ); + m_rectShortcutsBack.SetDiffuseColor( D3DXCOLOR(0,0,0,0.5f) ); + m_textShortcuts.LoadFromFont( THEME->GetPathTo("Fonts","normal") ); m_textShortcuts.SetXY( SHORTCUTS_X, SHORTCUTS_Y ); m_textShortcuts.SetHorizAlign( Actor::align_left ); - m_textShortcuts.SetVertAlign( Actor::align_top ); + m_textShortcuts.SetVertAlign( Actor::align_middle ); m_textShortcuts.SetZoom( 0.5f ); m_textShortcuts.SetShadowLength( 2 ); m_textShortcuts.SetText( SHORTCUT_TEXT ); @@ -325,6 +333,7 @@ void ScreenEdit::Update( float fDeltaTime ) m_Fade.Update( fDeltaTime ); m_textHelp.Update( fDeltaTime ); m_textInfo.Update( fDeltaTime ); + m_rectShortcutsBack.Update( fDeltaTime ); m_textShortcuts.Update( fDeltaTime ); m_rectRecordBack.Update( fDeltaTime ); @@ -385,11 +394,11 @@ void ScreenEdit::Update( float fDeltaTime ) CString sNoteType; switch( m_SnapDisplay.GetSnapMode() ) { - case NOTE_4TH: sNoteType = "quarter notes"; break; - case NOTE_8TH: sNoteType = "eighth notes"; break; - case NOTE_12TH: sNoteType = "triplets"; break; - case NOTE_16TH: sNoteType = "sixteenth notes"; break; - default: ASSERT( false ); + case NOTE_TYPE_4TH: sNoteType = "quarter notes"; break; + case NOTE_TYPE_8TH: sNoteType = "eighth notes"; break; + case NOTE_TYPE_12TH: sNoteType = "triplets"; break; + case NOTE_TYPE_16TH: sNoteType = "sixteenth notes"; break; + default: ASSERT(0); } static int iNumTapNotes = 0, iNumHoldNotes = 0; @@ -437,11 +446,14 @@ void ScreenEdit::DrawPrimitives() m_NoteFieldEdit.Draw(); GAMESTATE->m_fSongBeat = fSongBeat; // restore real song beat - if( INPUTMAN->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD,DIK_F1) ) ) - m_textShortcuts.Draw(); m_textHelp.Draw(); m_textInfo.Draw(); m_Fade.Draw(); + if( INPUTMAN->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD,DIK_F1) ) ) + { + m_rectShortcutsBack.Draw(); + m_textShortcuts.Draw(); + } m_rectRecordBack.Draw(); @@ -562,6 +574,7 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ SCREENMAN->SetNewScreen( new ScreenEditMenu ); break; case DIK_S: + case DIK_W: { // copy edit into current Notes Song* pSong = GAMESTATE->m_pCurSong; @@ -578,7 +591,19 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ } pNotes->SetNoteData( (NoteData*)&m_NoteFieldEdit ); - GAMESTATE->m_pCurSong->SaveToSMFile(); + switch( DeviceI.button ) + { + case DIK_S: + GAMESTATE->m_pCurSong->SaveToSMFile(); + SCREENMAN->SystemMessage( "Saved as SM." ); + break; + case DIK_W: + GAMESTATE->m_pCurSong->SaveToSMAndDWIFile(); + SCREENMAN->SystemMessage( "Saved as SM and DWI." ); + break; + default: + ASSERT(0); + } SOUND->PlayOnceStreamed( THEME->GetPathTo("Sounds","edit save") ); } break; @@ -709,11 +734,11 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ NoteType noteType2; switch( DeviceI.button ) { - case DIK_G: noteType1 = NOTE_4TH; noteType2 = NOTE_4TH; break; - case DIK_H: noteType1 = NOTE_8TH; noteType2 = NOTE_8TH; break; - case DIK_J: noteType1 = NOTE_12TH; noteType2 = NOTE_12TH; break; - case DIK_K: noteType1 = NOTE_16TH; noteType2 = NOTE_16TH; break; - case DIK_L: noteType1 = NOTE_12TH; noteType2 = NOTE_16TH; break; + case DIK_G: noteType1 = NOTE_TYPE_4TH; noteType2 = NOTE_TYPE_4TH; break; + case DIK_H: noteType1 = NOTE_TYPE_8TH; noteType2 = NOTE_TYPE_8TH; break; + case DIK_J: noteType1 = NOTE_TYPE_12TH; noteType2 = NOTE_TYPE_12TH; break; + case DIK_K: noteType1 = NOTE_TYPE_16TH; noteType2 = NOTE_TYPE_16TH; break; + case DIK_L: noteType1 = NOTE_TYPE_12TH; noteType2 = NOTE_TYPE_16TH; break; default: ASSERT( false ); } @@ -857,6 +882,21 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ } break; + case DIK_B: + { + CString sOldBackground; + for( int i=0; im_BackgroundChanges.GetSize(); i++ ) + { + if( m_pSong->m_BackgroundChanges[i].m_fStartBeat == GAMESTATE->m_fSongBeat ) + break; + } + if( i != m_pSong->m_BackgroundChanges.GetSize() ) // there is already a BGChange here + sOldBackground = m_pSong->m_BackgroundChanges[i].m_sBGName; + + SCREENMAN->AddScreenToTop( new ScreenTextEntry(SM_None, "Type a background name.\nPress Enter to keep,\nEscape to cancel.\nEnter an empty string to remove\nthe Background Change.", sOldBackground, AddBGChange, NULL) ); + } + break; + case DIK_F7: case DIK_F8: { @@ -896,17 +936,17 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ case DIK_F9: case DIK_F10: { - float fFreezeDelta; + float fStopDelta; switch( DeviceI.button ) { - case DIK_F9: fFreezeDelta = -0.020f; break; - case DIK_F10: fFreezeDelta = +0.020f; break; + case DIK_F9: fStopDelta = -0.020f; break; + case DIK_F10: fStopDelta = +0.020f; break; default: ASSERT(0); } switch( type ) { - case IET_SLOW_REPEAT: fFreezeDelta *= 10; break; - case IET_FAST_REPEAT: fFreezeDelta *= 40; break; + case IET_SLOW_REPEAT: fStopDelta *= 10; break; + case IET_FAST_REPEAT: fStopDelta *= 40; break; } for( int i=0; im_StopSegments.GetSize(); i++ ) @@ -918,12 +958,12 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ if( i == m_pSong->m_StopSegments.GetSize() ) // there is no BPMSegment at the current beat { // create a new StopSegment - if( fFreezeDelta > 0 ) - m_pSong->AddStopSegment( StopSegment(GAMESTATE->m_fSongBeat, fFreezeDelta) ); + if( fStopDelta > 0 ) + m_pSong->AddStopSegment( StopSegment(GAMESTATE->m_fSongBeat, fStopDelta) ); } else // StopSegment being modified is m_StopSegments[i] { - m_pSong->m_StopSegments[i].m_fStopSeconds += fFreezeDelta; + m_pSong->m_StopSegments[i].m_fStopSeconds += fStopDelta; if( m_pSong->m_StopSegments[i].m_fStopSeconds <= 0 ) m_pSong->m_StopSegments.RemoveAt( i ); } @@ -982,6 +1022,24 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ } } +void ScreenEdit::AddBGChange( CString sBGName ) +{ + Song* pSong = GAMESTATE->m_pCurSong; + + for( int i=0; im_BackgroundChanges.GetSize(); i++ ) + { + if( pSong->m_BackgroundChanges[i].m_fStartBeat == GAMESTATE->m_fSongBeat ) + break; + } + + if( i != pSong->m_BackgroundChanges.GetSize() ) // there is already a BGChange here + pSong->m_BackgroundChanges.RemoveAt( i ); + + // create a new BGChange + if( sBGName != "" ) + pSong->AddBackgroundChange( BackgroundChange(GAMESTATE->m_fSongBeat, sBGName) ); +} + void ScreenEdit::InputRecord( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ) { if(type == IET_RELEASE) return; // don't care @@ -1010,7 +1068,7 @@ void ScreenEdit::InputRecord( const DeviceInput& DeviceI, const InputEventType t if( type == IET_FIRST_PRESS ) { m_NoteFieldRecord.m_TapNotes[iCol][iNoteIndex] = '1'; - m_NoteFieldRecord.SnapToNearestNoteType( NOTE_12TH, NOTE_16TH, max(0,GAMESTATE->m_fSongBeat-1), GAMESTATE->m_fSongBeat+1); + m_NoteFieldRecord.SnapToNearestNoteType( NOTE_TYPE_12TH, NOTE_TYPE_16TH, max(0,GAMESTATE->m_fSongBeat-1), GAMESTATE->m_fSongBeat+1); m_GrayArrowRowRecord.Step( iCol ); } else @@ -1030,7 +1088,7 @@ void ScreenEdit::InputRecord( const DeviceInput& DeviceI, const InputEventType t newHN.m_fEndBeat = fEndBeat; m_NoteFieldRecord.AddHoldNote( newHN ); - m_NoteFieldRecord.SnapToNearestNoteType( NOTE_12TH, NOTE_16TH, max(0,GAMESTATE->m_fSongBeat-2), GAMESTATE->m_fSongBeat+2); + m_NoteFieldRecord.SnapToNearestNoteType( NOTE_TYPE_12TH, NOTE_TYPE_16TH, max(0,GAMESTATE->m_fSongBeat-2), GAMESTATE->m_fSongBeat+2); } break; } diff --git a/stepmania/src/ScreenEdit.h b/stepmania/src/ScreenEdit.h index ef5af67ea7..0f4f24738c 100644 --- a/stepmania/src/ScreenEdit.h +++ b/stepmania/src/ScreenEdit.h @@ -22,7 +22,7 @@ #include "SnapDisplay.h" -const int NUM_MENU_ITEMS = 19; +const int NUM_MENU_ITEMS = 21; class ScreenEdit : public Screen @@ -46,6 +46,8 @@ protected: void MenuItemGainFocus( int iItemIndex ); void MenuItemLoseFocus( int iItemIndex ); + static void AddBGChange( CString sBGName ); + enum EditMode { MODE_EDITING, MODE_MENU, MODE_RECORDING, MODE_PLAYING }; EditMode m_EditMode; @@ -60,6 +62,7 @@ protected: BitmapText m_textInfo; // status information that changes BitmapText m_textHelp; + Quad m_rectShortcutsBack; BitmapText m_textShortcuts; // keep track of where we are and what we're doing diff --git a/stepmania/src/ScreenEditMenu.cpp b/stepmania/src/ScreenEditMenu.cpp index 4dff108897..410e3f5012 100644 --- a/stepmania/src/ScreenEditMenu.cpp +++ b/stepmania/src/ScreenEditMenu.cpp @@ -112,12 +112,12 @@ void ScreenEditMenu::MenuDown( const PlayerNumber p ) Selector.Down(); } -void ScreenEditMenu::MenuLeft( const PlayerNumber p ) +void ScreenEditMenu::MenuLeft( const PlayerNumber p, const InputEventType type ) { Selector.Left(); } -void ScreenEditMenu::MenuRight( const PlayerNumber p ) +void ScreenEditMenu::MenuRight( const PlayerNumber p, const InputEventType type ) { Selector.Right(); } diff --git a/stepmania/src/ScreenEditMenu.h b/stepmania/src/ScreenEditMenu.h index c7766e8bc5..e26d84743a 100644 --- a/stepmania/src/ScreenEditMenu.h +++ b/stepmania/src/ScreenEditMenu.h @@ -28,8 +28,8 @@ private: void MenuUp( const PlayerNumber p ); void MenuDown( const PlayerNumber p ); - void MenuLeft( const PlayerNumber p ); - void MenuRight( const PlayerNumber p ); + void MenuLeft( const PlayerNumber p, const InputEventType type ); + void MenuRight( const PlayerNumber p, const InputEventType type ); void MenuBack( const PlayerNumber p ); void MenuStart( const PlayerNumber p ); diff --git a/stepmania/src/ScreenEvaluation.cpp b/stepmania/src/ScreenEvaluation.cpp index 2ad2f403e4..2f78466170 100644 --- a/stepmania/src/ScreenEvaluation.cpp +++ b/stepmania/src/ScreenEvaluation.cpp @@ -330,7 +330,7 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary ) Grade grade[NUM_PLAYERS]; for( p=0; pIsPlayerEnabled(p) || GAMESTATE->m_bUsedAutoPlayer || GAMESTATE->m_fSecondsBeforeFail[p] != -1 ) + if( !GAMESTATE->IsPlayerEnabled(p) || GAMESTATE->m_fSecondsBeforeFail[p] != -1 ) { grade[p] = GRADE_E; } @@ -370,7 +370,7 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary ) if( !GAMESTATE->IsPlayerEnabled(p) ) continue; - if( GAMESTATE->m_bUsedAutoPlayer ) + if( grade[p] == GRADE_E ) continue; switch( m_ResultMode ) diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index d1caa60cba..9626cdfd88 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -86,6 +86,8 @@ #define DIFFICULTY_P2_EXTRA_REVERSE_Y THEME->GetMetricF("Gameplay","DifficultyP2ExtraReverseY") #define DEBUG_X THEME->GetMetricF("Gameplay","DebugX") #define DEBUG_Y THEME->GetMetricF("Gameplay","DebugY") +#define AUTOPLAY_X THEME->GetMetricF("Gameplay","AutoPlayX") +#define AUTOPLAY_Y THEME->GetMetricF("Gameplay","AutoPlayY") #define SURVIVE_TIME_X THEME->GetMetricF("Gameplay","SurviveTimeX") #define SURVIVE_TIME_Y THEME->GetMetricF("Gameplay","SurviveTimeY") #define SECONDS_BETWEEN_COMMENTS THEME->GetMetricF("Gameplay","SecondsBetweenComments") @@ -245,8 +247,6 @@ ScreenGameplay::ScreenGameplay() } - - GAMESTATE->m_bUsedAutoPlayer |= PREFSMAN->m_bAutoPlay; m_bChangedOffsetOrBPM = false; @@ -478,7 +478,12 @@ ScreenGameplay::ScreenGameplay() m_textDebug.SetXY( DEBUG_X, DEBUG_Y ); m_textDebug.SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); this->AddSubActor( &m_textDebug ); - + + m_textAutoPlay.LoadFromFont( THEME->GetPathTo("Fonts","normal") ); + m_textAutoPlay.SetXY( AUTOPLAY_X, AUTOPLAY_Y ); + m_textAutoPlay.SetText( "AutoPlay is ON" ); + m_textAutoPlay.SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); + this->AddSubActor( &m_textAutoPlay ); m_StarWipe.SetClosed(); @@ -904,6 +909,10 @@ void ScreenGameplay::Update( float fDeltaTime ) iRowLastCrossed = iRowNow; } + if( PREFSMAN->m_bAutoPlay && !GAMESTATE->m_bDemonstration ) + m_textAutoPlay.SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); + else + m_textAutoPlay.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); Screen::Update( fDeltaTime ); } @@ -937,7 +946,6 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ return; // don't fall through below } - // Handle special keys to adjust the offset if( DeviceI.device == DEVICE_KEYBOARD ) { @@ -945,13 +953,6 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ { case DIK_F8: PREFSMAN->m_bAutoPlay = !PREFSMAN->m_bAutoPlay; - GAMESTATE->m_bUsedAutoPlayer |= PREFSMAN->m_bAutoPlay; - m_textDebug.SetText( ssprintf("Autoplayer %s.", (PREFSMAN->m_bAutoPlay ? "ON" : "OFF")) ); - m_textDebug.SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); - m_textDebug.StopTweening(); - m_textDebug.BeginTweeningQueued( 3 ); // sleep - m_textDebug.BeginTweeningQueued( 0.5f ); // fade out - m_textDebug.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,0) ); break; case DIK_F9: case DIK_F10: @@ -971,7 +972,7 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ seg.m_fBPM += fOffsetDelta; - m_textDebug.SetText( ssprintf("Cur BPM = %f.", seg.m_fBPM) ); + m_textDebug.SetText( ssprintf("Cur BPM = %f", seg.m_fBPM) ); m_textDebug.SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); m_textDebug.StopTweening(); m_textDebug.BeginTweeningQueued( 3 ); // sleep @@ -996,7 +997,7 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ GAMESTATE->m_pCurSong->m_fBeat0OffsetInSeconds += fOffsetDelta; - m_textDebug.SetText( ssprintf("Offset = %f.", GAMESTATE->m_pCurSong->m_fBeat0OffsetInSeconds) ); + m_textDebug.SetText( ssprintf("Offset = %f", GAMESTATE->m_pCurSong->m_fBeat0OffsetInSeconds) ); m_textDebug.SetDiffuseColor( D3DXCOLOR(1,1,1,1) ); m_textDebug.StopTweening(); m_textDebug.BeginTweeningQueued( 3 ); // sleep @@ -1026,17 +1027,9 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ // // handle a step // - if( m_DancingState == STATE_DANCING ) - { - if( type == IET_FIRST_PRESS ) - { - if( StyleI.IsValid() ) - { - if( GAMESTATE->IsPlayerEnabled( StyleI.player ) ) - m_Player[StyleI.player].Step( StyleI.col ); - } - } - } + if( m_DancingState == STATE_DANCING && type == IET_FIRST_PRESS && !PREFSMAN->m_bAutoPlay && StyleI.IsValid() ) + if( GAMESTATE->IsPlayerEnabled( StyleI.player ) ) + m_Player[StyleI.player].Step( StyleI.col ); } void SaveChanges() diff --git a/stepmania/src/ScreenGameplay.h b/stepmania/src/ScreenGameplay.h index 94e7daacbc..5235ad3ff2 100644 --- a/stepmania/src/ScreenGameplay.h +++ b/stepmania/src/ScreenGameplay.h @@ -94,6 +94,7 @@ private: BitmapText m_textSongOptions; BitmapText m_textDebug; + BitmapText m_textAutoPlay; // shows whether AutoPlay is on. TransitionFadeWipe m_Fade; diff --git a/stepmania/src/ScreenGraphicOptions.cpp b/stepmania/src/ScreenGraphicOptions.cpp index 17e3b44b17..305a004361 100644 --- a/stepmania/src/ScreenGraphicOptions.cpp +++ b/stepmania/src/ScreenGraphicOptions.cpp @@ -44,7 +44,7 @@ OptionLineData g_GraphicOptionsLines[NUM_GRAPHIC_OPTIONS_LINES] = { { "Texture Res", 3, {"256","512","1024"} }, { "Refresh Rate", 11, {"MAX","DEFAULT","60","70","72","75","80","85","90","100","120"} }, { "Show Stats", 2, {"OFF","ON"} }, - { "BG Mode", 6, {"OFF","ANIMATIONS","VISUALIZATIONS","RANDOM MOVIES","fsdflksjfdlksjdflksfdj","fsdflksjfdlksjdflksfdj"} }, + { "BG Mode", 4, {"OFF","ANIMATIONS","VISUALIZATIONS","RANDOM MOVIES"} }, { "BG Brightness", 5, {"20%","40%","60%","80%","100%"} }, { "Movie Decode", 4, {"1ms","2ms","3ms","4ms"} }, { "BG For Banner", 2, {"NO", "YES (slow)"} }, diff --git a/stepmania/src/ScreenManager.cpp b/stepmania/src/ScreenManager.cpp index ba23368cfc..df64a95e78 100644 --- a/stepmania/src/ScreenManager.cpp +++ b/stepmania/src/ScreenManager.cpp @@ -65,8 +65,8 @@ ScreenManager::ScreenManager() m_textSystemMessage.LoadFromFont( THEME->GetPathTo("Fonts","normal") ); m_textSystemMessage.SetHorizAlign( Actor::align_left ); - m_textSystemMessage.SetVertAlign( Actor::align_bottom ); - m_textSystemMessage.SetXY( 5.0f, 10.0f ); + m_textSystemMessage.SetVertAlign( Actor::align_top ); + m_textSystemMessage.SetXY( 4.0f, 4.0f ); m_textSystemMessage.SetZoom( 0.5f ); m_textSystemMessage.SetShadowLength( 2 ); m_textSystemMessage.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); diff --git a/stepmania/src/ScreenTextEntry.cpp b/stepmania/src/ScreenTextEntry.cpp new file mode 100644 index 0000000000..74d1e7834e --- /dev/null +++ b/stepmania/src/ScreenTextEntry.cpp @@ -0,0 +1,160 @@ +#include "stdafx.h" +/* +----------------------------------------------------------------------------- + Class: ScreenTextEntry + + Desc: See header. + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "ScreenTextEntry.h" +#include "PrefsManager.h" +#include "ScreenManager.h" +#include "RageMusic.h" +#include "ScreenTitleMenu.h" +#include "GameConstantsAndTypes.h" +#include "PrefsManager.h" + +const float QUESTION_X = CENTER_X; +const float QUESTION_Y = CENTER_Y - 60; + +const float ANSWER_X = CENTER_X; +const float ANSWER_Y = CENTER_Y + 120; +const float ANSWER_WIDTH = 440; +const float ANSWER_HEIGHT = 30; + +ScreenTextEntry::ScreenTextEntry( ScreenMessage SM_SendWhenDone, CString sQuestion, CString sInitialAnswer, void(*OnOK)(CString sAnswer), void(*OnCancel)() ) +{ + m_SMSendWhenDone = SM_SendWhenDone; + m_pOnOK = OnOK; + m_pOnCancel = OnCancel; + m_sAnswer = sInitialAnswer; + + m_Fade.SetTransitionTime( 0.5f ); + m_Fade.SetDiffuseColor( D3DXCOLOR(0,0,0,0.7f) ); + m_Fade.SetOpened(); + m_Fade.CloseWipingRight(); + this->AddSubActor( &m_Fade ); + + m_textQuestion.LoadFromFont( THEME->GetPathTo("Fonts","normal") ); + m_textQuestion.SetText( sQuestion ); + m_textQuestion.SetXY( QUESTION_X, QUESTION_Y ); + this->AddSubActor( &m_textQuestion ); + + m_rectAnswerBox.SetDiffuseColor( D3DXCOLOR(0.5f,0.5f,1.0f,0.7f) ); + this->AddSubActor( &m_rectAnswerBox ); + + m_rectAnswerBox.SetXY( ANSWER_X, ANSWER_Y ); + m_rectAnswerBox.SetZoomX( ANSWER_WIDTH ); + m_rectAnswerBox.SetZoomY( ANSWER_HEIGHT ); + this->AddSubActor( &m_rectAnswerBox ); + + m_textAnswer.LoadFromFont( THEME->GetPathTo("Fonts","header1") ); + m_textAnswer.LoadFromFont( THEME->GetPathTo("Fonts","header1") ); + m_textAnswer.SetXY( ANSWER_X, ANSWER_Y ); + m_textAnswer.SetText( m_sAnswer ); + this->AddSubActor( &m_textAnswer ); + + SOUND->PlayOnceStreamed( THEME->GetPathTo("Sounds","menu prompt") ); +} + +void ScreenTextEntry::Update( float fDeltaTime ) +{ + Screen::Update( fDeltaTime ); +} + +void ScreenTextEntry::DrawPrimitives() +{ + Screen::DrawPrimitives(); +} + +void ScreenTextEntry::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ) +{ + if( m_Fade.IsOpening() ) + return; + + if( type != IET_FIRST_PRESS ) + return; + + switch( DeviceI.button ) + { + case DIK_ESCAPE: + m_bCancelled = true; + MenuStart(PLAYER_1); + break; + case DIK_RETURN: + MenuStart(PLAYER_1); + break; + case DIK_BACK: + m_sAnswer = m_sAnswer.Left( max(0,m_sAnswer.GetLength()-1) ); + m_textAnswer.SetText( m_sAnswer ); + break; + default: + char c; + c = DeviceI.ToChar(); + if( c != '\0' ) + m_sAnswer += c; + m_textAnswer.SetText( m_sAnswer ); + break; + } + + Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); +} + +void ScreenTextEntry::HandleScreenMessage( const ScreenMessage SM ) +{ + switch( SM ) + { + case SM_DoneClosingWipingLeft: + break; + case SM_DoneClosingWipingRight: + break; + case SM_DoneOpeningWipingLeft: + break; + case SM_DoneOpeningWipingRight: + SCREENMAN->PopTopScreen( m_SMSendWhenDone ); + break; + } +} + +void ScreenTextEntry::MenuLeft( const PlayerNumber p ) +{ +} + +void ScreenTextEntry::MenuRight( const PlayerNumber p ) +{ +} + +void ScreenTextEntry::MenuStart( const PlayerNumber p ) +{ + m_Fade.OpenWipingRight( SM_DoneOpeningWipingRight ); + + m_textQuestion.BeginTweening( 0.2f ); + m_textQuestion.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,0) ); + + m_rectAnswerBox.BeginTweening( 0.2f ); + m_rectAnswerBox.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,0) ); + + m_textAnswer.SetEffectNone(); + + m_textAnswer.BeginTweening( 0.2f ); + m_textAnswer.SetTweenDiffuseColor( D3DXCOLOR(1,1,1,0) ); + + SOUND->PlayOnceStreamed( THEME->GetPathTo("Sounds","menu start") ); + + if( m_bCancelled ) + if( m_pOnCancel ) + m_pOnCancel(); + else + if( m_pOnOK ) + m_pOnOK( m_sAnswer ); +} + +void ScreenTextEntry::MenuBack( const PlayerNumber p ) +{ + m_bCancelled = true; + MenuStart(p); +} diff --git a/stepmania/src/ScreenTextEntry.h b/stepmania/src/ScreenTextEntry.h new file mode 100644 index 0000000000..ea6fd25de3 --- /dev/null +++ b/stepmania/src/ScreenTextEntry.h @@ -0,0 +1,49 @@ +/* +----------------------------------------------------------------------------- + Class: ScreenTextEntry + + Desc: Displays a text entry box over the top of another screen. Must use by calling + SCREENMAN->AddScreenToTop( new ScreenTextEntry(...) ); + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "Screen.h" +#include "BitmapText.h" +#include "TransitionFade.h" +#include "Quad.h" +#include "RandomSample.h" + + + + +class ScreenTextEntry : public Screen +{ +public: + ScreenTextEntry(); + ScreenTextEntry( ScreenMessage SM_SendWhenDone, CString sQuestion, CString sInitialAnswer, void(*OnOK)(CString sAnswer) = NULL, void(*OnCanel)() = NULL ); + + virtual void Update( float fDeltaTime ); + virtual void DrawPrimitives(); + virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ); + virtual void HandleScreenMessage( const ScreenMessage SM ); + +protected: + virtual void MenuLeft( const PlayerNumber p ); + virtual void MenuRight( const PlayerNumber p ); + virtual void MenuStart( const PlayerNumber p ); + virtual void MenuBack( const PlayerNumber p ); + + TransitionFade m_Fade; + BitmapText m_textQuestion; + Quad m_rectAnswerBox; + CString m_sAnswer; + BitmapText m_textAnswer; + ScreenMessage m_SMSendWhenDone; + void(*m_pOnOK)( CString sAnswer ); + void(*m_pOnCancel)(); + bool m_bCancelled; +}; + diff --git a/stepmania/src/SnapDisplay.cpp b/stepmania/src/SnapDisplay.cpp index ec55ac8d10..25818425d7 100644 --- a/stepmania/src/SnapDisplay.cpp +++ b/stepmania/src/SnapDisplay.cpp @@ -27,7 +27,7 @@ SnapDisplay::SnapDisplay() this->AddSubActor( &m_sprIndicators[i] ); } - m_NoteType = NOTE_4TH; + m_NoteType = NOTE_TYPE_4TH; D3DXCOLOR color = NoteTypeToColor( m_NoteType ); for( i=0; i<2; i++ ) diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index b3431b9e5d..8f0b1d0f84 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -70,11 +70,11 @@ void SortStopSegmentsArray( CArray &arrayStopSegments qsort( arrayStopSegments.GetData(), arrayStopSegments.GetSize(), sizeof(StopSegment), CompareStopSegments ); } -int CompareAnimationSegments(const void *arg1, const void *arg2) +int CompareBackgroundChanges(const void *arg1, const void *arg2) { // arg1 and arg2 are of type Step** - const AnimationSegment* seg1 = (const AnimationSegment*)arg1; - const AnimationSegment* seg2 = (const AnimationSegment*)arg2; + const BackgroundChange* seg1 = (const BackgroundChange*)arg1; + const BackgroundChange* seg2 = (const BackgroundChange*)arg2; float score1 = seg1->m_fStartBeat; float score2 = seg2->m_fStartBeat; @@ -87,9 +87,9 @@ int CompareAnimationSegments(const void *arg1, const void *arg2) return 1; } -void SortAnimationSegmentsArray( CArray &arrayAnimationSegments ) +void SortBackgroundChangesArray( CArray &arrayBackgroundChanges ) { - qsort( arrayAnimationSegments.GetData(), arrayAnimationSegments.GetSize(), sizeof(AnimationSegment), CompareAnimationSegments ); + qsort( arrayBackgroundChanges.GetData(), arrayBackgroundChanges.GetSize(), sizeof(BackgroundChange), CompareBackgroundChanges ); } @@ -131,10 +131,10 @@ void Song::AddStopSegment( StopSegment seg ) } -void Song::AddAnimationSegment( AnimationSegment seg ) +void Song::AddBackgroundChange( BackgroundChange seg ) { - m_AnimationSegments.Add( seg ); - SortAnimationSegmentsArray( m_AnimationSegments ); + m_BackgroundChanges.Add( seg ); + SortBackgroundChangesArray( m_BackgroundChanges ); } float Song::GetMusicStartBeat() const @@ -486,7 +486,7 @@ bool Song::LoadFromBMSDir( CString sDir ) // index is in quarter beats starting at beat 0 int iStepIndex = (int) ( (iMeasureNo + fPercentThroughMeasure) - * BEATS_PER_MEASURE * ELEMENTS_PER_BEAT ); + * BEATS_PER_MEASURE * ROWS_PER_BEAT ); switch( iBMSTrackNo ) { @@ -726,7 +726,7 @@ bool Song::LoadFromDWIFile( CString sPath ) { CStringArray arrayFreezeValues; split( arrayFreezeExpressions[f], "=", arrayFreezeValues ); - float fIndex = atoi( arrayFreezeValues[0] ) * ELEMENTS_PER_BEAT / 4.0f; + float fIndex = atoi( arrayFreezeValues[0] ) * ROWS_PER_BEAT / 4.0f; float fFreezeBeat = NoteRowToBeat( fIndex ); float fFreezeSeconds = (float)atof( arrayFreezeValues[1] ) / 1000.0f; @@ -744,7 +744,7 @@ bool Song::LoadFromDWIFile( CString sPath ) { CStringArray arrayBPMChangeValues; split( arrayBPMChangeExpressions[b], "=", arrayBPMChangeValues ); - float fIndex = atoi( arrayBPMChangeValues[0] ) * ELEMENTS_PER_BEAT / 4.0f; + float fIndex = atoi( arrayBPMChangeValues[0] ) * ROWS_PER_BEAT / 4.0f; float fBeat = NoteRowToBeat( fIndex ); float fNewBPM = (float)atof( arrayBPMChangeValues[1] ); @@ -887,20 +887,20 @@ bool Song::LoadFromSMFile( CString sPath ) } } - else if( 0==stricmp(sValueName,"ANIMATIONS") ) + else if( 0==stricmp(sValueName,"BGCHANGES") ) { - CStringArray arrayAnimationExpressions; - split( sParams[1], ",", arrayAnimationExpressions ); + CStringArray aBGChangeExpressions; + split( sParams[1], ",", aBGChangeExpressions ); - for( int b=0; b + + + + diff --git a/stepmania/src/song.h b/stepmania/src/song.h index dfe09c2c38..5c10819f38 100644 --- a/stepmania/src/song.h +++ b/stepmania/src/song.h @@ -33,12 +33,12 @@ struct StopSegment float m_fStopSeconds; }; -struct AnimationSegment +struct BackgroundChange { - AnimationSegment() { m_fStartBeat = -1; }; - AnimationSegment( float s, CString sAnimName ) { m_fStartBeat = s; m_sAnimationName = sAnimName; }; + BackgroundChange() { m_fStartBeat = -1; }; + BackgroundChange( float s, CString sBGName ) { m_fStartBeat = s; m_sBGName = sBGName; }; float m_fStartBeat; - CString m_sAnimationName; + CString m_sBGName; }; @@ -116,15 +116,15 @@ public: bool HasBackground() {return m_sBackgroundFile != "" && IsAFile(GetBackgroundPath()); }; bool HasCDTitle() {return m_sCDTitleFile != "" && IsAFile(GetCDTitlePath()); }; bool HasMovieBackground() {return m_sMovieBackgroundFile != ""&& IsAFile(GetMovieBackgroundPath()); }; - + bool HasBGChanges() {return m_BackgroundChanges.GetSize() > 0; }; CArray m_BPMSegments; // this must be sorted before gameplay CArray m_StopSegments; // this must be sorted before gameplay - CArray m_AnimationSegments; // this must be sorted before gameplay + CArray m_BackgroundChanges; // this must be sorted before gameplay void AddBPMSegment( BPMSegment seg ); void AddStopSegment( StopSegment seg ); - void AddAnimationSegment( AnimationSegment seg ); + void AddBackgroundChange( BackgroundChange seg ); void GetMinMaxBPM( float &fMinBPM, float &fMaxBPM ) const { @@ -151,12 +151,12 @@ public: break; return m_BPMSegments[i]; }; - CString GetAnimationAtBeat( float fBeat ) + CString GetBackgroundAtBeat( float fBeat ) { - for( int i=0; i fBeat ) + for( int i=0; i fBeat ) break; - return m_AnimationSegments[i].m_sAnimationName; + return m_BackgroundChanges[i].m_sBGName; }; void GetBeatAndBPSFromElapsedTime( float fElapsedTime, float &fBeatOut, float &fBPSOut, bool &bFreezeOut ) const; float GetElapsedTimeFromBeat( float fBeat ) const;