Step Attacks will be written.
The cache won't be incremented until this is given some testing.
This commit is contained in:
+12
-10
@@ -10,7 +10,6 @@
|
||||
#include "Song.h"
|
||||
#include "SongManager.h"
|
||||
#include "Steps.h"
|
||||
#include "Attack.h"
|
||||
#include "PrefsManager.h"
|
||||
|
||||
void SMLoader::SetSongTitle(const RString & title)
|
||||
@@ -143,19 +142,21 @@ void SMLoader::ProcessBGChanges( Song &out, const RString &sValueName, const RSt
|
||||
}
|
||||
}
|
||||
|
||||
void SMLoader::ProcessAttacks( Song &out, MsdFile::value_t sParams )
|
||||
void SMLoader::ProcessAttackString( vector<RString> & attacks, MsdFile::value_t params )
|
||||
{
|
||||
for( unsigned s=1; s < params.params.size(); ++s )
|
||||
attacks.push_back( params[s] );
|
||||
}
|
||||
|
||||
void SMLoader::ProcessAttacks( AttackArray &attacks, MsdFile::value_t params )
|
||||
{
|
||||
// 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 )
|
||||
for( unsigned j=1; j < params.params.size(); ++j )
|
||||
{
|
||||
vector<RString> sBits;
|
||||
split( sParams[j], "=", sBits, false );
|
||||
split( params[j], "=", sBits, false );
|
||||
|
||||
// Need an identifer and a value for this to work
|
||||
if( sBits.size() < 2 )
|
||||
@@ -183,7 +184,7 @@ void SMLoader::ProcessAttacks( Song &out, MsdFile::value_t sParams )
|
||||
if( attack.fSecsRemaining < 0.0f )
|
||||
attack.fSecsRemaining = 0.0f;
|
||||
|
||||
out.m_Attacks.push_back( attack );
|
||||
attacks.push_back( attack );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -913,7 +914,8 @@ bool SMLoader::LoadFromSimfile( const RString &sPath, Song &out, bool bFromCache
|
||||
// Attacks loaded from file
|
||||
else if( sValueName=="ATTACKS" )
|
||||
{
|
||||
ProcessAttacks( out, sParams );
|
||||
ProcessAttackString(out.m_sAttackString, sParams);
|
||||
ProcessAttacks(out.m_Attacks, sParams);
|
||||
}
|
||||
|
||||
else if( sValueName=="NOTES" || sValueName=="NOTES2" )
|
||||
|
||||
+13
-1
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "GameConstantsAndTypes.h"
|
||||
#include "BackgroundUtil.h"
|
||||
#include "Attack.h"
|
||||
#include "MsdFile.h" // we require the struct from here.
|
||||
|
||||
class Song;
|
||||
@@ -133,7 +134,18 @@ struct SMLoader
|
||||
|
||||
virtual void ProcessBGChanges( Song &out, const RString &sValueName,
|
||||
const RString &sPath, const RString &sParam );
|
||||
void ProcessAttacks( Song &out, MsdFile::value_t sParams );
|
||||
|
||||
/**
|
||||
* @brief Put the attacks in the attacks string.
|
||||
* @param attacks the attack string.
|
||||
* @param params the params from the simfile. */
|
||||
virtual void ProcessAttackString(vector<RString> &attacks, MsdFile::value_t params);
|
||||
|
||||
/**
|
||||
* @brief Put the attacks in the attacks array.
|
||||
* @param attacks the attacks array.
|
||||
* @param params the params from the simfile. */
|
||||
void ProcessAttacks( AttackArray &attacks, MsdFile::value_t params );
|
||||
void ProcessInstrumentTracks( Song &out, const RString &sParam );
|
||||
|
||||
/**
|
||||
|
||||
@@ -432,7 +432,8 @@ bool SMALoader::LoadFromSimfile( const RString &sPath, Song &out, bool bFromCach
|
||||
// Attacks loaded from file
|
||||
else if( sValueName=="ATTACKS" )
|
||||
{
|
||||
SMLoader::ProcessAttacks( out, sParams );
|
||||
ProcessAttackString(out.m_sAttackString, sParams);
|
||||
ProcessAttacks(out.m_Attacks, sParams);
|
||||
}
|
||||
|
||||
else if( sValueName=="NOTES" || sValueName=="NOTES2" )
|
||||
|
||||
@@ -344,7 +344,8 @@ bool SSCLoader::LoadFromSimfile( const RString &sPath, Song &out, bool bFromCach
|
||||
// Attacks loaded from file
|
||||
else if( sValueName=="ATTACKS" )
|
||||
{
|
||||
SMLoader::ProcessAttacks( out, sParams );
|
||||
ProcessAttackString(out.m_sAttackString, sParams);
|
||||
ProcessAttacks(out.m_Attacks, sParams);
|
||||
}
|
||||
|
||||
else if( sValueName=="OFFSET" )
|
||||
@@ -559,7 +560,8 @@ bool SSCLoader::LoadFromSimfile( const RString &sPath, Song &out, bool bFromCach
|
||||
|
||||
else if( sValueName=="ATTACKS" )
|
||||
{
|
||||
// Step Attacks aren't in yet.
|
||||
ProcessAttackString(pNewNotes->m_sAttackString, sParams);
|
||||
ProcessAttacks(pNewNotes->m_Attacks, sParams);
|
||||
}
|
||||
|
||||
else if( sValueName=="OFFSET" )
|
||||
|
||||
+11
-2
@@ -320,8 +320,17 @@ static RString GetSSCNoteData( const Song &song, const Steps &in, bool bSavingCa
|
||||
|
||||
GetTimingTags( lines, in.m_Timing );
|
||||
|
||||
// For now, attacks are NOT in use for the step.
|
||||
lines.push_back( "#ATTACKS:;" );
|
||||
RString attacks = "";
|
||||
for( unsigned a=0; a < in.m_sAttackString.size(); a++ )
|
||||
{
|
||||
RString sData = in.m_sAttackString[a];
|
||||
attacks += sData;
|
||||
|
||||
if( a != (in.m_sAttackString.size() - 1) )
|
||||
attacks += ":"; // Not the end, so write a divider ':'
|
||||
}
|
||||
lines.push_back( ssprintf( "#ATTACKS:%s;", attacks.c_str()));
|
||||
|
||||
lines.push_back( ssprintf( "#OFFSET:%.6f;", in.m_Timing.m_fBeat0OffsetInSeconds ) );
|
||||
|
||||
RString sNoteData;
|
||||
|
||||
+3
-1
@@ -154,7 +154,9 @@ Steps *Song::CreateSteps()
|
||||
|
||||
void Song::InitSteps(Steps *pSteps)
|
||||
{
|
||||
pSteps->m_Timing = m_SongTiming;
|
||||
pSteps->m_Timing = this->m_SongTiming;
|
||||
pSteps->m_sAttackString = this->m_sAttackString;
|
||||
pSteps->m_Attacks = this->m_Attacks;
|
||||
}
|
||||
|
||||
void Song::GetDisplayBpms( DisplayBpms &AddTo ) const
|
||||
|
||||
Reference in New Issue
Block a user