Skip to content

Commit

Permalink
remove dead code relating to composite charts
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed Jul 24, 2018
1 parent 8c145b0 commit 24067c4
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 131 deletions.
15 changes: 0 additions & 15 deletions src/NoteData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,6 @@ void NoteData::SetNumTracks( int iNewNumTracks )
CalcNumTracksLCD();
}

bool NoteData::IsComposite() const
{
return false;
for( int track = 0; track < GetNumTracks(); ++track )
{
FOREACHM_CONST( int, TapNote, m_TapNotes[track], tn )
if( tn->second.pn != PLAYER_INVALID )
return true;
}
}

// Clear (rowBegin,rowEnd).
void NoteData::ClearRangeForTrack( int rowBegin, int rowEnd, int iTrack )
{
Expand Down Expand Up @@ -790,10 +779,6 @@ int NoteData::GetNumFakes( int iStartIndex, int iEndIndex ) const

bool NoteData::IsPlayer1(const int track, const TapNote &tn) const
{
if (this->IsComposite())
{
return tn.pn == PLAYER_1;
}
return track < (this->GetNumTracks() / 2);
}

Expand Down
1 change: 0 additions & 1 deletion src/NoteData.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ class NoteData

int GetNumTracks() const { return m_TapNotes.size(); }
void SetNumTracks( int iNewNumTracks );
bool IsComposite() const;
bool operator==( const NoteData &nd ) const { return m_TapNotes == nd.m_TapNotes; }
bool operator!=( const NoteData &nd ) const { return m_TapNotes != nd.m_TapNotes; }

Expand Down
110 changes: 3 additions & 107 deletions src/NoteDataUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ void NoteDataUtil::LoadFromETTNoteDataString( NoteData& out, const RString &sSMN
out.RevalidateATIs(vector<int>(), false);
}

void NoteDataUtil::LoadFromSMNoteDataString( NoteData &out, const RString &sSMNoteData_, bool bComposite )
void NoteDataUtil::LoadFromSMNoteDataString( NoteData &out, const RString &sSMNoteData_)
{
// Load note data
RString sSMNoteData;
Expand All @@ -520,31 +520,7 @@ void NoteDataUtil::LoadFromSMNoteDataString( NoteData &out, const RString &sSMNo
int iNumTracks = out.GetNumTracks();
out.Init();
out.SetNumTracks( iNumTracks );

if( !bComposite )
{
LoadFromSMNoteDataStringWithPlayer( out, sSMNoteData, 0, sSMNoteData.size(),
PLAYER_INVALID, iNumTracks );
return;
}

int start = 0, size = -1;

vector<NoteData> vParts;
FOREACH_PlayerNumber( pn )
{
// Split in place.
split( sSMNoteData, "&", start, size, false );
if( unsigned(start) == sSMNoteData.size() )
break;
vParts.push_back( NoteData() );
NoteData &nd = vParts.back();

nd.SetNumTracks( iNumTracks );
LoadFromSMNoteDataStringWithPlayer( nd, sSMNoteData, start, size, pn, iNumTracks );
}
CombineCompositeNoteData( out, vParts );
out.RevalidateATIs(vector<int>(), false);
LoadFromSMNoteDataStringWithPlayer( out, sSMNoteData, 0, sSMNoteData.size(), PLAYER_INVALID, iNumTracks );
}

void NoteDataUtil::InsertHoldTails( NoteData &inout )
Expand Down Expand Up @@ -578,8 +554,6 @@ void NoteDataUtil::GetSMNoteDataString( const NoteData &in, RString &sRet )
vector<NoteData> parts;
float fLastBeat = -1.0f;

SplitCompositeNoteData( in, parts );

FOREACH( NoteData, parts, nd )
{
InsertHoldTails( *nd );
Expand Down Expand Up @@ -657,7 +631,6 @@ void NoteDataUtil::GetETTNoteDataString(const NoteData &in, RString &sRet) {
// Get note data
vector<NoteData> parts;
float fLastBeat = -1.f;
SplitCompositeNoteData(in, parts);

FOREACH(NoteData, parts, nd) {
fLastBeat = max(fLastBeat, nd->GetLastBeat());
Expand Down Expand Up @@ -810,72 +783,6 @@ void NoteDataUtil::GetETTNoteDataString(const NoteData &in, RString &sRet) {
sRet.shrink_to_fit();
}

void NoteDataUtil::SplitCompositeNoteData( const NoteData &in, vector<NoteData> &out )
{
if( !in.IsComposite() )
{
out.push_back( in );
return;
}

FOREACH_PlayerNumber( pn )
{
out.push_back( NoteData() );
out.back().SetNumTracks( in.GetNumTracks() );
}

for( int t = 0; t < in.GetNumTracks(); ++t )
{
for( NoteData::const_iterator iter = in.begin(t); iter != in.end(t); ++iter )
{
int row = iter->first;
TapNote tn = iter->second;
/*
XXX: This code is (hopefully) a temporary hack to make sure that
routine charts don't have any notes without players assigned to them.
I suspect this is due to a related bug that these problems were
occuring to begin with, but at this time, I am unsure how to deal with it.
Hopefully this hack can be removed soon. -- Jason "Wolfman2000" Felds
*/
const Style *curStyle = GAMESTATE->GetCurrentStyle(PLAYER_INVALID);
if( (curStyle == NULL || curStyle->m_StyleType == StyleType_TwoPlayersSharedSides )
&& static_cast<int>( tn.pn ) > NUM_PlayerNumber )
{
tn.pn = PLAYER_1;
}
unsigned index = static_cast<int>( tn.pn );

ASSERT_M( index < NUM_PlayerNumber, ssprintf("We have a note not assigned to a player. The note in question is on beat %f, column %i.", NoteRowToBeat(row), t + 1) );
tn.pn = PLAYER_INVALID;
out[index].SetTapNote( t, row, tn );
}
}
}

void NoteDataUtil::CombineCompositeNoteData( NoteData &out, const vector<NoteData> &in )
{
FOREACH_CONST( NoteData, in, nd )
{
const int iMaxTracks = min( out.GetNumTracks(), nd->GetNumTracks() );

for( int track = 0; track < iMaxTracks; ++track )
{
for( NoteData::const_iterator i = nd->begin(track); i != nd->end(track); ++i )
{
int row = i->first;
if( out.IsHoldNoteAtRow(track, i->first) )
continue;
if( i->second.type == TapNoteType_HoldHead )
out.AddHoldNote( track, row, row + i->second.iDuration, i->second );
else
out.SetTapNote( track, row, i->second );
}
}
}
out.RevalidateATIs(vector<int>(), false);
}


void NoteDataUtil::LoadTransformedSlidingWindow( const NoteData &in, NoteData &out, int iNewNumTracks )
{
// reset all notes
Expand Down Expand Up @@ -1282,18 +1189,7 @@ void NoteDataUtil::RemoveSimultaneousNotes( NoteData &in, int iMaxSimultaneous,
// given time. Never touch data outside of the range given; if many hold notes are overlapping
// iStartIndex, and we'd have to change those holds to obey iMaxSimultaneous, just do the best
// we can without doing so.
if( in.IsComposite() )
{
// Do this per part.
vector<NoteData> vParts;

SplitCompositeNoteData( in, vParts );
FOREACH( NoteData, vParts, nd )
RemoveSimultaneousNotes( *nd, iMaxSimultaneous, iStartIndex, iEndIndex );
in.Init();
in.SetNumTracks( vParts.front().GetNumTracks() );
CombineCompositeNoteData( in, vParts );
}

FOREACH_NONEMPTY_ROW_ALL_TRACKS_RANGE( in, r, iStartIndex, iEndIndex )
{
set<int> viTracksHeld;
Expand Down
4 changes: 1 addition & 3 deletions src/NoteDataUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@ namespace NoteDataUtil
{
NoteType GetSmallestNoteTypeForMeasure( const NoteData &nd, int iMeasureIndex );
NoteType GetSmallestNoteTypeInRange( const NoteData &nd, int iStartIndex, int iEndIndex );
void LoadFromSMNoteDataString( NoteData &out, const RString &sSMNoteData, bool bComposite );
void LoadFromSMNoteDataString( NoteData &out, const RString &sSMNoteData);
void LoadFromETTNoteDataString(NoteData& out, const RString &sSMNoteData);
void GetSMNoteDataString( const NoteData &in, RString &notes_out );
void GetETTNoteDataString(const NoteData &in, RString &notes_out);
void SplitCompositeNoteData( const NoteData &in, vector<NoteData> &out );
void CombineCompositeNoteData( NoteData &out, const vector<NoteData> &in );
/**
* @brief Autogenerate notes from one type to another.
*
Expand Down
6 changes: 1 addition & 5 deletions src/Steps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,14 +325,10 @@ void Steps::Decompress() {
/* there is no data, do nothing */
return;
}


// load from compressed
bool bComposite = false;
m_bNoteDataIsFilled = true;
m_pNoteData->SetNumTracks(GAMEMAN->GetStepsTypeInfo(m_StepsType).iNumTracks);
NoteDataUtil::LoadFromSMNoteDataString(*m_pNoteData, m_sNoteDataCompressed, bComposite);

NoteDataUtil::LoadFromSMNoteDataString(*m_pNoteData, m_sNoteDataCompressed);
}

bool Steps::IsRecalcValid() {
Expand Down

0 comments on commit 24067c4

Please sign in to comment.