Merge pull request #496 from stepmania/revert-494-improved_notes_loader

Revert "Improved NotesLoaderSSC and NotesLoaderSM"
This commit is contained in:
Jason Felds
2015-03-09 16:59:16 -04:00
9 changed files with 1042 additions and 1188 deletions
+19 -33
View File
@@ -47,43 +47,29 @@ CourseDifficulty GetNextShownCourseDifficulty( CourseDifficulty cd )
return Difficulty_Invalid;
}
struct OldStyleStringToDifficultyMapHolder
{
std::map<RString, Difficulty> conversion_map;
OldStyleStringToDifficultyMapHolder()
{
conversion_map["beginner"]= Difficulty_Beginner;
conversion_map["easy"]= Difficulty_Easy;
conversion_map["basic"]= Difficulty_Easy;
conversion_map["light"]= Difficulty_Easy;
conversion_map["medium"]= Difficulty_Medium;
conversion_map["another"]= Difficulty_Medium;
conversion_map["trick"]= Difficulty_Medium;
conversion_map["standard"]= Difficulty_Medium;
conversion_map["difficult"]= Difficulty_Medium;
conversion_map["hard"]= Difficulty_Hard;
conversion_map["ssr"]= Difficulty_Hard;
conversion_map["maniac"]= Difficulty_Hard;
conversion_map["heavy"]= Difficulty_Hard;
conversion_map["smaniac"]= Difficulty_Challenge;
conversion_map["challenge"]= Difficulty_Challenge;
conversion_map["expert"]= Difficulty_Challenge;
conversion_map["oni"]= Difficulty_Challenge;
conversion_map["edit"]= Difficulty_Edit;
}
};
OldStyleStringToDifficultyMapHolder OldStyleStringToDifficulty_converter;
Difficulty OldStyleStringToDifficulty( const RString& sDC )
{
RString s2 = sDC;
s2.MakeLower();
std::map<RString, Difficulty>::iterator diff=
OldStyleStringToDifficulty_converter.conversion_map.find(s2);
if(diff != OldStyleStringToDifficulty_converter.conversion_map.end())
{
return diff->second;
}
return Difficulty_Invalid;
if( s2 == "beginner" ) return Difficulty_Beginner;
else if( s2 == "easy" ) return Difficulty_Easy;
else if( s2 == "basic" ) return Difficulty_Easy;
else if( s2 == "light" ) return Difficulty_Easy;
else if( s2 == "medium" ) return Difficulty_Medium;
else if( s2 == "another" ) return Difficulty_Medium;
else if( s2 == "trick" ) return Difficulty_Medium;
else if( s2 == "standard" ) return Difficulty_Medium;
else if( s2 == "difficult") return Difficulty_Medium;
else if( s2 == "hard" ) return Difficulty_Hard;
else if( s2 == "ssr" ) return Difficulty_Hard;
else if( s2 == "maniac" ) return Difficulty_Hard;
else if( s2 == "heavy" ) return Difficulty_Hard;
else if( s2 == "smaniac" ) return Difficulty_Challenge;
else if( s2 == "challenge" ) return Difficulty_Challenge;
else if( s2 == "expert" ) return Difficulty_Challenge;
else if( s2 == "oni" ) return Difficulty_Challenge;
else if( s2 == "edit" ) return Difficulty_Edit;
else return Difficulty_Invalid;
}
LuaFunction( OldStyleStringToDifficulty, OldStyleStringToDifficulty(SArg(1)) );
+20 -24
View File
@@ -201,34 +201,30 @@ static const char *TapNoteScoreNames[] = {
"W1",
"CheckpointHit",
};
struct tns_conversion_helper
{
std::map<RString, TapNoteScore> conversion_map;
tns_conversion_helper()
{
FOREACH_ENUM(TapNoteScore, tns)
{
conversion_map[TapNoteScoreNames[tns]]= tns;
}
// for backward compatibility
conversion_map["Boo"]= TNS_W5;
conversion_map["Good"]= TNS_W4;
conversion_map["Great"]= TNS_W3;
conversion_map["Perfect"]= TNS_W2;
conversion_map["Marvelous"]= TNS_W1;
}
};
tns_conversion_helper tns_converter;
XToString( TapNoteScore );
LuaXType( TapNoteScore );
TapNoteScore StringToTapNoteScore( const RString &s )
{
std::map<RString, TapNoteScore>::iterator tns=
tns_converter.conversion_map.find(s);
if(tns != tns_converter.conversion_map.end())
{
return tns->second;
}
// new style
if ( s == "None" ) return TNS_None;
else if( s == "HitMine" ) return TNS_HitMine;
else if( s == "AvoidMine" ) return TNS_AvoidMine;
else if( s == "CheckpointHit" ) return TNS_CheckpointHit;
else if( s == "CheckpointMiss" )return TNS_CheckpointMiss;
else if( s == "Miss" ) return TNS_Miss;
else if( s == "W5" ) return TNS_W5;
else if( s == "W4" ) return TNS_W4;
else if( s == "W3" ) return TNS_W3;
else if( s == "W2" ) return TNS_W2;
else if( s == "W1" ) return TNS_W1;
// for backward compatibility
else if( s == "Boo" ) return TNS_W5;
else if( s == "Good" ) return TNS_W4;
else if( s == "Great" ) return TNS_W3;
else if( s == "Perfect" ) return TNS_W2;
else if( s == "Marvelous" ) return TNS_W1;
return TapNoteScore_Invalid;
}
// This is necessary because the StringToX macro wasn't used, and Preference
+26 -41
View File
@@ -34,8 +34,6 @@ bool IniFile::ReadFile( const RString &sPath )
bool IniFile::ReadFile( RageFileBasic &f )
{
RString keyname;
// keychild is used to cache the node that values are being added to. -Kyz
XNode* keychild= NULL;
while( 1 )
{
RString line;
@@ -63,47 +61,34 @@ bool IniFile::ReadFile( RageFileBasic &f )
}
if( line.empty() )
if( line.size() == 0 )
continue;
switch(line[0])
if( line[0] == ';' )
continue; // comment
if( line[0] == '#' )
continue; // comment
if( line.size() > 1 && line[0] == '/' && line[1] == '/' )
continue; // comment
if( line.size() > 1 && line[0] == '-' && line[1] == '-' )
continue; // comment (Lua style)
if( line[0] == '[' && line[line.size()-1] == ']' )
{
case ';':
case '#':
continue; // comment
case '/':
case '-':
if(line.size() > 1 && line[0] == line[1])
{ continue; } // comment (Lua or C++ style)
goto keyvalue;
case '[':
if(line[line.size()-1] == ']')
{
// New section.
keyname = line.substr(1, line.size()-2);
keychild= GetChild(keyname);
if(keychild == NULL)
{
keychild= AppendChild(keyname);
}
break;
}
default:
keyvalue:
if(keychild == NULL)
{ break; }
// New value.
size_t iEqualIndex = line.find("=");
if( iEqualIndex != string::npos )
{
RString valuename = line.Left((int) iEqualIndex);
RString value = line.Right(line.size()-valuename.size()-1);
Trim(valuename);
if(!valuename.empty())
{
SetKeyValue(keychild, valuename, value);
}
}
break;
// New section.
keyname = line.substr(1, line.size()-2);
}
else
{
// New value.
size_t iEqualIndex = line.find("=");
if( iEqualIndex != string::npos )
{
RString valuename = line.Left( (int) iEqualIndex );
RString value = line.Right( line.size()-valuename.size()-1 );
Trim( valuename );
if( keyname.size() && valuename.size() )
SetValue( keyname, valuename, value );
}
}
}
}
-5
View File
@@ -44,11 +44,6 @@ public:
pNode = AppendChild( sKey );
pNode->AppendAttr<T>( sValueName, value );
}
template <typename T>
void SetKeyValue(XNode* keynode, const RString &sValueName, const T &value)
{
keynode->AppendAttr<T>(sValueName, value);
}
bool DeleteKey( const RString &keyname );
bool DeleteValue( const RString &keyname, const RString &valuename );
+187 -254
View File
@@ -13,242 +13,6 @@
#include "Attack.h"
#include "PrefsManager.h"
// Everything from this line to the creation of sm_parser_helper exists to
// speed up parsing by allowing the use of std::map. All these functions
// are put into a map of function pointers which is used when loading.
// -Kyz
/****************************************************************/
struct SMSongTagInfo
{
SMLoader* loader;
Song* song;
const MsdFile::value_t* params;
const RString& path;
vector< pair<float, float> > BPMChanges, Stops;
SMSongTagInfo(SMLoader* l, Song* s, const RString& p)
:loader(l), song(s), path(p)
{}
};
typedef void (*song_tag_func_t)(SMSongTagInfo& info);
// Functions for song tags go below this line. -Kyz
/****************************************************************/
void SMSetTitle(SMSongTagInfo& info)
{
info.song->m_sMainTitle = (*info.params)[1];
info.loader->SetSongTitle((*info.params)[1]);
}
void SMSetSubtitle(SMSongTagInfo& info)
{
info.song->m_sSubTitle = (*info.params)[1];
}
void SMSetArtist(SMSongTagInfo& info)
{
info.song->m_sArtist = (*info.params)[1];
}
void SMSetTitleTranslit(SMSongTagInfo& info)
{
info.song->m_sMainTitleTranslit = (*info.params)[1];
}
void SMSetSubtitleTranslit(SMSongTagInfo& info)
{
info.song->m_sSubTitleTranslit = (*info.params)[1];
}
void SMSetArtistTranslit(SMSongTagInfo& info)
{
info.song->m_sArtistTranslit = (*info.params)[1];
}
void SMSetGenre(SMSongTagInfo& info)
{
info.song->m_sGenre = (*info.params)[1];
}
void SMSetCredit(SMSongTagInfo& info)
{
info.song->m_sCredit = (*info.params)[1];
}
void SMSetBanner(SMSongTagInfo& info)
{
info.song->m_sBannerFile = (*info.params)[1];
}
void SMSetBackground(SMSongTagInfo& info)
{
info.song->m_sBackgroundFile = (*info.params)[1];
}
void SMSetLyricsPath(SMSongTagInfo& info)
{
info.song->m_sLyricsFile = (*info.params)[1];
}
void SMSetCDTitle(SMSongTagInfo& info)
{
info.song->m_sCDTitleFile = (*info.params)[1];
}
void SMSetMusic(SMSongTagInfo& info)
{
info.song->m_sMusicFile = (*info.params)[1];
}
void SMSetOffset(SMSongTagInfo& info)
{
info.song->m_SongTiming.m_fBeat0OffsetInSeconds = StringToFloat((*info.params)[1]);
}
void SMSetBPMs(SMSongTagInfo& info)
{
info.BPMChanges.clear();
info.loader->ParseBPMs(info.BPMChanges, (*info.params)[1]);
}
void SMSetStops(SMSongTagInfo& info)
{
info.Stops.clear();
info.loader->ParseStops(info.Stops, (*info.params)[1]);
}
void SMSetDelays(SMSongTagInfo& info)
{
info.loader->ProcessDelays(info.song->m_SongTiming, (*info.params)[1]);
}
void SMSetTimeSignatures(SMSongTagInfo& info)
{
info.loader->ProcessTimeSignatures(info.song->m_SongTiming, (*info.params)[1]);
}
void SMSetTickCounts(SMSongTagInfo& info)
{
info.loader->ProcessTickcounts(info.song->m_SongTiming, (*info.params)[1]);
}
void SMSetInstrumentTrack(SMSongTagInfo& info)
{
info.loader->ProcessInstrumentTracks(*info.song, (*info.params)[1]);
}
void SMSetSampleStart(SMSongTagInfo& info)
{
info.song->m_fMusicSampleStartSeconds = HHMMSSToSeconds((*info.params)[1]);
}
void SMSetSampleLength(SMSongTagInfo& info)
{
info.song->m_fMusicSampleLengthSeconds = HHMMSSToSeconds((*info.params)[1]);
}
void SMSetDisplayBPM(SMSongTagInfo& info)
{
// #DISPLAYBPM:[xxx][xxx:xxx]|[*];
if((*info.params)[1] == "*")
{ info.song->m_DisplayBPMType = DISPLAY_BPM_RANDOM; }
else
{
info.song->m_DisplayBPMType = DISPLAY_BPM_SPECIFIED;
info.song->m_fSpecifiedBPMMin = StringToFloat((*info.params)[1]);
if((*info.params)[2].empty())
{ info.song->m_fSpecifiedBPMMax = info.song->m_fSpecifiedBPMMin; }
else
{ info.song->m_fSpecifiedBPMMax = StringToFloat((*info.params)[2]); }
}
}
void SMSetSelectable(SMSongTagInfo& info)
{
if((*info.params)[1].EqualsNoCase("YES"))
{ info.song->m_SelectionDisplay = info.song->SHOW_ALWAYS; }
else if((*info.params)[1].EqualsNoCase("NO"))
{ info.song->m_SelectionDisplay = info.song->SHOW_NEVER; }
// ROULETTE from 3.9. It was removed since UnlockManager can serve
// the same purpose somehow. This, of course, assumes you're using
// unlocks. -aj
else if((*info.params)[1].EqualsNoCase("ROULETTE"))
{ info.song->m_SelectionDisplay = info.song->SHOW_ALWAYS; }
/* The following two cases are just fixes to make sure simfiles that
* used 3.9+ features are not excluded here */
else if((*info.params)[1].EqualsNoCase("ES") || (*info.params)[1].EqualsNoCase("OMES"))
{ info.song->m_SelectionDisplay = info.song->SHOW_ALWAYS; }
else if(StringToInt((*info.params)[1]) > 0)
{ info.song->m_SelectionDisplay = info.song->SHOW_ALWAYS; }
else
{ LOG->UserLog("Song file", info.path, "has an unknown #SELECTABLE value, \"%s\"; ignored.", (*info.params)[1].c_str()); }
}
void SMSetBGChanges(SMSongTagInfo& info)
{
info.loader->ProcessBGChanges(*info.song, (*info.params)[0], info.path, (*info.params)[1]);
}
void SMSetFGChanges(SMSongTagInfo& info)
{
vector<RString> aFGChangeExpressions;
split((*info.params)[1], ",", aFGChangeExpressions);
for(unsigned int b = 0; b < aFGChangeExpressions.size(); ++b)
{
BackgroundChange change;
if(info.loader->LoadFromBGChangesString(change, aFGChangeExpressions[b]))
info.song->AddForegroundChange(change);
}
}
void SMSetKeysounds(SMSongTagInfo& info)
{
split((*info.params)[1], ",", info.song->m_vsKeysoundFile);
}
void SMSetAttacks(SMSongTagInfo& info)
{
info.loader->ProcessAttackString(info.song->m_sAttackString, (*info.params));
info.loader->ProcessAttacks(info.song->m_Attacks, (*info.params));
}
typedef std::map<RString, song_tag_func_t> song_handler_map_t;
struct sm_parser_helper_t
{
song_handler_map_t song_tag_handlers;
// Unless signed, the comments in this tag list are not by me. They were
// moved here when converting from the else if chain. -Kyz
sm_parser_helper_t()
{
song_tag_handlers["TITLE"]= &SMSetTitle;
song_tag_handlers["SUBTITLE"]= &SMSetSubtitle;
song_tag_handlers["ARTIST"]= &SMSetArtist;
song_tag_handlers["TITLETRANSLIT"]= &SMSetTitleTranslit;
song_tag_handlers["SUBTITLETRANSLIT"]= &SMSetSubtitleTranslit;
song_tag_handlers["ARTISTTRANSLIT"]= &SMSetArtistTranslit;
song_tag_handlers["GENRE"]= &SMSetGenre;
song_tag_handlers["CREDIT"]= &SMSetCredit;
song_tag_handlers["BANNER"]= &SMSetBanner;
song_tag_handlers["BACKGROUND"]= &SMSetBackground;
// Save "#LYRICS" for later, so we can add an internal lyrics tag.
song_tag_handlers["LYRICSPATH"]= &SMSetLyricsPath;
song_tag_handlers["CDTITLE"]= &SMSetCDTitle;
song_tag_handlers["MUSIC"]= &SMSetMusic;
song_tag_handlers["OFFSET"]= &SMSetOffset;
song_tag_handlers["BPMS"]= &SMSetBPMs;
song_tag_handlers["STOPS"]= &SMSetStops;
song_tag_handlers["FREEZES"]= &SMSetStops;
song_tag_handlers["DELAYS"]= &SMSetDelays;
song_tag_handlers["TIMESIGNATURES"]= &SMSetTimeSignatures;
song_tag_handlers["TICKCOUNTS"]= &SMSetTickCounts;
song_tag_handlers["INSTRUMENTTRACK"]= &SMSetInstrumentTrack;
song_tag_handlers["SAMPLESTART"]= &SMSetSampleStart;
song_tag_handlers["SAMPLELENGTH"]= &SMSetSampleLength;
song_tag_handlers["DISPLAYBPM"]= &SMSetDisplayBPM;
song_tag_handlers["SELECTABLE"]= &SMSetSelectable;
// It's a bit odd to have the tag that exists for backwards compatibility
// in this list and not the replacement, but the BGCHANGES tag has a
// number on the end, allowing up to NUM_BackgroundLayer tags, so it
// can't fit in the map. -Kyz
song_tag_handlers["ANIMATIONS"]= &SMSetBGChanges;
song_tag_handlers["FGCHANGES"]= &SMSetFGChanges;
song_tag_handlers["KEYSOUNDS"]= &SMSetKeysounds;
// Attacks loaded from file
song_tag_handlers["ATTACKS"]= &SMSetAttacks;
/* Tags that no longer exist, listed for posterity. May their names
* never be forgotten for their service to Stepmania. -Kyz
* LASTBEATHINT: // unable to identify at this point: ignore
* MUSICBYTES: // ignore
* FIRSTBEAT: // cache tags from older SM files: ignore.
* LASTBEAT: // cache tags from older SM files: ignore.
* SONGFILENAME: // cache tags from older SM files: ignore.
* HASMUSIC: // cache tags from older SM files: ignore.
* HASBANNER: // cache tags from older SM files: ignore.
* SAMPLEPATH: // SamplePath was used when the song has a separate preview clip. -aj
* LEADTRACK: // XXX: Does anyone know what LEADTRACK is for? -Wolfman2000
* MUSICLENGTH: // Loaded from the cache now. -Kyz
*/
}
};
sm_parser_helper_t sm_parser_helper;
// End sm_parser_helper related functions. -Kyz
/****************************************************************/
void SMLoader::SetSongTitle(const RString & title)
{
this->songTitle = title;
@@ -1121,11 +885,10 @@ bool SMLoader::LoadFromSimfile( const RString &sPath, Song &out, bool bFromCache
return false;
}
vector< pair<float, float> > vBPMChanges, vStops;
out.m_SongTiming.m_sFile = sPath;
out.m_sSongFileName = sPath;
SMSongTagInfo reused_song_info(&*this, &out, sPath);
for( unsigned i=0; i<msd.GetNumValues(); i++ )
{
int iNumParams = msd.GetNumParams(i);
@@ -1133,22 +896,191 @@ bool SMLoader::LoadFromSimfile( const RString &sPath, Song &out, bool bFromCache
RString sValueName = sParams[0];
sValueName.MakeUpper();
reused_song_info.params= &sParams;
song_handler_map_t::iterator handler=
sm_parser_helper.song_tag_handlers.find(sValueName);
if(handler != sm_parser_helper.song_tag_handlers.end())
{
// handle the data
/* Don't use GetMainAndSubTitlesFromFullTitle; that's only for heuristically
* splitting other formats that *don't* natively support #SUBTITLE. */
handler->second(reused_song_info);
}
else if(sValueName.Left(strlen("BGCHANGES")) == "BGCHANGES")
if( sValueName=="TITLE" )
{
SMSetBGChanges(reused_song_info);
out.m_sMainTitle = sParams[1];
this->SetSongTitle(sParams[1]);
}
else if(sValueName == "NOTES" || sValueName == "NOTES2")
else if( sValueName=="SUBTITLE" )
out.m_sSubTitle = sParams[1];
else if( sValueName=="ARTIST" )
out.m_sArtist = sParams[1];
else if( sValueName=="TITLETRANSLIT" )
out.m_sMainTitleTranslit = sParams[1];
else if( sValueName=="SUBTITLETRANSLIT" )
out.m_sSubTitleTranslit = sParams[1];
else if( sValueName=="ARTISTTRANSLIT" )
out.m_sArtistTranslit = sParams[1];
else if( sValueName=="GENRE" )
out.m_sGenre = sParams[1];
else if( sValueName=="CREDIT" )
out.m_sCredit = sParams[1];
else if( sValueName=="BANNER" )
out.m_sBannerFile = sParams[1];
else if( sValueName=="BACKGROUND" )
out.m_sBackgroundFile = sParams[1];
// Save "#LYRICS" for later, so we can add an internal lyrics tag.
else if( sValueName=="LYRICSPATH" )
out.m_sLyricsFile = sParams[1];
else if( sValueName=="CDTITLE" )
out.m_sCDTitleFile = sParams[1];
else if( sValueName=="MUSIC" )
out.m_sMusicFile = sParams[1];
else if( sValueName=="OFFSET" )
{
if(iNumParams < 7)
out.m_SongTiming.m_fBeat0OffsetInSeconds = StringToFloat( sParams[1] );
}
else if( sValueName=="BPMS" )
{
vBPMChanges.clear();
ParseBPMs(vBPMChanges, sParams[1]);
}
else if( sValueName=="STOPS" || sValueName=="FREEZES" )
{
vStops.clear();
ParseStops(vStops, sParams[1]);
}
else if( sValueName=="DELAYS" )
{
ProcessDelays(out.m_SongTiming, sParams[1]);
}
else if( sValueName=="TIMESIGNATURES" )
{
ProcessTimeSignatures(out.m_SongTiming, sParams[1]);
}
else if( sValueName=="TICKCOUNTS" )
{
ProcessTickcounts(out.m_SongTiming, sParams[1]);
}
else if( sValueName=="INSTRUMENTTRACK" )
{
ProcessInstrumentTracks( out, sParams[1] );
}
else if( sValueName=="MUSICLENGTH" )
{
if( !bFromCache )
continue;
out.m_fMusicLengthSeconds = StringToFloat( sParams[1] );
}
else if( sValueName=="LASTBEATHINT" )
{
// unable to identify at this point: ignore
}
else if( sValueName=="MUSICBYTES" )
; /* ignore */
// cache tags from older SM files: ignore.
else if(sValueName=="FIRSTBEAT" || sValueName=="LASTBEAT" ||
sValueName=="SONGFILENAME" || sValueName=="HASMUSIC" ||
sValueName=="HASBANNER")
{
;
}
else if( sValueName=="SAMPLESTART" )
out.m_fMusicSampleStartSeconds = HHMMSSToSeconds( sParams[1] );
else if( sValueName=="SAMPLELENGTH" )
out.m_fMusicSampleLengthSeconds = HHMMSSToSeconds( sParams[1] );
// SamplePath is used when the song has a separate preview clip. -aj
//else if( sValueName=="SAMPLEPATH" )
//out.m_sMusicSamplePath = sParams[1];
else if( sValueName=="DISPLAYBPM" )
{
// #DISPLAYBPM:[xxx][xxx:xxx]|[*];
if( sParams[1] == "*" )
out.m_DisplayBPMType = DISPLAY_BPM_RANDOM;
else
{
out.m_DisplayBPMType = DISPLAY_BPM_SPECIFIED;
out.m_fSpecifiedBPMMin = StringToFloat( sParams[1] );
if( sParams[2].empty() )
out.m_fSpecifiedBPMMax = out.m_fSpecifiedBPMMin;
else
out.m_fSpecifiedBPMMax = StringToFloat( sParams[2] );
}
}
else if( sValueName=="SELECTABLE" )
{
if(sParams[1].EqualsNoCase("YES"))
out.m_SelectionDisplay = out.SHOW_ALWAYS;
else if(sParams[1].EqualsNoCase("NO"))
out.m_SelectionDisplay = out.SHOW_NEVER;
// ROULETTE from 3.9. It was removed since UnlockManager can serve
// the same purpose somehow. This, of course, assumes you're using
// unlocks. -aj
else if(sParams[1].EqualsNoCase("ROULETTE"))
out.m_SelectionDisplay = out.SHOW_ALWAYS;
/* The following two cases are just fixes to make sure simfiles that
* used 3.9+ features are not excluded here */
else if(sParams[1].EqualsNoCase("ES") || sParams[1].EqualsNoCase("OMES"))
out.m_SelectionDisplay = out.SHOW_ALWAYS;
else if( StringToInt(sParams[1]) > 0 )
out.m_SelectionDisplay = out.SHOW_ALWAYS;
else
LOG->UserLog( "Song file", sPath, "has an unknown #SELECTABLE value, \"%s\"; ignored.", sParams[1].c_str() );
}
else if( sValueName.Left(strlen("BGCHANGES"))=="BGCHANGES" || sValueName=="ANIMATIONS" )
{
ProcessBGChanges( out, sValueName, sPath, sParams[1]);
}
else if( sValueName=="FGCHANGES" )
{
vector<RString> aFGChangeExpressions;
split( sParams[1], ",", aFGChangeExpressions );
for( unsigned b=0; b<aFGChangeExpressions.size(); b++ )
{
BackgroundChange change;
if( LoadFromBGChangesString( change, aFGChangeExpressions[b] ) )
out.AddForegroundChange( change );
}
}
else if( sValueName=="KEYSOUNDS" )
{
split( sParams[1], ",", out.m_vsKeysoundFile );
}
// Attacks loaded from file
else if( sValueName=="ATTACKS" )
{
ProcessAttackString(out.m_sAttackString, sParams);
ProcessAttacks(out.m_Attacks, sParams);
}
else if( sValueName=="NOTES" || sValueName=="NOTES2" )
{
if( iNumParams < 7 )
{
LOG->UserLog( "Song file", sPath, "has %d fields in a #NOTES tag, but should have at least 7.", iNumParams );
continue;
@@ -1162,19 +1094,20 @@ bool SMLoader::LoadFromSimfile( const RString &sPath, Song &out, bool bFromCache
sParams[4],
sParams[5],
sParams[6],
*pNewNotes);
*pNewNotes );
pNewNotes->SetFilename(sPath);
out.AddSteps( pNewNotes );
}
// XXX: Does anyone know what LEADTRACK is for? -Wolfman2000
else if( sValueName=="LEADTRACK" )
;
else
{
LOG->UserLog("Song file", sPath, "has an unexpected value named \"%s\".", sValueName.c_str());
}
LOG->UserLog( "Song file", sPath, "has an unexpected value named \"%s\".", sValueName.c_str() );
}
// Turn negative time changes into warps
ProcessBPMsAndStops(out.m_SongTiming, reused_song_info.BPMChanges, reused_song_info.Stops);
ProcessBPMsAndStops(out.m_SongTiming, vBPMChanges, vStops);
TidyUpData( out, bFromCache );
return true;
+1 -4
View File
@@ -198,10 +198,7 @@ protected:
* @brief Retrieve the file extension associated with this loader.
* @return the file extension. */
RString GetFileExtension() const { return fileExt; }
public:
// SetSongTitle and GetSongTitle changed to public to allow the functions
// used by the parser helper to access them. -Kyz
/**
* @brief Set the song title.
* @param t the song title. */
+783 -820
View File
File diff suppressed because it is too large Load Diff
+5 -6
View File
@@ -466,17 +466,16 @@ void PrefsManager::ReadGamePrefsFromIni( const RString &sIni )
FOREACH_CONST_Child( &ini, section )
{
RString section_name= section->GetName();
if( !BeginsWith(section_name, GAME_SECTION_PREFIX) )
if( !BeginsWith(section->GetName(), GAME_SECTION_PREFIX) )
continue;
RString sGame = section_name.Right( section_name.length() - GAME_SECTION_PREFIX.length() );
RString sGame = section->GetName().Right( section->GetName().length() - GAME_SECTION_PREFIX.length() );
GamePrefs &gp = m_mapGameNameToGamePrefs[ sGame ];
// todo: read more prefs here? -aj
ini.GetValue(section_name, "Announcer", gp.m_sAnnouncer);
ini.GetValue(section_name, "Theme", gp.m_sTheme);
ini.GetValue(section_name, "DefaultModifiers", gp.m_sDefaultModifiers);
ini.GetValue( section->GetName(), "Announcer", gp.m_sAnnouncer );
ini.GetValue( section->GetName(), "Theme", gp.m_sTheme );
ini.GetValue( section->GetName(), "DefaultModifiers", gp.m_sDefaultModifiers );
}
}
+1 -1
View File
@@ -53,7 +53,7 @@ extern const RageTimer RageZeroTimer;
// For profiling how long some chunk of code takes. -Kyz
#define START_TIME(name) float name##_start_time= RageTimer::GetTimeSinceStartFast();
#define END_TIME(name) float name##_end_time= RageTimer::GetTimeSinceStartFast(); LOG->Warn(#name " time: %f to %f = %f", name##_start_time, name##_end_time, name##_end_time - name##_start_time);
#define END_TIME(name) float name##_end_time= RageTimer::GetTimeSinceStartFast(); LOG->Warn(#name " time: %f", name##_end_time - name##_start_time);
#endif