[Steps] Add PredictMeter() and GetDisplayBPMType() Lua bindings.

This commit is contained in:
AJ Kelly
2011-08-19 14:36:25 -05:00
parent f824c56abe
commit 818ea049c2
3 changed files with 34 additions and 58 deletions
+4
View File
@@ -8,6 +8,10 @@ ________________________________________________________________________________
StepMania 5.0 Preview 3 | 2011081? StepMania 5.0 Preview 3 | 2011081?
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
2011/08/19
----------
* [Steps] Add PredictMeter() and GetDisplayBPMType() Lua bindings. [AJ]
2011/08/18 2011/08/18
---------- ----------
* [RageInput] Added "No input devices were loaded." string to languages. [AJ] * [RageInput] Added "No input devices were loaded." string to languages. [AJ]
+11 -9
View File
@@ -41,8 +41,8 @@ static const char *DisplayBPMNames[] =
"Specified", "Specified",
"Random", "Random",
}; };
XToString( DisplayBPM ); XToString( DisplayBPM );
LuaXType( DisplayBPM );
Steps::Steps(): m_StepsType(StepsType_Invalid), Steps::Steps(): m_StepsType(StepsType_Invalid),
parent(NULL), m_pNoteData(new NoteData), m_bNoteDataIsFilled(false), parent(NULL), m_pNoteData(new NoteData), m_bNoteDataIsFilled(false),
@@ -548,14 +548,11 @@ public:
lua_pushboolean(L, p->HasSignificantTimingChanges()); lua_pushboolean(L, p->HasSignificantTimingChanges());
return 1; return 1;
} }
static int HasAttacks( T* p, lua_State *L ) static int HasAttacks( T* p, lua_State *L )
{ {
lua_pushboolean(L, p->HasAttacks()); lua_pushboolean(L, p->HasAttacks());
return 1; return 1;
} }
static int GetRadarValues( T* p, lua_State *L ) static int GetRadarValues( T* p, lua_State *L )
{ {
PlayerNumber pn = Enum::Check<PlayerNumber>(L, 1); PlayerNumber pn = Enum::Check<PlayerNumber>(L, 1);
@@ -563,16 +560,14 @@ public:
rv.PushSelf(L); rv.PushSelf(L);
return 1; return 1;
} }
static int GetTimingData( T* p, lua_State *L ) static int GetTimingData( T* p, lua_State *L )
{ {
p->m_Timing.PushSelf(L); p->m_Timing.PushSelf(L);
return 1; return 1;
} }
static int GetHash( T* p, lua_State *L ) { lua_pushnumber( L, p->GetHash() ); return 1; } static int GetHash( T* p, lua_State *L ) { lua_pushnumber( L, p->GetHash() ); return 1; }
// untested // untested
/*
static int GetSMNoteData( T* p, lua_State *L ) static int GetSMNoteData( T* p, lua_State *L )
{ {
RString out; RString out;
@@ -580,13 +575,12 @@ public:
lua_pushstring( L, out ); lua_pushstring( L, out );
return 1; return 1;
} }
*/
static int GetChartName(T *p, lua_State *L) static int GetChartName(T *p, lua_State *L)
{ {
lua_pushstring(L, p->GetChartName()); lua_pushstring(L, p->GetChartName());
return 1; return 1;
} }
static int GetDisplayBpms( T* p, lua_State *L ) static int GetDisplayBpms( T* p, lua_State *L )
{ {
DisplayBpms temp; DisplayBpms temp;
@@ -618,6 +612,12 @@ public:
lua_pushboolean( L, p->GetDisplayBPM() == DISPLAY_BPM_RANDOM ); lua_pushboolean( L, p->GetDisplayBPM() == DISPLAY_BPM_RANDOM );
return 1; return 1;
} }
DEFINE_METHOD( PredictMeter, PredictMeter() )
static int GetDisplayBPMType( T* p, lua_State *L )
{
LuaHelpers::Push( L, p->GetDisplayBPM() );
return 1;
}
LunaSteps() LunaSteps()
{ {
@@ -643,6 +643,8 @@ public:
ADD_METHOD( IsDisplayBpmSecret ); ADD_METHOD( IsDisplayBpmSecret );
ADD_METHOD( IsDisplayBpmConstant ); ADD_METHOD( IsDisplayBpmConstant );
ADD_METHOD( IsDisplayBpmRandom ); ADD_METHOD( IsDisplayBpmRandom );
ADD_METHOD( PredictMeter );
ADD_METHOD( GetDisplayBPMType );
} }
}; };
+12 -42
View File
@@ -28,8 +28,11 @@ enum DisplayBPM
DISPLAY_BPM_ACTUAL, /**< Display the song's actual BPM. */ DISPLAY_BPM_ACTUAL, /**< Display the song's actual BPM. */
DISPLAY_BPM_SPECIFIED, /**< Display a specified value or values. */ DISPLAY_BPM_SPECIFIED, /**< Display a specified value or values. */
DISPLAY_BPM_RANDOM, /**< Display a random selection of BPMs. */ DISPLAY_BPM_RANDOM, /**< Display a random selection of BPMs. */
NUM_DisplayBPM NUM_DisplayBPM,
DisplayBPM_Invalid
}; };
const RString& DisplayBPMToString( DisplayBPM dbpm );
LuaDeclareType( DisplayBPM );
/** /**
* @brief Holds note information for a Song. * @brief Holds note information for a Song.
@@ -108,16 +111,8 @@ public:
/** @brief The stringified list of attacks. */ /** @brief The stringified list of attacks. */
vector<RString> m_sAttackString; vector<RString> m_sAttackString;
RString GetChartName() const RString GetChartName() const { return parent ? Real()->GetChartName() : this->chartName; }
{ void SetChartName(const RString name) { this->chartName = name; }
return parent ? Real()->GetChartName() : this->chartName;
}
void SetChartName(const RString name)
{
this->chartName = name;
}
void SetFilename( RString fn ) { m_sFilename = fn; } void SetFilename( RString fn ) { m_sFilename = fn; }
RString GetFilename() const { return m_sFilename; } RString GetFilename() const { return m_sFilename; }
void SetSavedToDisk( bool b ) { DeAutogen(); m_bSavedToDisk = b; } void SetSavedToDisk( bool b ) { DeAutogen(); m_bSavedToDisk = b; }
@@ -184,34 +179,12 @@ public:
* @return true if the Step and Song use different timings, false otherwise. */ * @return true if the Step and Song use different timings, false otherwise. */
bool UsesSplitTiming() const; bool UsesSplitTiming() const;
void SetDisplayBPM(const DisplayBPM type) void SetDisplayBPM(const DisplayBPM type) { this->displayBPMType = type; }
{ DisplayBPM GetDisplayBPM() const { return this->displayBPMType; }
this->displayBPMType = type; void SetMinBPM(const float f) { this->specifiedBPMMin = f; }
} float GetMinBPM() const { return this->specifiedBPMMin; }
void SetMaxBPM(const float f) { this->specifiedBPMMax = f; }
DisplayBPM GetDisplayBPM() const float GetMaxBPM() const { return this->specifiedBPMMax; }
{
return this->displayBPMType;
}
void SetMinBPM(const float f)
{
this->specifiedBPMMin = f;
}
float GetMinBPM() const
{
return this->specifiedBPMMin;
}
void SetMaxBPM(const float f)
{
this->specifiedBPMMax = f;
}
float GetMaxBPM() const
{
return this->specifiedBPMMax;
}
void GetDisplayBpms( DisplayBpms &addTo) const; void GetDisplayBpms( DisplayBpms &addTo) const;
RString GetAttackString() const RString GetAttackString() const
@@ -261,17 +234,14 @@ private:
bool m_bAreCachedRadarValuesJustLoaded; bool m_bAreCachedRadarValuesJustLoaded;
/** @brief The name of the person who created the Steps. */ /** @brief The name of the person who created the Steps. */
RString m_sCredit; RString m_sCredit;
/** @brief The name of the chart. */ /** @brief The name of the chart. */
RString chartName; RString chartName;
/** @brief How is the BPM displayed for this chart? */ /** @brief How is the BPM displayed for this chart? */
DisplayBPM displayBPMType; DisplayBPM displayBPMType;
/** @brief What is the minimum specified BPM? */ /** @brief What is the minimum specified BPM? */
float specifiedBPMMin; float specifiedBPMMin;
/** /**
* @brief What is the maximum specified BPM? * @brief What is the maximum specified BPM?
*
* If this is a range, then min should not be equal to max. */ * If this is a range, then min should not be equal to max. */
float specifiedBPMMax; float specifiedBPMMax;
}; };