From 192bfd5ff58fa621b71b222af9941b809757805e Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Wed, 2 Oct 2002 05:42:59 +0000 Subject: [PATCH] Missing a jump in Oni now takes away only one life --- stepmania/NEWS | 1 + stepmania/src/Combo.cpp | 85 ++++++++++++++-------------- stepmania/src/Combo.h | 2 +- stepmania/src/Player.cpp | 76 ++++++++++++++----------- stepmania/src/Player.h | 2 +- stepmania/src/PlayerOptions.h | 2 - stepmania/src/RageUtil.cpp | 4 +- stepmania/src/ScreenSelectCourse.cpp | 1 + stepmania/src/ScreenTitleMenu.cpp | 14 +---- 9 files changed, 96 insertions(+), 91 deletions(-) diff --git a/stepmania/NEWS b/stepmania/NEWS index d75cdd255e..fa731ac189 100644 --- a/stepmania/NEWS +++ b/stepmania/NEWS @@ -3,6 +3,7 @@ CHANGE: Name changed to "beta 7" to avoid confusion with the numerous beta 6 release candidates ------------------------CVS after 3.00 beta 6---------------- +CHANGE: Missing a jump with the Oni life meter now subtracts only 1 life CHANGE: Judge difficulty strictness increased slightly. CHANGE: Initial sort order now sorts by meter of Easy notes, ala MAX. BUG FIX: DWI music sample info now read correctly - again. diff --git a/stepmania/src/Combo.cpp b/stepmania/src/Combo.cpp index a46a6dd202..21bf1889b5 100644 --- a/stepmania/src/Combo.cpp +++ b/stepmania/src/Combo.cpp @@ -45,7 +45,7 @@ Combo::Combo() } -void Combo::UpdateScore( TapNoteScore score ) +void Combo::UpdateScore( TapNoteScore score, int iNumNotesInThisRow ) { if( PREFSMAN->m_bAutoPlay && !GAMESTATE->m_bDemonstration ) // cheaters never prosper { @@ -58,52 +58,53 @@ void Combo::UpdateScore( TapNoteScore score ) { case TNS_PERFECT: case TNS_GREAT: - - // continue combo - m_iCurCombo++; - - if( score == TNS_PERFECT ) m_iCurComboOfPerfects++; - else m_iCurComboOfPerfects = 0; - - if( m_iCurComboOfPerfects>=150 && (m_iCurComboOfPerfects%150)==0 && RandomFloat(0,1) > 0.5 && !GAMESTATE->m_bDemonstration ) - SCREENMAN->SendMessageToTopScreen( SM_BeginToasty, 0 ); - - - switch( m_iCurCombo ) { - case 100: SCREENMAN->SendMessageToTopScreen( SM_100Combo, 0 ); break; - case 200: SCREENMAN->SendMessageToTopScreen( SM_200Combo, 0 ); break; - case 300: SCREENMAN->SendMessageToTopScreen( SM_300Combo, 0 ); break; - case 400: SCREENMAN->SendMessageToTopScreen( SM_400Combo, 0 ); break; - case 500: SCREENMAN->SendMessageToTopScreen( SM_500Combo, 0 ); break; - case 600: SCREENMAN->SendMessageToTopScreen( SM_600Combo, 0 ); break; - case 700: SCREENMAN->SendMessageToTopScreen( SM_700Combo, 0 ); break; - case 800: SCREENMAN->SendMessageToTopScreen( SM_800Combo, 0 ); break; - case 900: SCREENMAN->SendMessageToTopScreen( SM_900Combo, 0 ); break; - case 1000: SCREENMAN->SendMessageToTopScreen( SM_1000Combo, 0 ); break; - } + int iOldCombo = m_iCurCombo; - // new max combo - m_iMaxCombo = max(m_iMaxCombo, m_iCurCombo); + m_iCurCombo += iNumNotesInThisRow; // continue combo + + if( score == TNS_PERFECT ) m_iCurComboOfPerfects += iNumNotesInThisRow; + else m_iCurComboOfPerfects = 0; + + if( m_iCurComboOfPerfects>=150 && (m_iCurComboOfPerfects%150)==0 && RandomFloat(0,1) > 0.5 && !GAMESTATE->m_bDemonstration ) + SCREENMAN->SendMessageToTopScreen( SM_BeginToasty, 0 ); - if( m_iCurCombo <= 4 ) - { - m_textComboNumber.SetDiffuse( D3DXCOLOR(1,1,1,0) ); // invisible - m_sprCombo.SetDiffuse( D3DXCOLOR(1,1,1,0) ); // invisible - } - else - { - m_textComboNumber.SetDiffuse( D3DXCOLOR(1,1,1,1) ); // visible - m_sprCombo.SetDiffuse( D3DXCOLOR(1,1,1,1) ); // visible + #define CROSSED( i ) (iOldComboSetZoom( 1.2f ); - //this->BeginTweening( 0.3f ); - //this->SetTweenZoom( 1 ); + if ( CROSSED(100) ) SCREENMAN->SendMessageToTopScreen( SM_100Combo, 0 ); + else if( CROSSED(200) ) SCREENMAN->SendMessageToTopScreen( SM_200Combo, 0 ); + else if( CROSSED(300) ) SCREENMAN->SendMessageToTopScreen( SM_300Combo, 0 ); + else if( CROSSED(400) ) SCREENMAN->SendMessageToTopScreen( SM_400Combo, 0 ); + else if( CROSSED(500) ) SCREENMAN->SendMessageToTopScreen( SM_500Combo, 0 ); + else if( CROSSED(600) ) SCREENMAN->SendMessageToTopScreen( SM_600Combo, 0 ); + else if( CROSSED(700) ) SCREENMAN->SendMessageToTopScreen( SM_700Combo, 0 ); + else if( CROSSED(800) ) SCREENMAN->SendMessageToTopScreen( SM_800Combo, 0 ); + else if( CROSSED(900) ) SCREENMAN->SendMessageToTopScreen( SM_900Combo, 0 ); + else if( CROSSED(1000)) SCREENMAN->SendMessageToTopScreen( SM_1000Combo, 0 ); + + // new max combo + m_iMaxCombo = max(m_iMaxCombo, m_iCurCombo); + + + if( m_iCurCombo <= 4 ) + { + m_textComboNumber.SetDiffuse( D3DXCOLOR(1,1,1,0) ); // invisible + m_sprCombo.SetDiffuse( D3DXCOLOR(1,1,1,0) ); // invisible + } + else + { + m_textComboNumber.SetDiffuse( D3DXCOLOR(1,1,1,1) ); // visible + m_sprCombo.SetDiffuse( D3DXCOLOR(1,1,1,1) ); // visible + + m_textComboNumber.SetText( ssprintf("%d", m_iCurCombo) ); + float fNewZoom = min( 0.5f + m_iCurCombo/800.0f, 1.0f ); + m_textComboNumber.SetZoom( fNewZoom ); + + //this->SetZoom( 1.2f ); + //this->BeginTweening( 0.3f ); + //this->SetTweenZoom( 1 ); + } } break; case TNS_GOOD: diff --git a/stepmania/src/Combo.h b/stepmania/src/Combo.h index 25522bd095..08aa6e9301 100644 --- a/stepmania/src/Combo.h +++ b/stepmania/src/Combo.h @@ -22,7 +22,7 @@ class Combo : public ActorFrame public: Combo(); - void UpdateScore( TapNoteScore score ); + void UpdateScore( TapNoteScore score, int iNumNotesInThisRow ); int GetCurrentCombo() const { return m_iCurCombo; } int GetMaxCombo() const { return m_iMaxCombo; } diff --git a/stepmania/src/Player.cpp b/stepmania/src/Player.cpp index d949f12a86..7f20ced14a 100644 --- a/stepmania/src/Player.cpp +++ b/stepmania/src/Player.cpp @@ -458,8 +458,7 @@ void Player::Step( int col ) void Player::OnRowDestroyed( int col, int iIndexThatWasSteppedOn ) { - //LOG->Trace( "fBeatsUntilStep: %f, fPercentFromPerfect: %f", - // fBeatsUntilStep, fPercentFromPerfect ); + LOG->Trace( "Player::OnRowDestroyed" ); // find the minimum score of the row TapNoteScore score = TNS_PERFECT; @@ -485,14 +484,18 @@ void Player::OnRowDestroyed( int col, int iIndexThatWasSteppedOn ) for( int c=0; cg_iBrightGhostThreshold ); // show the ghost arrow for this column - - HandleNoteScore( score ); // update score - called once per note in this row - - // update combo - called once per note in this row - m_Combo.UpdateScore( score ); + } + + if( iNumNotesInThisRow > 0 ) + { + HandleNoteScore( score, iNumNotesInThisRow ); // update score - called once per note in this row + m_Combo.UpdateScore( score, iNumNotesInThisRow ); GAMESTATE->m_iMaxCombo[m_PlayerNumber] = max( GAMESTATE->m_iMaxCombo[m_PlayerNumber], m_Combo.GetCurrentCombo() ); } } @@ -535,25 +538,28 @@ int Player::UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat ) int iStartCheckingAt = max( 0, iMissIfOlderThanThisIndex-10 ); //LOG->Trace( "iStartCheckingAt: %d iMissIfOlderThanThisIndex: %d", iStartCheckingAt, iMissIfOlderThanThisIndex ); - for( int t=0; t 0 ) + { + HandleNoteScore( TNS_MISS, iNumMissesThisRow ); + m_Combo.UpdateScore( TNS_MISS, iNumMissesThisRow ); + } } if( iNumMissesFound > 0 ) { m_Judgement.SetJudgement( TNS_MISS ); - m_Combo.UpdateScore( TNS_MISS ); } return iNumMissesFound; @@ -575,19 +581,21 @@ void Player::CrossedRow( int iNoteRow ) -void Player::HandleNoteScore( TapNoteScore score ) +void Player::HandleNoteScore( TapNoteScore score, int iNumTapsInRow ) { + ASSERT( iNumTapsInRow >= 1 ); + // don't accumulate points if AutoPlay is on. if( PREFSMAN->m_bAutoPlay && !GAMESTATE->m_bDemonstration ) return; // update dance points for Oni lifemeter - GAMESTATE->m_iActualDancePoints[m_PlayerNumber] += TapNoteScoreToDancePoints( score ); - GAMESTATE->m_TapNoteScores[m_PlayerNumber][score]++; + GAMESTATE->m_iActualDancePoints[m_PlayerNumber] += iNumTapsInRow * TapNoteScoreToDancePoints( score ); + GAMESTATE->m_TapNoteScores[m_PlayerNumber][score] += iNumTapsInRow; if( m_pLifeMeter ) m_pLifeMeter->ChangeLife( score ); if( m_pLifeMeter ) - m_pLifeMeter->OnDancePointsChange(); + m_pLifeMeter->OnDancePointsChange(); // update oni life meter //A single step's points are calculated as follows: @@ -617,6 +625,10 @@ void Player::HandleNoteScore( TapNoteScore score ) // //Note: if you got all Perfect on this song, you would get (p=10)*B, which is 80,000,000. In fact, the maximum possible score for any song is the number of feet difficulty X 10,000,000. + float& fScore = GAMESTATE->m_fScore[m_PlayerNumber]; + ASSERT( fScore >= 0 ); + + int p; // score multiplier switch( score ) { @@ -625,21 +637,23 @@ void Player::HandleNoteScore( TapNoteScore score ) default: p = 0; break; } - int N = m_iNumTapNotes; - int n = m_iTapNotesHit+1; - int B = m_iMeter * 1000000; - float S = (1+N)*N/2.0f; + for( int i=0; im_fScore[m_PlayerNumber]; - ASSERT( fScore >= 0 ); + float one_step_score = p * (B/S) * n; - fScore += one_step_score; + fScore += one_step_score; + + m_iTapNotesHit++; + } - m_iTapNotesHit++; ASSERT( m_iTapNotesHit <= m_iNumTapNotes ); // HACK: Correct for rounding errors that cause a 100% perfect score to be slightly off @@ -657,16 +671,14 @@ void Player::HandleNoteScore( HoldNoteScore score ) if( PREFSMAN->m_bAutoPlay && !GAMESTATE->m_bDemonstration ) return; - // update dance points for Oni lifemeter + // update dance points totals GAMESTATE->m_iActualDancePoints[m_PlayerNumber] += HoldNoteScoreToDancePoints( score ); - GAMESTATE->m_HoldNoteScores[m_PlayerNumber][score]++; + GAMESTATE->m_HoldNoteScores[m_PlayerNumber][score] ++; if( m_pLifeMeter ) m_pLifeMeter->ChangeLife( score ); if( m_pLifeMeter ) - m_pLifeMeter->OnDancePointsChange(); - - // HoldNoteScores don't effect m_fScore + m_pLifeMeter->OnDancePointsChange(); // refresh Oni life meter } float Player::GetMaxBeatDifference() diff --git a/stepmania/src/Player.h b/stepmania/src/Player.h index 605a6252f4..72b8126b53 100644 --- a/stepmania/src/Player.h +++ b/stepmania/src/Player.h @@ -52,7 +52,7 @@ public: protected: int UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat ); void OnRowDestroyed( int col, int iStepIndex ); - void HandleNoteScore( TapNoteScore score ); + void HandleNoteScore( TapNoteScore score, int iNumTapsInRow ); void HandleNoteScore( HoldNoteScore score ); static float GetMaxBeatDifference(); diff --git a/stepmania/src/PlayerOptions.h b/stepmania/src/PlayerOptions.h index 18dd2a5c0e..0d96e63751 100644 --- a/stepmania/src/PlayerOptions.h +++ b/stepmania/src/PlayerOptions.h @@ -10,8 +10,6 @@ ----------------------------------------------------------------------------- */ -const int NUM_EFFECT_TYPES = 9; - struct PlayerOptions { float m_fArrowScrollSpeed; diff --git a/stepmania/src/RageUtil.cpp b/stepmania/src/RageUtil.cpp index 1cc3494a50..1e26016186 100644 --- a/stepmania/src/RageUtil.cpp +++ b/stepmania/src/RageUtil.cpp @@ -50,7 +50,9 @@ CString SecondsToTime( float fSecs ) int iMinsDisplay = (int)fSecs/60; int iSecsDisplay = (int)fSecs - iMinsDisplay*60; float fLeftoverDisplay = (fSecs - iMinsDisplay*60 - iSecsDisplay) * 100; - return ssprintf( "%02d:%02d:%02.0f", iMinsDisplay, iSecsDisplay, fLeftoverDisplay ); + CString sReturn = ssprintf( "%02d:%02d:%02.0f", iMinsDisplay, iSecsDisplay, min(99.0f,fLeftoverDisplay) ); + ASSERT( sReturn.GetLength() <= 8 ); + return sReturn; } //----------------------------------------------------------------------------- diff --git a/stepmania/src/ScreenSelectCourse.cpp b/stepmania/src/ScreenSelectCourse.cpp index 53754a7807..4323e2acbc 100644 --- a/stepmania/src/ScreenSelectCourse.cpp +++ b/stepmania/src/ScreenSelectCourse.cpp @@ -339,6 +339,7 @@ void ScreenSelectCourse::AfterCourseChange() } break; case TYPE_SECTION: // if we get here, there are no courses + m_Banner.SetFromGroup( "" ); break; default: ASSERT(0); diff --git a/stepmania/src/ScreenTitleMenu.cpp b/stepmania/src/ScreenTitleMenu.cpp index 5deb8606f5..56e39e6ab1 100644 --- a/stepmania/src/ScreenTitleMenu.cpp +++ b/stepmania/src/ScreenTitleMenu.cpp @@ -259,17 +259,7 @@ void ScreenTitleMenu::HandleScreenMessage( const ScreenMessage SM ) if( RandomFloat(0,1)>0.8f ) GAMESTATE->m_PlayerOptions[p].m_fArrowScrollSpeed = 1.5f; - - /* This is a bitfield; choose a bit. 1<<0 chooses the first - * option, 1<<1 the second, and so on. NUM_EFFECT_TYPES is one - * greater than the number of options (since it includes NONE); - * we'll actually NONE if we choose NUM_EFFECT_TYPES, since that'll - * do 1<<(NUM_EFFECT_TYPES-1), which will turn on a bit that doesn't - * do anything. - * - * It's simple, but it's a hack. FIXME -glenn */ - - GAMESTATE->m_PlayerOptions[p].m_bEffects[ rand()%NUM_EFFECT_TYPES ] = true; + GAMESTATE->m_PlayerOptions[p].m_bEffects[ rand()%PlayerOptions::NUM_EFFECT_TYPES ] = true; if( RandomFloat(0,1)>0.9f ) GAMESTATE->m_PlayerOptions[p].m_AppearanceType = PlayerOptions::APPEARANCE_HIDDEN; if( RandomFloat(0,1)>0.9f ) @@ -281,7 +271,7 @@ void ScreenTitleMenu::HandleScreenMessage( const ScreenMessage SM ) } GAMESTATE->m_SongOptions.m_LifeType = (randomf(0,1)>0.7f) ? SongOptions::LIFE_BATTERY : SongOptions::LIFE_BAR; GAMESTATE->m_SongOptions.m_FailType = SongOptions::FAIL_OFF; - + GAMESTATE->m_bDemonstration = true; m_Fade.CloseWipingRight( SM_GoToDemonstration ); }