Added methods to load/write tech counts to cache.
This commit is contained in:
@@ -384,6 +384,30 @@ void SetRadarValues(StepsTagInfo& info)
|
|||||||
info.ssc_format= true;
|
info.ssc_format= true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetTechCounts(StepsTagInfo& info)
|
||||||
|
{
|
||||||
|
if (info.from_cache || info.for_load_edit)
|
||||||
|
{
|
||||||
|
std::vector<RString> values;
|
||||||
|
split((*info.params)[1], ",", values, true);
|
||||||
|
std::size_t cats_per_player= values.size() / NUM_PlayerNumber;
|
||||||
|
TechCounts v[NUM_PLAYERS];
|
||||||
|
FOREACH_PlayerNumber(pn)
|
||||||
|
{
|
||||||
|
for(std::size_t i= 0; i < cats_per_player; ++i)
|
||||||
|
{
|
||||||
|
v[pn][i]= StringToFloat(values[pn * cats_per_player + i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
info.steps->SetCachedTechCounts(v);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// just recalc at time.
|
||||||
|
}
|
||||||
|
info.ssc_format= true;
|
||||||
|
}
|
||||||
|
|
||||||
void SetMeasureInfo(StepsTagInfo& info)
|
void SetMeasureInfo(StepsTagInfo& info)
|
||||||
{
|
{
|
||||||
if (info.from_cache || info.for_load_edit)
|
if (info.from_cache || info.for_load_edit)
|
||||||
@@ -406,6 +430,15 @@ void SetMeasureInfo(StepsTagInfo& info)
|
|||||||
info.ssc_format= true;
|
info.ssc_format= true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetGrooveStatsHash(StepsTagInfo& info)
|
||||||
|
{
|
||||||
|
if (info.from_cache || info.for_load_edit)
|
||||||
|
{
|
||||||
|
RString value = (*info.params)[1];
|
||||||
|
info.steps->SetCachedGrooveStatsHash(value);
|
||||||
|
}
|
||||||
|
info.ssc_format = true;
|
||||||
|
}
|
||||||
|
|
||||||
void SetCredit(StepsTagInfo& info)
|
void SetCredit(StepsTagInfo& info)
|
||||||
{
|
{
|
||||||
@@ -647,6 +680,7 @@ struct ssc_parser_helper_t
|
|||||||
steps_tag_handlers["SCROLLS"]= &SetStepsScrolls;
|
steps_tag_handlers["SCROLLS"]= &SetStepsScrolls;
|
||||||
steps_tag_handlers["FAKES"]= &SetStepsFakes;
|
steps_tag_handlers["FAKES"]= &SetStepsFakes;
|
||||||
steps_tag_handlers["LABELS"]= &SetStepsLabels;
|
steps_tag_handlers["LABELS"]= &SetStepsLabels;
|
||||||
|
steps_tag_handlers["TECHCOUNTS"] = &SetTechCounts;
|
||||||
steps_tag_handlers["MEASUREINFO"] = &SetMeasureInfo;
|
steps_tag_handlers["MEASUREINFO"] = &SetMeasureInfo;
|
||||||
|
|
||||||
/* If this is called, the chart does not use the same attacks
|
/* If this is called, the chart does not use the same attacks
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ const float VERSION_CHART_NAME_TAG = 0.74f;
|
|||||||
const float VERSION_CACHE_SWITCH_TAG = 0.77f;
|
const float VERSION_CACHE_SWITCH_TAG = 0.77f;
|
||||||
/** @brief The version where note count was added as a radar category. */
|
/** @brief The version where note count was added as a radar category. */
|
||||||
const float VERSION_RADAR_NOTECOUNT = 0.83f;
|
const float VERSION_RADAR_NOTECOUNT = 0.83f;
|
||||||
|
/** @brief The version where tech stats, measure stats, and GrooveStats key were added. */
|
||||||
|
const float VERSION_TECH_STATS = 0.84f;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The SSCLoader handles all of the parsing needed for .ssc files.
|
* @brief The SSCLoader handles all of the parsing needed for .ssc files.
|
||||||
|
|||||||
@@ -428,6 +428,18 @@ static RString GetSSCNoteData( const Song &song, const Steps &in, bool bSavingCa
|
|||||||
}
|
}
|
||||||
if (bSavingCache)
|
if (bSavingCache)
|
||||||
{
|
{
|
||||||
|
lines.push_back( ssprintf( "// step cache tags:" ) );
|
||||||
|
std::vector<RString> asTechCounts;
|
||||||
|
FOREACH_PlayerNumber( pn )
|
||||||
|
{
|
||||||
|
const TechCounts &ts = in.GetTechCounts(pn);
|
||||||
|
FOREACH_ENUM( TechCountsCategory, tc )
|
||||||
|
{
|
||||||
|
asTechCounts.push_back(ssprintf("%.6f", ts[tc]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lines.push_back(ssprintf("#TECHCOUNTS:%s;", join(",", asTechCounts).c_str()));
|
||||||
|
|
||||||
std::vector<RString> asMeasureInfo;
|
std::vector<RString> asMeasureInfo;
|
||||||
FOREACH_PlayerNumber( pn )
|
FOREACH_PlayerNumber( pn )
|
||||||
{
|
{
|
||||||
@@ -436,7 +448,13 @@ static RString GetSSCNoteData( const Song &song, const Steps &in, bool bSavingCa
|
|||||||
}
|
}
|
||||||
lines.push_back(ssprintf("#MEASUREINFO:%s;", join("|", asMeasureInfo).c_str()));
|
lines.push_back(ssprintf("#MEASUREINFO:%s;", join("|", asMeasureInfo).c_str()));
|
||||||
|
|
||||||
|
// MV: #STEPFILENAME has to be at the end of the cache tags,
|
||||||
|
// because it's used in SSCLoader::LoadFromSimfile to determine when
|
||||||
|
// to switch the state back to GETTING_SONG_INFO, which means any tags
|
||||||
|
// after it will be ignored.
|
||||||
|
|
||||||
lines.push_back(ssprintf("#STEPFILENAME:%s;", in.GetFilename().c_str()));
|
lines.push_back(ssprintf("#STEPFILENAME:%s;", in.GetFilename().c_str()));
|
||||||
|
lines.push_back( ssprintf( "// end step cache tags" ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -51,7 +51,7 @@
|
|||||||
* @brief The internal version of the cache for StepMania.
|
* @brief The internal version of the cache for StepMania.
|
||||||
*
|
*
|
||||||
* Increment this value to invalidate the current cache. */
|
* Increment this value to invalidate the current cache. */
|
||||||
const int FILE_CACHE_VERSION = 227;
|
const int FILE_CACHE_VERSION = 232;
|
||||||
|
|
||||||
/** @brief How long does a song sample last by default? */
|
/** @brief How long does a song sample last by default? */
|
||||||
const float DEFAULT_MUSIC_SAMPLE_LENGTH = 12.f;
|
const float DEFAULT_MUSIC_SAMPLE_LENGTH = 12.f;
|
||||||
|
|||||||
Reference in New Issue
Block a user