diff --git a/stepmania/src/Attack.cpp b/stepmania/src/Attack.cpp index 5c74c0502e..23414ccad4 100644 --- a/stepmania/src/Attack.cpp +++ b/stepmania/src/Attack.cpp @@ -66,6 +66,12 @@ Attack Attack::FromGlobalCourseModifier( const CString &sModifiers ) return a; } +CString Attack::GetTextDescription() const +{ + CString s = sModifiers + " " + ssprintf("(%.2f seconds)", fSecsRemaining); + return s; +} + bool AttackArray::ContainsTransformOrTurn() const { FOREACH_CONST( Attack, *this, a ) diff --git a/stepmania/src/Attack.h b/stepmania/src/Attack.h index 62a94ae454..1def17032d 100644 --- a/stepmania/src/Attack.h +++ b/stepmania/src/Attack.h @@ -50,6 +50,7 @@ struct Attack bool operator== ( const Attack &rhs ) const; bool ContainsTransformOrTurn() const; static Attack FromGlobalCourseModifier( const CString &sModifiers ); + CString GetTextDescription() const; }; struct AttackArray : public vector diff --git a/stepmania/src/BackgroundUtil.cpp b/stepmania/src/BackgroundUtil.cpp index cc25d14cdf..d4c0694aa6 100644 --- a/stepmania/src/BackgroundUtil.cpp +++ b/stepmania/src/BackgroundUtil.cpp @@ -50,6 +50,26 @@ XNode *BackgroundDef::CreateNode() const return pNode; } + +CString BackgroundChange::GetTextDescription() const +{ + vector vsParts; + if( !m_def.m_sFile1.empty() ) vsParts.push_back( m_def.m_sFile1 ); + if( !m_def.m_sFile2.empty() ) vsParts.push_back( m_def.m_sFile2 ); + if( m_fRate!=1.0f ) vsParts.push_back( ssprintf("%.2f%%",m_fRate*100) ); + if( !m_sTransition.empty() ) vsParts.push_back( m_sTransition ); + if( !m_def.m_sEffect.empty() ) vsParts.push_back( m_def.m_sEffect ); + if( !m_def.m_sColor1.empty() ) vsParts.push_back( m_def.m_sColor1 ); + if( !m_def.m_sColor2.empty() ) vsParts.push_back( m_def.m_sColor2 ); + + if( vsParts.empty() ) + vsParts.push_back( "(empty)" ); + + CString s = join( "\n", vsParts ); + return s; +} + + const CString BACKGROUND_EFFECTS_DIR = "BackgroundEffects/"; const CString BACKGROUND_TRANSITIONS_DIR = "BackgroundTransitions/"; const CString BG_ANIMS_DIR = "BGAnimations/"; diff --git a/stepmania/src/BackgroundUtil.h b/stepmania/src/BackgroundUtil.h index aeb102af8d..83be94f8c8 100644 --- a/stepmania/src/BackgroundUtil.h +++ b/stepmania/src/BackgroundUtil.h @@ -58,6 +58,8 @@ struct BackgroundChange float m_fStartBeat; float m_fRate; CString m_sTransition; + + CString GetTextDescription() const; }; namespace BackgroundUtil diff --git a/stepmania/src/NoteField.cpp b/stepmania/src/NoteField.cpp index 21694c60e5..c8c7c2e94d 100644 --- a/stepmania/src/NoteField.cpp +++ b/stepmania/src/NoteField.cpp @@ -20,6 +20,7 @@ #include "CommonMetrics.h" #include #include "BackgroundUtil.h" +#include "Course.h" NoteField::NoteField() { @@ -319,6 +320,19 @@ void NoteField::DrawFreezeText( const float fBeat, const float fSecs ) m_textMeasureNumber.Draw(); } +void NoteField::DrawAttackText( const float fBeat, const Attack &attack ) +{ + const float fYOffset = ArrowEffects::GetYOffset( m_pPlayerState, 0, fBeat ); + const float fYPos = ArrowEffects::GetYPos( m_pPlayerState, 0, fYOffset, m_fYReverseOffsetPixels ); + + m_textMeasureNumber.SetHorizAlign( Actor::align_right ); + m_textMeasureNumber.SetDiffuse( RageColor(0,0.8f,0.8f,1) ); + m_textMeasureNumber.SetGlow( RageColor(1,1,1,RageFastCos(RageTimer::GetTimeSinceStartFast()*2)/2+0.5f) ); + m_textMeasureNumber.SetText( attack.GetTextDescription() ); + m_textMeasureNumber.SetXY( -GetWidth()/2.f - 10, fYPos ); + m_textMeasureNumber.Draw(); +} + void NoteField::DrawBGChangeText( const float fBeat, const CString sNewBGName ) { const float fYOffset = ArrowEffects::GetYOffset( m_pPlayerState, 0, fBeat ); @@ -509,6 +523,7 @@ void NoteField::DrawPrimitives() DrawBPMText( fBeat, aBPMSegments[i].GetBPM() ); } } + // // Freeze text // @@ -524,6 +539,27 @@ void NoteField::DrawPrimitives() } } + // + // Course mods text + // + Course *pCourse = GAMESTATE->m_pCurCourse; + const CourseEntry &ce = pCourse->m_vEntries[GAMESTATE->m_iEditCourseEntryIndex]; + if( pCourse ) + { + FOREACH_CONST( Attack, ce.attacks, a ) + { + float fSecond = a->fStartSecond; + float fBeat = GAMESTATE->m_pCurSong->m_Timing.GetBeatFromElapsedTime( fSecond ); + + if( BeatToNoteRow(fBeat) >= iFirstIndexToDraw && + BeatToNoteRow(fBeat) <= iLastIndexToDraw) + { + if( IS_ON_SCREEN(fBeat) ) + DrawAttackText( fBeat, *a ); + } + } + } + // // BGChange text // @@ -574,22 +610,11 @@ void NoteField::DrawPrimitives() FOREACH_CONST( BackgroundLayer, viLowestIndex, i ) { ASSERT( iter[*i] != GAMESTATE->m_pCurSong->GetBackgroundChanges(*i).end() ); - const BackgroundChange& change = *iter[*i]; - vector vsParts; - if( *i!=0 ) vsParts.push_back( ssprintf("%d: ",*i) ); - if( !change.m_def.m_sFile1.empty() ) vsParts.push_back( change.m_def.m_sFile1 ); - if( !change.m_def.m_sFile2.empty() ) vsParts.push_back( change.m_def.m_sFile2 ); - if( change.m_fRate!=1.0f ) vsParts.push_back( ssprintf("%.2f%%",change.m_fRate*100) ); - if( !change.m_sTransition.empty() ) vsParts.push_back( change.m_sTransition ); - if( !change.m_def.m_sEffect.empty() ) vsParts.push_back( change.m_def.m_sEffect ); - if( !change.m_def.m_sColor1.empty() ) vsParts.push_back( change.m_def.m_sColor1 ); - if( !change.m_def.m_sColor2.empty() ) vsParts.push_back( change.m_def.m_sColor2 ); - - if( vsParts.empty() ) - vsParts.push_back( "(empty)" ); - - vsBGChanges.push_back( join("\n",vsParts) ); + CString s = change.GetTextDescription(); + if( *i!=0 ) + s = ssprintf("%d: ",*i) + s; + vsBGChanges.push_back( s ); } DrawBGChangeText( fLowestBeat, join("\n",vsBGChanges) ); } diff --git a/stepmania/src/NoteField.h b/stepmania/src/NoteField.h index 0c11a79377..f943eb3edd 100644 --- a/stepmania/src/NoteField.h +++ b/stepmania/src/NoteField.h @@ -52,6 +52,7 @@ protected: void DrawAreaHighlight( int iStartBeat, int iEndBeat ); void DrawBPMText( const float fBeat, const float fBPM ); void DrawFreezeText( const float fBeat, const float fBPM ); + void DrawAttackText( const float fBeat, const Attack &attack ); void DrawBGChangeText( const float fBeat, const CString sNewBGName ); float GetWidth();