make TapNote a struct. Over time, more properties will move from the enums and into bit flags.

This commit is contained in:
Chris Danford
2004-09-12 05:56:24 +00:00
parent bc38866cda
commit d2a54cca31
26 changed files with 306 additions and 292 deletions
+3 -3
View File
@@ -335,9 +335,9 @@ void BeginnerHelper::Update( float fDeltaTime )
// Find all steps on this row, in order to show the correct animations // Find all steps on this row, in order to show the correct animations
int iStep = 0; int iStep = 0;
const int iNumTracks = m_NoteData[pn].GetNumTracks(); const int iNumTracks = m_NoteData[pn].GetNumTracks();
for(int k=0; k<iNumTracks; k++) for( int t=0; t<iNumTracks; t++ )
if(m_NoteData[pn].GetTapNote(k, iRow) == TAP_TAP) if( m_NoteData[pn].GetTapNote(t,iRow).type == TapNote::tap )
iStep |= 1 << k; iStep |= 1 << t;
// Assign new data // Assign new data
this->Step(pn, iStep); this->Step(pn, iStep);
+1
View File
@@ -17,6 +17,7 @@
#include "StyleUtil.h" #include "StyleUtil.h"
#include "ThemeManager.h" #include "ThemeManager.h"
#include "PrefsManager.h" #include "PrefsManager.h"
#include "Style.h"
#define SHOW_PLAY_MODE(pm) THEME->GetMetricB("CatalogXml",ssprintf("ShowPlayMode%s",PlayModeToString(pm).c_str())) #define SHOW_PLAY_MODE(pm) THEME->GetMetricB("CatalogXml",ssprintf("ShowPlayMode%s",PlayModeToString(pm).c_str()))
#define SHOW_STYLE(ps) THEME->GetMetricB("CatalogXml",ssprintf("ShowStyle%s",Capitalize((ps)->m_szName).c_str())) #define SHOW_STYLE(ps) THEME->GetMetricB("CatalogXml",ssprintf("ShowStyle%s",Capitalize((ps)->m_szName).c_str()))
+1
View File
@@ -15,6 +15,7 @@
#include "MemoryCardManager.h" #include "MemoryCardManager.h"
#include "song.h" #include "song.h"
#include "Game.h" #include "Game.h"
#include "Style.h"
void ModeChoice::Init() void ModeChoice::Init()
{ {
+71 -66
View File
@@ -90,15 +90,15 @@ void NoteData::CopyRange( const NoteData* pFrom, int iFromIndexBegin, int iFromI
{ {
for( int c=0; c<m_iNumTracks; c++ ) for( int c=0; c<m_iNumTracks; c++ )
{ {
TapNote tn = From.GetTapNote(c, f); TapNote tn = From.GetTapNote( c, f );
if( IsTapAttack(tn) ) if( tn.type == TapNote::attack )
{ {
Attack attack = From.GetAttackAt(c,f); Attack attack = From.GetAttackAt( c, f );
To.SetTapAttackNote( c, t, attack ); To.SetTapAttackNote( c, t, attack );
} }
else else
{ {
To.SetTapNote(c, t, tn); To.SetTapNote( c, t, tn );
} }
} }
f++; f++;
@@ -131,7 +131,7 @@ bool NoteData::IsRowEmpty( int index ) const
return true; return true;
for( int t=0; t<m_iNumTracks; t++ ) for( int t=0; t<m_iNumTracks; t++ )
if( GetTapNoteX(t, index) != TAP_EMPTY ) if( GetTapNoteX(t, index).type != TapNote::empty )
return false; return false;
return true; return true;
} }
@@ -144,7 +144,7 @@ bool NoteData::IsRangeEmpty( int track, int iIndexBegin, int iIndexEnd ) const
CLAMP( iIndexEnd, 0, GetNumRows()-1 ); CLAMP( iIndexEnd, 0, GetNumRows()-1 );
for( int i=iIndexBegin; i<=iIndexEnd; i++ ) for( int i=iIndexBegin; i<=iIndexEnd; i++ )
if( GetTapNoteX(track,i) != TAP_EMPTY ) if( GetTapNoteX(track,i).type != TapNote::empty )
return false; return false;
return true; return true;
} }
@@ -153,7 +153,7 @@ int NoteData::GetNumTapNonEmptyTracks( int index ) const
{ {
int iNum = 0; int iNum = 0;
for( int t=0; t<m_iNumTracks; t++ ) for( int t=0; t<m_iNumTracks; t++ )
if( GetTapNote(t, index) != TAP_EMPTY ) if( GetTapNote(t, index).type != TapNote::empty )
iNum++; iNum++;
return iNum; return iNum;
} }
@@ -161,7 +161,7 @@ int NoteData::GetNumTapNonEmptyTracks( int index ) const
void NoteData::GetTapNonEmptyTracks( int index, set<int>& addTo ) const void NoteData::GetTapNonEmptyTracks( int index, set<int>& addTo ) const
{ {
for( int t=0; t<m_iNumTracks; t++ ) for( int t=0; t<m_iNumTracks; t++ )
if( GetTapNote(t, index) != TAP_EMPTY ) if( GetTapNote(t, index).type != TapNote::empty )
addTo.insert(t); addTo.insert(t);
} }
@@ -172,7 +172,7 @@ int NoteData::GetFirstNonEmptyTrack( int index ) const
return 0; return 0;
for( int t=0; t<m_iNumTracks; t++ ) for( int t=0; t<m_iNumTracks; t++ )
if( GetTapNoteX( t, index ) != TAP_EMPTY ) if( GetTapNoteX( t, index ).type != TapNote::empty )
return t; return t;
return -1; return -1;
} }
@@ -187,7 +187,7 @@ int NoteData::GetNumTracksWithTap( int index ) const
for( int t=0; t<m_iNumTracks; t++ ) for( int t=0; t<m_iNumTracks; t++ )
{ {
TapNote tn = GetTapNoteX( t, index ); TapNote tn = GetTapNoteX( t, index );
if( tn == TAP_TAP ) if( tn.type == TapNote::tap )
iNum++; iNum++;
} }
return iNum; return iNum;
@@ -203,7 +203,7 @@ int NoteData::GetNumTracksWithTapOrHoldHead( int index ) const
for( int t=0; t<m_iNumTracks; t++ ) for( int t=0; t<m_iNumTracks; t++ )
{ {
TapNote tn = GetTapNoteX( t, index ); TapNote tn = GetTapNoteX( t, index );
if( tn == TAP_TAP || tn == TAP_ADDITION || tn == TAP_HOLD_HEAD ) if( tn.type == TapNote::tap || tn.type == TapNote::hold_head )
iNum++; iNum++;
} }
return iNum; return iNum;
@@ -218,7 +218,7 @@ int NoteData::GetFirstTrackWithTap( int index ) const
for( int t=0; t<m_iNumTracks; t++ ) for( int t=0; t<m_iNumTracks; t++ )
{ {
TapNote tn = GetTapNoteX( t, index ); TapNote tn = GetTapNoteX( t, index );
if( tn == TAP_TAP || tn == TAP_ADDITION ) if( tn.type == TapNote::tap )
return t; return t;
} }
return -1; return -1;
@@ -233,7 +233,7 @@ int NoteData::GetFirstTrackWithTapOrHoldHead( int index ) const
for( int t=0; t<m_iNumTracks; t++ ) for( int t=0; t<m_iNumTracks; t++ )
{ {
TapNote tn = GetTapNoteX( t, index ); TapNote tn = GetTapNoteX( t, index );
if( tn == TAP_TAP || tn == TAP_ADDITION || tn == TAP_HOLD_HEAD ) if( tn.type == TapNote::tap || tn.type == TapNote::hold_head )
return t; return t;
} }
return -1; return -1;
@@ -268,10 +268,10 @@ void NoteData::AddHoldNote( HoldNote add )
// delete TapNotes under this HoldNote // delete TapNotes under this HoldNote
for( i=iAddStartIndex+1; i<=iAddEndIndex; i++ ) for( i=iAddStartIndex+1; i<=iAddEndIndex; i++ )
SetTapNote(add.iTrack, i, TAP_EMPTY); SetTapNote( add.iTrack, i, TAP_EMPTY );
// add a tap note at the start of this hold // add a tap note at the start of this hold
SetTapNote(add.iTrack, iAddStartIndex, TAP_HOLD_HEAD); // Hold begin marker. Don't draw this, but do grade it. SetTapNote( add.iTrack, iAddStartIndex, TAP_ORIGINAL_HOLD_HEAD ); // Hold begin marker. Don't draw this, but do grade it.
m_HoldNotes.push_back(add); m_HoldNotes.push_back(add);
} }
@@ -309,24 +309,25 @@ void NoteData::SetTapAttackNote( int track, int row, Attack attack )
PruneUnusedAttacksFromMap(); PruneUnusedAttacksFromMap();
// find first unused attack index // find first unused attack index
TapNote tn; for( int i=0; i<MAX_NUM_ATTACKS; i++ )
for( tn = TAP_ATTACK_BEGIN; tn<=TAP_ATTACK_END; tn++ )
{ {
if( m_AttackMap.find(tn) == m_AttackMap.end() ) // this TapNote value is free to use if( m_AttackMap.find(i) == m_AttackMap.end() ) // this index is free to use
goto done_searching; {
m_AttackMap[i] = attack;
TapNote tn;
tn.Set( TapNote::attack, TapNote::original, i );
SetTapNote( track, row, tn );
return;
}
} }
// TODO: need to increase MAX_NUM_ATTACKS or handle "no more room" case
ASSERT(0); ASSERT(0);
done_searching:
m_AttackMap[tn] = attack;
SetTapNote( track, row, tn );
} }
void NoteData::PruneUnusedAttacksFromMap() void NoteData::PruneUnusedAttacksFromMap()
{ {
// Add all used AttackNote values to a map. // Add all used AttackNote index values to a map.
map<TapNote,int> mapAttackToNothing; set<unsigned> setUsedIndices;
int num_rows = GetNumRows(); int num_rows = GetNumRows();
for( int t=0; t<m_iNumTracks; t++ ) for( int t=0; t<m_iNumTracks; t++ )
@@ -334,34 +335,33 @@ void NoteData::PruneUnusedAttacksFromMap()
for( int r=0; r<num_rows; r++ ) for( int r=0; r<num_rows; r++ )
{ {
TapNote tn = GetTapNote(t, r); TapNote tn = GetTapNote(t, r);
if( IsTapAttack( tn ) ) if( tn.type == TapNote::attack )
mapAttackToNothing[tn] = 1; setUsedIndices.insert( tn.attackIndex );
} }
} }
// Remove all items from m_AttackMap that don't have corresponding // Remove all items from m_AttackMap that don't have corresponding
// TapNotes in use. // TapNotes in use.
for( TapNote tn = TAP_ATTACK_BEGIN; tn<=TAP_ATTACK_END; tn++ ) for( unsigned i=0; i<MAX_NUM_ATTACKS; i++ )
{ {
bool bInAttackMap = m_AttackMap.find(tn) != m_AttackMap.end(); bool bInAttackMap = m_AttackMap.find(i) != m_AttackMap.end();
bool bActuallyUsed = mapAttackToNothing.find(tn) != mapAttackToNothing.end(); bool bActuallyUsed = setUsedIndices.find(i) != setUsedIndices.end();
if( bActuallyUsed && !bInAttackMap ) if( bActuallyUsed && !bInAttackMap )
ASSERT( 0 ); ASSERT(0); // something earlier than us didn't enforce consistency
if( bInAttackMap && !bActuallyUsed ) if( bInAttackMap && !bActuallyUsed )
{ m_AttackMap.erase( i );
m_AttackMap.erase( tn );
}
} }
} }
const Attack& NoteData::GetAttackAt( int track, int row ) const Attack& NoteData::GetAttackAt( int track, int row )
{ {
TapNote tn = GetTapNote(track, row); TapNote tn = GetTapNote(track, row);
ASSERT( IsTapAttack(tn) ); ASSERT( tn.type == TapNote::attack ); // don't call this if the TapNote here isn't an attack
ASSERT( m_AttackMap.find(tn) != m_AttackMap.end() ); map<unsigned,Attack>::iterator iter = m_AttackMap.find( tn.attackIndex );
return m_AttackMap[tn]; ASSERT( iter != m_AttackMap.end() );
return iter->second;
} }
@@ -446,7 +446,7 @@ int NoteData::GetNumTapNotes( float fStartBeat, float fEndBeat ) const
for( int i=iStartIndex; i<=iEndIndex; i++ ) for( int i=iStartIndex; i<=iEndIndex; i++ )
{ {
TapNote tn = GetTapNoteX(t, i); TapNote tn = GetTapNoteX(t, i);
if( tn != TAP_EMPTY && tn != TAP_MINE ) if( tn.type != TapNote::empty && tn.type != TapNote::mine )
iNumNotes++; iNumNotes++;
} }
} }
@@ -486,7 +486,7 @@ int NoteData::GetNumMines( float fStartBeat, float fEndBeat ) const
for( int t=0; t<m_iNumTracks; t++ ) for( int t=0; t<m_iNumTracks; t++ )
{ {
for( int i=iStartIndex; i<=iEndIndex; i++ ) for( int i=iStartIndex; i<=iEndIndex; i++ )
if( GetTapNoteX(t, i) == TAP_MINE ) if( GetTapNoteX(t, i).type == TapNote::mine )
iNumMines++; iNumMines++;
} }
@@ -514,8 +514,13 @@ int NoteData::RowNeedsHands( const int row ) const
for( int t=0; t<m_iNumTracks; t++ ) for( int t=0; t<m_iNumTracks; t++ )
{ {
TapNote tn = GetTapNoteX(t, row); TapNote tn = GetTapNoteX(t, row);
if( tn == TAP_MINE || tn == TAP_EMPTY || tn == TAP_HOLD_TAIL ) // mines don't count switch( tn.type )
continue; {
case TapNote::mine:
case TapNote::empty:
case TapNote::hold_tail:
continue; // skip these types - they don't count
}
++iNumNotesThisIndex; ++iNumNotesThisIndex;
} }
@@ -585,7 +590,7 @@ int NoteData::GetNumN( int MinTaps, float fStartBeat, float fEndBeat ) const
for( int t=0; t<m_iNumTracks; t++ ) for( int t=0; t<m_iNumTracks; t++ )
{ {
TapNote tn = GetTapNoteX(t, i); TapNote tn = GetTapNoteX(t, i);
if( tn != TAP_MINE && tn != TAP_EMPTY ) // mines don't count if( tn.type != TapNote::mine && tn.type != TapNote::empty ) // mines don't count
iNumNotesThisIndex++; iNumNotesThisIndex++;
} }
if( iNumNotesThisIndex >= MinTaps ) if( iNumNotesThisIndex >= MinTaps )
@@ -622,20 +627,21 @@ void NoteData::Convert2sAnd3sToHoldNotes()
{ {
for( int i=0; i<=rows; i++ ) // foreach TapNote element for( int i=0; i<=rows; i++ ) // foreach TapNote element
{ {
if( GetTapNote(col, i) != TAP_HOLD_HEAD ) // this is a HoldNote begin marker if( GetTapNote(col,i).type != TapNote::hold_head ) // this is a HoldNote begin marker
continue; continue;
SetTapNote(col, i, TAP_EMPTY); SetTapNote(col, i, TAP_EMPTY); // clear the hold head marker
for( int j=i+1; j<=rows; j++ ) // search for end of HoldNote for( int j=i+1; j<=rows; j++ ) // search for end of HoldNote
{ {
// end hold on the next note we see // End hold on the next note we see. This should be a hold_tail if the
if( GetTapNote(col, j) == TAP_EMPTY ) // data is in a consistent state, but doesn't have to be.
if( GetTapNote(col, j).type == TapNote::empty )
continue; continue;
SetTapNote(col, j, TAP_EMPTY); SetTapNote(col, j, TAP_EMPTY);
AddHoldNote( HoldNote(col, i, j) ); AddHoldNote( HoldNote(col, i, j) );
break; break; // done searching for the end of this hold
} }
} }
} }
@@ -654,8 +660,8 @@ void NoteData::ConvertHoldNotesTo2sAnd3s()
/* If they're the same, then they got clamped together, so just ignore it. */ /* If they're the same, then they got clamped together, so just ignore it. */
if( hn.iStartRow != hn.iEndRow ) if( hn.iStartRow != hn.iEndRow )
{ {
SetTapNote( hn.iTrack, hn.iStartRow, TAP_HOLD_HEAD ); SetTapNote( hn.iTrack, hn.iStartRow, TAP_ORIGINAL_HOLD_HEAD );
SetTapNote( hn.iTrack, hn.iEndRow, TAP_HOLD_TAIL ); SetTapNote( hn.iTrack, hn.iEndRow, TAP_ORIGINAL_HOLD_TAIL );
} }
} }
m_HoldNotes.clear(); m_HoldNotes.clear();
@@ -699,19 +705,19 @@ void NoteData::Convert4sToHoldNotes()
{ {
for( int i=0; i<=rows; i++ ) // foreach TapNote element for( int i=0; i<=rows; i++ ) // foreach TapNote element
{ {
if( GetTapNote(col, i) != TAP_HOLD ) // this is a HoldNote body if( GetTapNote(col, i).type == TapNote::hold ) // this is a HoldNote body
continue; {
HoldNote hn( col, i, 0 );
HoldNote hn( col, i, 0 ); // search for end of HoldNote
// search for end of HoldNote do {
do { SetTapNote(col, i, TAP_EMPTY);
i++;
} while( GetTapNote(col, i).type == TapNote::hold );
SetTapNote(col, i, TAP_EMPTY); SetTapNote(col, i, TAP_EMPTY);
i++;
} while( GetTapNote(col, i) == TAP_HOLD);
SetTapNote(col, i, TAP_EMPTY);
hn.iEndRow = i; hn.iEndRow = i;
AddHoldNote( hn ); AddHoldNote( hn );
}
} }
} }
} }
@@ -722,9 +728,8 @@ void NoteData::ConvertHoldNotesTo4s()
for( int i=0; i<GetNumHoldNotes(); i++ ) for( int i=0; i<GetNumHoldNotes(); i++ )
{ {
const HoldNote &hn = GetHoldNote(i); const HoldNote &hn = GetHoldNote(i);
for( int j = hn.iStartRow; j < hn.iEndRow; ++j) for( int j = hn.iStartRow; j < hn.iEndRow; ++j)
SetTapNote(hn.iTrack, j, TAP_HOLD); SetTapNote(hn.iTrack, j, TAP_ORIGINAL_HOLD);
} }
m_HoldNotes.clear(); m_HoldNotes.clear();
} }
@@ -767,7 +772,7 @@ void NoteData::PadTapNotes(int rows)
needed += 100; /* optimization: give it a little more than it needs */ needed += 100; /* optimization: give it a little more than it needs */
for(int track = 0; track < m_iNumTracks; ++track) for(int track = 0; track < m_iNumTracks; ++track)
m_TapNotes[track].insert(m_TapNotes[track].end(), needed, TAP_EMPTY); m_TapNotes[track].insert( m_TapNotes[track].end(), needed, TAP_EMPTY );
} }
void NoteData::MoveTapNoteTrack(int dest, int src) void NoteData::MoveTapNoteTrack(int dest, int src)
@@ -800,7 +805,7 @@ void NoteData::EliminateAllButOneTap(int row)
int track; int track;
for(track = 0; track < m_iNumTracks; ++track) for(track = 0; track < m_iNumTracks; ++track)
{ {
if( m_TapNotes[track][row] == TAP_TAP ) if( m_TapNotes[track][row].type == TapNote::tap )
break; break;
} }
@@ -808,7 +813,7 @@ void NoteData::EliminateAllButOneTap(int row)
for( ; track < m_iNumTracks; ++track) for( ; track < m_iNumTracks; ++track)
{ {
if( m_TapNotes[track][row] == TAP_TAP ) if( m_TapNotes[track][row].type == TapNote::tap )
m_TapNotes[track][row] = TAP_EMPTY; m_TapNotes[track][row] = TAP_EMPTY;
} }
} }
+5 -4
View File
@@ -17,7 +17,7 @@ class NoteData
vector<HoldNote> m_HoldNotes; vector<HoldNote> m_HoldNotes;
map<TapNote,Attack> m_AttackMap; map<unsigned,Attack> m_AttackMap;
/* Pad m_TapNotes so it includes the row "rows". */ /* Pad m_TapNotes so it includes the row "rows". */
void PadTapNotes(int rows); void PadTapNotes(int rows);
@@ -36,14 +36,15 @@ public:
void SetNumTracks( int iNewNumTracks ); void SetNumTracks( int iNewNumTracks );
// TODO: Think of better accessors // TODO: Think of better accessors
const map<TapNote,Attack>& GetAttackMap() const { return m_AttackMap; } const map<unsigned,Attack>& GetAttackMap() const { return m_AttackMap; }
map<TapNote,Attack>& GetAttackMap() { return m_AttackMap; } map<unsigned,Attack>& GetAttackMap() { return m_AttackMap; }
/* 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, int row) const inline TapNote GetTapNote(unsigned track, int row) const
{ {
if(row < 0 || row >= (int) m_TapNotes[track].size()) return TapNote(TAP_EMPTY); if(row < 0 || row >= (int) m_TapNotes[track].size())
return TAP_EMPTY;
return m_TapNotes[track][row]; return m_TapNotes[track][row];
} }
void ReserveRows( int row ); void ReserveRows( int row );
+66 -66
View File
@@ -95,21 +95,22 @@ void NoteDataUtil::LoadFromSMNoteDataString( NoteData &out, CString sSMNoteData,
for( int c=0; c<min(sMeasureLine.GetLength(),out.GetNumTracks()); c++ ) for( int c=0; c<min(sMeasureLine.GetLength(),out.GetNumTracks()); c++ )
{ {
TapNote t; TapNote t;
switch(sMeasureLine[c]) char ch = sMeasureLine[c];
switch( ch )
{ {
case '0': t = TAP_EMPTY; break; case '0': t = TAP_EMPTY; break;
case '1': t = TAP_TAP; break; case '1': t = TAP_ORIGINAL_TAP; break;
case '2': t = TAP_HOLD_HEAD; break; case '2': t = TAP_ORIGINAL_HOLD_HEAD; break;
case '3': t = TAP_HOLD_TAIL; break; case '3': t = TAP_ORIGINAL_HOLD_TAIL; break;
// case 'm': // case 'm':
// Don't be loose with the definition. Use only 'M' since // Don't be loose with the definition. Use only 'M' since
// that's what we've been writing to disk. -Chris // that's what we've been writing to disk. -Chris
case 'M': t = TAP_MINE; break; case 'M':
t = TAP_ORIGINAL_MINE; break;
default: default:
if( sMeasureLine[c] >= 'a' && sMeasureLine[c] <= 'z' ) if( ch >= 'a' && ch <= 'z' )
{ {
t = sMeasureLine[c]; t.Set( TapNote::attack, TapNote::original, ch - 'a' );
} }
else else
{ {
@@ -154,7 +155,7 @@ void NoteDataUtil::LoadFromSMNoteDataString( NoteData &out, CString sSMNoteData,
if( asBits[0].empty() ) if( asBits[0].empty() )
continue; continue;
TapNote tn = asBits[0][0]; int attack_index = asBits[0][0] - 'a';
Attack attack; Attack attack;
attack.level = ATTACK_LEVEL_1; attack.level = ATTACK_LEVEL_1;
@@ -162,7 +163,7 @@ void NoteDataUtil::LoadFromSMNoteDataString( NoteData &out, CString sSMNoteData,
attack.sModifier.Replace( '.', ',' ); // we couldn't use comma here because the map item separator is a comma attack.sModifier.Replace( '.', ',' ); // we couldn't use comma here because the map item separator is a comma
attack.fSecsRemaining = strtof( asBits[2], NULL ); attack.fSecsRemaining = strtof( asBits[2], NULL );
out.GetAttackMap()[tn] = attack; out.GetAttackMap()[attack_index] = attack;
} }
} }
} }
@@ -206,23 +207,17 @@ void NoteDataUtil::GetSMNoteDataString( const NoteData &in_, CString &notes_out,
{ {
TapNote tn = in.GetTapNote(t, r); TapNote tn = in.GetTapNote(t, r);
char c; char c;
switch( tn ) switch( tn.type )
{ {
case TAP_EMPTY: c = '0'; break; case TapNote::empty: c = '0'; break;
case TAP_TAP: c = '1'; break; case TapNote::tap: c = '1'; break;
case TAP_HOLD_HEAD: c = '2'; break; case TapNote::hold_head: c = '2'; break;
case TAP_HOLD_TAIL: c = '3'; break; case TapNote::hold_tail: c = '3'; break;
case TAP_MINE: c = 'M'; break; case TapNote::mine: c = 'M'; break;
case TapNote::attack: c = 'a' + (char)tn.attackIndex ; break;
default: default:
if( IsTapAttack(tn) ) ASSERT(0);
{ c = '0';
c = tn;
}
else
{
ASSERT(0);
c = '0';
}
break; break;
} }
sRet.append(1, c); sRet.append(1, c);
@@ -239,15 +234,16 @@ void NoteDataUtil::GetSMNoteDataString( const NoteData &in_, CString &notes_out,
// //
CStringArray asLines; CStringArray asLines;
for( map<TapNote,Attack>::const_iterator iter = in_.GetAttackMap().begin(); for( map<unsigned,Attack>::const_iterator iter = in_.GetAttackMap().begin();
iter != in_.GetAttackMap().end(); iter != in_.GetAttackMap().end();
iter++ ) iter++ )
{ {
TapNote tn = iter->first; int attackIndex = iter->first;
char ch = 'a' + (char)attackIndex;
Attack attack = iter->second; Attack attack = iter->second;
attack.sModifier.Replace( ',', '.' ); // comma is the map item separator attack.sModifier.Replace( ',', '.' ); // comma is the map item separator
asLines.push_back( ssprintf("%c=%s=%f,\n", tn, attack.sModifier.c_str(), attack.fSecsRemaining) ); asLines.push_back( ssprintf("%c=%s=%f,\n", ch, attack.sModifier.c_str(), attack.fSecsRemaining) );
} }
attacks_out = join( ",", asLines ); attacks_out = join( ",", asLines );
@@ -298,8 +294,8 @@ void NoteDataUtil::LoadTransformedSlidingWindow( const NoteData &in, NoteData &o
if( r ) if( r )
for( int t=0; t<=Original.GetNumTracks(); t++ ) for( int t=0; t<=Original.GetNumTracks(); t++ )
{ {
if( Original.GetTapNote(t, r) == TAP_HOLD && if( Original.GetTapNote(t,r).type == TapNote::hold &&
Original.GetTapNote(t, r-1) == TAP_HOLD) Original.GetTapNote(t,r-1).type == TapNote::hold )
{ {
bHoldCrossesThisMeasure = true; bHoldCrossesThisMeasure = true;
break; break;
@@ -355,7 +351,7 @@ void NoteDataUtil::LoadOverlapped( const NoteData &input, NoteData &out, int iNe
int &iTrackTo = DestRow[i]; int &iTrackTo = DestRow[i];
const TapNote iStepFrom = in.GetTapNote( iTrackFrom, row ); const TapNote iStepFrom = in.GetTapNote( iTrackFrom, row );
if( iStepFrom == TAP_EMPTY ) if( iStepFrom.type == TapNote::empty )
continue; continue;
if( LastSourceTrack[iTrackTo] != iTrackFrom && if( LastSourceTrack[iTrackTo] != iTrackFrom &&
@@ -404,12 +400,12 @@ void NoteDataUtil::LoadTransformedLights( const NoteData &in, NoteData &out, int
* don't write huge streams of tap notes. */ * don't write huge streams of tap notes. */
bool bHoldNoteOnThisRow = false; bool bHoldNoteOnThisRow = false;
for( int t=0; t<Original.GetNumTracks(); t++ ) for( int t=0; t<Original.GetNumTracks(); t++ )
if( Original.GetTapNote( t, r ) == TAP_HOLD ) if( Original.GetTapNote(t,r).type == TapNote::hold )
bHoldNoteOnThisRow = true; bHoldNoteOnThisRow = true;
for( int t=0; t<out.GetNumTracks(); t++ ) for( int t=0; t<out.GetNumTracks(); t++ )
{ {
TapNote tn = bHoldNoteOnThisRow? TAP_HOLD:TAP_TAP; TapNote tn = bHoldNoteOnThisRow ? TAP_ORIGINAL_HOLD : TAP_ORIGINAL_TAP;
out.SetTapNote( t, r, tn ); out.SetTapNote( t, r, tn );
} }
} }
@@ -524,7 +520,7 @@ void NoteDataUtil::RemoveHoldNotes(NoteData &in, float fStartBeat, float fEndBea
continue; // skip continue; // skip
in.RemoveHoldNote( i ); in.RemoveHoldNote( i );
in.SetTapNote( hn.iTrack, hn.iStartRow, TAP_TAP ); in.SetTapNote( hn.iTrack, hn.iStartRow, TAP_ORIGINAL_TAP );
} }
} }
@@ -548,12 +544,12 @@ void NoteDataUtil::RemoveSimultaneousNotes(NoteData &in, int iMaxSimultaneous, f
int iTracksToRemove = max( 0, iTotalTracksPressed - iMaxSimultaneous ); int iTracksToRemove = max( 0, iTotalTracksPressed - iMaxSimultaneous );
for( int t=0; iTracksToRemove>0 && t<in.GetNumTracks(); t++ ) for( int t=0; iTracksToRemove>0 && t<in.GetNumTracks(); t++ )
{ {
if( in.GetTapNote(t,r) == TAP_TAP ) if( in.GetTapNote(t,r).type == TapNote::tap )
{ {
in.SetTapNote( t, r, TAP_EMPTY ); in.SetTapNote( t, r, TAP_EMPTY );
iTracksToRemove--; iTracksToRemove--;
} }
else if( in.GetTapNote(t,r) == TAP_HOLD_HEAD ) else if( in.GetTapNote(t,r).type == TapNote::hold_head )
{ {
int i; int i;
for( i=0; i<in.GetNumHoldNotes(); i++ ) for( i=0; i<in.GetNumHoldNotes(); i++ )
@@ -591,8 +587,8 @@ void NoteDataUtil::RemoveMines(NoteData &in, float fStartBeat, float fEndBeat )
int iRowEnd = BeatToNoteRow(fEndBeat); int iRowEnd = BeatToNoteRow(fEndBeat);
for( int t=0; t<in.GetNumTracks(); t++ ) for( int t=0; t<in.GetNumTracks(); t++ )
for( int r=iRowStart; r<=iRowEnd; r++ ) for( int r=iRowStart; r<=iRowEnd; r++ )
if( in.GetTapNote(t,r)==TAP_MINE ) if( in.GetTapNote(t,r).type == TapNote::mine )
in.SetTapNote(t,r,TAP_EMPTY); in.SetTapNote( t, r, TAP_EMPTY );
} }
@@ -747,7 +743,7 @@ static void SuperShuffleTaps( NoteData &in, int iStartIndex, int iEndIndex )
for( int t1=0; t1<in.GetNumTracks(); t1++ ) for( int t1=0; t1<in.GetNumTracks(); t1++ )
{ {
TapNote tn1 = in.GetTapNote(t1, r); TapNote tn1 = in.GetTapNote(t1, r);
if( tn1==TAP_HOLD ) if( tn1.type == TapNote::hold )
continue; continue;
// a tap that is not part of a hold // a tap that is not part of a hold
@@ -756,7 +752,7 @@ static void SuperShuffleTaps( NoteData &in, int iStartIndex, int iEndIndex )
{ {
const int t2 = rand() % in.GetNumTracks(); const int t2 = rand() % in.GetNumTracks();
TapNote tn2 = in.GetTapNote(t2, r); TapNote tn2 = in.GetTapNote(t2, r);
if( tn2==TAP_HOLD ) // a tap that is not part of a hold if( tn2.type == TapNote::hold ) // a tap that is not part of a hold
continue; continue;
// swap // swap
@@ -856,7 +852,7 @@ void NoteDataUtil::Little(NoteData &in, float fStartBeat, float fEndBeat)
for( i=0; i<=max_row; i+=1 ) for( i=0; i<=max_row; i+=1 )
if( i % ROWS_PER_BEAT != 0 ) if( i % ROWS_PER_BEAT != 0 )
for( int c=0; c<in.GetNumTracks(); c++ ) for( int c=0; c<in.GetNumTracks(); c++ )
in.SetTapNote(c, i, TAP_EMPTY); in.SetTapNote( c, i, TAP_EMPTY );
for( i=in.GetNumHoldNotes()-1; i>=0; i-- ) for( i=in.GetNumHoldNotes()-1; i>=0; i-- )
if( fmodf(in.GetHoldNote(i).GetStartBeat(),1) != 0 ) // doesn't start on a beat if( fmodf(in.GetHoldNote(i).GetStartBeat(),1) != 0 ) // doesn't start on a beat
@@ -906,11 +902,11 @@ void NoteDataUtil::Wide( NoteData &in, float fStartBeat, float fEndBeat )
iTrackToAdd--; iTrackToAdd--;
CLAMP( iTrackToAdd, 0, in.GetNumTracks()-1 ); CLAMP( iTrackToAdd, 0, in.GetNumTracks()-1 );
if( in.GetTapNote(iTrackToAdd, i) != TAP_EMPTY ) if( in.GetTapNote(iTrackToAdd, i).type != TapNote::empty )
{ {
iTrackToAdd = (iTrackToAdd+1) % in.GetNumTracks(); iTrackToAdd = (iTrackToAdd+1) % in.GetNumTracks();
} }
in.SetTapNote(iTrackToAdd, i, TAP_ADDITION); in.SetTapNote(iTrackToAdd, i, TAP_ADDITION_TAP);
} }
in.Convert4sToHoldNotes(); in.Convert4sToHoldNotes();
@@ -1029,7 +1025,7 @@ void NoteDataUtil::InsertIntelligentTaps(
} }
done_looking_for_track_to_add: done_looking_for_track_to_add:
in.SetTapNote(iTrackOfNoteToAdd, iRowToAdd, TAP_ADDITION); in.SetTapNote(iTrackOfNoteToAdd, iRowToAdd, TAP_ADDITION_TAP);
} }
in.Convert4sToHoldNotes(); in.Convert4sToHoldNotes();
@@ -1057,8 +1053,8 @@ void NoteDataUtil::AddMines( NoteData &in, float fStartBeat, float fEndBeat )
if( iRowCount>=iPlaceEveryRows ) if( iRowCount>=iPlaceEveryRows )
{ {
for( int t=0; t<in.GetNumTracks(); t++ ) for( int t=0; t<in.GetNumTracks(); t++ )
if( in.GetTapNote(t,r) == TAP_TAP ) if( in.GetTapNote(t,r).type == TapNote::tap )
in.SetTapNote(t,r,TAP_MINE); in.SetTapNote(t,r,TAP_ADDITION_MINE);
iRowCount = 0; iRowCount = 0;
if( iPlaceEveryRows == 6 ) if( iPlaceEveryRows == 6 )
@@ -1087,12 +1083,12 @@ void NoteDataUtil::AddMines( NoteData &in, float fStartBeat, float fEndBeat )
continue; continue;
// Add a mine right after the hold end. // Add a mine right after the hold end.
in.SetTapNote(hn.iTrack,iMineRow,TAP_MINE); in.SetTapNote( hn.iTrack, iMineRow, TAP_ADDITION_MINE );
// Convert all notes in this row to mines. // Convert all notes in this row to mines.
for( int t=0; t<in.GetNumTracks(); t++ ) for( int t=0; t<in.GetNumTracks(); t++ )
if( in.GetTapNote(t,iMineRow) == TAP_TAP ) if( in.GetTapNote(t,iMineRow).type == TapNote::tap )
in.SetTapNote(t,iMineRow,TAP_MINE); in.SetTapNote(t,iMineRow,TAP_ADDITION_MINE);
iRowCount = 0; iRowCount = 0;
} }
@@ -1148,7 +1144,7 @@ void NoteDataUtil::Echo( NoteData &in, float fStartBeat, float fEndBeat )
continue; // don't lay continue; // don't lay
} }
in.SetTapNote( iEchoTrack, iRowEcho, TAP_ADDITION ); in.SetTapNote( iEchoTrack, iRowEcho, TAP_ADDITION_TAP );
} }
} }
@@ -1177,7 +1173,7 @@ void NoteDataUtil::ConvertTapsToHolds( NoteData &in, int iSimultaneousHolds, flo
if( iTrackAddedThisRow > iSimultaneousHolds ) if( iTrackAddedThisRow > iSimultaneousHolds )
break; break;
if( in.GetTapNote(t,r) == TAP_TAP ) if( in.GetTapNote(t,r).type == TapNote::tap )
{ {
// Find the ending row for this hold // Find the ending row for this hold
int iTapsLeft = iSimultaneousHolds; int iTapsLeft = iSimultaneousHolds;
@@ -1191,7 +1187,7 @@ void NoteDataUtil::ConvertTapsToHolds( NoteData &in, int iSimultaneousHolds, flo
// If there are two taps in a row on the same track, // If there are two taps in a row on the same track,
// don't convert the earlier one to a hold. // don't convert the earlier one to a hold.
if( in.GetTapNote(t,r2) != TAP_EMPTY ) if( in.GetTapNote(t,r2).type != TapNote::empty )
goto dont_add_hold; goto dont_add_hold;
set<int> tracksDown; set<int> tracksDown;
@@ -1238,7 +1234,7 @@ void NoteDataUtil::Stomp( NoteData &in, StepsType st, float fStartBeat, float fE
for( int t=0; t<in.GetNumTracks(); t++ ) for( int t=0; t<in.GetNumTracks(); t++ )
{ {
if( in.GetTapNote(t, r) == TAP_TAP ) // there is a tap here if( in.GetTapNote(t, r).type == TapNote::tap ) // there is a tap here
{ {
// Look to see if there is enough empty space on either side of the note // Look to see if there is enough empty space on either side of the note
// to turn this into a jump. // to turn this into a jump.
@@ -1261,7 +1257,7 @@ void NoteDataUtil::Stomp( NoteData &in, StepsType st, float fStartBeat, float fE
continue; continue;
int iOppositeTrack = iTrackMapping[t]; int iOppositeTrack = iTrackMapping[t];
in.SetTapNote( iOppositeTrack, r, TAP_ADDITION ); in.SetTapNote( iOppositeTrack, r, TAP_ADDITION_TAP );
} }
} }
} }
@@ -1322,20 +1318,20 @@ void NoteDataUtil::SnapToNearestNoteType( NoteData &in, NoteType nt1, NoteType n
continue; continue;
TapNote note = in.GetTapNote(c, iOldIndex); TapNote note = in.GetTapNote(c, iOldIndex);
if( note == TAP_EMPTY ) if( note.type == TapNote::empty )
continue; continue;
in.SetTapNote(c, iOldIndex, TAP_EMPTY); in.SetTapNote(c, iOldIndex, TAP_EMPTY);
const TapNote oldnote = in.GetTapNote(c, iNewIndex); const TapNote oldnote = in.GetTapNote(c, iNewIndex);
if( note == TAP_TAP && if( note.type == TapNote::tap &&
(oldnote == TAP_HOLD_HEAD || oldnote == TAP_HOLD_TAIL) ) (oldnote.type == TapNote::hold_head || oldnote.type == TapNote::hold_tail) )
continue; // HoldNotes override TapNotes continue; // HoldNotes override TapNotes
/* If two hold note boundaries are getting snapped together, /* If two hold note boundaries are getting snapped together,
* merge them. */ * merge them. */
if( (note == TAP_HOLD_HEAD && oldnote == TAP_HOLD_TAIL) || if( (note.type == TapNote::hold_head && oldnote.type == TapNote::hold_tail) ||
(note == TAP_HOLD_TAIL && oldnote == TAP_HOLD_HEAD)) (note.type == TapNote::hold_tail && oldnote.type == TapNote::hold_head) )
note = TAP_EMPTY; note = TAP_EMPTY;
in.SetTapNote(c, iNewIndex, note ); in.SetTapNote(c, iNewIndex, note );
@@ -1414,7 +1410,7 @@ void NoteDataUtil::CollapseToOne( NoteData &in )
int max_row = in.GetLastRow(); int max_row = in.GetLastRow();
for( int r=0; r<=max_row; r++ ) for( int r=0; r<=max_row; r++ )
for( int t=0; t<in.GetNumTracks(); t++ ) for( int t=0; t<in.GetNumTracks(); t++ )
if( in.GetTapNote(t,r) != TAP_EMPTY ) if( in.GetTapNote(t,r).type != TapNote::empty )
{ {
TapNote tn = in.GetTapNote(t,r); TapNote tn = in.GetTapNote(t,r);
in.SetTapNote(t, r, TAP_EMPTY); in.SetTapNote(t, r, TAP_EMPTY);
@@ -1431,7 +1427,7 @@ void NoteDataUtil::CollapseLeft( NoteData &in )
{ {
int iNumTracksFilled = 0; int iNumTracksFilled = 0;
for( int t=0; t<in.GetNumTracks(); t++ ) for( int t=0; t<in.GetNumTracks(); t++ )
if( in.GetTapNote(t,r) != TAP_EMPTY ) if( in.GetTapNote(t,r).type != TapNote::empty )
{ {
TapNote tn = in.GetTapNote(t,r); TapNote tn = in.GetTapNote(t,r);
in.SetTapNote(t, r, TAP_EMPTY); in.SetTapNote(t, r, TAP_EMPTY);
@@ -1540,7 +1536,7 @@ bool NoteDataUtil::RowPassesValidMask( NoteData &in, int row, const bool bValidM
{ {
for( int t=0; t<in.GetNumTracks(); t++ ) for( int t=0; t<in.GetNumTracks(); t++ )
{ {
if( !bValidMask[t] && in.GetTapNote(t,row) != TAP_EMPTY ) if( !bValidMask[t] && in.GetTapNote(t,row).type != TapNote::empty )
return false; return false;
} }
@@ -1551,8 +1547,12 @@ void NoteDataUtil::ConvertAdditionsToRegular( NoteData &in )
{ {
for( int r=0; r<=in.GetLastRow(); r++ ) for( int r=0; r<=in.GetLastRow(); r++ )
for( int t=0; t<in.GetNumTracks(); t++ ) for( int t=0; t<in.GetNumTracks(); t++ )
if( in.GetTapNote(t,r) == TAP_ADDITION ) if( in.GetTapNote(t,r).source == TapNote::addition )
in.SetTapNote(t,r,TAP_TAP); {
TapNote tn = in.GetTapNote(t,r);
tn.source = TapNote::original;
in.SetTapNote( t, r, tn );
}
} }
void NoteDataUtil::TransformNoteData( NoteData &nd, const AttackArray &aa, StepsType st, Song* pSong ) void NoteDataUtil::TransformNoteData( NoteData &nd, const AttackArray &aa, StepsType st, Song* pSong )
@@ -1692,7 +1692,7 @@ void NoteDataUtil::ScaleRegion( NoteData &nd, float fScale, float fStartBeat, fl
for( int t=0; t<temp2.GetNumTracks(); t++ ) for( int t=0; t<temp2.GetNumTracks(); t++ )
{ {
TapNote tn = temp2.GetTapNote( t, r ); TapNote tn = temp2.GetTapNote( t, r );
if( tn != TAP_EMPTY ) if( tn.type != TapNote::empty )
{ {
temp2.SetTapNote( t, r, TAP_EMPTY ); temp2.SetTapNote( t, r, TAP_EMPTY );
+10 -9
View File
@@ -33,7 +33,7 @@ int NoteDataWithScoring::GetNumTapNotesWithScore( TapNoteScore tns, const float
{ {
for( int t=0; t<GetNumTracks(); t++ ) for( int t=0; t<GetNumTracks(); t++ )
{ {
if( this->GetTapNote(t, i) != TAP_EMPTY && GetTapNoteScore(t, i) >= tns ) if( this->GetTapNote(t, i).type != TapNote::empty && GetTapNoteScore(t, i) >= tns )
iNumSuccessfulTapNotes++; iNumSuccessfulTapNotes++;
} }
} }
@@ -59,11 +59,10 @@ int NoteDataWithScoring::GetNumNWithScore( TapNoteScore tns, int MinTaps, const
TapNoteScore minTapNoteScore = TNS_MARVELOUS; TapNoteScore minTapNoteScore = TNS_MARVELOUS;
for( int t=0; t<GetNumTracks(); t++ ) for( int t=0; t<GetNumTracks(); t++ )
{ {
switch( GetTapNote(t, i) ) switch( GetTapNote(t, i).type )
{ {
case TAP_TAP: case TapNote::tap:
case TAP_HOLD_HEAD: case TapNote::hold_head:
case TAP_ADDITION:
iNumNotesThisIndex++; iNumNotesThisIndex++;
minTapNoteScore = min( minTapNoteScore, GetTapNoteScore(t, i) ); minTapNoteScore = min( minTapNoteScore, GetTapNoteScore(t, i) );
} }
@@ -112,7 +111,7 @@ int NoteDataWithScoring::GetSuccessfulMines( float fStartBeat, float fEndBeat )
{ {
for( int t=0; t<GetNumTracks(); t++ ) for( int t=0; t<GetNumTracks(); t++ )
{ {
if( this->GetTapNote(t, i) == TAP_MINE && GetTapNoteScore(t, i) != TNS_HIT_MINE ) if( this->GetTapNote(t,i).type == TapNote::mine && GetTapNoteScore(t, i) != TNS_HIT_MINE )
iNumSuccessfulMinesNotes++; iNumSuccessfulMinesNotes++;
} }
} }
@@ -143,7 +142,9 @@ int NoteDataWithScoring::GetSuccessfulHands( float fStartBeat, float fEndBeat )
for( int t=0; t<GetNumTracks(); t++ ) for( int t=0; t<GetNumTracks(); t++ )
{ {
TapNote tn = GetTapNoteX(t, i); TapNote tn = GetTapNoteX(t, i);
if( tn == TAP_MINE || tn == TAP_EMPTY ) // mines don't count if( tn.type == TapNote::empty )
continue;
if( tn.type == TapNote::mine ) // mines don't count
continue; continue;
if( GetTapNoteScore(t, i) <= TNS_BOO ) if( GetTapNoteScore(t, i) <= TNS_BOO )
Missed = true; Missed = true;
@@ -188,7 +189,7 @@ TapNoteScore NoteDataWithScoring::MinTapNoteScore(unsigned row) const
/* Don't coun, or else the score /* Don't coun, or else the score
* will always be TNS_NONE. */ * will always be TNS_NONE. */
TapNote tn = GetTapNote(t, row); TapNote tn = GetTapNote(t, row);
if( tn == TAP_EMPTY || tn == TAP_MINE ) if( tn.type == TapNote::empty || tn.type == TapNote::mine)
continue; continue;
score = min( score, GetTapNoteScore(t, row) ); score = min( score, GetTapNoteScore(t, row) );
} }
@@ -212,7 +213,7 @@ int NoteDataWithScoring::LastTapNoteScoreTrack(unsigned row) const
{ {
/* Skip empty tracks and mines */ /* Skip empty tracks and mines */
TapNote tn = GetTapNote(t, row); TapNote tn = GetTapNote(t, row);
if( tn == TAP_EMPTY || tn == TAP_MINE ) if( tn.type == TapNote::empty || tn.type == TapNote::mine )
continue; continue;
TapNoteScore tns = GetTapNoteScore(t, row); TapNoteScore tns = GetTapNoteScore(t, row);
+6 -6
View File
@@ -582,10 +582,10 @@ void NoteField::DrawPrimitives()
for( i=iLastIndexToDraw; i>=iFirstIndexToDraw; --i ) // for each row for( i=iLastIndexToDraw; i>=iFirstIndexToDraw; --i ) // for each row
{ {
TapNote tn = GetTapNote(c, i); TapNote tn = GetTapNote(c, i);
if( tn == TAP_EMPTY ) // no note here if( tn.type == TapNote::empty ) // no note here
continue; // skip continue; // skip
if( tn == TAP_HOLD_HEAD ) // this is a HoldNote begin marker. Grade it, but don't draw if( tn.type == TapNote::hold_head ) // this is a HoldNote begin marker. Grade it, but don't draw
continue; // skip continue; // skip
// TRICKY: If boomerang is on, then all notes in the range // TRICKY: If boomerang is on, then all notes in the range
@@ -601,7 +601,7 @@ void NoteField::DrawPrimitives()
bool bHoldNoteBeginsOnThisBeat = false; bool bHoldNoteBeginsOnThisBeat = false;
for( int c2=0; c2<GetNumTracks(); c2++ ) for( int c2=0; c2<GetNumTracks(); c2++ )
{ {
if( GetTapNote(c2, i) == TAP_HOLD_HEAD ) if( GetTapNote(c2, i).type == TapNote::hold_head)
{ {
bHoldNoteBeginsOnThisBeat = true; bHoldNoteBeginsOnThisBeat = true;
break; break;
@@ -615,9 +615,9 @@ void NoteField::DrawPrimitives()
bIsInSelectionRange = m_fBeginMarker<=fBeat && fBeat<=m_fEndMarker; bIsInSelectionRange = m_fBeginMarker<=fBeat && fBeat<=m_fEndMarker;
} }
bool bIsAddition = (tn == TAP_ADDITION); bool bIsAddition = (tn.source == TapNote::addition);
bool bIsMine = (tn == TAP_MINE); bool bIsMine = (tn.type == TapNote::mine);
bool bIsAttack = IsTapAttack(tn); bool bIsAttack = (tn.type == TapNote::attack);
ASSERT_M( NoteRowToBeat(i) > -2000, ssprintf("%i %i %i, %f %f", i, iLastIndexToDraw, iFirstIndexToDraw, GAMESTATE->m_fSongBeat, GAMESTATE->m_fMusicSeconds) ); ASSERT_M( NoteRowToBeat(i) > -2000, ssprintf("%i %i %i, %f %f", i, iLastIndexToDraw, iFirstIndexToDraw, GAMESTATE->m_fSongBeat, GAMESTATE->m_fMusicSeconds) );
SearchForBeat( CurDisplay, NextDisplay, NoteRowToBeat(i) ); SearchForBeat( CurDisplay, NextDisplay, NoteRowToBeat(i) );
+9
View File
@@ -1,6 +1,15 @@
#include "global.h" #include "global.h"
#include "NoteTypes.h" #include "NoteTypes.h"
TapNote TAP_EMPTY = { TapNote::empty, TapNote::original, 0 };
TapNote TAP_ORIGINAL_TAP = { TapNote::tap, TapNote::original, 0 };
TapNote TAP_ORIGINAL_HOLD_HEAD = { TapNote::hold_head, TapNote::original, 0 }; // '2'
TapNote TAP_ORIGINAL_HOLD_TAIL = { TapNote::hold_tail, TapNote::original, 0 }; // '3'
TapNote TAP_ORIGINAL_HOLD = { TapNote::hold, TapNote::original, 0 }; // '4'
TapNote TAP_ORIGINAL_MINE = { TapNote::mine, TapNote::original, 0 };
TapNote TAP_ADDITION_TAP = { TapNote::tap, TapNote::addition, 0 };
TapNote TAP_ADDITION_MINE = { TapNote::mine, TapNote::addition, 0 };
float NoteTypeToBeat( NoteType nt ) float NoteTypeToBeat( NoteType nt )
{ {
switch( nt ) switch( nt )
+47 -58
View File
@@ -1,68 +1,57 @@
#ifndef NOTE_TYPES_H #ifndef NOTE_TYPES_H
#define NOTE_TYPES_H #define NOTE_TYPES_H
#include "PlayerOptions.h" struct TapNote
{
enum Type {
empty,
tap,
hold_head, // graded like a TAP_TAP
hold_tail, /* In 2sand3s mode, holds are deleted and TAP_HOLD_END is added: */
hold, /* In 4s mode, holds and TAP_HOLD_HEAD are deleted and TAP_HOLD is added: */
mine, // don't step!
attack,
};
unsigned type : 3; // no unsigned enum support in VC++
enum Source {
original, // part of the original NoteData
addition, // additional note added by a transform
removed, // Removed taps, e.g. in Little - play keysounds here as if
// judged Perfect, but don't bother rendering or judging this
// step. Also used for when we implement auto-scratch in BM,
// and for if/when we do a "reduce" modifier that cancels out
// all but N keys on a line [useful for BM->DDR autogen, too].
// Removed hold body (...why?) - acts as follows:
// 1 - if we're using a sustained-sound gametype [Keyboardmania], and
// we've already hit the start of the sound (?? we put Holds Off on?)
// then this is triggered automatically to keep the sound going
// 2 - if we're NOT [anything else], we ignore this.
// Equivalent to all 4s aside from the first one.
};
unsigned source : 2; // only valid if type!=empty
unsigned attackIndex : 3; // attack index
// bit field sizes should add to 8 bits.
// '1' = tap note void Set( Type type_, Source source_, unsigned attackIndex_ )
// '2' = hold note begin {
// '3' = hold note end ('1' can also end a HoldNote) ('3' without a matching '2' is ignored type = type_;
// ... for future expansion source = source_;
attackIndex = attackIndex_;
}
};
const unsigned MAX_NUM_ATTACKS = 2*2*2; // 3 bits to hold the attack index currently
typedef unsigned char TapNote; extern TapNote TAP_EMPTY; // '0'
extern TapNote TAP_ORIGINAL_TAP; // '1'
static const TapNote TAP_EMPTY = '0'; extern TapNote TAP_ORIGINAL_HOLD_HEAD; // '2'
static const TapNote TAP_TAP = '1'; /* impatient? */ extern TapNote TAP_ORIGINAL_HOLD_TAIL; // '3'
static const TapNote TAP_HOLD_HEAD = '2'; // graded like a TAP_TAP extern TapNote TAP_ORIGINAL_HOLD; // '4'
extern TapNote TAP_ORIGINAL_MINE; // 'M'
/* In 2sand3s mode, holds are deleted and TAP_HOLD_END is added: */ extern TapNote TAP_ADDITION_TAP;
static const TapNote TAP_HOLD_TAIL = '3'; extern TapNote TAP_ADDITION_MINE;
/* In 4s mode, holds and TAP_HOLD_HEAD are deleted and TAP_HOLD is added: */
static const TapNote TAP_HOLD = '4';
// additional note added by a transform
static const TapNote TAP_ADDITION = '5';
// mine note - don't step!
static const TapNote TAP_MINE = '6';
// TAP_ADD_HOLD is to TAP_HOLD what TAP_ADDITION is to TAP_TAP.
// There is no equivalent for TAP_MINE.
static const TapNote TAP_ADD_HOLD = '7'; // is this supposed to be TAP_ADD_HOLD_HEAD? -Chris
// BM-specific
// Removed taps, e.g. in Little - play keysounds here as if
// judged Perfect, but don't bother rendering or judging this
// step. Also used for when we implement auto-scratch in BM,
// and for if/when we do a "reduce" modifier that cancels out
// all but N keys on a line [useful for BM->DDR autogen, too].
static const TapNote TAP_REMOVED = '8';
// KM-specific
// Removed hold body (...why?) - acts as follows:
// 1 - if we're using a sustained-sound gametype [Keyboardmania], and
// we've already hit the start of the sound (?? we put Holds Off on?)
// then this is triggered automatically to keep the sound going
// 2 - if we're NOT [anything else], we ignore this.
// Equivalent to all 4s aside from the first one.
static const TapNote TAP_REMOVED_HOLD_BODY = ':';
// KM-specific
// A hold removed by Little, I guess.
static const TapNote TAP_REMOVED_HOLD_HEAD = '.';
// KM-specific
// Kills an auto-sound from a hold.
static const TapNote TAP_REMOVED_HOLD_TAIL = '\'';
// step for an item
static const TapNote TAP_ATTACK_BEGIN = 'a';
static const TapNote TAP_ATTACK_END = 'z';
inline bool IsTapAttack( TapNote tn ) { return tn>=TAP_ATTACK_BEGIN && tn<=TAP_ATTACK_END; }
// TODO: Don't have a hard-coded track limit.
enum enum
{ {
TRACK_1 = 0, TRACK_1 = 0,
+6 -6
View File
@@ -128,16 +128,16 @@ StepsType BMSLoader::CheckTracksMagic()
} }
} }
void BMSLoader::mapBMSTrackToDanceNote( int iBMSTrack, int &iDanceColOut, char &cNoteCharOut ) void BMSLoader::mapBMSTrackToDanceNote( int iBMSTrack, int &iDanceColOut, TapNote &tapNoteOut )
{ {
if( iBMSTrack > 40 ) if( iBMSTrack > 40 )
{ {
cNoteCharOut = '2'; tapNoteOut = TAP_ORIGINAL_HOLD_HEAD;
iBMSTrack -= 40; iBMSTrack -= 40;
} }
else else
{ {
cNoteCharOut = '1'; tapNoteOut = TAP_ORIGINAL_TAP;
} }
switch( iBMSTrack ) switch( iBMSTrack )
@@ -293,12 +293,12 @@ bool BMSLoader::LoadFromBMSFile( const CString &sPath, Steps &out )
const int iNoteIndex = (int) ( (iMeasureNo + fPercentThroughMeasure) const int iNoteIndex = (int) ( (iMeasureNo + fPercentThroughMeasure)
* BEATS_PER_MEASURE * ROWS_PER_BEAT ); * BEATS_PER_MEASURE * ROWS_PER_BEAT );
int iColumnNumber; int iColumnNumber;
char cNoteChar; TapNote tapNoteOut;
mapBMSTrackToDanceNote( iTrackNum, iColumnNumber, cNoteChar ); mapBMSTrackToDanceNote( iTrackNum, iColumnNumber, tapNoteOut );
if( iColumnNumber != -1 ) if( iColumnNumber != -1 )
pNoteData->SetTapNote(iColumnNumber, iNoteIndex, cNoteChar); pNoteData->SetTapNote(iColumnNumber, iNoteIndex, tapNoteOut);
} }
} }
} }
+2 -1
View File
@@ -3,6 +3,7 @@
#include "NotesLoader.h" #include "NotesLoader.h"
#include "GameConstantsAndTypes.h" #include "GameConstantsAndTypes.h"
#include "NoteTypes.h"
class Song; class Song;
class Steps; class Steps;
@@ -10,7 +11,7 @@ class Steps;
class BMSLoader: public NotesLoader class BMSLoader: public NotesLoader
{ {
bool LoadFromBMSFile( const CString &sPath, Steps &out1 ); bool LoadFromBMSFile( const CString &sPath, Steps &out1 );
void mapBMSTrackToDanceNote( int iBMSTrack, int &iDanceColOut, char &cNoteCharOut ); void mapBMSTrackToDanceNote( int iBMSTrack, int &iDanceColOut, TapNote &tapNoteOut );
void PushTrackNumForMagic( int iTrackNum ); void PushTrackNumForMagic( int iTrackNum );
StepsType CheckTracksMagic(); StepsType CheckTracksMagic();
void ResetTracksMagic(); void ResetTracksMagic();
+4 -4
View File
@@ -266,9 +266,9 @@ bool DWILoader::LoadFromDWITokens(
DWIcharToNoteCol( c, (GameController)pad, iCol1, iCol2 ); DWIcharToNoteCol( c, (GameController)pad, iCol1, iCol2 );
if( iCol1 != -1 ) if( iCol1 != -1 )
newNoteData.SetTapNote(iCol1, iIndex, TAP_TAP); newNoteData.SetTapNote(iCol1, iIndex, TAP_ORIGINAL_TAP);
if( iCol2 != -1 ) if( iCol2 != -1 )
newNoteData.SetTapNote(iCol2, iIndex, TAP_TAP); newNoteData.SetTapNote(iCol2, iIndex, TAP_ORIGINAL_TAP);
if( sStepData[i] == '!' ) if( sStepData[i] == '!' )
{ {
@@ -278,9 +278,9 @@ bool DWILoader::LoadFromDWITokens(
DWIcharToNoteCol( holdChar, (GameController)pad, iCol1, iCol2 ); DWIcharToNoteCol( holdChar, (GameController)pad, iCol1, iCol2 );
if( iCol1 != -1 ) if( iCol1 != -1 )
newNoteData.SetTapNote(iCol1, iIndex, TAP_HOLD_HEAD); newNoteData.SetTapNote(iCol1, iIndex, TAP_ORIGINAL_HOLD_HEAD);
if( iCol2 != -1 ) if( iCol2 != -1 )
newNoteData.SetTapNote(iCol2, iIndex, TAP_HOLD_HEAD); newNoteData.SetTapNote(iCol2, iIndex, TAP_ORIGINAL_HOLD_HEAD);
} }
} }
+3 -3
View File
@@ -192,9 +192,9 @@ bool KSFLoader::LoadFromKSFFile( const CString &sPath, Steps &out, const Song &s
TapNote tap; TapNote tap;
switch(sRowString[t]) switch(sRowString[t])
{ {
case '0': tap = TAP_EMPTY; break; case '0': tap = TAP_EMPTY; break;
case '1': tap = TAP_TAP; break; case '1': tap = TAP_ORIGINAL_TAP; break;
default: ASSERT(0); tap = TAP_EMPTY; break; default: ASSERT(0); tap = TAP_EMPTY; break;
} }
notedata.SetTapNote(t, row, tap); notedata.SetTapNote(t, row, tap);
+11 -8
View File
@@ -15,14 +15,14 @@ CString NotesWriterDWI::NotesToDWIString( const TapNote cNoteCols[6] )
CString taps, holds, ret; CString taps, holds, ret;
for( int col = 0; col < 6; ++col ) for( int col = 0; col < 6; ++col )
{ {
switch( cNoteCols[col] ) switch( cNoteCols[col].type )
{ {
case TAP_EMPTY: case TapNote::empty:
case TAP_MINE: case TapNote::mine:
continue; continue;
} }
if( cNoteCols[col] == TAP_HOLD_HEAD ) if( cNoteCols[col].type == TapNote::hold_head )
holds += dirs[col]; holds += dirs[col];
else else
taps += dirs[col]; taps += dirs[col];
@@ -83,10 +83,13 @@ CString NotesWriterDWI::NotesToDWIString( const TapNote cNoteCols[6] )
CString NotesWriterDWI::NotesToDWIString( TapNote cNoteCol1, TapNote cNoteCol2, TapNote cNoteCol3, TapNote cNoteCol4, TapNote cNoteCol5, TapNote cNoteCol6 ) CString NotesWriterDWI::NotesToDWIString( TapNote cNoteCol1, TapNote cNoteCol2, TapNote cNoteCol3, TapNote cNoteCol4, TapNote cNoteCol5, TapNote cNoteCol6 )
{ {
const TapNote cNoteCols[6] = { TapNote cNoteCols[6];
cNoteCol1, cNoteCol2, cNoteCol3, cNoteCol4, cNoteCol5, cNoteCol6 cNoteCols[0] = cNoteCol1;
}; cNoteCols[1] = cNoteCol2;
cNoteCols[2] = cNoteCol3;
cNoteCols[3] = cNoteCol4;
cNoteCols[4] = cNoteCol5;
cNoteCols[5] = cNoteCol6;
return NotesToDWIString( cNoteCols ); return NotesToDWIString( cNoteCols );
} }
+45 -47
View File
@@ -597,7 +597,7 @@ int PlayerMinus::GetClosestNoteDirectional( int col, float fBeat, float fMaxBeat
int iCurrentIndex = iIndexStartLookingAt + (iDirection * delta); int iCurrentIndex = iIndexStartLookingAt + (iDirection * delta);
if( iCurrentIndex < 0) continue; if( iCurrentIndex < 0) continue;
if( GetTapNote(col, iCurrentIndex) == TAP_EMPTY) continue; /* no note here */ if( GetTapNote(col, iCurrentIndex).type == TapNote::empty) continue; /* no note here */
if( GetTapNoteScore(col, iCurrentIndex) != TNS_NONE ) continue; /* this note has a score already */ if( GetTapNoteScore(col, iCurrentIndex) != TNS_NONE ) continue; /* this note has a score already */
return iCurrentIndex; return iCurrentIndex;
@@ -678,11 +678,11 @@ void PlayerMinus::Step( int col, RageTimer tm )
switch( GAMESTATE->m_PlayerController[m_PlayerNumber] ) switch( GAMESTATE->m_PlayerController[m_PlayerNumber] )
{ {
case PC_HUMAN: { case PC_HUMAN:
switch( tn ) switch( tn.type )
{ {
case TAP_MINE: case TapNote::mine:
// stepped too close to mine? // stepped too close to mine?
if( fSecondsFromPerfect <= ADJUSTED_WINDOW(Mine) ) if( fSecondsFromPerfect <= ADJUSTED_WINDOW(Mine) )
{ {
@@ -698,42 +698,38 @@ void PlayerMinus::Step( int col, RageTimer tm )
} }
break; break;
default: // not a mine case TapNote::attack:
if( IsTapAttack(tn) ) score = TNS_NONE; // don't score this as anything
if( fSecondsFromPerfect <= ADJUSTED_WINDOW(Attack) )
{ {
score = TNS_NONE; // don't score this as anything m_soundAttackLaunch.Play();
if( fSecondsFromPerfect <= ADJUSTED_WINDOW(Attack) ) // put attack in effect
{ Attack attack = this->GetAttackAt( col, iIndexOverlappingNote );
m_soundAttackLaunch.Play(); GAMESTATE->LaunchAttack( OPPOSITE_PLAYER[m_PlayerNumber], attack );
// put attack in effect
Attack attack = this->GetAttackAt( col, iIndexOverlappingNote );
GAMESTATE->LaunchAttack( OPPOSITE_PLAYER[m_PlayerNumber], attack );
// remove all TapAttacks on this row // remove all TapAttacks on this row
for( int t=0; t<this->GetNumTracks(); t++ ) for( int t=0; t<this->GetNumTracks(); t++ )
{
TapNote tn = this->GetTapNote(t, iIndexOverlappingNote);
if( tn.type == TapNote::attack )
{ {
TapNote tn = this->GetTapNote(t, iIndexOverlappingNote); this->SetTapNote(col, iIndexOverlappingNote, TAP_EMPTY); // remove from NoteField
if( IsTapAttack(tn) ) m_pNoteField->SetTapNote(col, iIndexOverlappingNote, TAP_EMPTY); // remove from NoteField
{
this->SetTapNote(col, iIndexOverlappingNote, TAP_EMPTY); // remove from NoteField
m_pNoteField->SetTapNote(col, iIndexOverlappingNote, TAP_EMPTY); // remove from NoteField
}
} }
} }
} }
else // !IsTapAttack break;
{ default:
if( fSecondsFromPerfect <= ADJUSTED_WINDOW(Marvelous) ) score = TNS_MARVELOUS; if( fSecondsFromPerfect <= ADJUSTED_WINDOW(Marvelous) ) score = TNS_MARVELOUS;
else if( fSecondsFromPerfect <= ADJUSTED_WINDOW(Perfect) ) score = TNS_PERFECT; else if( fSecondsFromPerfect <= ADJUSTED_WINDOW(Perfect) ) score = TNS_PERFECT;
else if( fSecondsFromPerfect <= ADJUSTED_WINDOW(Great) ) score = TNS_GREAT; else if( fSecondsFromPerfect <= ADJUSTED_WINDOW(Great) ) score = TNS_GREAT;
else if( fSecondsFromPerfect <= ADJUSTED_WINDOW(Good) ) score = TNS_GOOD; else if( fSecondsFromPerfect <= ADJUSTED_WINDOW(Good) ) score = TNS_GOOD;
else if( fSecondsFromPerfect <= ADJUSTED_WINDOW(Boo) ) score = TNS_BOO; else if( fSecondsFromPerfect <= ADJUSTED_WINDOW(Boo) ) score = TNS_BOO;
else score = TNS_NONE; else score = TNS_NONE;
}
break; break;
} }
break; break;
}
case PC_CPU: case PC_CPU:
case PC_AUTOPLAY: case PC_AUTOPLAY:
switch( GAMESTATE->m_PlayerController[m_PlayerNumber] ) switch( GAMESTATE->m_PlayerController[m_PlayerNumber] )
@@ -748,14 +744,14 @@ void PlayerMinus::Step( int col, RageTimer tm )
// TRICKY: We're asking the AI to judge mines. consider TNS_GOOD and below // TRICKY: We're asking the AI to judge mines. consider TNS_GOOD and below
// as "mine was hit" and everything else as "mine was avoided" // as "mine was hit" and everything else as "mine was avoided"
if( tn == TAP_MINE ) if( tn.type == TapNote::mine )
{ {
// The CPU hits a lot of mines. Only consider hitting the // The CPU hits a lot of mines. Only consider hitting the
// first mine for a row. We know we're the first mine if // first mine for a row. We know we're the first mine if
// there are are no mines to the left of us. // there are are no mines to the left of us.
for( int t=0; t<col; t++ ) for( int t=0; t<col; t++ )
{ {
if( TAP_MINE == GetTapNote(t,iIndexOverlappingNote) ) // there's a mine to the left of us if( GetTapNote(t,iIndexOverlappingNote).type == TapNote::mine ) // there's a mine to the left of us
return; // avoid return; // avoid
} }
@@ -789,7 +785,7 @@ void PlayerMinus::Step( int col, RageTimer tm )
return; return;
if( IsTapAttack(tn) && score > TNS_GOOD ) if( tn.type == TapNote::attack && score > TNS_GOOD )
{ {
m_soundAttackLaunch.Play(); m_soundAttackLaunch.Play();
score = TNS_NONE; // don't score this as anything score = TNS_NONE; // don't score this as anything
@@ -802,7 +798,7 @@ void PlayerMinus::Step( int col, RageTimer tm )
for( int t=0; t<this->GetNumTracks(); t++ ) for( int t=0; t<this->GetNumTracks(); t++ )
{ {
TapNote tn = this->GetTapNote(t, iIndexOverlappingNote); TapNote tn = this->GetTapNote(t, iIndexOverlappingNote);
if( IsTapAttack(tn) ) if( tn.type == TapNote::attack )
{ {
this->SetTapNote(col, iIndexOverlappingNote, TAP_EMPTY); // remove from NoteField this->SetTapNote(col, iIndexOverlappingNote, TAP_EMPTY); // remove from NoteField
m_pNoteField->SetTapNote(col, iIndexOverlappingNote, TAP_EMPTY); // remove from NoteField m_pNoteField->SetTapNote(col, iIndexOverlappingNote, TAP_EMPTY); // remove from NoteField
@@ -863,11 +859,10 @@ void PlayerMinus::Step( int col, RageTimer tm )
if( m_pSecondaryScoreKeeper ) if( m_pSecondaryScoreKeeper )
m_pSecondaryScoreKeeper->HandleTapScore( score ); m_pSecondaryScoreKeeper->HandleTapScore( score );
switch( tn ) switch( tn.type )
{ {
case TAP_TAP: case TapNote::tap:
case TAP_HOLD_HEAD: case TapNote::hold_head:
case TAP_ADDITION:
// don't the row if this note is a mine or tap attack // don't the row if this note is a mine or tap attack
if( IsRowCompletelyJudged(iIndexOverlappingNote) ) if( IsRowCompletelyJudged(iIndexOverlappingNote) )
OnRowCompletelyJudged( iIndexOverlappingNote ); OnRowCompletelyJudged( iIndexOverlappingNote );
@@ -945,8 +940,8 @@ void PlayerMinus::OnRowCompletelyJudged( int iIndexThatWasSteppedOn )
{ {
TapNote tn = GetTapNote(c, iIndexThatWasSteppedOn); TapNote tn = GetTapNote(c, iIndexThatWasSteppedOn);
if( tn == TAP_EMPTY ) continue; /* no note in this col */ if( tn.type == TapNote::empty ) continue; /* no note in this col */
if( tn == TAP_MINE ) continue; /* don't flash on mines b/c they're supposed to be missed */ if( tn.type == TapNote::mine ) continue; /* don't flash on mines b/c they're supposed to be missed */
// If the score is great or better, remove the note from the screen to // If the score is great or better, remove the note from the screen to
// indicate success. (Or always if blind is on.) // indicate success. (Or always if blind is on.)
@@ -1011,10 +1006,12 @@ void PlayerMinus::UpdateTapNotesMissedOlderThan( float fMissIfOlderThanSeconds )
bool MissedNoteOnThisRow = false; bool MissedNoteOnThisRow = false;
for( int t=0; t<GetNumTracks(); t++ ) for( int t=0; t<GetNumTracks(); t++ )
{ {
if( GetTapNote(t, r) == TAP_EMPTY) continue; /* no note here */ if( GetTapNote(t, r).type == TapNote::empty) /* no note here */
if( GetTapNoteScore(t, r) != TNS_NONE ) continue; /* note here is already hit */ continue;
if( GetTapNoteScore(t, r) != TNS_NONE ) /* note here is already hit */
continue;
if( GetTapNote(t, r) != TAP_MINE ) if( GetTapNote(t, r).type != TapNote::mine )
{ {
// A normal note. Penalize for not stepping on it. // A normal note. Penalize for not stepping on it.
MissedNoteOnThisRow = true; MissedNoteOnThisRow = true;
@@ -1047,7 +1044,7 @@ void PlayerMinus::CrossedRow( int iNoteRow )
if( GAMESTATE->m_PlayerController[m_PlayerNumber] != PC_HUMAN ) if( GAMESTATE->m_PlayerController[m_PlayerNumber] != PC_HUMAN )
{ {
for( int t=0; t<GetNumTracks(); t++ ) for( int t=0; t<GetNumTracks(); t++ )
if( GetTapNote(t, iNoteRow) != TAP_EMPTY ) if( GetTapNote(t, iNoteRow).type != TapNote::empty )
if( GetTapNoteScore(t, iNoteRow) == TNS_NONE ) if( GetTapNoteScore(t, iNoteRow) == TNS_NONE )
Step( t, now ); Step( t, now );
} }
@@ -1059,7 +1056,7 @@ void PlayerMinus::CrossedMineRow( int iNoteRow )
RageTimer now; RageTimer now;
for( int t=0; t<GetNumTracks(); t++ ) for( int t=0; t<GetNumTracks(); t++ )
{ {
if( GetTapNote(t,iNoteRow) == TAP_MINE ) if( GetTapNote(t,iNoteRow).type == TapNote::mine )
{ {
const StyleInput StyleI( m_PlayerNumber, t ); const StyleInput StyleI( m_PlayerNumber, t );
const GameInput GameI = GAMESTATE->GetCurrentStyle()->StyleInputToGameInput( StyleI ); const GameInput GameI = GAMESTATE->GetCurrentStyle()->StyleInputToGameInput( StyleI );
@@ -1091,7 +1088,8 @@ void PlayerMinus::RandomiseNotes( int iNoteRow )
const TapNote t1 = GetTapNote(t, NewNoteRow); const TapNote t1 = GetTapNote(t, NewNoteRow);
const TapNote t2 = GetTapNote(iRandomTrackToSwapWith, NewNoteRow); const TapNote t2 = GetTapNote(iRandomTrackToSwapWith, NewNoteRow);
if( (t1 == TAP_TAP || t1 == TAP_EMPTY) && (t2 == TAP_TAP || t2 == TAP_EMPTY) ) if( (t1.type == TapNote::tap || t1.type == TapNote::empty) &&
(t2.type == TapNote::tap || t2.type == TapNote::empty) )
{ {
SetTapNote(t, NewNoteRow, t2); SetTapNote(t, NewNoteRow, t2);
SetTapNote(iRandomTrackToSwapWith, NewNoteRow, t1); SetTapNote(iRandomTrackToSwapWith, NewNoteRow, t1);
+1
View File
@@ -20,6 +20,7 @@
#include "MemoryCardManager.h" #include "MemoryCardManager.h"
#include "XmlFile.h" #include "XmlFile.h"
#include "StepsUtil.h" #include "StepsUtil.h"
#include "Style.h"
ProfileManager* PROFILEMAN = NULL; // global and accessable from anywhere in our program ProfileManager* PROFILEMAN = NULL; // global and accessable from anywhere in our program
+4 -4
View File
@@ -726,7 +726,7 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
} }
} }
if( m_NoteFieldEdit.GetTapNote(iCol, iSongIndex) != TAP_EMPTY ) if( m_NoteFieldEdit.GetTapNote(iCol, iSongIndex).type != TapNote::empty )
{ {
m_NoteFieldEdit.SetTapNote( iCol, iSongIndex, TAP_EMPTY ); m_NoteFieldEdit.SetTapNote( iCol, iSongIndex, TAP_EMPTY );
return; return;
@@ -735,7 +735,7 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
// Hold LShift to lay mine, hold RShift to lay an attack // Hold LShift to lay mine, hold RShift to lay an attack
if( INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_LSHIFT)) ) if( INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_LSHIFT)) )
{ {
m_NoteFieldEdit.SetTapNote(iCol, iSongIndex, TAP_MINE ); m_NoteFieldEdit.SetTapNote(iCol, iSongIndex, TAP_ORIGINAL_MINE );
} }
else if( INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_RSHIFT)) ) else if( INPUTFILTER->IsBeingPressed(DeviceInput(DEVICE_KEYBOARD, KEY_RSHIFT)) )
{ {
@@ -744,7 +744,7 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
} }
else else
{ {
m_NoteFieldEdit.SetTapNote(iCol, iSongIndex, TAP_TAP ); m_NoteFieldEdit.SetTapNote(iCol, iSongIndex, TAP_ORIGINAL_TAP );
} }
} }
break; break;
@@ -1214,7 +1214,7 @@ void ScreenEdit::InputRecord( const DeviceInput& DeviceI, const InputEventType t
if( iRow < 0 ) if( iRow < 0 )
break; break;
m_NoteFieldRecord.SetTapNote(iCol, iRow, TAP_TAP); m_NoteFieldRecord.SetTapNote(iCol, iRow, TAP_ORIGINAL_TAP);
m_NoteFieldRecord.Step( iCol, TNS_MARVELOUS ); m_NoteFieldRecord.Step( iCol, TNS_MARVELOUS );
} }
break; break;
+1 -1
View File
@@ -26,7 +26,7 @@
#include "RageDisplay.h" #include "RageDisplay.h"
#include "StepMania.h" #include "StepMania.h"
#include "CryptManager.h" #include "CryptManager.h"
#include <ctime> #include "Style.h"
const int NUM_SCORE_DIGITS = 9; const int NUM_SCORE_DIGITS = 9;
+2 -2
View File
@@ -1510,7 +1510,7 @@ void ScreenGameplay::Update( float fDeltaTime )
{ {
// Somehow, step data was getting majorly corrupted, therefor causing light // Somehow, step data was getting majorly corrupted, therefor causing light
// signals to be sent at incorrect times where notes were not even present. // signals to be sent at incorrect times where notes were not even present.
bool bBlink = (m_CabinetLightsNoteData.GetTapNote( cl, r ) != TAP_EMPTY); bool bBlink = (m_CabinetLightsNoteData.GetTapNote( cl, r ).type != TapNote::empty );
bBlinkCabinetLight[cl] |= bBlink; bBlinkCabinetLight[cl] |= bBlink;
} }
FOREACH_EnabledPlayer( pn ) FOREACH_EnabledPlayer( pn )
@@ -1518,7 +1518,7 @@ void ScreenGameplay::Update( float fDeltaTime )
for( int t=0; t<m_Player[pn].GetNumTracks(); t++ ) for( int t=0; t<m_Player[pn].GetNumTracks(); t++ )
{ {
TapNote tn = m_Player[pn].GetTapNote(t,r); TapNote tn = m_Player[pn].GetTapNote(t,r);
bool bBlink = (tn != TAP_EMPTY && tn != TAP_MINE); bool bBlink = (tn.type != TapNote::empty && tn.type != TapNote::mine);
if( bBlink ) if( bBlink )
{ {
StyleInput si( pn, t ); StyleInput si( pn, t );
+1 -1
View File
@@ -200,7 +200,7 @@ void ScreenHowToPlay::Step()
{ {
const int iNumTracks = m_NoteData.GetNumTracks(); const int iNumTracks = m_NoteData.GetNumTracks();
for( int k=0; k<iNumTracks; k++ ) for( int k=0; k<iNumTracks; k++ )
if( m_NoteData.GetTapNote(k, iNoteRow ) == TAP_TAP ) if( m_NoteData.GetTapNote(k, iNoteRow).type == TapNote::tap )
iStep |= 1 << k; iStep |= 1 << k;
switch( iStep ) switch( iStep )
@@ -21,6 +21,7 @@
#include "StageStats.h" #include "StageStats.h"
#include "RageDisplay.h" #include "RageDisplay.h"
#include "Foreach.h" #include "Foreach.h"
#include "Style.h"
// //
+1
View File
@@ -23,6 +23,7 @@
#include "StageStats.h" #include "StageStats.h"
#include "StepsUtil.h" #include "StepsUtil.h"
#include "Foreach.h" #include "Foreach.h"
#include "Style.h"
const int NUM_SCORE_DIGITS = 9; const int NUM_SCORE_DIGITS = 9;
+1
View File
@@ -30,6 +30,7 @@
#include "CatalogXml.h" #include "CatalogXml.h"
#include "Foreach.h" #include "Foreach.h"
#include "StageStats.h" #include "StageStats.h"
#include "Style.h"
SongManager* SONGMAN = NULL; // global and accessable from anywhere in our program SongManager* SONGMAN = NULL; // global and accessable from anywhere in our program
+1
View File
@@ -3,6 +3,7 @@
#include "GameManager.h" #include "GameManager.h"
#include "XmlFile.h" #include "XmlFile.h"
#include "Game.h" #include "Game.h"
#include "Style.h"
void StyleID::FromStyle( const Style *p ) void StyleID::FromStyle( const Style *p )
+2 -2
View File
@@ -1,8 +1,8 @@
#ifndef STYLEUTIL_H #ifndef STYLEUTIL_H
#define STYLEUTIL_H #define STYLEUTIL_H
#include "Style.h" class Style;
class Song;
struct XNode; struct XNode;
class StyleID class StyleID