fix "corrupted HoldNotes" when using Transforms as attacks
This commit is contained in:
@@ -86,7 +86,7 @@ void NoteData::CopyRange( NoteData* pFrom, int iFromIndexBegin, int iFromIndexEn
|
|||||||
// copy recorded TapNotes
|
// copy recorded TapNotes
|
||||||
int f = iFromIndexBegin, t = iToIndexBegin;
|
int f = iFromIndexBegin, t = iToIndexBegin;
|
||||||
|
|
||||||
while( f<=iFromIndexEnd )
|
while( f<iFromIndexEnd )
|
||||||
{
|
{
|
||||||
for( int c=0; c<m_iNumTracks; c++ )
|
for( int c=0; c<m_iNumTracks; c++ )
|
||||||
SetTapNote(c, t, pFrom->GetTapNote(c, f));
|
SetTapNote(c, t, pFrom->GetTapNote(c, f));
|
||||||
|
|||||||
@@ -504,6 +504,7 @@ void NoteDataUtil::Wide( NoteData &in, float fStartBeat, float fEndBeat )
|
|||||||
|
|
||||||
in.ConvertHoldNotesTo4s();
|
in.ConvertHoldNotesTo4s();
|
||||||
|
|
||||||
|
|
||||||
int first_row = 0;
|
int first_row = 0;
|
||||||
if( fStartBeat != -1 )
|
if( fStartBeat != -1 )
|
||||||
first_row = BeatToNoteRow(fStartBeat);
|
first_row = BeatToNoteRow(fStartBeat);
|
||||||
@@ -512,7 +513,7 @@ void NoteDataUtil::Wide( NoteData &in, float fStartBeat, float fEndBeat )
|
|||||||
if( fEndBeat != -1 )
|
if( fEndBeat != -1 )
|
||||||
last_row = BeatToNoteRow(fEndBeat);
|
last_row = BeatToNoteRow(fEndBeat);
|
||||||
|
|
||||||
for( int i=first_row; i<=last_row; i+=ROWS_PER_BEAT*2 ) // every even beat
|
for( int i=first_row; i<last_row; i+=ROWS_PER_BEAT*2 ) // every even beat
|
||||||
{
|
{
|
||||||
if( in.GetNumTapNonEmptyTracks(i) != 1 )
|
if( in.GetNumTapNonEmptyTracks(i) != 1 )
|
||||||
continue; // skip. Don't place during holds
|
continue; // skip. Don't place during holds
|
||||||
@@ -586,7 +587,7 @@ void NoteDataUtil::InsertIntelligentTaps( NoteData &in, float fBeatInterval, flo
|
|||||||
|
|
||||||
int rows_per_interval = BeatToNoteRow( fBeatInterval );
|
int rows_per_interval = BeatToNoteRow( fBeatInterval );
|
||||||
int insert_row_offset = BeatToNoteRow( fInsertBeatOffset );
|
int insert_row_offset = BeatToNoteRow( fInsertBeatOffset );
|
||||||
for( int i=first_row; i<=last_row; i+=rows_per_interval )
|
for( int i=first_row; i<last_row; i+=rows_per_interval )
|
||||||
{
|
{
|
||||||
int iRowEarlier = i;
|
int iRowEarlier = i;
|
||||||
int iRowLater = i + rows_per_interval;
|
int iRowLater = i + rows_per_interval;
|
||||||
|
|||||||
@@ -238,7 +238,15 @@ void Player::Update( float fDeltaTime )
|
|||||||
m_NoteField.m_bIsHoldingHoldNote[i] = bIsHoldingButton && bSteppedOnTapNote;
|
m_NoteField.m_bIsHoldingHoldNote[i] = bIsHoldingButton && bSteppedOnTapNote;
|
||||||
|
|
||||||
if( bSteppedOnTapNote ) // this note is not judged and we stepped on its head
|
if( bSteppedOnTapNote ) // this note is not judged and we stepped on its head
|
||||||
m_NoteField.GetHoldNote(i).fStartBeat = fSongBeat; // move the start of this Hold
|
{
|
||||||
|
// Move the start of this Hold
|
||||||
|
//
|
||||||
|
// IMPORTANT: Every HoldNote::fStartBeat must be at least 1 index less than
|
||||||
|
// its HoldNote::fEndBeat. Otherwise, when HoldNotes are converted to the
|
||||||
|
// 4s representation, it disappears, which causes problems for the way we
|
||||||
|
// store HoldNote life (by index of the hold).
|
||||||
|
m_NoteField.GetHoldNote(i).fStartBeat = min( fSongBeat, m_NoteField.GetHoldNote(i).fEndBeat -NoteRowToBeat(1) );
|
||||||
|
}
|
||||||
|
|
||||||
if( bSteppedOnTapNote && bIsHoldingButton )
|
if( bSteppedOnTapNote && bIsHoldingButton )
|
||||||
{
|
{
|
||||||
@@ -328,36 +336,34 @@ void Player::Update( float fDeltaTime )
|
|||||||
float fEndBeat = GAMESTATE->m_pCurSong->GetBeatFromElapsedTime( fEndSeconds );
|
float fEndBeat = GAMESTATE->m_pCurSong->GetBeatFromElapsedTime( fEndSeconds );
|
||||||
fEndBeat = ((int)fEndBeat)+1;
|
fEndBeat = ((int)fEndBeat)+1;
|
||||||
|
|
||||||
|
LOG->Trace( "Applying transform from %f to %f", fStartBeat, fEndBeat );
|
||||||
|
|
||||||
switch( GAMESTATE->m_TransformsToApply[m_PlayerNumber][i] )
|
switch( GAMESTATE->m_TransformsToApply[m_PlayerNumber][i] )
|
||||||
{
|
{
|
||||||
case PlayerOptions::TRANSFORM_LITTLE:
|
case PlayerOptions::TRANSFORM_LITTLE:
|
||||||
NoteDataUtil::Little( *this, fStartBeat, fEndBeat );
|
NoteDataUtil::Little( *this, fStartBeat, fEndBeat );
|
||||||
NoteDataUtil::Little( m_NoteField, fStartBeat, fEndBeat );
|
|
||||||
break;
|
break;
|
||||||
case PlayerOptions::TRANSFORM_WIDE:
|
case PlayerOptions::TRANSFORM_WIDE:
|
||||||
NoteDataUtil::Wide( *this, fStartBeat, fEndBeat );
|
NoteDataUtil::Wide( *this, fStartBeat, fEndBeat );
|
||||||
NoteDataUtil::Wide( m_NoteField, fStartBeat, fEndBeat );
|
|
||||||
break;
|
break;
|
||||||
case PlayerOptions::TRANSFORM_BIG:
|
case PlayerOptions::TRANSFORM_BIG:
|
||||||
NoteDataUtil::Big( *this, fStartBeat, fEndBeat );
|
NoteDataUtil::Big( *this, fStartBeat, fEndBeat );
|
||||||
NoteDataUtil::Big( m_NoteField, fStartBeat, fEndBeat );
|
|
||||||
break;
|
break;
|
||||||
case PlayerOptions::TRANSFORM_QUICK:
|
case PlayerOptions::TRANSFORM_QUICK:
|
||||||
NoteDataUtil::Quick( *this, fStartBeat, fEndBeat );
|
NoteDataUtil::Quick( *this, fStartBeat, fEndBeat );
|
||||||
NoteDataUtil::Quick( m_NoteField, fStartBeat, fEndBeat );
|
|
||||||
break;
|
break;
|
||||||
case PlayerOptions::TRANSFORM_SKIPPY:
|
case PlayerOptions::TRANSFORM_SKIPPY:
|
||||||
NoteDataUtil::Skippy( *this, fStartBeat, fEndBeat );
|
NoteDataUtil::Skippy( *this, fStartBeat, fEndBeat );
|
||||||
NoteDataUtil::Skippy( m_NoteField, fStartBeat, fEndBeat );
|
|
||||||
break;
|
break;
|
||||||
case PlayerOptions::TRANSFORM_MINES:
|
case PlayerOptions::TRANSFORM_MINES:
|
||||||
NoteDataUtil::Mines( *this, fStartBeat, fEndBeat );
|
NoteDataUtil::Mines( *this, fStartBeat, fEndBeat );
|
||||||
NoteDataUtil::Mines( m_NoteField, fStartBeat, fEndBeat );
|
|
||||||
break;
|
break;
|
||||||
case PlayerOptions::TRANSFORM_NONE:
|
case PlayerOptions::TRANSFORM_NONE:
|
||||||
default:
|
default:
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_NoteField.CopyRange( this, BeatToNoteRow(fStartBeat), BeatToNoteRow(fEndBeat), BeatToNoteRow(fStartBeat) );
|
||||||
}
|
}
|
||||||
GAMESTATE->m_TransformsToApply[m_PlayerNumber].clear();
|
GAMESTATE->m_TransformsToApply[m_PlayerNumber].clear();
|
||||||
|
|
||||||
|
|||||||
@@ -1421,23 +1421,25 @@ void ScreenEdit::HandleAreaMenuChoice( AreaMenuChoice c, int* iAnswers )
|
|||||||
break;
|
break;
|
||||||
case transform:
|
case transform:
|
||||||
{
|
{
|
||||||
HandleAreaMenuChoice( cut, NULL );
|
// HandleAreaMenuChoice( cut, NULL );
|
||||||
|
|
||||||
|
float fBeginBeat = m_NoteFieldEdit.m_fBeginMarker;
|
||||||
|
float fEndBeat = m_NoteFieldEdit.m_fEndMarker;
|
||||||
TransformType tt = (TransformType)iAnswers[c];
|
TransformType tt = (TransformType)iAnswers[c];
|
||||||
switch( tt )
|
switch( tt )
|
||||||
{
|
{
|
||||||
case little: NoteDataUtil::Little( m_Clipboard ); break;
|
case little: NoteDataUtil::Little( m_NoteFieldEdit, fBeginBeat, fEndBeat ); break;
|
||||||
case wide: NoteDataUtil::Wide( m_Clipboard ); break;
|
case wide: NoteDataUtil::Wide( m_NoteFieldEdit, fBeginBeat, fEndBeat ); break;
|
||||||
case big: NoteDataUtil::Big( m_Clipboard ); break;
|
case big: NoteDataUtil::Big( m_NoteFieldEdit, fBeginBeat, fEndBeat ); break;
|
||||||
case quick: NoteDataUtil::Quick( m_Clipboard ); break;
|
case quick: NoteDataUtil::Quick( m_NoteFieldEdit, fBeginBeat, fEndBeat ); break;
|
||||||
case skippy: NoteDataUtil::Skippy( m_Clipboard ); break;
|
case skippy: NoteDataUtil::Skippy( m_NoteFieldEdit, fBeginBeat, fEndBeat ); break;
|
||||||
default: ASSERT(0);
|
default: ASSERT(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// bake in the additions
|
// bake in the additions
|
||||||
NoteDataUtil::ConvertAdditionsToRegular( m_Clipboard );
|
NoteDataUtil::ConvertAdditionsToRegular( m_NoteFieldEdit );
|
||||||
|
|
||||||
HandleAreaMenuChoice( paste_at_begin_marker, NULL );
|
// HandleAreaMenuChoice( paste_at_begin_marker, NULL );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case alter:
|
case alter:
|
||||||
|
|||||||
Reference in New Issue
Block a user