use DEFAULT_WEIGHT_POUNDS if weight not explicitly set
This commit is contained in:
+25
-29
@@ -806,37 +806,33 @@ void Player::HandleStep( int col, const RageTimer &tm, bool bHeld )
|
|||||||
Profile* pProfile = PROFILEMAN->GetProfile(pn);
|
Profile* pProfile = PROFILEMAN->GetProfile(pn);
|
||||||
if( pProfile )
|
if( pProfile )
|
||||||
{
|
{
|
||||||
int iLbs = pProfile->m_iWeightPounds;
|
int iNumTracksHeld = 0;
|
||||||
if( iLbs != 0 )
|
for( int t=0; t<m_NoteData.GetNumTracks(); t++ )
|
||||||
{
|
{
|
||||||
int iNumTracksHeld = 0;
|
const StyleInput StyleI( pn, t );
|
||||||
for( int t=0; t<m_NoteData.GetNumTracks(); t++ )
|
const GameInput GameI = GAMESTATE->GetCurrentStyle()->StyleInputToGameInput( StyleI );
|
||||||
{
|
float fSecsHeld = INPUTMAPPER->GetSecsHeld( GameI );
|
||||||
const StyleInput StyleI( pn, t );
|
if( fSecsHeld > 0 )
|
||||||
const GameInput GameI = GAMESTATE->GetCurrentStyle()->StyleInputToGameInput( StyleI );
|
iNumTracksHeld++;
|
||||||
float fSecsHeld = INPUTMAPPER->GetSecsHeld( GameI );
|
|
||||||
if( fSecsHeld > 0 )
|
|
||||||
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.029f, 0.193f );
|
|
||||||
float fCalsFor200Lbs = SCALE( iNumTracksHeld, 1, 2, 0.052f, 0.334f );
|
|
||||||
fCals = SCALE( iLbs, 100.f, 200.f, fCalsFor100Lbs, fCalsFor200Lbs );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_pPlayerStageStats->fCaloriesBurned += fCals;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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.029f, 0.193f );
|
||||||
|
float fCalsFor200Lbs = SCALE( iNumTracksHeld, 1, 2, 0.052f, 0.334f );
|
||||||
|
fCals = SCALE( pProfile->GetCalculatedWeightPounds(), 100.f, 200.f, fCalsFor100Lbs, fCalsFor200Lbs );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_pPlayerStageStats->fCaloriesBurned += fCals;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+29
-43
@@ -46,7 +46,8 @@ const CString LASTGOOD_SUBDIR = "LastGood/";
|
|||||||
* 10 /* HighScores per Steps */ \
|
* 10 /* HighScores per Steps */ \
|
||||||
* 1024 /* size in bytes of a HighScores XNode */
|
* 1024 /* size in bytes of a HighScores XNode */
|
||||||
|
|
||||||
#define MAX_DISPLAY_NAME_LENGTH 12
|
const int MAX_DISPLAY_NAME_LENGTH = 12;
|
||||||
|
const int DEFAULT_WEIGHT_POUNDS = 120;
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#pragma warning (disable : 4706) // assignment within conditional expression
|
#pragma warning (disable : 4706) // assignment within conditional expression
|
||||||
@@ -103,10 +104,10 @@ void Profile::InitGeneralData()
|
|||||||
m_iTotalMines = 0;
|
m_iTotalMines = 0;
|
||||||
m_iTotalHands = 0;
|
m_iTotalHands = 0;
|
||||||
|
|
||||||
for( int i=0; i<NUM_PLAY_MODES; i++ )
|
FOREACH_PlayMode( i )
|
||||||
m_iNumSongsPlayedByPlayMode[i] = 0;
|
m_iNumSongsPlayedByPlayMode[i] = 0;
|
||||||
m_iNumSongsPlayedByStyle.clear();
|
m_iNumSongsPlayedByStyle.clear();
|
||||||
for( int i=0; i<NUM_DIFFICULTIES; i++ )
|
FOREACH_Difficulty( i )
|
||||||
m_iNumSongsPlayedByDifficulty[i] = 0;
|
m_iNumSongsPlayedByDifficulty[i] = 0;
|
||||||
for( int i=0; i<MAX_METER+1; i++ )
|
for( int i=0; i<MAX_METER+1; i++ )
|
||||||
m_iNumSongsPlayedByMeter[i] = 0;
|
m_iNumSongsPlayedByMeter[i] = 0;
|
||||||
@@ -170,21 +171,23 @@ static CString FormatCalories( float fCals )
|
|||||||
return Commify((int)fCals) + " Cal";
|
return Commify((int)fCals) + " Cal";
|
||||||
}
|
}
|
||||||
|
|
||||||
CString Profile::GetDisplayTotalCaloriesBurned() const
|
int Profile::GetCalculatedWeightPounds() const
|
||||||
{
|
{
|
||||||
if( m_iWeightPounds == 0 ) // weight not entered
|
if( m_iWeightPounds == 0 ) // weight not entered
|
||||||
return "N/A";
|
return DEFAULT_WEIGHT_POUNDS;
|
||||||
else
|
else
|
||||||
return FormatCalories( m_fTotalCaloriesBurned );
|
return m_iWeightPounds;
|
||||||
|
}
|
||||||
|
|
||||||
|
CString Profile::GetDisplayTotalCaloriesBurned() const
|
||||||
|
{
|
||||||
|
return FormatCalories( m_fTotalCaloriesBurned );
|
||||||
}
|
}
|
||||||
|
|
||||||
CString Profile::GetDisplayTotalCaloriesBurnedToday() const
|
CString Profile::GetDisplayTotalCaloriesBurnedToday() const
|
||||||
{
|
{
|
||||||
float fCals = GetCaloriesBurnedToday();
|
float fCals = GetCaloriesBurnedToday();
|
||||||
if( m_iWeightPounds == 0 ) // weight not entered
|
return FormatCalories( fCals );
|
||||||
return "N/A";
|
|
||||||
else
|
|
||||||
return FormatCalories( fCals );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float Profile::GetCaloriesBurnedToday() const
|
float Profile::GetCaloriesBurnedToday() const
|
||||||
@@ -297,9 +300,7 @@ float Profile::GetSongsActual( StepsType st, Difficulty dc ) const
|
|||||||
float fTotalPercents = 0;
|
float fTotalPercents = 0;
|
||||||
|
|
||||||
// add steps high scores
|
// add steps high scores
|
||||||
for( map<SongID,HighScoresForASong>::const_iterator i = m_SongHighScores.begin();
|
FOREACHM_CONST( SongID, HighScoresForASong, m_SongHighScores, i )
|
||||||
i != m_SongHighScores.end();
|
|
||||||
++i )
|
|
||||||
{
|
{
|
||||||
const SongID &id = i->first;
|
const SongID &id = i->first;
|
||||||
Song* pSong = id.ToSong();
|
Song* pSong = id.ToSong();
|
||||||
@@ -317,9 +318,7 @@ float Profile::GetSongsActual( StepsType st, Difficulty dc ) const
|
|||||||
CHECKPOINT_M( ssprintf("Profile::GetSongsActual: song %s", pSong->GetSongDir().c_str()) );
|
CHECKPOINT_M( ssprintf("Profile::GetSongsActual: song %s", pSong->GetSongDir().c_str()) );
|
||||||
const HighScoresForASong &hsfas = i->second;
|
const HighScoresForASong &hsfas = i->second;
|
||||||
|
|
||||||
for( map<StepsID,HighScoresForASteps>::const_iterator j = hsfas.m_StepsHighScores.begin();
|
FOREACHM_CONST( StepsID, HighScoresForASteps, hsfas.m_StepsHighScores, j )
|
||||||
j != hsfas.m_StepsHighScores.end();
|
|
||||||
++j )
|
|
||||||
{
|
{
|
||||||
const StepsID &id = j->first;
|
const StepsID &id = j->first;
|
||||||
Steps* pSteps = id.ToSteps( pSong, true );
|
Steps* pSteps = id.ToSteps( pSong, true );
|
||||||
@@ -385,9 +384,7 @@ float Profile::GetCoursesActual( StepsType st, CourseDifficulty cd ) const
|
|||||||
float fTotalPercents = 0;
|
float fTotalPercents = 0;
|
||||||
|
|
||||||
// add course high scores
|
// add course high scores
|
||||||
for( map<CourseID,HighScoresForACourse>::const_iterator i = m_CourseHighScores.begin();
|
FOREACHM_CONST( CourseID, HighScoresForACourse, m_CourseHighScores, i )
|
||||||
i != m_CourseHighScores.end();
|
|
||||||
i++ )
|
|
||||||
{
|
{
|
||||||
CourseID id = i->first;
|
CourseID id = i->first;
|
||||||
const Course* pCourse = id.ToCourse();
|
const Course* pCourse = id.ToCourse();
|
||||||
@@ -403,9 +400,7 @@ float Profile::GetCoursesActual( StepsType st, CourseDifficulty cd ) const
|
|||||||
|
|
||||||
const HighScoresForACourse &hsfac = i->second;
|
const HighScoresForACourse &hsfac = i->second;
|
||||||
|
|
||||||
for( map<TrailID,HighScoresForATrail>::const_iterator j = hsfac.m_TrailHighScores.begin();
|
FOREACHM_CONST( TrailID, HighScoresForATrail, hsfac.m_TrailHighScores, j )
|
||||||
j != hsfac.m_TrailHighScores.end();
|
|
||||||
++j )
|
|
||||||
{
|
{
|
||||||
const TrailID &id = j->first;
|
const TrailID &id = j->first;
|
||||||
Trail* pTrail = id.ToTrail( pCourse, true );
|
Trail* pTrail = id.ToTrail( pCourse, true );
|
||||||
@@ -474,9 +469,7 @@ int Profile::GetSongNumTimesPlayed( const SongID& songID ) const
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
int iTotalNumTimesPlayed = 0;
|
int iTotalNumTimesPlayed = 0;
|
||||||
for( map<StepsID,HighScoresForASteps>::const_iterator j = hsSong->m_StepsHighScores.begin();
|
FOREACHM_CONST( StepsID, HighScoresForASteps, hsSong->m_StepsHighScores, j )
|
||||||
j != hsSong->m_StepsHighScores.end();
|
|
||||||
j++ )
|
|
||||||
{
|
{
|
||||||
const HighScoresForASteps &hsSteps = j->second;
|
const HighScoresForASteps &hsSteps = j->second;
|
||||||
|
|
||||||
@@ -590,8 +583,7 @@ void Profile::GetGrades( const Song* pSong, StepsType st, int iCounts[NUM_GRADES
|
|||||||
|
|
||||||
FOREACH_Grade(g)
|
FOREACH_Grade(g)
|
||||||
{
|
{
|
||||||
map<StepsID,HighScoresForASteps>::const_iterator it;
|
FOREACHM_CONST( StepsID, HighScoresForASteps, hsSong->m_StepsHighScores, it )
|
||||||
for( it = hsSong->m_StepsHighScores.begin(); it != hsSong->m_StepsHighScores.end(); ++it )
|
|
||||||
{
|
{
|
||||||
const StepsID &id = it->first;
|
const StepsID &id = it->first;
|
||||||
if( !id.MatchesStepsType(st) )
|
if( !id.MatchesStepsType(st) )
|
||||||
@@ -646,9 +638,7 @@ int Profile::GetCourseNumTimesPlayed( const CourseID &courseID ) const
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
int iTotalNumTimesPlayed = 0;
|
int iTotalNumTimesPlayed = 0;
|
||||||
for( map<TrailID,HighScoresForATrail>::const_iterator j = hsCourse->m_TrailHighScores.begin();
|
FOREACHM_CONST( TrailID, HighScoresForATrail, hsCourse->m_TrailHighScores, j )
|
||||||
j != hsCourse->m_TrailHighScores.end();
|
|
||||||
j++ )
|
|
||||||
{
|
{
|
||||||
const HighScoresForATrail &hsTrail = j->second;
|
const HighScoresForATrail &hsTrail = j->second;
|
||||||
|
|
||||||
@@ -914,6 +904,7 @@ XNode* Profile::SaveGeneralDataCreateNode() const
|
|||||||
// redundant to the game app.
|
// redundant to the game app.
|
||||||
pGeneralDataNode->AppendChild( "DisplayName", GetDisplayName() );
|
pGeneralDataNode->AppendChild( "DisplayName", GetDisplayName() );
|
||||||
pGeneralDataNode->AppendChild( "IsMachine", IsMachine() );
|
pGeneralDataNode->AppendChild( "IsMachine", IsMachine() );
|
||||||
|
pGeneralDataNode->AppendChild( "IsWeightSet", m_iWeightPounds != 0 );
|
||||||
|
|
||||||
pGeneralDataNode->AppendChild( "Guid", m_sGuid );
|
pGeneralDataNode->AppendChild( "Guid", m_sGuid );
|
||||||
pGeneralDataNode->AppendChild( "SortOrder", SortOrderToString(m_SortOrder) );
|
pGeneralDataNode->AppendChild( "SortOrder", SortOrderToString(m_SortOrder) );
|
||||||
@@ -928,7 +919,7 @@ XNode* Profile::SaveGeneralDataCreateNode() const
|
|||||||
pGeneralDataNode->AppendChild( "TotalCaloriesBurned", m_fTotalCaloriesBurned );
|
pGeneralDataNode->AppendChild( "TotalCaloriesBurned", m_fTotalCaloriesBurned );
|
||||||
pGeneralDataNode->AppendChild( "GoalType", m_GoalType );
|
pGeneralDataNode->AppendChild( "GoalType", m_GoalType );
|
||||||
pGeneralDataNode->AppendChild( "GoalCalories", m_iGoalCalories );
|
pGeneralDataNode->AppendChild( "GoalCalories", m_iGoalCalories );
|
||||||
pGeneralDataNode->AppendChild( "GoalSeconds", m_iGoalSeconds );
|
pGeneralDataNode->AppendChild( "GoalSeconds", m_iGoalSeconds );
|
||||||
pGeneralDataNode->AppendChild( "LastPlayedMachineGuid", m_sLastPlayedMachineGuid );
|
pGeneralDataNode->AppendChild( "LastPlayedMachineGuid", m_sLastPlayedMachineGuid );
|
||||||
pGeneralDataNode->AppendChild( "LastPlayedDate", m_LastPlayedDate );
|
pGeneralDataNode->AppendChild( "LastPlayedDate", m_LastPlayedDate );
|
||||||
pGeneralDataNode->AppendChild( "TotalDancePoints", m_iTotalDancePoints );
|
pGeneralDataNode->AppendChild( "TotalDancePoints", m_iTotalDancePoints );
|
||||||
@@ -949,13 +940,13 @@ XNode* Profile::SaveGeneralDataCreateNode() const
|
|||||||
|
|
||||||
{
|
{
|
||||||
XNode* pDefaultModifiers = pGeneralDataNode->AppendChild("DefaultModifiers");
|
XNode* pDefaultModifiers = pGeneralDataNode->AppendChild("DefaultModifiers");
|
||||||
for( map<CString,CString>::const_iterator it = m_sDefaultModifiers.begin(); it != m_sDefaultModifiers.end(); ++it )
|
FOREACHM_CONST( CString, CString, m_sDefaultModifiers, it )
|
||||||
pDefaultModifiers->AppendChild( it->first, it->second );
|
pDefaultModifiers->AppendChild( it->first, it->second );
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
XNode* pUnlockedSongs = pGeneralDataNode->AppendChild("UnlockedSongs");
|
XNode* pUnlockedSongs = pGeneralDataNode->AppendChild("UnlockedSongs");
|
||||||
for( set<int>::const_iterator it = m_UnlockedSongs.begin(); it != m_UnlockedSongs.end(); ++it )
|
FOREACHS_CONST( int, m_UnlockedSongs, it )
|
||||||
pUnlockedSongs->AppendChild( ssprintf("Unlock%i", *it) );
|
pUnlockedSongs->AppendChild( ssprintf("Unlock%i", *it) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -972,9 +963,7 @@ XNode* Profile::SaveGeneralDataCreateNode() const
|
|||||||
|
|
||||||
{
|
{
|
||||||
XNode* pNumSongsPlayedByStyle = pGeneralDataNode->AppendChild("NumSongsPlayedByStyle");
|
XNode* pNumSongsPlayedByStyle = pGeneralDataNode->AppendChild("NumSongsPlayedByStyle");
|
||||||
for( map<StyleID,int>::const_iterator iter = m_iNumSongsPlayedByStyle.begin();
|
FOREACHM_CONST( StyleID, int, m_iNumSongsPlayedByStyle, iter )
|
||||||
iter != m_iNumSongsPlayedByStyle.end();
|
|
||||||
iter++ )
|
|
||||||
{
|
{
|
||||||
const StyleID &s = iter->first;
|
const StyleID &s = iter->first;
|
||||||
int iNumPlays = iter->second;
|
int iNumPlays = iter->second;
|
||||||
@@ -1063,7 +1052,7 @@ Profile::LoadResult Profile::LoadEditableDataFromDir( CString sDir )
|
|||||||
m_sDisplayName = WStringToCString(wstr);
|
m_sDisplayName = WStringToCString(wstr);
|
||||||
// TODO: strip invalid chars?
|
// TODO: strip invalid chars?
|
||||||
if( m_iWeightPounds != 0 )
|
if( m_iWeightPounds != 0 )
|
||||||
CLAMP( m_iWeightPounds, 50, 500 );
|
CLAMP( m_iWeightPounds, 20, 1000 );
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
@@ -1209,13 +1198,10 @@ void Profile::AddStepTotals( int iTotalTapsAndHolds, int iTotalJumps, int iTotal
|
|||||||
m_iTotalMines += iTotalMines;
|
m_iTotalMines += iTotalMines;
|
||||||
m_iTotalHands += iTotalHands;
|
m_iTotalHands += iTotalHands;
|
||||||
|
|
||||||
if( m_iWeightPounds != 0 )
|
m_fTotalCaloriesBurned += fCaloriesBurned;
|
||||||
{
|
|
||||||
m_fTotalCaloriesBurned += fCaloriesBurned;
|
|
||||||
|
|
||||||
DateTime date = DateTime::GetNowDate();
|
DateTime date = DateTime::GetNowDate();
|
||||||
m_mapDayToCaloriesBurned[date] += fCaloriesBurned;
|
m_mapDayToCaloriesBurned[date] += fCaloriesBurned;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
XNode* Profile::SaveSongScoresCreateNode() const
|
XNode* Profile::SaveSongScoresCreateNode() const
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ public:
|
|||||||
CString GetDisplayName() const;
|
CString GetDisplayName() const;
|
||||||
CString GetDisplayTotalCaloriesBurned() const; // remove me and use Lua instead
|
CString GetDisplayTotalCaloriesBurned() const; // remove me and use Lua instead
|
||||||
CString GetDisplayTotalCaloriesBurnedToday() const; // remove me and use Lua instead
|
CString GetDisplayTotalCaloriesBurnedToday() const; // remove me and use Lua instead
|
||||||
|
int GetCalculatedWeightPounds() const; // returns a default value if m_iWeightPounds isn't set
|
||||||
float GetCaloriesBurnedToday() const;
|
float GetCaloriesBurnedToday() const;
|
||||||
int GetTotalNumSongsPassed() const;
|
int GetTotalNumSongsPassed() const;
|
||||||
int GetTotalStepsWithTopGrade( StepsType st, Difficulty d, Grade g ) const;
|
int GetTotalStepsWithTopGrade( StepsType st, Difficulty d, Grade g ) const;
|
||||||
|
|||||||
Reference in New Issue
Block a user