From ad697be6a9d590558d91e3e5caf6d02ae4bc649a Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sun, 28 Oct 2007 00:02:44 +0000 Subject: [PATCH] broadcast WorkoutGoalComplete --- stepmania/src/GameState.cpp | 15 +++++++++++++++ stepmania/src/GameState.h | 1 + 2 files changed, 16 insertions(+) diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index a2a3030f73..e4d3ce8034 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -37,6 +37,8 @@ #include "UnlockManager.h" #include "ScreenManager.h" #include "Screen.h" +#include "WorkoutManager.h" +#include "Workout.h" #include #include @@ -787,6 +789,18 @@ void GameState::Update( float fDelta ) MESSAGEMAN->Broadcast( (MessageID)(Message_GoalCompleteP1+p) ); } } + + if( WORKOUTMAN->m_pCurWorkout != NULL && !m_bWorkoutGoalComplete ) + { + const StageStats &ssAccum = STATSMAN->GetAccumPlayedStageStats(); + const StageStats &ssCurrent = STATSMAN->m_CurStageStats; + bool bGoalComplete = ssAccum.m_fGameplaySeconds + ssCurrent.m_fGameplaySeconds > WORKOUTMAN->m_pCurWorkout->m_iMinutes*60; + if( bGoalComplete ) + { + MESSAGEMAN->Broadcast( "WorkoutGoalComplete" ); + m_bWorkoutGoalComplete = true; + } + } } void GameState::SetCurGame( const Game *pGame ) @@ -836,6 +850,7 @@ void GameState::ResetStageStatistics() m_bGoalComplete[p] = false; } + m_bWorkoutGoalComplete = false; FOREACH_PlayerNumber( p ) diff --git a/stepmania/src/GameState.h b/stepmania/src/GameState.h index 26231514ba..2fa0a70f91 100644 --- a/stepmania/src/GameState.h +++ b/stepmania/src/GameState.h @@ -212,6 +212,7 @@ public: // used in workout bool m_bGoalComplete[NUM_PLAYERS]; + bool m_bWorkoutGoalComplete; void RemoveAllActiveAttacks(); // called on end of song PlayerNumber GetBestPlayer() const;