Fixed life meter ugliness
This commit is contained in:
@@ -110,17 +110,23 @@ public:
|
||||
{
|
||||
DISPLAY->EnableZBuffer();
|
||||
|
||||
DrawMask( m_fPercent );
|
||||
|
||||
const float fPercentBetweenStrips = 1.0f/g_iNumStrips;
|
||||
|
||||
const float fPercentOffset = fmodf( GAMESTATE->m_fSongBeat/4+1000, fPercentBetweenStrips );
|
||||
ASSERT( fPercentOffset >= 0 && fPercentOffset <= fPercentBetweenStrips );
|
||||
|
||||
for( float f=fPercentOffset+1; f>=fPercentOffset; f-=fPercentBetweenStrips )
|
||||
if( GAMESTATE->IsPlayerEnabled(m_PlayerNumber) )
|
||||
{
|
||||
DrawMask( f );
|
||||
DrawStrip( f );
|
||||
|
||||
|
||||
DrawMask( m_fPercent );
|
||||
|
||||
const float fPercentBetweenStrips = 1.0f/g_iNumStrips;
|
||||
|
||||
const float fPercentOffset = fmodf( GAMESTATE->m_fSongBeat/4+1000, fPercentBetweenStrips );
|
||||
ASSERT( fPercentOffset >= 0 && fPercentOffset <= fPercentBetweenStrips );
|
||||
|
||||
for( float f=fPercentOffset+1; f>=fPercentOffset; f-=fPercentBetweenStrips )
|
||||
{
|
||||
DrawMask( f );
|
||||
DrawStrip( f );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
DISPLAY->DisableZBuffer();
|
||||
@@ -131,9 +137,6 @@ public:
|
||||
|
||||
void DrawStrip( float fRightEdgePercent )
|
||||
{
|
||||
if( !GAMESTATE->IsPlayerEnabled(m_PlayerNumber) )
|
||||
return;
|
||||
|
||||
RECT rect;
|
||||
|
||||
const float fChamberWidthInPercent = 1.0f/g_iNumChambers;
|
||||
@@ -150,6 +153,9 @@ public:
|
||||
rect.right = -g_iMeterWidth/2 + g_iMeterWidth*min(1,fCorrectedRightEdgePercent);
|
||||
rect.bottom = +g_iMeterHeight/2;
|
||||
|
||||
ASSERT( rect.left <= g_iMeterWidth/2 && rect.right <= g_iMeterWidth/2 );
|
||||
|
||||
float fPercentCroppedFromLeft = max( 0, -fCorrectedLeftEdgePercent );
|
||||
float fPercentCroppedFromRight = max( 0, fCorrectedRightEdgePercent-1 );
|
||||
|
||||
|
||||
@@ -161,7 +167,7 @@ public:
|
||||
float fPrecentOffset = fRightEdgePercent;
|
||||
|
||||
FRECT frectCustomTexCoords(
|
||||
0,
|
||||
fPercentCroppedFromLeft,
|
||||
0,
|
||||
1-fPercentCroppedFromRight,
|
||||
1);
|
||||
@@ -188,10 +194,14 @@ public:
|
||||
float fChamberRightPercent = GetChamberRightPercent( iChamber );
|
||||
|
||||
// draw mask for vertical chambers
|
||||
rect.left = -g_iMeterWidth/2 + fChamberLeftPercent*g_iMeterWidth;
|
||||
rect.left = -g_iMeterWidth/2 + fChamberLeftPercent*g_iMeterWidth-1;
|
||||
rect.top = -g_iMeterHeight/2;
|
||||
rect.right = -g_iMeterWidth/2 + fChamberRightPercent*g_iMeterWidth;
|
||||
rect.right = -g_iMeterWidth/2 + fChamberRightPercent*g_iMeterWidth+1;
|
||||
rect.bottom = -g_iMeterHeight/2 + fHeightPercent*g_iMeterHeight;
|
||||
|
||||
rect.left = MIN( rect.left, + g_iMeterWidth/2 );
|
||||
rect.right = MIN( rect.right, + g_iMeterWidth/2 );
|
||||
|
||||
m_quadMask.StretchTo( &rect );
|
||||
m_quadMask.Draw();
|
||||
|
||||
@@ -200,6 +210,10 @@ public:
|
||||
rect.top = -g_iMeterHeight/2;
|
||||
rect.right = +g_iMeterWidth/2;
|
||||
rect.bottom = +g_iMeterHeight/2;
|
||||
|
||||
rect.left = MIN( rect.left, + g_iMeterWidth/2 );
|
||||
rect.right = MIN( rect.right, + g_iMeterWidth/2 );
|
||||
|
||||
m_quadMask.StretchTo( &rect );
|
||||
m_quadMask.Draw();
|
||||
}
|
||||
@@ -226,8 +240,8 @@ LifeMeterBar::LifeMeterBar()
|
||||
m_quadBlackBackground.SetDiffuse( D3DXCOLOR(0,0,0,1) );
|
||||
m_quadBlackBackground.SetZoomX( (float)g_iMeterWidth );
|
||||
m_quadBlackBackground.SetZoomY( (float)g_iMeterHeight );
|
||||
m_frame.AddChild( &m_quadBlackBackground );
|
||||
|
||||
this->AddChild( &m_quadBlackBackground );
|
||||
this->AddChild( m_pStream );
|
||||
|
||||
AfterLifeChanged();
|
||||
@@ -245,7 +259,7 @@ void LifeMeterBar::Load( PlayerNumber pn )
|
||||
m_pStream->m_PlayerNumber = pn;
|
||||
|
||||
if( pn == PLAYER_2 )
|
||||
m_frame.SetZoomX( -1 );
|
||||
m_pStream->SetZoomX( -1 );
|
||||
}
|
||||
|
||||
void LifeMeterBar::ChangeLife( TapNoteScore score )
|
||||
@@ -355,7 +369,7 @@ void LifeMeterBar::Update( float fDeltaTime )
|
||||
const float fViscousForce = -m_fLifeVelocity * 0.2f;
|
||||
m_fLifeVelocity += fViscousForce * fDeltaTime;
|
||||
|
||||
CLAMP( m_fLifeVelocity, -.02f, +.02f );
|
||||
CLAMP( m_fLifeVelocity, -.06f, +.02f );
|
||||
|
||||
m_fTrailingLifePercentage += m_fLifeVelocity * fDeltaTime;
|
||||
}
|
||||
|
||||
@@ -39,8 +39,6 @@ public:
|
||||
private:
|
||||
void ResetBarVelocity();
|
||||
|
||||
ActorFrame m_frame; // hold everything and mirror this for PLAYER_2 instead of mirroring all the individual Actors
|
||||
|
||||
Quad m_quadBlackBackground;
|
||||
LifeMeterStream* m_pStream;
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ void NoteDataWithScoring::InitScoringData()
|
||||
}
|
||||
}
|
||||
|
||||
int NoteDataWithScoring::GetNumSuccessfulTapNotes( const float fStartBeat, const float fEndBeat )
|
||||
int NoteDataWithScoring::GetNumTapNotesWithScore( TapNoteScore tns, const float fStartBeat, const float fEndBeat )
|
||||
{
|
||||
int iNumSuccessfulTapNotes = 0;
|
||||
|
||||
@@ -49,7 +49,7 @@ int NoteDataWithScoring::GetNumSuccessfulTapNotes( const float fStartBeat, const
|
||||
{
|
||||
for( int t=0; t<m_iNumTracks; t++ )
|
||||
{
|
||||
if( m_TapNotes[t][i] != '0' && m_TapNoteScores[t][i] >= TNS_GREAT )
|
||||
if( m_TapNotes[t][i] != '0' && m_TapNoteScores[t][i] == tns )
|
||||
iNumSuccessfulTapNotes++;
|
||||
}
|
||||
}
|
||||
@@ -57,7 +57,7 @@ int NoteDataWithScoring::GetNumSuccessfulTapNotes( const float fStartBeat, const
|
||||
return iNumSuccessfulTapNotes;
|
||||
}
|
||||
|
||||
int NoteDataWithScoring::GetNumSuccessfulDoubles( const float fStartBeat, const float fEndBeat )
|
||||
int NoteDataWithScoring::GetNumDoublesWithScore( TapNoteScore tns, const float fStartBeat, const float fEndBeat )
|
||||
{
|
||||
int iNumSuccessfulDoubles = 0;
|
||||
|
||||
@@ -76,21 +76,21 @@ int NoteDataWithScoring::GetNumSuccessfulDoubles( const float fStartBeat, const
|
||||
minTapNoteScore = min( minTapNoteScore, m_TapNoteScores[t][i] );
|
||||
}
|
||||
}
|
||||
if( iNumNotesThisIndex >= 2 && minTapNoteScore >= TNS_GREAT )
|
||||
if( iNumNotesThisIndex >= 2 && minTapNoteScore == tns )
|
||||
iNumSuccessfulDoubles++;
|
||||
}
|
||||
|
||||
return iNumSuccessfulDoubles;
|
||||
}
|
||||
|
||||
int NoteDataWithScoring::GetNumSuccessfulHoldNotes( const float fStartBeat, const float fEndBeat )
|
||||
int NoteDataWithScoring::GetNumHoldNotesWithScore( HoldNoteScore hns, const float fStartBeat, const float fEndBeat )
|
||||
{
|
||||
int iNumSuccessfulHolds = 0;
|
||||
|
||||
for( int i=0; i<m_iNumHoldNotes; i++ )
|
||||
{
|
||||
HoldNote &hn = m_HoldNotes[i];
|
||||
if( fStartBeat <= hn.m_fStartBeat && hn.m_fEndBeat <= fEndBeat && m_HoldNoteScores[i] == HNS_OK )
|
||||
if( fStartBeat <= hn.m_fStartBeat && hn.m_fEndBeat <= fEndBeat && m_HoldNoteScores[i] == hns )
|
||||
iNumSuccessfulHolds++;
|
||||
}
|
||||
return iNumSuccessfulHolds;
|
||||
@@ -100,7 +100,10 @@ int NoteDataWithScoring::GetNumSuccessfulHoldNotes( const float fStartBeat, cons
|
||||
float NoteDataWithScoring::GetActualStreamRadarValue( float fSongSeconds )
|
||||
{
|
||||
// density of steps
|
||||
int iNumSuccessfulNotes = GetNumSuccessfulTapNotes() + GetNumSuccessfulHoldNotes();
|
||||
int iNumSuccessfulNotes =
|
||||
GetNumTapNotesWithScore(TNS_PERFECT) +
|
||||
GetNumTapNotesWithScore(TNS_GREAT)/2 +
|
||||
GetNumHoldNotesWithScore(HNS_OK);
|
||||
float fNotesPerSecond = iNumSuccessfulNotes/fSongSeconds;
|
||||
float fReturn = fNotesPerSecond / 7;
|
||||
return min( fReturn, 1.0f );
|
||||
@@ -117,7 +120,7 @@ float NoteDataWithScoring::GetActualVoltageRadarValue( float fSongSeconds )
|
||||
|
||||
for( int i=0; i<MAX_BEATS; i+=BEAT_WINDOW )
|
||||
{
|
||||
int iNumNotesThisWindow = GetNumSuccessfulTapNotes((float)i,(float)i+BEAT_WINDOW) + GetNumSuccessfulHoldNotes((float)i,(float)i+BEAT_WINDOW);
|
||||
int iNumNotesThisWindow = GetNumTapNotesWithScore(TNS_PERFECT,(float)i,(float)i+BEAT_WINDOW) + GetNumHoldNotesWithScore(HNS_OK,(float)i,(float)i+BEAT_WINDOW);
|
||||
float fDensityThisWindow = iNumNotesThisWindow/(float)BEAT_WINDOW;
|
||||
fMaxDensitySoFar = max( fMaxDensitySoFar, fDensityThisWindow );
|
||||
}
|
||||
@@ -129,7 +132,9 @@ float NoteDataWithScoring::GetActualVoltageRadarValue( float fSongSeconds )
|
||||
float NoteDataWithScoring::GetActualAirRadarValue( float fSongSeconds )
|
||||
{
|
||||
// number of doubles
|
||||
int iNumDoubles = GetNumSuccessfulDoubles();
|
||||
int iNumDoubles =
|
||||
GetNumDoublesWithScore(TNS_PERFECT) +
|
||||
GetNumDoublesWithScore(TNS_GREAT)/2;
|
||||
float fReturn = iNumDoubles / fSongSeconds;
|
||||
return min( fReturn, 1.0f );
|
||||
}
|
||||
@@ -151,6 +156,6 @@ float NoteDataWithScoring::GetActualChaosRadarValue( float fSongSeconds )
|
||||
float NoteDataWithScoring::GetActualFreezeRadarValue( float fSongSeconds )
|
||||
{
|
||||
// number of hold steps
|
||||
float fReturn = GetNumSuccessfulHoldNotes() / fSongSeconds;
|
||||
float fReturn = GetNumHoldNotesWithScore(HNS_OK) / fSongSeconds;
|
||||
return min( fReturn, 1.0f );
|
||||
}
|
||||
|
||||
@@ -31,9 +31,9 @@ struct NoteDataWithScoring : public NoteData
|
||||
|
||||
|
||||
// statistics
|
||||
int GetNumSuccessfulTapNotes( const float fStartBeat = 0, const float fEndBeat = MAX_BEATS );
|
||||
int GetNumSuccessfulDoubles( const float fStartBeat = 0, const float fEndBeat = MAX_BEATS );
|
||||
int GetNumSuccessfulHoldNotes( const float fStartBeat = 0, const float fEndBeat = MAX_BEATS );
|
||||
int GetNumTapNotesWithScore( TapNoteScore tns, const float fStartBeat = 0, const float fEndBeat = MAX_BEATS );
|
||||
int GetNumDoublesWithScore( TapNoteScore tns, const float fStartBeat = 0, const float fEndBeat = MAX_BEATS );
|
||||
int GetNumHoldNotesWithScore( HoldNoteScore hns, const float fStartBeat = 0, const float fEndBeat = MAX_BEATS );
|
||||
|
||||
inline bool IsRowComplete( int index )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user