count calories while stepping, not at the end
This commit is contained in:
@@ -123,7 +123,7 @@ bool GameCommand::DescribesCurrentMode( PlayerNumber pn ) const
|
|||||||
return false;
|
return false;
|
||||||
if( m_SortOrder != SORT_INVALID && GAMESTATE->m_PreferredSortOrder != m_SortOrder )
|
if( m_SortOrder != SORT_INVALID && GAMESTATE->m_PreferredSortOrder != m_SortOrder )
|
||||||
return false;
|
return false;
|
||||||
if( m_iWeightPounds != -1 && GAMESTATE->m_pPlayerState[pn]->m_iWeightPounds != m_iWeightPounds )
|
if( m_iWeightPounds != -1 && PROFILEMAN->IsUsingProfile(pn) && PROFILEMAN->GetProfile(pn)->m_iWeightPounds != m_iWeightPounds )
|
||||||
return false;
|
return false;
|
||||||
if( m_iStopCourseAtSeconds != -1 && GAMESTATE->m_iStopCourseAtSeconds != m_iStopCourseAtSeconds )
|
if( m_iStopCourseAtSeconds != -1 && GAMESTATE->m_iStopCourseAtSeconds != m_iStopCourseAtSeconds )
|
||||||
return false;
|
return false;
|
||||||
@@ -642,7 +642,8 @@ void GameCommand::Apply( const vector<PlayerNumber> &vpns ) const
|
|||||||
SOUND->PlayOnce( THEME->GetPathToS( m_sSoundPath ) );
|
SOUND->PlayOnce( THEME->GetPathToS( m_sSoundPath ) );
|
||||||
if( m_iWeightPounds != -1 )
|
if( m_iWeightPounds != -1 )
|
||||||
FOREACH_CONST( PlayerNumber, vpns, pn )
|
FOREACH_CONST( PlayerNumber, vpns, pn )
|
||||||
GAMESTATE->m_pPlayerState[*pn]->m_iWeightPounds = m_iWeightPounds;
|
if( PROFILEMAN->IsUsingProfile(*pn) )
|
||||||
|
PROFILEMAN->GetProfile(*pn)->m_iWeightPounds = m_iWeightPounds;
|
||||||
if( m_iStopCourseAtSeconds != -1 )
|
if( m_iStopCourseAtSeconds != -1 )
|
||||||
GAMESTATE->m_iStopCourseAtSeconds = m_iStopCourseAtSeconds;
|
GAMESTATE->m_iStopCourseAtSeconds = m_iStopCourseAtSeconds;
|
||||||
|
|
||||||
|
|||||||
@@ -652,7 +652,8 @@ void GameState::FinishStage()
|
|||||||
int iNumHolds = (int) g_CurStageStats.m_player[pn].radarActual[RADAR_NUM_HOLDS];
|
int iNumHolds = (int) g_CurStageStats.m_player[pn].radarActual[RADAR_NUM_HOLDS];
|
||||||
int iNumMines = (int) g_CurStageStats.m_player[pn].radarActual[RADAR_NUM_MINES];
|
int iNumMines = (int) g_CurStageStats.m_player[pn].radarActual[RADAR_NUM_MINES];
|
||||||
int iNumHands = (int) g_CurStageStats.m_player[pn].radarActual[RADAR_NUM_HANDS];
|
int iNumHands = (int) g_CurStageStats.m_player[pn].radarActual[RADAR_NUM_HANDS];
|
||||||
PROFILEMAN->AddStepTotals( pn, iNumTapsAndHolds, iNumJumps, iNumHolds, iNumMines, iNumHands );
|
float fCaloriesBurned = g_CurStageStats.m_player[pn].fCaloriesBurned;
|
||||||
|
PROFILEMAN->AddStepTotals( pn, iNumTapsAndHolds, iNumJumps, iNumHolds, iNumMines, iNumHands, fCaloriesBurned );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
#include "GameSoundManager.h"
|
#include "GameSoundManager.h"
|
||||||
#include "Style.h"
|
#include "Style.h"
|
||||||
#include "MessageManager.h"
|
#include "MessageManager.h"
|
||||||
|
#include "ProfileManager.h"
|
||||||
|
|
||||||
CString JUDGMENT_X_NAME( size_t p, size_t both_sides ) { return "JudgmentXOffset" + (both_sides ? CString("BothSides") : ssprintf("OneSideP%d",p+1) ); }
|
CString JUDGMENT_X_NAME( size_t p, size_t both_sides ) { return "JudgmentXOffset" + (both_sides ? CString("BothSides") : ssprintf("OneSideP%d",p+1) ); }
|
||||||
CString COMBO_X_NAME( size_t p, size_t both_sides ) { return "ComboXOffset" + (both_sides ? CString("BothSides") : ssprintf("OneSideP%d",p+1) ); }
|
CString COMBO_X_NAME( size_t p, size_t both_sides ) { return "ComboXOffset" + (both_sides ? CString("BothSides") : ssprintf("OneSideP%d",p+1) ); }
|
||||||
@@ -693,10 +694,45 @@ void Player::HandleStep( int col, const RageTimer &tm )
|
|||||||
//
|
//
|
||||||
// Count calories for this step.
|
// Count calories for this step.
|
||||||
//
|
//
|
||||||
if( m_pPlayerStageStats )
|
if( m_pPlayerStageStats && m_pPlayerState )
|
||||||
{
|
{
|
||||||
// FIXME:
|
// TODO: remove use of PlayerNumber
|
||||||
m_pPlayerStageStats->fCaloriesBurned += randomf( 1.f, 2.f );
|
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
|
||||||
|
Profile* pProfile = PROFILEMAN->GetProfile(pn);
|
||||||
|
if( pProfile )
|
||||||
|
{
|
||||||
|
int iLbs = pProfile->m_iWeightPounds;
|
||||||
|
if( iLbs != 0 )
|
||||||
|
{
|
||||||
|
int iNumTracksHeld = 0;
|
||||||
|
for( unsigned t=0; t<m_NoteData.GetNumTracks(); t++ )
|
||||||
|
{
|
||||||
|
const StyleInput StyleI( pn, t );
|
||||||
|
const GameInput GameI = GAMESTATE->GetCurrentStyle()->StyleInputToGameInput( StyleI );
|
||||||
|
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
|
||||||
|
fCals = 0;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
float fCalsFor100Lbs = SCALE( iNumTracksHeld, 1, 2, 0.029f, 0.222f );
|
||||||
|
float fCalsFor200Lbs = SCALE( iNumTracksHeld, 1, 2, 0.052f, 0.386f );
|
||||||
|
fCals = SCALE( iLbs, 100.f, 200.f, fCalsFor100Lbs, fCalsFor200Lbs );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_pPlayerStageStats->fCaloriesBurned += fCals;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -42,8 +42,6 @@ struct PlayerState
|
|||||||
|
|
||||||
for( int i=0; i<NUM_INVENTORY_SLOTS; i++ )
|
for( int i=0; i<NUM_INVENTORY_SLOTS; i++ )
|
||||||
m_Inventory[i].MakeBlank();
|
m_Inventory[i].MakeBlank();
|
||||||
|
|
||||||
m_iWeightPounds = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -91,11 +89,6 @@ struct PlayerState
|
|||||||
// Used in Battle
|
// Used in Battle
|
||||||
//
|
//
|
||||||
Attack m_Inventory[NUM_INVENTORY_SLOTS];
|
Attack m_Inventory[NUM_INVENTORY_SLOTS];
|
||||||
|
|
||||||
//
|
|
||||||
// Used in Workout
|
|
||||||
//
|
|
||||||
int m_iWeightPounds; // -1 == no weight set
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1030,26 +1030,21 @@ void Profile::LoadGeneralDataFromNode( const XNode* pNode )
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Profile::AddStepTotals( int iTotalTapsAndHolds, int iTotalJumps, int iTotalHolds, int iTotalMines, int iTotalHands )
|
void Profile::AddStepTotals( int iTotalTapsAndHolds, int iTotalJumps, int iTotalHolds, int iTotalMines, int iTotalHands, float fCaloriesBurned )
|
||||||
{
|
{
|
||||||
m_iTotalTapsAndHolds += iTotalTapsAndHolds;
|
m_iTotalTapsAndHolds += iTotalTapsAndHolds;
|
||||||
m_iTotalJumps += iTotalJumps;
|
m_iTotalJumps += iTotalJumps;
|
||||||
m_iTotalHolds += iTotalHolds;
|
m_iTotalHolds += iTotalHolds;
|
||||||
m_iTotalMines += iTotalMines;
|
m_iTotalMines += iTotalMines;
|
||||||
m_iTotalHands += iTotalHands;
|
m_iTotalHands += iTotalHands;
|
||||||
|
m_fTotalCaloriesBurned += fCaloriesBurned;
|
||||||
|
|
||||||
if( m_iWeightPounds != 0 )
|
if( m_iWeightPounds != 0 )
|
||||||
{
|
{
|
||||||
float fCals =
|
m_fTotalCaloriesBurned += fCaloriesBurned;
|
||||||
SCALE( m_iWeightPounds, 100.f, 200.f, 0.029f, 0.052f ) * iTotalTapsAndHolds +
|
|
||||||
SCALE( m_iWeightPounds, 100.f, 200.f, 0.111f, 0.193f ) * iTotalJumps +
|
|
||||||
SCALE( m_iWeightPounds, 100.f, 200.f, 0.029f, 0.052f ) * iTotalHolds +
|
|
||||||
SCALE( m_iWeightPounds, 100.f, 200.f, 0.000f, 0.000f ) * iTotalMines +
|
|
||||||
SCALE( m_iWeightPounds, 100.f, 200.f, 0.222f, 0.386f ) * iTotalHands;
|
|
||||||
m_fTotalCaloriesBurned += fCals;
|
|
||||||
|
|
||||||
DateTime date = DateTime::GetNowDate();
|
DateTime date = DateTime::GetNowDate();
|
||||||
m_mapDayToCaloriesBurned[date] += fCals;
|
m_mapDayToCaloriesBurned[date] += fCaloriesBurned;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ public:
|
|||||||
bool GetDefaultModifiers( const Game* pGameType, CString &sModifiersOut ) const;
|
bool GetDefaultModifiers( const Game* pGameType, CString &sModifiersOut ) const;
|
||||||
void SetDefaultModifiers( const Game* pGameType, const CString &sModifiers );
|
void SetDefaultModifiers( const Game* pGameType, const CString &sModifiers );
|
||||||
|
|
||||||
void AddStepTotals( int iNumTapsAndHolds, int iNumJumps, int iNumHolds, int iNumMines, int iNumHands );
|
void AddStepTotals( int iNumTapsAndHolds, int iNumJumps, int iNumHolds, int iNumMines, int iNumHands, float fCaloriesBurned );
|
||||||
|
|
||||||
bool IsMachine() const;
|
bool IsMachine() const;
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ public:
|
|||||||
//
|
//
|
||||||
CString m_sDisplayName;
|
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.
|
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;
|
int m_iWeightPounds; // 0 == invalid
|
||||||
|
|
||||||
//
|
//
|
||||||
// General data
|
// General data
|
||||||
|
|||||||
@@ -360,11 +360,11 @@ void ProfileManager::IncrementToastiesCount( PlayerNumber pn )
|
|||||||
++PROFILEMAN->GetMachineProfile()->m_iNumToasties;
|
++PROFILEMAN->GetMachineProfile()->m_iNumToasties;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProfileManager::AddStepTotals( PlayerNumber pn, int iNumTapsAndHolds, int iNumJumps, int iNumHolds, int iNumMines, int iNumHands )
|
void ProfileManager::AddStepTotals( PlayerNumber pn, int iNumTapsAndHolds, int iNumJumps, int iNumHolds, int iNumMines, int iNumHands, float fCaloriesBurned )
|
||||||
{
|
{
|
||||||
if( PROFILEMAN->IsUsingProfile(pn) )
|
if( PROFILEMAN->IsUsingProfile(pn) )
|
||||||
PROFILEMAN->GetProfile(pn)->AddStepTotals( iNumTapsAndHolds, iNumJumps, iNumHolds, iNumMines, iNumHands );
|
PROFILEMAN->GetProfile(pn)->AddStepTotals( iNumTapsAndHolds, iNumJumps, iNumHolds, iNumMines, iNumHands, fCaloriesBurned );
|
||||||
PROFILEMAN->GetMachineProfile()->AddStepTotals( iNumTapsAndHolds, iNumJumps, iNumHolds, iNumMines, iNumHands );
|
PROFILEMAN->GetMachineProfile()->AddStepTotals( iNumTapsAndHolds, iNumJumps, iNumHolds, iNumMines, iNumHands, fCaloriesBurned );
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public:
|
|||||||
// General data
|
// General data
|
||||||
//
|
//
|
||||||
void IncrementToastiesCount( PlayerNumber pn );
|
void IncrementToastiesCount( PlayerNumber pn );
|
||||||
void AddStepTotals( PlayerNumber pn, int iNumTapsAndHolds, int iNumJumps, int iNumHolds, int iNumMines, int iNumHands );
|
void AddStepTotals( PlayerNumber pn, int iNumTapsAndHolds, int iNumJumps, int iNumHolds, int iNumMines, int iNumHands, float fCaloriesBurned );
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user