diff --git a/stepmania/src/Player.cpp b/stepmania/src/Player.cpp index ed764a870a..42531b3fdb 100644 --- a/stepmania/src/Player.cpp +++ b/stepmania/src/Player.cpp @@ -286,6 +286,7 @@ void Player::Init( m_pPrimaryScoreKeeper = pPrimaryScoreKeeper; m_pSecondaryScoreKeeper = pSecondaryScoreKeeper; + m_iLastSeenCombo = -1; // set initial life if( m_pLifeMeter && m_pPlayerStageStats ) @@ -330,10 +331,10 @@ void Player::Init( LuaThreadVariable var( "Player", LuaReference::Create(m_pPlayerState->m_PlayerNumber) ); LuaThreadVariable var2( "MultiPlayer", LuaReference::Create(m_pPlayerState->m_mp) ); - m_Combo.SetName( "Combo" ); - m_Combo.Load( THEME->GetPathG(sType,"combo"), m_pPlayerState, m_pPlayerStageStats ); + m_Combo.Load( THEME->GetPathG(sType,"combo") ); + m_Combo->SetName( "Combo" ); ActorUtil::LoadAllCommandsAndOnCommand( m_Combo, sType ); - this->AddChild( &m_Combo ); + this->AddChild( m_Combo ); m_pJudgment.Load( THEME->GetPathG(sType,"judgment") ); m_pJudgment->SetName( "Judgment" ); @@ -385,10 +386,9 @@ void Player::Load() * is reset and not tweening. Perhaps ActorFrame should recurse to subactors; * then we could just this->StopTweening()? -glenn */ m_pJudgment->PlayCommand("Reset"); -// m_Combo.Reset(); // don't reset combos between songs in a course! if( m_pPlayerStageStats ) { - m_Combo.SetCombo( m_pPlayerStageStats->m_iCurCombo, m_pPlayerStageStats->m_iCurMissCombo ); // combo can persist between songs and games + SetCombo( m_pPlayerStageStats->m_iCurCombo, m_pPlayerStageStats->m_iCurMissCombo ); // combo can persist between songs and games } if( m_pAttackDisplay ) m_pAttackDisplay->Init( m_pPlayerState ); @@ -447,8 +447,8 @@ void Player::Load() const bool bReverse = m_pPlayerState->m_PlayerOptions.GetStage().GetReversePercentForColumn( 0 ) == 1; bool bPlayerUsingBothSides = GAMESTATE->GetCurrentStyle()->m_StyleType==StyleType_OnePlayerTwoSides; - m_Combo.SetX( COMBO_X.GetValue(pn, bPlayerUsingBothSides) ); - m_Combo.SetY( bReverse ? COMBO_Y_REVERSE : COMBO_Y ); + m_Combo->SetX( COMBO_X.GetValue(pn, bPlayerUsingBothSides) ); + m_Combo->SetY( bReverse ? COMBO_Y_REVERSE : COMBO_Y ); if( m_pAttackDisplay ) m_pAttackDisplay->SetX( ATTACK_DISPLAY_X.GetValue(pn, bPlayerUsingBothSides) - 40 ); // set this in Update //m_pAttackDisplay->SetY( bReverse ? ATTACK_DISPLAY_Y_REVERSE : ATTACK_DISPLAY_Y ); @@ -563,7 +563,7 @@ void Player::Update( float fDeltaTime ) const bool bReverse = m_pPlayerState->m_PlayerOptions.GetCurrent().GetReversePercentForColumn(0) == 1; float fPercentCentered = m_pPlayerState->m_PlayerOptions.GetCurrent().m_fScrolls[PlayerOptions::SCROLL_CENTERED]; - m_Combo.SetY( + m_Combo->SetY( bReverse ? COMBO_Y_REVERSE + fPercentCentered * COMBO_CENTERED_ADDY_REVERSE : COMBO_Y + fPercentCentered * COMBO_CENTERED_ADDY ); @@ -964,7 +964,7 @@ void Player::DrawPrimitives() // Draw these below everything else. if( m_pPlayerState->m_PlayerOptions.GetCurrent().m_fBlind == 0 ) - m_Combo.Draw(); + m_Combo->Draw(); if( m_pAttackDisplay ) m_pAttackDisplay->Draw(); @@ -2293,7 +2293,7 @@ void Player::HandleTapRowScore( unsigned row ) if( m_pPlayerStageStats ) { - m_Combo.SetCombo( iCurCombo, iCurMissCombo ); + SetCombo( iCurCombo, iCurMissCombo ); } #define CROSSED( x ) (iOldCombo=x) @@ -2400,7 +2400,7 @@ void Player::FadeToFail() m_pNoteField->FadeToFail(); // clear miss combo - m_Combo.SetCombo( 0, 0 ); + SetCombo( 0, 0 ); } void Player::CacheAllUsedNoteSkins() @@ -2449,6 +2449,45 @@ void Player::SetHoldJudgment( TapNoteScore tns, HoldNoteScore hns, int iTrack ) MESSAGEMAN->Broadcast( msg ); } +void Player::SetCombo( int iCombo, int iMisses ) +{ + if( m_iLastSeenCombo == -1 ) // first update, don't set bIsMilestone=true + m_iLastSeenCombo = iCombo; + + bool b100Milestone = false; + bool b1000Milestone = false; + for( int i=m_iLastSeenCombo+1; i<=iCombo; i++ ) + { + if( i < 600 ) + b100Milestone |= ((i % 100) == 0); + else + b1000Milestone |= ((i % 200) == 0); + } + m_iLastSeenCombo = iCombo; + + if( b100Milestone ) + this->PlayCommand( "100Milestone" ); + if( b1000Milestone ) + this->PlayCommand( "1000Milestone" ); + + // don't show a colored combo until 1/4 of the way through the song + bool bPastMidpoint = GAMESTATE->GetCourseSongIndex()>0 || + GAMESTATE->m_fMusicSeconds > GAMESTATE->m_pCurSong->m_fMusicLengthSeconds/4; + + Message msg("Combo"); + if( iCombo ) + msg.SetParam( "Combo", iCombo ); + if( iMisses ) + msg.SetParam( "Misses", iMisses ); + if( bPastMidpoint && m_pPlayerStageStats->FullComboOfScore(TNS_W1) ) + msg.SetParam( "FullComboW1", true ); + if( bPastMidpoint && m_pPlayerStageStats->FullComboOfScore(TNS_W2) ) + msg.SetParam( "FullComboW2", true ); + if( bPastMidpoint && m_pPlayerStageStats->FullComboOfScore(TNS_W3) ) + msg.SetParam( "FullComboW3", true ); + this->HandleMessage( msg ); +} + /* * (c) 2001-2006 Chris Danford, Steve Checkoway * All rights reserved. diff --git a/stepmania/src/Player.h b/stepmania/src/Player.h index 7935264e2e..8c8f53a1e6 100644 --- a/stepmania/src/Player.h +++ b/stepmania/src/Player.h @@ -5,7 +5,6 @@ #include "ActorFrame.h" #include "HoldJudgment.h" -#include "Combo.h" #include "NoteDataWithScoring.h" #include "RageSound.h" #include "AttackDisplay.h" @@ -112,6 +111,7 @@ protected: void SetJudgment( TapNoteScore tns, bool bEarly ); void SetHoldJudgment( TapNoteScore tns, HoldNoteScore hns, int iTrack ); + void SetCombo( int iCombo, int iMisses ); void ChangeLife( TapNoteScore tns ); void ChangeLife( HoldNoteScore hns, TapNoteScore tns ); @@ -144,8 +144,7 @@ protected: vector m_vHoldJudgment; AutoActor m_pJudgment; - - Combo m_Combo; + AutoActor m_Combo; AttackDisplay *m_pAttackDisplay; @@ -162,6 +161,7 @@ protected: int m_iMineRowLastCrossed; int m_iRowLastJudged; // Everything up to and including this row has been judged. int m_iMineRowLastJudged; + int m_iLastSeenCombo; JudgedRows *m_pJudgedRows; RageSound m_soundMine;