Pass timing data to TransformNoteData so that fake notes inside warps can be removed properly.

This commit is contained in:
Kyzentun Keeslala
2016-03-02 08:23:26 -07:00
parent c50ad2286c
commit eb3121faf9
5 changed files with 50 additions and 29 deletions
+31 -14
View File
@@ -1252,28 +1252,45 @@ void NoteDataUtil::RemoveQuads( NoteData &inout, int iStartIndex, int iEndIndex
RemoveSimultaneousNotes( inout, 3, iStartIndex, iEndIndex );
}
void NoteDataUtil::RemoveSpecificTapNotes( NoteData &inout, TapNoteType tn, int iStartIndex, int iEndIndex )
void NoteDataUtil::RemoveSpecificTapNotes(NoteData &inout, TapNoteType tn, int iStartIndex, int iEndIndex)
{
for( int t=0; t<inout.GetNumTracks(); t++ )
FOREACH_NONEMPTY_ROW_IN_TRACK_RANGE( inout, t, r, iStartIndex, iEndIndex )
if( inout.GetTapNote(t,r).type == tn )
for(int t=0; t<inout.GetNumTracks(); t++)
{
FOREACH_NONEMPTY_ROW_IN_TRACK_RANGE(inout, t, r, iStartIndex, iEndIndex)
{
if(inout.GetTapNote(t,r).type == tn)
{
inout.SetTapNote( t, r, TAP_EMPTY );
}
}
}
inout.RevalidateATIs(vector<int>(), false);
}
void NoteDataUtil::RemoveMines( NoteData &inout, int iStartIndex, int iEndIndex )
void NoteDataUtil::RemoveMines(NoteData &inout, int iStartIndex, int iEndIndex)
{
RemoveSpecificTapNotes( inout, TapNoteType_Mine, iStartIndex, iEndIndex );
RemoveSpecificTapNotes(inout, TapNoteType_Mine, iStartIndex, iEndIndex);
}
void NoteDataUtil::RemoveLifts( NoteData &inout, int iStartIndex, int iEndIndex )
void NoteDataUtil::RemoveLifts(NoteData &inout, int iStartIndex, int iEndIndex)
{
RemoveSpecificTapNotes( inout, TapNoteType_Lift, iStartIndex, iEndIndex );
RemoveSpecificTapNotes(inout, TapNoteType_Lift, iStartIndex, iEndIndex);
}
void NoteDataUtil::RemoveFakes( NoteData &inout, int iStartIndex, int iEndIndex )
void NoteDataUtil::RemoveFakes(NoteData &inout, TimingData const& timing_data, int iStartIndex, int iEndIndex)
{
RemoveSpecificTapNotes( inout, TapNoteType_Fake, iStartIndex, iEndIndex );
RemoveSpecificTapNotes(inout, TapNoteType_Fake, iStartIndex, iEndIndex);
for(int t=0; t<inout.GetNumTracks(); t++)
{
FOREACH_NONEMPTY_ROW_IN_TRACK_RANGE(inout, t, r, iStartIndex, iEndIndex)
{
if(!timing_data.IsJudgableAtRow(r))
{
inout.SetTapNote( t, r, TAP_EMPTY );
}
}
}
inout.RevalidateATIs(vector<int>(), false);
}
void NoteDataUtil::RemoveAllButOneTap( NoteData &inout, int row )
@@ -2692,7 +2709,7 @@ void NoteDataUtil::ConvertAdditionsToRegular( NoteData &inout )
inout.RevalidateATIs(vector<int>(), false);
}
void NoteDataUtil::TransformNoteData( NoteData &nd, const AttackArray &aa, StepsType st, Song* pSong )
void NoteDataUtil::TransformNoteData(NoteData &nd, TimingData const& timing_data, const AttackArray &aa, StepsType st, Song* pSong)
{
FOREACH_CONST( Attack, aa, a )
{
@@ -2703,12 +2720,12 @@ void NoteDataUtil::TransformNoteData( NoteData &nd, const AttackArray &aa, Steps
float fStartBeat, fEndBeat;
a->GetAttackBeats( pSong, fStartBeat, fEndBeat );
NoteDataUtil::TransformNoteData( nd, po, st, BeatToNoteRow(fStartBeat), BeatToNoteRow(fEndBeat) );
NoteDataUtil::TransformNoteData(nd, timing_data, po, st, BeatToNoteRow(fStartBeat), BeatToNoteRow(fEndBeat) );
}
}
}
void NoteDataUtil::TransformNoteData( NoteData &nd, const PlayerOptions &po, StepsType st, int iStartIndex, int iEndIndex )
void NoteDataUtil::TransformNoteData( NoteData &nd, TimingData const& timing_data, const PlayerOptions &po, StepsType st, int iStartIndex, int iEndIndex )
{
// Apply remove transforms before others so that we don't go removing
// notes we just inserted. Apply TRANSFORM_NOROLLS before TRANSFORM_NOHOLDS,
@@ -2719,7 +2736,7 @@ void NoteDataUtil::TransformNoteData( NoteData &nd, const PlayerOptions &po, Ste
if( po.m_bTransforms[PlayerOptions::TRANSFORM_NOMINES] ) NoteDataUtil::RemoveMines( nd, iStartIndex, iEndIndex );
if( po.m_bTransforms[PlayerOptions::TRANSFORM_NOJUMPS] ) NoteDataUtil::RemoveJumps( nd, iStartIndex, iEndIndex );
if( po.m_bTransforms[PlayerOptions::TRANSFORM_NOLIFTS] ) NoteDataUtil::RemoveLifts( nd, iStartIndex, iEndIndex );
if( po.m_bTransforms[PlayerOptions::TRANSFORM_NOFAKES] ) NoteDataUtil::RemoveFakes( nd, iStartIndex, iEndIndex );
if( po.m_bTransforms[PlayerOptions::TRANSFORM_NOFAKES] ) NoteDataUtil::RemoveFakes( nd, timing_data, iStartIndex, iEndIndex );
if( po.m_bTransforms[PlayerOptions::TRANSFORM_NOHANDS] ) NoteDataUtil::RemoveHands( nd, iStartIndex, iEndIndex );
if( po.m_bTransforms[PlayerOptions::TRANSFORM_NOQUADS] ) NoteDataUtil::RemoveQuads( nd, iStartIndex, iEndIndex );
if( po.m_bTransforms[PlayerOptions::TRANSFORM_NOSTRETCH] ) NoteDataUtil::RemoveStretch( nd, st, iStartIndex, iEndIndex );
+8 -6
View File
@@ -74,25 +74,25 @@ namespace NoteDataUtil
* @param tn the TapNote Type to remove.
* @param iStartIndex the starting point for transforming.
* @param iEndIndex the ending point for transforming. */
void RemoveSpecificTapNotes( NoteData &inout, TapNoteType tn, int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW );
void RemoveSpecificTapNotes(NoteData &inout, TapNoteType tn, int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW);
/**
* @brief Remove all of the mines from the chart.
* @param inout the Notedata to be transformed.
* @param iStartIndex the starting point for transforming.
* @param iEndIndex the ending point for transforming. */
void RemoveMines( NoteData &inout, int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW );
void RemoveMines(NoteData &inout, int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW);
/**
* @brief Remove all of the lifts from the chart.
* @param inout the Notedata to be transformed.
* @param iStartIndex the starting point for transforming.
* @param iEndIndex the ending point for transforming. */
void RemoveLifts( NoteData &inout, int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW );
void RemoveLifts(NoteData &inout, int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW);
/**
* @brief Remove all of the fakes from the chart.
* @param inout the Notedata to be transformed.
* @param iStartIndex the starting point for transforming.
* @param iEndIndex the ending point for transforming. */
void RemoveFakes( NoteData &inout, int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW );
void RemoveFakes(NoteData &inout, TimingData const& timing_data, int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW);
void RemoveStretch( NoteData &inout, StepsType st, int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW );
void RemoveAllButOneTap( NoteData &inout, int row );
void RemoveAllButPlayer( NoteData &inout, PlayerNumber pn );
@@ -163,8 +163,10 @@ namespace NoteDataUtil
// True if no notes in row that aren't true in the mask
bool RowPassesValidMask( NoteData &inout, int row, const bool bValidMask[] );
void TransformNoteData( NoteData &nd, const AttackArray &aa, StepsType st, Song* pSong );
void TransformNoteData( NoteData &nd, const PlayerOptions &po, StepsType st,
void TransformNoteData(NoteData &nd, TimingData const& timing_data,
const AttackArray &aa, StepsType st, Song* pSong);
void TransformNoteData(NoteData &nd, TimingData const& timing_data,
const PlayerOptions &po, StepsType st,
int iStartIndex = 0, int iEndIndex = MAX_NOTE_ROW );
void AddTapAttacks( NoteData &nd, Song* pSong );
+5 -5
View File
@@ -670,13 +670,13 @@ void Player::Load()
// if( m_pScore )
// m_pScore->Init( pn );
m_Timing = GAMESTATE->m_pCurSteps[pn]->GetTimingData();
/* Apply transforms. */
NoteDataUtil::TransformNoteData( m_NoteData, m_pPlayerState->m_PlayerOptions.GetStage(), GAMESTATE->GetCurrentStyle(GetPlayerState()->m_PlayerNumber)->m_StepsType );
NoteDataUtil::TransformNoteData(m_NoteData, *m_Timing, m_pPlayerState->m_PlayerOptions.GetStage(), GAMESTATE->GetCurrentStyle(GetPlayerState()->m_PlayerNumber)->m_StepsType);
const Song* pSong = GAMESTATE->m_pCurSong;
m_Timing = GAMESTATE->m_pCurSteps[pn]->GetTimingData();
// Generate some cache data structure.
GenerateCacheDataStructure(m_pPlayerState, m_NoteData);
@@ -691,7 +691,7 @@ void Player::Load()
// workaround, but since only DDR has ever really implemented those
// modes, it's stayed like this. -aj
StepsType st = GAMESTATE->GetCurrentStyle(GetPlayerState()->m_PlayerNumber)->m_StepsType;
NoteDataUtil::TransformNoteData( m_NoteData, m_pPlayerState->m_PlayerOptions.GetStage(), st );
NoteDataUtil::TransformNoteData(m_NoteData, *m_Timing, m_pPlayerState->m_PlayerOptions.GetStage(), st);
if (BATTLE_RAVE_MIRROR)
{
@@ -1504,7 +1504,7 @@ void Player::ApplyWaitingTransforms()
// if re-adding noteskin changes, this is one place to edit -aj
NoteDataUtil::TransformNoteData( m_NoteData, po, GAMESTATE->GetCurrentStyle(GetPlayerState()->m_PlayerNumber)->m_StepsType, BeatToNoteRow(fStartBeat), BeatToNoteRow(fEndBeat) );
NoteDataUtil::TransformNoteData(m_NoteData, *m_Timing, po, GAMESTATE->GetCurrentStyle(GetPlayerState()->m_PlayerNumber)->m_StepsType, BeatToNoteRow(fStartBeat), BeatToNoteRow(fEndBeat));
}
m_pPlayerState->m_ModsToApply.clear();
}
+2 -2
View File
@@ -79,7 +79,7 @@ void ScoreKeeperNormal::Load(
/* Compute RadarValues before applying any user-selected mods. Apply
* Course mods and count them in the "pre" RadarValues because they're
* forced and not chosen by the user. */
NoteDataUtil::TransformNoteData( ndPre, aa, pSteps->m_StepsType, pSong );
NoteDataUtil::TransformNoteData(ndPre, *(pSteps->GetTimingData()), aa, pSteps->m_StepsType, pSong );
/* Apply user transforms to find out how the notes will really look.
*
@@ -89,7 +89,7 @@ void ScoreKeeperNormal::Load(
* the last call to StoreSelectedOptions and the modifiers list, but that'd
* mean moving the queues in ScreenGameplay to GameState ... */
NoteData ndPost = ndPre;
NoteDataUtil::TransformNoteData( ndPost, m_pPlayerState->m_PlayerOptions.GetStage(), pSteps->m_StepsType );
NoteDataUtil::TransformNoteData(ndPost, *(pSteps->GetTimingData()), m_pPlayerState->m_PlayerOptions.GetStage(), pSteps->m_StepsType);
GAMESTATE->SetProcessedTimingData(pSteps->GetTimingData()); // XXX: Not sure why but NoteDataUtil::CalculateRadarValues segfaults without this
iTotalPossibleDancePoints += this->GetPossibleDancePoints( &ndPre, &ndPost, pSteps->GetTimingData(), pSong->m_fMusicLengthSeconds );
+4 -2
View File
@@ -120,8 +120,10 @@ const RadarValues &Trail::GetRadarValues() const
PlayerOptions po;
po.FromString( e->Modifiers );
if( po.ContainsTransformOrTurn() )
NoteDataUtil::TransformNoteData( nd, po, pSteps->m_StepsType );
NoteDataUtil::TransformNoteData( nd, e->Attacks, pSteps->m_StepsType, e->pSong );
{
NoteDataUtil::TransformNoteData(nd, *(pSteps->GetTimingData()), po, pSteps->m_StepsType);
}
NoteDataUtil::TransformNoteData(nd, *(pSteps->GetTimingData()), e->Attacks, pSteps->m_StepsType, e->pSong);
RadarValues transformed_rv;
NoteDataUtil::CalculateRadarValues( nd, e->pSong->m_fMusicLengthSeconds, transformed_rv );
GAMESTATE->SetProcessedTimingData(NULL);