From 1efce9f7f7e09a6bbafa9cf32ffc7bd1e8297f1e Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 26 Aug 2002 08:11:52 +0000 Subject: [PATCH] Add Reset(). Reset combos and judgements in Player::Load(). const stuff. --- stepmania/src/Combo.cpp | 26 +++++++++----------------- stepmania/src/Combo.h | 5 +++-- stepmania/src/Judgement.h | 6 ++++-- stepmania/src/Player.cpp | 6 ++++++ 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/stepmania/src/Combo.cpp b/stepmania/src/Combo.cpp index 3c822abac2..d107390255 100644 --- a/stepmania/src/Combo.cpp +++ b/stepmania/src/Combo.cpp @@ -17,11 +17,17 @@ #include "GameState.h" +void Combo::Reset() +{ + m_iCurCombo = m_iMaxCombo = m_iCurComboOfPerfects = 0; + + m_textComboNumber.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); // invisible + m_sprCombo.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); // invisible +} + Combo::Combo() { - m_iCurCombo = 0; - m_iMaxCombo = 0; - m_iCurComboOfPerfects = 0; + Reset(); m_sprCombo.Load( THEME->GetPathTo("Graphics", "gameplay combo") ); m_sprCombo.TurnShadowOn(); @@ -34,10 +40,6 @@ Combo::Combo() m_textComboNumber.SetHorizAlign( Actor::align_right ); m_textComboNumber.SetX( 0 ); - m_textComboNumber.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); // invisible - m_sprCombo.SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); // invisible - - this->AddSubActor( &m_textComboNumber ); this->AddSubActor( &m_sprCombo ); } @@ -124,13 +126,3 @@ void Combo::UpdateScore( TapNoteScore score ) ASSERT(0); } } - -int Combo::GetCurrentCombo() -{ - return m_iCurCombo; -} - -int Combo::GetMaxCombo() -{ - return m_iMaxCombo; -} \ No newline at end of file diff --git a/stepmania/src/Combo.h b/stepmania/src/Combo.h index f6c90a21a4..25522bd095 100644 --- a/stepmania/src/Combo.h +++ b/stepmania/src/Combo.h @@ -24,8 +24,9 @@ public: void UpdateScore( TapNoteScore score ); - int GetCurrentCombo(); - int GetMaxCombo(); + int GetCurrentCombo() const { return m_iCurCombo; } + int GetMaxCombo() const { return m_iMaxCombo; } + void Reset(); protected: int m_iCurCombo; diff --git a/stepmania/src/Judgement.h b/stepmania/src/Judgement.h index 8cb3c2b33d..5b040f59a0 100644 --- a/stepmania/src/Judgement.h +++ b/stepmania/src/Judgement.h @@ -9,8 +9,8 @@ */ -#ifndef _Judgement_H_ -#define _Judgement_H_ +#ifndef JUDGEMENT_H +#define JUDGEMENT_H #include "Sprite.h" @@ -24,9 +24,11 @@ class Judgement : public ActorFrame { public: Judgement(); + virtual ~Judgement() { } void SetJudgement( TapNoteScore score ); virtual void Update( float fDeltaTime ); virtual void DrawPrimitives(); + virtual void Reset() { m_fDisplayCountdown = .0f; } protected: Sprite m_sprJudgement; diff --git a/stepmania/src/Player.cpp b/stepmania/src/Player.cpp index 7ad2f9b9b0..9e6f082258 100644 --- a/stepmania/src/Player.cpp +++ b/stepmania/src/Player.cpp @@ -77,6 +77,12 @@ void Player::Load( PlayerNumber pn, NoteData* pNoteData, LifeMeter* pLM, ScoreDi if( GAMESTATE->m_SongOptions.m_LifeType == SongOptions::LIFE_BATTERY && GAMESTATE->m_fSecondsBeforeFail[m_PlayerNumber] != -1 ) // Oni dead this->ClearAll(); + /* The editor reuses Players ... so we really need to make sure everything + * is reset and not tweening. Perhaps ActorFrame should recurse to subactors; + * then we could just this->StopTweening()? -glenn */ + m_frameJudgement.StopTweening(); + m_Combo.Reset(); + m_Judgement.Reset(); m_iNumTapNotes = pNoteData->GetNumTapNotes(); m_iTapNotesHit = 0;