fix edit elements drawing way off screen in boomerang causing artifacts on some hardware
This commit is contained in:
+36
-12
@@ -406,6 +406,19 @@ float FindLastDisplayedBeat( const PlayerState* pPlayerState, int iLastPixelToDr
|
|||||||
return fLastBeatToDraw;
|
return fLastBeatToDraw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool NoteField::IsOnScreen( float fBeat, int iFirstPixelToDraw, int iLastPixelToDraw )
|
||||||
|
{
|
||||||
|
// TRICKY: If boomerang is on, then ones in the range
|
||||||
|
// [iFirstIndexToDraw,iLastIndexToDraw] aren't necessarily visible.
|
||||||
|
// Test to see if this beat is visible before drawing.
|
||||||
|
float fYOffset = ArrowEffects::GetYOffset( m_pPlayerState, 0, fBeat );
|
||||||
|
if( fYOffset > iLastPixelToDraw ) // off screen
|
||||||
|
return false;
|
||||||
|
if( fYOffset < iFirstPixelToDraw ) // off screen
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void NoteField::DrawPrimitives()
|
void NoteField::DrawPrimitives()
|
||||||
{
|
{
|
||||||
@@ -451,6 +464,8 @@ void NoteField::DrawPrimitives()
|
|||||||
// LOG->Trace( "start = %f.1, end = %f.1", fFirstBeatToDraw-fSongBeat, fLastBeatToDraw-fSongBeat );
|
// LOG->Trace( "start = %f.1, end = %f.1", fFirstBeatToDraw-fSongBeat, fLastBeatToDraw-fSongBeat );
|
||||||
// LOG->Trace( "Drawing elements %d through %d", iFirstIndexToDraw, iLastIndexToDraw );
|
// LOG->Trace( "Drawing elements %d through %d", iFirstIndexToDraw, iLastIndexToDraw );
|
||||||
|
|
||||||
|
#define IS_ON_SCREEN( fBeat ) IsOnScreen( fBeat, iFirstPixelToDraw, iLastPixelToDraw )
|
||||||
|
|
||||||
if( GAMESTATE->m_bEditing )
|
if( GAMESTATE->m_bEditing )
|
||||||
{
|
{
|
||||||
ASSERT(GAMESTATE->m_pCurSong);
|
ASSERT(GAMESTATE->m_pCurSong);
|
||||||
@@ -461,7 +476,10 @@ void NoteField::DrawPrimitives()
|
|||||||
{
|
{
|
||||||
float fStartDrawingMeasureBars = max( 0, Quantize(fFirstBeatToDraw-0.25f,0.25f) );
|
float fStartDrawingMeasureBars = max( 0, Quantize(fFirstBeatToDraw-0.25f,0.25f) );
|
||||||
for( float f=fStartDrawingMeasureBars; f<fLastBeatToDraw; f+=0.25f )
|
for( float f=fStartDrawingMeasureBars; f<fLastBeatToDraw; f+=0.25f )
|
||||||
DrawBeatBar( f );
|
{
|
||||||
|
if( IS_ON_SCREEN(f) )
|
||||||
|
DrawBeatBar( f );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -470,9 +488,13 @@ void NoteField::DrawPrimitives()
|
|||||||
vector<BPMSegment> &aBPMSegments = GAMESTATE->m_pCurSong->m_Timing.m_BPMSegments;
|
vector<BPMSegment> &aBPMSegments = GAMESTATE->m_pCurSong->m_Timing.m_BPMSegments;
|
||||||
for( unsigned i=0; i<aBPMSegments.size(); i++ )
|
for( unsigned i=0; i<aBPMSegments.size(); i++ )
|
||||||
{
|
{
|
||||||
if(aBPMSegments[i].m_iStartIndex >= iFirstIndexToDraw &&
|
if( aBPMSegments[i].m_iStartIndex >= iFirstIndexToDraw &&
|
||||||
aBPMSegments[i].m_iStartIndex <= iLastIndexToDraw)
|
aBPMSegments[i].m_iStartIndex <= iLastIndexToDraw)
|
||||||
DrawBPMText( NoteRowToBeat(aBPMSegments[i].m_iStartIndex), aBPMSegments[i].GetBPM() );
|
{
|
||||||
|
float fBeat = NoteRowToBeat(aBPMSegments[i].m_iStartIndex);
|
||||||
|
if( IS_ON_SCREEN(fBeat) )
|
||||||
|
DrawBPMText( fBeat, aBPMSegments[i].GetBPM() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// Freeze text
|
// Freeze text
|
||||||
@@ -480,9 +502,13 @@ void NoteField::DrawPrimitives()
|
|||||||
vector<StopSegment> &aStopSegments = GAMESTATE->m_pCurSong->m_Timing.m_StopSegments;
|
vector<StopSegment> &aStopSegments = GAMESTATE->m_pCurSong->m_Timing.m_StopSegments;
|
||||||
for( unsigned i=0; i<aStopSegments.size(); i++ )
|
for( unsigned i=0; i<aStopSegments.size(); i++ )
|
||||||
{
|
{
|
||||||
if(aStopSegments[i].m_iStartRow >= iFirstIndexToDraw &&
|
if( aStopSegments[i].m_iStartRow >= iFirstIndexToDraw &&
|
||||||
aStopSegments[i].m_iStartRow <= iLastIndexToDraw)
|
aStopSegments[i].m_iStartRow <= iLastIndexToDraw)
|
||||||
DrawFreezeText( NoteRowToBeat(aStopSegments[i].m_iStartRow), aStopSegments[i].m_fStopSeconds );
|
{
|
||||||
|
float fBeat = NoteRowToBeat(aStopSegments[i].m_iStartRow);
|
||||||
|
if( IS_ON_SCREEN(fBeat) )
|
||||||
|
DrawFreezeText( fBeat, aStopSegments[i].m_fStopSeconds );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -509,7 +535,8 @@ void NoteField::DrawPrimitives()
|
|||||||
change.m_bRewindMovie ? " Rewind" : "",
|
change.m_bRewindMovie ? " Rewind" : "",
|
||||||
change.m_bLoop ? " Loop" : "" );
|
change.m_bLoop ? " Loop" : "" );
|
||||||
|
|
||||||
DrawBGChangeText( change.m_fStartBeat, sChangeText );
|
if( IS_ON_SCREEN(change.m_fStartBeat) )
|
||||||
|
DrawBGChangeText( change.m_fStartBeat, sChangeText );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -648,10 +675,7 @@ void NoteField::DrawPrimitives()
|
|||||||
// TRICKY: If boomerang is on, then all notes in the range
|
// TRICKY: If boomerang is on, then all notes in the range
|
||||||
// [iFirstIndexToDraw,iLastIndexToDraw] aren't necessarily visible.
|
// [iFirstIndexToDraw,iLastIndexToDraw] aren't necessarily visible.
|
||||||
// Test every note to make sure it's on screen before drawing
|
// Test every note to make sure it's on screen before drawing
|
||||||
float fYOffset = ArrowEffects::GetYOffset( m_pPlayerState, c, NoteRowToBeat(i) );
|
if( !IS_ON_SCREEN(NoteRowToBeat(i)) )
|
||||||
if( fYOffset > iLastPixelToDraw ) // off screen
|
|
||||||
continue; // skip
|
|
||||||
if( fYOffset < iFirstPixelToDraw ) // off screen
|
|
||||||
continue; // skip
|
continue; // skip
|
||||||
|
|
||||||
ASSERT_M( NoteRowToBeat(i) > -2000, ssprintf("%i %i %i, %f %f", i, iLastIndexToDraw, iFirstIndexToDraw, GAMESTATE->m_fSongBeat, GAMESTATE->m_fMusicSeconds) );
|
ASSERT_M( NoteRowToBeat(i) > -2000, ssprintf("%i %i %i, %f %f", i, iLastIndexToDraw, iFirstIndexToDraw, GAMESTATE->m_fSongBeat, GAMESTATE->m_fMusicSeconds) );
|
||||||
|
|||||||
Reference in New Issue
Block a user