add character bindings to remove special cases in ScreenStage
This commit is contained in:
@@ -163,6 +163,26 @@ bool Character::Has2DElems()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// lua start
|
||||||
|
#include "LuaBinding.h"
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
class LunaCharacter : public Luna<T>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LunaCharacter() { LUA->Register( Register ); }
|
||||||
|
|
||||||
|
static int GetStageIconPath( T* p, lua_State *L ) { lua_pushstring(L, p->GetStageIconPath() ); return 1; }
|
||||||
|
static void Register( Lua *L )
|
||||||
|
{
|
||||||
|
ADD_METHOD( GetStageIconPath )
|
||||||
|
Luna<T>::Register( L );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
LUA_REGISTER_CLASS( Character )
|
||||||
|
// lua end
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (c) 2003 Chris Danford
|
* (c) 2003 Chris Danford
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
#define Character_H
|
#define Character_H
|
||||||
|
|
||||||
#include "GameConstantsAndTypes.h"
|
#include "GameConstantsAndTypes.h"
|
||||||
|
struct lua_State;
|
||||||
|
typedef lua_State Lua;
|
||||||
|
|
||||||
|
|
||||||
class Character
|
class Character
|
||||||
@@ -25,6 +27,10 @@ public:
|
|||||||
CString GetStageIconPath() const;
|
CString GetStageIconPath() const;
|
||||||
bool Has2DElems();
|
bool Has2DElems();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Lua
|
||||||
|
//
|
||||||
|
virtual void PushSelf( Lua *L );
|
||||||
|
|
||||||
CString m_sCharDir;
|
CString m_sCharDir;
|
||||||
CString m_sName;
|
CString m_sName;
|
||||||
|
|||||||
@@ -2059,6 +2059,16 @@ public:
|
|||||||
}
|
}
|
||||||
static int GetPreferredDifficulty( T* p, lua_State *L ) { lua_pushnumber(L, p->m_PreferredDifficulty[IArg(1)] ); return 1; }
|
static int GetPreferredDifficulty( T* p, lua_State *L ) { lua_pushnumber(L, p->m_PreferredDifficulty[IArg(1)] ); return 1; }
|
||||||
static int AnyPlayerHasRankingFeats( T* p, lua_State *L ) { lua_pushboolean(L, p->AnyPlayerHasRankingFeats() ); return 1; }
|
static int AnyPlayerHasRankingFeats( T* p, lua_State *L ) { lua_pushboolean(L, p->AnyPlayerHasRankingFeats() ); return 1; }
|
||||||
|
static int GetCharacter( T* p, lua_State *L )
|
||||||
|
{
|
||||||
|
Character *pCharacter = p->m_pCurCharacters[IArg(1)];
|
||||||
|
if( pCharacter != NULL )
|
||||||
|
pCharacter->PushSelf( L );
|
||||||
|
else
|
||||||
|
lua_pushnil( L );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
static int IsCourseMode( T* p, lua_State *L ) { lua_pushboolean(L, p->IsCourseMode() ); return 1; }
|
static int IsCourseMode( T* p, lua_State *L ) { lua_pushboolean(L, p->IsCourseMode() ); return 1; }
|
||||||
static int IsDemonstration( T* p, lua_State *L ) { lua_pushboolean(L, p->m_bDemonstrationOrJukebox ); return 1; }
|
static int IsDemonstration( T* p, lua_State *L ) { lua_pushboolean(L, p->m_bDemonstrationOrJukebox ); return 1; }
|
||||||
static int GetPlayMode( T* p, lua_State *L ) { lua_pushnumber(L, p->m_PlayMode ); return 1; }
|
static int GetPlayMode( T* p, lua_State *L ) { lua_pushnumber(L, p->m_PlayMode ); return 1; }
|
||||||
@@ -2111,6 +2121,7 @@ public:
|
|||||||
ADD_METHOD( GetEditSourceSteps )
|
ADD_METHOD( GetEditSourceSteps )
|
||||||
ADD_METHOD( GetPreferredDifficulty )
|
ADD_METHOD( GetPreferredDifficulty )
|
||||||
ADD_METHOD( AnyPlayerHasRankingFeats )
|
ADD_METHOD( AnyPlayerHasRankingFeats )
|
||||||
|
ADD_METHOD( GetCharacter )
|
||||||
ADD_METHOD( IsCourseMode )
|
ADD_METHOD( IsCourseMode )
|
||||||
ADD_METHOD( IsDemonstration )
|
ADD_METHOD( IsDemonstration )
|
||||||
ADD_METHOD( GetPlayMode )
|
ADD_METHOD( GetPlayMode )
|
||||||
|
|||||||
Reference in New Issue
Block a user