Fix visibility modifiers when combined with reverse modifiers

This commit is contained in:
Glenn Maynard
2003-09-04 05:27:43 +00:00
parent 563930a9be
commit ab3d3c622a
5 changed files with 36 additions and 30 deletions
+10 -6
View File
@@ -199,10 +199,13 @@ const float fCenterLine = 160; // from fYPos == 0
const float fFadeDist = 100; const float fFadeDist = 100;
// used by ArrowGetAlpha and ArrowGetGlow below // used by ArrowGetAlpha and ArrowGetGlow below
float ArrowGetPercentVisible( PlayerNumber pn, int iCol, float fYPos ) static float ArrowGetPercentVisible( PlayerNumber pn, int iCol, float fYPos, float fYReverseOffsetPixels )
{ {
if( GAMESTATE->m_CurrentPlayerOptions[pn].GetReversePercentForColumn(iCol) > 0.5f ) if( GAMESTATE->m_CurrentPlayerOptions[pn].GetReversePercentForColumn(iCol) > 0.5f )
fYPos *= -1; {
fYPos -= SCALE( GAMESTATE->m_CurrentPlayerOptions[pn].GetReversePercentForColumn(iCol), 0.f, 1.f, 0.f, fYReverseOffsetPixels );
fYPos /= SCALE( GAMESTATE->m_CurrentPlayerOptions[pn].GetReversePercentForColumn(iCol), 0.f, 1.f, 1.f, -1.f );
}
const float fDistFromCenterLine = fYPos - fCenterLine; const float fDistFromCenterLine = fYPos - fCenterLine;
@@ -254,10 +257,10 @@ float ArrowGetPercentVisible( PlayerNumber pn, int iCol, float fYPos )
return clamp( 1+fVisibleAdjust, 0, 1 ); return clamp( 1+fVisibleAdjust, 0, 1 );
} }
float ArrowGetAlpha( PlayerNumber pn, int iCol, float fYPos, float fPercentFadeToFail ) float ArrowGetAlpha( PlayerNumber pn, int iCol, float fYPos, float fPercentFadeToFail, float fYReverseOffsetPixels )
{ {
// fYPos /= GAMESTATE->m_CurrentPlayerOptions[pn].m_fScrollSpeed; // fYPos /= GAMESTATE->m_CurrentPlayerOptions[pn].m_fScrollSpeed;
float fPercentVisible = ArrowGetPercentVisible(pn,iCol,fYPos); float fPercentVisible = ArrowGetPercentVisible(pn,iCol,fYPos,fYReverseOffsetPixels);
if( fPercentFadeToFail != -1 ) if( fPercentFadeToFail != -1 )
fPercentVisible = 1 - fPercentFadeToFail; fPercentVisible = 1 - fPercentFadeToFail;
@@ -265,10 +268,10 @@ float ArrowGetAlpha( PlayerNumber pn, int iCol, float fYPos, float fPercentFadeT
return (fPercentVisible>0.5f) ? 1.0f : 0.0f; return (fPercentVisible>0.5f) ? 1.0f : 0.0f;
} }
float ArrowGetGlow( PlayerNumber pn, int iCol, float fYPos, float fPercentFadeToFail ) float ArrowGetGlow( PlayerNumber pn, int iCol, float fYPos, float fPercentFadeToFail, float fYReverseOffsetPixels )
{ {
// fYPos /= GAMESTATE->m_CurrentPlayerOptions[pn].m_fScrollSpeed; // fYPos /= GAMESTATE->m_CurrentPlayerOptions[pn].m_fScrollSpeed;
float fPercentVisible = ArrowGetPercentVisible(pn,iCol,fYPos); float fPercentVisible = ArrowGetPercentVisible(pn,iCol,fYPos,fYReverseOffsetPixels);
if( fPercentFadeToFail != -1 ) if( fPercentFadeToFail != -1 )
fPercentVisible = 1 - fPercentFadeToFail; fPercentVisible = 1 - fPercentFadeToFail;
@@ -310,3 +313,4 @@ bool ArrowsNeedZBuffer( PlayerNumber pn )
return false; return false;
} }
+2 -2
View File
@@ -49,12 +49,12 @@ bool ArrowsNeedZBuffer( PlayerNumber pn );
// fAlpha is the transparency of the arrow. It depends on fYPos and the // fAlpha is the transparency of the arrow. It depends on fYPos and the
// AppearanceType. // AppearanceType.
float ArrowGetAlpha( PlayerNumber pn, int iCol, float fYPos, float fPercentFadeToFail ); float ArrowGetAlpha( PlayerNumber pn, int iCol, float fYPos, float fPercentFadeToFail, float fYReverseOffsetPixels );
// fAlpha is the transparency of the arrow. It depends on fYPos and the // fAlpha is the transparency of the arrow. It depends on fYPos and the
// AppearanceType. // AppearanceType.
float ArrowGetGlow( PlayerNumber pn, int iCol, float fYPos, float fPercentFadeToFail ); float ArrowGetGlow( PlayerNumber pn, int iCol, float fYPos, float fPercentFadeToFail, float fYReverseOffsetPixels );
// Depends on fYOffset. // Depends on fYOffset.
+20 -19
View File
@@ -169,9 +169,10 @@ NoteDisplay::~NoteDisplay()
delete cache; delete cache;
} }
void NoteDisplay::Load( int iColNum, PlayerNumber pn ) void NoteDisplay::Load( int iColNum, PlayerNumber pn, float fYReverseOffsetPixels )
{ {
m_PlayerNumber = pn; m_PlayerNumber = pn;
m_fYReverseOffsetPixels = fYReverseOffsetPixels;
/* Normally, this is empty and we use the style table entry via ColToButtonName. */ /* Normally, this is empty and we use the style table entry via ColToButtonName. */
CString Button = g_NoteFieldMode[m_PlayerNumber].NoteButtonNames[iColNum]; CString Button = g_NoteFieldMode[m_PlayerNumber].NoteButtonNames[iColNum];
@@ -479,10 +480,10 @@ void NoteDisplay::DrawHoldTopCap( const HoldNote& hn, const bool bActive, float
ASSERT( fTexCoordTop>=-0.0001 && fTexCoordBottom<=1.0001 ); /* allow for rounding error */ ASSERT( fTexCoordTop>=-0.0001 && fTexCoordBottom<=1.0001 ); /* allow for rounding error */
const float fTexCoordLeft = pRect->left; const float fTexCoordLeft = pRect->left;
const float fTexCoordRight = pRect->right; const float fTexCoordRight = pRect->right;
const float fAlphaTop = ArrowGetAlpha( m_PlayerNumber, iCol, fYTop, fPercentFadeToFail ); const float fAlphaTop = ArrowGetAlpha( m_PlayerNumber, iCol, fYTop, fPercentFadeToFail, m_fYReverseOffsetPixels );
const float fAlphaBottom = ArrowGetAlpha( m_PlayerNumber, iCol, fYBottom, fPercentFadeToFail ); const float fAlphaBottom = ArrowGetAlpha( m_PlayerNumber, iCol, fYBottom, fPercentFadeToFail, m_fYReverseOffsetPixels );
const float fGlowTop = ArrowGetGlow( m_PlayerNumber, iCol, fYTop, fPercentFadeToFail ); const float fGlowTop = ArrowGetGlow( m_PlayerNumber, iCol, fYTop, fPercentFadeToFail, m_fYReverseOffsetPixels );
const float fGlowBottom = ArrowGetGlow( m_PlayerNumber, iCol, fYBottom, fPercentFadeToFail ); const float fGlowBottom = ArrowGetGlow( m_PlayerNumber, iCol, fYBottom, fPercentFadeToFail, m_fYReverseOffsetPixels );
const RageColor colorDiffuseTop = RageColor(fColorScale,fColorScale,fColorScale,fAlphaTop); const RageColor colorDiffuseTop = RageColor(fColorScale,fColorScale,fColorScale,fAlphaTop);
const RageColor colorDiffuseBottom = RageColor(fColorScale,fColorScale,fColorScale,fAlphaBottom); const RageColor colorDiffuseBottom = RageColor(fColorScale,fColorScale,fColorScale,fAlphaBottom);
const RageColor colorGlowTop = RageColor(1,1,1,fGlowTop); const RageColor colorGlowTop = RageColor(1,1,1,fGlowTop);
@@ -562,10 +563,10 @@ void NoteDisplay::DrawHoldBody( const HoldNote& hn, const bool bActive, float fY
ASSERT( fTexCoordTop<=2 && fTexCoordBottom<=2 ); ASSERT( fTexCoordTop<=2 && fTexCoordBottom<=2 );
const float fTexCoordLeft = pRect->left; const float fTexCoordLeft = pRect->left;
const float fTexCoordRight = pRect->right; const float fTexCoordRight = pRect->right;
const float fAlphaTop = ArrowGetAlpha( m_PlayerNumber, iCol, fYTop, fPercentFadeToFail ); const float fAlphaTop = ArrowGetAlpha( m_PlayerNumber, iCol, fYTop, fPercentFadeToFail, m_fYReverseOffsetPixels );
const float fAlphaBottom = ArrowGetAlpha( m_PlayerNumber, iCol, fYBottom, fPercentFadeToFail ); const float fAlphaBottom = ArrowGetAlpha( m_PlayerNumber, iCol, fYBottom, fPercentFadeToFail, m_fYReverseOffsetPixels );
const float fGlowTop = ArrowGetGlow( m_PlayerNumber, iCol, fYTop, fPercentFadeToFail ); const float fGlowTop = ArrowGetGlow( m_PlayerNumber, iCol, fYTop, fPercentFadeToFail, m_fYReverseOffsetPixels );
const float fGlowBottom = ArrowGetGlow( m_PlayerNumber, iCol, fYBottom, fPercentFadeToFail ); const float fGlowBottom = ArrowGetGlow( m_PlayerNumber, iCol, fYBottom, fPercentFadeToFail, m_fYReverseOffsetPixels );
const RageColor colorDiffuseTop = RageColor(fColorScale,fColorScale,fColorScale,fAlphaTop); const RageColor colorDiffuseTop = RageColor(fColorScale,fColorScale,fColorScale,fAlphaTop);
const RageColor colorDiffuseBottom = RageColor(fColorScale,fColorScale,fColorScale,fAlphaBottom); const RageColor colorDiffuseBottom = RageColor(fColorScale,fColorScale,fColorScale,fAlphaBottom);
const RageColor colorGlowTop = RageColor(1,1,1,fGlowTop); const RageColor colorGlowTop = RageColor(1,1,1,fGlowTop);
@@ -632,10 +633,10 @@ void NoteDisplay::DrawHoldBottomCap( const HoldNote& hn, const bool bActive, flo
const float fTexCoordBottom = SCALE( fBottomDistFromTailTop, 0, fFrameHeight, pRect->top, pRect->bottom ); const float fTexCoordBottom = SCALE( fBottomDistFromTailTop, 0, fFrameHeight, pRect->top, pRect->bottom );
const float fTexCoordLeft = pRect->left; const float fTexCoordLeft = pRect->left;
const float fTexCoordRight = pRect->right; const float fTexCoordRight = pRect->right;
const float fAlphaTop = ArrowGetAlpha( m_PlayerNumber, iCol, fYTop, fPercentFadeToFail ); const float fAlphaTop = ArrowGetAlpha( m_PlayerNumber, iCol, fYTop, fPercentFadeToFail, m_fYReverseOffsetPixels );
const float fAlphaBottom = ArrowGetAlpha( m_PlayerNumber, iCol, fYBottom, fPercentFadeToFail ); const float fAlphaBottom = ArrowGetAlpha( m_PlayerNumber, iCol, fYBottom, fPercentFadeToFail, m_fYReverseOffsetPixels );
const float fGlowTop = ArrowGetGlow( m_PlayerNumber, iCol, fYTop, fPercentFadeToFail ); const float fGlowTop = ArrowGetGlow( m_PlayerNumber, iCol, fYTop, fPercentFadeToFail, m_fYReverseOffsetPixels );
const float fGlowBottom = ArrowGetGlow( m_PlayerNumber, iCol, fYBottom, fPercentFadeToFail ); const float fGlowBottom = ArrowGetGlow( m_PlayerNumber, iCol, fYBottom, fPercentFadeToFail, m_fYReverseOffsetPixels );
const RageColor colorDiffuseTop = RageColor(fColorScale,fColorScale,fColorScale,fAlphaTop); const RageColor colorDiffuseTop = RageColor(fColorScale,fColorScale,fColorScale,fAlphaTop);
const RageColor colorDiffuseBottom = RageColor(fColorScale,fColorScale,fColorScale,fAlphaBottom); const RageColor colorDiffuseBottom = RageColor(fColorScale,fColorScale,fColorScale,fAlphaBottom);
const RageColor colorGlowTop = RageColor(1,1,1,fGlowTop); const RageColor colorGlowTop = RageColor(1,1,1,fGlowTop);
@@ -667,8 +668,8 @@ void NoteDisplay::DrawHoldTail( const HoldNote& hn, bool bActive, float fYTail,
const float fY = fYTail; const float fY = fYTail;
const float fX = ArrowGetXPos( m_PlayerNumber, iCol, fY ); const float fX = ArrowGetXPos( m_PlayerNumber, iCol, fY );
const float fZ = ArrowGetZPos( m_PlayerNumber, iCol, fY ); const float fZ = ArrowGetZPos( m_PlayerNumber, iCol, fY );
const float fAlpha = ArrowGetAlpha( m_PlayerNumber, iCol, fY, fPercentFadeToFail ); const float fAlpha = ArrowGetAlpha( m_PlayerNumber, iCol, fY, fPercentFadeToFail, m_fYReverseOffsetPixels );
const float fGlow = ArrowGetGlow( m_PlayerNumber, iCol, fY, fPercentFadeToFail ); const float fGlow = ArrowGetGlow( m_PlayerNumber, iCol, fY, fPercentFadeToFail, m_fYReverseOffsetPixels );
const RageColor colorDiffuse= RageColor(fColorScale,fColorScale,fColorScale,fAlpha); const RageColor colorDiffuse= RageColor(fColorScale,fColorScale,fColorScale,fAlpha);
const RageColor colorGlow = RageColor(1,1,1,fGlow); const RageColor colorGlow = RageColor(1,1,1,fGlow);
@@ -717,8 +718,8 @@ void NoteDisplay::DrawHoldHead( const HoldNote& hn, bool bActive, float fYHead,
const float fY = fYHead; const float fY = fYHead;
const float fX = ArrowGetXPos( m_PlayerNumber, iCol, fY ); const float fX = ArrowGetXPos( m_PlayerNumber, iCol, fY );
const float fZ = ArrowGetZPos( m_PlayerNumber, iCol, fY ); const float fZ = ArrowGetZPos( m_PlayerNumber, iCol, fY );
const float fAlpha = ArrowGetAlpha( m_PlayerNumber, iCol, fY, fPercentFadeToFail ); const float fAlpha = ArrowGetAlpha( m_PlayerNumber, iCol, fY, fPercentFadeToFail, m_fYReverseOffsetPixels );
const float fGlow = ArrowGetGlow( m_PlayerNumber, iCol, fY, fPercentFadeToFail ); const float fGlow = ArrowGetGlow( m_PlayerNumber, iCol, fY, fPercentFadeToFail, m_fYReverseOffsetPixels );
const RageColor colorDiffuse= RageColor(fColorScale,fColorScale,fColorScale,fAlpha); const RageColor colorDiffuse= RageColor(fColorScale,fColorScale,fColorScale,fAlpha);
const RageColor colorGlow = RageColor(1,1,1,fGlow); const RageColor colorGlow = RageColor(1,1,1,fGlow);
@@ -811,8 +812,8 @@ void NoteDisplay::DrawTap( int iCol, float fBeat, bool bOnSameRowAsHoldStart, bo
const float fRotation = ArrowGetRotation( m_PlayerNumber, fBeat ); const float fRotation = ArrowGetRotation( m_PlayerNumber, fBeat );
const float fXPos = ArrowGetXPos( m_PlayerNumber, iCol, fYPos ); const float fXPos = ArrowGetXPos( m_PlayerNumber, iCol, fYPos );
const float fZPos = ArrowGetZPos( m_PlayerNumber, iCol, fYPos ); const float fZPos = ArrowGetZPos( m_PlayerNumber, iCol, fYPos );
const float fAlpha = ArrowGetAlpha( m_PlayerNumber, iCol, fYPos, fPercentFadeToFail ); const float fAlpha = ArrowGetAlpha( m_PlayerNumber, iCol, fYPos, fPercentFadeToFail, m_fYReverseOffsetPixels );
const float fGlow = ArrowGetGlow( m_PlayerNumber, iCol, fYPos, fPercentFadeToFail ); const float fGlow = ArrowGetGlow( m_PlayerNumber, iCol, fYPos, fPercentFadeToFail, m_fYReverseOffsetPixels );
const float fColorScale = ArrowGetBrightness( m_PlayerNumber, fBeat ) * SCALE(fLife,0,1,0.2f,1); const float fColorScale = ArrowGetBrightness( m_PlayerNumber, fBeat ) * SCALE(fLife,0,1,0.2f,1);
RageColor diffuse = RageColor(fColorScale,fColorScale,fColorScale,fAlpha); RageColor diffuse = RageColor(fColorScale,fColorScale,fColorScale,fAlpha);
RageColor glow = RageColor(1,1,1,fGlow); RageColor glow = RageColor(1,1,1,fGlow);
+2 -1
View File
@@ -27,7 +27,7 @@ public:
NoteDisplay(); NoteDisplay();
~NoteDisplay(); ~NoteDisplay();
void Load( int iColNum, PlayerNumber pn ); void Load( int iColNum, PlayerNumber pn, float fYReverseOffsetPixels );
void DrawTap( int iCol, float fBeat, bool bOnSameRowAsHoldStart, bool bIsAddition, bool bIsMine, float fPercentFadeToFail, float fLife, float fReverseOffsetPixels ); void DrawTap( int iCol, float fBeat, bool bOnSameRowAsHoldStart, bool bIsAddition, bool bIsMine, float fPercentFadeToFail, float fLife, float fReverseOffsetPixels );
void DrawHold( const HoldNote& hn, bool bActive, float fLife, float fPercentFadeToFail, bool bDrawGlowOnly, float fReverseOffsetPixels ); void DrawHold( const HoldNote& hn, bool bActive, float fLife, float fPercentFadeToFail, bool bDrawGlowOnly, float fReverseOffsetPixels );
@@ -68,6 +68,7 @@ protected:
Sprite m_sprHoldBottomCapInactive[NOTE_COLOR_IMAGES]; Sprite m_sprHoldBottomCapInactive[NOTE_COLOR_IMAGES];
Actor* m_pHoldTailActive[NOTE_COLOR_IMAGES]; Actor* m_pHoldTailActive[NOTE_COLOR_IMAGES];
Actor* m_pHoldTailInactive[NOTE_COLOR_IMAGES]; Actor* m_pHoldTailInactive[NOTE_COLOR_IMAGES];
float m_fYReverseOffsetPixels;
}; };
#endif #endif
+2 -2
View File
@@ -62,7 +62,7 @@ void NoteField::Load( NoteData* pNoteData, PlayerNumber pn, int iFirstPixelToDra
// init note displays // init note displays
for( int c=0; c<GetNumTracks(); c++ ) for( int c=0; c<GetNumTracks(); c++ )
m_NoteDisplay[c].Load( c, pn ); m_NoteDisplay[c].Load( c, pn, m_fYReverseOffsetPixels );
ASSERT( GetNumTracks() == GAMESTATE->GetCurrentStyleDef()->m_iColsPerPlayer ); ASSERT( GetNumTracks() == GAMESTATE->GetCurrentStyleDef()->m_iColsPerPlayer );
} }
@@ -71,7 +71,7 @@ void NoteField::ReloadNoteSkin()
{ {
// init note displays // init note displays
for( int c=0; c<GetNumTracks(); c++ ) for( int c=0; c<GetNumTracks(); c++ )
m_NoteDisplay[c].Load( c, m_PlayerNumber ); m_NoteDisplay[c].Load( c, m_PlayerNumber, m_fYReverseOffsetPixels );
} }
void NoteField::Update( float fDeltaTime ) void NoteField::Update( float fDeltaTime )