receptor row follows note skin changes

This commit is contained in:
Glenn Maynard
2003-11-28 00:45:31 +00:00
parent 6ded9d5ab7
commit 5b2c13d51e
2 changed files with 44 additions and 15 deletions
+33 -7
View File
@@ -65,6 +65,9 @@ void NoteField::CacheNoteSkin( CString skin )
NoteDisplayCols *nd = new NoteDisplayCols;
for( int c=0; c<GetNumTracks(); c++ )
nd->display[c].Load( c, m_PlayerNumber, skin, m_fYReverseOffsetPixels );
nd->m_GrayArrowRow.Load( m_PlayerNumber, skin, m_fYReverseOffsetPixels );
nd->m_GhostArrowRow.Load( m_PlayerNumber, skin, m_fYReverseOffsetPixels );
m_NoteDisplays[ skin ] = nd;
}
@@ -97,11 +100,10 @@ void NoteField::Load( const NoteData* pNoteData, PlayerNumber pn, int iFirstPixe
this->CopyAll( pNoteData );
ASSERT( GetNumTracks() == GAMESTATE->GetCurrentStyleDef()->m_iColsPerPlayer );
m_GrayArrowRow.Load( pn, GAMESTATE->m_PlayerOptions[pn].m_sNoteSkin, m_fYReverseOffsetPixels );
m_GhostArrowRow.Load( pn, GAMESTATE->m_PlayerOptions[pn].m_sNoteSkin, m_fYReverseOffsetPixels );
CacheAllUsedNoteSkins();
RefreshBeatToNoteSkin();
/* if last != SearchForSongBeat ... copy */
}
@@ -145,8 +147,10 @@ void NoteField::Update( float fDeltaTime )
ActorFrame::Update( fDeltaTime );
m_rectMarkerBar.Update( fDeltaTime );
m_GrayArrowRow.Update( fDeltaTime );
m_GhostArrowRow.Update( fDeltaTime );
NoteDisplayCols *cur = SearchForSongBeat();
cur->m_GrayArrowRow.Update( fDeltaTime );
cur->m_GhostArrowRow.Update( fDeltaTime );
if( m_fPercentFadeToFail >= 0 )
m_fPercentFadeToFail = min( m_fPercentFadeToFail + fDeltaTime/1.5f, 1 ); // take 1.5 seconds to totally fade
@@ -305,6 +309,21 @@ void NoteField::SearchForBeat( NDMap::iterator &cur, NDMap::iterator &next, floa
}
}
NoteField::NoteDisplayCols *NoteField::SearchForSongBeat()
{
return SearchForBeat( GAMESTATE->m_fSongBeat );
}
NoteField::NoteDisplayCols *NoteField::SearchForBeat( float Beat )
{
NDMap::iterator it = m_BeatToNoteDisplays.lower_bound( Beat );
/* The first entry should always be lower than any Beat we might receive. */
ASSERT( it != m_BeatToNoteDisplays.begin() );
--it;
ASSERT( it != m_BeatToNoteDisplays.end() );
return it->second;
}
// CPU OPTIMIZATION OPPORTUNITY:
// change this probing to binary search
@@ -359,7 +378,8 @@ void NoteField::DrawPrimitives()
/* This should be filled in on the first update. */
ASSERT( !m_BeatToNoteDisplays.empty() );
m_GrayArrowRow.Draw();
NoteDisplayCols *cur = SearchForSongBeat();
cur->m_GrayArrowRow.Draw();
//
// Adjust draw range depending on some effects
@@ -574,7 +594,7 @@ void NoteField::DrawPrimitives()
g_NoteFieldMode[m_PlayerNumber].EndDrawTrack(c);
}
m_GhostArrowRow.Draw();
cur->m_GhostArrowRow.Draw();
}
void NoteField::RemoveTapNoteRow( int iIndex )
@@ -588,3 +608,9 @@ void NoteField::FadeToFail()
m_fPercentFadeToFail = max( 0.0f, m_fPercentFadeToFail ); // this will slowly increase every Update()
// don't fade all over again if this is called twice
}
void NoteField::Step( int iCol ) { SearchForSongBeat()->m_GrayArrowRow.Step( iCol ); }
void NoteField::UpdateBars( int iCol ) { SearchForSongBeat()->m_GrayArrowRow.UpdateBars( iCol ); }
void NoteField::DidTapNote( int iCol, TapNoteScore score, bool bBright ) { SearchForSongBeat()->m_GhostArrowRow.DidTapNote( iCol, score, bBright ); }
void NoteField::DidHoldNote( int iCol ) { SearchForSongBeat()->m_GhostArrowRow.DidHoldNote( iCol ); }
void NoteField::DidTapMine( int iCol, TapNoteScore score ) { SearchForSongBeat()->m_GhostArrowRow.DidTapMine( iCol, score ); }
+11 -8
View File
@@ -47,11 +47,11 @@ public:
void CacheAllUsedNoteSkins();
void CacheNoteSkin( CString skin );
void Step( int iCol ) { m_GrayArrowRow.Step( iCol ); }
void UpdateBars( int iCol ) { m_GrayArrowRow.UpdateBars( iCol ); }
void DidTapNote( int iCol, TapNoteScore score, bool bBright ) { m_GhostArrowRow.DidTapNote( iCol, score, bBright ); }
void DidHoldNote( int iCol ) { m_GhostArrowRow.DidHoldNote( iCol ); }
void DidTapMine( int iCol, TapNoteScore score ) { m_GhostArrowRow.DidTapMine( iCol, score ); }
void Step( int iCol );
void UpdateBars( int iCol );
void DidTapNote( int iCol, TapNoteScore score, bool bBright );
void DidHoldNote( int iCol );
void DidTapMine( int iCol, TapNoteScore score );
protected:
@@ -76,7 +76,10 @@ protected:
struct NoteDisplayCols
{
NoteDisplay display[MAX_NOTE_TRACKS];
GrayArrowRow m_GrayArrowRow;
GhostArrowRow m_GhostArrowRow;
};
/* All loaded note displays, mapped by their name. */
map<CString, NoteDisplayCols *> m_NoteDisplays;
@@ -85,10 +88,10 @@ protected:
/* Map of beat->NoteDisplayCols. This is updated whenever GAMESTATE-> changes. */
typedef map<float, NoteDisplayCols *> NDMap;
void SearchForBeat( NDMap::iterator &cur, NDMap::iterator &next, float Beat );
NDMap m_BeatToNoteDisplays;
NoteDisplayCols *SearchForBeat( float Beat );
NoteDisplayCols *SearchForSongBeat();
GrayArrowRow m_GrayArrowRow;
GhostArrowRow m_GhostArrowRow;
NDMap m_BeatToNoteDisplays;
// used in MODE_EDIT
Sprite m_sprBars; // 4 frames: Measure, 4th, 8th, 16th