add Lua bindings
This commit is contained in:
@@ -1873,6 +1873,8 @@ public:
|
||||
p->ApplyGameCommand(SArg(1),pn);
|
||||
return 0;
|
||||
}
|
||||
static int GetCurrentSong( T* p, lua_State *L ) { if(p->m_pCurSong) p->m_pCurSong->PushSelf(L); else lua_pushnil(L); return 1; }
|
||||
static int SetCurrentSong( T* p, lua_State *L ) { Song *pS = Luna<Song>::check(L,1); p->m_pCurSong = pS; return 0; }
|
||||
static int GetCurrentCourse( T* p, lua_State *L ) { if(p->m_pCurCourse) p->m_pCurCourse->PushSelf(L); else lua_pushnil(L); return 1; }
|
||||
static int SetCurrentCourse( T* p, lua_State *L ) { Course *pC = Luna<Course>::check(L,1); p->m_pCurCourse = pC; return 0; }
|
||||
static int SetTemporaryEventMode( T* p, lua_State *L ) { p->m_bTemporaryEventMode = BArg(1); return 0; }
|
||||
@@ -1884,6 +1886,8 @@ public:
|
||||
ADD_METHOD( GetPlayerDisplayName )
|
||||
ADD_METHOD( GetMasterPlayerNumber )
|
||||
ADD_METHOD( ApplyGameCommand )
|
||||
ADD_METHOD( GetCurrentSong )
|
||||
ADD_METHOD( SetCurrentSong )
|
||||
ADD_METHOD( GetCurrentCourse )
|
||||
ADD_METHOD( SetCurrentCourse )
|
||||
ADD_METHOD( SetTemporaryEventMode )
|
||||
|
||||
@@ -1404,6 +1404,38 @@ bool Song::HasSignificantBpmChangesOrStops() const
|
||||
return m_Timing.HasBpmChangesOrStops();
|
||||
}
|
||||
|
||||
|
||||
// lua start
|
||||
#include "LuaBinding.h"
|
||||
|
||||
template<class T>
|
||||
class LunaSong : public Luna<T>
|
||||
{
|
||||
public:
|
||||
LunaSong() { LUA->Register( Register ); }
|
||||
|
||||
static int GetFullDisplayTitle( T* p, lua_State *L ) { lua_pushstring(L, p->GetFullDisplayTitle() ); return 1; }
|
||||
static int GetFullTranslitTitle( T* p, lua_State *L ) { lua_pushstring(L, p->GetFullTranslitTitle() ); return 1; }
|
||||
static int GetAllSteps( T* p, lua_State *L )
|
||||
{
|
||||
const vector<Steps*> &v = p->GetAllSteps();
|
||||
CreateTableFromArray<Steps*>( v, L );
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void Register(lua_State *L)
|
||||
{
|
||||
ADD_METHOD( GetFullDisplayTitle )
|
||||
ADD_METHOD( GetFullTranslitTitle )
|
||||
ADD_METHOD( GetAllSteps )
|
||||
Luna<T>::Register( L );
|
||||
}
|
||||
};
|
||||
|
||||
LUA_REGISTER_CLASS( Song )
|
||||
// lua end
|
||||
|
||||
|
||||
/*
|
||||
* (c) 2001-2004 Chris Danford, Glenn Maynard
|
||||
* All rights reserved.
|
||||
|
||||
@@ -326,6 +326,31 @@ void Steps::SetRadarValues( const RadarValues& v )
|
||||
m_RadarValues = v;
|
||||
}
|
||||
|
||||
|
||||
// lua start
|
||||
#include "LuaBinding.h"
|
||||
|
||||
template<class T>
|
||||
class LunaSteps : public Luna<T>
|
||||
{
|
||||
public:
|
||||
LunaSteps() { LUA->Register( Register ); }
|
||||
|
||||
static int GetStepsType( T* p, lua_State *L ) { lua_pushnumber(L, p->m_StepsType ); return 1; }
|
||||
static int GetDescription( T* p, lua_State *L ) { lua_pushstring(L, p->GetDescription() ); return 1; }
|
||||
|
||||
static void Register(lua_State *L)
|
||||
{
|
||||
ADD_METHOD( GetStepsType )
|
||||
ADD_METHOD( GetDescription )
|
||||
Luna<T>::Register( L );
|
||||
}
|
||||
};
|
||||
|
||||
LUA_REGISTER_CLASS( Steps )
|
||||
// lua end
|
||||
|
||||
|
||||
/*
|
||||
* (c) 2001-2004 Chris Danford, Glenn Maynard, David Wilson
|
||||
* All rights reserved.
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "Difficulty.h"
|
||||
class NoteData;
|
||||
class Profile;
|
||||
struct lua_State;
|
||||
|
||||
class Steps
|
||||
{
|
||||
@@ -55,6 +56,9 @@ public:
|
||||
|
||||
void TidyUpData();
|
||||
|
||||
// Lua
|
||||
void PushSelf( lua_State *L );
|
||||
|
||||
protected:
|
||||
/* If this Steps is autogenerated, this will point to the autogen
|
||||
* source. If this is true, notes_comp will always be NULL. */
|
||||
|
||||
@@ -15,6 +15,7 @@ class NotesLoader;
|
||||
class LyricsLoader;
|
||||
class Profile;
|
||||
class StepsID;
|
||||
struct lua_State;
|
||||
|
||||
#define MAX_EDITS_PER_SONG_PER_PROFILE 5
|
||||
#define MAX_EDITS_PER_SONG 5*NUM_PROFILE_SLOTS
|
||||
@@ -224,6 +225,9 @@ public:
|
||||
// means "this note doens't have a keysound".
|
||||
vector<CString> m_vsKeysoundFile;
|
||||
|
||||
// Lua
|
||||
void PushSelf( lua_State *L );
|
||||
|
||||
private:
|
||||
void AdjustDuplicateSteps(); // part of TidyUpData
|
||||
void DeleteDuplicateSteps( vector<Steps*> &vSteps );
|
||||
|
||||
Reference in New Issue
Block a user