Merge pull request #42 from kyzentun/combo_list_and_life_record
Added GetComboList and GetLifeRecord to PlayerStageStats.
This commit is contained in:
@@ -1108,6 +1108,7 @@
|
|||||||
<Function name='GetAliveSeconds'/>
|
<Function name='GetAliveSeconds'/>
|
||||||
<Function name='GetBestFullComboTapNoteScore'/>
|
<Function name='GetBestFullComboTapNoteScore'/>
|
||||||
<Function name='GetCaloriesBurned'/>
|
<Function name='GetCaloriesBurned'/>
|
||||||
|
<Function name='GetComboList'/>
|
||||||
<Function name='GetCurMaxScore'/>
|
<Function name='GetCurMaxScore'/>
|
||||||
<Function name='GetCurrentCombo'/>
|
<Function name='GetCurrentCombo'/>
|
||||||
<Function name='GetCurrentLife'/>
|
<Function name='GetCurrentLife'/>
|
||||||
@@ -1119,6 +1120,7 @@
|
|||||||
<Function name='GetHoldNoteScores'/>
|
<Function name='GetHoldNoteScores'/>
|
||||||
<Function name='GetLessonScoreActual'/>
|
<Function name='GetLessonScoreActual'/>
|
||||||
<Function name='GetLessonScoreNeeded'/>
|
<Function name='GetLessonScoreNeeded'/>
|
||||||
|
<Function name='GetLifeRecord'/>
|
||||||
<Function name='GetLifeRemainingSeconds'/>
|
<Function name='GetLifeRemainingSeconds'/>
|
||||||
<Function name='GetMachineHighScoreIndex'/>
|
<Function name='GetMachineHighScoreIndex'/>
|
||||||
<Function name='GetNumControllerSteps'/>
|
<Function name='GetNumControllerSteps'/>
|
||||||
|
|||||||
@@ -3222,6 +3222,9 @@ save yourself some time, copy this for undocumented things:
|
|||||||
<Function name='GetCaloriesBurned' return='float' arguments=''>
|
<Function name='GetCaloriesBurned' return='float' arguments=''>
|
||||||
Returns the number of calories burned.
|
Returns the number of calories burned.
|
||||||
</Function>
|
</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=''>
|
<Function name='GetCurMaxScore' return='int' arguments=''>
|
||||||
Returns the current possible maximum score.
|
Returns the current possible maximum score.
|
||||||
</Function>
|
</Function>
|
||||||
@@ -3255,6 +3258,11 @@ save yourself some time, copy this for undocumented things:
|
|||||||
<Function name='GetLessonScoreNeeded' return='int' arguments=''>
|
<Function name='GetLessonScoreNeeded' return='int' arguments=''>
|
||||||
Returns the score needed to pass the lesson.
|
Returns the score needed to pass the lesson.
|
||||||
</Function>
|
</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=''>
|
<Function name='GetLifeRemainingSeconds' return='float' arguments=''>
|
||||||
Returns the player's life remaining seconds.
|
Returns the player's life remaining seconds.
|
||||||
</Function>
|
</Function>
|
||||||
|
|||||||
@@ -741,6 +741,58 @@ public:
|
|||||||
}
|
}
|
||||||
return 1;
|
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 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; }
|
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( IsDisqualified );
|
||||||
ADD_METHOD( GetPlayedSteps );
|
ADD_METHOD( GetPlayedSteps );
|
||||||
ADD_METHOD( GetPossibleSteps );
|
ADD_METHOD( GetPossibleSteps );
|
||||||
|
ADD_METHOD( GetComboList );
|
||||||
|
ADD_METHOD( GetLifeRecord );
|
||||||
ADD_METHOD( GetAliveSeconds );
|
ADD_METHOD( GetAliveSeconds );
|
||||||
ADD_METHOD( GetPercentageOfTaps );
|
ADD_METHOD( GetPercentageOfTaps );
|
||||||
ADD_METHOD( GetRadarActual );
|
ADD_METHOD( GetRadarActual );
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ public:
|
|||||||
|
|
||||||
struct Combo_t
|
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.
|
* @brief The start time of the combo.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user