add GoalType, Lua functions
This commit is contained in:
@@ -52,6 +52,7 @@ void GameCommand::Init()
|
||||
m_iWeightPounds = -1;
|
||||
m_iGoalCalories = -1;
|
||||
m_iStopCourseAtSeconds = -1;
|
||||
m_GoalType = GOAL_INVALID;
|
||||
|
||||
m_bClearBookkeepingData = false;
|
||||
m_bClearMachineStats = false;
|
||||
@@ -130,6 +131,8 @@ bool GameCommand::DescribesCurrentMode( PlayerNumber pn ) const
|
||||
return false;
|
||||
if( m_iStopCourseAtSeconds != -1 && GAMESTATE->m_iStopCourseAtSeconds != m_iStopCourseAtSeconds )
|
||||
return false;
|
||||
if( m_GoalType != GOAL_INVALID && PROFILEMAN->IsUsingProfile(pn) && PROFILEMAN->GetProfile(pn)->m_GoalType != m_GoalType )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -317,6 +320,11 @@ void GameCommand::Load( int iIndex, const Commands& cmds )
|
||||
m_iStopCourseAtSeconds = atoi( sValue );
|
||||
}
|
||||
|
||||
else if( sName == "goaltype" )
|
||||
{
|
||||
m_GoalType = StringToGoalType( sValue );
|
||||
}
|
||||
|
||||
else if( sName == "unlock" )
|
||||
{
|
||||
m_iUnlockIndex = atoi( sValue );
|
||||
@@ -658,6 +666,10 @@ void GameCommand::Apply( const vector<PlayerNumber> &vpns ) const
|
||||
PROFILEMAN->GetProfile(*pn)->m_iGoalCalories = m_iGoalCalories;
|
||||
if( m_iStopCourseAtSeconds != -1 )
|
||||
GAMESTATE->m_iStopCourseAtSeconds = m_iStopCourseAtSeconds;
|
||||
if( m_GoalType != GOAL_INVALID )
|
||||
FOREACH_CONST( PlayerNumber, vpns, pn )
|
||||
if( PROFILEMAN->IsUsingProfile(*pn) )
|
||||
PROFILEMAN->GetProfile(*pn)->m_GoalType = m_GoalType;
|
||||
|
||||
/* If we're going to stop music, do so before preparing new screens, so we don't
|
||||
* stop music between preparing screens and loading screens. */
|
||||
@@ -800,7 +812,8 @@ bool GameCommand::IsZero() const
|
||||
m_SortOrder != SORT_INVALID ||
|
||||
m_iWeightPounds != -1 ||
|
||||
m_iGoalCalories != -1 ||
|
||||
m_iStopCourseAtSeconds != -1
|
||||
m_iStopCourseAtSeconds != -1 ||
|
||||
m_GoalType != GOAL_INVALID
|
||||
)
|
||||
return false;
|
||||
|
||||
|
||||
@@ -62,6 +62,7 @@ public:
|
||||
int m_iWeightPounds; // -1 == none specified
|
||||
int m_iGoalCalories; // -1 == none specified
|
||||
int m_iStopCourseAtSeconds; // -1 == none specified
|
||||
GoalType m_GoalType;
|
||||
|
||||
bool m_bClearBookkeepingData;
|
||||
bool m_bClearMachineStats;
|
||||
|
||||
@@ -246,7 +246,15 @@ static const CString MenuDirNames[NUM_MENU_DIRS] = {
|
||||
"Auto",
|
||||
};
|
||||
XToString( MenuDir );
|
||||
StringToX( MenuDir );
|
||||
|
||||
|
||||
static const CString GoalTypeNames[NUM_GOAL_TYPES] = {
|
||||
"Calories",
|
||||
"Time",
|
||||
"None",
|
||||
};
|
||||
XToString( GoalType );
|
||||
StringToX( GoalType );
|
||||
|
||||
|
||||
#include "LuaFunctions.h"
|
||||
|
||||
@@ -355,6 +355,19 @@ enum MenuDir
|
||||
const CString& MenuDirToString( MenuDir md );
|
||||
|
||||
|
||||
enum GoalType
|
||||
{
|
||||
GOAL_CALORIES,
|
||||
GOAL_TIME,
|
||||
GOAL_NONE,
|
||||
NUM_GOAL_TYPES,
|
||||
GOAL_INVALID,
|
||||
};
|
||||
#define FOREACH_GoalType( md ) FOREACH_ENUM( GoalType, NUM_GOAL_TYPES, gt )
|
||||
const CString& GoalTypeToString( GoalType gt );
|
||||
GoalType StringToGoalType( const CString& s );
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
@@ -1685,8 +1685,11 @@ public:
|
||||
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 = FArg(1); return 0; }
|
||||
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 = (GoalType)IArg(1); return 0; }
|
||||
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); return 0; }
|
||||
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); return 0; }
|
||||
static int GetCaloriesBurnedToday( T* p, lua_State *L ) { lua_pushnumber(L, p->GetCaloriesBurnedToday() ); return 1; }
|
||||
static int GetSaved( T* p, lua_State *L ) { p->m_SavedLuaData.PushSelf(L); return 1; }
|
||||
|
||||
@@ -1695,8 +1698,11 @@ public:
|
||||
ADD_METHOD( GetWeightPounds )
|
||||
ADD_METHOD( SetWeightPounds )
|
||||
ADD_METHOD( GetGoalType )
|
||||
ADD_METHOD( SetGoalType )
|
||||
ADD_METHOD( GetGoalCalories )
|
||||
ADD_METHOD( SetGoalCalories )
|
||||
ADD_METHOD( GetGoalSeconds )
|
||||
ADD_METHOD( SetGoalSeconds )
|
||||
ADD_METHOD( GetCaloriesBurnedToday )
|
||||
ADD_METHOD( GetSaved )
|
||||
Luna<T>::Register( L );
|
||||
|
||||
@@ -106,7 +106,7 @@ public:
|
||||
int m_iTotalGameplaySeconds;
|
||||
int m_iCurrentCombo;
|
||||
float m_fTotalCaloriesBurned;
|
||||
enum GoalType { GOAL_CALORIES, GOAL_TIME, GOAL_NONE } m_GoalType;
|
||||
GoalType m_GoalType;
|
||||
int m_iGoalCalories;
|
||||
int m_iGoalSeconds;
|
||||
int m_iTotalDancePoints;
|
||||
|
||||
Reference in New Issue
Block a user