draw course attacks in NoteField

This commit is contained in:
Chris Danford
2005-07-30 19:32:31 +00:00
parent b18fcf555f
commit 3263654989
6 changed files with 70 additions and 15 deletions
+6
View File
@@ -66,6 +66,12 @@ Attack Attack::FromGlobalCourseModifier( const CString &sModifiers )
return a; return a;
} }
CString Attack::GetTextDescription() const
{
CString s = sModifiers + " " + ssprintf("(%.2f seconds)", fSecsRemaining);
return s;
}
bool AttackArray::ContainsTransformOrTurn() const bool AttackArray::ContainsTransformOrTurn() const
{ {
FOREACH_CONST( Attack, *this, a ) FOREACH_CONST( Attack, *this, a )
+1
View File
@@ -50,6 +50,7 @@ struct Attack
bool operator== ( const Attack &rhs ) const; bool operator== ( const Attack &rhs ) const;
bool ContainsTransformOrTurn() const; bool ContainsTransformOrTurn() const;
static Attack FromGlobalCourseModifier( const CString &sModifiers ); static Attack FromGlobalCourseModifier( const CString &sModifiers );
CString GetTextDescription() const;
}; };
struct AttackArray : public vector<Attack> struct AttackArray : public vector<Attack>
+20
View File
@@ -50,6 +50,26 @@ XNode *BackgroundDef::CreateNode() const
return pNode; return pNode;
} }
CString BackgroundChange::GetTextDescription() const
{
vector<CString> 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_EFFECTS_DIR = "BackgroundEffects/";
const CString BACKGROUND_TRANSITIONS_DIR = "BackgroundTransitions/"; const CString BACKGROUND_TRANSITIONS_DIR = "BackgroundTransitions/";
const CString BG_ANIMS_DIR = "BGAnimations/"; const CString BG_ANIMS_DIR = "BGAnimations/";
+2
View File
@@ -58,6 +58,8 @@ struct BackgroundChange
float m_fStartBeat; float m_fStartBeat;
float m_fRate; float m_fRate;
CString m_sTransition; CString m_sTransition;
CString GetTextDescription() const;
}; };
namespace BackgroundUtil namespace BackgroundUtil
+40 -15
View File
@@ -20,6 +20,7 @@
#include "CommonMetrics.h" #include "CommonMetrics.h"
#include <float.h> #include <float.h>
#include "BackgroundUtil.h" #include "BackgroundUtil.h"
#include "Course.h"
NoteField::NoteField() NoteField::NoteField()
{ {
@@ -319,6 +320,19 @@ void NoteField::DrawFreezeText( const float fBeat, const float fSecs )
m_textMeasureNumber.Draw(); 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 ) void NoteField::DrawBGChangeText( const float fBeat, const CString sNewBGName )
{ {
const float fYOffset = ArrowEffects::GetYOffset( m_pPlayerState, 0, fBeat ); const float fYOffset = ArrowEffects::GetYOffset( m_pPlayerState, 0, fBeat );
@@ -509,6 +523,7 @@ void NoteField::DrawPrimitives()
DrawBPMText( fBeat, aBPMSegments[i].GetBPM() ); DrawBPMText( fBeat, aBPMSegments[i].GetBPM() );
} }
} }
// //
// Freeze text // 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 // BGChange text
// //
@@ -574,22 +610,11 @@ void NoteField::DrawPrimitives()
FOREACH_CONST( BackgroundLayer, viLowestIndex, i ) FOREACH_CONST( BackgroundLayer, viLowestIndex, i )
{ {
ASSERT( iter[*i] != GAMESTATE->m_pCurSong->GetBackgroundChanges(*i).end() ); ASSERT( iter[*i] != GAMESTATE->m_pCurSong->GetBackgroundChanges(*i).end() );
const BackgroundChange& change = *iter[*i]; const BackgroundChange& change = *iter[*i];
vector<CString> vsParts; CString s = change.GetTextDescription();
if( *i!=0 ) vsParts.push_back( ssprintf("%d: ",*i) ); if( *i!=0 )
if( !change.m_def.m_sFile1.empty() ) vsParts.push_back( change.m_def.m_sFile1 ); s = ssprintf("%d: ",*i) + s;
if( !change.m_def.m_sFile2.empty() ) vsParts.push_back( change.m_def.m_sFile2 ); vsBGChanges.push_back( s );
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) );
} }
DrawBGChangeText( fLowestBeat, join("\n",vsBGChanges) ); DrawBGChangeText( fLowestBeat, join("\n",vsBGChanges) );
} }
+1
View File
@@ -52,6 +52,7 @@ protected:
void DrawAreaHighlight( int iStartBeat, int iEndBeat ); void DrawAreaHighlight( int iStartBeat, int iEndBeat );
void DrawBPMText( const float fBeat, const float fBPM ); void DrawBPMText( const float fBeat, const float fBPM );
void DrawFreezeText( 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 ); void DrawBGChangeText( const float fBeat, const CString sNewBGName );
float GetWidth(); float GetWidth();