implement clamping for caps

This commit is contained in:
Glenn Maynard
2005-02-07 21:13:04 +00:00
parent d1fbf3f1f5
commit 62ed8ffd2f
2 changed files with 38 additions and 14 deletions
+36 -12
View File
@@ -594,7 +594,7 @@ struct StripBuffer
int Free() const { return size - Used(); } int Free() const { return size - Used(); }
}; };
void NoteDisplay::DrawHoldTopCap( const TapNote& tn, int iCol, int iBeat, const bool bIsBeingHeld, float fYHead, float fYTail, int fYStep, float fPercentFadeToFail, float fColorScale, bool bGlow ) void NoteDisplay::DrawHoldTopCap( const TapNote& tn, int iCol, int iBeat, const bool bIsBeingHeld, float fYHead, float fYTail, int fYStep, float fPercentFadeToFail, float fColorScale, bool bGlow, float fYStartOffset, float fYEndOffset )
{ {
// //
// Draw the top cap (always wavy) // Draw the top cap (always wavy)
@@ -622,16 +622,29 @@ void NoteDisplay::DrawHoldTopCap( const TapNote& tn, int iCol, int iBeat, const
if( bGlow ) if( bGlow )
fColorScale = 1; fColorScale = 1;
float fDrawYCapTop;
float fDrawYCapBottom;
{
float fYStartPos = ArrowEffects::GetYPos( m_pPlayerState, iCol, fYStartOffset, m_fYReverseOffsetPixels );
fDrawYCapTop = max( fYCapTop, fYStartPos );
}
{
float fYEndPos = ArrowEffects::GetYPos( m_pPlayerState, iCol, fYEndOffset, m_fYReverseOffsetPixels );
fDrawYCapBottom = min( fYCapBottom, fYEndPos );
}
// don't draw any part of the head that is after the middle of the tail
fDrawYCapBottom = min( fYTail, fDrawYCapBottom );
bool bAllAreTransparent = true; bool bAllAreTransparent = true;
bool bLast = false; bool bLast = false;
// don't draw any part of the head that is after the middle of the tail
float fY = fYCapTop; float fY = fDrawYCapTop;
float fYStop = min(fYTail,fYCapBottom);
for( ; !bLast; fY+=fYStep ) for( ; !bLast; fY+=fYStep )
{ {
if( fY >= fYStop ) if( fY >= fDrawYCapBottom )
{ {
fY = fYStop; fY = fDrawYCapBottom;
bLast = true; bLast = true;
} }
@@ -763,7 +776,7 @@ void NoteDisplay::DrawHoldBody( const TapNote& tn, int iCol, int iBeat, const bo
queue.Draw(); queue.Draw();
} }
void NoteDisplay::DrawHoldBottomCap( const TapNote& tn, int iCol, int iBeat, const bool bIsBeingHeld, float fYHead, float fYTail, int fYStep, float fPercentFadeToFail, float fColorScale, bool bGlow ) void NoteDisplay::DrawHoldBottomCap( const TapNote& tn, int iCol, int iBeat, const bool bIsBeingHeld, float fYHead, float fYTail, int fYStep, float fPercentFadeToFail, float fColorScale, bool bGlow, float fYStartOffset, float fYEndOffset )
{ {
// //
// Draw the bottom cap (always wavy) // Draw the bottom cap (always wavy)
@@ -791,15 +804,26 @@ void NoteDisplay::DrawHoldBottomCap( const TapNote& tn, int iCol, int iBeat, con
if( bGlow ) if( bGlow )
fColorScale = 1; fColorScale = 1;
float fDrawYCapTop;
float fDrawYCapBottom;
{
float fYStartPos = ArrowEffects::GetYPos( m_pPlayerState, iCol, fYStartOffset, m_fYReverseOffsetPixels );
fDrawYCapTop = max( fYCapTop, fYStartPos );
}
{
float fYEndPos = ArrowEffects::GetYPos( m_pPlayerState, iCol, fYEndOffset, m_fYReverseOffsetPixels );
fDrawYCapBottom = min( fYCapBottom, fYEndPos );
}
bool bAllAreTransparent = true; bool bAllAreTransparent = true;
bool bLast = false; bool bLast = false;
// don't draw any part of the tail that is before the middle of the head // don't draw any part of the tail that is before the middle of the head
float fY=max( fYCapTop, fYHead ); float fY=max( fDrawYCapTop, fYHead );
for( ; !bLast; fY += fYStep ) for( ; !bLast; fY += fYStep )
{ {
if( fY >= fYCapBottom ) if( fY >= fDrawYCapBottom )
{ {
fY = fYCapBottom; fY = fDrawYCapBottom;
bLast = true; bLast = true;
} }
@@ -987,10 +1011,10 @@ void NoteDisplay::DrawHold( const TapNote &tn, int iCol, int iBeat, bool bIsBein
DISPLAY->SetZWrite( WavyPartsNeedZBuffer ); DISPLAY->SetZWrite( WavyPartsNeedZBuffer );
if( !bFlipHeadAndTail ) if( !bFlipHeadAndTail )
DrawHoldBottomCap( tn, iCol, iBeat, bIsBeingHeld, fYHead, fYTail, fYStep, fPercentFadeToFail, fColorScale, bDrawGlowOnly ); DrawHoldBottomCap( tn, iCol, iBeat, bIsBeingHeld, fYHead, fYTail, fYStep, fPercentFadeToFail, fColorScale, bDrawGlowOnly, fYStartOffset, fYEndOffset );
DrawHoldBody( tn, iCol, iBeat, bIsBeingHeld, fYHead, fYTail, fYStep, fPercentFadeToFail, fColorScale, bDrawGlowOnly, fYStartOffset, fYEndOffset ); DrawHoldBody( tn, iCol, iBeat, bIsBeingHeld, fYHead, fYTail, fYStep, fPercentFadeToFail, fColorScale, bDrawGlowOnly, fYStartOffset, fYEndOffset );
if( bFlipHeadAndTail ) if( bFlipHeadAndTail )
DrawHoldTopCap( tn, iCol, iBeat, bIsBeingHeld, fYHead, fYTail, fYStep, fPercentFadeToFail, fColorScale, bDrawGlowOnly ); DrawHoldTopCap( tn, iCol, iBeat, bIsBeingHeld, fYHead, fYTail, fYStep, fPercentFadeToFail, fColorScale, bDrawGlowOnly, fYStartOffset, fYEndOffset );
/* These set the texture mode themselves. */ /* These set the texture mode themselves. */
if( cache->m_bHoldTailIsAboveWavyParts ) if( cache->m_bHoldTailIsAboveWavyParts )
+2 -2
View File
@@ -38,8 +38,8 @@ protected:
Sprite *GetHoldBodySprite( float fNoteBeat, bool bIsBeingHeld ); Sprite *GetHoldBodySprite( float fNoteBeat, bool bIsBeingHeld );
Sprite *GetHoldBottomCapSprite( float fNoteBeat, bool bIsBeingHeld ); Sprite *GetHoldBottomCapSprite( float fNoteBeat, bool bIsBeingHeld );
void DrawHoldBottomCap( const TapNote& tn, int iCol, int iBeat, const bool bIsBeingHeld, float fYHead, float fYTail, int fYStep, float fPercentFadeToFail, float fColorScale, bool bGlow ); void DrawHoldBottomCap( const TapNote& tn, int iCol, int iBeat, const bool bIsBeingHeld, float fYHead, float fYTail, int fYStep, float fPercentFadeToFail, float fColorScale, bool bGlow, float fYStartOffset, float fYEndOffset );
void DrawHoldTopCap( const TapNote& tn, int iCol, int iBeat, const bool bIsBeingHeld, float fYHead, float fYTail, int fYStep, float fPercentFadeToFail, float fColorScale, bool bGlow ); void DrawHoldTopCap( const TapNote& tn, int iCol, int iBeat, const bool bIsBeingHeld, float fYHead, float fYTail, int fYStep, float fPercentFadeToFail, float fColorScale, bool bGlow, float fYStartOffset, float fYEndOffset );
void DrawHoldBody( const TapNote& tn, int iCol, int iBeat, const bool bIsBeingHeld, float fYHead, float fYTail, int fYStep, float fPercentFadeToFail, float fColorScale, bool bGlow, float fYStartOffset, float fYEndOffset ); void DrawHoldBody( const TapNote& tn, int iCol, int iBeat, const bool bIsBeingHeld, float fYHead, float fYTail, int fYStep, float fPercentFadeToFail, float fColorScale, bool bGlow, float fYStartOffset, float fYEndOffset );
void DrawHoldTail( const TapNote& tn, int iCol, int iBeat, const bool bIsBeingHeld, float fYTail, float fPercentFadeToFail, float fColorScale, bool bGlow ); void DrawHoldTail( const TapNote& tn, int iCol, int iBeat, const bool bIsBeingHeld, float fYTail, float fPercentFadeToFail, float fColorScale, bool bGlow );
void DrawHoldHead( const TapNote& tn, int iCol, int iBeat, const bool bIsBeingHeld, float fYHead, float fPercentFadeToFail, float fColorScale, bool bGlow ); void DrawHoldHead( const TapNote& tn, int iCol, int iBeat, const bool bIsBeingHeld, float fYHead, float fPercentFadeToFail, float fColorScale, bool bGlow );