FlipHeadAndTailWhenReverse is a bit confusing.

Other things are happening here: anchoring the hold note to the
top or bottom, and flipping the wavy texture upside down.  These
have separate purposes:

Normal hold rendering anchored to the bottom, so the hold scrolls
up as it's held; if it was anchored at the top, then it would
stay in place and the bottom would disappear as it was held.
In reverse, we can optionally reverse this, so the hold scrolls
down as it's held, or not reverse it, causing the hold to be
eaten by the head as the head comes down.

Normal hold rendering displays the hold body right-side-up.
In reverse, we can optionally render the hold body upside-down.
If we're flipping the head and tail (usually, putting the
overlaid arrow on the bottom instead of the top), mirroring
the body may or may not be wanted.

Additionally, we can optionally reverse the head and tail
(not to be confused with the top and bottom caps) in reverse.

These have been done together, but that's confusing; it's a
single setting with several obscure effects.  Split it up.
This commit is contained in:
Glenn Maynard
2007-01-11 03:10:36 +00:00
parent d561eecb17
commit 63b273fee2
2 changed files with 22 additions and 17 deletions
+21 -16
View File
@@ -57,6 +57,8 @@ struct NoteMetricCache_t
bool m_bHoldHeadUseLighting;
bool m_bHoldTailUseLighting;
bool m_bFlipHeadAndTailWhenReverse;
bool m_bFlipHoldBodyWhenReverse;
bool m_bTopHoldAnchorWhenReverse;
bool m_bHoldActiveIsAddLayer;
@@ -87,6 +89,8 @@ void NoteMetricCache_t::Load( const RString &sButton )
m_bHoldHeadUseLighting = NOTESKIN->GetMetricB(sButton,"HoldHeadUseLighting");
m_bHoldTailUseLighting = NOTESKIN->GetMetricB(sButton,"HoldTailUseLighting");
m_bFlipHeadAndTailWhenReverse = NOTESKIN->GetMetricB(sButton,"FlipHeadAndTailWhenReverse");
m_bFlipHoldBodyWhenReverse = NOTESKIN->GetMetricB(sButton,"FlipHoldBodyWhenReverse");
m_bTopHoldAnchorWhenReverse = NOTESKIN->GetMetricB(sButton,"TopHoldAnchorWhenReverse");
m_bHoldActiveIsAddLayer = NOTESKIN->GetMetricB(sButton,"HoldActiveIsAddLayer");
}
@@ -371,7 +375,7 @@ void NoteDisplay::DrawHoldPart( vector<Sprite*> &vpSpr, int iCol, int fYStep, fl
float fDrawDistanceAfterTargetsPixels, float fDrawDistanceBeforeTargetsPixels, float fFadeInPercentOfDrawFar,
float fYTop, float fYBottom,
float fYStartPos, float fYEndPos,
bool bWrapping, bool bAnchorToBottom )
bool bWrapping, bool bAnchorToTop, bool bFlipTextureVertically )
{
ASSERT( !vpSpr.empty() );
@@ -384,7 +388,9 @@ void NoteDisplay::DrawHoldPart( vector<Sprite*> &vpSpr, int iCol, int fYStep, fl
}
// draw manually in small segments
const RectF *pRect = pSprite->GetCurrentTextureCoordRect();
RectF rect = *pSprite->GetCurrentTextureCoordRect();
if( bFlipTextureVertically )
swap( rect.top, rect.bottom );
const float fFrameWidth = pSprite->GetZoomedWidth();
const float fFrameHeight = pSprite->GetZoomedHeight();
@@ -402,9 +408,9 @@ void NoteDisplay::DrawHoldPart( vector<Sprite*> &vpSpr, int iCol, int fYStep, fl
bool bLast = false;
float fAddToTexCoord = 0;
if( bAnchorToBottom )
if( !bAnchorToTop )
{
float fTexCoordBottom = SCALE( fYBottom - fYTop, 0, fFrameHeight, pRect->bottom, pRect->top );
float fTexCoordBottom = SCALE( fYBottom - fYTop, 0, fFrameHeight, rect.bottom, rect.top );
float fWantTexCoordBottom = ceilf( fTexCoordBottom - 0.0001f );
fAddToTexCoord = fWantTexCoordBottom - fTexCoordBottom;
}
@@ -414,7 +420,7 @@ void NoteDisplay::DrawHoldPart( vector<Sprite*> &vpSpr, int iCol, int fYStep, fl
/* For very large hold notes, shift the texture coordinates to be near 0, so we
* don't send very large values to the renderer. */
const float fDistFromTop = fYStartPos - fYTop;
float fTexCoordTop = SCALE( fDistFromTop, 0, fFrameHeight, pRect->top, pRect->bottom );
float fTexCoordTop = SCALE( fDistFromTop, 0, fFrameHeight, rect.top, rect.bottom );
fTexCoordTop += fAddToTexCoord;
fAddToTexCoord -= floorf( fTexCoordTop );
}
@@ -436,11 +442,11 @@ void NoteDisplay::DrawHoldPart( vector<Sprite*> &vpSpr, int iCol, int fYStep, fl
const float fXLeft = fX - fFrameWidth/2;
const float fXRight = fX + fFrameWidth/2;
const float fDistFromTop = fY - fYTop;
float fTexCoordTop = SCALE( fDistFromTop, 0, fFrameHeight, pRect->top, pRect->bottom );
float fTexCoordTop = SCALE( fDistFromTop, 0, fFrameHeight, rect.top, rect.bottom );
fTexCoordTop += fAddToTexCoord;
const float fTexCoordLeft = pRect->left;
const float fTexCoordRight = pRect->right;
const float fTexCoordLeft = rect.left;
const float fTexCoordRight = rect.right;
const float fAlpha = ArrowGetAlphaOrGlow( bGlow, m_pPlayerState, iCol, fYOffset, fPercentFadeToFail, m_fYReverseOffsetPixels, fDrawDistanceBeforeTargetsPixels, fFadeInPercentOfDrawFar );
const RageColor color = RageColor(fColorScale,fColorScale,fColorScale,fAlpha);
@@ -499,8 +505,8 @@ void NoteDisplay::DrawHoldBody( const TapNote& tn, int iCol, float fBeat, bool b
}
const bool bReverse = m_pPlayerState->m_PlayerOptions.GetCurrent().GetReversePercentForColumn(iCol) > 0.5f;
bool bFlipHeadAndTail = bReverse && cache->m_bFlipHeadAndTailWhenReverse;
if( bFlipHeadAndTail )
bool bFlipHoldBody = bReverse && cache->m_bFlipHoldBodyWhenReverse;
if( bFlipHoldBody )
{
swap( vpSprTop, vpSprBottom );
swap( pSpriteTop, pSpriteBottom );
@@ -529,6 +535,8 @@ void NoteDisplay::DrawHoldBody( const TapNote& tn, int iCol, float fBeat, bool b
if( bReverse )
swap( fYStartPos, fYEndPos );
bool bTopAnchor = bReverse && cache->m_bTopHoldAnchorWhenReverse;
// Draw the top cap
DrawHoldPart(
vpSprTop,
@@ -536,8 +544,7 @@ void NoteDisplay::DrawHoldBody( const TapNote& tn, int iCol, float fBeat, bool b
fDrawDistanceAfterTargetsPixels, fDrawDistanceBeforeTargetsPixels, fFadeInPercentOfDrawFar,
fYHead-fFrameHeightTop, fYHead,
fYStartPos, min(fYEndPos, fYTail),
false,
bFlipHeadAndTail );
false, bTopAnchor, bFlipHoldBody );
// Draw the body
DrawHoldPart(
@@ -546,8 +553,7 @@ void NoteDisplay::DrawHoldBody( const TapNote& tn, int iCol, float fBeat, bool b
fDrawDistanceAfterTargetsPixels, fDrawDistanceBeforeTargetsPixels, fFadeInPercentOfDrawFar,
fYHead, fYTail,
fYStartPos, fYEndPos,
true,
!bFlipHeadAndTail );
true, bTopAnchor, bFlipHoldBody );
// Draw the bottom cap
DrawHoldPart(
@@ -556,8 +562,7 @@ void NoteDisplay::DrawHoldBody( const TapNote& tn, int iCol, float fBeat, bool b
fDrawDistanceAfterTargetsPixels, fDrawDistanceBeforeTargetsPixels, fFadeInPercentOfDrawFar,
fYTail, fYTail+fFrameHeightBottom,
max(fYStartPos, fYHead), fYEndPos,
false,
bFlipHeadAndTail );
false, bTopAnchor, bFlipHoldBody );
}
void NoteDisplay::DrawHold( const TapNote &tn, int iCol, int iRow, bool bIsBeingHeld, const HoldNoteResult &Result, bool bIsAddition, float fPercentFadeToFail,
+1 -1
View File
@@ -98,7 +98,7 @@ private:
bool bGlow, float fDrawDistanceAfterTargetsPixels, float fDrawDistanceBeforeTargetsPixels, float fFadeInPercentOfDrawFar );
void DrawHoldPart( vector<Sprite*> &vpSpr, int iCol, int fYStep, float fPercentFadeToFail, float fColorScale, bool bGlow,
float fDrawDistanceAfterTargetsPixels, float fDrawDistanceBeforeTargetsPixels, float fFadeInPercentOfDrawFar,
float fYTop, float fYBottom, float fYStartPos, float fYEndPos, bool bWrapping, bool bAnchorToBottom );
float fYTop, float fYBottom, float fYStartPos, float fYEndPos, bool bWrapping, bool bAnchorToTop, bool bFlipTextureVertically );
const PlayerState *m_pPlayerState; // to look up PlayerOptions
NoteMetricCache_t *cache;