clean up NoteData
This commit is contained in:
+24
-13
@@ -37,6 +37,17 @@ NoteData::~NoteData()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int NoteData::GetNumTracks()
|
||||||
|
{
|
||||||
|
return m_iNumTracks;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NoteData::SetNumTracks( int iNewNumTracks )
|
||||||
|
{
|
||||||
|
m_iNumTracks = iNewNumTracks;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Clear [iNoteIndexBegin,iNoteIndexEnd]; that is, including iNoteIndexEnd. */
|
/* Clear [iNoteIndexBegin,iNoteIndexEnd]; that is, including iNoteIndexEnd. */
|
||||||
void NoteData::ClearRange( int iNoteIndexBegin, int iNoteIndexEnd )
|
void NoteData::ClearRange( int iNoteIndexBegin, int iNoteIndexEnd )
|
||||||
{
|
{
|
||||||
@@ -566,9 +577,9 @@ NoteType NoteDataUtil::GetSmallestNoteTypeForMeasure( const NoteData &n, int iMe
|
|||||||
void NoteDataUtil::LoadFromSMNoteDataString( NoteData &out, CString sSMNoteData )
|
void NoteDataUtil::LoadFromSMNoteDataString( NoteData &out, CString sSMNoteData )
|
||||||
{
|
{
|
||||||
/* Clear notes, but keep the same number of tracks. */
|
/* Clear notes, but keep the same number of tracks. */
|
||||||
int iNumTracks = out.m_iNumTracks;
|
int iNumTracks = out.GetNumTracks();
|
||||||
out.Init();
|
out.Init();
|
||||||
out.m_iNumTracks = iNumTracks;
|
out.SetNumTracks( iNumTracks );
|
||||||
|
|
||||||
// strip comments out of sSMNoteData
|
// strip comments out of sSMNoteData
|
||||||
while( sSMNoteData.Find("//") != -1 )
|
while( sSMNoteData.Find("//") != -1 )
|
||||||
@@ -611,7 +622,7 @@ void NoteDataUtil::LoadFromSMNoteDataString( NoteData &out, CString sSMNoteData
|
|||||||
// if( m_iNumTracks != sMeasureLine.GetLength() )
|
// if( m_iNumTracks != sMeasureLine.GetLength() )
|
||||||
// RageException::Throw( "Actual number of note columns (%d) is different from the NotesType (%d).", m_iNumTracks, sMeasureLine.GetLength() );
|
// RageException::Throw( "Actual number of note columns (%d) is different from the NotesType (%d).", m_iNumTracks, sMeasureLine.GetLength() );
|
||||||
|
|
||||||
for( int c=0; c<min(sMeasureLine.GetLength(),out.m_iNumTracks); c++ )
|
for( int c=0; c<min(sMeasureLine.GetLength(),out.GetNumTracks()); c++ )
|
||||||
{
|
{
|
||||||
TapNote t;
|
TapNote t;
|
||||||
switch(sMeasureLine[c])
|
switch(sMeasureLine[c])
|
||||||
@@ -655,7 +666,7 @@ CString NoteDataUtil::GetSMNoteDataString(NoteData &in)
|
|||||||
|
|
||||||
for( int r=iMeasureStartRow; r<=iMeasureLastRow; r+=iRowSpacing )
|
for( int r=iMeasureStartRow; r<=iMeasureLastRow; r+=iRowSpacing )
|
||||||
{
|
{
|
||||||
for( int t=0; t<in.m_iNumTracks; t++ ) {
|
for( int t=0; t<in.GetNumTracks(); t++ ) {
|
||||||
char c;
|
char c;
|
||||||
switch(in.GetTapNote(t, r)) {
|
switch(in.GetTapNote(t, r)) {
|
||||||
case TAP_EMPTY: c = '0'; break;
|
case TAP_EMPTY: c = '0'; break;
|
||||||
@@ -783,8 +794,8 @@ void NoteDataUtil::Turn( NoteData &in, PlayerOptions::TurnType tt )
|
|||||||
case PlayerOptions::TURN_NONE:
|
case PlayerOptions::TURN_NONE:
|
||||||
return; // nothing to do
|
return; // nothing to do
|
||||||
case PlayerOptions::TURN_MIRROR:
|
case PlayerOptions::TURN_MIRROR:
|
||||||
for( t=0; t<in.m_iNumTracks; t++ )
|
for( t=0; t<in.GetNumTracks(); t++ )
|
||||||
iTakeFromTrack[t] = in.m_iNumTracks-t-1;
|
iTakeFromTrack[t] = in.GetNumTracks()-t-1;
|
||||||
break;
|
break;
|
||||||
case PlayerOptions::TURN_LEFT:
|
case PlayerOptions::TURN_LEFT:
|
||||||
case PlayerOptions::TURN_RIGHT: // HACK: TurnRight does the same thing as TurnLeft. I'll fix this later...
|
case PlayerOptions::TURN_RIGHT: // HACK: TurnRight does the same thing as TurnLeft. I'll fix this later...
|
||||||
@@ -859,10 +870,10 @@ void NoteDataUtil::Turn( NoteData &in, PlayerOptions::TurnType tt )
|
|||||||
case PlayerOptions::TURN_SUPER_SHUFFLE: // use this code to shuffle the HoldNotes
|
case PlayerOptions::TURN_SUPER_SHUFFLE: // use this code to shuffle the HoldNotes
|
||||||
{
|
{
|
||||||
vector<int> aiTracksLeftToMap;
|
vector<int> aiTracksLeftToMap;
|
||||||
for( t=0; t<in.m_iNumTracks; t++ )
|
for( t=0; t<in.GetNumTracks(); t++ )
|
||||||
aiTracksLeftToMap.push_back( t );
|
aiTracksLeftToMap.push_back( t );
|
||||||
|
|
||||||
for( t=0; t<in.m_iNumTracks; t++ )
|
for( t=0; t<in.GetNumTracks(); t++ )
|
||||||
{
|
{
|
||||||
int iRandTrackIndex = rand()%aiTracksLeftToMap.size();
|
int iRandTrackIndex = rand()%aiTracksLeftToMap.size();
|
||||||
int iRandTrack = aiTracksLeftToMap[iRandTrackIndex];
|
int iRandTrack = aiTracksLeftToMap[iRandTrackIndex];
|
||||||
@@ -885,7 +896,7 @@ void NoteDataUtil::Turn( NoteData &in, PlayerOptions::TurnType tt )
|
|||||||
|
|
||||||
// transform notes
|
// transform notes
|
||||||
int max_row = in.GetLastRow();
|
int max_row = in.GetLastRow();
|
||||||
for( t=0; t<in.m_iNumTracks; t++ )
|
for( t=0; t<in.GetNumTracks(); t++ )
|
||||||
for( int r=0; r<=max_row; r++ )
|
for( int r=0; r<=max_row; r++ )
|
||||||
tempNoteData.SetTapNote(t, r, in.GetTapNote(iTakeFromTrack[t], r));
|
tempNoteData.SetTapNote(t, r, in.GetTapNote(iTakeFromTrack[t], r));
|
||||||
|
|
||||||
@@ -919,11 +930,11 @@ void NoteDataUtil::Turn( NoteData &in, PlayerOptions::TurnType tt )
|
|||||||
|
|
||||||
// shuffle this row
|
// shuffle this row
|
||||||
vector<int> aiTracksThatCouldHaveTapNotes;
|
vector<int> aiTracksThatCouldHaveTapNotes;
|
||||||
for( t=0; t<in.m_iNumTracks; t++ )
|
for( t=0; t<in.GetNumTracks(); t++ )
|
||||||
if( in.GetTapNote(t, r) != TAP_HOLD ) // any point that isn't part of a hold
|
if( in.GetTapNote(t, r) != TAP_HOLD ) // any point that isn't part of a hold
|
||||||
aiTracksThatCouldHaveTapNotes.push_back( t );
|
aiTracksThatCouldHaveTapNotes.push_back( t );
|
||||||
|
|
||||||
for( t=0; t<in.m_iNumTracks; t++ )
|
for( t=0; t<in.GetNumTracks(); t++ )
|
||||||
{
|
{
|
||||||
if( in.GetTapNote(t, r) != TAP_HOLD && in.GetTapNote(t, r) != TAP_EMPTY ) // there is a tap note here (and not a HoldNote)
|
if( in.GetTapNote(t, r) != TAP_HOLD && in.GetTapNote(t, r) != TAP_EMPTY ) // there is a tap note here (and not a HoldNote)
|
||||||
{
|
{
|
||||||
@@ -950,7 +961,7 @@ void NoteDataUtil::MakeLittle(NoteData &in)
|
|||||||
if( i%ROWS_PER_BEAT != 0 )
|
if( i%ROWS_PER_BEAT != 0 )
|
||||||
{
|
{
|
||||||
// filter out all non-quarter notes
|
// filter out all non-quarter notes
|
||||||
for( int c=0; c<in.m_iNumTracks; c++ )
|
for( int c=0; c<in.GetNumTracks(); c++ )
|
||||||
{
|
{
|
||||||
in.SetTapNote(c, i, TAP_EMPTY);
|
in.SetTapNote(c, i, TAP_EMPTY);
|
||||||
}
|
}
|
||||||
@@ -1001,7 +1012,7 @@ void NoteDataUtil::SnapToNearestNoteType( NoteData &in, NoteType nt1, NoteType n
|
|||||||
float fNewBeat = bNewBeat1IsCloser ? fNewBeat1 : fNewBeat2;
|
float fNewBeat = bNewBeat1IsCloser ? fNewBeat1 : fNewBeat2;
|
||||||
int iNewIndex = BeatToNoteRow( fNewBeat );
|
int iNewIndex = BeatToNoteRow( fNewBeat );
|
||||||
|
|
||||||
for( int c=0; c<in.m_iNumTracks; c++ )
|
for( int c=0; c<in.GetNumTracks(); c++ )
|
||||||
{
|
{
|
||||||
TapNote note = in.GetTapNote(c, iOldIndex);
|
TapNote note = in.GetTapNote(c, iOldIndex);
|
||||||
in.SetTapNote(c, iOldIndex, TAP_EMPTY);
|
in.SetTapNote(c, iOldIndex, TAP_EMPTY);
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ class NoteData
|
|||||||
{
|
{
|
||||||
/* Keep this aligned, so that they all have the same size. */
|
/* Keep this aligned, so that they all have the same size. */
|
||||||
vector<TapNote> m_TapNotes[MAX_NOTE_TRACKS];
|
vector<TapNote> m_TapNotes[MAX_NOTE_TRACKS];
|
||||||
|
int m_iNumTracks;
|
||||||
|
|
||||||
vector<HoldNote> m_HoldNotes;
|
vector<HoldNote> m_HoldNotes;
|
||||||
|
|
||||||
/* Pad m_TapNotes so it includes the row "rows". */
|
/* Pad m_TapNotes so it includes the row "rows". */
|
||||||
@@ -37,12 +39,13 @@ public:
|
|||||||
* divisor. Doesn't allocate or copy anything. */
|
* divisor. Doesn't allocate or copy anything. */
|
||||||
void Config( const NoteData &From );
|
void Config( const NoteData &From );
|
||||||
|
|
||||||
int m_iNumTracks;
|
|
||||||
|
|
||||||
NoteData();
|
NoteData();
|
||||||
~NoteData();
|
~NoteData();
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
|
int GetNumTracks();
|
||||||
|
void SetNumTracks( int iNewNumTracks );
|
||||||
|
|
||||||
/* Return the note at the given track and row. Row may be out of
|
/* Return the note at the given track and row. Row may be out of
|
||||||
* range; pretend the song goes on with TAP_EMPTYs indefinitely. */
|
* range; pretend the song goes on with TAP_EMPTYs indefinitely. */
|
||||||
inline TapNote GetTapNote(unsigned track, unsigned row) const
|
inline TapNote GetTapNote(unsigned track, unsigned row) const
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ int NoteDataWithScoring::GetNumTapNotesWithScore( TapNoteScore tns, const float
|
|||||||
|
|
||||||
for( unsigned i=iStartIndex; i<min(iEndIndex, m_TapNoteScores[0].size()); i++ )
|
for( unsigned i=iStartIndex; i<min(iEndIndex, m_TapNoteScores[0].size()); i++ )
|
||||||
{
|
{
|
||||||
for( int t=0; t<m_iNumTracks; t++ )
|
for( int t=0; t<GetNumTracks(); t++ )
|
||||||
{
|
{
|
||||||
if( this->GetTapNote(t, i) != TAP_EMPTY && GetTapNoteScore(t, i) == tns )
|
if( this->GetTapNote(t, i) != TAP_EMPTY && GetTapNoteScore(t, i) == tns )
|
||||||
iNumSuccessfulTapNotes++;
|
iNumSuccessfulTapNotes++;
|
||||||
@@ -60,7 +60,7 @@ int NoteDataWithScoring::GetNumDoublesWithScore( TapNoteScore tns, const float f
|
|||||||
{
|
{
|
||||||
int iNumNotesThisIndex = 0;
|
int iNumNotesThisIndex = 0;
|
||||||
TapNoteScore minTapNoteScore = TNS_MARVELOUS;
|
TapNoteScore minTapNoteScore = TNS_MARVELOUS;
|
||||||
for( int t=0; t<m_iNumTracks; t++ )
|
for( int t=0; t<GetNumTracks(); t++ )
|
||||||
{
|
{
|
||||||
if( GetTapNote(t, i) != TAP_EMPTY )
|
if( GetTapNote(t, i) != TAP_EMPTY )
|
||||||
{
|
{
|
||||||
@@ -90,7 +90,7 @@ int NoteDataWithScoring::GetNumHoldNotesWithScore( HoldNoteScore hns, const floa
|
|||||||
|
|
||||||
bool NoteDataWithScoring::IsRowComplete( int index )
|
bool NoteDataWithScoring::IsRowComplete( int index )
|
||||||
{
|
{
|
||||||
for( int t=0; t<m_iNumTracks; t++ )
|
for( int t=0; t<GetNumTracks(); t++ )
|
||||||
if( GetTapNote(t, index) != TAP_EMPTY && GetTapNoteScore(t, index) < TNS_GREAT )
|
if( GetTapNote(t, index) != TAP_EMPTY && GetTapNoteScore(t, index) < TNS_GREAT )
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -61,10 +61,10 @@ void NoteField::Load( NoteData* pNoteData, PlayerNumber pn, int iFirstPixelToDra
|
|||||||
this->CopyAll( pNoteData );
|
this->CopyAll( pNoteData );
|
||||||
|
|
||||||
// init note displays
|
// init note displays
|
||||||
for( int c=0; c<m_iNumTracks; c++ )
|
for( int c=0; c<GetNumTracks(); c++ )
|
||||||
m_NoteDisplay[c].Load( c, pn );
|
m_NoteDisplay[c].Load( c, pn );
|
||||||
|
|
||||||
ASSERT( m_iNumTracks == GAMESTATE->GetCurrentStyleDef()->m_iColsPerPlayer );
|
ASSERT( GetNumTracks() == GAMESTATE->GetCurrentStyleDef()->m_iColsPerPlayer );
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoteField::Update( float fDeltaTime )
|
void NoteField::Update( float fDeltaTime )
|
||||||
@@ -84,7 +84,7 @@ void NoteField::DrawMeasureBar( int iMeasureIndex )
|
|||||||
const float fYPos = ArrowGetYPos( m_PlayerNumber, fYOffset );
|
const float fYPos = ArrowGetYPos( m_PlayerNumber, fYOffset );
|
||||||
|
|
||||||
m_rectMeasureBar.SetXY( 0, fYPos );
|
m_rectMeasureBar.SetXY( 0, fYPos );
|
||||||
m_rectMeasureBar.SetZoomX( (float)(m_iNumTracks+1) * ARROW_SIZE );
|
m_rectMeasureBar.SetZoomX( (float)(GetNumTracks()+1) * ARROW_SIZE );
|
||||||
m_rectMeasureBar.SetZoomY( 20 );
|
m_rectMeasureBar.SetZoomY( 20 );
|
||||||
m_rectMeasureBar.SetDiffuse( RageColor(0,0,0,0.5f) );
|
m_rectMeasureBar.SetDiffuse( RageColor(0,0,0,0.5f) );
|
||||||
m_rectMeasureBar.Draw();
|
m_rectMeasureBar.Draw();
|
||||||
@@ -102,7 +102,7 @@ void NoteField::DrawMarkerBar( const float fBeat )
|
|||||||
const float fYPos = ArrowGetYPos( m_PlayerNumber, fYOffset );
|
const float fYPos = ArrowGetYPos( m_PlayerNumber, fYOffset );
|
||||||
|
|
||||||
m_rectMarkerBar.SetXY( 0, fYPos );
|
m_rectMarkerBar.SetXY( 0, fYPos );
|
||||||
m_rectMarkerBar.SetZoomX( (float)(m_iNumTracks+1) * ARROW_SIZE );
|
m_rectMarkerBar.SetZoomX( (float)(GetNumTracks()+1) * ARROW_SIZE );
|
||||||
m_rectMarkerBar.SetZoomY( 20 );
|
m_rectMarkerBar.SetZoomY( 20 );
|
||||||
m_rectMarkerBar.SetDiffuse( RageColor(0,0,0,0.5f) );
|
m_rectMarkerBar.SetDiffuse( RageColor(0,0,0,0.5f) );
|
||||||
m_rectMarkerBar.Draw();
|
m_rectMarkerBar.Draw();
|
||||||
@@ -249,7 +249,7 @@ void NoteField::DrawPrimitives()
|
|||||||
// draw in big batches.
|
// draw in big batches.
|
||||||
//
|
//
|
||||||
|
|
||||||
for( int c=0; c<m_iNumTracks; c++ ) // for each arrow column
|
for( int c=0; c<GetNumTracks(); c++ ) // for each arrow column
|
||||||
{
|
{
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
// Draw all HoldNotes in this column (so that they appear under the tap notes)
|
// Draw all HoldNotes in this column (so that they appear under the tap notes)
|
||||||
@@ -295,7 +295,7 @@ void NoteField::DrawPrimitives()
|
|||||||
|
|
||||||
// See if there is a hold step that begins on this index.
|
// See if there is a hold step that begins on this index.
|
||||||
bool bHoldNoteBeginsOnThisBeat = false;
|
bool bHoldNoteBeginsOnThisBeat = false;
|
||||||
for( int c2=0; c2<m_iNumTracks; c2++ )
|
for( int c2=0; c2<GetNumTracks(); c2++ )
|
||||||
{
|
{
|
||||||
if( GetTapNote(c2, i) == TAP_HOLD_HEAD )
|
if( GetTapNote(c2, i) == TAP_HOLD_HEAD )
|
||||||
{
|
{
|
||||||
@@ -313,7 +313,7 @@ void NoteField::DrawPrimitives()
|
|||||||
|
|
||||||
void NoteField::RemoveTapNoteRow( int iIndex )
|
void NoteField::RemoveTapNoteRow( int iIndex )
|
||||||
{
|
{
|
||||||
for( int c=0; c<m_iNumTracks; c++ )
|
for( int c=0; c<GetNumTracks(); c++ )
|
||||||
SetTapNote(c, iIndex, TAP_EMPTY);
|
SetTapNote(c, iIndex, TAP_EMPTY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ Notes::~Notes()
|
|||||||
|
|
||||||
void Notes::SetNoteData( NoteData* pNewNoteData )
|
void Notes::SetNoteData( NoteData* pNewNoteData )
|
||||||
{
|
{
|
||||||
ASSERT( pNewNoteData->m_iNumTracks == GameManager::NotesTypeToNumTracks(m_NotesType) );
|
ASSERT( pNewNoteData->GetNumTracks() == GameManager::NotesTypeToNumTracks(m_NotesType) );
|
||||||
|
|
||||||
DeAutogen();
|
DeAutogen();
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ void Notes::GetNoteData( NoteData* pNoteDataOut ) const
|
|||||||
ASSERT(this);
|
ASSERT(this);
|
||||||
ASSERT(pNoteDataOut);
|
ASSERT(pNoteDataOut);
|
||||||
Decompress();
|
Decompress();
|
||||||
pNoteDataOut->m_iNumTracks = notes->m_iNumTracks;
|
pNoteDataOut->SetNumTracks( notes->GetNumTracks() );
|
||||||
*pNoteDataOut = *notes;
|
*pNoteDataOut = *notes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,11 +218,11 @@ void Notes::Decompress() const
|
|||||||
parent->GetNoteData(&pdata);
|
parent->GetNoteData(&pdata);
|
||||||
|
|
||||||
notes = new NoteData;
|
notes = new NoteData;
|
||||||
notes->m_iNumTracks = GameManager::NotesTypeToNumTracks(m_NotesType);
|
notes->SetNumTracks( GameManager::NotesTypeToNumTracks(m_NotesType) );
|
||||||
if(pdata.m_iNumTracks == notes->m_iNumTracks)
|
if(pdata.GetNumTracks() == notes->GetNumTracks())
|
||||||
notes->CopyRange( &pdata, 0, pdata.GetLastRow(), 0 );
|
notes->CopyRange( &pdata, 0, pdata.GetLastRow(), 0 );
|
||||||
else
|
else
|
||||||
notes->LoadTransformedSlidingWindow( &pdata, notes->m_iNumTracks );
|
notes->LoadTransformedSlidingWindow( &pdata, notes->GetNumTracks() );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -230,7 +230,7 @@ void Notes::Decompress() const
|
|||||||
if(!notes_comp) return; /* no data is no data */
|
if(!notes_comp) return; /* no data is no data */
|
||||||
|
|
||||||
notes = new NoteData;
|
notes = new NoteData;
|
||||||
notes->m_iNumTracks = GameManager::NotesTypeToNumTracks(m_NotesType);
|
notes->SetNumTracks( GameManager::NotesTypeToNumTracks(m_NotesType) );
|
||||||
|
|
||||||
NoteDataUtil::LoadFromSMNoteDataString(*notes, *notes_comp);
|
NoteDataUtil::LoadFromSMNoteDataString(*notes, *notes_comp);
|
||||||
}
|
}
|
||||||
@@ -298,7 +298,7 @@ void Notes::CopyFrom( Notes* pSource, NotesType ntTo ) // pSource does not have
|
|||||||
m_NotesType = ntTo;
|
m_NotesType = ntTo;
|
||||||
NoteData noteData;
|
NoteData noteData;
|
||||||
pSource->GetNoteData( ¬eData );
|
pSource->GetNoteData( ¬eData );
|
||||||
noteData.m_iNumTracks = GameManager::NotesTypeToNumTracks(ntTo);
|
noteData.SetNumTracks( GameManager::NotesTypeToNumTracks(ntTo) );
|
||||||
this->SetNoteData( ¬eData );
|
this->SetNoteData( ¬eData );
|
||||||
this->SetDescription( "Copied from "+pSource->GetDescription() );
|
this->SetDescription( "Copied from "+pSource->GetDescription() );
|
||||||
this->SetDifficulty( pSource->GetDifficulty() );
|
this->SetDifficulty( pSource->GetDifficulty() );
|
||||||
@@ -313,7 +313,7 @@ void Notes::CreateBlank( NotesType ntTo )
|
|||||||
{
|
{
|
||||||
m_NotesType = ntTo;
|
m_NotesType = ntTo;
|
||||||
NoteData noteData;
|
NoteData noteData;
|
||||||
noteData.m_iNumTracks = GameManager::NotesTypeToNumTracks(ntTo);
|
noteData.SetNumTracks( GameManager::NotesTypeToNumTracks(ntTo) );
|
||||||
this->SetNoteData( ¬eData );
|
this->SetNoteData( ¬eData );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ bool BMSLoader::LoadFromBMSFile( const CString &sPath, Notes &out )
|
|||||||
out.m_NotesType = NOTES_TYPE_INVALID;
|
out.m_NotesType = NOTES_TYPE_INVALID;
|
||||||
|
|
||||||
NoteData* pNoteData = new NoteData;
|
NoteData* pNoteData = new NoteData;
|
||||||
pNoteData->m_iNumTracks = MAX_NOTE_TRACKS;
|
pNoteData->SetNumTracks( MAX_NOTE_TRACKS );
|
||||||
|
|
||||||
ifstream file(sPath);
|
ifstream file(sPath);
|
||||||
if( file.bad() )
|
if( file.bad() )
|
||||||
@@ -230,7 +230,7 @@ bool BMSLoader::LoadFromBMSFile( const CString &sPath, Notes &out )
|
|||||||
}
|
}
|
||||||
|
|
||||||
NoteData* pNoteData2 = new NoteData;
|
NoteData* pNoteData2 = new NoteData;
|
||||||
pNoteData2->m_iNumTracks = iNumNewTracks;
|
pNoteData2->SetNumTracks( iNumNewTracks );
|
||||||
pNoteData2->LoadTransformed( pNoteData, iNumNewTracks, iTransformNewToOld );
|
pNoteData2->LoadTransformed( pNoteData, iNumNewTracks, iTransformNewToOld );
|
||||||
|
|
||||||
out.SetNoteData(pNoteData2);
|
out.SetNoteData(pNoteData2);
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ bool DWILoader::LoadFromDWITokens(
|
|||||||
|
|
||||||
NoteData* pNoteData = new NoteData;
|
NoteData* pNoteData = new NoteData;
|
||||||
ASSERT( pNoteData );
|
ASSERT( pNoteData );
|
||||||
pNoteData->m_iNumTracks = mapDanceNoteToNoteDataColumn.size();
|
pNoteData->SetNumTracks( mapDanceNoteToNoteDataColumn.size() );
|
||||||
|
|
||||||
for( int pad=0; pad<2; pad++ ) // foreach pad
|
for( int pad=0; pad<2; pad++ ) // foreach pad
|
||||||
{
|
{
|
||||||
@@ -236,7 +236,7 @@ bool DWILoader::LoadFromDWITokens(
|
|||||||
// this will expand the HoldNote begin markers we wrote into actual HoldNotes
|
// this will expand the HoldNote begin markers we wrote into actual HoldNotes
|
||||||
pNoteData->Convert2sAnd3sToHoldNotes();
|
pNoteData->Convert2sAnd3sToHoldNotes();
|
||||||
|
|
||||||
ASSERT( pNoteData->m_iNumTracks > 0 );
|
ASSERT( pNoteData->GetNumTracks() > 0 );
|
||||||
|
|
||||||
out.SetNoteData(pNoteData);
|
out.SetNoteData(pNoteData);
|
||||||
|
|
||||||
|
|||||||
@@ -75,14 +75,14 @@ bool KSFLoader::LoadFromKSFFile( const CString &sPath, Notes &out )
|
|||||||
if(!out.GetMeter()) out.SetMeter(5);
|
if(!out.GetMeter()) out.SetMeter(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
notedata.m_iNumTracks = 5;
|
notedata.SetNumTracks( 5 );
|
||||||
out.m_NotesType = NOTES_TYPE_PUMP_SINGLE;
|
out.m_NotesType = NOTES_TYPE_PUMP_SINGLE;
|
||||||
if( sFName.Find("double") != -1 )
|
if( sFName.Find("double") != -1 )
|
||||||
{
|
{
|
||||||
notedata.m_iNumTracks = 10;
|
notedata.SetNumTracks( 10 );
|
||||||
out.m_NotesType = NOTES_TYPE_PUMP_DOUBLE;
|
out.m_NotesType = NOTES_TYPE_PUMP_DOUBLE;
|
||||||
} else if( sFName.Find("_2") != -1 ) {
|
} else if( sFName.Find("_2") != -1 ) {
|
||||||
notedata.m_iNumTracks = 10;
|
notedata.SetNumTracks( 10 );
|
||||||
out.m_NotesType = NOTES_TYPE_PUMP_COUPLE;
|
out.m_NotesType = NOTES_TYPE_PUMP_COUPLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -112,7 +112,7 @@ bool KSFLoader::LoadFromKSFFile( const CString &sPath, Notes &out )
|
|||||||
// the length of a note in a row depends on TICKCOUNT
|
// the length of a note in a row depends on TICKCOUNT
|
||||||
float fBeatThisRow = r/(float)iTickCount;
|
float fBeatThisRow = r/(float)iTickCount;
|
||||||
int row = BeatToNoteRow(fBeatThisRow);
|
int row = BeatToNoteRow(fBeatThisRow);
|
||||||
for( int t=0; t < notedata.m_iNumTracks; t++ )
|
for( int t=0; t < notedata.GetNumTracks(); t++ )
|
||||||
{
|
{
|
||||||
if( sRowString[t] == '4' )
|
if( sRowString[t] == '4' )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -335,7 +335,7 @@ void Player::DrawPrimitives()
|
|||||||
|
|
||||||
m_frameJudgement.Draw();
|
m_frameJudgement.Draw();
|
||||||
|
|
||||||
for( int c=0; c<m_iNumTracks; c++ )
|
for( int c=0; c<GetNumTracks(); c++ )
|
||||||
m_HoldJudgement[c].Draw();
|
m_HoldJudgement[c].Draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -346,7 +346,7 @@ void Player::Step( int col )
|
|||||||
|
|
||||||
//LOG->Trace( "Player::HandlePlayerStep()" );
|
//LOG->Trace( "Player::HandlePlayerStep()" );
|
||||||
|
|
||||||
ASSERT( col >= 0 && col <= m_iNumTracks );
|
ASSERT( col >= 0 && col <= GetNumTracks() );
|
||||||
|
|
||||||
const float fSongBeat = GAMESTATE->m_fSongBeat;
|
const float fSongBeat = GAMESTATE->m_fSongBeat;
|
||||||
|
|
||||||
@@ -447,7 +447,7 @@ void Player::Step( int col )
|
|||||||
|
|
||||||
if (score > TNS_NONE) {
|
if (score > TNS_NONE) {
|
||||||
bool bRowDestroyed = true;
|
bool bRowDestroyed = true;
|
||||||
for( int t=0; t<m_iNumTracks; t++ ) // did this complete the elimination of the row?
|
for( int t=0; t<GetNumTracks(); t++ ) // did this complete the elimination of the row?
|
||||||
{
|
{
|
||||||
if( GetTapNote(t, iIndexOverlappingNote) != TAP_EMPTY && // there is a note here
|
if( GetTapNote(t, iIndexOverlappingNote) != TAP_EMPTY && // there is a note here
|
||||||
GetTapNoteScore(t, iIndexOverlappingNote) == TNS_NONE ) // and it doesn't have a score
|
GetTapNoteScore(t, iIndexOverlappingNote) == TNS_NONE ) // and it doesn't have a score
|
||||||
@@ -471,7 +471,7 @@ void Player::OnRowDestroyed( int iIndexThatWasSteppedOn )
|
|||||||
|
|
||||||
// find the minimum score of the row
|
// find the minimum score of the row
|
||||||
TapNoteScore score = TNS_MARVELOUS;
|
TapNoteScore score = TNS_MARVELOUS;
|
||||||
for( int t=0; t<m_iNumTracks; t++ )
|
for( int t=0; t<GetNumTracks(); t++ )
|
||||||
{
|
{
|
||||||
TapNoteScore tns = GetTapNoteScore(t, iIndexThatWasSteppedOn);
|
TapNoteScore tns = GetTapNoteScore(t, iIndexThatWasSteppedOn);
|
||||||
if( tns >= TNS_BOO )
|
if( tns >= TNS_BOO )
|
||||||
@@ -502,7 +502,7 @@ void Player::OnRowDestroyed( int iIndexThatWasSteppedOn )
|
|||||||
}
|
}
|
||||||
|
|
||||||
int iNumNotesInThisRow = 0;
|
int iNumNotesInThisRow = 0;
|
||||||
for( int c=0; c<m_iNumTracks; c++ ) // for each column
|
for( int c=0; c<GetNumTracks(); c++ ) // for each column
|
||||||
{
|
{
|
||||||
if( GetTapNote(c, iIndexThatWasSteppedOn) != TAP_EMPTY ) // if there is a note in this col
|
if( GetTapNote(c, iIndexThatWasSteppedOn) != TAP_EMPTY ) // if there is a note in this col
|
||||||
{
|
{
|
||||||
@@ -565,7 +565,7 @@ int Player::UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat )
|
|||||||
for( int r=iStartCheckingAt; r<iMissIfOlderThanThisIndex; r++ )
|
for( int r=iStartCheckingAt; r<iMissIfOlderThanThisIndex; r++ )
|
||||||
{
|
{
|
||||||
int iNumMissesThisRow = 0;
|
int iNumMissesThisRow = 0;
|
||||||
for( int t=0; t<m_iNumTracks; t++ )
|
for( int t=0; t<GetNumTracks(); t++ )
|
||||||
{
|
{
|
||||||
if( GetTapNote(t, r) != TAP_EMPTY && GetTapNoteScore(t, r) == TNS_NONE )
|
if( GetTapNote(t, r) != TAP_EMPTY && GetTapNoteScore(t, r) == TNS_NONE )
|
||||||
{
|
{
|
||||||
@@ -595,7 +595,7 @@ void Player::CrossedRow( int iNoteRow )
|
|||||||
if( PREFSMAN->m_bAutoPlay || GAMESTATE->m_bDemonstration )
|
if( PREFSMAN->m_bAutoPlay || GAMESTATE->m_bDemonstration )
|
||||||
{
|
{
|
||||||
// check to see if there's at the crossed row
|
// check to see if there's at the crossed row
|
||||||
for( int t=0; t<m_iNumTracks; t++ )
|
for( int t=0; t<GetNumTracks(); t++ )
|
||||||
{
|
{
|
||||||
if( GetTapNote(t, iNoteRow) != TAP_EMPTY )
|
if( GetTapNote(t, iNoteRow) != TAP_EMPTY )
|
||||||
this->Step( t );
|
this->Step( t );
|
||||||
|
|||||||
@@ -249,7 +249,7 @@ ScreenEdit::ScreenEdit()
|
|||||||
m_NoteFieldRecord.SetZoom( 1.0f );
|
m_NoteFieldRecord.SetZoom( 1.0f );
|
||||||
m_NoteFieldRecord.Load( ¬eData, PLAYER_1, -150, 350 );
|
m_NoteFieldRecord.Load( ¬eData, PLAYER_1, -150, 350 );
|
||||||
|
|
||||||
m_Clipboard.m_iNumTracks = m_NoteFieldEdit.m_iNumTracks;
|
m_Clipboard.SetNumTracks( m_NoteFieldEdit.GetNumTracks() );
|
||||||
|
|
||||||
m_Player.Load( PLAYER_1, ¬eData, NULL, NULL );
|
m_Player.Load( PLAYER_1, ¬eData, NULL, NULL );
|
||||||
m_Player.SetXY( PLAYER_X, PLAYER_Y );
|
m_Player.SetXY( PLAYER_X, PLAYER_Y );
|
||||||
@@ -715,7 +715,7 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
|
|||||||
const float fSongBeat = GAMESTATE->m_fSongBeat;
|
const float fSongBeat = GAMESTATE->m_fSongBeat;
|
||||||
const int iSongIndex = BeatToNoteRow( fSongBeat );
|
const int iSongIndex = BeatToNoteRow( fSongBeat );
|
||||||
|
|
||||||
if( iCol >= m_NoteFieldEdit.m_iNumTracks ) // this button is not in the range of columns for this StyleDef
|
if( iCol >= m_NoteFieldEdit.GetNumTracks() ) // this button is not in the range of columns for this StyleDef
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* XXX: easier to do with 4s */
|
/* XXX: easier to do with 4s */
|
||||||
@@ -784,7 +784,7 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
|
|||||||
const float fEndBeat = GAMESTATE->m_fSongBeat + fBeatsToMove;
|
const float fEndBeat = GAMESTATE->m_fSongBeat + fBeatsToMove;
|
||||||
|
|
||||||
// check to see if they're holding a button
|
// check to see if they're holding a button
|
||||||
for( int col=0; col<m_NoteFieldEdit.m_iNumTracks && col<=10; col++ )
|
for( int col=0; col<m_NoteFieldEdit.GetNumTracks() && col<=10; col++ )
|
||||||
{
|
{
|
||||||
const DeviceInput di(DEVICE_KEYBOARD, SDLK_1+col);
|
const DeviceInput di(DEVICE_KEYBOARD, SDLK_1+col);
|
||||||
|
|
||||||
@@ -937,7 +937,7 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
|
|||||||
|
|
||||||
// initialize m_NoteFieldRecord
|
// initialize m_NoteFieldRecord
|
||||||
m_NoteFieldRecord.ClearAll();
|
m_NoteFieldRecord.ClearAll();
|
||||||
m_NoteFieldRecord.m_iNumTracks = m_NoteFieldEdit.m_iNumTracks;
|
m_NoteFieldRecord.SetNumTracks( m_NoteFieldEdit.GetNumTracks() );
|
||||||
m_NoteFieldRecord.m_fBeginMarker = m_NoteFieldEdit.m_fBeginMarker;
|
m_NoteFieldRecord.m_fBeginMarker = m_NoteFieldEdit.m_fBeginMarker;
|
||||||
m_NoteFieldRecord.m_fEndMarker = m_NoteFieldEdit.m_fEndMarker;
|
m_NoteFieldRecord.m_fEndMarker = m_NoteFieldEdit.m_fEndMarker;
|
||||||
|
|
||||||
@@ -973,7 +973,7 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
|
|||||||
case SDLK_DELETE:
|
case SDLK_DELETE:
|
||||||
{
|
{
|
||||||
NoteData temp;
|
NoteData temp;
|
||||||
temp.m_iNumTracks = m_NoteFieldEdit.m_iNumTracks;
|
temp.SetNumTracks( m_NoteFieldEdit.GetNumTracks() );
|
||||||
int iTakeFromRow=0;
|
int iTakeFromRow=0;
|
||||||
int iPasteAtRow;
|
int iPasteAtRow;
|
||||||
switch( DeviceI.button )
|
switch( DeviceI.button )
|
||||||
|
|||||||
Reference in New Issue
Block a user