From c208c31eb2c57e412ac12ba2960969cf7c5010c3 Mon Sep 17 00:00:00 2001 From: MinaciousGrace Date: Wed, 3 May 2017 09:39:59 -0400 Subject: [PATCH] purge everything related to calories or workouts --- src/Course.cpp | 5 +- src/Course.h | 1 - src/CourseUtil.cpp | 4 - src/GameCommand.cpp | 37 ---- src/GameCommand.h | 10 +- src/GameConstantsAndTypes.cpp | 9 - src/GameConstantsAndTypes.h | 13 -- src/GameState.cpp | 58 ------ src/GameState.h | 8 - src/MessageManager.cpp | 2 - src/MessageManager.h | 2 - src/PercentageDisplay.cpp | 6 - src/Player.cpp | 41 ---- src/PlayerStageStats.cpp | 4 - src/PlayerStageStats.h | 1 - src/Profile.cpp | 341 +------------------------------- src/Profile.h | 56 +----- src/ProfileManager.cpp | 6 +- src/ProfileManager.h | 2 +- src/ScoreDisplayCalories.cpp | 112 +---------- src/ScoreDisplayCalories.h | 57 +----- src/ScreenGameplay.cpp | 5 - src/ScreenOptionsEditCourse.cpp | 5 - src/StatsManager.cpp | 3 +- 24 files changed, 15 insertions(+), 773 deletions(-) diff --git a/src/Course.cpp b/src/Course.cpp index 245bb254d2..d098a683b1 100644 --- a/src/Course.cpp +++ b/src/Course.cpp @@ -89,7 +89,7 @@ int CourseEntry::GetNumModChanges() const Course::Course(): m_bIsAutogen(false), m_sPath(""), m_sMainTitle(""), m_sMainTitleTranslit(""), m_sSubTitle(""), m_sSubTitleTranslit(""), m_sScripter(""), m_sDescription(""), m_sBannerPath(""), m_sBackgroundPath(""), - m_sCDTitlePath(""), m_sGroupName(""), m_bRepeat(false), m_fGoalSeconds(0), + m_sCDTitlePath(""), m_sGroupName(""), m_bRepeat(false), m_bShuffle(false), m_iLives(-1), m_bSortByMeter(false), m_bIncomplete(false), m_vEntries(), m_SortOrder_TotalDifficulty(0), m_SortOrder_Ranking(0), m_LoadedFromProfile(ProfileSlot_Invalid), @@ -185,7 +185,6 @@ void Course::Init() m_sGroupName = ""; m_bRepeat = false; - m_fGoalSeconds = 0; m_bShuffle = false; m_iLives = -1; @@ -1303,7 +1302,6 @@ class LunaCourse: public Luna DEFINE_METHOD( IsEndless, IsEndless() ) DEFINE_METHOD( IsNonstop, IsNonstop() ) DEFINE_METHOD( IsOni, IsOni() ) - DEFINE_METHOD( GetGoalSeconds, m_fGoalSeconds ) static int HasBanner( T* p, lua_State *L ) { lua_pushboolean(L, p->HasBanner() ); return 1; } static int HasBackground( T* p, lua_State *L ) { lua_pushboolean(L, p->HasBackground() ); return 1; } DEFINE_METHOD( IsAnEdit, IsAnEdit() ) @@ -1339,7 +1337,6 @@ class LunaCourse: public Luna ADD_METHOD( IsEndless ); ADD_METHOD( IsNonstop ); ADD_METHOD( IsOni ); - ADD_METHOD( GetGoalSeconds ); ADD_METHOD( HasBanner ); ADD_METHOD( HasBackground ); ADD_METHOD( IsAnEdit ); diff --git a/src/Course.h b/src/Course.h index 24ca7c4af7..39b2f3c360 100644 --- a/src/Course.h +++ b/src/Course.h @@ -171,7 +171,6 @@ class Course RString m_sGroupName; bool m_bRepeat; // repeat after last song? "Endless" - float m_fGoalSeconds; // if not 0, stop play after this number of seconds bool m_bShuffle; int m_iLives; // -1 means use bar life meter int m_iCustomMeter[NUM_Difficulty]; // -1 = no meter specified diff --git a/src/CourseUtil.cpp b/src/CourseUtil.cpp index 862514c9a7..92d5d5b1f3 100644 --- a/src/CourseUtil.cpp +++ b/src/CourseUtil.cpp @@ -462,9 +462,7 @@ void EditCourseUtil::PrepareForPlay() GAMESTATE->m_PlayMode.Set( PLAY_MODE_ENDLESS ); GAMESTATE->m_bSideIsJoined[0] = true; - PROFILEMAN->GetProfile(ProfileSlot_Player1)->m_GoalType = GoalType_Time; Course *pCourse = GAMESTATE->m_pCurCourse; - PROFILEMAN->GetProfile(ProfileSlot_Player1)->m_iGoalSeconds = static_cast(pCourse->m_fGoalSeconds); } void EditCourseUtil::GetAllEditCourses( vector &vpCoursesOut ) @@ -482,8 +480,6 @@ void EditCourseUtil::LoadDefaults( Course &out ) { out = Course(); - out.m_fGoalSeconds = 0; - // pick a default name // XXX: Make this localizable for( int i=0; i<10000; i++ ) diff --git a/src/GameCommand.cpp b/src/GameCommand.cpp index 83da0bb0a5..3c622ef442 100644 --- a/src/GameCommand.cpp +++ b/src/GameCommand.cpp @@ -52,9 +52,6 @@ void GameCommand::Init() m_SortOrder = SortOrder_Invalid; m_sSoundPath = ""; m_vsScreensToPrepare.clear(); - m_iWeightPounds = -1; - m_iGoalCalories = -1; - m_GoalType = GoalType_Invalid; m_sProfileID = ""; m_sUrl = ""; m_bUrlExits = true; @@ -139,12 +136,6 @@ bool GameCommand::DescribesCurrentMode( PlayerNumber pn ) const return false; if( m_SortOrder != SortOrder_Invalid && GAMESTATE->m_PreferredSortOrder != m_SortOrder ) return false; - if( m_iWeightPounds != -1 && PROFILEMAN->GetProfile(pn)->m_iWeightPounds != m_iWeightPounds ) - return false; - if( m_iGoalCalories != -1 && PROFILEMAN->GetProfile(pn)->m_iGoalCalories != m_iGoalCalories ) - return false; - if( m_GoalType != GoalType_Invalid && PROFILEMAN->GetProfile(pn)->m_GoalType != m_GoalType ) - return false; if( !m_sProfileID.empty() && ProfileManager::m_sDefaultLocalProfileID[pn].Get() != m_sProfileID ) return false; @@ -375,22 +366,6 @@ void GameCommand::LoadOne( const Command& cmd ) CHECK_INVALID_VALUE(m_SortOrder, so, SortOrder_Invalid, sortorder); } - else if( sName == "weight" ) - { - m_iWeightPounds = StringToInt( sValue ); - } - - else if( sName == "goalcalories" ) - { - m_iGoalCalories = StringToInt( sValue ); - } - - else if( sName == "goaltype" ) - { - GoalType go= StringToGoalType(sValue); - CHECK_INVALID_VALUE(m_GoalType, go, GoalType_Invalid, goaltype); - } - else if( sName == "profileid" ) { m_sProfileID = sValue; @@ -811,15 +786,6 @@ void GameCommand::ApplySelf( const vector &vpns ) const GAMESTATE->m_PreferredSortOrder = m_SortOrder; if( m_sSoundPath != "" ) SOUND->PlayOnce( THEME->GetPathS( "", m_sSoundPath ) ); - if( m_iWeightPounds != -1 ) - FOREACH_CONST( PlayerNumber, vpns, pn ) - PROFILEMAN->GetProfile(*pn)->m_iWeightPounds = m_iWeightPounds; - if( m_iGoalCalories != -1 ) - FOREACH_CONST( PlayerNumber, vpns, pn ) - PROFILEMAN->GetProfile(*pn)->m_iGoalCalories = m_iGoalCalories; - if( m_GoalType != GoalType_Invalid ) - FOREACH_CONST( PlayerNumber, vpns, pn ) - PROFILEMAN->GetProfile(*pn)->m_GoalType = m_GoalType; if( !m_sProfileID.empty() ) FOREACH_CONST( PlayerNumber, vpns, pn ) ProfileManager::m_sDefaultLocalProfileID[*pn].Set( m_sProfileID ); @@ -895,9 +861,6 @@ bool GameCommand::IsZero() const m_CourseDifficulty != Difficulty_Invalid || !m_sSongGroup.empty() || m_SortOrder != SortOrder_Invalid || - m_iWeightPounds != -1 || - m_iGoalCalories != -1 || - m_GoalType != GoalType_Invalid || !m_sProfileID.empty() || !m_sUrl.empty() ) return false; diff --git a/src/GameCommand.h b/src/GameCommand.h index cad1ae9c62..324f22a710 100644 --- a/src/GameCommand.h +++ b/src/GameCommand.h @@ -36,8 +36,7 @@ class GameCommand m_pSong(NULL), m_pSteps(NULL), m_pCourse(NULL), m_pTrail(NULL), m_pCharacter(NULL), m_SetEnv(), m_SetPref(), m_sSongGroup(""), m_SortOrder(SortOrder_Invalid), - m_sSoundPath(""), m_vsScreensToPrepare(), m_iWeightPounds(-1), - m_iGoalCalories(-1), m_GoalType(GoalType_Invalid), + m_sSoundPath(""), m_vsScreensToPrepare(), m_sProfileID(""), m_sUrl(""), m_bUrlExits(true), m_bInsertCredit(false), m_bClearCredits(false), m_bStopMusic(false), m_bApplyDefaultOptions(false), @@ -97,13 +96,6 @@ class GameCommand SortOrder m_SortOrder; RString m_sSoundPath; // "" for no sound vector m_vsScreensToPrepare; - /** - * @brief What is the player's weight in pounds? - * - * If this value is -1, then no weight was specified. */ - int m_iWeightPounds; - int m_iGoalCalories; // -1 == none specified - GoalType m_GoalType; RString m_sProfileID; RString m_sUrl; // sm-ssc adds: diff --git a/src/GameConstantsAndTypes.cpp b/src/GameConstantsAndTypes.cpp index b6cd600e5b..250a24f54c 100644 --- a/src/GameConstantsAndTypes.cpp +++ b/src/GameConstantsAndTypes.cpp @@ -454,15 +454,6 @@ XToString( StyleType ); StringToX( StyleType ); LuaXType( StyleType ); -static const char *GoalTypeNames[] = { - "Calories", - "Time", - "None", -}; -XToString( GoalType ); -StringToX( GoalType ); -LuaXType( GoalType ); - static const char *EditModeNames[] = { "Practice", "CourseMods", diff --git a/src/GameConstantsAndTypes.h b/src/GameConstantsAndTypes.h index 5363b7c08a..9584462985 100644 --- a/src/GameConstantsAndTypes.h +++ b/src/GameConstantsAndTypes.h @@ -579,19 +579,6 @@ const RString& StyleTypeToString( StyleType s ); StyleType StringToStyleType( const RString& s ); LuaDeclareType( StyleType ); -/** @brief The different goal types, mainly meant for fitness modes. */ -enum GoalType -{ - GoalType_Calories, - GoalType_Time, - GoalType_None, - NUM_GoalType, - GoalType_Invalid, -}; -const RString& GoalTypeToString( GoalType gt ); -GoalType StringToGoalType( const RString& s ); -LuaDeclareType( GoalType ); - /** @brief The different types of Edit modes available. */ enum EditMode { diff --git a/src/GameState.cpp b/src/GameState.cpp index 9162ae35e7..d4ee87745b 100644 --- a/src/GameState.cpp +++ b/src/GameState.cpp @@ -1145,29 +1145,7 @@ void GameState::Update( float fDelta ) m_SongOptions.Update( fDelta ); FOREACH_PlayerNumber( p ) - { m_pPlayerState[p]->Update( fDelta ); - - if( !m_bGoalComplete[p] && IsGoalComplete(p) ) - { - m_bGoalComplete[p] = true; - MESSAGEMAN->Broadcast( (MessageID)(Message_GoalCompleteP1+p) ); - } - } - - if( GAMESTATE->m_pCurCourse ) - { - if( GAMESTATE->m_pCurCourse->m_fGoalSeconds > 0 && !m_bWorkoutGoalComplete ) - { - const StageStats &ssCurrent = STATSMAN->m_CurStageStats; - bool bGoalComplete = ssCurrent.m_fGameplaySeconds > GAMESTATE->m_pCurCourse->m_fGoalSeconds; - if( bGoalComplete ) - { - MESSAGEMAN->Broadcast( "WorkoutGoalComplete" ); - m_bWorkoutGoalComplete = true; - } - } - } } void GameState::SetCurGame( const Game *pGame ) @@ -1229,10 +1207,7 @@ void GameState::ResetStageStatistics() m_pPlayerState[p]->m_iLastPositiveSumOfAttackLevels = 0; m_pPlayerState[p]->m_fSecondsUntilAttacksPhasedOut = 0; // PlayerAI not affected - - m_bGoalComplete[p] = false; } - m_bWorkoutGoalComplete = false; FOREACH_PlayerNumber( p ) @@ -2524,35 +2499,6 @@ Premium GameState::GetPremium() const return DISABLE_PREMIUM_IN_EVENT_MODE ? Premium_Off : g_Premium; } -float GameState::GetGoalPercentComplete( PlayerNumber pn ) -{ - const Profile *pProfile = PROFILEMAN->GetProfile(pn); - const StageStats &ssCurrent = STATSMAN->m_CurStageStats; - const PlayerStageStats &pssCurrent = ssCurrent.m_player[pn]; - - float fActual = 0; - float fGoal = 0; - switch( pProfile->m_GoalType ) - { - case GoalType_Calories: - fActual = pssCurrent.m_fCaloriesBurned; - fGoal = (float)pProfile->m_iGoalCalories; - break; - case GoalType_Time: - fActual = ssCurrent.m_fGameplaySeconds; - fGoal = (float)pProfile->m_iGoalSeconds; - break; - case GoalType_None: - return 0; // never complete - default: - FAIL_M(ssprintf("Invalid GoalType: %i", pProfile->m_GoalType)); - } - if( fGoal == 0 ) - return 0; - else - return fActual / fGoal; -} - bool GameState::PlayerIsUsingModifier( PlayerNumber pn, const RString &sModifier ) { PlayerOptions po = m_pPlayerState[pn]->m_PlayerOptions.GetCurrent(); @@ -2779,7 +2725,6 @@ class LunaGameState: public Luna DEFINE_METHOD( GetPlayMode, m_PlayMode ) DEFINE_METHOD( GetSortOrder, m_SortOrder ) DEFINE_METHOD( GetCurrentStageIndex, m_iCurrentStageIndex ) - DEFINE_METHOD( IsGoalComplete, IsGoalComplete(Enum::Check(L, 1)) ) DEFINE_METHOD( PlayerIsUsingModifier, PlayerIsUsingModifier(Enum::Check(L, 1), SArg(2)) ) DEFINE_METHOD( GetCourseSongIndex, GetCourseSongIndex() ) DEFINE_METHOD( GetLoadingCourseSongIndex, GetLoadingCourseSongIndex() ) @@ -2992,7 +2937,6 @@ class LunaGameState: public Luna static int GetSongPercent( T* p, lua_State *L ) { lua_pushnumber(L, p->GetSongPercent(FArg(1))); return 1; } DEFINE_METHOD( GetCurMusicSeconds, m_Position.m_fMusicSeconds ) - DEFINE_METHOD( GetWorkoutGoalComplete, m_bWorkoutGoalComplete ) static int GetCharacter( T* p, lua_State *L ) { p->m_pCurCharacters[Enum::Check(L, 1)]->PushSelf(L); return 1; } static int SetCharacter( T* p, lua_State *L ){ Character* c = CHARMAN->GetCharacterFromID(SArg(2)); @@ -3283,7 +3227,6 @@ class LunaGameState: public Luna ADD_METHOD( GetPlayMode ); ADD_METHOD( GetSortOrder ); ADD_METHOD( GetCurrentStageIndex ); - ADD_METHOD( IsGoalComplete ); ADD_METHOD( PlayerIsUsingModifier ); ADD_METHOD( GetCourseSongIndex ); ADD_METHOD( GetLoadingCourseSongIndex ); @@ -3343,7 +3286,6 @@ class LunaGameState: public Luna ADD_METHOD( GetStageSeed ); ADD_METHOD( SaveLocalData ); ADD_METHOD( SetJukeboxUsesModifiers ); - ADD_METHOD( GetWorkoutGoalComplete ); ADD_METHOD( Reset ); ADD_METHOD( JoinPlayer ); ADD_METHOD( UnjoinPlayer ); diff --git a/src/GameState.h b/src/GameState.h index 037f91dc4c..55b5f3a8aa 100644 --- a/src/GameState.h +++ b/src/GameState.h @@ -298,10 +298,6 @@ class GameState // used in PLAY_MODE_RAVE float m_fTugLifePercentP1; - // used in workout - bool m_bGoalComplete[NUM_PLAYERS]; - bool m_bWorkoutGoalComplete; - /** @brief Primarily called at the end of a song to stop all attacks. */ void RemoveAllActiveAttacks(); PlayerNumber GetBestPlayer() const; @@ -407,10 +403,6 @@ class GameState BroadcastOnChange m_sEditLocalProfileID; Profile* GetEditLocalProfile(); - // Workout stuff - float GetGoalPercentComplete( PlayerNumber pn ); - bool IsGoalComplete( PlayerNumber pn ) { return GetGoalPercentComplete( pn ) >= 1; } - bool m_bDopefish; // Autogen stuff. This should probably be moved to its own singleton or diff --git a/src/MessageManager.cpp b/src/MessageManager.cpp index 5e403bb474..ed1c8ef65a 100644 --- a/src/MessageManager.cpp +++ b/src/MessageManager.cpp @@ -36,8 +36,6 @@ static const char *MessageIDNames[] = { "PreferredCourseDifficultyP2Changed", "EditCourseEntryIndexChanged", "EditLocalProfileIDChanged", - "GoalCompleteP1", - "GoalCompleteP2", "NoteCrossed", "NoteWillCrossIn400Ms", "NoteWillCrossIn800Ms", diff --git a/src/MessageManager.h b/src/MessageManager.h index 6e8fffbda3..7971517d08 100644 --- a/src/MessageManager.h +++ b/src/MessageManager.h @@ -31,8 +31,6 @@ enum MessageID Message_PreferredCourseDifficultyP2Changed, Message_EditCourseEntryIndexChanged, Message_EditLocalProfileIDChanged, - Message_GoalCompleteP1, - Message_GoalCompleteP2, Message_NoteCrossed, Message_NoteWillCrossIn400Ms, Message_NoteWillCrossIn800Ms, diff --git a/src/PercentageDisplay.cpp b/src/PercentageDisplay.cpp index a04da5278c..120e60a16f 100644 --- a/src/PercentageDisplay.cpp +++ b/src/PercentageDisplay.cpp @@ -195,12 +195,6 @@ bool PercentageDisplay::ShowDancePointsNotPercentage() const { // Use straight dance points in workout because the percentage denominator isn't accurate - we don't know when the players are going to stop. - if( GAMESTATE->m_pCurCourse ) - { - if( GAMESTATE->m_pCurCourse->m_fGoalSeconds > 0 ) - return true; - } - if( PREFSMAN->m_bDancePointsForOni ) return true; diff --git a/src/Player.cpp b/src/Player.cpp index 7dc8cb83ac..82c76fa260 100644 --- a/src/Player.cpp +++ b/src/Player.cpp @@ -2081,47 +2081,6 @@ void Player::Step( int col, int row, const std::chrono::steady_clock::time_point } } - // Count calories for this step, unless we're being called because a button - // is held over a mine or being released. - // TODO: Move calorie counting into a ScoreKeeper? - if( m_pPlayerStageStats && m_pPlayerState && !bHeld && !bRelease ) - { - Profile *pProfile = PROFILEMAN->GetProfile( pn ); - - int iNumTracksHeld = 0; - for( int t=0; t GameI; - GAMESTATE->GetCurrentStyle(GetPlayerState()->m_PlayerNumber)->StyleInputToGameInput( t, pn, GameI ); - float secs_held= 0.0f; - for(size_t i= 0; i < GameI.size(); ++i) - { - secs_held= max(secs_held, INPUTMAPPER->GetSecsHeld( GameI[i] )); - } - if( secs_held > 0 && secs_held < m_fTimingWindowJump ) - iNumTracksHeld++; - } - - float fCals = 0; - switch( iNumTracksHeld ) - { - case 0: - // autoplay is on, or this is a computer player - iNumTracksHeld = 1; - // fall through - default: - { - float fCalsFor100Lbs = SCALE( iNumTracksHeld, 1, 2, 0.023f, 0.077f ); - float fCalsFor200Lbs = SCALE( iNumTracksHeld, 1, 2, 0.041f, 0.133f ); - fCals = SCALE( pProfile->GetCalculatedWeightPounds(), 100.f, 200.f, fCalsFor100Lbs, fCalsFor200Lbs ); - } - break; - } - - m_pPlayerStageStats->m_fCaloriesBurned += fCals; - m_pPlayerStageStats->m_iNumControllerSteps ++; - } - // Check for step on a TapNote /* XXX: This seems wrong. If a player steps twice quickly and two notes are * close together in the same column then it is possible for the two notes diff --git a/src/PlayerStageStats.cpp b/src/PlayerStageStats.cpp index 33806ca274..ce00f89f45 100644 --- a/src/PlayerStageStats.cpp +++ b/src/PlayerStageStats.cpp @@ -59,7 +59,6 @@ void PlayerStageStats::InternalInit() m_iSongsPlayed = 0; m_fLifeRemainingSeconds = 0; m_iNumControllerSteps = 0; - m_fCaloriesBurned = 0; ZERO( m_iTapNoteScores ); ZERO( m_iHoldNoteScores ); @@ -119,7 +118,6 @@ void PlayerStageStats::AddStats( const PlayerStageStats& other ) m_iSongsPassed += other.m_iSongsPassed; m_iSongsPlayed += other.m_iSongsPlayed; m_iNumControllerSteps += other.m_iNumControllerSteps; - m_fCaloriesBurned += other.m_fCaloriesBurned; m_fLifeRemainingSeconds = other.m_fLifeRemainingSeconds; // don't accumulate m_bDisqualified |= other.m_bDisqualified; @@ -856,7 +854,6 @@ LuaFunction( FormatPercentScore, PlayerStageStats::FormatPercentScore( FArg(1) ) class LunaPlayerStageStats: public Luna { public: - DEFINE_METHOD( GetCaloriesBurned, m_fCaloriesBurned ) DEFINE_METHOD( GetNumControllerSteps, m_iNumControllerSteps ) DEFINE_METHOD( GetLifeRemainingSeconds, m_fLifeRemainingSeconds ) DEFINE_METHOD( GetSurvivalSeconds, GetSurvivalSeconds() ) @@ -1046,7 +1043,6 @@ class LunaPlayerStageStats: public Luna LunaPlayerStageStats() { - ADD_METHOD( GetCaloriesBurned ); ADD_METHOD( GetNumControllerSteps ); ADD_METHOD( GetLifeRemainingSeconds ); ADD_METHOD( GetSurvivalSeconds ); diff --git a/src/PlayerStageStats.h b/src/PlayerStageStats.h index a03d77fd0d..d99f1e3e9e 100644 --- a/src/PlayerStageStats.h +++ b/src/PlayerStageStats.h @@ -107,7 +107,6 @@ class PlayerStageStats // workout float m_iNumControllerSteps; - float m_fCaloriesBurned; map m_fLifeRecord; void SetLifeRecordAt( float fLife, float fStepsSecond ); diff --git a/src/Profile.cpp b/src/Profile.cpp index 12e95aa3ab..d07df5b4b0 100644 --- a/src/Profile.cpp +++ b/src/Profile.cpp @@ -103,11 +103,6 @@ void Profile::InitEditableData() m_sDisplayName = ""; m_sCharacterID = ""; m_sLastUsedHighScoreName = ""; - m_iWeightPounds = 0; - m_Voomax= 0; - m_BirthYear= 0; - m_IgnoreStepCountCalories= false; - m_IsMale= true; } void Profile::ClearStats() @@ -143,10 +138,6 @@ void Profile::InitGeneralData() m_iTotalSessions = 0; m_iTotalSessionSeconds = 0; m_iTotalGameplaySeconds = 0; - m_fTotalCaloriesBurned = 0; - m_GoalType = (GoalType)0; - m_iGoalCalories = 0; - m_iGoalSeconds = 0; m_iTotalDancePoints = 0; m_iNumExtraStagesPassed = 0; m_iNumExtraStagesFailed = 0; @@ -200,11 +191,6 @@ void Profile::InitScreenshotData() m_vScreenshots.clear(); } -void Profile::InitCalorieData() -{ - m_mapDayToCaloriesBurned.clear(); -} - RString Profile::GetDisplayNameOrHighScoreName() const { if( !m_sDisplayName.empty() ) @@ -233,45 +219,6 @@ void Profile::SetCharacter(const RString &sCharacterID) m_sCharacterID = sCharacterID; } -static RString FormatCalories( float fCals ) -{ - return Commify((int)fCals) + " Cal"; -} - -int Profile::GetCalculatedWeightPounds() const -{ - if( m_iWeightPounds == 0 ) // weight not entered - return DEFAULT_WEIGHT_POUNDS; - else - return m_iWeightPounds; -} - -int Profile::GetAge() const -{ - if(m_BirthYear == 0) - { - return (GetLocalTime().tm_year+1900) - static_cast(DEFAULT_BIRTH_YEAR); - } - return (GetLocalTime().tm_year+1900) - m_BirthYear; -} - -RString Profile::GetDisplayTotalCaloriesBurned() const -{ - return FormatCalories( m_fTotalCaloriesBurned ); -} - -RString Profile::GetDisplayTotalCaloriesBurnedToday() const -{ - float fCals = GetCaloriesBurnedToday(); - return FormatCalories( fCals ); -} - -float Profile::GetCaloriesBurnedToday() const -{ - DateTime now = DateTime::GetNowDate(); - return GetCaloriesBurnedForDay(now); -} - int Profile::GetTotalNumSongsPassed() const { int iTotal = 0; @@ -825,7 +772,6 @@ void Profile::MergeScoresFromOtherProfile(Profile* other, bool skip_totals, MERGE_FIELD(m_iTotalSessions); MERGE_FIELD(m_iTotalSessionSeconds); MERGE_FIELD(m_iTotalGameplaySeconds); - MERGE_FIELD(m_fTotalCaloriesBurned); MERGE_FIELD(m_iTotalDancePoints); MERGE_FIELD(m_iNumExtraStagesPassed); MERGE_FIELD(m_iNumExtraStagesFailed); @@ -856,21 +802,6 @@ void Profile::MergeScoresFromOtherProfile(Profile* other, bool skip_totals, MERGE_FIELD(m_iNumStagesPassedByGrade[i]); } #undef MERGE_FIELD - for(map::iterator other_cal= - other->m_mapDayToCaloriesBurned.begin(); - other_cal != other->m_mapDayToCaloriesBurned.end(); ++other_cal) - { - map::iterator this_cal= - m_mapDayToCaloriesBurned.find(other_cal->first); - if(this_cal == m_mapDayToCaloriesBurned.end()) - { - m_mapDayToCaloriesBurned[other_cal->first]= other_cal->second; - } - else - { - this_cal->second.fCals+= other_cal->second.fCals; - } - } } #define MERGE_SCORES_IN_MEMBER(main_member, main_key_type, main_value_type, sub_member, sub_key_type, sub_value_type) \ for(std::map::iterator main_entry= \ @@ -956,20 +887,11 @@ void Profile::swap(Profile& other) SWAP_STR_MEMBER(m_sDisplayName); SWAP_STR_MEMBER(m_sCharacterID); SWAP_STR_MEMBER(m_sLastUsedHighScoreName); - SWAP_GENERAL(m_iWeightPounds); - SWAP_GENERAL(m_Voomax); - SWAP_GENERAL(m_BirthYear); - SWAP_GENERAL(m_IgnoreStepCountCalories); - SWAP_GENERAL(m_IsMale); SWAP_STR_MEMBER(m_sGuid); SWAP_GENERAL(m_iCurrentCombo); SWAP_GENERAL(m_iTotalSessions); SWAP_GENERAL(m_iTotalSessionSeconds); SWAP_GENERAL(m_iTotalGameplaySeconds); - SWAP_GENERAL(m_fTotalCaloriesBurned); - SWAP_GENERAL(m_GoalType); - SWAP_GENERAL(m_iGoalCalories); - SWAP_GENERAL(m_iGoalSeconds); SWAP_GENERAL(m_iTotalDancePoints); SWAP_GENERAL(m_iNumExtraStagesPassed); SWAP_GENERAL(m_iNumExtraStagesFailed); @@ -1000,7 +922,6 @@ void Profile::swap(Profile& other) SWAP_ARRAY(m_CategoryHighScores[st], NUM_RankingCategory); } SWAP_STR_MEMBER(m_vScreenshots); - SWAP_STR_MEMBER(m_mapDayToCaloriesBurned); #undef SWAP_STR_MEMBER #undef SWAP_GENERAL #undef SWAP_ARRAY @@ -1081,11 +1002,6 @@ void Profile::HandleStatsPrefixChange(RString dir, bool require_signature) RString display_name= m_sDisplayName; RString character_id= m_sCharacterID; RString last_high_score_name= m_sLastUsedHighScoreName; - int weight= m_iWeightPounds; - float voomax= m_Voomax; - int birth_year= m_BirthYear; - bool ignore_step_cal= m_IgnoreStepCountCalories; - bool male= m_IsMale; ProfileType type= m_Type; int priority= m_ListPriority; RString guid= m_sGuid; @@ -1099,7 +1015,6 @@ void Profile::HandleStatsPrefixChange(RString dir, bool require_signature) int total_sessions= m_iTotalSessions; int total_session_seconds= m_iTotalSessionSeconds; int total_gameplay_seconds= m_iTotalGameplaySeconds; - float total_calories_burned= m_fTotalCaloriesBurned; LuaTable user_table= m_UserTable; bool need_to_create_file= false; if(IsAFile(dir + PROFILEMAN->GetStatsPrefix() + STATS_XML)) @@ -1114,11 +1029,6 @@ void Profile::HandleStatsPrefixChange(RString dir, bool require_signature) m_sDisplayName= display_name; m_sCharacterID= character_id; m_sLastUsedHighScoreName= last_high_score_name; - m_iWeightPounds= weight; - m_Voomax= voomax; - m_BirthYear= birth_year; - m_IgnoreStepCountCalories= ignore_step_cal; - m_IsMale= male; m_Type= type; m_ListPriority= priority; m_sGuid= guid; @@ -1131,7 +1041,6 @@ void Profile::HandleStatsPrefixChange(RString dir, bool require_signature) m_iTotalSessions= total_sessions; m_iTotalSessionSeconds= total_session_seconds; m_iTotalGameplaySeconds= total_gameplay_seconds; - m_fTotalCaloriesBurned= total_calories_burned; m_UserTable= user_table; if(need_to_create_file) { @@ -1334,29 +1243,18 @@ ProfileLoadResult Profile::LoadStatsXmlFromNode( const XNode *xml, bool bIgnoreE RString sName = m_sDisplayName; RString sCharacterID = m_sCharacterID; RString sLastUsedHighScoreName = m_sLastUsedHighScoreName; - int iWeightPounds = m_iWeightPounds; - float Voomax= m_Voomax; - int BirthYear= m_BirthYear; - bool IgnoreStepCountCalories= m_IgnoreStepCountCalories; - bool IsMale= m_IsMale; LOAD_NODE( GeneralData ); LOAD_NODE( SongScores ); LOAD_NODE( CourseScores ); LOAD_NODE( CategoryScores ); LOAD_NODE( ScreenshotData ); - LOAD_NODE( CalorieData ); if( bIgnoreEditable ) { m_sDisplayName = sName; m_sCharacterID = sCharacterID; m_sLastUsedHighScoreName = sLastUsedHighScoreName; - m_iWeightPounds = iWeightPounds; - m_Voomax= Voomax; - m_BirthYear= BirthYear; - m_IgnoreStepCountCalories= IgnoreStepCountCalories; - m_IsMale= IsMale; } return ProfileLoadResult_Success; @@ -1436,7 +1334,6 @@ XNode *Profile::SaveStatsXmlCreateNode() const xml->AppendChild( SaveCourseScoresCreateNode() ); xml->AppendChild( SaveCategoryScoresCreateNode() ); xml->AppendChild( SaveScreenshotDataCreateNode() ); - xml->AppendChild( SaveCalorieDataCreateNode() ); if( SHOW_COIN_DATA.GetValue() && IsMachine() ) xml->AppendChild( SaveCoinDataCreateNode() ); @@ -1569,11 +1466,6 @@ void Profile::SaveEditableDataToDir( const RString &sDir ) const ini.SetValue( "Editable", "DisplayName", m_sDisplayName ); ini.SetValue( "Editable", "CharacterID", m_sCharacterID ); ini.SetValue( "Editable", "LastUsedHighScoreName", m_sLastUsedHighScoreName ); - ini.SetValue( "Editable", "WeightPounds", m_iWeightPounds ); - ini.SetValue( "Editable", "Voomax", m_Voomax ); - ini.SetValue( "Editable", "BirthYear", m_BirthYear ); - ini.SetValue( "Editable", "IgnoreStepCountCalories", m_IgnoreStepCountCalories ); - ini.SetValue( "Editable", "IsMale", m_IsMale ); ini.WriteFile( sDir + EDITABLE_INI ); } @@ -1588,11 +1480,6 @@ XNode* Profile::SaveGeneralDataCreateNode() const pGeneralDataNode->AppendChild( "DisplayName", GetDisplayNameOrHighScoreName() ); pGeneralDataNode->AppendChild( "CharacterID", m_sCharacterID ); pGeneralDataNode->AppendChild( "LastUsedHighScoreName", m_sLastUsedHighScoreName ); - pGeneralDataNode->AppendChild( "WeightPounds", m_iWeightPounds ); - pGeneralDataNode->AppendChild( "Voomax", m_Voomax ); - pGeneralDataNode->AppendChild( "BirthYear", m_BirthYear ); - pGeneralDataNode->AppendChild( "IgnoreStepCountCalories", m_IgnoreStepCountCalories ); - pGeneralDataNode->AppendChild( "IsMale", m_IsMale ); pGeneralDataNode->AppendChild( "IsMachine", IsMachine() ); @@ -1608,10 +1495,6 @@ XNode* Profile::SaveGeneralDataCreateNode() const pGeneralDataNode->AppendChild( "TotalSessions", m_iTotalSessions ); pGeneralDataNode->AppendChild( "TotalSessionSeconds", m_iTotalSessionSeconds ); pGeneralDataNode->AppendChild( "TotalGameplaySeconds", m_iTotalGameplaySeconds ); - pGeneralDataNode->AppendChild( "TotalCaloriesBurned", m_fTotalCaloriesBurned ); - pGeneralDataNode->AppendChild( "GoalType", m_GoalType ); - pGeneralDataNode->AppendChild( "GoalCalories", m_iGoalCalories ); - pGeneralDataNode->AppendChild( "GoalSeconds", m_iGoalSeconds ); pGeneralDataNode->AppendChild( "LastPlayedMachineGuid", m_sLastPlayedMachineGuid ); pGeneralDataNode->AppendChild( "LastPlayedDate", m_LastPlayedDate.GetString() ); pGeneralDataNode->AppendChild( "TotalDancePoints", m_iTotalDancePoints ); @@ -1769,11 +1652,6 @@ ProfileLoadResult Profile::LoadEditableDataFromDir( const RString &sDir ) ini.GetValue( "Editable", "DisplayName", m_sDisplayName ); ini.GetValue( "Editable", "CharacterID", m_sCharacterID ); ini.GetValue( "Editable", "LastUsedHighScoreName", m_sLastUsedHighScoreName ); - ini.GetValue( "Editable", "WeightPounds", m_iWeightPounds ); - ini.GetValue( "Editable", "Voomax", m_Voomax ); - ini.GetValue( "Editable", "BirthYear", m_BirthYear ); - ini.GetValue( "Editable", "IgnoreStepCountCalories", m_IgnoreStepCountCalories ); - ini.GetValue( "Editable", "IsMale", m_IsMale ); // This is data that the user can change, so we have to validate it. wstring wstr = RStringToWstring(m_sDisplayName); @@ -1781,8 +1659,6 @@ ProfileLoadResult Profile::LoadEditableDataFromDir( const RString &sDir ) wstr = wstr.substr(0, PROFILE_MAX_DISPLAY_NAME_LENGTH); m_sDisplayName = WStringToRString(wstr); // TODO: strip invalid chars? - if( m_iWeightPounds != 0 ) - CLAMP( m_iWeightPounds, 20, 1000 ); return ProfileLoadResult_Success; } @@ -1797,11 +1673,6 @@ void Profile::LoadGeneralDataFromNode( const XNode* pNode ) pNode->GetChildValue( "DisplayName", m_sDisplayName ); pNode->GetChildValue( "CharacterID", m_sCharacterID ); pNode->GetChildValue( "LastUsedHighScoreName", m_sLastUsedHighScoreName ); - pNode->GetChildValue( "WeightPounds", m_iWeightPounds ); - pNode->GetChildValue( "Voomax", m_Voomax ); - pNode->GetChildValue( "BirthYear", m_BirthYear ); - pNode->GetChildValue( "IgnoreStepCountCalories", m_IgnoreStepCountCalories ); - pNode->GetChildValue( "IsMale", m_IsMale ); pNode->GetChildValue( "Guid", m_sGuid ); pNode->GetChildValue( "SortOrder", s ); m_SortOrder = StringToSortOrder( s ); pNode->GetChildValue( "LastDifficulty", s ); m_LastDifficulty = StringToDifficulty( s ); @@ -1813,10 +1684,6 @@ void Profile::LoadGeneralDataFromNode( const XNode* pNode ) pNode->GetChildValue( "TotalSessions", m_iTotalSessions ); pNode->GetChildValue( "TotalSessionSeconds", m_iTotalSessionSeconds ); pNode->GetChildValue( "TotalGameplaySeconds", m_iTotalGameplaySeconds ); - pNode->GetChildValue( "TotalCaloriesBurned", m_fTotalCaloriesBurned ); - pNode->GetChildValue( "GoalType", *ConvertValue(&m_GoalType) ); - pNode->GetChildValue( "GoalCalories", m_iGoalCalories ); - pNode->GetChildValue( "GoalSeconds", m_iGoalSeconds ); pNode->GetChildValue( "LastPlayedMachineGuid", m_sLastPlayedMachineGuid ); pNode->GetChildValue( "LastPlayedDate", s ); m_LastPlayedDate.FromString( s ); pNode->GetChildValue( "TotalDancePoints", m_iTotalDancePoints ); @@ -1970,7 +1837,7 @@ void Profile::LoadGeneralDataFromNode( const XNode* pNode ) } -void Profile::AddStepTotals( int iTotalTapsAndHolds, int iTotalJumps, int iTotalHolds, int iTotalRolls, int iTotalMines, int iTotalHands, int iTotalLifts, float fCaloriesBurned ) +void Profile::AddStepTotals( int iTotalTapsAndHolds, int iTotalJumps, int iTotalHolds, int iTotalRolls, int iTotalMines, int iTotalHands, int iTotalLifts) { m_iTotalTapsAndHolds += iTotalTapsAndHolds; m_iTotalJumps += iTotalJumps; @@ -1979,96 +1846,8 @@ void Profile::AddStepTotals( int iTotalTapsAndHolds, int iTotalJumps, int iTotal m_iTotalMines += iTotalMines; m_iTotalHands += iTotalHands; m_iTotalLifts += iTotalLifts; - - if(!m_IgnoreStepCountCalories) - { - m_fTotalCaloriesBurned += fCaloriesBurned; - DateTime date = DateTime::GetNowDate(); - m_mapDayToCaloriesBurned[date].fCals += fCaloriesBurned; - } -} - -// It's a bit unclean to have this flag for routing around the old step count -// based calorie calculation, but I can't think of a better way to do it. -// AddStepTotals is called (through a couple layers) by CommitStageStats at -// the end of ScreenGameplay, so it can't be moved to somewhere else. The -// player can't put in their heart rate for calculation until after -// ScreenGameplay -void Profile::AddCaloriesToDailyTotal(float cals) -{ - m_fTotalCaloriesBurned += cals; - DateTime date = DateTime::GetNowDate(); - m_mapDayToCaloriesBurned[date].fCals += cals; } -float Profile::CalculateCaloriesFromHeartRate(float HeartRate, float Duration) -{ - // Copied from http://www.shapesense.com/fitness-exercise/calculators/heart-rate-based-calorie-burn-calculator.aspx - /* - Male: ((-55.0969 + (0.6309 x HR) + (0.1988 x W) + (0.2017 x A))/4.184) x T - Female: ((-20.4022 + (0.4472 x HR) - (0.1263 x W) + (0.074 x A))/4.184) x T - where - - HR = Heart rate (in beats/minute) - W = Weight (in kilograms) - A = Age (in years) - T = Exercise duration time (in minutes) - - Equations for Determination of Calorie Burn if VO2max is Known - - Male: ((-95.7735 + (0.634 x HR) + (0.404 x VO2max) + (0.394 x W) + (0.271 x A))/4.184) x T - Female: ((-59.3954 + (0.45 x HR) + (0.380 x VO2max) + (0.103 x W) + (0.274 x A))/4.184) x T - where - - HR = Heart rate (in beats/minute) - VO2max = Maximal oxygen consumption (in mL•kg-1•min-1) - W = Weight (in kilograms) - A = Age (in years) - T = Exercise duration time (in minutes) - */ - // Duration passed in is in seconds. Convert it to minutes to make the code - // match the equations from the website. - Duration= Duration / 60.f; - float kilos= GetCalculatedWeightPounds() / 2.205f; - float age= static_cast(GetAge()); - - // Names for the constants in the equations. - // Assumes male and unknown voomax. - float gender_factor= -55.0969f; - float heart_factor= 0.6309f; - float voo_factor= 0.0f; - float weight_factor= 0.1988f; - float age_factor= 0.2017f; - if(m_Voomax > 0) - { - if(m_IsMale) - { - gender_factor= -95.7735f; - heart_factor= 0.634f; - voo_factor= 0.404f; - weight_factor= 0.394f; - age_factor= 0.271f; - } - else - { - gender_factor= -59.3954f; - heart_factor= 0.45f; - voo_factor= 0.380f; - weight_factor= 0.103f; - age_factor= 0.274f; - } - } - else if(!m_IsMale) - { - gender_factor= -20.4022f; - heart_factor= 0.6309f; - weight_factor= 0.1988f; - age_factor= 0.2017f; - } - return ((gender_factor + (heart_factor * HeartRate) + - (voo_factor * m_Voomax) + (weight_factor * kilos) + (age_factor + age)) - / 4.184f) * Duration; -} XNode* Profile::SaveSongScoresCreateNode() const { @@ -2704,60 +2483,6 @@ XNode* Profile::SaveScreenshotDataCreateNode() const return pNode; } -void Profile::LoadCalorieDataFromNode( const XNode* pCalorieData ) -{ - CHECKPOINT_M("Loading the node containing calorie data."); - - ASSERT( pCalorieData->GetName() == "CalorieData" ); - FOREACH_CONST_Child( pCalorieData, pCaloriesBurned ) - { - if( pCaloriesBurned->GetName() != "CaloriesBurned" ) - WARN_AND_CONTINUE_M( pCaloriesBurned->GetName() ); - - RString sDate; - if( !pCaloriesBurned->GetAttrValue("Date",sDate) ) - WARN_AND_CONTINUE; - DateTime date; - if( !date.FromString(sDate) ) - WARN_AND_CONTINUE_M( sDate ); - - float fCaloriesBurned = 0; - - pCaloriesBurned->GetTextValue(fCaloriesBurned); - - m_mapDayToCaloriesBurned[date].fCals = fCaloriesBurned; - } -} - -XNode* Profile::SaveCalorieDataCreateNode() const -{ - CHECKPOINT_M("Getting the node containing calorie data."); - - const Profile* pProfile = this; - ASSERT( pProfile != NULL ); - - XNode* pNode = new XNode( "CalorieData" ); - - FOREACHM_CONST( DateTime, Calories, m_mapDayToCaloriesBurned, i ) - { - XNode* pCaloriesBurned = pNode->AppendChild( "CaloriesBurned", i->second.fCals ); - - pCaloriesBurned->AppendAttr( "Date", i->first.GetString() ); - } - - return pNode; -} - -float Profile::GetCaloriesBurnedForDay( DateTime day ) const -{ - day.StripTime(); - map::const_iterator i = m_mapDayToCaloriesBurned.find( day ); - if( i == m_mapDayToCaloriesBurned.end() ) - return 0; - else - return i->second.fCals; -} - const Profile::HighScoresForASong *Profile::GetHighScoresForASong( const SongID& songID ) const { map::const_iterator it; @@ -3025,46 +2750,6 @@ class LunaProfile : public Luna static int GetCharacter(T* p, lua_State *L) { p->GetCharacter()->PushSelf(L); return 1; } static int SetCharacter(T* p, lua_State *L) { p->SetCharacter(SArg(1)); COMMON_RETURN_SELF; } - static int GetWeightPounds(T* p, lua_State *L) { lua_pushnumber(L, p->m_iWeightPounds); return 1; } - static int SetWeightPounds(T* p, lua_State *L) { p->m_iWeightPounds = IArg(1); COMMON_RETURN_SELF; } - DEFINE_METHOD(GetVoomax, m_Voomax); - DEFINE_METHOD(GetAge, GetAge()); - DEFINE_METHOD(GetBirthYear, m_BirthYear); - DEFINE_METHOD(GetIgnoreStepCountCalories, m_IgnoreStepCountCalories); - DEFINE_METHOD(GetIsMale, m_IsMale); - static int SetVoomax(T* p, lua_State *L) - { - p->m_Voomax = FArg(1); - COMMON_RETURN_SELF; - } - static int SetBirthYear(T* p, lua_State *L) - { - p->m_BirthYear = IArg(1); - COMMON_RETURN_SELF; - } - static int SetIgnoreStepCountCalories(T* p, lua_State *L) - { - p->m_IgnoreStepCountCalories = BArg(1); - COMMON_RETURN_SELF; - } - static int SetIsMale(T* p, lua_State *L) - { - p->m_IsMale = BArg(1); - COMMON_RETURN_SELF; - } - static int AddCaloriesToDailyTotal(T* p, lua_State *L) - { - p->AddCaloriesToDailyTotal(FArg(1)); - COMMON_RETURN_SELF; - } - DEFINE_METHOD(CalculateCaloriesFromHeartRate, CalculateCaloriesFromHeartRate(FArg(1), FArg(2))); - static int GetGoalType(T* p, lua_State *L) { lua_pushnumber(L, p->m_GoalType); return 1; } - static int SetGoalType(T* p, lua_State *L) { p->m_GoalType = Enum::Check(L, 1); COMMON_RETURN_SELF; } - static int GetGoalCalories(T* p, lua_State *L) { lua_pushnumber(L, p->m_iGoalCalories); return 1; } - static int SetGoalCalories(T* p, lua_State *L) { p->m_iGoalCalories = IArg(1); COMMON_RETURN_SELF; } - static int GetGoalSeconds(T* p, lua_State *L) { lua_pushnumber(L, p->m_iGoalSeconds); return 1; } - static int SetGoalSeconds(T* p, lua_State *L) { p->m_iGoalSeconds = IArg(1); COMMON_RETURN_SELF; } - static int GetCaloriesBurnedToday(T* p, lua_State *L) { lua_pushnumber(L, p->GetCaloriesBurnedToday()); return 1; } static int GetTotalNumSongsPlayed(T* p, lua_State *L) { lua_pushnumber(L, p->m_iNumTotalSongsPlayed); return 1; } static int IsCodeUnlocked(T* p, lua_State *L) { lua_pushboolean(L, p->IsCodeUnlocked(SArg(1))); return 1; } static int GetSongsActual(T* p, lua_State *L) { lua_pushnumber(L, p->GetSongsActual(Enum::Check(L, 1), Enum::Check(L, 2))); return 1; } @@ -3080,8 +2765,6 @@ class LunaProfile : public Luna static int GetTotalSessionSeconds(T* p, lua_State *L) { lua_pushnumber(L, p->m_iTotalSessionSeconds); return 1; } static int GetTotalGameplaySeconds(T* p, lua_State *L) { lua_pushnumber(L, p->m_iTotalGameplaySeconds); return 1; } static int GetSongsAndCoursesPercentCompleteAllDifficulties(T* p, lua_State *L) { lua_pushnumber(L, p->GetSongsAndCoursesPercentCompleteAllDifficulties(Enum::Check(L, 1))); return 1; } - static int GetTotalCaloriesBurned(T* p, lua_State *L) { lua_pushnumber(L, p->m_fTotalCaloriesBurned); return 1; } - static int GetDisplayTotalCaloriesBurned(T* p, lua_State *L) { lua_pushstring(L, p->GetDisplayTotalCaloriesBurned()); return 1; } static int GetPlayerRating(T* p, lua_State *L) { lua_pushnumber(L, p->m_fPlayerRating); return 1; } static int GetMostPopularSong(T* p, lua_State *L) { @@ -3198,26 +2881,6 @@ class LunaProfile : public Luna ADD_METHOD( GetCategoryHighScoreList ); ADD_METHOD( GetCharacter ); ADD_METHOD( SetCharacter ); - ADD_METHOD( GetWeightPounds ); - ADD_METHOD( SetWeightPounds ); - ADD_METHOD( GetVoomax ); - ADD_METHOD( SetVoomax ); - ADD_METHOD( GetAge ); - ADD_METHOD( GetBirthYear ); - ADD_METHOD( SetBirthYear ); - ADD_METHOD( GetIgnoreStepCountCalories ); - ADD_METHOD( SetIgnoreStepCountCalories ); - ADD_METHOD( GetIsMale ); - ADD_METHOD( SetIsMale ); - ADD_METHOD( AddCaloriesToDailyTotal ); - ADD_METHOD( CalculateCaloriesFromHeartRate ); - ADD_METHOD( GetGoalType ); - ADD_METHOD( SetGoalType ); - ADD_METHOD( GetGoalCalories ); - ADD_METHOD( SetGoalCalories ); - ADD_METHOD( GetGoalSeconds ); - ADD_METHOD( SetGoalSeconds ); - ADD_METHOD( GetCaloriesBurnedToday ); ADD_METHOD( GetTotalNumSongsPlayed ); ADD_METHOD( IsCodeUnlocked ); ADD_METHOD( GetSongsActual ); @@ -3233,8 +2896,6 @@ class LunaProfile : public Luna ADD_METHOD( GetTotalSessionSeconds ); ADD_METHOD( GetTotalGameplaySeconds ); ADD_METHOD( GetSongsAndCoursesPercentCompleteAllDifficulties ); - ADD_METHOD( GetTotalCaloriesBurned ); - ADD_METHOD( GetDisplayTotalCaloriesBurned ); ADD_METHOD( GetMostPopularSong ); ADD_METHOD( GetMostPopularCourse ); ADD_METHOD( GetSongNumTimesPlayed ); diff --git a/src/Profile.h b/src/Profile.h index cb52a85819..49b17cafb5 100644 --- a/src/Profile.h +++ b/src/Profile.h @@ -124,9 +124,7 @@ class Profile Profile(): m_Type(ProfileType_Normal), m_ListPriority(0), m_sDisplayName(""), m_sCharacterID(""), - m_sLastUsedHighScoreName(""), m_iWeightPounds(0), - m_Voomax(0), m_BirthYear(0), m_IgnoreStepCountCalories(false), - m_IsMale(true), + m_sLastUsedHighScoreName(""), m_sGuid(MakeGuid()), m_sDefaultModifiers(), m_SortOrder(SortOrder_Invalid), m_LastDifficulty(Difficulty_Invalid), @@ -134,8 +132,7 @@ class Profile m_LastStepsType(StepsType_Invalid), m_lastSong(), m_lastCourse(), m_iCurrentCombo(0), m_iTotalSessions(0), m_iTotalSessionSeconds(0), m_iTotalGameplaySeconds(0), - m_fTotalCaloriesBurned(0), m_GoalType(GoalType_Calories), - m_iGoalCalories(0), m_iGoalSeconds(0), m_iTotalDancePoints(0), + m_iTotalDancePoints(0), m_iNumExtraStagesPassed(0), m_iNumExtraStagesFailed(0), m_iNumToasties(0), m_iTotalTapsAndHolds(0), m_iTotalJumps(0), m_iTotalHolds(0), m_iTotalRolls(0), m_iTotalMines(0), @@ -143,8 +140,8 @@ class Profile m_UnlockedEntryIDs(), m_sLastPlayedMachineGuid(""), m_LastPlayedDate(),m_iNumSongsPlayedByStyle(), m_iNumTotalSongsPlayed(0), m_UserTable(), m_SongHighScores(), - m_CourseHighScores(), m_vScreenshots(), - m_mapDayToCaloriesBurned(), profiledir(""),IsEtternaProfile(false) + m_CourseHighScores(), m_vScreenshots(), + profiledir(""), IsEtternaProfile(false) { m_lastSong.Unset(); m_lastCourse.Unset(); @@ -171,11 +168,6 @@ class Profile RString GetDisplayNameOrHighScoreName() const; Character *GetCharacter() const; void SetCharacter(const RString &sCharacterID); - RString GetDisplayTotalCaloriesBurned() const; // remove me and use Lua instead - RString GetDisplayTotalCaloriesBurnedToday() const; // remove me and use Lua instead - int GetCalculatedWeightPounds() const; // returns a default value if m_iWeightPounds isn't set - int GetAge() const; // returns a default value if m_Age isn't set - float GetCaloriesBurnedToday() const; int GetTotalNumSongsPassed() const; int GetTotalStepsWithTopGrade( StepsType st, Difficulty d, Grade g ) const; int GetTotalTrailsWithTopGrade( StepsType st, CourseDifficulty d, Grade g ) const; @@ -193,9 +185,7 @@ class Profile Course *GetMostPopularCourse() const; void AddStepTotals( int iNumTapsAndHolds, int iNumJumps, int iNumHolds, int iNumRolls, int iNumMines, - int iNumHands, int iNumLifts, float fCaloriesBurned ); - void AddCaloriesToDailyTotal(float cals); - float CalculateCaloriesFromHeartRate(float HeartRate, float Duration); + int iNumHands, int iNumLifts ); bool IsMachine() const; @@ -212,16 +202,6 @@ class Profile * This really shouldn't be in "editable", but it's needed in the smaller editable file * so that it can be ready quickly. */ RString m_sLastUsedHighScoreName; - int m_iWeightPounds; // 0 == not set - // Voomax and BirthYear are used for calculating calories from heart rate. - float m_Voomax; // 0 == not set - int m_BirthYear; // 0 == not set - // m_IgnoreStepCountCalories is so that the step count based calorie - // counter can be ignored in favor of calculating calories from heart rate - // and voomax. - bool m_IgnoreStepCountCalories; - bool m_IsMale; // Used solely for calculating calories from heart rate. - //RString m_sProfileImageName; // todo: add a default image -aj // General data static RString MakeGuid(); @@ -238,10 +218,6 @@ class Profile int m_iTotalSessions; int m_iTotalSessionSeconds; int m_iTotalGameplaySeconds; - float m_fTotalCaloriesBurned; - GoalType m_GoalType; - int m_iGoalCalories; - int m_iGoalSeconds; int m_iTotalDancePoints; int m_iNumExtraStagesPassed; int m_iNumExtraStagesFailed; @@ -379,24 +355,6 @@ class Profile void AddScreenshot( const Screenshot &screenshot ); int GetNextScreenshotIndex() { return m_vScreenshots.size(); } - - /** - * @brief The basics for Calorie Data. - * - * Why track calories in a map, and not in a static sized array like - * Bookkeeping? The machine's clock is not guaranteed to be set correctly. - * If calorie array is in a static sized array, playing on a machine with - * a mis-set clock could wipe out all your past data. With this scheme, - * the worst that could happen is that playing on a mis-set machine will - * insert some garbage entries into the map. */ - struct Calories - { - Calories(): fCals(0) {} - float fCals; - }; - map m_mapDayToCaloriesBurned; - float GetCaloriesBurnedForDay( DateTime day ) const; - // Init'ing void InitAll() { @@ -406,7 +364,6 @@ class Profile InitCourseScores(); InitCategoryScores(); InitScreenshotData(); - InitCalorieData(); } void InitEditableData(); void InitGeneralData(); @@ -414,7 +371,6 @@ class Profile void InitCourseScores(); void InitCategoryScores(); void InitScreenshotData(); - void InitCalorieData(); void ClearStats(); void swap(Profile& other); @@ -435,7 +391,6 @@ class Profile void LoadCourseScoresFromNode( const XNode* pNode ); void LoadCategoryScoresFromNode( const XNode* pNode ); void LoadScreenshotDataFromNode( const XNode* pNode ); - void LoadCalorieDataFromNode( const XNode* pNode ); void SaveTypeToDir(const RString &dir) const; void SaveEditableDataToDir( const RString &sDir ) const; @@ -449,7 +404,6 @@ class Profile XNode* SaveCourseScoresCreateNode() const; XNode* SaveCategoryScoresCreateNode() const; XNode* SaveScreenshotDataCreateNode() const; - XNode* SaveCalorieDataCreateNode() const; XNode* SaveCoinDataCreateNode() const; diff --git a/src/ProfileManager.cpp b/src/ProfileManager.cpp index 3c46a793f2..03886af82b 100644 --- a/src/ProfileManager.cpp +++ b/src/ProfileManager.cpp @@ -844,11 +844,11 @@ void ProfileManager::IncrementToastiesCount( PlayerNumber pn ) ++GetMachineProfile()->m_iNumToasties; } -void ProfileManager::AddStepTotals( PlayerNumber pn, int iNumTapsAndHolds, int iNumJumps, int iNumHolds, int iNumRolls, int iNumMines, int iNumHands, int iNumLifts, float fCaloriesBurned ) +void ProfileManager::AddStepTotals( PlayerNumber pn, int iNumTapsAndHolds, int iNumJumps, int iNumHolds, int iNumRolls, int iNumMines, int iNumHands, int iNumLifts) { if( IsPersistentProfile(pn) ) - GetProfile(pn)->AddStepTotals( iNumTapsAndHolds, iNumJumps, iNumHolds, iNumRolls, iNumMines, iNumHands, iNumLifts, fCaloriesBurned ); - GetMachineProfile()->AddStepTotals( iNumTapsAndHolds, iNumJumps, iNumHolds, iNumRolls, iNumMines, iNumHands, iNumLifts, fCaloriesBurned ); + GetProfile(pn)->AddStepTotals( iNumTapsAndHolds, iNumJumps, iNumHolds, iNumRolls, iNumMines, iNumHands, iNumLifts); + GetMachineProfile()->AddStepTotals( iNumTapsAndHolds, iNumJumps, iNumHolds, iNumRolls, iNumMines, iNumHands, iNumLifts); } // diff --git a/src/ProfileManager.h b/src/ProfileManager.h index a3f0de4da2..90d0016231 100644 --- a/src/ProfileManager.h +++ b/src/ProfileManager.h @@ -62,7 +62,7 @@ class ProfileManager // General data void IncrementToastiesCount( PlayerNumber pn ); - void AddStepTotals( PlayerNumber pn, int iNumTapsAndHolds, int iNumJumps, int iNumHolds, int iNumRolls, int iNumMines, int iNumHands, int iNumLifts, float fCaloriesBurned ); + void AddStepTotals( PlayerNumber pn, int iNumTapsAndHolds, int iNumJumps, int iNumHolds, int iNumRolls, int iNumMines, int iNumHands, int iNumLifts); // High scores void LoadMachineProfile(); // including edits diff --git a/src/ScoreDisplayCalories.cpp b/src/ScoreDisplayCalories.cpp index 3d59272068..07cf6a4e4c 100644 --- a/src/ScoreDisplayCalories.cpp +++ b/src/ScoreDisplayCalories.cpp @@ -1,111 +1 @@ -#include "global.h" -#include "ScoreDisplayCalories.h" -#include "MessageManager.h" -#include "PlayerNumber.h" -#include "PlayerState.h" -#include "RageUtil.h" -#include "StageStats.h" -#include "XmlFile.h" -#include "ActorUtil.h" -#include "StatsManager.h" -#include "LuaManager.h" - -REGISTER_ACTOR_CLASS( ScoreDisplayCalories ); - -ScoreDisplayCalories::ScoreDisplayCalories() -{ -} - -ScoreDisplayCalories::~ScoreDisplayCalories() -{ - if( m_sMessageOnStep != "" ) - MESSAGEMAN->Unsubscribe( this, m_sMessageOnStep ); -} - -void ScoreDisplayCalories::LoadFromNode( const XNode* pNode ) -{ - RollingNumbers::LoadFromNode( pNode ); - - { - Lua *L = LUA->Get(); - bool b = pNode->PushAttrValue( L, "PlayerNumber" ); - ASSERT( b ); - LuaHelpers::Pop( L, m_PlayerNumber ); - LUA->Release( L ); - } - - MESSAGEMAN->Subscribe( this, "Step" ); -} - -void ScoreDisplayCalories::Update( float fDelta ) -{ - // We have to set the initial text after StatsManager::CalcAccumPlayedStageStats - // is called. - if( IsFirstUpdate() ) - UpdateNumber(); - - RollingNumbers::Update( fDelta ); -} - -void ScoreDisplayCalories::HandleMessage( const Message &msg ) -{ - if( msg.GetName() == "Step" ) - { - PlayerNumber pn; - msg.GetParam( "PlayerNumber", pn ); - if( pn == m_PlayerNumber ) - UpdateNumber(); - } - - RollingNumbers::HandleMessage( msg ); -} - -void ScoreDisplayCalories::UpdateNumber() -{ - float fCals = - STATSMAN->GetAccumPlayedStageStats().m_player[m_PlayerNumber].m_fCaloriesBurned + - STATSMAN->m_CurStageStats.m_player[m_PlayerNumber].m_fCaloriesBurned; - - SetTargetNumber( fCals ); -} - -// lua start -#include "LuaBinding.h" - -/** @brief Allow Lua to have access to the ScoreDisplayCalories. */ -class LunaScoreDisplayCalories: public Luna -{ -public: - LunaScoreDisplayCalories() - { - } -}; - -LUA_REGISTER_DERIVED_CLASS( ScoreDisplayCalories, BitmapText ) - -// lua end - -/* - * (c) 2001-2004 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +//hahahahahaha \ No newline at end of file diff --git a/src/ScoreDisplayCalories.h b/src/ScoreDisplayCalories.h index 8e0836cce9..920a430e40 100644 --- a/src/ScoreDisplayCalories.h +++ b/src/ScoreDisplayCalories.h @@ -1,56 +1 @@ -#ifndef ScoreDisplayCalories_H -#define ScoreDisplayCalories_H - -#include "RollingNumbers.h" -#include "PlayerNumber.h" - -/** @brief Shows calorie score during gameplay and some menus. */ -class ScoreDisplayCalories : public RollingNumbers -{ -public: - ScoreDisplayCalories(); - ~ScoreDisplayCalories(); - - virtual void Update( float fDelta ); - - void LoadFromNode( const XNode* pNode ); - virtual ScoreDisplayCalories *Copy() const; - - virtual void HandleMessage( const Message &msg ); - - void UpdateNumber(); - - // Lua - virtual void PushSelf( lua_State *L ); - -private: - PlayerNumber m_PlayerNumber; - RString m_sMessageOnStep; -}; - -#endif - -/* - * (c) 2001-2004 Chris Danford - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, and/or sell copies of the Software, and to permit persons to - * whom the Software is furnished to do so, provided that the above - * copyright notice(s) and this permission notice appear in all copies of - * the Software and that both the above copyright notice(s) and this - * permission notice appear in supporting documentation. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF - * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS - * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR - * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ +// hahahaha bye \ No newline at end of file diff --git a/src/ScreenGameplay.cpp b/src/ScreenGameplay.cpp index 436510b7cf..21131e3bc3 100644 --- a/src/ScreenGameplay.cpp +++ b/src/ScreenGameplay.cpp @@ -1051,11 +1051,6 @@ ScreenGameplay::~ScreenGameplay() bool ScreenGameplay::IsLastSong() { - if( GAMESTATE->m_pCurCourse ) - { - if( GAMESTATE->m_pCurCourse->m_fGoalSeconds > 0 && GAMESTATE->m_bWorkoutGoalComplete ) - return true; - } if( GAMESTATE->m_pCurCourse && GAMESTATE->m_pCurCourse->m_bRepeat ) return false; return GAMESTATE->GetCourseSongIndex() >= (int)m_apSongsQueue.size()-1; // GetCourseSongIndex() is 0-based diff --git a/src/ScreenOptionsEditCourse.cpp b/src/ScreenOptionsEditCourse.cpp index 599f4a88f3..6afdf62bef 100644 --- a/src/ScreenOptionsEditCourse.cpp +++ b/src/ScreenOptionsEditCourse.cpp @@ -262,7 +262,6 @@ void ScreenOptionsEditCourse::ImportOptions( int iRow, const vector(GAMESTATE->m_pCurCourse->m_fGoalSeconds)/60) ); break; default: { @@ -308,10 +307,6 @@ void ScreenOptionsEditCourse::ExportOptions( int iRow, const vectorm_pCurCourse->m_fGoalSeconds = 0; - int mins; - if( sscanf( sValue, "%d", &mins ) == 1 ) - GAMESTATE->m_pCurCourse->m_fGoalSeconds = mins * 60; break; } } diff --git a/src/StatsManager.cpp b/src/StatsManager.cpp index 947f25cd49..a2564442f8 100644 --- a/src/StatsManager.cpp +++ b/src/StatsManager.cpp @@ -202,8 +202,7 @@ void StatsManager::CommitStatsToProfiles( const StageStats *pSS ) int iNumMines = (int) pSS->m_player[pn].m_radarActual[RadarCategory_Mines]; int iNumHands = (int) pSS->m_player[pn].m_radarActual[RadarCategory_Hands]; int iNumLifts = (int) pSS->m_player[pn].m_radarActual[RadarCategory_Lifts]; - float fCaloriesBurned = pSS->m_player[pn].m_fCaloriesBurned; - PROFILEMAN->AddStepTotals( pn, iNumTapsAndHolds, iNumJumps, iNumHolds, iNumRolls, iNumMines, iNumHands, iNumLifts, fCaloriesBurned ); + PROFILEMAN->AddStepTotals( pn, iNumTapsAndHolds, iNumJumps, iNumHolds, iNumRolls, iNumMines, iNumHands, iNumLifts ); } // Update profile stats