[WheelBase] Made WheelState a Lua-enabled enum, added GetWheelState() Lua binding.

This commit is contained in:
AJ Kelly
2012-03-08 18:46:54 -06:00
parent ccf29a15b7
commit 00a76ac1f9
3 changed files with 32 additions and 9 deletions
+2
View File
@@ -13,6 +13,8 @@ StepMania 5.0 alpha 2 | 201203??
----------
* [MusicWheel] Added RouletteStopped message, which is broadcast when Roulette
is finished and the wheel is locked. [AJ]
* [WheelBase] Made WheelState a Lua-enabled enum and added
GetWheelState() Lua binding. [AJ]
2012/03/07
----------
+14
View File
@@ -19,6 +19,19 @@
const int MAX_WHEEL_SOUND_SPEED = 15;
AutoScreenMessage( SM_SongChanged ); // TODO: Replace this with a Message and MESSAGEMAN
static const char *WheelStateNames[] = {
"Selecting",
"FlyingOffBeforeNextSort",
"FlyingOnAfterNextSort",
"RouletteSpinning",
"RouletteSlowingDown",
"RandomSpinning",
"Locked",
};
XToString( WheelState );
StringToX( WheelState );
LuaXType( WheelState );
WheelBase::~WheelBase()
{
FOREACH( WheelItemBase*, m_WheelBaseItems, i )
@@ -535,6 +548,7 @@ public:
//static int ChangeMusic( T* p, lua_State *L ){ p->ChangeMusicUnlessLocked( IArg(1) ); return 0; }
DEFINE_METHOD( GetSelectedType, GetSelectedType() )
DEFINE_METHOD( GetWheelState, GetWheelState() )
LunaWheelBase()
{
+16 -9
View File
@@ -14,6 +14,21 @@
#define NUM_WHEEL_ITEMS ((int)ceil(NUM_WHEEL_ITEMS_TO_DRAW+2))
enum WheelState {
STATE_SELECTING,
STATE_FLYING_OFF_BEFORE_NEXT_SORT,
STATE_FLYING_ON_AFTER_NEXT_SORT,
STATE_ROULETTE_SPINNING,
STATE_ROULETTE_SLOWING_DOWN,
STATE_RANDOM_SPINNING,
STATE_LOCKED,
NUM_WheelState,
WheelState_Invalid,
};
const RString& WheelStateToString( WheelState ws );
WheelState StringToWheelState( const RString& sDC );
LuaDeclareType( WheelState );
/** @brief A wheel with data elements. */
class WheelBase : public ActorFrame
{
@@ -38,6 +53,7 @@ public:
virtual bool Select(); // return true if this selection can end the screen
WheelState GetWheelState() { return m_WheelState; }
bool WheelIsLocked() { return (m_WheelState == STATE_LOCKED ? true : false); }
void RebuildWheelItems( int dist = INT_MAX ); // INT_MAX = refresh all
@@ -83,15 +99,6 @@ protected:
RageTimer m_MovingSoundTimer;
float m_TimeBeforeMovingBegins;
float m_SpinSpeed;
enum WheelState {
STATE_SELECTING,
STATE_FLYING_OFF_BEFORE_NEXT_SORT,
STATE_FLYING_ON_AFTER_NEXT_SORT,
STATE_ROULETTE_SPINNING,
STATE_ROULETTE_SLOWING_DOWN,
STATE_RANDOM_SPINNING,
STATE_LOCKED,
};
WheelState m_WheelState;
float m_fTimeLeftInState;