More on the branch. NotesLoader/Writer set up.
This commit is contained in:
+10
-3
@@ -55,12 +55,19 @@ void SMLoader::LoadFromSMTokens(
|
|||||||
out.SetMeter( atoi(sMeter) );
|
out.SetMeter( atoi(sMeter) );
|
||||||
vector<RString> saValues;
|
vector<RString> saValues;
|
||||||
split( sRadarValues, ",", saValues, true );
|
split( sRadarValues, ",", saValues, true );
|
||||||
if( saValues.size() == NUM_RadarCategory * NUM_PLAYERS )
|
int categories = NUM_RadarCategory - 1; // Fakes aren't counted in the radar values.
|
||||||
|
if( saValues.size() == (unsigned)categories * NUM_PLAYERS )
|
||||||
{
|
{
|
||||||
RadarValues v[NUM_PLAYERS];
|
RadarValues v[NUM_PLAYERS];
|
||||||
FOREACH_PlayerNumber( pn )
|
FOREACH_PlayerNumber( pn )
|
||||||
FOREACH_ENUM( RadarCategory, rc )
|
{
|
||||||
v[pn][rc] = StringToFloat( saValues[pn*NUM_RadarCategory + rc] );
|
// Can't use the foreach anymore due to flexible radar lines.
|
||||||
|
for( RadarCategory rc = (RadarCategory)0; rc < categories;
|
||||||
|
enum_add<RadarCategory>( rc, 1 ) )
|
||||||
|
{
|
||||||
|
v[pn][rc] = StringToFloat( saValues[pn*categories + rc] );
|
||||||
|
}
|
||||||
|
}
|
||||||
out.SetCachedRadarValues( v );
|
out.SetCachedRadarValues( v );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+14
-3
@@ -658,12 +658,23 @@ bool SSCLoader::LoadFromSSCFile( const RString &sPath, Song &out, bool bFromCach
|
|||||||
{
|
{
|
||||||
vector<RString> saValues;
|
vector<RString> saValues;
|
||||||
split( sParams[1], ",", saValues, true );
|
split( sParams[1], ",", saValues, true );
|
||||||
if( saValues.size() == NUM_RadarCategory * NUM_PLAYERS )
|
|
||||||
|
int categories = NUM_RadarCategory;
|
||||||
|
if( out.m_fVersion < VERSION_RADAR_FAKE )
|
||||||
|
categories -= 1;
|
||||||
|
|
||||||
|
if( saValues.size() == (unsigned)categories * NUM_PLAYERS )
|
||||||
{
|
{
|
||||||
RadarValues v[NUM_PLAYERS];
|
RadarValues v[NUM_PLAYERS];
|
||||||
FOREACH_PlayerNumber( pn )
|
FOREACH_PlayerNumber( pn )
|
||||||
FOREACH_ENUM( RadarCategory, rc )
|
{
|
||||||
v[pn][rc] = StringToFloat( saValues[pn*NUM_RadarCategory + rc] );
|
// Can't use the foreach anymore due to flexible radar lines.
|
||||||
|
for( RadarCategory rc = (RadarCategory)0; rc < categories;
|
||||||
|
enum_add<RadarCategory>( rc, +1 ) )
|
||||||
|
{
|
||||||
|
v[pn][rc] = StringToFloat( saValues[pn*categories + rc] );
|
||||||
|
}
|
||||||
|
}
|
||||||
pNewNotes->SetCachedRadarValues( v );
|
pNewNotes->SetCachedRadarValues( v );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ enum SSCLoadingStates
|
|||||||
NUM_SSCLoadingStates /**< The number of states used. */
|
NUM_SSCLoadingStates /**< The number of states used. */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const float VERSION_RADAR_FAKE = 0.53f;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The SSCLoader handles all of the parsing needed for .ssc files.
|
* @brief The SSCLoader handles all of the parsing needed for .ssc files.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -273,11 +273,17 @@ static RString GetSMNotesTag( const Song &song, const Steps &in )
|
|||||||
lines.push_back( ssprintf( " %d:", in.GetMeter() ) );
|
lines.push_back( ssprintf( " %d:", in.GetMeter() ) );
|
||||||
|
|
||||||
vector<RString> asRadarValues;
|
vector<RString> asRadarValues;
|
||||||
|
// SM files don't use fakes for radar data. Keep it that way.
|
||||||
|
int categories = NUM_RadarCategory - 1;
|
||||||
FOREACH_PlayerNumber( pn )
|
FOREACH_PlayerNumber( pn )
|
||||||
{
|
{
|
||||||
const RadarValues &rv = in.GetRadarValues( pn );
|
const RadarValues &rv = in.GetRadarValues( pn );
|
||||||
FOREACH_ENUM( RadarCategory, rc )
|
// Can't use the foreach anymore due to flexible radar lines.
|
||||||
|
for( RadarCategory rc = (RadarCategory)0; rc < categories;
|
||||||
|
enum_add<RadarCategory>( rc, 1 ) )
|
||||||
|
{
|
||||||
asRadarValues.push_back( ssprintf("%.3f", rv[rc]) );
|
asRadarValues.push_back( ssprintf("%.3f", rv[rc]) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
lines.push_back( ssprintf( " %s:", join(",",asRadarValues).c_str() ) );
|
lines.push_back( ssprintf( " %s:", join(",",asRadarValues).c_str() ) );
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -37,12 +37,12 @@
|
|||||||
#include <float.h>
|
#include <float.h>
|
||||||
|
|
||||||
/** @brief The version of the .ssc file format. */
|
/** @brief The version of the .ssc file format. */
|
||||||
const static float VERSION_NUMBER = 0.52f;
|
const static float VERSION_NUMBER = 0.53f;
|
||||||
/**
|
/**
|
||||||
* @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 = 164;
|
const int FILE_CACHE_VERSION = 165;
|
||||||
|
|
||||||
/** @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