Fixed life meter ugliness

This commit is contained in:
Chris Danford
2002-09-12 02:31:52 +00:00
parent 686b704ed7
commit 572e73fedc
5 changed files with 51 additions and 36 deletions
-2
View File
@@ -4,8 +4,6 @@ Fix
fix movie texture crash fix movie texture crash
life meter snaking
eval letters glow faster eval letters glow faster
The "groove bar" reports at the results screen is broken. The "groove bar" reports at the results screen is broken.
+23 -9
View File
@@ -110,6 +110,10 @@ public:
{ {
DISPLAY->EnableZBuffer(); DISPLAY->EnableZBuffer();
if( GAMESTATE->IsPlayerEnabled(m_PlayerNumber) )
{
DrawMask( m_fPercent ); DrawMask( m_fPercent );
const float fPercentBetweenStrips = 1.0f/g_iNumStrips; const float fPercentBetweenStrips = 1.0f/g_iNumStrips;
@@ -123,6 +127,8 @@ public:
DrawStrip( f ); DrawStrip( f );
} }
}
DISPLAY->DisableZBuffer(); DISPLAY->DisableZBuffer();
m_sprFrame.Draw(); m_sprFrame.Draw();
@@ -131,9 +137,6 @@ public:
void DrawStrip( float fRightEdgePercent ) void DrawStrip( float fRightEdgePercent )
{ {
if( !GAMESTATE->IsPlayerEnabled(m_PlayerNumber) )
return;
RECT rect; RECT rect;
const float fChamberWidthInPercent = 1.0f/g_iNumChambers; const float fChamberWidthInPercent = 1.0f/g_iNumChambers;
@@ -150,6 +153,9 @@ public:
rect.right = -g_iMeterWidth/2 + g_iMeterWidth*min(1,fCorrectedRightEdgePercent); rect.right = -g_iMeterWidth/2 + g_iMeterWidth*min(1,fCorrectedRightEdgePercent);
rect.bottom = +g_iMeterHeight/2; 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 ); float fPercentCroppedFromRight = max( 0, fCorrectedRightEdgePercent-1 );
@@ -161,7 +167,7 @@ public:
float fPrecentOffset = fRightEdgePercent; float fPrecentOffset = fRightEdgePercent;
FRECT frectCustomTexCoords( FRECT frectCustomTexCoords(
0, fPercentCroppedFromLeft,
0, 0,
1-fPercentCroppedFromRight, 1-fPercentCroppedFromRight,
1); 1);
@@ -188,10 +194,14 @@ public:
float fChamberRightPercent = GetChamberRightPercent( iChamber ); float fChamberRightPercent = GetChamberRightPercent( iChamber );
// draw mask for vertical chambers // 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.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.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.StretchTo( &rect );
m_quadMask.Draw(); m_quadMask.Draw();
@@ -200,6 +210,10 @@ public:
rect.top = -g_iMeterHeight/2; rect.top = -g_iMeterHeight/2;
rect.right = +g_iMeterWidth/2; rect.right = +g_iMeterWidth/2;
rect.bottom = +g_iMeterHeight/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.StretchTo( &rect );
m_quadMask.Draw(); m_quadMask.Draw();
} }
@@ -226,8 +240,8 @@ LifeMeterBar::LifeMeterBar()
m_quadBlackBackground.SetDiffuse( D3DXCOLOR(0,0,0,1) ); m_quadBlackBackground.SetDiffuse( D3DXCOLOR(0,0,0,1) );
m_quadBlackBackground.SetZoomX( (float)g_iMeterWidth ); m_quadBlackBackground.SetZoomX( (float)g_iMeterWidth );
m_quadBlackBackground.SetZoomY( (float)g_iMeterHeight ); m_quadBlackBackground.SetZoomY( (float)g_iMeterHeight );
m_frame.AddChild( &m_quadBlackBackground );
this->AddChild( &m_quadBlackBackground );
this->AddChild( m_pStream ); this->AddChild( m_pStream );
AfterLifeChanged(); AfterLifeChanged();
@@ -245,7 +259,7 @@ void LifeMeterBar::Load( PlayerNumber pn )
m_pStream->m_PlayerNumber = pn; m_pStream->m_PlayerNumber = pn;
if( pn == PLAYER_2 ) if( pn == PLAYER_2 )
m_frame.SetZoomX( -1 ); m_pStream->SetZoomX( -1 );
} }
void LifeMeterBar::ChangeLife( TapNoteScore score ) void LifeMeterBar::ChangeLife( TapNoteScore score )
@@ -355,7 +369,7 @@ void LifeMeterBar::Update( float fDeltaTime )
const float fViscousForce = -m_fLifeVelocity * 0.2f; const float fViscousForce = -m_fLifeVelocity * 0.2f;
m_fLifeVelocity += fViscousForce * fDeltaTime; m_fLifeVelocity += fViscousForce * fDeltaTime;
CLAMP( m_fLifeVelocity, -.02f, +.02f ); CLAMP( m_fLifeVelocity, -.06f, +.02f );
m_fTrailingLifePercentage += m_fLifeVelocity * fDeltaTime; m_fTrailingLifePercentage += m_fLifeVelocity * fDeltaTime;
} }
-2
View File
@@ -39,8 +39,6 @@ public:
private: private:
void ResetBarVelocity(); void ResetBarVelocity();
ActorFrame m_frame; // hold everything and mirror this for PLAYER_2 instead of mirroring all the individual Actors
Quad m_quadBlackBackground; Quad m_quadBlackBackground;
LifeMeterStream* m_pStream; LifeMeterStream* m_pStream;
+15 -10
View File
@@ -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; int iNumSuccessfulTapNotes = 0;
@@ -49,7 +49,7 @@ int NoteDataWithScoring::GetNumSuccessfulTapNotes( const float fStartBeat, const
{ {
for( int t=0; t<m_iNumTracks; t++ ) 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++; iNumSuccessfulTapNotes++;
} }
} }
@@ -57,7 +57,7 @@ int NoteDataWithScoring::GetNumSuccessfulTapNotes( const float fStartBeat, const
return iNumSuccessfulTapNotes; 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; int iNumSuccessfulDoubles = 0;
@@ -76,21 +76,21 @@ int NoteDataWithScoring::GetNumSuccessfulDoubles( const float fStartBeat, const
minTapNoteScore = min( minTapNoteScore, m_TapNoteScores[t][i] ); minTapNoteScore = min( minTapNoteScore, m_TapNoteScores[t][i] );
} }
} }
if( iNumNotesThisIndex >= 2 && minTapNoteScore >= TNS_GREAT ) if( iNumNotesThisIndex >= 2 && minTapNoteScore == tns )
iNumSuccessfulDoubles++; iNumSuccessfulDoubles++;
} }
return 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; int iNumSuccessfulHolds = 0;
for( int i=0; i<m_iNumHoldNotes; i++ ) for( int i=0; i<m_iNumHoldNotes; i++ )
{ {
HoldNote &hn = m_HoldNotes[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++; iNumSuccessfulHolds++;
} }
return iNumSuccessfulHolds; return iNumSuccessfulHolds;
@@ -100,7 +100,10 @@ int NoteDataWithScoring::GetNumSuccessfulHoldNotes( const float fStartBeat, cons
float NoteDataWithScoring::GetActualStreamRadarValue( float fSongSeconds ) float NoteDataWithScoring::GetActualStreamRadarValue( float fSongSeconds )
{ {
// density of steps // density of steps
int iNumSuccessfulNotes = GetNumSuccessfulTapNotes() + GetNumSuccessfulHoldNotes(); int iNumSuccessfulNotes =
GetNumTapNotesWithScore(TNS_PERFECT) +
GetNumTapNotesWithScore(TNS_GREAT)/2 +
GetNumHoldNotesWithScore(HNS_OK);
float fNotesPerSecond = iNumSuccessfulNotes/fSongSeconds; float fNotesPerSecond = iNumSuccessfulNotes/fSongSeconds;
float fReturn = fNotesPerSecond / 7; float fReturn = fNotesPerSecond / 7;
return min( fReturn, 1.0f ); return min( fReturn, 1.0f );
@@ -117,7 +120,7 @@ float NoteDataWithScoring::GetActualVoltageRadarValue( float fSongSeconds )
for( int i=0; i<MAX_BEATS; i+=BEAT_WINDOW ) 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; float fDensityThisWindow = iNumNotesThisWindow/(float)BEAT_WINDOW;
fMaxDensitySoFar = max( fMaxDensitySoFar, fDensityThisWindow ); fMaxDensitySoFar = max( fMaxDensitySoFar, fDensityThisWindow );
} }
@@ -129,7 +132,9 @@ float NoteDataWithScoring::GetActualVoltageRadarValue( float fSongSeconds )
float NoteDataWithScoring::GetActualAirRadarValue( float fSongSeconds ) float NoteDataWithScoring::GetActualAirRadarValue( float fSongSeconds )
{ {
// number of doubles // number of doubles
int iNumDoubles = GetNumSuccessfulDoubles(); int iNumDoubles =
GetNumDoublesWithScore(TNS_PERFECT) +
GetNumDoublesWithScore(TNS_GREAT)/2;
float fReturn = iNumDoubles / fSongSeconds; float fReturn = iNumDoubles / fSongSeconds;
return min( fReturn, 1.0f ); return min( fReturn, 1.0f );
} }
@@ -151,6 +156,6 @@ float NoteDataWithScoring::GetActualChaosRadarValue( float fSongSeconds )
float NoteDataWithScoring::GetActualFreezeRadarValue( float fSongSeconds ) float NoteDataWithScoring::GetActualFreezeRadarValue( float fSongSeconds )
{ {
// number of hold steps // number of hold steps
float fReturn = GetNumSuccessfulHoldNotes() / fSongSeconds; float fReturn = GetNumHoldNotesWithScore(HNS_OK) / fSongSeconds;
return min( fReturn, 1.0f ); return min( fReturn, 1.0f );
} }
+3 -3
View File
@@ -31,9 +31,9 @@ struct NoteDataWithScoring : public NoteData
// statistics // statistics
int GetNumSuccessfulTapNotes( const float fStartBeat = 0, const float fEndBeat = MAX_BEATS ); int GetNumTapNotesWithScore( TapNoteScore tns, const float fStartBeat = 0, const float fEndBeat = MAX_BEATS );
int GetNumSuccessfulDoubles( const float fStartBeat = 0, const float fEndBeat = MAX_BEATS ); int GetNumDoublesWithScore( TapNoteScore tns, const float fStartBeat = 0, const float fEndBeat = MAX_BEATS );
int GetNumSuccessfulHoldNotes( 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 ) inline bool IsRowComplete( int index )
{ {