51 lines
3.2 KiB
Plaintext
51 lines
3.2 KiB
Plaintext
SM5 has two systems for calculating the number of calories burned during a song.
|
|
|
|
The first system simply uses the weight of the player and adds a small amount for every step. This does not require any specific support from the theme and is the default for new profiles.
|
|
|
|
|
|
The second system uses age, gender, weight, heart rate, and song duration to calculate the amount used during a song. This requires a theme to support it, and the relevant parts of Editable.ini to be set for the profile.
|
|
|
|
Editable.ini fields:
|
|
BirthYear, -- defaults to 1995
|
|
IgnoreStepCountCalories, -- Must be set to 1 to use the second system.
|
|
IsMale, -- Defaults to 1. Set to 0 for females.
|
|
Voomax, -- VO2max. Optional. Calorie calculation is more accurate if it is set, but it is not necessary. 0 means unset. http://www.shapesense.com/fitness-exercise/calculators/vo2max-calculator.aspx is a site for estimating V02max, and the source of the equations used.
|
|
WeightPounds -- Weight in pounds.
|
|
|
|
Lua API functions: (names only, details are in Docs/Luadoc/Lua.xml)
|
|
GetWeightPounds()
|
|
SetWeightPounds()
|
|
GetVoomax()
|
|
SetVoomax()
|
|
GetAge()
|
|
GetBirthYear()
|
|
SetBirthYear()
|
|
GetIgnoreStepCountCalories()
|
|
SetIgnoreStepCountCalories()
|
|
GetIsMale()
|
|
SetIsMale()
|
|
AddCaloriesToDailyTotal()
|
|
CalculateCaloriesFromHeartRate()
|
|
|
|
Intended usage:
|
|
A theme that supports heart rate calorie calculation should take the following steps:
|
|
1. Create a new screen that the player will be able to use to enter their heart rate. It shall be called "ScreenHeartEntry" in this list, though a theme can name it anything.
|
|
2. During ScreenGameplay, track the amount of time that the player is hitting steps for. This duration must be in seconds.
|
|
3. When proceeding from ScreenGameplay:
|
|
3a. Check whether GetIgnoreStepCountCalories returns true for either player's profile.
|
|
3b. If it returns true for either player, go to ScreenHeartEntry instead of ScreenEvaluationNormal.
|
|
3c. This means changing the NextScreen metric for ScreenGameplay to use a function that checks the profiles and returns the correct screen.
|
|
4. On ScreenHeartEntry:
|
|
4a. Provide a timer that the players can watch while measuring their pulse.
|
|
4b. Provide a way for the players to enter their heart rate in beats per minute.
|
|
4c. When a player enters their heart rate, use Profile:CalculateCaloriesFromHeartRate().
|
|
4d. Do not add calories to a profile if Profile:IgnoreStepCountCalories() returns false for that profile.
|
|
4e. Pass the heart rate and the duration from ScreenGameplay to Profile:CalculateCaloriesFromHeartRate() and store its return value.
|
|
4f. Pass the return value of Profile:CalculateCaloriesFromHeartRate() to Profile:AddCaloriesToDailyTotal() to add them to the total for that player's profile.
|
|
4g. When all active players have finished entering their heart rate, proceed to ScreenEvaluationNormal.
|
|
5. This concludes the special steps required for theme support of heart rate calorie calculation.
|
|
|
|
Side notes:
|
|
CalculateCaloriesFromHeartRate and AddCaloriesToDailyTotal are separate functions so that a theme can display or use the calorie amount in other ways easily.
|
|
If IgnoreStepCountCalories is true for a profile, but the theme in use does not provide support using the steps listed above, that profile will not accumulate calories.
|