Some styling changes, don't expose some lua functions
This commit is contained in:
+27
-37
@@ -62,6 +62,7 @@ Steps::Steps(Song *song): m_StepsType(StepsType_Invalid), m_pSong(song),
|
|||||||
m_AreCachedNpsPerMeasureJustLoaded(false),
|
m_AreCachedNpsPerMeasureJustLoaded(false),
|
||||||
m_AreCachedNotesPerMeasureJustLoaded(false),
|
m_AreCachedNotesPerMeasureJustLoaded(false),
|
||||||
m_bIsCachedGrooveStatsHashJustLoaded(false),
|
m_bIsCachedGrooveStatsHashJustLoaded(false),
|
||||||
|
m_sGrooveStatsHash(""), m_iGrooveStatsHashVersion(0),
|
||||||
m_sCredit(""), displayBPMType(DISPLAY_BPM_ACTUAL),
|
m_sCredit(""), displayBPMType(DISPLAY_BPM_ACTUAL),
|
||||||
specifiedBPMMin(0), specifiedBPMMax(0) { }
|
specifiedBPMMin(0), specifiedBPMMax(0) { }
|
||||||
|
|
||||||
@@ -307,7 +308,7 @@ void Steps::CalculateStepStats( float fMusicLengthSeconds )
|
|||||||
this->CalculateRadarValues(fMusicLengthSeconds);
|
this->CalculateRadarValues(fMusicLengthSeconds);
|
||||||
this->CalculateTechCounts();
|
this->CalculateTechCounts();
|
||||||
this->CalculateMeasureInfo();
|
this->CalculateMeasureInfo();
|
||||||
this->CalculateGrooveStatsHash(false);
|
this->CalculateGrooveStatsHash();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Steps::CalculateRadarValues( float fMusicLengthSeconds )
|
void Steps::CalculateRadarValues( float fMusicLengthSeconds )
|
||||||
@@ -780,19 +781,24 @@ void Steps::SetPeakNps(std::vector<float> &peakNps)
|
|||||||
|
|
||||||
const RString Steps::GetGrooveStatsHash() const
|
const RString Steps::GetGrooveStatsHash() const
|
||||||
{
|
{
|
||||||
return GrooveStatsHash;
|
return m_sGrooveStatsHash;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Steps::GetGrooveStatsHashVersion() const
|
int Steps::GetGrooveStatsHashVersion() const
|
||||||
{
|
{
|
||||||
return GrooveStatsHashVersion;
|
return m_iGrooveStatsHashVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Steps::CalculateGrooveStatsHash(bool forceRecalculate)
|
void Steps::CalculateGrooveStatsHash()
|
||||||
{
|
{
|
||||||
if (!forceRecalculate
|
// When the game first boots up, it will load the GrooveStatsHash from the
|
||||||
&& GrooveStatsHashVersion == CURRENT_GROOVE_STATS_HASH_VERSION
|
// cache.
|
||||||
&& m_bIsCachedGrooveStatsHashJustLoaded == true)
|
// This should keep the initial boot snappy, especially since hashes should
|
||||||
|
// almost never change.
|
||||||
|
// If this function is then called again (say in ScreenEval), we can
|
||||||
|
// recalculate the hash and use that for submission.
|
||||||
|
if (m_iGrooveStatsHashVersion == CURRENT_GROOVE_STATS_HASH_VERSION &&
|
||||||
|
m_bIsCachedGrooveStatsHashJustLoaded == true)
|
||||||
{
|
{
|
||||||
m_bIsCachedGrooveStatsHashJustLoaded = false;
|
m_bIsCachedGrooveStatsHashJustLoaded = false;
|
||||||
return;
|
return;
|
||||||
@@ -818,8 +824,8 @@ void Steps::CalculateGrooveStatsHash(bool forceRecalculate)
|
|||||||
smNoteData.append(bpmString);
|
smNoteData.append(bpmString);
|
||||||
RString gsKey = BinaryToHex(CryptManager::GetSHA1ForString(smNoteData));
|
RString gsKey = BinaryToHex(CryptManager::GetSHA1ForString(smNoteData));
|
||||||
gsKey = gsKey.substr(0, 16);
|
gsKey = gsKey.substr(0, 16);
|
||||||
GrooveStatsHash = gsKey;
|
m_sGrooveStatsHash = gsKey;
|
||||||
GrooveStatsHashVersion = CURRENT_GROOVE_STATS_HASH_VERSION;
|
m_iGrooveStatsHashVersion = CURRENT_GROOVE_STATS_HASH_VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
RString Steps::MinimizedChartString()
|
RString Steps::MinimizedChartString()
|
||||||
@@ -917,15 +923,15 @@ RString Steps::MinimizedChartString()
|
|||||||
return minimizedNoteData;
|
return minimizedNoteData;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Steps::SetCachedGrooveStatsHash(const RString key)
|
void Steps::SetCachedGrooveStatsHash(const RString& key)
|
||||||
{
|
{
|
||||||
GrooveStatsHash = key;
|
m_sGrooveStatsHash = key;
|
||||||
m_bIsCachedGrooveStatsHashJustLoaded = true;
|
m_bIsCachedGrooveStatsHashJustLoaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Steps::SetCachedGrooveStatsHashVersion(int version)
|
void Steps::SetCachedGrooveStatsHashVersion(int version)
|
||||||
{
|
{
|
||||||
GrooveStatsHashVersion = version;
|
m_iGrooveStatsHashVersion = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
RString Steps::GenerateChartKey()
|
RString Steps::GenerateChartKey()
|
||||||
@@ -1123,7 +1129,7 @@ public:
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int GetNPSPerMeasure(T *p, lua_State *L)
|
static int GetNpsPerMeasure(T *p, lua_State *L)
|
||||||
{
|
{
|
||||||
PlayerNumber pn = PLAYER_1;
|
PlayerNumber pn = PLAYER_1;
|
||||||
if (!lua_isnil(L, 1)) {
|
if (!lua_isnil(L, 1)) {
|
||||||
@@ -1145,7 +1151,7 @@ public:
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int GetPeakNPS(T *p, lua_State *L)
|
static int GetPeakNps(T *p, lua_State *L)
|
||||||
{
|
{
|
||||||
PlayerNumber pn = PLAYER_1;
|
PlayerNumber pn = PLAYER_1;
|
||||||
if (!lua_isnil(L, 1)) {
|
if (!lua_isnil(L, 1)) {
|
||||||
@@ -1172,25 +1178,8 @@ public:
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int GetMinimizedChartString(T * p, lua_State *L)
|
|
||||||
{
|
|
||||||
lua_pushstring(L, p->MinimizedChartString());
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int GetGrooveStatsHash(T *p, lua_State *L)
|
static int GetGrooveStatsHash(T *p, lua_State *L)
|
||||||
{
|
{
|
||||||
if(p->GetGrooveStatsHash().empty())
|
|
||||||
{
|
|
||||||
p->CalculateGrooveStatsHash(true);
|
|
||||||
}
|
|
||||||
lua_pushstring(L, p->GetGrooveStatsHash());
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int CalculateGrooveStatsHash(T *p, lua_State *L)
|
|
||||||
{
|
|
||||||
p->CalculateGrooveStatsHash(true);
|
|
||||||
lua_pushstring(L, p->GetGrooveStatsHash());
|
lua_pushstring(L, p->GetGrooveStatsHash());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -1296,10 +1285,6 @@ public:
|
|||||||
ADD_METHOD( GetDifficulty );
|
ADD_METHOD( GetDifficulty );
|
||||||
ADD_METHOD( GetFilename );
|
ADD_METHOD( GetFilename );
|
||||||
ADD_METHOD( GetHash );
|
ADD_METHOD( GetHash );
|
||||||
ADD_METHOD( GetMinimizedChartString );
|
|
||||||
ADD_METHOD( GetGrooveStatsHash );
|
|
||||||
ADD_METHOD( CalculateGrooveStatsHash );
|
|
||||||
ADD_METHOD( GetGrooveStatsHashVersion );
|
|
||||||
ADD_METHOD( GetMeter );
|
ADD_METHOD( GetMeter );
|
||||||
ADD_METHOD( HasSignificantTimingChanges );
|
ADD_METHOD( HasSignificantTimingChanges );
|
||||||
ADD_METHOD( HasAttacks );
|
ADD_METHOD( HasAttacks );
|
||||||
@@ -1319,10 +1304,15 @@ public:
|
|||||||
ADD_METHOD( IsDisplayBpmRandom );
|
ADD_METHOD( IsDisplayBpmRandom );
|
||||||
ADD_METHOD( PredictMeter );
|
ADD_METHOD( PredictMeter );
|
||||||
ADD_METHOD( GetDisplayBPMType );
|
ADD_METHOD( GetDisplayBPMType );
|
||||||
|
// TODO: Below are experimental and may change in the future until we
|
||||||
|
// actually document them in lua.
|
||||||
|
// We expose them for testing purposes.
|
||||||
ADD_METHOD( GetColumnCues );
|
ADD_METHOD( GetColumnCues );
|
||||||
ADD_METHOD( GetNPSPerMeasure );
|
ADD_METHOD( GetNpsPerMeasure );
|
||||||
ADD_METHOD( GetNotesPerMeasure );
|
ADD_METHOD( GetNotesPerMeasure );
|
||||||
ADD_METHOD( GetPeakNPS );
|
ADD_METHOD( GetPeakNps );
|
||||||
|
ADD_METHOD( GetGrooveStatsHash );
|
||||||
|
ADD_METHOD( GetGrooveStatsHashVersion );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+4
-7
@@ -146,7 +146,7 @@ public:
|
|||||||
RString MinimizedChartString();
|
RString MinimizedChartString();
|
||||||
|
|
||||||
/** @brief Generates a hash used for GrooveStats integration. */
|
/** @brief Generates a hash used for GrooveStats integration. */
|
||||||
void CalculateGrooveStatsHash(bool forceRecalculate);
|
void CalculateGrooveStatsHash();
|
||||||
const RString GetGrooveStatsHash() const;
|
const RString GetGrooveStatsHash() const;
|
||||||
int GetGrooveStatsHashVersion() const;
|
int GetGrooveStatsHashVersion() const;
|
||||||
|
|
||||||
@@ -159,7 +159,7 @@ public:
|
|||||||
void SetCachedNpsPerMeasure(std::vector<std::vector<float>>& npsPerMeasure);
|
void SetCachedNpsPerMeasure(std::vector<std::vector<float>>& npsPerMeasure);
|
||||||
void SetCachedNotesPerMeasure(std::vector<std::vector<int>>& notesPerMeasure);
|
void SetCachedNotesPerMeasure(std::vector<std::vector<int>>& notesPerMeasure);
|
||||||
void SetPeakNps(std::vector<float>& peakNps);
|
void SetPeakNps(std::vector<float>& peakNps);
|
||||||
void SetCachedGrooveStatsHash(const RString key);
|
void SetCachedGrooveStatsHash(const RString& key);
|
||||||
void SetCachedGrooveStatsHashVersion(int version);
|
void SetCachedGrooveStatsHashVersion(int version);
|
||||||
float PredictMeter() const;
|
float PredictMeter() const;
|
||||||
|
|
||||||
@@ -306,12 +306,9 @@ private:
|
|||||||
|
|
||||||
std::vector<float> m_PeakNps;
|
std::vector<float> m_PeakNps;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
RString GrooveStatsHash;
|
|
||||||
bool m_bIsCachedGrooveStatsHashJustLoaded;
|
bool m_bIsCachedGrooveStatsHashJustLoaded;
|
||||||
int GrooveStatsHashVersion = 0;
|
RString m_sGrooveStatsHash;
|
||||||
|
int m_iGrooveStatsHashVersion;
|
||||||
|
|
||||||
/** @brief The name of the person who created the Steps. */
|
/** @brief The name of the person who created the Steps. */
|
||||||
RString m_sCredit;
|
RString m_sCredit;
|
||||||
|
|||||||
Reference in New Issue
Block a user