[splittiming] Abstract unused(?) #ATTACKS.
This commit is contained in:
+46
-41
@@ -128,6 +128,51 @@ void SMLoader::ProcessBGChanges( Song &out, const RString &sValueName, const RSt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SMLoader::ProcessAttacks( Song &out, MsdFile::value_t sParams )
|
||||||
|
{
|
||||||
|
// Build the RString vector here so we can write it to file again later
|
||||||
|
for( unsigned s=1; s < sParams.params.size(); ++s )
|
||||||
|
out.m_sAttackString.push_back( sParams[s] );
|
||||||
|
|
||||||
|
Attack attack;
|
||||||
|
float end = -9999;
|
||||||
|
|
||||||
|
for( unsigned j=1; j < sParams.params.size(); ++j )
|
||||||
|
{
|
||||||
|
vector<RString> sBits;
|
||||||
|
split( sParams[j], "=", sBits, false );
|
||||||
|
|
||||||
|
// Need an identifer and a value for this to work
|
||||||
|
if( sBits.size() < 2 )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
TrimLeft( sBits[0] );
|
||||||
|
TrimRight( sBits[0] );
|
||||||
|
|
||||||
|
if( !sBits[0].CompareNoCase("TIME") )
|
||||||
|
attack.fStartSecond = strtof( sBits[1], NULL );
|
||||||
|
else if( !sBits[0].CompareNoCase("LEN") )
|
||||||
|
attack.fSecsRemaining = strtof( sBits[1], NULL );
|
||||||
|
else if( !sBits[0].CompareNoCase("END") )
|
||||||
|
end = strtof( sBits[1], NULL );
|
||||||
|
else if( !sBits[0].CompareNoCase("MODS") )
|
||||||
|
{
|
||||||
|
attack.sModifiers = sBits[1];
|
||||||
|
|
||||||
|
if( end != -9999 )
|
||||||
|
{
|
||||||
|
attack.fSecsRemaining = end - attack.fStartSecond;
|
||||||
|
end = -9999;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( attack.fSecsRemaining < 0.0f )
|
||||||
|
attack.fSecsRemaining = 0.0f;
|
||||||
|
|
||||||
|
out.m_Attacks.push_back( attack );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool SMLoader::ProcessBPMs( TimingData &out, const RString sParam )
|
bool SMLoader::ProcessBPMs( TimingData &out, const RString sParam )
|
||||||
{
|
{
|
||||||
vector<RString> arrayBPMChangeExpressions;
|
vector<RString> arrayBPMChangeExpressions;
|
||||||
@@ -681,47 +726,7 @@ bool SMLoader::LoadFromSMFile( const RString &sPath, Song &out, bool bFromCache
|
|||||||
// Attacks loaded from file
|
// Attacks loaded from file
|
||||||
else if( sValueName=="ATTACKS" )
|
else if( sValueName=="ATTACKS" )
|
||||||
{
|
{
|
||||||
// Build the RString vector here so we can write it to file again later
|
ProcessAttacks( out, sParams );
|
||||||
for( unsigned s=1; s < sParams.params.size(); ++s )
|
|
||||||
out.m_sAttackString.push_back( sParams[s] );
|
|
||||||
|
|
||||||
Attack attack;
|
|
||||||
float end = -9999;
|
|
||||||
|
|
||||||
for( unsigned j=1; j < sParams.params.size(); ++j )
|
|
||||||
{
|
|
||||||
vector<RString> sBits;
|
|
||||||
split( sParams[j], "=", sBits, false );
|
|
||||||
|
|
||||||
// Need an identifer and a value for this to work
|
|
||||||
if( sBits.size() < 2 )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
TrimLeft( sBits[0] );
|
|
||||||
TrimRight( sBits[0] );
|
|
||||||
|
|
||||||
if( !sBits[0].CompareNoCase("TIME") )
|
|
||||||
attack.fStartSecond = strtof( sBits[1], NULL );
|
|
||||||
else if( !sBits[0].CompareNoCase("LEN") )
|
|
||||||
attack.fSecsRemaining = strtof( sBits[1], NULL );
|
|
||||||
else if( !sBits[0].CompareNoCase("END") )
|
|
||||||
end = strtof( sBits[1], NULL );
|
|
||||||
else if( !sBits[0].CompareNoCase("MODS") )
|
|
||||||
{
|
|
||||||
attack.sModifiers = sBits[1];
|
|
||||||
|
|
||||||
if( end != -9999 )
|
|
||||||
{
|
|
||||||
attack.fSecsRemaining = end - attack.fStartSecond;
|
|
||||||
end = -9999;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( attack.fSecsRemaining < 0.0f )
|
|
||||||
attack.fSecsRemaining = 0.0f;
|
|
||||||
|
|
||||||
out.m_Attacks.push_back( attack );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( sValueName=="NOTES" || sValueName=="NOTES2" )
|
else if( sValueName=="NOTES" || sValueName=="NOTES2" )
|
||||||
|
|||||||
+2
-1
@@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
#include "GameConstantsAndTypes.h"
|
#include "GameConstantsAndTypes.h"
|
||||||
#include "BackgroundUtil.h"
|
#include "BackgroundUtil.h"
|
||||||
|
#include "MsdFile.h" // we require the struct from here.
|
||||||
|
|
||||||
class MsdFile;
|
|
||||||
class Song;
|
class Song;
|
||||||
class Steps;
|
class Steps;
|
||||||
class TimingData;
|
class TimingData;
|
||||||
@@ -34,6 +34,7 @@ namespace SMLoader
|
|||||||
void ProcessTickcounts( TimingData &, const RString );
|
void ProcessTickcounts( TimingData &, const RString );
|
||||||
void ProcessBGChanges( Song &out, const RString &sValueName,
|
void ProcessBGChanges( Song &out, const RString &sValueName,
|
||||||
const RString &sPath, const RString &sParam );
|
const RString &sPath, const RString &sParam );
|
||||||
|
void ProcessAttacks( Song &out, MsdFile::value_t sParams );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+1
-41
@@ -296,47 +296,7 @@ bool SMALoader::LoadFromSMAFile( const RString &sPath, Song &out )
|
|||||||
// Attacks loaded from file
|
// Attacks loaded from file
|
||||||
else if( sValueName=="ATTACKS" )
|
else if( sValueName=="ATTACKS" )
|
||||||
{
|
{
|
||||||
// Build the RString vector here so we can write it to file again later
|
SMLoader::ProcessAttacks( out, sParams );
|
||||||
for( unsigned s=1; s < sParams.params.size(); ++s )
|
|
||||||
out.m_sAttackString.push_back( sParams[s] );
|
|
||||||
|
|
||||||
Attack attack;
|
|
||||||
float end = -9999;
|
|
||||||
|
|
||||||
for( unsigned j=1; j < sParams.params.size(); ++j )
|
|
||||||
{
|
|
||||||
vector<RString> sBits;
|
|
||||||
split( sParams[j], "=", sBits, false );
|
|
||||||
|
|
||||||
// Need an identifer and a value for this to work
|
|
||||||
if( sBits.size() < 2 )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
TrimLeft( sBits[0] );
|
|
||||||
TrimRight( sBits[0] );
|
|
||||||
|
|
||||||
if( !sBits[0].CompareNoCase("TIME") )
|
|
||||||
attack.fStartSecond = strtof( sBits[1], NULL );
|
|
||||||
else if( !sBits[0].CompareNoCase("LEN") )
|
|
||||||
attack.fSecsRemaining = strtof( sBits[1], NULL );
|
|
||||||
else if( !sBits[0].CompareNoCase("END") )
|
|
||||||
end = strtof( sBits[1], NULL );
|
|
||||||
else if( !sBits[0].CompareNoCase("MODS") )
|
|
||||||
{
|
|
||||||
attack.sModifiers = sBits[1];
|
|
||||||
|
|
||||||
if( end != -9999 )
|
|
||||||
{
|
|
||||||
attack.fSecsRemaining = end - attack.fStartSecond;
|
|
||||||
end = -9999;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( attack.fSecsRemaining < 0.0f )
|
|
||||||
attack.fSecsRemaining = 0.0f;
|
|
||||||
|
|
||||||
out.m_Attacks.push_back( attack );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( sValueName=="NOTES" || sValueName=="NOTES2" )
|
else if( sValueName=="NOTES" || sValueName=="NOTES2" )
|
||||||
|
|||||||
+1
-41
@@ -335,47 +335,7 @@ bool SSCLoader::LoadFromSSCFile( const RString &sPath, Song &out, bool bFromCach
|
|||||||
// Attacks loaded from file
|
// Attacks loaded from file
|
||||||
else if( sValueName=="ATTACKS" )
|
else if( sValueName=="ATTACKS" )
|
||||||
{
|
{
|
||||||
// Build the RString vector here so we can write it to file again later
|
SMLoader::ProcessAttacks( out, sParams );
|
||||||
for( unsigned s=1; s < sParams.params.size(); ++s )
|
|
||||||
out.m_sAttackString.push_back( sParams[s] );
|
|
||||||
|
|
||||||
Attack attack;
|
|
||||||
float end = -9999;
|
|
||||||
|
|
||||||
for( unsigned j=1; j < sParams.params.size(); ++j )
|
|
||||||
{
|
|
||||||
vector<RString> sBits;
|
|
||||||
split( sParams[j], "=", sBits, false );
|
|
||||||
|
|
||||||
// Need an identifer and a value for this to work
|
|
||||||
if( sBits.size() < 2 )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
TrimLeft( sBits[0] );
|
|
||||||
TrimRight( sBits[0] );
|
|
||||||
|
|
||||||
if( !sBits[0].CompareNoCase("TIME") )
|
|
||||||
attack.fStartSecond = strtof( sBits[1], NULL );
|
|
||||||
else if( !sBits[0].CompareNoCase("LEN") )
|
|
||||||
attack.fSecsRemaining = strtof( sBits[1], NULL );
|
|
||||||
else if( !sBits[0].CompareNoCase("END") )
|
|
||||||
end = strtof( sBits[1], NULL );
|
|
||||||
else if( !sBits[0].CompareNoCase("MODS") )
|
|
||||||
{
|
|
||||||
attack.sModifiers = sBits[1];
|
|
||||||
|
|
||||||
if( end != -9999 )
|
|
||||||
{
|
|
||||||
attack.fSecsRemaining = end - attack.fStartSecond;
|
|
||||||
end = -9999;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( attack.fSecsRemaining < 0.0f )
|
|
||||||
attack.fSecsRemaining = 0.0f;
|
|
||||||
|
|
||||||
out.m_Attacks.push_back( attack );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( sValueName=="OFFSET" )
|
else if( sValueName=="OFFSET" )
|
||||||
|
|||||||
Reference in New Issue
Block a user