From 572e73fedcb5d661de2d52dddd45eff94f4efb32 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Thu, 12 Sep 2002 02:31:52 +0000 Subject: [PATCH] Fixed life meter ugliness --- stepmania/TODO.chris | 2 -- stepmania/src/LifeMeterBar.cpp | 52 +++++++++++++++++---------- stepmania/src/LifeMeterBar.h | 2 -- stepmania/src/NoteDataWithScoring.cpp | 25 +++++++------ stepmania/src/NoteDataWithScoring.h | 6 ++-- 5 files changed, 51 insertions(+), 36 deletions(-) diff --git a/stepmania/TODO.chris b/stepmania/TODO.chris index f063428f9d..dbc16be4c4 100644 --- a/stepmania/TODO.chris +++ b/stepmania/TODO.chris @@ -4,8 +4,6 @@ Fix fix movie texture crash -life meter snaking - eval letters glow faster The "groove bar" reports at the results screen is broken. diff --git a/stepmania/src/LifeMeterBar.cpp b/stepmania/src/LifeMeterBar.cpp index 92e45d1e51..e883b4ef56 100644 --- a/stepmania/src/LifeMeterBar.cpp +++ b/stepmania/src/LifeMeterBar.cpp @@ -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; } diff --git a/stepmania/src/LifeMeterBar.h b/stepmania/src/LifeMeterBar.h index ef94bdd012..fd31b0b6e8 100644 --- a/stepmania/src/LifeMeterBar.h +++ b/stepmania/src/LifeMeterBar.h @@ -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; diff --git a/stepmania/src/NoteDataWithScoring.cpp b/stepmania/src/NoteDataWithScoring.cpp index 3066022205..087e00fc5c 100644 --- a/stepmania/src/NoteDataWithScoring.cpp +++ b/stepmania/src/NoteDataWithScoring.cpp @@ -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= 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