From 9434a66d94745bd760ec7c06cf5ea8f2f7a3a6f1 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sun, 21 Sep 2003 23:16:44 +0000 Subject: [PATCH] fix FixImpossibleRows() fix misaligned editor NoteFields --- stepmania/src/NoteData.cpp | 22 +++++++++++ stepmania/src/NoteData.h | 3 +- stepmania/src/NoteDataUtil.cpp | 48 ++++++++++++++++-------- stepmania/src/NoteDataUtil.h | 3 -- stepmania/src/ScreenEdit.cpp | 67 ++++++++++++++++++---------------- stepmania/src/Song.cpp | 20 ++++++---- stepmania/src/Steps.cpp | 2 +- 7 files changed, 104 insertions(+), 61 deletions(-) diff --git a/stepmania/src/NoteData.cpp b/stepmania/src/NoteData.cpp index cb6ec03b66..577b84b185 100644 --- a/stepmania/src/NoteData.cpp +++ b/stepmania/src/NoteData.cpp @@ -521,3 +521,25 @@ void NoteData::SetTapNote(int track, int row, TapNote t) PadTapNotes(row); m_TapNotes[track][row]=t; } + +void NoteData::EliminateAllButOneTap(int row) +{ + if(row < 0) return; + + PadTapNotes(row); + + for(int track = 0; track < m_iNumTracks; ++track) + { + if( m_TapNotes[track][row] == TAP_TAP ) + break; + } + + track++; + + for( ; track < m_iNumTracks; ++track) + { + if( m_TapNotes[track][row] == TAP_TAP ) + m_TapNotes[track][row] = TAP_EMPTY; + } +} + diff --git a/stepmania/src/NoteData.h b/stepmania/src/NoteData.h index 7a05028bce..3de7f7e1f8 100644 --- a/stepmania/src/NoteData.h +++ b/stepmania/src/NoteData.h @@ -137,8 +137,7 @@ public: // True if no notes in row that aren't true in the mask bool RowPassesValidMask( int row, bool bValidMask[] ); - // Remove all tap notes that fail this mask - void EliminateNonPassingTaps( int row, bool bValidMask[] ); + void EliminateAllButOneTap( int row ); }; diff --git a/stepmania/src/NoteDataUtil.cpp b/stepmania/src/NoteDataUtil.cpp index 9d2907234e..d5accc092f 100644 --- a/stepmania/src/NoteDataUtil.cpp +++ b/stepmania/src/NoteDataUtil.cpp @@ -916,35 +916,53 @@ const ValidRow g_ValidRows[] = void NoteDataUtil::FixImpossibleRows( NoteData &in, StepsType st ) { - for( unsigned i=0; i vpValidRowsToCheck; + for( int i=0; iGetPathToB("ScreenEdit background") ); shiftAnchor = -1; - m_SnapDisplay.SetXY( EDIT_X, EDIT_GRAY_Y ); + + + m_SnapDisplay.SetXY( EDIT_X, PLAYER_Y_STANDARD ); m_SnapDisplay.Load( PLAYER_1 ); m_SnapDisplay.SetZoom( 0.5f ); - m_GrayArrowRowEdit.SetXY( EDIT_X, EDIT_GRAY_Y ); + m_GrayArrowRowEdit.SetXY( EDIT_X, PLAYER_Y_STANDARD ); m_GrayArrowRowEdit.Load( PLAYER_1 ); m_GrayArrowRowEdit.SetZoom( 0.5f ); - m_NoteFieldEdit.SetXY( EDIT_X, EDIT_GRAY_Y ); + m_NoteFieldEdit.SetXY( EDIT_X, PLAYER_Y ); m_NoteFieldEdit.SetZoom( 0.5f ); - m_NoteFieldEdit.Load( ¬eData, PLAYER_1, -240, 800, 800 ); + m_NoteFieldEdit.Load( ¬eData, PLAYER_1, -240, 800, PLAYER_HEIGHT*2 ); m_rectRecordBack.StretchTo( RectI(SCREEN_LEFT, SCREEN_TOP, SCREEN_RIGHT, SCREEN_BOTTOM) ); m_rectRecordBack.SetDiffuse( RageColor(0,0,0,0) ); - m_GrayArrowRowRecord.SetXY( EDIT_X, EDIT_GRAY_Y ); + m_GrayArrowRowRecord.SetXY( EDIT_X, PLAYER_Y ); m_GrayArrowRowRecord.Load( PLAYER_1 ); m_GrayArrowRowRecord.SetZoom( 1.0f ); - m_NoteFieldRecord.SetXY( EDIT_X, EDIT_GRAY_Y ); + m_NoteFieldRecord.SetXY( EDIT_X, PLAYER_Y ); m_NoteFieldRecord.SetZoom( 1.0f ); m_NoteFieldRecord.Load( ¬eData, PLAYER_1, -150, 350, 350 ); diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index 136a58853c..452cbbfa42 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -900,27 +900,31 @@ void Song::TranslateTitles() void Song::ReCalculateRadarValuesAndLastBeat() { - // - // calculate radar values and first/last beat - // for( unsigned i=0; iIsAutogen() ) continue; + + // + // calculate radar values + // NoteData tempNoteData; pNotes->GetNoteData( &tempNoteData ); for( int r=0; rIsAutogen()) - continue; - - pNotes->SetRadarValue(r, NoteDataUtil::GetRadarValue( tempNoteData, (RadarCategory)r, m_fMusicLengthSeconds )); + float fVal = NoteDataUtil::GetRadarValue( tempNoteData, (RadarCategory)r, m_fMusicLengthSeconds ); + pNotes->SetRadarValue(r, fVal); } + + // + // calculate first/last beat + // /* Many songs have stray, empty song patterns. Ignore them, so * they don't force the first beat of the whole song to 0. XXX Should * we just delete them, now that new patterns can be created quickly diff --git a/stepmania/src/Steps.cpp b/stepmania/src/Steps.cpp index abd489a694..ce2ec8523f 100644 --- a/stepmania/src/Steps.cpp +++ b/stepmania/src/Steps.cpp @@ -173,7 +173,7 @@ void Steps::Decompress() const else { notes->LoadTransformedSlidingWindow( &pdata, notes->GetNumTracks() ); - NoteDataUtil::FixImpossibleRows( pdata, m_StepsType ); + NoteDataUtil::FixImpossibleRows( *notes, m_StepsType ); } } else if(!notes_comp)