#include "stdafx.h" /* ----------------------------------------------------------------------------- Class: NoteDataWithScoring Desc: See header. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ #include "NoteDataWithScoring.h" NoteDataWithScoring::NoteDataWithScoring() { Init(); } void NoteDataWithScoring::Init() { NoteData::Init(); for( int t=0; tGetTapNote(t, i) != TAP_EMPTY && GetTapNoteScore(t, i) == tns ) iNumSuccessfulTapNotes++; } } return iNumSuccessfulTapNotes; } int NoteDataWithScoring::GetNumDoublesWithScore( TapNoteScore tns, const float fStartBeat, const float fEndBeat ) { int iNumSuccessfulDoubles = 0; unsigned iStartIndex = BeatToNoteRow( fStartBeat ); unsigned iEndIndex = BeatToNoteRow( fEndBeat ); for( unsigned i=iStartIndex; i= 2 && minTapNoteScore == tns ) iNumSuccessfulDoubles++; } return iNumSuccessfulDoubles; } int NoteDataWithScoring::GetNumHoldNotesWithScore( HoldNoteScore hns, const float fStartBeat, const float fEndBeat ) { int iNumSuccessfulHolds = 0; for( int i=0; i= NOTE_TYPE_12TH ) iNumChaosNotesCompleted++; } float fReturn = iNumChaosNotesCompleted / fSongSeconds * 0.5f; return min( fReturn, 1.0f ); } float NoteDataWithScoring::GetActualFreezeRadarValue( float fSongSeconds ) { // number of hold steps float fReturn = GetNumHoldNotesWithScore(HNS_OK) / fSongSeconds; return min( fReturn, 1.0f ); } template void extend(vector &v, T val, unsigned pos) { int needed = pos - v.size() + 1; if(needed > 0) { needed += 100; /* optimization: give it a little more than it needs */ v.insert(v.end(), needed, val); } } TapNoteScore NoteDataWithScoring::GetTapNoteScore(unsigned track, unsigned row) const { if(row >= m_TapNoteScores[track].size()) return TNS_NONE; return m_TapNoteScores[track][row]; } void NoteDataWithScoring::SetTapNoteScore(unsigned track, unsigned row, TapNoteScore tns) { extend(m_TapNoteScores[track], TNS_NONE, row); m_TapNoteScores[track][row] = tns; } HoldNoteScore NoteDataWithScoring::GetHoldNoteScore(unsigned h) const { if(h >= m_HoldNoteScores.size()) return HNS_NONE; return m_HoldNoteScores[h]; } void NoteDataWithScoring::SetHoldNoteScore(unsigned h, HoldNoteScore hns) { extend(m_HoldNoteScores, HNS_NONE, h); m_HoldNoteScores[h] = hns; } void NoteDataWithScoring::SetHoldNoteLife(unsigned h, float f) { extend(m_fHoldNoteLife, 1.0f, h); m_fHoldNoteLife[h] = f; } float NoteDataWithScoring::GetHoldNoteLife(unsigned h) const { // start with full life if(h >= m_fHoldNoteLife.size()) return 1.0f; return m_fHoldNoteLife[h]; }