Z-buffer for effects on the Z axis.
This commit is contained in:
@@ -238,5 +238,20 @@ float ArrowGetBrightness( PlayerNumber pn, float fNoteBeat )
|
||||
|
||||
float ArrowGetZPos( PlayerNumber pn, int iCol, float fYPos )
|
||||
{
|
||||
return 0;
|
||||
float fZPos=0;
|
||||
const float* fEffects = GAMESTATE->m_CurrentPlayerOptions[pn].m_fEffects;
|
||||
|
||||
if( fEffects[PlayerOptions::EFFECT_BUMPY] > 0 )
|
||||
fZPos += fEffects[PlayerOptions::EFFECT_BUMPY] * 40*sinf( fYPos/16.0f );
|
||||
|
||||
return fZPos;
|
||||
}
|
||||
|
||||
bool ArrowsNeedZBuffer( PlayerNumber pn )
|
||||
{
|
||||
const float* fEffects = GAMESTATE->m_CurrentPlayerOptions[pn].m_fEffects;
|
||||
if( fEffects[PlayerOptions::EFFECT_BUMPY] > 0 )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -44,8 +44,11 @@ float ArrowGetYPos( PlayerNumber pn, float fYOffset );
|
||||
// fYPos (in the case of EFFECT_DRUNK).
|
||||
float ArrowGetXPos( PlayerNumber pn, int iCol, float fYPos );
|
||||
|
||||
// Z position; normally 0. Only visible in perspective modes.
|
||||
float ArrowGetZPos( PlayerNumber pn, int iCol, float fYPos );
|
||||
|
||||
// Enable this if any ZPos effects are enabled.
|
||||
bool ArrowsNeedZBuffer( PlayerNumber pn );
|
||||
|
||||
// fAlpha is the transparency of the arrow. It depends on fYPos and the
|
||||
// AppearanceType.
|
||||
|
||||
@@ -400,7 +400,9 @@ void NoteDisplay::DrawHold( const HoldNote& hn, const bool bActive, const float
|
||||
const float fYTail = bReverse ? fStartYPos : fEndYPos; // the center the tail
|
||||
|
||||
// const bool bWavy = GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_fEffects[PlayerOptions::EFFECT_DRUNK] > 0;
|
||||
const int fYStep = 16; //bWavy ? 16 : 128; // use small steps only if wavy
|
||||
const bool WavyPartsNeedZBuffer = ArrowsNeedZBuffer( m_PlayerNumber );
|
||||
/* Hack: Z effects need a finer grain step. */
|
||||
const int fYStep = WavyPartsNeedZBuffer? 4: 16; //bWavy ? 16 : 128; // use small steps only if wavy
|
||||
|
||||
const float fColorScale = 1*fLife + (1-fLife)*cache->m_fHoldNGGrayPercent;
|
||||
|
||||
@@ -427,7 +429,7 @@ void NoteDisplay::DrawHold( const HoldNote& hn, const bool bActive, const float
|
||||
DISPLAY->SetTexture( pTexture );
|
||||
DISPLAY->SetBlendMode( BLEND_NORMAL );
|
||||
DISPLAY->SetBackfaceCull( false );
|
||||
DISPLAY->SetZBuffer( false );
|
||||
DISPLAY->SetZBuffer( WavyPartsNeedZBuffer );
|
||||
if( bDrawGlowOnly )
|
||||
DISPLAY->SetTextureModeGlow();
|
||||
else
|
||||
@@ -498,7 +500,7 @@ void NoteDisplay::DrawHold( const HoldNote& hn, const bool bActive, const float
|
||||
DISPLAY->SetTexture( pTexture );
|
||||
DISPLAY->SetBlendMode( BLEND_NORMAL );
|
||||
DISPLAY->SetBackfaceCull( false );
|
||||
DISPLAY->SetZBuffer( false );
|
||||
DISPLAY->SetZBuffer( WavyPartsNeedZBuffer );
|
||||
if( bDrawGlowOnly )
|
||||
DISPLAY->SetTextureModeGlow();
|
||||
else
|
||||
@@ -582,7 +584,7 @@ void NoteDisplay::DrawHold( const HoldNote& hn, const bool bActive, const float
|
||||
DISPLAY->SetTexture( pTexture );
|
||||
DISPLAY->SetBlendMode( BLEND_NORMAL );
|
||||
DISPLAY->SetBackfaceCull( false );
|
||||
DISPLAY->SetZBuffer( false );
|
||||
DISPLAY->SetZBuffer( WavyPartsNeedZBuffer );
|
||||
if( bDrawGlowOnly )
|
||||
DISPLAY->SetTextureModeGlow();
|
||||
else
|
||||
|
||||
@@ -92,6 +92,7 @@ CString PlayerOptions::GetString()
|
||||
if( m_fEffects[EFFECT_MINI]==1 ) sReturn += "Mini, ";
|
||||
if( m_fEffects[EFFECT_FLIP]==1 ) sReturn += "Flip, ";
|
||||
if( m_fEffects[EFFECT_TORNADO]==1 ) sReturn += "Tornado, ";
|
||||
if( m_fEffects[EFFECT_BUMPY]==1 ) sReturn += "Bumpy, ";
|
||||
|
||||
if( m_fAppearances[APPEARANCE_HIDDEN]==1 ) sReturn += "Hidden, ";
|
||||
if( m_fAppearances[APPEARANCE_SUDDEN]==1 ) sReturn += "Sudden, ";
|
||||
@@ -184,6 +185,7 @@ void PlayerOptions::FromString( CString sOptions )
|
||||
else if( sBit == "mini" ) m_fEffects[EFFECT_MINI] = 1;
|
||||
else if( sBit == "flip" ) m_fEffects[EFFECT_FLIP] = 1;
|
||||
else if( sBit == "tornado" ) m_fEffects[EFFECT_TORNADO] = 1;
|
||||
else if( sBit == "bumpy" ) m_fEffects[EFFECT_BUMPY] = 1;
|
||||
else if( sBit == "hidden" ) m_fAppearances[APPEARANCE_HIDDEN] = 1;
|
||||
else if( sBit == "sudden" ) m_fAppearances[APPEARANCE_SUDDEN] = 1;
|
||||
else if( sBit == "stealth" ) m_fAppearances[APPEARANCE_STEALTH] = 1;
|
||||
|
||||
@@ -35,6 +35,7 @@ struct PlayerOptions
|
||||
EFFECT_MINI,
|
||||
EFFECT_FLIP,
|
||||
EFFECT_TORNADO,
|
||||
EFFECT_BUMPY,
|
||||
NUM_EFFECTS
|
||||
};
|
||||
enum Appearance {
|
||||
|
||||
Reference in New Issue
Block a user