diff --git a/stepmania/src/GameCommand.cpp b/stepmania/src/GameCommand.cpp index 882236fa9c..e2ea6dc301 100644 --- a/stepmania/src/GameCommand.cpp +++ b/stepmania/src/GameCommand.cpp @@ -50,6 +50,7 @@ void GameCommand::Init() m_vsScreensToPrepare.clear(); m_bDeletePreparedScreens = false; m_iWeightPounds = -1; + m_iGoalCalories = -1; m_iStopCourseAtSeconds = -1; m_bClearBookkeepingData = false; @@ -125,6 +126,8 @@ bool GameCommand::DescribesCurrentMode( PlayerNumber pn ) const return false; if( m_iWeightPounds != -1 && PROFILEMAN->IsUsingProfile(pn) && PROFILEMAN->GetProfile(pn)->m_iWeightPounds != m_iWeightPounds ) return false; + if( m_iGoalCalories != -1 && PROFILEMAN->IsUsingProfile(pn) && PROFILEMAN->GetProfile(pn)->m_iGoalCalories != m_iGoalCalories ) + return false; if( m_iStopCourseAtSeconds != -1 && GAMESTATE->m_iStopCourseAtSeconds != m_iStopCourseAtSeconds ) return false; @@ -304,6 +307,11 @@ void GameCommand::Load( int iIndex, const Commands& cmds ) m_iWeightPounds = atoi( sValue ); } + else if( sName == "goalcalories" ) + { + m_iGoalCalories = atoi( sValue ); + } + else if( sName == "stopcourseatseconds" ) { m_iStopCourseAtSeconds = atoi( sValue ); @@ -644,6 +652,10 @@ void GameCommand::Apply( const vector &vpns ) const FOREACH_CONST( PlayerNumber, vpns, pn ) if( PROFILEMAN->IsUsingProfile(*pn) ) PROFILEMAN->GetProfile(*pn)->m_iWeightPounds = m_iWeightPounds; + if( m_iGoalCalories != -1 ) + FOREACH_CONST( PlayerNumber, vpns, pn ) + if( PROFILEMAN->IsUsingProfile(*pn) ) + PROFILEMAN->GetProfile(*pn)->m_iGoalCalories = m_iGoalCalories; if( m_iStopCourseAtSeconds != -1 ) GAMESTATE->m_iStopCourseAtSeconds = m_iStopCourseAtSeconds; @@ -787,6 +799,7 @@ bool GameCommand::IsZero() const !m_sSongGroup.empty() || m_SortOrder != SORT_INVALID || m_iWeightPounds != -1 || + m_iGoalCalories != -1 || m_iStopCourseAtSeconds != -1 ) return false; diff --git a/stepmania/src/GameCommand.h b/stepmania/src/GameCommand.h index 75d406b19b..cdbc8daa35 100644 --- a/stepmania/src/GameCommand.h +++ b/stepmania/src/GameCommand.h @@ -60,6 +60,7 @@ public: vector m_vsScreensToPrepare; bool m_bDeletePreparedScreens; int m_iWeightPounds; // -1 == none specified + int m_iGoalCalories; // -1 == none specified int m_iStopCourseAtSeconds; // -1 == none specified bool m_bClearBookkeepingData; diff --git a/stepmania/src/Profile.cpp b/stepmania/src/Profile.cpp index d738f93f3d..ae02507534 100644 --- a/stepmania/src/Profile.cpp +++ b/stepmania/src/Profile.cpp @@ -77,6 +77,7 @@ void Profile::InitGeneralData() m_iTotalGameplaySeconds = 0; m_iCurrentCombo = 0; m_fTotalCaloriesBurned = 0; + m_iGoalCalories = 0; m_iTotalDancePoints = 0; m_iNumExtraStagesPassed = 0; m_iNumExtraStagesFailed = 0; @@ -787,6 +788,7 @@ XNode* Profile::SaveGeneralDataCreateNode() const pGeneralDataNode->AppendChild( "TotalGameplaySeconds", m_iTotalGameplaySeconds ); pGeneralDataNode->AppendChild( "CurrentCombo", m_iCurrentCombo ); pGeneralDataNode->AppendChild( "TotalCaloriesBurned", m_fTotalCaloriesBurned ); + pGeneralDataNode->AppendChild( "GoalCalories", m_iGoalCalories ); pGeneralDataNode->AppendChild( "LastPlayedMachineGuid", m_sLastPlayedMachineGuid ); pGeneralDataNode->AppendChild( "LastPlayedDate", m_LastPlayedDate ); pGeneralDataNode->AppendChild( "TotalDancePoints", m_iTotalDancePoints ); @@ -862,16 +864,6 @@ XNode* Profile::SaveGeneralDataCreateNode() const } } - { - XNode* pNumStagesPassedByGrade = pGeneralDataNode->AppendChild("NumStagesPassedByGrade"); - FOREACH_Grade( g ) - { - if( !m_iNumStagesPassedByGrade[g] ) - continue; - pNumStagesPassedByGrade->AppendChild( GradeToString(g), m_iNumStagesPassedByGrade[g] ); - } - } - { XNode* pNumStagesPassedByPlayMode = pGeneralDataNode->AppendChild("NumStagesPassedByPlayMode"); FOREACH_PlayMode( pm ) @@ -883,6 +875,16 @@ XNode* Profile::SaveGeneralDataCreateNode() const } } + { + XNode* pNumStagesPassedByGrade = pGeneralDataNode->AppendChild("NumStagesPassedByGrade"); + FOREACH_Grade( g ) + { + if( !m_iNumStagesPassedByGrade[g] ) + continue; + pNumStagesPassedByGrade->AppendChild( GradeToString(g), m_iNumStagesPassedByGrade[g] ); + } + } + return pGeneralDataNode; } @@ -936,6 +938,7 @@ void Profile::LoadGeneralDataFromNode( const XNode* pNode ) pNode->GetChildValue( "TotalGameplaySeconds", m_iTotalGameplaySeconds ); pNode->GetChildValue( "CurrentCombo", m_iCurrentCombo ); pNode->GetChildValue( "TotalCaloriesBurned", m_fTotalCaloriesBurned ); + pNode->GetChildValue( "GoalCalories", m_iGoalCalories ); pNode->GetChildValue( "LastPlayedMachineGuid", m_sLastPlayedMachineGuid ); pNode->GetChildValue( "LastPlayedDate", m_LastPlayedDate ); pNode->GetChildValue( "TotalDancePoints", m_iTotalDancePoints ); diff --git a/stepmania/src/Profile.h b/stepmania/src/Profile.h index af50797439..c9988d37a6 100644 --- a/stepmania/src/Profile.h +++ b/stepmania/src/Profile.h @@ -86,7 +86,7 @@ public: // CString m_sDisplayName; CString m_sLastUsedHighScoreName; // this doesn't really belong in "editable", but we need it in the smaller editable file so that it can be ready quickly. - int m_iWeightPounds; // 0 == invalid + int m_iWeightPounds; // 0 == not set // // General data @@ -103,6 +103,7 @@ public: int m_iTotalGameplaySeconds; int m_iCurrentCombo; float m_fTotalCaloriesBurned; + int m_iGoalCalories; int m_iTotalDancePoints; int m_iNumExtraStagesPassed; int m_iNumExtraStagesFailed;