add Lua binding
This commit is contained in:
@@ -377,6 +377,28 @@ float PlayerStageStats::GetPercentageOfTaps( TapNoteScore tns ) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// lua start
|
||||||
|
#include "LuaBinding.h"
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
class LunaPlayerStageStats : public Luna<T>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LunaPlayerStageStats() { LUA->Register( Register ); }
|
||||||
|
|
||||||
|
static int GetCaloriesBurned( T* p, lua_State *L ) { lua_pushnumber(L, p->fCaloriesBurned ); return 1; }
|
||||||
|
|
||||||
|
static void Register(lua_State *L)
|
||||||
|
{
|
||||||
|
ADD_METHOD( GetCaloriesBurned )
|
||||||
|
Luna<T>::Register( L );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
LUA_REGISTER_CLASS( PlayerStageStats )
|
||||||
|
// lua end
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (c) 2001-2004 Chris Danford, Glenn Maynard
|
* (c) 2001-2004 Chris Danford, Glenn Maynard
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
#include "RadarValues.h"
|
#include "RadarValues.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
class Steps;
|
class Steps;
|
||||||
|
struct lua_State;
|
||||||
|
|
||||||
|
|
||||||
struct PlayerStageStats
|
struct PlayerStageStats
|
||||||
{
|
{
|
||||||
@@ -88,6 +90,9 @@ struct PlayerStageStats
|
|||||||
float GetPercentageOfTaps( TapNoteScore tns ) const;
|
float GetPercentageOfTaps( TapNoteScore tns ) const;
|
||||||
void UpdateComboList( float fSecond, bool rollover );
|
void UpdateComboList( float fSecond, bool rollover );
|
||||||
Combo_t GetMaxCombo() const;
|
Combo_t GetMaxCombo() const;
|
||||||
|
|
||||||
|
// Lua
|
||||||
|
void PushSelf( lua_State *L );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -81,6 +81,33 @@ bool StageStats::AllFailedEarlier() const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// lua start
|
||||||
|
#include "LuaBinding.h"
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
class LunaStageStats : public Luna<T>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LunaStageStats() { LUA->Register( Register ); }
|
||||||
|
|
||||||
|
static int GetPlayerStageStats( T* p, lua_State *L ) { p->m_player[IArg(1)].PushSelf(L); return 1; }
|
||||||
|
|
||||||
|
static void Register(lua_State *L)
|
||||||
|
{
|
||||||
|
ADD_METHOD( GetPlayerStageStats )
|
||||||
|
Luna<T>::Register( L );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
LUA_REGISTER_CLASS( StageStats )
|
||||||
|
// lua end
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Old Lua
|
||||||
|
//
|
||||||
|
|
||||||
static Grade GetBestGrade()
|
static Grade GetBestGrade()
|
||||||
{
|
{
|
||||||
Grade g = NUM_GRADES;
|
Grade g = NUM_GRADES;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include "PlayerStageStats.h"
|
#include "PlayerStageStats.h"
|
||||||
class Song;
|
class Song;
|
||||||
class Style;
|
class Style;
|
||||||
|
struct lua_State;
|
||||||
|
|
||||||
|
|
||||||
struct StageStats
|
struct StageStats
|
||||||
@@ -31,6 +32,9 @@ struct StageStats
|
|||||||
float fGameplaySeconds; // how many seconds before gameplay ended. Updated by Gameplay, not scaled by music rate.
|
float fGameplaySeconds; // how many seconds before gameplay ended. Updated by Gameplay, not scaled by music rate.
|
||||||
|
|
||||||
PlayerStageStats m_player[NUM_PLAYERS];
|
PlayerStageStats m_player[NUM_PLAYERS];
|
||||||
|
|
||||||
|
// Lua
|
||||||
|
void PushSelf( lua_State *L );
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user