[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?
--------------------------------------------------------------------------------
2011/08/19
----------
* [Steps] Add PredictMeter() and GetDisplayBPMType() Lua bindings. [AJ]
2011/08/18
----------
* [RageInput] Added "No input devices were loaded." string to languages. [AJ]
+11 -9
View File
@@ -41,8 +41,8 @@ static const char *DisplayBPMNames[] =
"Specified",
"Random",
};
XToString( DisplayBPM );
LuaXType( DisplayBPM );
Steps::Steps(): m_StepsType(StepsType_Invalid),
parent(NULL), m_pNoteData(new NoteData), m_bNoteDataIsFilled(false),
@@ -548,14 +548,11 @@ public:
lua_pushboolean(L, p->HasSignificantTimingChanges());
return 1;
}
static int HasAttacks( T* p, lua_State *L )
{
lua_pushboolean(L, p->HasAttacks());
return 1;
}
static int GetRadarValues( T* p, lua_State *L )
{
PlayerNumber pn = Enum::Check<PlayerNumber>(L, 1);
@@ -563,16 +560,14 @@ public:
rv.PushSelf(L);
return 1;
}
static int GetTimingData( T* p, lua_State *L )
{
p->m_Timing.PushSelf(L);
return 1;
}
static int GetHash( T* p, lua_State *L ) { lua_pushnumber( L, p->GetHash() ); return 1; }
// untested
/*
static int GetSMNoteData( T* p, lua_State *L )
{
RString out;
@@ -580,13 +575,12 @@ public:
lua_pushstring( L, out );
return 1;
}
*/
static int GetChartName(T *p, lua_State *L)
{
lua_pushstring(L, p->GetChartName());
return 1;
}
static int GetDisplayBpms( T* p, lua_State *L )
{
DisplayBpms temp;
@@ -618,6 +612,12 @@ public:
lua_pushboolean( L, p->GetDisplayBPM() == DISPLAY_BPM_RANDOM );
return 1;
}
DEFINE_METHOD( PredictMeter, PredictMeter() )
static int GetDisplayBPMType( T* p, lua_State *L )
{
LuaHelpers::Push( L, p->GetDisplayBPM() );
return 1;
}
LunaSteps()
{
@@ -643,6 +643,8 @@ public:
ADD_METHOD( IsDisplayBpmSecret );
ADD_METHOD( IsDisplayBpmConstant );
ADD_METHOD( IsDisplayBpmRandom );
ADD_METHOD( PredictMeter );
ADD_METHOD( GetDisplayBPMType );
}
};
+19 -49
View File
@@ -28,8 +28,11 @@ enum DisplayBPM
DISPLAY_BPM_ACTUAL, /**< Display the song's actual BPM. */
DISPLAY_BPM_SPECIFIED, /**< Display a specified value or values. */
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.
@@ -107,17 +110,9 @@ public:
AttackArray m_Attacks;
/** @brief The stringified list of attacks. */
vector<RString> m_sAttackString;
RString GetChartName() const
{
return parent ? Real()->GetChartName() : this->chartName;
}
void SetChartName(const RString name)
{
this->chartName = name;
}
RString GetChartName() const { return parent ? Real()->GetChartName() : this->chartName; }
void SetChartName(const RString name) { this->chartName = name; }
void SetFilename( RString fn ) { m_sFilename = fn; }
RString GetFilename() const { return m_sFilename; }
void SetSavedToDisk( bool b ) { DeAutogen(); m_bSavedToDisk = b; }
@@ -140,12 +135,12 @@ public:
void SetNoteData( const NoteData& noteDataNew );
void SetSMNoteData( const RString &notes_comp );
void GetSMNoteData( RString &notes_comp_out ) const;
/**
* @brief Retrieve the NoteData from the original source.
* @return true if successful, false for failure. */
bool GetNoteDataFromSimfile();
/**
* @brief Determine if we are missing any note data.
*
@@ -161,12 +156,12 @@ public:
*
* This is required to allow Split Timing. */
TimingData m_Timing;
/**
* @brief Determine if the Steps have any major timing changes during gameplay.
* @return true if it does, or false otherwise. */
bool HasSignificantTimingChanges() const;
/**
* @brief Determine if the Steps have any attacks.
* @return true if it does, or false otherwise. */
@@ -178,40 +173,18 @@ public:
StepsType m_StepsType;
CachedObject<Steps> m_CachedObject;
/**
* @brief Determine if the Steps use Split Timing by comparing the Song it's in.
* @return true if the Step and Song use different timings, false otherwise. */
bool UsesSplitTiming() const;
void SetDisplayBPM(const DisplayBPM type)
{
this->displayBPMType = type;
}
DisplayBPM GetDisplayBPM() const
{
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 SetDisplayBPM(const DisplayBPM type) { this->displayBPMType = type; }
DisplayBPM GetDisplayBPM() const { 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;
RString GetAttackString() const
@@ -261,17 +234,14 @@ private:
bool m_bAreCachedRadarValuesJustLoaded;
/** @brief The name of the person who created the Steps. */
RString m_sCredit;
/** @brief The name of the chart. */
RString chartName;
/** @brief How is the BPM displayed for this chart? */
DisplayBPM displayBPMType;
/** @brief What is the minimum specified BPM? */
float specifiedBPMMin;
/**
* @brief What is the maximum specified BPM?
*
* If this is a range, then min should not be equal to max. */
float specifiedBPMMax;
};