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
int iStep = 0;
const int iNumTracks = m_NoteData[pn].GetNumTracks();
for(int k=0; k<iNumTracks; k++)
if(m_NoteData[pn].GetTapNote(k, iRow) == TAP_TAP)
iStep |= 1 << k;
for( int t=0; t<iNumTracks; t++ )
if( m_NoteData[pn].GetTapNote(t,iRow).type == TapNote::tap )
iStep |= 1 << t;
// Assign new data
this->Step(pn, iStep);
+1
View File
@@ -17,6 +17,7 @@
#include "StyleUtil.h"
#include "ThemeManager.h"
#include "PrefsManager.h"
#include "Style.h"
#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()))
+1
View File
@@ -15,6 +15,7 @@
#include "MemoryCardManager.h"
#include "song.h"
#include "Game.h"
#include "Style.h"
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++ )
{
TapNote tn = From.GetTapNote(c, f);
if( IsTapAttack(tn) )
TapNote tn = From.GetTapNote( c, f );
if( tn.type == TapNote::attack )
{
Attack attack = From.GetAttackAt(c,f);
Attack attack = From.GetAttackAt( c, f );
To.SetTapAttackNote( c, t, attack );
}
else
{
To.SetTapNote(c, t, tn);
To.SetTapNote( c, t, tn );
}
}
f++;
@@ -131,7 +131,7 @@ bool NoteData::IsRowEmpty( int index ) const
return true;
for( int t=0; t<m_iNumTracks; t++ )
if( GetTapNoteX(t, index) != TAP_EMPTY )
if( GetTapNoteX(t, index).type != TapNote::empty )
return false;
return true;
}
@@ -144,7 +144,7 @@ bool NoteData::IsRangeEmpty( int track, int iIndexBegin, int iIndexEnd ) const
CLAMP( iIndexEnd, 0, GetNumRows()-1 );
for( int i=iIndexBegin; i<=iIndexEnd; i++ )
if( GetTapNoteX(track,i) != TAP_EMPTY )
if( GetTapNoteX(track,i).type != TapNote::empty )
return false;
return true;
}
@@ -153,7 +153,7 @@ int NoteData::GetNumTapNonEmptyTracks( int index ) const
{
int iNum = 0;
for( int t=0; t<m_iNumTracks; t++ )
if( GetTapNote(t, index) != TAP_EMPTY )
if( GetTapNote(t, index).type != TapNote::empty )
iNum++;
return iNum;
}
@@ -161,7 +161,7 @@ int NoteData::GetNumTapNonEmptyTracks( int index ) const
void NoteData::GetTapNonEmptyTracks( int index, set<int>& addTo ) const
{
for( int t=0; t<m_iNumTracks; t++ )
if( GetTapNote(t, index) != TAP_EMPTY )
if( GetTapNote(t, index).type != TapNote::empty )
addTo.insert(t);
}
@@ -172,7 +172,7 @@ int NoteData::GetFirstNonEmptyTrack( int index ) const
return 0;
for( int t=0; t<m_iNumTracks; t++ )
if( GetTapNoteX( t, index ) != TAP_EMPTY )
if( GetTapNoteX( t, index ).type != TapNote::empty )
return t;
return -1;
}
@@ -187,7 +187,7 @@ int NoteData::GetNumTracksWithTap( int index ) const
for( int t=0; t<m_iNumTracks; t++ )
{
TapNote tn = GetTapNoteX( t, index );
if( tn == TAP_TAP )
if( tn.type == TapNote::tap )
iNum++;
}
return iNum;
@@ -203,7 +203,7 @@ int NoteData::GetNumTracksWithTapOrHoldHead( int index ) const
for( int t=0; t<m_iNumTracks; t++ )
{
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++;
}
return iNum;
@@ -218,7 +218,7 @@ int NoteData::GetFirstTrackWithTap( int index ) const
for( int t=0; t<m_iNumTracks; t++ )
{
TapNote tn = GetTapNoteX( t, index );
if( tn == TAP_TAP || tn == TAP_ADDITION )
if( tn.type == TapNote::tap )
return t;
}
return -1;
@@ -233,7 +233,7 @@ int NoteData::GetFirstTrackWithTapOrHoldHead( int index ) const
for( int t=0; t<m_iNumTracks; t++ )
{
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 -1;
@@ -268,10 +268,10 @@ void NoteData::AddHoldNote( HoldNote add )
// delete TapNotes under this HoldNote
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
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);
}
@@ -309,24 +309,25 @@ void NoteData::SetTapAttackNote( int track, int row, Attack attack )
PruneUnusedAttacksFromMap();
// find first unused attack index
TapNote tn;
for( tn = TAP_ATTACK_BEGIN; tn<=TAP_ATTACK_END; tn++ )
for( int i=0; i<MAX_NUM_ATTACKS; i++ )
{
if( m_AttackMap.find(tn) == m_AttackMap.end() ) // this TapNote value is free to use
goto done_searching;
if( m_AttackMap.find(i) == m_AttackMap.end() ) // this index is free to use
{
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);
done_searching:
m_AttackMap[tn] = attack;
SetTapNote( track, row, tn );
}
void NoteData::PruneUnusedAttacksFromMap()
{
// Add all used AttackNote values to a map.
map<TapNote,int> mapAttackToNothing;
// Add all used AttackNote index values to a map.
set<unsigned> setUsedIndices;
int num_rows = GetNumRows();
for( int t=0; t<m_iNumTracks; t++ )
@@ -334,34 +335,33 @@ void NoteData::PruneUnusedAttacksFromMap()
for( int r=0; r<num_rows; r++ )
{
TapNote tn = GetTapNote(t, r);
if( IsTapAttack( tn ) )
mapAttackToNothing[tn] = 1;
if( tn.type == TapNote::attack )
setUsedIndices.insert( tn.attackIndex );
}
}
// Remove all items from m_AttackMap that don't have corresponding
// 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 bActuallyUsed = mapAttackToNothing.find(tn) != mapAttackToNothing.end();
bool bInAttackMap = m_AttackMap.find(i) != m_AttackMap.end();
bool bActuallyUsed = setUsedIndices.find(i) != setUsedIndices.end();
if( bActuallyUsed && !bInAttackMap )
ASSERT( 0 );
ASSERT(0); // something earlier than us didn't enforce consistency
if( bInAttackMap && !bActuallyUsed )
{
m_AttackMap.erase( tn );
}
m_AttackMap.erase( i );
}
}
const Attack& NoteData::GetAttackAt( int track, int row )
{
TapNote tn = GetTapNote(track, row);
ASSERT( IsTapAttack(tn) );
ASSERT( m_AttackMap.find(tn) != m_AttackMap.end() );
return m_AttackMap[tn];
ASSERT( tn.type == TapNote::attack ); // don't call this if the TapNote here isn't an attack
map<unsigned,Attack>::iterator iter = m_AttackMap.find( tn.attackIndex );
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++ )
{
TapNote tn = GetTapNoteX(t, i);
if( tn != TAP_EMPTY && tn != TAP_MINE )
if( tn.type != TapNote::empty && tn.type != TapNote::mine )
iNumNotes++;
}
}
@@ -486,7 +486,7 @@ int NoteData::GetNumMines( float fStartBeat, float fEndBeat ) const
for( int t=0; t<m_iNumTracks; t++ )
{
for( int i=iStartIndex; i<=iEndIndex; i++ )
if( GetTapNoteX(t, i) == TAP_MINE )
if( GetTapNoteX(t, i).type == TapNote::mine )
iNumMines++;
}
@@ -514,8 +514,13 @@ int NoteData::RowNeedsHands( const int row ) const
for( int t=0; t<m_iNumTracks; t++ )
{
TapNote tn = GetTapNoteX(t, row);
if( tn == TAP_MINE || tn == TAP_EMPTY || tn == TAP_HOLD_TAIL ) // mines don't count
continue;
switch( tn.type )
{
case TapNote::mine:
case TapNote::empty:
case TapNote::hold_tail:
continue; // skip these types - they don't count
}
++iNumNotesThisIndex;
}
@@ -585,7 +590,7 @@ int NoteData::GetNumN( int MinTaps, float fStartBeat, float fEndBeat ) const
for( int t=0; t<m_iNumTracks; t++ )
{
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++;
}
if( iNumNotesThisIndex >= MinTaps )
@@ -622,20 +627,21 @@ void NoteData::Convert2sAnd3sToHoldNotes()
{
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;
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
{
// end hold on the next note we see
if( GetTapNote(col, j) == TAP_EMPTY )
// End hold on the next note we see. This should be a hold_tail if the
// data is in a consistent state, but doesn't have to be.
if( GetTapNote(col, j).type == TapNote::empty )
continue;
SetTapNote(col, j, TAP_EMPTY);
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( hn.iStartRow != hn.iEndRow )
{
SetTapNote( hn.iTrack, hn.iStartRow, TAP_HOLD_HEAD );
SetTapNote( hn.iTrack, hn.iEndRow, TAP_HOLD_TAIL );
SetTapNote( hn.iTrack, hn.iStartRow, TAP_ORIGINAL_HOLD_HEAD );
SetTapNote( hn.iTrack, hn.iEndRow, TAP_ORIGINAL_HOLD_TAIL );
}
}
m_HoldNotes.clear();
@@ -699,19 +705,19 @@ void NoteData::Convert4sToHoldNotes()
{
for( int i=0; i<=rows; i++ ) // foreach TapNote element
{
if( GetTapNote(col, i) != TAP_HOLD ) // this is a HoldNote body
continue;
HoldNote hn( col, i, 0 );
// search for end of HoldNote
do {
if( GetTapNote(col, i).type == TapNote::hold ) // this is a HoldNote body
{
HoldNote hn( col, i, 0 );
// search for end of HoldNote
do {
SetTapNote(col, i, TAP_EMPTY);
i++;
} while( GetTapNote(col, i).type == TapNote::hold );
SetTapNote(col, i, TAP_EMPTY);
i++;
} while( GetTapNote(col, i) == TAP_HOLD);
SetTapNote(col, i, TAP_EMPTY);
hn.iEndRow = i;
AddHoldNote( hn );
hn.iEndRow = i;
AddHoldNote( hn );
}
}
}
}
@@ -722,9 +728,8 @@ void NoteData::ConvertHoldNotesTo4s()
for( int i=0; i<GetNumHoldNotes(); i++ )
{
const HoldNote &hn = GetHoldNote(i);
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();
}
@@ -767,7 +772,7 @@ void NoteData::PadTapNotes(int rows)
needed += 100; /* optimization: give it a little more than it needs */
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)
@@ -800,7 +805,7 @@ void NoteData::EliminateAllButOneTap(int row)
int track;
for(track = 0; track < m_iNumTracks; ++track)
{
if( m_TapNotes[track][row] == TAP_TAP )
if( m_TapNotes[track][row].type == TapNote::tap )
break;
}
@@ -808,7 +813,7 @@ void NoteData::EliminateAllButOneTap(int row)
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;
}
}
+5 -4
View File
@@ -17,7 +17,7 @@ class NoteData
vector<HoldNote> m_HoldNotes;
map<TapNote,Attack> m_AttackMap;
map<unsigned,Attack> m_AttackMap;
/* Pad m_TapNotes so it includes the row "rows". */
void PadTapNotes(int rows);
@@ -36,14 +36,15 @@ public:
void SetNumTracks( int iNewNumTracks );
// TODO: Think of better accessors
const map<TapNote,Attack>& GetAttackMap() const { return m_AttackMap; }
map<TapNote,Attack>& GetAttackMap() { return m_AttackMap; }
const map<unsigned,Attack>& GetAttackMap() const { return m_AttackMap; }
map<unsigned,Attack>& GetAttackMap() { return m_AttackMap; }
/* Return the note at the given track and row. Row may be out of
* range; pretend the song goes on with TAP_EMPTYs indefinitely. */
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];
}
void ReserveRows( int row );
+67 -67
View File
@@ -95,21 +95,22 @@ void NoteDataUtil::LoadFromSMNoteDataString( NoteData &out, CString sSMNoteData,
for( int c=0; c<min(sMeasureLine.GetLength(),out.GetNumTracks()); c++ )
{
TapNote t;
switch(sMeasureLine[c])
char ch = sMeasureLine[c];
switch( ch )
{
case '0': t = TAP_EMPTY; break;
case '1': t = TAP_TAP; break;
case '2': t = TAP_HOLD_HEAD; break;
case '3': t = TAP_HOLD_TAIL; break;
case '0': t = TAP_EMPTY; break;
case '1': t = TAP_ORIGINAL_TAP; break;
case '2': t = TAP_ORIGINAL_HOLD_HEAD; break;
case '3': t = TAP_ORIGINAL_HOLD_TAIL; break;
// case 'm':
// Don't be loose with the definition. Use only 'M' since
// that's what we've been writing to disk. -Chris
case 'M': t = TAP_MINE; break;
case 'M':
t = TAP_ORIGINAL_MINE; break;
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
{
@@ -118,7 +119,7 @@ void NoteDataUtil::LoadFromSMNoteDataString( NoteData &out, CString sSMNoteData,
* due to invalid data. We should probably check for this when
* we load SM data for the first time ... */
// ASSERT(0);
t = TAP_EMPTY;
t = TAP_EMPTY;
}
break;
}
@@ -154,7 +155,7 @@ void NoteDataUtil::LoadFromSMNoteDataString( NoteData &out, CString sSMNoteData,
if( asBits[0].empty() )
continue;
TapNote tn = asBits[0][0];
int attack_index = asBits[0][0] - 'a';
Attack attack;
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.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);
char c;
switch( tn )
switch( tn.type )
{
case TAP_EMPTY: c = '0'; break;
case TAP_TAP: c = '1'; break;
case TAP_HOLD_HEAD: c = '2'; break;
case TAP_HOLD_TAIL: c = '3'; break;
case TAP_MINE: c = 'M'; break;
case TapNote::empty: c = '0'; break;
case TapNote::tap: c = '1'; break;
case TapNote::hold_head: c = '2'; break;
case TapNote::hold_tail: c = '3'; break;
case TapNote::mine: c = 'M'; break;
case TapNote::attack: c = 'a' + (char)tn.attackIndex ; break;
default:
if( IsTapAttack(tn) )
{
c = tn;
}
else
{
ASSERT(0);
c = '0';
}
ASSERT(0);
c = '0';
break;
}
sRet.append(1, c);
@@ -239,15 +234,16 @@ void NoteDataUtil::GetSMNoteDataString( const NoteData &in_, CString &notes_out,
//
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++ )
{
TapNote tn = iter->first;
int attackIndex = iter->first;
char ch = 'a' + (char)attackIndex;
Attack attack = iter->second;
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 );
@@ -298,8 +294,8 @@ void NoteDataUtil::LoadTransformedSlidingWindow( const NoteData &in, NoteData &o
if( r )
for( int t=0; t<=Original.GetNumTracks(); t++ )
{
if( Original.GetTapNote(t, r) == TAP_HOLD &&
Original.GetTapNote(t, r-1) == TAP_HOLD)
if( Original.GetTapNote(t,r).type == TapNote::hold &&
Original.GetTapNote(t,r-1).type == TapNote::hold )
{
bHoldCrossesThisMeasure = true;
break;
@@ -355,7 +351,7 @@ void NoteDataUtil::LoadOverlapped( const NoteData &input, NoteData &out, int iNe
int &iTrackTo = DestRow[i];
const TapNote iStepFrom = in.GetTapNote( iTrackFrom, row );
if( iStepFrom == TAP_EMPTY )
if( iStepFrom.type == TapNote::empty )
continue;
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. */
bool bHoldNoteOnThisRow = false;
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;
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 );
}
}
@@ -524,7 +520,7 @@ void NoteDataUtil::RemoveHoldNotes(NoteData &in, float fStartBeat, float fEndBea
continue; // skip
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 );
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 );
iTracksToRemove--;
}
else if( in.GetTapNote(t,r) == TAP_HOLD_HEAD )
else if( in.GetTapNote(t,r).type == TapNote::hold_head )
{
int 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);
for( int t=0; t<in.GetNumTracks(); t++ )
for( int r=iRowStart; r<=iRowEnd; r++ )
if( in.GetTapNote(t,r)==TAP_MINE )
in.SetTapNote(t,r,TAP_EMPTY);
if( in.GetTapNote(t,r).type == TapNote::mine )
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++ )
{
TapNote tn1 = in.GetTapNote(t1, r);
if( tn1==TAP_HOLD )
if( tn1.type == TapNote::hold )
continue;
// 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();
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;
// swap
@@ -856,7 +852,7 @@ void NoteDataUtil::Little(NoteData &in, float fStartBeat, float fEndBeat)
for( i=0; i<=max_row; i+=1 )
if( i % ROWS_PER_BEAT != 0 )
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-- )
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--;
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();
}
in.SetTapNote(iTrackToAdd, i, TAP_ADDITION);
in.SetTapNote(iTrackToAdd, i, TAP_ADDITION_TAP);
}
in.Convert4sToHoldNotes();
@@ -1029,7 +1025,7 @@ void NoteDataUtil::InsertIntelligentTaps(
}
done_looking_for_track_to_add:
in.SetTapNote(iTrackOfNoteToAdd, iRowToAdd, TAP_ADDITION);
in.SetTapNote(iTrackOfNoteToAdd, iRowToAdd, TAP_ADDITION_TAP);
}
in.Convert4sToHoldNotes();
@@ -1057,8 +1053,8 @@ void NoteDataUtil::AddMines( NoteData &in, float fStartBeat, float fEndBeat )
if( iRowCount>=iPlaceEveryRows )
{
for( int t=0; t<in.GetNumTracks(); t++ )
if( in.GetTapNote(t,r) == TAP_TAP )
in.SetTapNote(t,r,TAP_MINE);
if( in.GetTapNote(t,r).type == TapNote::tap )
in.SetTapNote(t,r,TAP_ADDITION_MINE);
iRowCount = 0;
if( iPlaceEveryRows == 6 )
@@ -1087,12 +1083,12 @@ void NoteDataUtil::AddMines( NoteData &in, float fStartBeat, float fEndBeat )
continue;
// 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.
for( int t=0; t<in.GetNumTracks(); t++ )
if( in.GetTapNote(t,iMineRow) == TAP_TAP )
in.SetTapNote(t,iMineRow,TAP_MINE);
if( in.GetTapNote(t,iMineRow).type == TapNote::tap )
in.SetTapNote(t,iMineRow,TAP_ADDITION_MINE);
iRowCount = 0;
}
@@ -1148,7 +1144,7 @@ void NoteDataUtil::Echo( NoteData &in, float fStartBeat, float fEndBeat )
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 )
break;
if( in.GetTapNote(t,r) == TAP_TAP )
if( in.GetTapNote(t,r).type == TapNote::tap )
{
// Find the ending row for this hold
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,
// 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;
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++ )
{
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
// to turn this into a jump.
@@ -1261,7 +1257,7 @@ void NoteDataUtil::Stomp( NoteData &in, StepsType st, float fStartBeat, float fE
continue;
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;
TapNote note = in.GetTapNote(c, iOldIndex);
if( note == TAP_EMPTY )
if( note.type == TapNote::empty )
continue;
in.SetTapNote(c, iOldIndex, TAP_EMPTY);
const TapNote oldnote = in.GetTapNote(c, iNewIndex);
if( note == TAP_TAP &&
(oldnote == TAP_HOLD_HEAD || oldnote == TAP_HOLD_TAIL) )
if( note.type == TapNote::tap &&
(oldnote.type == TapNote::hold_head || oldnote.type == TapNote::hold_tail) )
continue; // HoldNotes override TapNotes
/* If two hold note boundaries are getting snapped together,
* merge them. */
if( (note == TAP_HOLD_HEAD && oldnote == TAP_HOLD_TAIL) ||
(note == TAP_HOLD_TAIL && oldnote == TAP_HOLD_HEAD))
if( (note.type == TapNote::hold_head && oldnote.type == TapNote::hold_tail) ||
(note.type == TapNote::hold_tail && oldnote.type == TapNote::hold_head) )
note = TAP_EMPTY;
in.SetTapNote(c, iNewIndex, note );
@@ -1414,7 +1410,7 @@ void NoteDataUtil::CollapseToOne( NoteData &in )
int max_row = in.GetLastRow();
for( int r=0; r<=max_row; r++ )
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);
in.SetTapNote(t, r, TAP_EMPTY);
@@ -1431,7 +1427,7 @@ void NoteDataUtil::CollapseLeft( NoteData &in )
{
int iNumTracksFilled = 0;
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);
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++ )
{
if( !bValidMask[t] && in.GetTapNote(t,row) != TAP_EMPTY )
if( !bValidMask[t] && in.GetTapNote(t,row).type != TapNote::empty )
return false;
}
@@ -1551,8 +1547,12 @@ void NoteDataUtil::ConvertAdditionsToRegular( NoteData &in )
{
for( int r=0; r<=in.GetLastRow(); r++ )
for( int t=0; t<in.GetNumTracks(); t++ )
if( in.GetTapNote(t,r) == TAP_ADDITION )
in.SetTapNote(t,r,TAP_TAP);
if( in.GetTapNote(t,r).source == TapNote::addition )
{
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 )
@@ -1692,7 +1692,7 @@ void NoteDataUtil::ScaleRegion( NoteData &nd, float fScale, float fStartBeat, fl
for( int t=0; t<temp2.GetNumTracks(); t++ )
{
TapNote tn = temp2.GetTapNote( t, r );
if( tn != TAP_EMPTY )
if( tn.type != TapNote::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++ )
{
if( this->GetTapNote(t, i) != TAP_EMPTY && GetTapNoteScore(t, i) >= tns )
if( this->GetTapNote(t, i).type != TapNote::empty && GetTapNoteScore(t, i) >= tns )
iNumSuccessfulTapNotes++;
}
}
@@ -59,11 +59,10 @@ int NoteDataWithScoring::GetNumNWithScore( TapNoteScore tns, int MinTaps, const
TapNoteScore minTapNoteScore = TNS_MARVELOUS;
for( int t=0; t<GetNumTracks(); t++ )
{
switch( GetTapNote(t, i) )
switch( GetTapNote(t, i).type )
{
case TAP_TAP:
case TAP_HOLD_HEAD:
case TAP_ADDITION:
case TapNote::tap:
case TapNote::hold_head:
iNumNotesThisIndex++;
minTapNoteScore = min( minTapNoteScore, GetTapNoteScore(t, i) );
}
@@ -112,7 +111,7 @@ int NoteDataWithScoring::GetSuccessfulMines( float fStartBeat, float fEndBeat )
{
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++;
}
}
@@ -143,7 +142,9 @@ int NoteDataWithScoring::GetSuccessfulHands( float fStartBeat, float fEndBeat )
for( int t=0; t<GetNumTracks(); t++ )
{
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;
if( GetTapNoteScore(t, i) <= TNS_BOO )
Missed = true;
@@ -188,7 +189,7 @@ TapNoteScore NoteDataWithScoring::MinTapNoteScore(unsigned row) const
/* Don't coun, or else the score
* will always be TNS_NONE. */
TapNote tn = GetTapNote(t, row);
if( tn == TAP_EMPTY || tn == TAP_MINE )
if( tn.type == TapNote::empty || tn.type == TapNote::mine)
continue;
score = min( score, GetTapNoteScore(t, row) );
}
@@ -212,7 +213,7 @@ int NoteDataWithScoring::LastTapNoteScoreTrack(unsigned row) const
{
/* Skip empty tracks and mines */
TapNote tn = GetTapNote(t, row);
if( tn == TAP_EMPTY || tn == TAP_MINE )
if( tn.type == TapNote::empty || tn.type == TapNote::mine )
continue;
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
{
TapNote tn = GetTapNote(c, i);
if( tn == TAP_EMPTY ) // no note here
if( tn.type == TapNote::empty ) // no note here
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
// TRICKY: If boomerang is on, then all notes in the range
@@ -601,7 +601,7 @@ void NoteField::DrawPrimitives()
bool bHoldNoteBeginsOnThisBeat = false;
for( int c2=0; c2<GetNumTracks(); c2++ )
{
if( GetTapNote(c2, i) == TAP_HOLD_HEAD )
if( GetTapNote(c2, i).type == TapNote::hold_head)
{
bHoldNoteBeginsOnThisBeat = true;
break;
@@ -615,9 +615,9 @@ void NoteField::DrawPrimitives()
bIsInSelectionRange = m_fBeginMarker<=fBeat && fBeat<=m_fEndMarker;
}
bool bIsAddition = (tn == TAP_ADDITION);
bool bIsMine = (tn == TAP_MINE);
bool bIsAttack = IsTapAttack(tn);
bool bIsAddition = (tn.source == TapNote::addition);
bool bIsMine = (tn.type == TapNote::mine);
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) );
SearchForBeat( CurDisplay, NextDisplay, NoteRowToBeat(i) );
+9
View File
@@ -1,6 +1,15 @@
#include "global.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 )
{
switch( nt )
+47 -58
View File
@@ -1,68 +1,57 @@
#ifndef 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
// '2' = hold note begin
// '3' = hold note end ('1' can also end a HoldNote) ('3' without a matching '2' is ignored
// ... for future expansion
void Set( Type type_, Source source_, unsigned attackIndex_ )
{
type = type_;
source = source_;
attackIndex = attackIndex_;
}
};
const unsigned MAX_NUM_ATTACKS = 2*2*2; // 3 bits to hold the attack index currently
typedef unsigned char TapNote;
static const TapNote TAP_EMPTY = '0';
static const TapNote TAP_TAP = '1'; /* impatient? */
static const TapNote TAP_HOLD_HEAD = '2'; // graded like a TAP_TAP
/* In 2sand3s mode, holds are deleted and TAP_HOLD_END is added: */
static const TapNote TAP_HOLD_TAIL = '3';
/* 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; }
extern TapNote TAP_EMPTY; // '0'
extern TapNote TAP_ORIGINAL_TAP; // '1'
extern TapNote TAP_ORIGINAL_HOLD_HEAD; // '2'
extern TapNote TAP_ORIGINAL_HOLD_TAIL; // '3'
extern TapNote TAP_ORIGINAL_HOLD; // '4'
extern TapNote TAP_ORIGINAL_MINE; // 'M'
extern TapNote TAP_ADDITION_TAP;
extern TapNote TAP_ADDITION_MINE;
// TODO: Don't have a hard-coded track limit.
enum
{
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 )
{
cNoteCharOut = '2';
tapNoteOut = TAP_ORIGINAL_HOLD_HEAD;
iBMSTrack -= 40;
}
else
{
cNoteCharOut = '1';
tapNoteOut = TAP_ORIGINAL_TAP;
}
switch( iBMSTrack )
@@ -293,12 +293,12 @@ bool BMSLoader::LoadFromBMSFile( const CString &sPath, Steps &out )
const int iNoteIndex = (int) ( (iMeasureNo + fPercentThroughMeasure)
* BEATS_PER_MEASURE * ROWS_PER_BEAT );
int iColumnNumber;
char cNoteChar;
TapNote tapNoteOut;
mapBMSTrackToDanceNote( iTrackNum, iColumnNumber, cNoteChar );
mapBMSTrackToDanceNote( iTrackNum, iColumnNumber, tapNoteOut );
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 "GameConstantsAndTypes.h"
#include "NoteTypes.h"
class Song;
class Steps;
@@ -10,7 +11,7 @@ class Steps;
class BMSLoader: public NotesLoader
{
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 );
StepsType CheckTracksMagic();
void ResetTracksMagic();
+4 -4
View File
@@ -266,9 +266,9 @@ bool DWILoader::LoadFromDWITokens(
DWIcharToNoteCol( c, (GameController)pad, iCol1, iCol2 );
if( iCol1 != -1 )
newNoteData.SetTapNote(iCol1, iIndex, TAP_TAP);
newNoteData.SetTapNote(iCol1, iIndex, TAP_ORIGINAL_TAP);
if( iCol2 != -1 )
newNoteData.SetTapNote(iCol2, iIndex, TAP_TAP);
newNoteData.SetTapNote(iCol2, iIndex, TAP_ORIGINAL_TAP);
if( sStepData[i] == '!' )
{
@@ -278,9 +278,9 @@ bool DWILoader::LoadFromDWITokens(
DWIcharToNoteCol( holdChar, (GameController)pad, iCol1, iCol2 );
if( iCol1 != -1 )
newNoteData.SetTapNote(iCol1, iIndex, TAP_HOLD_HEAD);
newNoteData.SetTapNote(iCol1, iIndex, TAP_ORIGINAL_HOLD_HEAD);
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;
switch(sRowString[t])
{
case '0': tap = TAP_EMPTY; break;
case '1': tap = TAP_TAP; break;
default: ASSERT(0); tap = TAP_EMPTY; break;
case '0': tap = TAP_EMPTY; break;
case '1': tap = TAP_ORIGINAL_TAP; break;
default: ASSERT(0); tap = TAP_EMPTY; break;
}
notedata.SetTapNote(t, row, tap);
+11 -8
View File
@@ -15,14 +15,14 @@ CString NotesWriterDWI::NotesToDWIString( const TapNote cNoteCols[6] )
CString taps, holds, ret;
for( int col = 0; col < 6; ++col )
{
switch( cNoteCols[col] )
switch( cNoteCols[col].type )
{
case TAP_EMPTY:
case TAP_MINE:
case TapNote::empty:
case TapNote::mine:
continue;
}
if( cNoteCols[col] == TAP_HOLD_HEAD )
if( cNoteCols[col].type == TapNote::hold_head )
holds += dirs[col];
else
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 )
{
const TapNote cNoteCols[6] = {
cNoteCol1, cNoteCol2, cNoteCol3, cNoteCol4, cNoteCol5, cNoteCol6
};
TapNote cNoteCols[6];
cNoteCols[0] = cNoteCol1;
cNoteCols[1] = cNoteCol2;
cNoteCols[2] = cNoteCol3;
cNoteCols[3] = cNoteCol4;
cNoteCols[4] = cNoteCol5;
cNoteCols[5] = cNoteCol6;
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);
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 */
return iCurrentIndex;
@@ -678,11 +678,11 @@ void PlayerMinus::Step( int col, RageTimer tm )
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?
if( fSecondsFromPerfect <= ADJUSTED_WINDOW(Mine) )
{
@@ -698,42 +698,38 @@ void PlayerMinus::Step( int col, RageTimer tm )
}
break;
default: // not a mine
if( IsTapAttack(tn) )
case TapNote::attack:
score = TNS_NONE; // don't score this as anything
if( fSecondsFromPerfect <= ADJUSTED_WINDOW(Attack) )
{
score = TNS_NONE; // don't score this as anything
if( fSecondsFromPerfect <= ADJUSTED_WINDOW(Attack) )
{
m_soundAttackLaunch.Play();
// put attack in effect
Attack attack = this->GetAttackAt( col, iIndexOverlappingNote );
GAMESTATE->LaunchAttack( OPPOSITE_PLAYER[m_PlayerNumber], attack );
m_soundAttackLaunch.Play();
// put attack in effect
Attack attack = this->GetAttackAt( col, iIndexOverlappingNote );
GAMESTATE->LaunchAttack( OPPOSITE_PLAYER[m_PlayerNumber], attack );
// remove all TapAttacks on this row
for( int t=0; t<this->GetNumTracks(); t++ )
// remove all TapAttacks on this row
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);
if( IsTapAttack(tn) )
{
this->SetTapNote(col, iIndexOverlappingNote, TAP_EMPTY); // remove from NoteField
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
{
if( fSecondsFromPerfect <= ADJUSTED_WINDOW(Marvelous) ) score = TNS_MARVELOUS;
else if( fSecondsFromPerfect <= ADJUSTED_WINDOW(Perfect) ) score = TNS_PERFECT;
else if( fSecondsFromPerfect <= ADJUSTED_WINDOW(Great) ) score = TNS_GREAT;
else if( fSecondsFromPerfect <= ADJUSTED_WINDOW(Good) ) score = TNS_GOOD;
else if( fSecondsFromPerfect <= ADJUSTED_WINDOW(Boo) ) score = TNS_BOO;
else score = TNS_NONE;
}
break;
default:
if( fSecondsFromPerfect <= ADJUSTED_WINDOW(Marvelous) ) score = TNS_MARVELOUS;
else if( fSecondsFromPerfect <= ADJUSTED_WINDOW(Perfect) ) score = TNS_PERFECT;
else if( fSecondsFromPerfect <= ADJUSTED_WINDOW(Great) ) score = TNS_GREAT;
else if( fSecondsFromPerfect <= ADJUSTED_WINDOW(Good) ) score = TNS_GOOD;
else if( fSecondsFromPerfect <= ADJUSTED_WINDOW(Boo) ) score = TNS_BOO;
else score = TNS_NONE;
break;
}
break;
}
case PC_CPU:
case PC_AUTOPLAY:
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
// 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
// first mine for a row. We know we're the first mine if
// there are are no mines to the left of us.
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
}
@@ -789,7 +785,7 @@ void PlayerMinus::Step( int col, RageTimer tm )
return;
if( IsTapAttack(tn) && score > TNS_GOOD )
if( tn.type == TapNote::attack && score > TNS_GOOD )
{
m_soundAttackLaunch.Play();
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++ )
{
TapNote tn = this->GetTapNote(t, iIndexOverlappingNote);
if( IsTapAttack(tn) )
if( tn.type == TapNote::attack )
{
this->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 )
m_pSecondaryScoreKeeper->HandleTapScore( score );
switch( tn )
switch( tn.type )
{
case TAP_TAP:
case TAP_HOLD_HEAD:
case TAP_ADDITION:
case TapNote::tap:
case TapNote::hold_head:
// don't the row if this note is a mine or tap attack
if( IsRowCompletelyJudged(iIndexOverlappingNote) )
OnRowCompletelyJudged( iIndexOverlappingNote );
@@ -945,8 +940,8 @@ void PlayerMinus::OnRowCompletelyJudged( int iIndexThatWasSteppedOn )
{
TapNote tn = GetTapNote(c, iIndexThatWasSteppedOn);
if( tn == TAP_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::empty ) continue; /* no note in this col */
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
// indicate success. (Or always if blind is on.)
@@ -1011,10 +1006,12 @@ void PlayerMinus::UpdateTapNotesMissedOlderThan( float fMissIfOlderThanSeconds )
bool MissedNoteOnThisRow = false;
for( int t=0; t<GetNumTracks(); t++ )
{
if( GetTapNote(t, r) == TAP_EMPTY) continue; /* no note here */
if( GetTapNoteScore(t, r) != TNS_NONE ) continue; /* note here is already hit */
if( GetTapNote(t, r).type == TapNote::empty) /* no note here */
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.
MissedNoteOnThisRow = true;
@@ -1047,7 +1044,7 @@ void PlayerMinus::CrossedRow( int iNoteRow )
if( GAMESTATE->m_PlayerController[m_PlayerNumber] != PC_HUMAN )
{
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 )
Step( t, now );
}
@@ -1059,7 +1056,7 @@ void PlayerMinus::CrossedMineRow( int iNoteRow )
RageTimer now;
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 GameInput GameI = GAMESTATE->GetCurrentStyle()->StyleInputToGameInput( StyleI );
@@ -1091,7 +1088,8 @@ void PlayerMinus::RandomiseNotes( int iNoteRow )
const TapNote t1 = GetTapNote(t, 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(iRandomTrackToSwapWith, NewNoteRow, t1);
+1
View File
@@ -20,6 +20,7 @@
#include "MemoryCardManager.h"
#include "XmlFile.h"
#include "StepsUtil.h"
#include "Style.h"
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 );
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
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)) )
{
@@ -744,7 +744,7 @@ void ScreenEdit::InputEdit( const DeviceInput& DeviceI, const InputEventType typ
}
else
{
m_NoteFieldEdit.SetTapNote(iCol, iSongIndex, TAP_TAP );
m_NoteFieldEdit.SetTapNote(iCol, iSongIndex, TAP_ORIGINAL_TAP );
}
}
break;
@@ -1214,7 +1214,7 @@ void ScreenEdit::InputRecord( const DeviceInput& DeviceI, const InputEventType t
if( iRow < 0 )
break;
m_NoteFieldRecord.SetTapNote(iCol, iRow, TAP_TAP);
m_NoteFieldRecord.SetTapNote(iCol, iRow, TAP_ORIGINAL_TAP);
m_NoteFieldRecord.Step( iCol, TNS_MARVELOUS );
}
break;
+1 -1
View File
@@ -26,7 +26,7 @@
#include "RageDisplay.h"
#include "StepMania.h"
#include "CryptManager.h"
#include <ctime>
#include "Style.h"
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
// 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;
}
FOREACH_EnabledPlayer( pn )
@@ -1518,7 +1518,7 @@ void ScreenGameplay::Update( float fDeltaTime )
for( int t=0; t<m_Player[pn].GetNumTracks(); t++ )
{
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 )
{
StyleInput si( pn, t );
+1 -1
View File
@@ -200,7 +200,7 @@ void ScreenHowToPlay::Step()
{
const int iNumTracks = m_NoteData.GetNumTracks();
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;
switch( iStep )
@@ -21,6 +21,7 @@
#include "StageStats.h"
#include "RageDisplay.h"
#include "Foreach.h"
#include "Style.h"
//
+1
View File
@@ -23,6 +23,7 @@
#include "StageStats.h"
#include "StepsUtil.h"
#include "Foreach.h"
#include "Style.h"
const int NUM_SCORE_DIGITS = 9;
+1
View File
@@ -30,6 +30,7 @@
#include "CatalogXml.h"
#include "Foreach.h"
#include "StageStats.h"
#include "Style.h"
SongManager* SONGMAN = NULL; // global and accessable from anywhere in our program
+1
View File
@@ -3,6 +3,7 @@
#include "GameManager.h"
#include "XmlFile.h"
#include "Game.h"
#include "Style.h"
void StyleID::FromStyle( const Style *p )
+2 -2
View File
@@ -1,8 +1,8 @@
#ifndef STYLEUTIL_H
#define STYLEUTIL_H
#include "Style.h"
class Style;
class Song;
struct XNode;
class StyleID