TapSteps -> TapNotes

This commit is contained in:
Chris Danford
2004-05-24 04:26:54 +00:00
parent b31996b97f
commit d65404e750
12 changed files with 57 additions and 54 deletions
+2
View File
@@ -148,6 +148,8 @@ void GameState::Reset()
FOREACH_PlayerNumber( p )
m_pCurNotes[p] = NULL;
m_pCurCourse = NULL;
FOREACH_PlayerNumber( p )
m_pCurTrail[p] = NULL;
SAFE_DELETE( m_pPosition );
m_pPosition = new NoteFieldPositioning("Positioning.ini");
+1
View File
@@ -142,6 +142,7 @@ public:
Song* m_pCurSong;
Steps* m_pCurNotes[NUM_PLAYERS];
Course* m_pCurCourse;
Course* m_pCurTrail[NUM_PLAYERS];
//
+22 -22
View File
@@ -42,14 +42,14 @@ void NoteData::SetNumTracks( int iNewNumTracks )
// Make sure that all tracks are of the same length
ASSERT( m_iNumTracks > 0 );
int rows = m_TapSteps[0].size();
int rows = m_TapNotes[0].size();
for( int t=0; t<MAX_NOTE_TRACKS; t++ )
{
if( t<m_iNumTracks )
m_TapSteps[t].resize( rows, TAP_EMPTY );
m_TapNotes[t].resize( rows, TAP_EMPTY );
else
m_TapSteps[t].clear();
m_TapNotes[t].clear();
}
/* Remove all hold notes that are out of bounds. */
@@ -74,7 +74,7 @@ void NoteData::ClearRange( int iNoteIndexBegin, int iNoteIndexEnd )
void NoteData::ClearAll()
{
for( int t=0; t<m_iNumTracks; t++ )
m_TapSteps[t].clear();
m_TapNotes[t].clear();
m_HoldNotes.clear();
}
@@ -124,7 +124,7 @@ void NoteData::CopyAll( const NoteData* pFrom )
ClearAll();
for( int c=0; c<m_iNumTracks; c++ )
m_TapSteps[c] = pFrom->m_TapSteps[c];
m_TapNotes[c] = pFrom->m_TapNotes[c];
m_HoldNotes = pFrom->m_HoldNotes;
m_AttackMap = pFrom->m_AttackMap;
}
@@ -376,7 +376,7 @@ int NoteData::GetFirstRow() const
int i;
for( i=0; i < int(m_TapSteps[0].size()); i++ )
for( i=0; i < int(m_TapNotes[0].size()); i++ )
{
if( !IsRowEmpty(i) )
{
@@ -409,7 +409,7 @@ int NoteData::GetLastRow() const
int i;
for( i = int(m_TapSteps[0].size()); i>=0; i-- ) // iterate back to front
for( i = int(m_TapNotes[0].size()); i>=0; i-- ) // iterate back to front
{
if( !IsRowEmpty(i) )
{
@@ -432,7 +432,7 @@ float NoteData::GetLastBeat() const
return NoteRowToBeat( GetLastRow() );
}
int NoteData::GetNumTapSteps( float fStartBeat, float fEndBeat ) const
int NoteData::GetNumTapNotes( float fStartBeat, float fEndBeat ) const
{
int iNumNotes = 0;
@@ -755,7 +755,7 @@ void NoteData::LoadTransformed( const NoteData* pOriginal, int iNewNumTracks, co
if( iOriginalTrack == -1 )
continue;
m_TapSteps[t] = Original.m_TapSteps[iOriginalTrack];
m_TapNotes[t] = Original.m_TapNotes[iOriginalTrack];
}
Convert4sToHoldNotes();
@@ -795,7 +795,7 @@ void NoteData::LoadOverlapped( const NoteData* pOriginal, int iNewNumTracks )
const int iTrackFrom = i;
int &iTrackTo = DestRow[i];
const TapNote iStepFrom = in.m_TapSteps[iTrackFrom][row];
const TapNote iStepFrom = in.m_TapNotes[iTrackFrom][row];
if( iStepFrom == TAP_EMPTY )
continue;
@@ -891,49 +891,49 @@ void NoteData::LoadTransformedSlidingWindow( const NoteData* pOriginal, int iNew
m_AttackMap = Original.GetAttackMap();
}
void NoteData::PadTapSteps(int rows)
void NoteData::PadTapNotes(int rows)
{
int needed = rows - m_TapSteps[0].size() + 1;
int needed = rows - m_TapNotes[0].size() + 1;
if(needed < 0)
return;
needed += 100; /* optimization: give it a little more than it needs */
for(int track = 0; track < m_iNumTracks; ++track)
m_TapSteps[track].insert(m_TapSteps[track].end(), needed, TAP_EMPTY);
m_TapNotes[track].insert(m_TapNotes[track].end(), needed, TAP_EMPTY);
}
void NoteData::MoveTapNoteTrack(int dest, int src)
{
if(dest == src) return;
m_TapSteps[dest] = m_TapSteps[src];
m_TapSteps[src].clear();
m_TapNotes[dest] = m_TapNotes[src];
m_TapNotes[src].clear();
}
void NoteData::SetTapNote(int track, int row, TapNote t)
{
if(row < 0) return;
PadTapSteps(row);
m_TapSteps[track][row]=t;
PadTapNotes(row);
m_TapNotes[track][row]=t;
}
void NoteData::ReserveRows( int row )
{
for(int track = 0; track < m_iNumTracks; ++track)
m_TapSteps[track].reserve( row );
m_TapNotes[track].reserve( row );
}
void NoteData::EliminateAllButOneTap(int row)
{
if(row < 0) return;
PadTapSteps(row);
PadTapNotes(row);
int track;
for(track = 0; track < m_iNumTracks; ++track)
{
if( m_TapSteps[track][row] == TAP_TAP )
if( m_TapNotes[track][row] == TAP_TAP )
break;
}
@@ -941,8 +941,8 @@ void NoteData::EliminateAllButOneTap(int row)
for( ; track < m_iNumTracks; ++track)
{
if( m_TapSteps[track][row] == TAP_TAP )
m_TapSteps[track][row] = TAP_EMPTY;
if( m_TapNotes[track][row] == TAP_TAP )
m_TapNotes[track][row] = TAP_EMPTY;
}
}
+8 -8
View File
@@ -23,15 +23,15 @@
class NoteData
{
/* Keep this aligned, so that they all have the same size. */
vector<TapNote> m_TapSteps[MAX_NOTE_TRACKS];
vector<TapNote> m_TapNotes[MAX_NOTE_TRACKS];
int m_iNumTracks;
vector<HoldNote> m_HoldNotes;
map<TapNote,Attack> m_AttackMap;
/* Pad m_TapSteps so it includes the row "rows". */
void PadTapSteps(int rows);
/* Pad m_TapNotes so it includes the row "rows". */
void PadTapNotes(int rows);
void LoadOverlapped( const NoteData* pOriginal, int iNewNumTracks );
@@ -56,8 +56,8 @@ public:
* range; pretend the song goes on with TAP_EMPTYs indefinitely. */
inline TapNote GetTapNote(unsigned track, int row) const
{
if(row < 0 || row >= (int) m_TapSteps[track].size()) return TapNote(TAP_EMPTY);
return m_TapSteps[track][row];
if(row < 0 || row >= (int) m_TapNotes[track].size()) return TapNote(TAP_EMPTY);
return m_TapNotes[track][row];
}
void ReserveRows( int row );
@@ -65,7 +65,7 @@ public:
* which is much faster. Be sure that 0 <= row < GetMaxRow(). */
inline TapNote GetTapNoteX(unsigned track, int row) const
{
return m_TapSteps[track][row];
return m_TapNotes[track][row];
}
void MoveTapNoteTrack(int dest, int src);
void SetTapNote(int track, int row, TapNote t);
@@ -116,13 +116,13 @@ public:
/* Return the highest beat/row that might contain notes. (Use GetLastBeat if you need
* accuracy.) */
float GetMaxBeat() const { return NoteRowToBeat(GetMaxRow()); }
int GetMaxRow() const { return int(m_TapSteps[0].size()); }
int GetMaxRow() const { return int(m_TapNotes[0].size()); }
float GetFirstBeat() const; // return the beat number of the first note
int GetFirstRow() const;
float GetLastBeat() const; // return the beat number of the last note
int GetLastRow() const;
int GetNumTapSteps( const float fStartBeat = 0, const float fEndBeat = -1 ) const;
int GetNumTapNotes( const float fStartBeat = 0, const float fEndBeat = -1 ) const;
int GetNumMines( const float fStartBeat = 0, const float fEndBeat = -1 ) const;
int GetNumHands( const float fStartBeat = 0, const float fEndBeat = -1 ) const;
int GetNumRowsWithTap( const float fStartBeat = 0, const float fEndBeat = -1 ) const;
+2 -2
View File
@@ -321,7 +321,7 @@ float NoteDataUtil::GetStreamRadarValue( const NoteData &in, float fSongSeconds
if( !fSongSeconds )
return 0.0f;
// density of steps
int iNumNotes = in.GetNumTapSteps() + in.GetNumHoldNotes();
int iNumNotes = in.GetNumTapNotes() + in.GetNumHoldNotes();
float fNotesPerSecond = iNumNotes/fSongSeconds;
float fReturn = fNotesPerSecond / 7;
return min( fReturn, 1.0f );
@@ -342,7 +342,7 @@ float NoteDataUtil::GetVoltageRadarValue( const NoteData &in, float fSongSeconds
for( int i=0; i<=int(fLastBeat); i+=BEAT_WINDOW )
{
int iNumNotesThisWindow = in.GetNumTapSteps((float)i,(float)i+BEAT_WINDOW) + in.GetNumHoldNotes((float)i,(float)i+BEAT_WINDOW);
int iNumNotesThisWindow = in.GetNumTapNotes((float)i,(float)i+BEAT_WINDOW) + in.GetNumHoldNotes((float)i,(float)i+BEAT_WINDOW);
float fDensityThisWindow = iNumNotesThisWindow/(float)BEAT_WINDOW;
fMaxDensitySoFar = max( fMaxDensitySoFar, fDensityThisWindow );
}
+7 -7
View File
@@ -31,9 +31,9 @@ void NoteDataWithScoring::Init()
m_HoldNoteScores.clear();
}
int NoteDataWithScoring::GetNumTapStepsWithScore( TapNoteScore tns, const float fStartBeat, float fEndBeat ) const
int NoteDataWithScoring::GetNumTapNotesWithScore( TapNoteScore tns, const float fStartBeat, float fEndBeat ) const
{
int iNumSuccessfulTapSteps = 0;
int iNumSuccessfulTapNotes = 0;
if(fEndBeat == -1)
fEndBeat = GetMaxBeat()+1;
@@ -46,11 +46,11 @@ int NoteDataWithScoring::GetNumTapStepsWithScore( TapNoteScore tns, const float
for( int t=0; t<GetNumTracks(); t++ )
{
if( this->GetTapNote(t, i) != TAP_EMPTY && GetTapNoteScore(t, i) >= tns )
iNumSuccessfulTapSteps++;
iNumSuccessfulTapNotes++;
}
}
return iNumSuccessfulTapSteps;
return iNumSuccessfulTapNotes;
}
int NoteDataWithScoring::GetNumNWithScore( TapNoteScore tns, int MinTaps, const float fStartBeat, float fEndBeat ) const
@@ -281,17 +281,17 @@ float NoteDataWithScoring::GetActualRadarValue( RadarCategory rv, PlayerNumber p
float NoteDataWithScoring::GetActualStreamRadarValue( float fSongSeconds, PlayerNumber pn ) const
{
int TotalSteps = GetNumTapSteps();
int TotalSteps = GetNumTapNotes();
if( !TotalSteps )
return 1;
const int Perfects = GetNumTapStepsWithScore(TNS_PERFECT);
const int Perfects = GetNumTapNotesWithScore(TNS_PERFECT);
return clamp( float(Perfects)/TotalSteps, 0.0f, 1.0f );
}
float NoteDataWithScoring::GetActualVoltageRadarValue( float fSongSeconds, PlayerNumber pn ) const
{
/* g_CurStageStats.iMaxCombo is unrelated to GetNumTapSteps: m_bComboContinuesBetweenSongs
/* g_CurStageStats.iMaxCombo is unrelated to GetNumTapNotes: m_bComboContinuesBetweenSongs
* might be on, and the way combo is counted varies depending on the mode and score
* keeper. Instead, let's use the length of the longest recorded combo. This is
* only subtly different: it's the percent of the song the longest combo took to get. */
+1 -1
View File
@@ -65,7 +65,7 @@ public:
void Init();
// statistics
int GetNumTapStepsWithScore( TapNoteScore tns, const float fStartBeat = 0, const float fEndBeat = -1 ) const;
int GetNumTapNotesWithScore( TapNoteScore tns, const float fStartBeat = 0, const float fEndBeat = -1 ) const;
int GetNumNWithScore( TapNoteScore tns, int MinTaps, const float fStartBeat = 0, const float fEndBeat = -1 ) const;
int GetNumHoldNotesWithScore( HoldNoteScore hns, const float fStartBeat = 0, const float fEndBeat = -1 ) const;
int GetSuccessfulMines( const float fStartBeat = 0, const float fEndBeat = -1 ) const;
+4 -4
View File
@@ -300,7 +300,7 @@ void PlayerMinus::Update( float fDeltaTime )
//
// Check for TapNote misses
//
UpdateTapStepsMissedOlderThan( GetMaxStepDistanceSeconds() );
UpdateTapNotesMissedOlderThan( GetMaxStepDistanceSeconds() );
//
// update pressed flag
@@ -847,7 +847,7 @@ void PlayerMinus::Step( int col, RageTimer tm )
/* AI will generate misses here. Don't handle a miss like a regular note because
* we want the judgment animation to appear delayed. Instead, return early if
* AI generated a miss, and let UpdateMissedTapStepsOlderThan() detect and handle the
* AI generated a miss, and let UpdateMissedTapNotesOlderThan() detect and handle the
* misses. */
if( score == TNS_MISS )
return;
@@ -1030,9 +1030,9 @@ void PlayerMinus::OnRowCompletelyJudged( int iIndexThatWasSteppedOn )
}
void PlayerMinus::UpdateTapStepsMissedOlderThan( float fMissIfOlderThanSeconds )
void PlayerMinus::UpdateTapNotesMissedOlderThan( float fMissIfOlderThanSeconds )
{
//LOG->Trace( "Steps::UpdateTapStepsMissedOlderThan(%f)", fMissIfOlderThanThisBeat );
//LOG->Trace( "Steps::UpdateTapNotesMissedOlderThan(%f)", fMissIfOlderThanThisBeat );
int iMissIfOlderThanThisIndex;
{
const float fEarliestTime = GAMESTATE->m_fMusicSeconds - fMissIfOlderThanSeconds;
+1 -1
View File
@@ -61,7 +61,7 @@ public:
static float GetMaxStepDistanceSeconds();
protected:
void UpdateTapStepsMissedOlderThan( float fMissIfOlderThanThisBeat );
void UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat );
void OnRowCompletelyJudged( int iStepIndex );
void HandleTapRowScore( unsigned row );
void HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore );
+5 -5
View File
@@ -183,7 +183,7 @@ void ScoreKeeperMAX2::OnNextSong( int iSongInCourseIndex, const Steps* pSteps, c
ASSERT( m_iPointBonus >= 0 );
m_iTapStepsHit = 0;
m_iTapNotesHit = 0;
}
static int GetScore(int p, int B, int S, int n)
@@ -267,7 +267,7 @@ void ScoreKeeperMAX2::AddScore( TapNoteScore score )
default: p = 0; break;
}
m_iTapStepsHit++;
m_iTapNotesHit++;
const int N = m_iNumTapsAndHolds;
const int sum = (N * (N + 1)) / 2;
@@ -286,15 +286,15 @@ void ScoreKeeperMAX2::AddScore( TapNoteScore score )
}
else
{
iScore += GetScore(p, B, sum, m_iTapStepsHit);
iScore += GetScore(p, B, sum, m_iTapNotesHit);
const int &iCurrentCombo = g_CurStageStats.iCurCombo[m_PlayerNumber];
g_CurStageStats.iBonus[m_PlayerNumber] += m_ComboBonusFactor[score] * iCurrentCombo;
}
/* Subtract the maximum this step could have been worth from the bonus. */
m_iPointBonus -= GetScore(10, B, sum, m_iTapStepsHit);
m_iPointBonus -= GetScore(10, B, sum, m_iTapNotesHit);
if ( m_iTapStepsHit == m_iNumTapsAndHolds && score >= TNS_PERFECT )
if ( m_iTapNotesHit == m_iNumTapsAndHolds && score >= TNS_PERFECT )
{
if (!g_CurStageStats.bFailedEarlier[m_PlayerNumber])
iScore += m_iPointBonus;
+1 -1
View File
@@ -20,7 +20,7 @@ class ScoreKeeperMAX2: public ScoreKeeper
{
int m_iScoreRemainder;
int m_iMaxPossiblePoints;
int m_iTapStepsHit; // number of notes judged so far, needed by scoring
int m_iTapNotesHit; // number of notes judged so far, needed by scoring
int m_iNumTapsAndHolds;
int m_iMaxScoreSoFar; // for nonstop scoring
+3 -3
View File
@@ -554,7 +554,7 @@ void ScreenEdit::Update( float fDeltaTime )
void ScreenEdit::UpdateTextInfo()
{
int iNumTapSteps = m_NoteFieldEdit.GetNumTapSteps();
int iNumTapNotes = m_NoteFieldEdit.GetNumTapNotes();
int iNumHoldNotes = m_NoteFieldEdit.GetNumHoldNotes();
CString sNoteType;
@@ -588,7 +588,7 @@ void ScreenEdit::UpdateTextInfo()
sText += ssprintf( "Description:\n %s\n", GAMESTATE->m_pCurNotes[PLAYER_1] ? GAMESTATE->m_pCurNotes[PLAYER_1]->GetDescription().c_str() : "no description" );
sText += ssprintf( "Main title:\n %s\n", m_pSong->m_sMainTitle.c_str() );
sText += ssprintf( "Sub title:\n %s\n", m_pSong->m_sSubTitle.c_str() );
sText += ssprintf( "Tap Steps:\n %d\n", iNumTapSteps );
sText += ssprintf( "Tap Steps:\n %d\n", iNumTapNotes );
sText += ssprintf( "Hold Steps:\n %d\n", iNumHoldNotes );
sText += ssprintf( "Beat 0 Offset:\n %.3f secs\n", m_pSong->m_Timing.m_fBeat0OffsetInSeconds );
sText += ssprintf( "Preview Start:\n %.2f secs\n", m_pSong->m_fMusicSampleStartSeconds );
@@ -1561,7 +1561,7 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, int* iAnswers )
g_EditNotesStatistics.rows[meter].defaultChoice = pSteps->GetMeter()-1;
g_EditNotesStatistics.rows[predict_meter].choices.resize(1);g_EditNotesStatistics.rows[predict_meter].choices[0] = ssprintf("%f",pSteps->PredictMeter());
g_EditNotesStatistics.rows[description].choices.resize(1); g_EditNotesStatistics.rows[description].choices[0] = pSteps->GetDescription();
g_EditNotesStatistics.rows[tap_notes].choices.resize(1); g_EditNotesStatistics.rows[tap_notes].choices[0] = ssprintf("%d", m_NoteFieldEdit.GetNumTapSteps());
g_EditNotesStatistics.rows[tap_notes].choices.resize(1); g_EditNotesStatistics.rows[tap_notes].choices[0] = ssprintf("%d", m_NoteFieldEdit.GetNumTapNotes());
g_EditNotesStatistics.rows[hold_notes].choices.resize(1); g_EditNotesStatistics.rows[hold_notes].choices[0] = ssprintf("%d", m_NoteFieldEdit.GetNumHoldNotes());
g_EditNotesStatistics.rows[stream].choices.resize(1); g_EditNotesStatistics.rows[stream].choices[0] = ssprintf("%f", NoteDataUtil::GetStreamRadarValue(m_NoteFieldEdit,fMusicSeconds));
g_EditNotesStatistics.rows[voltage].choices.resize(1); g_EditNotesStatistics.rows[voltage].choices[0] = ssprintf("%f", NoteDataUtil::GetVoltageRadarValue(m_NoteFieldEdit,fMusicSeconds));