const RadarValues &Trail::GetRadarValues() const { if( m_bRadarValuesCached ) { return m_CachedRadarValues; } if( IsSecret() ) { // Don't calculate RadarValues for a non-fixed Course. They values are // worthless because they'll change every time this Trail is // regenerated. m_CachedRadarValues = RadarValues(); return m_CachedRadarValues; } else { RadarValues rv; rv.Zero(); FOREACH_CONST( TrailEntry, m_vEntries, e ) { const Steps *pSteps = e->pSteps; ASSERT( pSteps != NULL ); // Hack: don't calculate for autogen entries if( !pSteps->IsAutogen() && e->ContainsTransformOrTurn() ) { NoteData nd; pSteps->GetNoteData( nd ); RadarValues rv_orig; GAMESTATE->SetProcessedTimingData(const_cast<TimingData *>(pSteps->GetTimingData())); NoteDataUtil::CalculateRadarValues( nd, e->pSong->m_fMusicLengthSeconds, rv_orig ); PlayerOptions po; po.FromString( e->Modifiers ); if( po.ContainsTransformOrTurn() ) { NoteDataUtil::TransformNoteData(nd, *(pSteps->GetTimingData()), po, pSteps->m_StepsType); } NoteDataUtil::TransformNoteData(nd, *(pSteps->GetTimingData()), e->Attacks, pSteps->m_StepsType, e->pSong); RadarValues transformed_rv; NoteDataUtil::CalculateRadarValues( nd, e->pSong->m_fMusicLengthSeconds, transformed_rv ); GAMESTATE->SetProcessedTimingData(NULL); rv += transformed_rv; } else { rv += pSteps->GetRadarValues( PLAYER_1 ); } } /* Hack: SetRadarValues is non-const (a const setter doesn't * make sense), but it only modifies a mutable value. Just * cast away const. */ const_cast<Trail*>(this)->SetRadarValues( rv ); return m_CachedRadarValues; } }
bool TrailEntry::ContainsTransformOrTurn() const { PlayerOptions po; po.FromString( Modifiers ); if( po.ContainsTransformOrTurn() ) return true; if( Attacks.ContainsTransformOrTurn() ) return true; return false; }
const RadarValues &Trail::GetRadarValues() const { if( m_bRadarValuesCached ) { return m_CachedRadarValues; } else if( IsSecret() ) { // Don't calculate RadarValues for a non-fixed Course. The values are // worthless because they'll change every time this Trail is // regenerated. m_CachedRadarValues = RadarValues(); return m_CachedRadarValues; } else { RadarValues rv; rv.Zero(); FOREACH_CONST( TrailEntry, m_vEntries, e ) { const Steps *pSteps = e->pSteps; ASSERT( pSteps ); /* Hack: don't calculate for autogen entries; it makes writing Catalog.xml * take way too long. (Tournamix 4 Sample.crs takes me ~10s.) */ if( !pSteps->IsAutogen() && e->ContainsTransformOrTurn() ) { NoteData nd; pSteps->GetNoteData( nd ); RadarValues rv_orig; NoteDataUtil::CalculateRadarValues( nd, e->pSong->MusicLengthSeconds(), rv_orig ); PlayerOptions po; po.FromString( e->Modifiers ); if( po.ContainsTransformOrTurn() ) NoteDataUtil::TransformNoteData( nd, po, pSteps->m_StepsType ); NoteDataUtil::TransformNoteData( nd, e->Attacks, pSteps->m_StepsType, e->pSong ); RadarValues transformed_rv; NoteDataUtil::CalculateRadarValues( nd, e->pSong->MusicLengthSeconds(), transformed_rv ); rv += transformed_rv; } else { rv += pSteps->GetRadarValues(); } } /* Hack: SetRadarValues is non-const (a const setter doesn't * make sense), but it only modifies a mutable value. Just * cast away const. */ const_cast<Trail*>(this)->SetRadarValues( rv ); return m_CachedRadarValues; } }
bool Attack::ContainsTransformOrTurn() const { PlayerOptions po; po.FromString(sModifiers); return po.ContainsTransformOrTurn(); }