Added GetComboList and GetLifeRecord to PlayerStageStats.

This commit is contained in:
Kyzentun
2014-02-12 16:19:16 -07:00
parent 3f1c96d10f
commit 17ea38576c
4 changed files with 65 additions and 0 deletions
+2
View File
@@ -1107,6 +1107,7 @@
<Function name='GetAliveSeconds'/>
<Function name='GetBestFullComboTapNoteScore'/>
<Function name='GetCaloriesBurned'/>
<Function name='GetComboList'/>
<Function name='GetCurMaxScore'/>
<Function name='GetCurrentCombo'/>
<Function name='GetCurrentLife'/>
@@ -1118,6 +1119,7 @@
<Function name='GetHoldNoteScores'/>
<Function name='GetLessonScoreActual'/>
<Function name='GetLessonScoreNeeded'/>
<Function name='GetLifeRecord'/>
<Function name='GetLifeRemainingSeconds'/>
<Function name='GetMachineHighScoreIndex'/>
<Function name='GetNumControllerSteps'/>
+8
View File
@@ -3217,6 +3217,9 @@ save yourself some time, copy this for undocumented things:
<Function name='GetCaloriesBurned' return='float' arguments=''>
Returns the number of calories burned.
</Function>
<Function name='GetComboList' return= '{combo}' arguments=''>
Returns a table of all the combos. Each entry in the table is a table containing the StartSecond, SizeSeconds, Count, Rollover, StageCount, and IsZero information for that combo.
</Function>
<Function name='GetCurMaxScore' return='int' arguments=''>
Returns the current possible maximum score.
</Function>
@@ -3250,6 +3253,11 @@ save yourself some time, copy this for undocumented things:
<Function name='GetLessonScoreNeeded' return='int' arguments=''>
Returns the score needed to pass the lesson.
</Function>
<Function name='GetLifeRecord' return='{float}' arguments='float last_second, int samples'>
Returns table of samples of the life record from 0 to last_second.
'samples' determines the size of the table. 'samples' defaults to 100
if not specified.
</Function>
<Function name='GetLifeRemainingSeconds' return='float' arguments=''>
Returns the player's life remaining seconds.
</Function>
+54
View File
@@ -741,6 +741,58 @@ public:
}
return 1;
}
static int GetComboList( T* p, lua_State *L )
{
lua_createtable(L, p->m_ComboList.size(), 0);
for( size_t i= 0; i < p->m_ComboList.size(); ++i)
{
lua_createtable(L, 0, 6);
lua_pushstring(L, "StartSecond");
lua_pushnumber(L, p->m_ComboList[i].m_fStartSecond);
lua_rawset(L, -3);
lua_pushstring(L, "SizeSeconds");
lua_pushnumber(L, p->m_ComboList[i].m_fSizeSeconds);
lua_rawset(L, -3);
lua_pushstring(L, "Count");
lua_pushnumber(L, p->m_ComboList[i].m_cnt);
lua_rawset(L, -3);
lua_pushstring(L, "Rollover");
lua_pushnumber(L, p->m_ComboList[i].m_rollover);
lua_rawset(L, -3);
lua_pushstring(L, "StageCount");
lua_pushnumber(L, p->m_ComboList[i].GetStageCnt());
lua_rawset(L, -3);
lua_pushstring(L, "IsZero");
lua_pushnumber(L, p->m_ComboList[i].IsZero());
lua_rawset(L, -3);
lua_rawseti(L, -2, i+1);
}
return 1;
}
static int GetLifeRecord( T* p, lua_State *L )
{
float last_second= FArg(1);
int samples= 100;
if (lua_gettop(L) >= 2 && !lua_isnil(L,2))
{
samples= IArg(2);
if(samples <= 0)
{
LOG->Trace("PlayerStageStats:GetLifeRecord requires an integer greater than 0. Defaulting to 100.");
samples= 100;
}
}
lua_createtable(L, samples, 0);
for(int i= 0; i < samples; ++i)
{
// The scale from range is [0, samples-1] because that is i's range.
float from= SCALE(i, 0, (float)samples-1.0f, 0.0f, last_second);
float curr= p->GetLifeRecordLerpAt(from);
lua_pushnumber(L, curr);
lua_rawseti(L, -2, i+1);
}
return 1;
}
static int GetRadarPossible( T* p, lua_State *L ) { p->m_radarPossible.PushSelf(L); return 1; }
static int GetRadarActual( T* p, lua_State *L ) { p->m_radarActual.PushSelf(L); return 1; }
@@ -800,6 +852,8 @@ public:
ADD_METHOD( IsDisqualified );
ADD_METHOD( GetPlayedSteps );
ADD_METHOD( GetPossibleSteps );
ADD_METHOD( GetComboList );
ADD_METHOD( GetLifeRecord );
ADD_METHOD( GetAliveSeconds );
ADD_METHOD( GetPercentageOfTaps );
ADD_METHOD( GetRadarActual );
+1
View File
@@ -99,6 +99,7 @@ public:
struct Combo_t
{
// Update GetComboList in PlayerStageStats.cpp when adding new members that should be visible from the Lua side.
/**
* @brief The start time of the combo.
*