[splittiming] merge
This commit is contained in:
@@ -8,6 +8,11 @@ ________________________________________________________________________________
|
|||||||
StepMania 5.0 $NEXT | 20110xyy
|
StepMania 5.0 $NEXT | 20110xyy
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
2011/05/11
|
||||||
|
----------
|
||||||
|
* [GameSoundManager] Added PlayAnnouncer Lua binding. [AJ]
|
||||||
|
* [AnnouncerManager] Add support for "gameplay combo #" for announcer. [AJ]
|
||||||
|
|
||||||
2011/05/10
|
2011/05/10
|
||||||
----------
|
----------
|
||||||
* [Sprite] Added SetSecondsIntoAnimation Lua binding. [AJ]
|
* [Sprite] Added SetSecondsIntoAnimation Lua binding. [AJ]
|
||||||
|
|||||||
@@ -2807,7 +2807,7 @@ Fallback="ScreenOptionsServiceChild"
|
|||||||
|
|
||||||
[ScreenSelectGame]
|
[ScreenSelectGame]
|
||||||
Fallback="ScreenOptionsServiceChild"
|
Fallback="ScreenOptionsServiceChild"
|
||||||
PrevScreen=Branch.TitleMenu()
|
PrevScreen="ScreenOptionsService"
|
||||||
NextScreen=Branch.TitleMenu()
|
NextScreen=Branch.TitleMenu()
|
||||||
LineNames="1"
|
LineNames="1"
|
||||||
Line1="conf,Game"
|
Line1="conf,Game"
|
||||||
@@ -2837,13 +2837,6 @@ Class="ScreenReloadSongs"
|
|||||||
Fallback="Screen"
|
Fallback="Screen"
|
||||||
NextScreen=Branch.TitleMenu()
|
NextScreen=Branch.TitleMenu()
|
||||||
|
|
||||||
[ScreenSelectGame]
|
|
||||||
Fallback="ScreenOptionsServiceChild"
|
|
||||||
PrevScreen="ScreenOptionsService"
|
|
||||||
NextScreen=Branch.TitleMenu()
|
|
||||||
LineNames="1"
|
|
||||||
Line1="conf,Game"
|
|
||||||
|
|
||||||
[ScreenPlayerOptions]
|
[ScreenPlayerOptions]
|
||||||
Fallback="ScreenOptions"
|
Fallback="ScreenOptions"
|
||||||
Class="ScreenPlayerOptions"
|
Class="ScreenPlayerOptions"
|
||||||
|
|||||||
@@ -27,6 +27,10 @@
|
|||||||
2B30D6831315EA7E00044B68 /* MouseDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = 2B30D6811315EA7E00044B68 /* MouseDevice.h */; };
|
2B30D6831315EA7E00044B68 /* MouseDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = 2B30D6811315EA7E00044B68 /* MouseDevice.h */; };
|
||||||
2B76698B132FF71500586512 /* NotesLoaderSMA.h in Headers */ = {isa = PBXBuildFile; fileRef = 2B766989132FF71500586512 /* NotesLoaderSMA.h */; };
|
2B76698B132FF71500586512 /* NotesLoaderSMA.h in Headers */ = {isa = PBXBuildFile; fileRef = 2B766989132FF71500586512 /* NotesLoaderSMA.h */; };
|
||||||
2B76698C132FF71500586512 /* NotesLoaderSMA.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B76698A132FF71500586512 /* NotesLoaderSMA.cpp */; };
|
2B76698C132FF71500586512 /* NotesLoaderSMA.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B76698A132FF71500586512 /* NotesLoaderSMA.cpp */; };
|
||||||
|
2B9C2E8D137A138B004C92F3 /* NotesLoaderJson.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B9C2E89137A138B004C92F3 /* NotesLoaderJson.cpp */; };
|
||||||
|
2B9C2E8E137A138B004C92F3 /* NotesLoaderJson.h in Headers */ = {isa = PBXBuildFile; fileRef = 2B9C2E8A137A138B004C92F3 /* NotesLoaderJson.h */; };
|
||||||
|
2B9C2E8F137A138B004C92F3 /* NotesWriterJson.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B9C2E8B137A138B004C92F3 /* NotesWriterJson.cpp */; };
|
||||||
|
2B9C2E90137A138B004C92F3 /* NotesWriterJson.h in Headers */ = {isa = PBXBuildFile; fileRef = 2B9C2E8C137A138B004C92F3 /* NotesWriterJson.h */; };
|
||||||
2BA7925E1304F20D002BD8E1 /* NotesLoaderSSC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BA7925A1304F20D002BD8E1 /* NotesLoaderSSC.cpp */; };
|
2BA7925E1304F20D002BD8E1 /* NotesLoaderSSC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BA7925A1304F20D002BD8E1 /* NotesLoaderSSC.cpp */; };
|
||||||
2BA7925F1304F20D002BD8E1 /* NotesLoaderSSC.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BA7925B1304F20D002BD8E1 /* NotesLoaderSSC.h */; };
|
2BA7925F1304F20D002BD8E1 /* NotesLoaderSSC.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BA7925B1304F20D002BD8E1 /* NotesLoaderSSC.h */; };
|
||||||
2BA792601304F20D002BD8E1 /* NotesWriterSSC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BA7925C1304F20D002BD8E1 /* NotesWriterSSC.cpp */; };
|
2BA792601304F20D002BD8E1 /* NotesWriterSSC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BA7925C1304F20D002BD8E1 /* NotesWriterSSC.cpp */; };
|
||||||
@@ -1800,6 +1804,10 @@
|
|||||||
2B30D6811315EA7E00044B68 /* MouseDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MouseDevice.h; sourceTree = "<group>"; };
|
2B30D6811315EA7E00044B68 /* MouseDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MouseDevice.h; sourceTree = "<group>"; };
|
||||||
2B766989132FF71500586512 /* NotesLoaderSMA.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NotesLoaderSMA.h; path = ../src/NotesLoaderSMA.h; sourceTree = SOURCE_ROOT; };
|
2B766989132FF71500586512 /* NotesLoaderSMA.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NotesLoaderSMA.h; path = ../src/NotesLoaderSMA.h; sourceTree = SOURCE_ROOT; };
|
||||||
2B76698A132FF71500586512 /* NotesLoaderSMA.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NotesLoaderSMA.cpp; path = ../src/NotesLoaderSMA.cpp; sourceTree = SOURCE_ROOT; };
|
2B76698A132FF71500586512 /* NotesLoaderSMA.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NotesLoaderSMA.cpp; path = ../src/NotesLoaderSMA.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
2B9C2E89137A138B004C92F3 /* NotesLoaderJson.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NotesLoaderJson.cpp; path = ../src/NotesLoaderJson.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
2B9C2E8A137A138B004C92F3 /* NotesLoaderJson.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NotesLoaderJson.h; path = ../src/NotesLoaderJson.h; sourceTree = SOURCE_ROOT; };
|
||||||
|
2B9C2E8B137A138B004C92F3 /* NotesWriterJson.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NotesWriterJson.cpp; path = ../src/NotesWriterJson.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
2B9C2E8C137A138B004C92F3 /* NotesWriterJson.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NotesWriterJson.h; path = ../src/NotesWriterJson.h; sourceTree = SOURCE_ROOT; };
|
||||||
2BA7925A1304F20D002BD8E1 /* NotesLoaderSSC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NotesLoaderSSC.cpp; path = ../src/NotesLoaderSSC.cpp; sourceTree = SOURCE_ROOT; };
|
2BA7925A1304F20D002BD8E1 /* NotesLoaderSSC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NotesLoaderSSC.cpp; path = ../src/NotesLoaderSSC.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
2BA7925B1304F20D002BD8E1 /* NotesLoaderSSC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NotesLoaderSSC.h; path = ../src/NotesLoaderSSC.h; sourceTree = SOURCE_ROOT; };
|
2BA7925B1304F20D002BD8E1 /* NotesLoaderSSC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NotesLoaderSSC.h; path = ../src/NotesLoaderSSC.h; sourceTree = SOURCE_ROOT; };
|
||||||
2BA7925C1304F20D002BD8E1 /* NotesWriterSSC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NotesWriterSSC.cpp; path = ../src/NotesWriterSSC.cpp; sourceTree = SOURCE_ROOT; };
|
2BA7925C1304F20D002BD8E1 /* NotesWriterSSC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NotesWriterSSC.cpp; path = ../src/NotesWriterSSC.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
@@ -3251,6 +3259,8 @@
|
|||||||
AA6EFDF004770C79005F316C /* NotesLoaderBMS.h */,
|
AA6EFDF004770C79005F316C /* NotesLoaderBMS.h */,
|
||||||
AA6EFDF104770C79005F316C /* NotesLoaderDWI.cpp */,
|
AA6EFDF104770C79005F316C /* NotesLoaderDWI.cpp */,
|
||||||
AA6EFDF204770C79005F316C /* NotesLoaderDWI.h */,
|
AA6EFDF204770C79005F316C /* NotesLoaderDWI.h */,
|
||||||
|
2B9C2E89137A138B004C92F3 /* NotesLoaderJson.cpp */,
|
||||||
|
2B9C2E8A137A138B004C92F3 /* NotesLoaderJson.h */,
|
||||||
AA6EFDF304770C79005F316C /* NotesLoaderKSF.cpp */,
|
AA6EFDF304770C79005F316C /* NotesLoaderKSF.cpp */,
|
||||||
AA6EFDF404770C79005F316C /* NotesLoaderKSF.h */,
|
AA6EFDF404770C79005F316C /* NotesLoaderKSF.h */,
|
||||||
3688B8510BD42DAA004186AD /* NotesLoaderMidi.cpp */,
|
3688B8510BD42DAA004186AD /* NotesLoaderMidi.cpp */,
|
||||||
@@ -3263,6 +3273,8 @@
|
|||||||
2B766989132FF71500586512 /* NotesLoaderSMA.h */,
|
2B766989132FF71500586512 /* NotesLoaderSMA.h */,
|
||||||
2BA7925A1304F20D002BD8E1 /* NotesLoaderSSC.cpp */,
|
2BA7925A1304F20D002BD8E1 /* NotesLoaderSSC.cpp */,
|
||||||
2BA7925B1304F20D002BD8E1 /* NotesLoaderSSC.h */,
|
2BA7925B1304F20D002BD8E1 /* NotesLoaderSSC.h */,
|
||||||
|
2B9C2E8B137A138B004C92F3 /* NotesWriterJson.cpp */,
|
||||||
|
2B9C2E8C137A138B004C92F3 /* NotesWriterJson.h */,
|
||||||
AA6EFDF704770C79005F316C /* NotesWriterDWI.cpp */,
|
AA6EFDF704770C79005F316C /* NotesWriterDWI.cpp */,
|
||||||
AA6EFDF804770C79005F316C /* NotesWriterDWI.h */,
|
AA6EFDF804770C79005F316C /* NotesWriterDWI.h */,
|
||||||
AA6EFDF904770C79005F316C /* NotesWriterSM.cpp */,
|
AA6EFDF904770C79005F316C /* NotesWriterSM.cpp */,
|
||||||
@@ -5049,6 +5061,8 @@
|
|||||||
2BC6133313773C8E00CC8BBD /* pngstruct.h in Headers */,
|
2BC6133313773C8E00CC8BBD /* pngstruct.h in Headers */,
|
||||||
2BC6133E13773D2C00CC8BBD /* pnglibconf.h in Headers */,
|
2BC6133E13773D2C00CC8BBD /* pnglibconf.h in Headers */,
|
||||||
B75CE3B5137963350076A82D /* SongPosition.h in Headers */,
|
B75CE3B5137963350076A82D /* SongPosition.h in Headers */,
|
||||||
|
2B9C2E8E137A138B004C92F3 /* NotesLoaderJson.h in Headers */,
|
||||||
|
2B9C2E90137A138B004C92F3 /* NotesWriterJson.h in Headers */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@@ -6309,6 +6323,8 @@
|
|||||||
2BC6133913773C8E00CC8BBD /* pngwtran.c in Sources */,
|
2BC6133913773C8E00CC8BBD /* pngwtran.c in Sources */,
|
||||||
2BC6133A13773C8E00CC8BBD /* pngwutil.c in Sources */,
|
2BC6133A13773C8E00CC8BBD /* pngwutil.c in Sources */,
|
||||||
B75CE3B6137963350076A82D /* SongPosition.cpp in Sources */,
|
B75CE3B6137963350076A82D /* SongPosition.cpp in Sources */,
|
||||||
|
2B9C2E8D137A138B004C92F3 /* NotesLoaderJson.cpp in Sources */,
|
||||||
|
2B9C2E8F137A138B004C92F3 /* NotesWriterJson.cpp in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
|||||||
Vendored
+7
@@ -234,6 +234,13 @@ namespace Json {
|
|||||||
double asDouble() const;
|
double asDouble() const;
|
||||||
bool asBool() const;
|
bool asBool() const;
|
||||||
|
|
||||||
|
bool TryGet( std::string &out ) const { if(!isString()) return false; out=asString(); return true; }
|
||||||
|
bool TryGet( int &out ) const { if(!isInt()) return false; out=asInt(); return true; }
|
||||||
|
bool TryGet( UInt &out ) const { if(!isUInt()) return false; out=asUInt(); return true; }
|
||||||
|
bool TryGet( double &out ) const { if(!isDouble()) return false; out=asDouble(); return true; }
|
||||||
|
bool TryGet( float &out ) const { if(!isDouble()) return false; out=(float)asDouble(); return true; }
|
||||||
|
bool TryGet( bool &out ) const { if(!isBool()) return false; out=asBool(); return true; }
|
||||||
|
|
||||||
bool isNull() const;
|
bool isNull() const;
|
||||||
bool isBool() const;
|
bool isBool() const;
|
||||||
bool isInt() const;
|
bool isInt() const;
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ void AnnouncerManager::GetAnnouncerNames( vector<RString>& AddTo )
|
|||||||
|
|
||||||
// strip out the empty announcer folder
|
// strip out the empty announcer folder
|
||||||
for( int i=AddTo.size()-1; i>=0; i-- )
|
for( int i=AddTo.size()-1; i>=0; i-- )
|
||||||
if( !stricmp( AddTo[i], EMPTY_ANNOUNCER_NAME ) )
|
if( !AddTo[i].EqualsNoCase( EMPTY_ANNOUNCER_NAME ) )
|
||||||
AddTo.erase(AddTo.begin()+i, AddTo.begin()+i+1 );
|
AddTo.erase(AddTo.begin()+i, AddTo.begin()+i+1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ bool AnnouncerManager::DoesAnnouncerExist( RString sAnnouncerName )
|
|||||||
vector<RString> asAnnouncerNames;
|
vector<RString> asAnnouncerNames;
|
||||||
GetAnnouncerNames( asAnnouncerNames );
|
GetAnnouncerNames( asAnnouncerNames );
|
||||||
for( unsigned i=0; i<asAnnouncerNames.size(); i++ )
|
for( unsigned i=0; i<asAnnouncerNames.size(); i++ )
|
||||||
if( 0==stricmp(sAnnouncerName, asAnnouncerNames[i]) )
|
if( sAnnouncerName.EqualsNoCase(asAnnouncerNames[i]) )
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -88,6 +88,18 @@ static const char *aliases[][2] = {
|
|||||||
{ "ScreenSelectStyle comment solo", "select style comment solo" },
|
{ "ScreenSelectStyle comment solo", "select style comment solo" },
|
||||||
{ "ScreenSelectStyle comment versus", "select style comment versus" },
|
{ "ScreenSelectStyle comment versus", "select style comment versus" },
|
||||||
|
|
||||||
|
/* Combo compatibility: */
|
||||||
|
{ "gameplay combo 100", "gameplay 100 combo" },
|
||||||
|
{ "gameplay combo 200", "gameplay 200 combo" },
|
||||||
|
{ "gameplay combo 300", "gameplay 300 combo" },
|
||||||
|
{ "gameplay combo 400", "gameplay 400 combo" },
|
||||||
|
{ "gameplay combo 500", "gameplay 500 combo" },
|
||||||
|
{ "gameplay combo 600", "gameplay 600 combo" },
|
||||||
|
{ "gameplay combo 700", "gameplay 700 combo" },
|
||||||
|
{ "gameplay combo 800", "gameplay 800 combo" },
|
||||||
|
{ "gameplay combo 900", "gameplay 900 combo" },
|
||||||
|
{ "gameplay combo 1000", "gameplay 1000 combo" },
|
||||||
|
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -388,30 +388,30 @@ void BGAnimationLayer::LoadFromNode( const XNode* pNode )
|
|||||||
pNode->GetAttrValue( "Stretch", bStretch );
|
pNode->GetAttrValue( "Stretch", bStretch );
|
||||||
|
|
||||||
// Check for string match first, then do integer match.
|
// Check for string match first, then do integer match.
|
||||||
// "if(atoi(type)==0)" was matching against all string matches.
|
// "if(StringType(type)==0)" was matching against all string matches.
|
||||||
// -Chris
|
// -Chris
|
||||||
if( stricmp(type,"sprite")==0 )
|
if( type.EqualsNoCase("sprite") )
|
||||||
{
|
{
|
||||||
m_Type = TYPE_SPRITE;
|
m_Type = TYPE_SPRITE;
|
||||||
}
|
}
|
||||||
else if( stricmp(type,"particles")==0 )
|
else if( type.EqualsNoCase("particles") )
|
||||||
{
|
{
|
||||||
m_Type = TYPE_PARTICLES;
|
m_Type = TYPE_PARTICLES;
|
||||||
}
|
}
|
||||||
else if( stricmp(type,"tiles")==0 )
|
else if( type.EqualsNoCase("tiles") )
|
||||||
{
|
{
|
||||||
m_Type = TYPE_TILES;
|
m_Type = TYPE_TILES;
|
||||||
}
|
}
|
||||||
else if( atoi(type) == 1 )
|
else if( StringToInt(type) == 1 )
|
||||||
{
|
{
|
||||||
m_Type = TYPE_SPRITE;
|
m_Type = TYPE_SPRITE;
|
||||||
bStretch = true;
|
bStretch = true;
|
||||||
}
|
}
|
||||||
else if( atoi(type) == 2 )
|
else if( StringToInt(type) == 2 )
|
||||||
{
|
{
|
||||||
m_Type = TYPE_PARTICLES;
|
m_Type = TYPE_PARTICLES;
|
||||||
}
|
}
|
||||||
else if( atoi(type) == 3 )
|
else if( StringToInt(type) == 3 )
|
||||||
{
|
{
|
||||||
m_Type = TYPE_TILES;
|
m_Type = TYPE_TILES;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -205,7 +205,7 @@ void BPMDisplay::SetBpmFromCourse( const Course* pCourse )
|
|||||||
StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType;
|
StepsType st = GAMESTATE->GetCurrentStyle()->m_StepsType;
|
||||||
Trail *pTrail = pCourse->GetTrail( st );
|
Trail *pTrail = pCourse->GetTrail( st );
|
||||||
// GetTranslitFullTitle because "Crashinfo.txt is garbled because of the ANSI output as usual." -f
|
// GetTranslitFullTitle because "Crashinfo.txt is garbled because of the ANSI output as usual." -f
|
||||||
ASSERT_M( pTrail, ssprintf("Course '%s' has no trail for StepsType '%s'", pCourse->GetTranslitFullTitle(), StringConversion::ToString(st).c_str() ) );
|
ASSERT_M( pTrail, ssprintf("Course '%s' has no trail for StepsType '%s'", pCourse->GetTranslitFullTitle().c_str(), StringConversion::ToString(st).c_str() ) );
|
||||||
|
|
||||||
m_fCycleTime = 0.2f;
|
m_fCycleTime = 0.2f;
|
||||||
|
|
||||||
|
|||||||
+25
-25
@@ -61,13 +61,13 @@ bool CourseLoaderCRS::LoadFromMsd( const RString &sPath, const MsdFile &msd, Cou
|
|||||||
const MsdFile::value_t &sParams = msd.GetValue(i);
|
const MsdFile::value_t &sParams = msd.GetValue(i);
|
||||||
|
|
||||||
// handle the data
|
// handle the data
|
||||||
if( 0 == stricmp(sValueName, "COURSE") )
|
if( sValueName.EqualsNoCase("COURSE") )
|
||||||
out.m_sMainTitle = sParams[1];
|
out.m_sMainTitle = sParams[1];
|
||||||
else if( 0 == stricmp(sValueName, "COURSETRANSLIT") )
|
else if( sValueName.EqualsNoCase("COURSETRANSLIT") )
|
||||||
out.m_sMainTitleTranslit = sParams[1];
|
out.m_sMainTitleTranslit = sParams[1];
|
||||||
else if( 0 == stricmp(sValueName, "SCRIPTER") )
|
else if( sValueName.EqualsNoCase("SCRIPTER") )
|
||||||
out.m_sScripter = sParams[1];
|
out.m_sScripter = sParams[1];
|
||||||
else if( 0 == stricmp(sValueName, "REPEAT") )
|
else if( sValueName.EqualsNoCase("REPEAT") )
|
||||||
{
|
{
|
||||||
RString str = sParams[1];
|
RString str = sParams[1];
|
||||||
str.MakeLower();
|
str.MakeLower();
|
||||||
@@ -75,27 +75,27 @@ bool CourseLoaderCRS::LoadFromMsd( const RString &sPath, const MsdFile &msd, Cou
|
|||||||
out.m_bRepeat = true;
|
out.m_bRepeat = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( 0 == stricmp(sValueName, "BANNER") )
|
else if( sValueName.EqualsNoCase("BANNER") )
|
||||||
{
|
{
|
||||||
out.m_sBannerPath = sParams[1];
|
out.m_sBannerPath = sParams[1];
|
||||||
}
|
}
|
||||||
else if( 0 == stricmp(sValueName, "BACKGROUND") )
|
else if( sValueName.EqualsNoCase("BACKGROUND") )
|
||||||
{
|
{
|
||||||
out.m_sBackgroundPath = sParams[1];
|
out.m_sBackgroundPath = sParams[1];
|
||||||
}
|
}
|
||||||
else if( 0 == stricmp(sValueName, "LIVES") )
|
else if( sValueName.EqualsNoCase("LIVES") )
|
||||||
{
|
{
|
||||||
out.m_iLives = max( atoi(sParams[1]), 0 );
|
out.m_iLives = max( StringToInt(sParams[1]), 0 );
|
||||||
}
|
}
|
||||||
else if( 0 == stricmp(sValueName, "GAINSECONDS") )
|
else if( sValueName.EqualsNoCase("GAINSECONDS") )
|
||||||
{
|
{
|
||||||
fGainSeconds = StringToFloat( sParams[1] );
|
fGainSeconds = StringToFloat( sParams[1] );
|
||||||
}
|
}
|
||||||
else if( 0 == stricmp(sValueName, "METER") )
|
else if( sValueName.EqualsNoCase("METER") )
|
||||||
{
|
{
|
||||||
if( sParams.params.size() == 2 )
|
if( sParams.params.size() == 2 )
|
||||||
{
|
{
|
||||||
out.m_iCustomMeter[Difficulty_Medium] = max( atoi(sParams[1]), 0 ); /* compat */
|
out.m_iCustomMeter[Difficulty_Medium] = max( StringToInt(sParams[1]), 0 ); /* compat */
|
||||||
}
|
}
|
||||||
else if( sParams.params.size() == 3 )
|
else if( sParams.params.size() == 3 )
|
||||||
{
|
{
|
||||||
@@ -105,12 +105,12 @@ bool CourseLoaderCRS::LoadFromMsd( const RString &sPath, const MsdFile &msd, Cou
|
|||||||
LOG->UserLog( "Course file", sPath, "contains an invalid #METER string: \"%s\"", sParams[1].c_str() );
|
LOG->UserLog( "Course file", sPath, "contains an invalid #METER string: \"%s\"", sParams[1].c_str() );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
out.m_iCustomMeter[cd] = max( atoi(sParams[2]), 0 );
|
out.m_iCustomMeter[cd] = max( StringToInt(sParams[2]), 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// todo: add COMBO and COMBOMODE from DWI CRS files? -aj
|
// todo: add COMBO and COMBOMODE from DWI CRS files? -aj
|
||||||
|
|
||||||
else if( 0 == stricmp(sValueName, "MODS") )
|
else if( sValueName.EqualsNoCase("MODS") )
|
||||||
{
|
{
|
||||||
Attack attack;
|
Attack attack;
|
||||||
float end = -9999;
|
float end = -9999;
|
||||||
@@ -156,7 +156,7 @@ bool CourseLoaderCRS::LoadFromMsd( const RString &sPath, const MsdFile &msd, Cou
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if( 0 == stricmp(sValueName, "SONG") )
|
else if( sValueName.EqualsNoCase("SONG") )
|
||||||
{
|
{
|
||||||
CourseEntry new_entry;
|
CourseEntry new_entry;
|
||||||
|
|
||||||
@@ -167,28 +167,28 @@ bool CourseLoaderCRS::LoadFromMsd( const RString &sPath, const MsdFile &msd, Cou
|
|||||||
// most played
|
// most played
|
||||||
if( sParams[1].Left(strlen("BEST")) == "BEST" )
|
if( sParams[1].Left(strlen("BEST")) == "BEST" )
|
||||||
{
|
{
|
||||||
new_entry.iChooseIndex = atoi( sParams[1].Right(sParams[1].size()-strlen("BEST")) ) - 1;
|
new_entry.iChooseIndex = StringToInt( sParams[1].Right(sParams[1].size()-strlen("BEST")) ) - 1;
|
||||||
CLAMP( new_entry.iChooseIndex, 0, 500 );
|
CLAMP( new_entry.iChooseIndex, 0, 500 );
|
||||||
new_entry.songSort = SongSort_MostPlays;
|
new_entry.songSort = SongSort_MostPlays;
|
||||||
}
|
}
|
||||||
// least played
|
// least played
|
||||||
else if( sParams[1].Left(strlen("WORST")) == "WORST" )
|
else if( sParams[1].Left(strlen("WORST")) == "WORST" )
|
||||||
{
|
{
|
||||||
new_entry.iChooseIndex = atoi( sParams[1].Right(sParams[1].size()-strlen("WORST")) ) - 1;
|
new_entry.iChooseIndex = StringToInt( sParams[1].Right(sParams[1].size()-strlen("WORST")) ) - 1;
|
||||||
CLAMP( new_entry.iChooseIndex, 0, 500 );
|
CLAMP( new_entry.iChooseIndex, 0, 500 );
|
||||||
new_entry.songSort = SongSort_FewestPlays;
|
new_entry.songSort = SongSort_FewestPlays;
|
||||||
}
|
}
|
||||||
// best grades
|
// best grades
|
||||||
else if( sParams[1].Left(strlen("GRADEBEST")) == "GRADEBEST" )
|
else if( sParams[1].Left(strlen("GRADEBEST")) == "GRADEBEST" )
|
||||||
{
|
{
|
||||||
new_entry.iChooseIndex = atoi( sParams[1].Right(sParams[1].size()-strlen("GRADEBEST")) ) - 1;
|
new_entry.iChooseIndex = StringToInt( sParams[1].Right(sParams[1].size()-strlen("GRADEBEST")) ) - 1;
|
||||||
CLAMP( new_entry.iChooseIndex, 0, 500 );
|
CLAMP( new_entry.iChooseIndex, 0, 500 );
|
||||||
new_entry.songSort = SongSort_TopGrades;
|
new_entry.songSort = SongSort_TopGrades;
|
||||||
}
|
}
|
||||||
// worst grades
|
// worst grades
|
||||||
else if( sParams[1].Left(strlen("GRADEWORST")) == "GRADEWORST" )
|
else if( sParams[1].Left(strlen("GRADEWORST")) == "GRADEWORST" )
|
||||||
{
|
{
|
||||||
new_entry.iChooseIndex = atoi( sParams[1].Right(sParams[1].size()-strlen("GRADEWORST")) ) - 1;
|
new_entry.iChooseIndex = StringToInt( sParams[1].Right(sParams[1].size()-strlen("GRADEWORST")) ) - 1;
|
||||||
CLAMP( new_entry.iChooseIndex, 0, 500 );
|
CLAMP( new_entry.iChooseIndex, 0, 500 );
|
||||||
new_entry.songSort = SongSort_LowestGrades;
|
new_entry.songSort = SongSort_LowestGrades;
|
||||||
}
|
}
|
||||||
@@ -284,7 +284,7 @@ bool CourseLoaderCRS::LoadFromMsd( const RString &sPath, const MsdFile &msd, Cou
|
|||||||
else if( !sMod.CompareNoCase("nodifficult") )
|
else if( !sMod.CompareNoCase("nodifficult") )
|
||||||
new_entry.bNoDifficult = true;
|
new_entry.bNoDifficult = true;
|
||||||
else if( sMod.length() > 5 && !sMod.Left(5).CompareNoCase("award") )
|
else if( sMod.length() > 5 && !sMod.Left(5).CompareNoCase("award") )
|
||||||
new_entry.iGainLives = atoi( sMod.substr(5).c_str() );
|
new_entry.iGainLives = StringToInt( sMod.substr(5) );
|
||||||
else
|
else
|
||||||
continue;
|
continue;
|
||||||
mods.erase( mods.begin() + j );
|
mods.erase( mods.begin() + j );
|
||||||
@@ -298,22 +298,22 @@ bool CourseLoaderCRS::LoadFromMsd( const RString &sPath, const MsdFile &msd, Cou
|
|||||||
|
|
||||||
out.m_vEntries.push_back( new_entry );
|
out.m_vEntries.push_back( new_entry );
|
||||||
}
|
}
|
||||||
else if( !stricmp(sValueName, "DISPLAYCOURSE") || !stricmp(sValueName, "COMBO") ||
|
else if( !sValueName.EqualsNoCase("DISPLAYCOURSE") || !sValueName.EqualsNoCase("COMBO") ||
|
||||||
!stricmp(sValueName, "COMBOMODE") )
|
!sValueName.EqualsNoCase("COMBOMODE") )
|
||||||
{
|
{
|
||||||
// Ignore
|
// Ignore
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( bFromCache && !stricmp(sValueName, "RADAR") )
|
else if( bFromCache && !sValueName.EqualsNoCase("RADAR") )
|
||||||
{
|
{
|
||||||
StepsType st = (StepsType) atoi(sParams[1]);
|
StepsType st = (StepsType) StringToInt(sParams[1]);
|
||||||
CourseDifficulty cd = (CourseDifficulty) atoi( sParams[2] );
|
CourseDifficulty cd = (CourseDifficulty) StringToInt( sParams[2] );
|
||||||
|
|
||||||
RadarValues rv;
|
RadarValues rv;
|
||||||
rv.FromString( sParams[3] );
|
rv.FromString( sParams[3] );
|
||||||
out.m_RadarCache[Course::CacheEntry(st, cd)] = rv;
|
out.m_RadarCache[Course::CacheEntry(st, cd)] = rv;
|
||||||
}
|
}
|
||||||
else if( 0 == stricmp(sValueName, "STYLE") )
|
else if( sValueName.EqualsNoCase("STYLE") )
|
||||||
{
|
{
|
||||||
RString sStyles = sParams[1];
|
RString sStyles = sParams[1];
|
||||||
vector<RString> asStyles;
|
vector<RString> asStyles;
|
||||||
|
|||||||
@@ -272,14 +272,14 @@ void FileTransfer::HTTPUpdate()
|
|||||||
m_sResponseName = "Malformed response.";
|
m_sResponseName = "Malformed response.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_iResponseCode = atoi(m_sBUFFER.substr(i+1,j-i).c_str());
|
m_iResponseCode = StringToInt(m_sBUFFER.substr(i+1,j-i));
|
||||||
m_sResponseName = m_sBUFFER.substr( j+1, k-j );
|
m_sResponseName = m_sBUFFER.substr( j+1, k-j );
|
||||||
|
|
||||||
i = m_sBUFFER.find("Content-Length:");
|
i = m_sBUFFER.find("Content-Length:");
|
||||||
j = m_sBUFFER.find("\n", i+1 );
|
j = m_sBUFFER.find("\n", i+1 );
|
||||||
|
|
||||||
if( i != string::npos )
|
if( i != string::npos )
|
||||||
m_iTotalBytes = atoi(m_sBUFFER.substr(i+16,j-i).c_str());
|
m_iTotalBytes = StringToInt(m_sBUFFER.substr(i+16,j-i));
|
||||||
else
|
else
|
||||||
m_iTotalBytes = -1; // We don't know, so go until disconnect
|
m_iTotalBytes = -1; // We don't know, so go until disconnect
|
||||||
|
|
||||||
@@ -350,7 +350,7 @@ bool FileTransfer::ParseHTTPAddress( const RString &URL, RString &sProto, RStrin
|
|||||||
sServer = asMatches[1];
|
sServer = asMatches[1];
|
||||||
if( asMatches[3] != "" )
|
if( asMatches[3] != "" )
|
||||||
{
|
{
|
||||||
iPort = atoi(asMatches[3]);
|
iPort = StringToInt(asMatches[3]);
|
||||||
if( iPort == 0 )
|
if( iPort == 0 )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -414,7 +414,7 @@ void Font::LoadFontPageSettings( FontPageSettings &cfg, IniFile &ini, const RStr
|
|||||||
// If val is an integer, it's a width, eg. "10=27".
|
// If val is an integer, it's a width, eg. "10=27".
|
||||||
if( IsAnInt(sName) )
|
if( IsAnInt(sName) )
|
||||||
{
|
{
|
||||||
cfg.m_mapGlyphWidths[atoi(sName)] = pValue->GetValue<int>();
|
cfg.m_mapGlyphWidths[StringToInt(sName)] = pValue->GetValue<int>();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -516,7 +516,7 @@ void Font::LoadFontPageSettings( FontPageSettings &cfg, IniFile &ini, const RStr
|
|||||||
TrimLeft( sRowStr );
|
TrimLeft( sRowStr );
|
||||||
|
|
||||||
ASSERT( IsAnInt(sRowStr) );
|
ASSERT( IsAnInt(sRowStr) );
|
||||||
const int iRow = atoi( sRowStr.c_str() );
|
const int iRow = StringToInt( sRowStr );
|
||||||
const int iFirstFrame = iRow * iNumFramesWide;
|
const int iFirstFrame = iRow * iNumFramesWide;
|
||||||
|
|
||||||
if( iRow > iNumFramesHigh )
|
if( iRow > iNumFramesHigh )
|
||||||
|
|||||||
+2
-2
@@ -335,12 +335,12 @@ void GameCommand::LoadOne( const Command& cmd )
|
|||||||
|
|
||||||
else if( sName == "weight" )
|
else if( sName == "weight" )
|
||||||
{
|
{
|
||||||
m_iWeightPounds = atoi( sValue );
|
m_iWeightPounds = StringToInt( sValue );
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( sName == "goalcalories" )
|
else if( sName == "goalcalories" )
|
||||||
{
|
{
|
||||||
m_iGoalCalories = atoi( sValue );
|
m_iGoalCalories = StringToInt( sValue );
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( sName == "goaltype" )
|
else if( sName == "goaltype" )
|
||||||
|
|||||||
@@ -87,8 +87,10 @@ enum StepsType
|
|||||||
StepsType_para_single,
|
StepsType_para_single,
|
||||||
StepsType_ds3ddx_single,
|
StepsType_ds3ddx_single,
|
||||||
StepsType_beat_single5,
|
StepsType_beat_single5,
|
||||||
|
StepsType_beat_versus5,
|
||||||
StepsType_beat_double5,
|
StepsType_beat_double5,
|
||||||
StepsType_beat_single7,
|
StepsType_beat_single7,
|
||||||
|
StepsType_beat_versus7,
|
||||||
StepsType_beat_double7,
|
StepsType_beat_double7,
|
||||||
StepsType_maniax_single,
|
StepsType_maniax_single,
|
||||||
StepsType_maniax_double,
|
StepsType_maniax_double,
|
||||||
|
|||||||
+89
-2
@@ -1584,7 +1584,47 @@ static const Style g_Style_Beat_Single5 =
|
|||||||
false, // m_bLockDifficulties
|
false, // m_bLockDifficulties
|
||||||
};
|
};
|
||||||
|
|
||||||
static const Style g_Style_Beat_Double =
|
static const Style g_Style_Beat_Versus5 =
|
||||||
|
{ // STYLE_BEAT_VERSUS
|
||||||
|
true, // m_bUsedForGameplay
|
||||||
|
false, // m_bUsedForEdit
|
||||||
|
true, // m_bUsedForDemonstration
|
||||||
|
false, // m_bUsedForHowToPlay
|
||||||
|
"versus", // m_szName
|
||||||
|
StepsType_beat_versus5, // m_StepsType
|
||||||
|
StyleType_TwoPlayersTwoSides, // m_StyleType
|
||||||
|
6, // m_iColsPerPlayer
|
||||||
|
{ // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER];
|
||||||
|
{ // PLAYER_1
|
||||||
|
{ TRACK_1, -BEAT_COL_SPACING*2.5f, NULL },
|
||||||
|
{ TRACK_2, -BEAT_COL_SPACING*1.5f, NULL },
|
||||||
|
{ TRACK_3, -BEAT_COL_SPACING*0.5f, NULL },
|
||||||
|
{ TRACK_4, +BEAT_COL_SPACING*0.5f, NULL },
|
||||||
|
{ TRACK_5, +BEAT_COL_SPACING*1.5f, NULL },
|
||||||
|
{ TRACK_6, +BEAT_COL_SPACING*3.0f, "scratch" },
|
||||||
|
},
|
||||||
|
{ // PLAYER_2
|
||||||
|
{ TRACK_1, -BEAT_COL_SPACING*2.5f, NULL },
|
||||||
|
{ TRACK_2, -BEAT_COL_SPACING*1.5f, NULL },
|
||||||
|
{ TRACK_3, -BEAT_COL_SPACING*0.5f, NULL },
|
||||||
|
{ TRACK_4, +BEAT_COL_SPACING*0.5f, NULL },
|
||||||
|
{ TRACK_5, +BEAT_COL_SPACING*1.5f, NULL },
|
||||||
|
{ TRACK_6, +BEAT_COL_SPACING*3.0f, "scratch" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ // m_iInputColumn[NUM_GameController][NUM_GameButton]
|
||||||
|
{ 0, 1, 2, 3, 4, Style::NO_MAPPING, Style::NO_MAPPING, 5, 5, Style::END_MAPPING },
|
||||||
|
{ 0, 1, 2, 3, 4, Style::NO_MAPPING, Style::NO_MAPPING, 5, 5, Style::END_MAPPING }
|
||||||
|
},
|
||||||
|
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
|
||||||
|
0,1,2,3,4,5
|
||||||
|
},
|
||||||
|
false, // m_bNeedsZoomOutWith2Players
|
||||||
|
false, // m_bCanUseBeginnerHelper
|
||||||
|
false, // m_bLockDifficulties
|
||||||
|
};
|
||||||
|
|
||||||
|
static const Style g_Style_Beat_Double5 =
|
||||||
{ // STYLE_BEAT_DOUBLE
|
{ // STYLE_BEAT_DOUBLE
|
||||||
true, // m_bUsedForGameplay
|
true, // m_bUsedForGameplay
|
||||||
true, // m_bUsedForEdit
|
true, // m_bUsedForEdit
|
||||||
@@ -1680,6 +1720,51 @@ static const Style g_Style_Beat_Single7 =
|
|||||||
false, // m_bLockDifficulties
|
false, // m_bLockDifficulties
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const Style g_Style_Beat_Versus7 =
|
||||||
|
{ // STYLE_BEAT_VERSUS7
|
||||||
|
true, // m_bUsedForGameplay
|
||||||
|
true, // m_bUsedForEdit
|
||||||
|
false, // m_bUsedForDemonstration
|
||||||
|
false, // m_bUsedForHowToPlay
|
||||||
|
"single7", // m_szName
|
||||||
|
StepsType_beat_versus7, // m_StepsType
|
||||||
|
StyleType_TwoPlayersTwoSides, // m_StyleType
|
||||||
|
8, // m_iColsPerPlayer
|
||||||
|
{ // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER];
|
||||||
|
{ // PLAYER_1
|
||||||
|
{ TRACK_8, -BEAT_COL_SPACING*3.5f, "scratch" },
|
||||||
|
{ TRACK_1, -BEAT_COL_SPACING*2.0f, NULL },
|
||||||
|
{ TRACK_2, -BEAT_COL_SPACING*1.0f, NULL },
|
||||||
|
{ TRACK_3, -BEAT_COL_SPACING*0.0f, NULL },
|
||||||
|
{ TRACK_4, +BEAT_COL_SPACING*1.0f, NULL },
|
||||||
|
{ TRACK_5, +BEAT_COL_SPACING*2.0f, NULL },
|
||||||
|
{ TRACK_6, +BEAT_COL_SPACING*3.0f, NULL },
|
||||||
|
{ TRACK_7, +BEAT_COL_SPACING*4.0f, NULL },
|
||||||
|
},
|
||||||
|
{ // PLAYER_2
|
||||||
|
{ TRACK_1, -BEAT_COL_SPACING*3.5f, NULL },
|
||||||
|
{ TRACK_2, -BEAT_COL_SPACING*2.5f, NULL },
|
||||||
|
{ TRACK_3, -BEAT_COL_SPACING*1.5f, NULL },
|
||||||
|
{ TRACK_4, -BEAT_COL_SPACING*0.5f, NULL },
|
||||||
|
{ TRACK_5, +BEAT_COL_SPACING*0.5f, NULL },
|
||||||
|
{ TRACK_6, +BEAT_COL_SPACING*1.5f, NULL },
|
||||||
|
{ TRACK_7, +BEAT_COL_SPACING*2.5f, NULL },
|
||||||
|
{ TRACK_8, +BEAT_COL_SPACING*4.0f, "scratch" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ // m_iInputColumn[NUM_GameController][NUM_GameButton]
|
||||||
|
{ 1, 2, 3, 4, 5, 6, 7, 0, 0, Style::END_MAPPING },
|
||||||
|
{ 0, 1, 2, 3, 4, 5, 6, 7, 7, Style::END_MAPPING },
|
||||||
|
},
|
||||||
|
{ // m_iColumnDrawOrder[MAX_COLS_PER_PLAYER];
|
||||||
|
0,1,2,3,4,5,6,7
|
||||||
|
},
|
||||||
|
false, // m_bNeedsZoomOutWith2Players
|
||||||
|
false, // m_bCanUseBeginnerHelper
|
||||||
|
false, // m_bLockDifficulties
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
static const Style g_Style_Beat_Double7 =
|
static const Style g_Style_Beat_Double7 =
|
||||||
{ // STYLE_BEAT_DOUBLE7
|
{ // STYLE_BEAT_DOUBLE7
|
||||||
true, // m_bUsedForGameplay
|
true, // m_bUsedForGameplay
|
||||||
@@ -1743,8 +1828,10 @@ static const Style g_Style_Beat_Double7 =
|
|||||||
static const Style *g_apGame_Beat_Styles[] =
|
static const Style *g_apGame_Beat_Styles[] =
|
||||||
{
|
{
|
||||||
&g_Style_Beat_Single5,
|
&g_Style_Beat_Single5,
|
||||||
&g_Style_Beat_Double,
|
&g_Style_Beat_Versus5,
|
||||||
|
&g_Style_Beat_Double5,
|
||||||
&g_Style_Beat_Single7,
|
&g_Style_Beat_Single7,
|
||||||
|
&g_Style_Beat_Versus7,
|
||||||
&g_Style_Beat_Double7,
|
&g_Style_Beat_Double7,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -806,12 +806,14 @@ public:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
static int PlayOnce( T* p, lua_State *L ) { RString sPath = SArg(1); p->PlayOnce( sPath ); return 0; }
|
static int PlayOnce( T* p, lua_State *L ) { RString sPath = SArg(1); p->PlayOnce( sPath ); return 0; }
|
||||||
|
static int PlayAnnouncer( T* p, lua_State *L ) { RString sPath = SArg(1); p->PlayOnceFromAnnouncer( sPath ); return 0; }
|
||||||
static int GetPlayerBalance( T* p, lua_State *L ) { PlayerNumber pn = Enum::Check<PlayerNumber>(L, 1); lua_pushnumber( L, p->GetPlayerBalance(pn) ); return 1; }
|
static int GetPlayerBalance( T* p, lua_State *L ) { PlayerNumber pn = Enum::Check<PlayerNumber>(L, 1); lua_pushnumber( L, p->GetPlayerBalance(pn) ); return 1; }
|
||||||
|
|
||||||
LunaGameSoundManager()
|
LunaGameSoundManager()
|
||||||
{
|
{
|
||||||
ADD_METHOD( DimMusic );
|
ADD_METHOD( DimMusic );
|
||||||
ADD_METHOD( PlayOnce );
|
ADD_METHOD( PlayOnce );
|
||||||
|
ADD_METHOD( PlayAnnouncer );
|
||||||
ADD_METHOD( GetPlayerBalance );
|
ADD_METHOD( GetPlayerBalance );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
+1
-1
@@ -209,7 +209,7 @@ void GameState::ApplyCmdline()
|
|||||||
RString sPlayer;
|
RString sPlayer;
|
||||||
for( int i = 0; GetCommandlineArgument( "player", &sPlayer, i ); ++i )
|
for( int i = 0; GetCommandlineArgument( "player", &sPlayer, i ); ++i )
|
||||||
{
|
{
|
||||||
int pn = atoi( sPlayer )-1;
|
int pn = StringToInt( sPlayer )-1;
|
||||||
if( !IsAnInt( sPlayer ) || pn < 0 || pn >= NUM_PLAYERS )
|
if( !IsAnInt( sPlayer ) || pn < 0 || pn >= NUM_PLAYERS )
|
||||||
RageException::Throw( "Invalid argument \"--player=%s\".", sPlayer.c_str() );
|
RageException::Throw( "Invalid argument \"--player=%s\".", sPlayer.c_str() );
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -948,7 +948,7 @@ MultiPlayer InputMapper::InputDeviceToMultiPlayer( InputDevice id )
|
|||||||
GameButton InputScheme::ButtonNameToIndex( const RString &sButtonName ) const
|
GameButton InputScheme::ButtonNameToIndex( const RString &sButtonName ) const
|
||||||
{
|
{
|
||||||
for( GameButton gb=(GameButton) 0; gb<m_iButtonsPerController; gb=(GameButton)(gb+1) )
|
for( GameButton gb=(GameButton) 0; gb<m_iButtonsPerController; gb=(GameButton)(gb+1) )
|
||||||
if( stricmp(GetGameButtonName(gb), sButtonName) == 0 )
|
if( sButtonName.EqualsNoCase(GetGameButtonName(gb)) )
|
||||||
return gb;
|
return gb;
|
||||||
|
|
||||||
return GameButton_Invalid;
|
return GameButton_Invalid;
|
||||||
|
|||||||
+184
-2
@@ -1,9 +1,10 @@
|
|||||||
|
/** @brief Utilities for handling JSON data. */
|
||||||
#ifndef JsonUtil_H
|
#ifndef JsonUtil_H
|
||||||
#define JsonUtil_H
|
#define JsonUtil_H
|
||||||
|
|
||||||
class RageFileBasic;
|
class RageFileBasic;
|
||||||
#include "../extern/jsoncpp/include/json/value.h"
|
#include "json/value.h"
|
||||||
/** @brief Utilities for handling JSON data. */
|
|
||||||
namespace JsonUtil
|
namespace JsonUtil
|
||||||
{
|
{
|
||||||
bool LoadFromString( Json::Value &root, RString sData, RString &sErrorOut );
|
bool LoadFromString( Json::Value &root, RString sData, RString &sErrorOut );
|
||||||
@@ -31,6 +32,86 @@ namespace JsonUtil
|
|||||||
fn(*v[i], root[i]);
|
fn(*v[i], root[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename V, typename T>
|
||||||
|
static void SerializeArray(const V &v, void fn(const T &, Json::Value &), Json::Value &root)
|
||||||
|
{
|
||||||
|
root = Json::Value(Json::arrayValue);
|
||||||
|
root.resize( v.size() );
|
||||||
|
int i=0;
|
||||||
|
for( typename V::const_iterator iter=v.begin(); iter!=v.end(); iter++ )
|
||||||
|
fn( *iter, root[i++] );
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename V>
|
||||||
|
static void SerializeArrayValues(const V &v, Json::Value &root)
|
||||||
|
{
|
||||||
|
root = Json::Value(Json::arrayValue);
|
||||||
|
root.resize( v.size() );
|
||||||
|
int i=0;
|
||||||
|
for( typename V::const_iterator iter=v.begin(); iter!=v.end(); iter++ )
|
||||||
|
root[i++] = *iter;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename V>
|
||||||
|
static void SerializeArrayObjects(const V &v, Json::Value &root)
|
||||||
|
{
|
||||||
|
root = Json::Value(Json::arrayValue);
|
||||||
|
root.resize( v.size() );
|
||||||
|
int i=0;
|
||||||
|
for( typename V::const_iterator iter=v.begin(); iter!=v.end(); iter++ )
|
||||||
|
iter->Serialize( root[i++] );
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename M, typename E, typename F>
|
||||||
|
static void SerializeStringToObjectMap(const M &m, F fnEnumToString(E e), Json::Value &root)
|
||||||
|
{
|
||||||
|
for( typename M::const_iterator iter=m.begin(); iter!=m.end(); iter++ )
|
||||||
|
iter->second.Serialize( root[ fnEnumToString(iter->first) ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename M, typename E, typename F>
|
||||||
|
static void SerializeStringToValueMap(const M &m, F fnToString(E e), Json::Value &root)
|
||||||
|
{
|
||||||
|
for( typename M::const_iterator iter=m.begin(); iter!=m.end(); iter++ )
|
||||||
|
root[ fnToString(iter->first) ] = iter->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename M>
|
||||||
|
static void SerializeValueToValueMap(const M &m, Json::Value &root)
|
||||||
|
{
|
||||||
|
for( typename M::const_iterator iter=m.begin(); iter!=m.end(); iter++ )
|
||||||
|
root[ (iter->first) ] = iter->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Serialize a map that has a non-string key type
|
||||||
|
template <typename V>
|
||||||
|
static void SerializeObjectToObjectMapAsArray(const V &v, const RString &sKeyName, const RString &sValueName, Json::Value &root)
|
||||||
|
{
|
||||||
|
root = Json::Value(Json::arrayValue);
|
||||||
|
root.resize( v.size() );
|
||||||
|
int i=0;
|
||||||
|
for( typename V::const_iterator iter=v.begin(); iter!=v.end(); iter++ )
|
||||||
|
{
|
||||||
|
Json::Value &vv = root[i++];
|
||||||
|
iter->first.Serialize( vv[sKeyName] );
|
||||||
|
iter->second.Serialize( vv[sValueName] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename V>
|
||||||
|
static void SerializeObjectToValueMapAsArray(const V &v, const RString &sKeyName, const RString &sValueName, Json::Value &root)
|
||||||
|
{
|
||||||
|
root = Json::Value(Json::arrayValue);
|
||||||
|
root.resize( v.size() );
|
||||||
|
int i=0;
|
||||||
|
for( typename V::const_iterator iter=v.begin(); iter!=v.end(); iter++ )
|
||||||
|
{
|
||||||
|
Json::Value &vv = root[i++];
|
||||||
|
iter->first.Serialize( vv[sKeyName] );
|
||||||
|
vv[sValueName] = iter->second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
static void SerializeVectorValues(const vector<T> &v, Json::Value &root)
|
static void SerializeVectorValues(const vector<T> &v, Json::Value &root)
|
||||||
{
|
{
|
||||||
@@ -48,6 +129,14 @@ namespace JsonUtil
|
|||||||
fn(v[i], root[i]);
|
fn(v[i], root[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename V>
|
||||||
|
static void DeserializeArrayObjects( V &v, const Json::Value &root)
|
||||||
|
{
|
||||||
|
v.resize( root.size() );
|
||||||
|
for( unsigned i=0; i<v.size(); i++ )
|
||||||
|
v[i].Deserialize( root[i] );
|
||||||
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
static void DeserializeVectorPointers(vector<T*> &v, void fn(T &, const Json::Value &), const Json::Value &root)
|
static void DeserializeVectorPointers(vector<T*> &v, void fn(T &, const Json::Value &), const Json::Value &root)
|
||||||
{
|
{
|
||||||
@@ -61,6 +150,99 @@ namespace JsonUtil
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
static void DeserializeArrayValues(vector<T> &v, const Json::Value &root)
|
||||||
|
{
|
||||||
|
v.clear();
|
||||||
|
for( unsigned i=0; i<root.size(); i++ )
|
||||||
|
{
|
||||||
|
T t;
|
||||||
|
if( root[i].TryGet( t ) )
|
||||||
|
v.push_back( t );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// don't pull in the set header here
|
||||||
|
template<typename S, typename T>
|
||||||
|
static void DeserializeArrayValuesIntoSet(S &s, const Json::Value &root)
|
||||||
|
{
|
||||||
|
s.clear();
|
||||||
|
for( unsigned i=0; i<root.size(); i++ )
|
||||||
|
{
|
||||||
|
T t;
|
||||||
|
if( root[i].TryGet( t ) )
|
||||||
|
s.insert( t );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
static void DeserializeArrayValuesIntoVector(vector<T> &v, const Json::Value &root)
|
||||||
|
{
|
||||||
|
v.clear();
|
||||||
|
for( unsigned i=0; i<root.size(); i++ )
|
||||||
|
{
|
||||||
|
T t;
|
||||||
|
if( root[i].TryGet( t ) )
|
||||||
|
v.push_back( t );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename M>
|
||||||
|
static void DeserializeValueToValueMap(M &m, const Json::Value &root)
|
||||||
|
{
|
||||||
|
for( Json::Value::const_iterator iter = root.begin(); iter != root.end(); iter++ )
|
||||||
|
(*iter).TryGet( m[ iter.memberName() ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename M, typename E, typename F>
|
||||||
|
static void DeserializeStringToValueMap(M &m, F fnToValue(E e), const Json::Value &root)
|
||||||
|
{
|
||||||
|
for( Json::Value::const_iterator iter = root.begin(); iter != root.end(); iter++ )
|
||||||
|
(*iter).TryGet( m[ fnToValue(iter.memberName()) ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename M, typename E, typename F>
|
||||||
|
static void DeserializeStringToObjectMap(M &m, F fnToValue(E e), const Json::Value &root)
|
||||||
|
{
|
||||||
|
for( Json::Value::const_iterator iter = root.begin(); iter != root.end(); iter++ )
|
||||||
|
m[ fnToValue(iter.memberName()) ].Deserialize( *iter );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Serialize a map that has a non-string key type
|
||||||
|
template <typename K, typename V>
|
||||||
|
static void DeserializeObjectToObjectMapAsArray(map<K,V> &m, const RString &sKeyName, const RString &sValueName, const Json::Value &root)
|
||||||
|
{
|
||||||
|
m.clear();
|
||||||
|
ASSERT( root.type() == Json::arrayValue );
|
||||||
|
for( Json::Value::const_iterator iter = root.begin(); iter != root.end(); iter++ )
|
||||||
|
{
|
||||||
|
ASSERT( (*iter).type() == Json::objectValue );
|
||||||
|
K k;
|
||||||
|
if( !k.Deserialize( (*iter)[sKeyName] ) )
|
||||||
|
continue;
|
||||||
|
V v;
|
||||||
|
if( !v.Deserialize( (*iter)[sValueName] ) )
|
||||||
|
continue;
|
||||||
|
m[k] = v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename K, typename V>
|
||||||
|
static void DeserializeObjectToValueMapAsArray(map<K,V> &m, const RString &sKeyName, const RString &sValueName, const Json::Value &root)
|
||||||
|
{
|
||||||
|
for( unsigned i=0; i<root.size(); i++ )
|
||||||
|
{
|
||||||
|
const Json::Value &root2 = root[i];
|
||||||
|
K k;
|
||||||
|
if( !k.Deserialize( root2[sKeyName] ) )
|
||||||
|
continue;
|
||||||
|
V v;
|
||||||
|
if( !root2[sValueName].TryGet(v) )
|
||||||
|
continue;
|
||||||
|
m[k] = v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
static void DeserializeVectorValues(vector<T> &v, const Json::Value &root)
|
static void DeserializeVectorValues(vector<T> &v, const Json::Value &root)
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -11,7 +11,7 @@
|
|||||||
#include "Command.h"
|
#include "Command.h"
|
||||||
#include "RageTypes.h"
|
#include "RageTypes.h"
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream> // conversion for lua functions.
|
||||||
#include <csetjmp>
|
#include <csetjmp>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ bool LyricsLoader::LoadFromLRCFile(const RString& sPath, Song& out)
|
|||||||
StripCrnl(sValueData);
|
StripCrnl(sValueData);
|
||||||
|
|
||||||
// handle the data
|
// handle the data
|
||||||
if( 0==stricmp(sValueName,"COLOUR") || 0==stricmp(sValueName,"COLOR") )
|
if( sValueName.EqualsNoCase("COLOUR") || sValueName.EqualsNoCase("COLOR") )
|
||||||
{
|
{
|
||||||
// set color var here for this segment
|
// set color var here for this segment
|
||||||
int r, g, b;
|
int r, g, b;
|
||||||
|
|||||||
@@ -158,10 +158,12 @@ ModsGroup.cpp ModsGroup.h \
|
|||||||
NoteData.cpp NoteData.h NoteDataUtil.cpp NoteDataUtil.h NoteDataWithScoring.cpp NoteDataWithScoring.h \
|
NoteData.cpp NoteData.h NoteDataUtil.cpp NoteDataUtil.h NoteDataWithScoring.cpp NoteDataWithScoring.h \
|
||||||
NoteTypes.cpp NoteTypes.h NotesLoader.cpp NotesLoader.h \
|
NoteTypes.cpp NoteTypes.h NotesLoader.cpp NotesLoader.h \
|
||||||
NotesLoaderBMS.cpp NotesLoaderBMS.h NotesLoaderDWI.cpp NotesLoaderDWI.h \
|
NotesLoaderBMS.cpp NotesLoaderBMS.h NotesLoaderDWI.cpp NotesLoaderDWI.h \
|
||||||
|
NotesLoaderJson.cpp NotesLoaderJson.h \
|
||||||
NotesLoaderKSF.cpp NotesLoaderKSF.h NotesLoaderMidi.cpp NotesLoaderMidi.h \
|
NotesLoaderKSF.cpp NotesLoaderKSF.h NotesLoaderMidi.cpp NotesLoaderMidi.h \
|
||||||
NotesLoaderPMS.cpp NotesLoaderPMS.h NotesLoaderSM.cpp NotesLoaderSM.h \
|
NotesLoaderPMS.cpp NotesLoaderPMS.h NotesLoaderSM.cpp NotesLoaderSM.h \
|
||||||
NotesLoaderSSC.cpp NotesLoaderSSC.h NotesLoaderSMA.cpp NotesLoaderSMA.h \
|
NotesLoaderSSC.cpp NotesLoaderSSC.h NotesLoaderSMA.cpp NotesLoaderSMA.h \
|
||||||
NotesWriterDWI.cpp NotesWriterDWI.h \
|
NotesWriterDWI.cpp NotesWriterDWI.h \
|
||||||
|
NotesWriterJson.cpp NotesWriterJson.h \
|
||||||
NotesWriterSM.cpp NotesWriterSM.h NotesWriterSSC.cpp NotesWriterSSC.h \
|
NotesWriterSM.cpp NotesWriterSM.h NotesWriterSSC.cpp NotesWriterSSC.h \
|
||||||
OptionRowHandler.cpp OptionRowHandler.h OptionsList.cpp OptionsList.h \
|
OptionRowHandler.cpp OptionRowHandler.h OptionsList.cpp OptionsList.h \
|
||||||
PlayerAI.cpp PlayerAI.h PlayerNumber.cpp PlayerNumber.h PlayerOptions.cpp PlayerOptions.h \
|
PlayerAI.cpp PlayerAI.h PlayerNumber.cpp PlayerNumber.h PlayerOptions.cpp PlayerOptions.h \
|
||||||
|
|||||||
+1
-1
@@ -63,7 +63,7 @@ void ModIcon::Set( const RString &_sText )
|
|||||||
};
|
};
|
||||||
|
|
||||||
for( unsigned i=0; i<ARRAYLEN(sStopWords); i++ )
|
for( unsigned i=0; i<ARRAYLEN(sStopWords); i++ )
|
||||||
if( 0==stricmp(sText,sStopWords[i]) )
|
if( sText.EqualsNoCase(sStopWords[i]) )
|
||||||
sText = "";
|
sText = "";
|
||||||
|
|
||||||
sText.Replace( " ", "\n" );
|
sText.Replace( " ", "\n" );
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ bool NoteSkinManager::DoesNoteSkinExist( const RString &sSkinName )
|
|||||||
vector<RString> asSkinNames;
|
vector<RString> asSkinNames;
|
||||||
GetAllNoteSkinNamesForGame( GAMESTATE->m_pCurGame, asSkinNames );
|
GetAllNoteSkinNamesForGame( GAMESTATE->m_pCurGame, asSkinNames );
|
||||||
for( unsigned i=0; i<asSkinNames.size(); i++ )
|
for( unsigned i=0; i<asSkinNames.size(); i++ )
|
||||||
if( 0==stricmp(sSkinName, asSkinNames[i]) )
|
if( sSkinName.EqualsNoCase(asSkinNames[i]) )
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -251,7 +251,7 @@ RString NoteSkinManager::GetMetric( const RString &sButtonName, const RString &s
|
|||||||
|
|
||||||
int NoteSkinManager::GetMetricI( const RString &sButtonName, const RString &sValueName )
|
int NoteSkinManager::GetMetricI( const RString &sButtonName, const RString &sValueName )
|
||||||
{
|
{
|
||||||
return atoi( GetMetric(sButtonName,sValueName) );
|
return StringToInt( GetMetric(sButtonName,sValueName) );
|
||||||
}
|
}
|
||||||
|
|
||||||
float NoteSkinManager::GetMetricF( const RString &sButtonName, const RString &sValueName )
|
float NoteSkinManager::GetMetricF( const RString &sButtonName, const RString &sValueName )
|
||||||
@@ -261,7 +261,8 @@ float NoteSkinManager::GetMetricF( const RString &sButtonName, const RString &sV
|
|||||||
|
|
||||||
bool NoteSkinManager::GetMetricB( const RString &sButtonName, const RString &sValueName )
|
bool NoteSkinManager::GetMetricB( const RString &sButtonName, const RString &sValueName )
|
||||||
{
|
{
|
||||||
return atoi( GetMetric(sButtonName,sValueName) ) != 0;
|
// Could also call GetMetricI here...hmm.
|
||||||
|
return StringToInt( GetMetric(sButtonName,sValueName) ) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
apActorCommands NoteSkinManager::GetMetricA( const RString &sButtonName, const RString &sValueName )
|
apActorCommands NoteSkinManager::GetMetricA( const RString &sButtonName, const RString &sValueName )
|
||||||
|
|||||||
@@ -398,8 +398,8 @@ static void ReadTimeSigs( const NameToData_t &mapNameToData, MeasureToTimeSig_t
|
|||||||
if( sName.size() != 6 || sName[0] != '#' || !IsAnInt( sName.substr(1,5) ) )
|
if( sName.size() != 6 || sName[0] != '#' || !IsAnInt( sName.substr(1,5) ) )
|
||||||
continue;
|
continue;
|
||||||
// this is step or offset data. Looks like "#00705"
|
// this is step or offset data. Looks like "#00705"
|
||||||
int iMeasureNo = atoi( sName.substr(1, 3).c_str() );
|
int iMeasureNo = StringToInt( sName.substr(1, 3) );
|
||||||
int iBMSTrackNo = atoi( sName.substr(4, 2).c_str() );
|
int iBMSTrackNo = StringToInt( sName.substr(4, 2) );
|
||||||
RString nData = it->second;
|
RString nData = it->second;
|
||||||
int totalPairs = nData.size() / 2;
|
int totalPairs = nData.size() / 2;
|
||||||
if( iBMSTrackNo != BMS_TRACK_TIME_SIG && iBMSTrackNo != 7 )
|
if( iBMSTrackNo != BMS_TRACK_TIME_SIG && iBMSTrackNo != 7 )
|
||||||
@@ -423,10 +423,10 @@ static void ReadTimeSigs( const NameToData_t &mapNameToData, MeasureToTimeSig_t
|
|||||||
|
|
||||||
// this is step or offset data. Looks like "#00705"
|
// this is step or offset data. Looks like "#00705"
|
||||||
const RString &sData = it->second;
|
const RString &sData = it->second;
|
||||||
int iMeasureNo = atoi( sName.substr(1, 3).c_str() );
|
int iMeasureNo = StringToInt( sName.substr(1, 3) );
|
||||||
if( iMeasureNo < iStartMeasureNo )
|
if( iMeasureNo < iStartMeasureNo )
|
||||||
continue;
|
continue;
|
||||||
int iBMSTrackNo = atoi( sName.substr(4, 2).c_str() );
|
int iBMSTrackNo = StringToInt( sName.substr(4, 2) );
|
||||||
if( iBMSTrackNo == BMS_TRACK_TIME_SIG )
|
if( iBMSTrackNo == BMS_TRACK_TIME_SIG )
|
||||||
out[iMeasureNo] = StringToFloat( sData );
|
out[iMeasureNo] = StringToFloat( sData );
|
||||||
}
|
}
|
||||||
@@ -558,9 +558,9 @@ static bool LoadFromBMSFile( const RString &sPath, const NameToData_t &mapNameTo
|
|||||||
int iPlayer = -1;
|
int iPlayer = -1;
|
||||||
RString sData;
|
RString sData;
|
||||||
if( GetTagFromMap( mapNameToData, "#player", sData ) )
|
if( GetTagFromMap( mapNameToData, "#player", sData ) )
|
||||||
iPlayer = atoi(sData);
|
iPlayer = StringToInt(sData);
|
||||||
if( GetTagFromMap( mapNameToData, "#playlevel", sData ) )
|
if( GetTagFromMap( mapNameToData, "#playlevel", sData ) )
|
||||||
out.SetMeter( atoi(sData) );
|
out.SetMeter( StringToInt(sData) );
|
||||||
|
|
||||||
NoteData ndNotes;
|
NoteData ndNotes;
|
||||||
ndNotes.SetNumTracks( NUM_BMS_TRACKS );
|
ndNotes.SetNumTracks( NUM_BMS_TRACKS );
|
||||||
@@ -697,8 +697,8 @@ static bool LoadFromBMSFile( const RString &sPath, const NameToData_t &mapNameTo
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// this is step or offset data. Looks like "#00705"
|
// this is step or offset data. Looks like "#00705"
|
||||||
int iMeasureNo = atoi( sName.substr(1,3).c_str() );
|
int iMeasureNo = StringToInt( sName.substr(1,3) );
|
||||||
int iRawTrackNum = atoi( sName.substr(4,2).c_str() );
|
int iRawTrackNum = StringToInt( sName.substr(4,2) );
|
||||||
int iRowNo = GetMeasureStartRow( mapMeasureToTimeSig, iMeasureNo, sigAdjustments );
|
int iRowNo = GetMeasureStartRow( mapMeasureToTimeSig, iMeasureNo, sigAdjustments );
|
||||||
float fBeatsPerMeasure = GetBeatsPerMeasure( mapMeasureToTimeSig, iMeasureNo, sigAdjustments );
|
float fBeatsPerMeasure = GetBeatsPerMeasure( mapMeasureToTimeSig, iMeasureNo, sigAdjustments );
|
||||||
const RString &sNoteData = it->second;
|
const RString &sNoteData = it->second;
|
||||||
|
|||||||
+20
-20
@@ -206,7 +206,7 @@ static bool LoadFromDWITokens(
|
|||||||
DEFAULT_FAIL( out.m_StepsType );
|
DEFAULT_FAIL( out.m_StepsType );
|
||||||
}
|
}
|
||||||
|
|
||||||
int iNumFeet = atoi(sNumFeet);
|
int iNumFeet = StringToInt(sNumFeet);
|
||||||
// out.SetDescription(sDescription); // Don't put garbage in the description.
|
// out.SetDescription(sDescription); // Don't put garbage in the description.
|
||||||
out.SetMeter(iNumFeet);
|
out.SetMeter(iNumFeet);
|
||||||
out.SetDifficulty( DwiCompatibleStringToDifficulty(sDescription) );
|
out.SetDifficulty( DwiCompatibleStringToDifficulty(sDescription) );
|
||||||
@@ -447,10 +447,10 @@ bool DWILoader::LoadFromDir( const RString &sPath_, Song &out, set<RString> &Bla
|
|||||||
}
|
}
|
||||||
|
|
||||||
// handle the data
|
// handle the data
|
||||||
if( 0==stricmp(sValueName,"FILE") )
|
if( sValueName.EqualsNoCase("FILE") )
|
||||||
out.m_sMusicFile = sParams[1];
|
out.m_sMusicFile = sParams[1];
|
||||||
|
|
||||||
else if( 0==stricmp(sValueName,"TITLE") )
|
else if( sValueName.EqualsNoCase("TITLE") )
|
||||||
{
|
{
|
||||||
NotesLoader::GetMainAndSubTitlesFromFullTitle( sParams[1], out.m_sMainTitle, out.m_sSubTitle );
|
NotesLoader::GetMainAndSubTitlesFromFullTitle( sParams[1], out.m_sMainTitle, out.m_sSubTitle );
|
||||||
|
|
||||||
@@ -460,22 +460,22 @@ bool DWILoader::LoadFromDir( const RString &sPath_, Song &out, set<RString> &Bla
|
|||||||
ConvertString( out.m_sSubTitle, "utf-8,english" );
|
ConvertString( out.m_sSubTitle, "utf-8,english" );
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( 0==stricmp(sValueName,"ARTIST") )
|
else if( sValueName.EqualsNoCase("ARTIST") )
|
||||||
{
|
{
|
||||||
out.m_sArtist = sParams[1];
|
out.m_sArtist = sParams[1];
|
||||||
ConvertString( out.m_sArtist, "utf-8,english" );
|
ConvertString( out.m_sArtist, "utf-8,english" );
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( 0==stricmp(sValueName,"GENRE") )
|
else if( sValueName.EqualsNoCase("GENRE") )
|
||||||
{
|
{
|
||||||
out.m_sGenre = sParams[1];
|
out.m_sGenre = sParams[1];
|
||||||
ConvertString( out.m_sGenre, "utf-8,english" );
|
ConvertString( out.m_sGenre, "utf-8,english" );
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( 0==stricmp(sValueName,"CDTITLE") )
|
else if( sValueName.EqualsNoCase("CDTITLE") )
|
||||||
out.m_sCDTitleFile = sParams[1];
|
out.m_sCDTitleFile = sParams[1];
|
||||||
|
|
||||||
else if( 0==stricmp(sValueName,"BPM") )
|
else if( sValueName.EqualsNoCase("BPM") )
|
||||||
{
|
{
|
||||||
const float fBPM = StringToFloat( sParams[1] );
|
const float fBPM = StringToFloat( sParams[1] );
|
||||||
|
|
||||||
@@ -491,7 +491,7 @@ bool DWILoader::LoadFromDir( const RString &sPath_, Song &out, set<RString> &Bla
|
|||||||
NoteRowToBeat(0), fBPM );
|
NoteRowToBeat(0), fBPM );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( 0==stricmp(sValueName,"DISPLAYBPM") )
|
else if( sValueName.EqualsNoCase("DISPLAYBPM") )
|
||||||
{
|
{
|
||||||
// #DISPLAYBPM:[xxx..xxx]|[xxx]|[*];
|
// #DISPLAYBPM:[xxx..xxx]|[xxx]|[*];
|
||||||
int iMin, iMax;
|
int iMin, iMax;
|
||||||
@@ -515,17 +515,17 @@ bool DWILoader::LoadFromDir( const RString &sPath_, Song &out, set<RString> &Bla
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( 0==stricmp(sValueName,"GAP") )
|
else if( sValueName.EqualsNoCase("GAP") )
|
||||||
// the units of GAP is 1/1000 second
|
// the units of GAP is 1/1000 second
|
||||||
out.m_SongTiming.m_fBeat0OffsetInSeconds = -atoi( sParams[1] ) / 1000.0f;
|
out.m_SongTiming.m_fBeat0OffsetInSeconds = -StringToInt( sParams[1] ) / 1000.0f;
|
||||||
|
|
||||||
else if( 0==stricmp(sValueName,"SAMPLESTART") )
|
else if( sValueName.EqualsNoCase("SAMPLESTART") )
|
||||||
out.m_fMusicSampleStartSeconds = ParseBrokenDWITimestamp(sParams[1], sParams[2], sParams[3]);
|
out.m_fMusicSampleStartSeconds = ParseBrokenDWITimestamp(sParams[1], sParams[2], sParams[3]);
|
||||||
|
|
||||||
else if( 0==stricmp(sValueName,"SAMPLELENGTH") )
|
else if( sValueName.EqualsNoCase("SAMPLELENGTH") )
|
||||||
out.m_fMusicSampleLengthSeconds = ParseBrokenDWITimestamp(sParams[1], sParams[2], sParams[3]);
|
out.m_fMusicSampleLengthSeconds = ParseBrokenDWITimestamp(sParams[1], sParams[2], sParams[3]);
|
||||||
|
|
||||||
else if( 0==stricmp(sValueName,"FREEZE") )
|
else if( sValueName.EqualsNoCase("FREEZE") )
|
||||||
{
|
{
|
||||||
vector<RString> arrayFreezeExpressions;
|
vector<RString> arrayFreezeExpressions;
|
||||||
split( sParams[1], ",", arrayFreezeExpressions );
|
split( sParams[1], ",", arrayFreezeExpressions );
|
||||||
@@ -547,7 +547,7 @@ bool DWILoader::LoadFromDir( const RString &sPath_, Song &out, set<RString> &Bla
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( 0==stricmp(sValueName,"CHANGEBPM") || 0==stricmp(sValueName,"BPMCHANGE") )
|
else if( sValueName.EqualsNoCase("CHANGEBPM") || sValueName.EqualsNoCase("BPMCHANGE") )
|
||||||
{
|
{
|
||||||
vector<RString> arrayBPMChangeExpressions;
|
vector<RString> arrayBPMChangeExpressions;
|
||||||
split( sParams[1], ",", arrayBPMChangeExpressions );
|
split( sParams[1], ",", arrayBPMChangeExpressions );
|
||||||
@@ -577,10 +577,10 @@ bool DWILoader::LoadFromDir( const RString &sPath_, Song &out, set<RString> &Bla
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( 0==stricmp(sValueName,"SINGLE") ||
|
else if( sValueName.EqualsNoCase("SINGLE") ||
|
||||||
0==stricmp(sValueName,"DOUBLE") ||
|
sValueName.EqualsNoCase("DOUBLE") ||
|
||||||
0==stricmp(sValueName,"COUPLE") ||
|
sValueName.EqualsNoCase("COUPLE") ||
|
||||||
0==stricmp(sValueName,"SOLO") )
|
sValueName.EqualsNoCase("SOLO") )
|
||||||
{
|
{
|
||||||
Steps* pNewNotes = out.CreateSteps();
|
Steps* pNewNotes = out.CreateSteps();
|
||||||
LoadFromDWITokens(
|
LoadFromDWITokens(
|
||||||
@@ -597,8 +597,8 @@ bool DWILoader::LoadFromDir( const RString &sPath_, Song &out, set<RString> &Bla
|
|||||||
else
|
else
|
||||||
delete pNewNotes;
|
delete pNewNotes;
|
||||||
}
|
}
|
||||||
else if( 0==stricmp(sValueName,"DISPLAYTITLE") ||
|
else if( sValueName.EqualsNoCase("DISPLAYTITLE") ||
|
||||||
0==stricmp(sValueName,"DISPLAYARTIST") )
|
sValueName.EqualsNoCase("DISPLAYARTIST") )
|
||||||
{
|
{
|
||||||
/* We don't want to support these tags. However, we don't want
|
/* We don't want to support these tags. However, we don't want
|
||||||
* to pick up images used here as song images (eg. banners). */
|
* to pick up images used here as song images (eg. banners). */
|
||||||
|
|||||||
@@ -0,0 +1,238 @@
|
|||||||
|
#include "global.h"
|
||||||
|
#include "NotesLoaderJson.h"
|
||||||
|
#include "Json/Value.h"
|
||||||
|
#include "TimingData.h"
|
||||||
|
#include "RageUtil.h"
|
||||||
|
#include "JsonUtil.h"
|
||||||
|
#include "BackgroundUtil.h"
|
||||||
|
#include "NoteData.h"
|
||||||
|
#include "Song.h"
|
||||||
|
#include "Steps.h"
|
||||||
|
#include "GameManager.h"
|
||||||
|
|
||||||
|
void NotesLoaderJson::GetApplicableFiles( const RString &sPath, vector<RString> &out )
|
||||||
|
{
|
||||||
|
GetDirListing( sPath + RString("*.json"), out );
|
||||||
|
}
|
||||||
|
|
||||||
|
void Deserialize(BPMSegment &seg, const Json::Value &root)
|
||||||
|
{
|
||||||
|
seg.m_iStartRow = BeatToNoteRow((float)root["Beat"].asDouble());
|
||||||
|
seg.m_fBPS = (float)(root["BPM"].asDouble() / 60);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Deserialize(StopSegment &seg, const Json::Value &root)
|
||||||
|
{
|
||||||
|
seg.m_iStartRow = BeatToNoteRow((float)(root["Beat"].asDouble()));
|
||||||
|
seg.m_fStopSeconds = (float)root["Seconds"].asDouble();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Deserialize(TimingData &td, const Json::Value &root)
|
||||||
|
{
|
||||||
|
JsonUtil::DeserializeVectorObjects( td.m_BPMSegments, Deserialize, root["BpmSegments"] );
|
||||||
|
JsonUtil::DeserializeVectorObjects( td.m_StopSegments, Deserialize, root["StopSegments"] );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Deserialize(LyricSegment &o, const Json::Value &root)
|
||||||
|
{
|
||||||
|
o.m_fStartTime = (float)root["StartTime"].asDouble();
|
||||||
|
o.m_sLyric = root["Lyric"].asString();
|
||||||
|
o.m_Color.FromString( root["Color"].asString() );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Deserialize(BackgroundDef &o, const Json::Value &root)
|
||||||
|
{
|
||||||
|
o.m_sEffect = root["Effect"].asString();
|
||||||
|
o.m_sFile1 = root["File1"].asString();
|
||||||
|
o.m_sFile2 = root["File2"].asString();
|
||||||
|
o.m_sColor1 = root["Color1"].asString();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Deserialize(BackgroundChange &o, const Json::Value &root )
|
||||||
|
{
|
||||||
|
Deserialize( o.m_def, root["Def"] );
|
||||||
|
o.m_fStartBeat = (float)root["StartBeat"].asDouble();
|
||||||
|
o.m_fRate = (float)root["Rate"].asDouble();
|
||||||
|
o.m_sTransition = root["Transition"].asString();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Deserialize( TapNote &o, const Json::Value &root )
|
||||||
|
{
|
||||||
|
//if( o.type != TapNote::tap )
|
||||||
|
if( root.isInt() )
|
||||||
|
o.type = (TapNote::Type)root["Type"].asInt();
|
||||||
|
//if( o.type == TapNote::hold_head )
|
||||||
|
o.subType = (TapNote::SubType)root["SubType"].asInt();
|
||||||
|
//root["Source"] = (int)source;
|
||||||
|
//if( !o.sAttackModifiers.empty() )
|
||||||
|
o.sAttackModifiers = root["AttackModifiers"].asString();
|
||||||
|
//if( o.fAttackDurationSeconds > 0 )
|
||||||
|
o.fAttackDurationSeconds = (float)root["AttackDurationSeconds"].asDouble();
|
||||||
|
//if( o.bKeysound )
|
||||||
|
o.iKeysoundIndex = root["KeysoundIndex"].asInt();
|
||||||
|
//if( o.iDuration > 0 )
|
||||||
|
o.iDuration = root["Duration"].asInt();
|
||||||
|
//if( o.pn != PLAYER_INVALID )
|
||||||
|
o.pn = (PlayerNumber)root["PlayerNumber"].asInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Deserialize( StepsType st, NoteData &nd, const Json::Value &root )
|
||||||
|
{
|
||||||
|
int iTracks = nd.GetNumTracks();
|
||||||
|
nd.SetNumTracks( iTracks );
|
||||||
|
for( unsigned i=0; i<root.size(); i++ )
|
||||||
|
{
|
||||||
|
Json::Value root2 = root[i];
|
||||||
|
float fBeat = (float)root2[(unsigned)0].asDouble();
|
||||||
|
int iRow = BeatToNoteRow(fBeat);
|
||||||
|
int iTrack = root2[1].asInt();
|
||||||
|
const Json::Value &root3 = root2[2];
|
||||||
|
TapNote tn;
|
||||||
|
Deserialize( tn, root3 );
|
||||||
|
nd.SetTapNote( iTrack, iRow, tn );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Deserialize( RadarValues &o, const Json::Value &root )
|
||||||
|
{
|
||||||
|
FOREACH_ENUM( RadarCategory, rc )
|
||||||
|
{
|
||||||
|
o.m_Values.f[rc] = (float)root[ RadarCategoryToString(rc) ].asDouble();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Deserialize( Steps &o, const Json::Value &root )
|
||||||
|
{
|
||||||
|
o.m_StepsType = GAMEMAN->StringToStepsType(root["StepsType"].asString());
|
||||||
|
|
||||||
|
o.Decompress();
|
||||||
|
|
||||||
|
NoteData nd;
|
||||||
|
Deserialize( o.m_StepsType, nd, root["NoteData"] );
|
||||||
|
o.SetNoteData( nd );
|
||||||
|
//o.SetHash( root["Hash"].asInt() );
|
||||||
|
o.SetDescription( root["Description"].asString() );
|
||||||
|
o.SetDifficulty( StringToDifficulty(root["Difficulty"].asString()) );
|
||||||
|
o.SetMeter( root["Meter"].asInt() );
|
||||||
|
|
||||||
|
RadarValues rv[NUM_PLAYERS];
|
||||||
|
FOREACH_PlayerNumber( pn )
|
||||||
|
{
|
||||||
|
Deserialize( rv[pn], root["RadarValues"] );
|
||||||
|
}
|
||||||
|
o.SetCachedRadarValues( rv );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Deserialize( Song &out, const Json::Value &root )
|
||||||
|
{
|
||||||
|
out.SetSongDir( root["SongDir"].asString() );
|
||||||
|
out.m_sGroupName = root["GroupName"].asString();
|
||||||
|
out.m_sMainTitle = root["Title"].asString();
|
||||||
|
out.m_sSubTitle = root["SubTitle"].asString();
|
||||||
|
out.m_sArtist = root["Artist"].asString();
|
||||||
|
out.m_sMainTitleTranslit = root["TitleTranslit"].asString();
|
||||||
|
out.m_sSubTitleTranslit = root["SubTitleTranslit"].asString();
|
||||||
|
out.m_sGenre = root["Genre"].asString();
|
||||||
|
out.m_sCredit = root["Credit"].asString();
|
||||||
|
out.m_sBannerFile = root["Banner"].asString();
|
||||||
|
out.m_sBackgroundFile = root["Background"].asString();
|
||||||
|
out.m_sLyricsFile = root["LyricsFile"].asString();
|
||||||
|
out.m_sCDTitleFile = root["CDTitle"].asString();
|
||||||
|
out.m_sMusicFile = root["Music"].asString();
|
||||||
|
out.m_SongTiming.m_fBeat0OffsetInSeconds = (float)root["Offset"].asDouble();
|
||||||
|
out.m_fMusicSampleStartSeconds = (float)root["SampleStart"].asDouble();
|
||||||
|
out.m_fMusicSampleLengthSeconds = (float)root["SampleLength"].asDouble();
|
||||||
|
RString sSelectable = root["Selectable"].asString();
|
||||||
|
if( sSelectable.EqualsNoCase("YES") )
|
||||||
|
out.m_SelectionDisplay = out.SHOW_ALWAYS;
|
||||||
|
else if( sSelectable.EqualsNoCase("NO") )
|
||||||
|
out.m_SelectionDisplay = out.SHOW_NEVER;
|
||||||
|
|
||||||
|
out.m_fFirstBeat = (float)root["FirstBeat"].asDouble();
|
||||||
|
out.m_fLastBeat = (float)root["LastBeat"].asDouble();
|
||||||
|
out.m_sSongFileName = root["SongFileName"].asString();
|
||||||
|
out.m_bHasMusic = root["HasMusic"].asBool();
|
||||||
|
out.m_bHasBanner = root["HasBanner"].asBool();
|
||||||
|
out.m_fMusicLengthSeconds = (float)root["MusicLengthSeconds"].asDouble();
|
||||||
|
|
||||||
|
RString sDisplayBPMType = root["DisplayBpmType"].asString();
|
||||||
|
if( sDisplayBPMType == "*" )
|
||||||
|
out.m_DisplayBPMType = DISPLAY_BPM_RANDOM;
|
||||||
|
else
|
||||||
|
out.m_DisplayBPMType = DISPLAY_BPM_SPECIFIED;
|
||||||
|
|
||||||
|
if( out.m_DisplayBPMType == DISPLAY_BPM_SPECIFIED )
|
||||||
|
{
|
||||||
|
out.m_fSpecifiedBPMMin = (float)root["SpecifiedBpmMin"].asDouble();
|
||||||
|
out.m_fSpecifiedBPMMax = (float)root["SpecifiedBpmMax"].asDouble();
|
||||||
|
}
|
||||||
|
|
||||||
|
Deserialize( out.m_SongTiming, root["TimingData"] );
|
||||||
|
JsonUtil::DeserializeVectorObjects( out.m_LyricSegments, Deserialize, root["LyricSegments"] );
|
||||||
|
|
||||||
|
{
|
||||||
|
const Json::Value &root2 = root["BackgroundChanges"];
|
||||||
|
FOREACH_BackgroundLayer( bl )
|
||||||
|
{
|
||||||
|
const Json::Value &root3 = root2[bl];
|
||||||
|
vector<BackgroundChange> &vBgc = out.GetBackgroundChanges(bl);
|
||||||
|
JsonUtil::DeserializeVectorObjects( vBgc, Deserialize, root3 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
vector<BackgroundChange> &vBgc = out.GetForegroundChanges();
|
||||||
|
JsonUtil::DeserializeVectorObjects( vBgc, Deserialize, root["ForegroundChanges"] );
|
||||||
|
}
|
||||||
|
|
||||||
|
JsonUtil::DeserializeArrayValuesIntoVector( out.m_vsKeysoundFile, root["KeySounds"] );
|
||||||
|
|
||||||
|
{
|
||||||
|
vector<Steps*> vpSteps;
|
||||||
|
JsonUtil::DeserializeVectorPointers<Steps>( vpSteps, Deserialize, root["Charts"] );
|
||||||
|
FOREACH( Steps*, vpSteps, iter )
|
||||||
|
out.AddSteps( *iter );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NotesLoaderJson::LoadFromJsonFile( const RString &sPath, Song &out )
|
||||||
|
{
|
||||||
|
Json::Value root;
|
||||||
|
if( !JsonUtil::LoadFromFileShowErrors(root,sPath) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
Deserialize(out, root);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NotesLoaderJson::LoadFromDir( const RString &sPath, Song &out )
|
||||||
|
{
|
||||||
|
return LoadFromJsonFile(sPath, out);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (c) 2001-2004 Chris Danford, Glenn Maynard
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
* copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||||
|
* whom the Software is furnished to do so, provided that the above
|
||||||
|
* copyright notice(s) and this permission notice appear in all copies of
|
||||||
|
* the Software and that both the above copyright notice(s) and this
|
||||||
|
* permission notice appear in supporting documentation.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||||
|
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||||
|
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||||
|
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||||
|
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
|
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
|
* PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
/* JsonLoader - Reads a Song from a .json file. */
|
||||||
|
|
||||||
|
#ifndef NotesLoaderJson_H
|
||||||
|
#define NotesLoaderJson_H
|
||||||
|
|
||||||
|
#include "NotesLoader.h"
|
||||||
|
class Song;
|
||||||
|
|
||||||
|
namespace NotesLoaderJson
|
||||||
|
{
|
||||||
|
void GetApplicableFiles( const RString &sPath, vector<RString> &out );
|
||||||
|
bool LoadFromDir( const RString &sPath, Song &out );
|
||||||
|
bool LoadFromJsonFile( const RString &sPath, Song &out );
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (c) 2001-2004 Chris Danford, Glenn Maynard
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
* copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||||
|
* whom the Software is furnished to do so, provided that the above
|
||||||
|
* copyright notice(s) and this permission notice appear in all copies of
|
||||||
|
* the Software and that both the above copyright notice(s) and this
|
||||||
|
* permission notice appear in supporting documentation.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||||
|
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||||
|
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||||
|
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||||
|
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
|
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
|
* PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
+182
-83
@@ -9,6 +9,51 @@
|
|||||||
#include "Song.h"
|
#include "Song.h"
|
||||||
#include "Steps.h"
|
#include "Steps.h"
|
||||||
|
|
||||||
|
static void HandleBunki( TimingData &timing, const float fEarlyBPM,
|
||||||
|
const float fCurBPM, const float fGap,
|
||||||
|
const float fPos )
|
||||||
|
{
|
||||||
|
const float BeatsPerSecond = fEarlyBPM / 60.0f;
|
||||||
|
const float beat = (fPos + fGap) * BeatsPerSecond;
|
||||||
|
LOG->Trace( "BPM %f, BPS %f, BPMPos %f, beat %f",
|
||||||
|
fEarlyBPM, BeatsPerSecond, fPos, beat );
|
||||||
|
timing.AddBPMSegment( BPMSegment(BeatToNoteRow(beat), fCurBPM) );
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool HandlePipeChars( TimingData &timing, const RString sNoteRow,
|
||||||
|
const float fCurBeat, int &iTickCount )
|
||||||
|
{
|
||||||
|
RString temp = sNoteRow.substr(2,sNoteRow.size()-3);
|
||||||
|
float numTemp = StringToFloat(temp);
|
||||||
|
if (BeginsWith(sNoteRow, "|T"))
|
||||||
|
{
|
||||||
|
iTickCount = static_cast<int>(numTemp);
|
||||||
|
timing.SetTickcountAtBeat( fCurBeat, clamp(iTickCount, 0, ROWS_PER_BEAT) );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (BeginsWith(sNoteRow, "|B"))
|
||||||
|
{
|
||||||
|
timing.SetBPMAtBeat( fCurBeat, numTemp );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (BeginsWith(sNoteRow, "|E"))
|
||||||
|
{
|
||||||
|
// Finally! the |E| tag is working as it should. I can die happy now -DaisuMaster
|
||||||
|
float fCurDelay = 60 / timing.GetBPMAtBeat(fCurBeat) * numTemp / iTickCount;
|
||||||
|
fCurDelay += timing.GetDelayAtRow(BeatToNoteRow(fCurBeat) );
|
||||||
|
timing.SetStopAtBeat( fCurBeat, fCurDelay, true );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (BeginsWith(sNoteRow, "|D"))
|
||||||
|
{
|
||||||
|
float fCurDelay = timing.GetStopAtRow(BeatToNoteRow(fCurBeat) );
|
||||||
|
fCurDelay += numTemp / 1000;
|
||||||
|
timing.SetStopAtBeat( fCurBeat, fCurDelay, true );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static bool LoadFromKSFFile( const RString &sPath, Steps &out, const Song &song, bool bKIUCompliant )
|
static bool LoadFromKSFFile( const RString &sPath, Steps &out, const Song &song, bool bKIUCompliant )
|
||||||
{
|
{
|
||||||
LOG->Trace( "Steps::LoadFromKSFFile( '%s' )", sPath.c_str() );
|
LOG->Trace( "Steps::LoadFromKSFFile( '%s' )", sPath.c_str() );
|
||||||
@@ -26,16 +71,98 @@ static bool LoadFromKSFFile( const RString &sPath, Steps &out, const Song &song,
|
|||||||
// According to Aldo_MX, there is a default BPM and it's 60. -aj
|
// According to Aldo_MX, there is a default BPM and it's 60. -aj
|
||||||
bool bDoublesChart = false;
|
bool bDoublesChart = false;
|
||||||
|
|
||||||
|
TimingData stepsTiming;
|
||||||
|
float SMGap1 = 0, SMGap2 = 0, BPM1 = -1, BPMPos2 = -1, BPM2 = -1, BPMPos3 = -1, BPM3 = -1;
|
||||||
|
|
||||||
for( unsigned i=0; i<msd.GetNumValues(); i++ )
|
for( unsigned i=0; i<msd.GetNumValues(); i++ )
|
||||||
{
|
{
|
||||||
const MsdFile::value_t &sParams = msd.GetValue( i );
|
const MsdFile::value_t &sParams = msd.GetValue( i );
|
||||||
RString sValueName = sParams[0];
|
RString sValueName = sParams[0];
|
||||||
sValueName.MakeUpper();
|
sValueName.MakeUpper();
|
||||||
|
|
||||||
// handle the data
|
/* handle the data...well, not this data: not related to steps.
|
||||||
if( sValueName=="TICKCOUNT" )
|
* Skips INTRO, MUSICINTRO, TITLEFILE, DISCFILE, SONGFILE. */
|
||||||
|
if (sValueName=="TITLE" || EndsWith(sValueName, "INTRO")
|
||||||
|
|| EndsWith(sValueName, "FILE") )
|
||||||
{
|
{
|
||||||
iTickCount = atoi( sParams[1] );
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if( sValueName=="BPM" )
|
||||||
|
{
|
||||||
|
BPM1 = StringToFloat(sParams[1]);
|
||||||
|
stepsTiming.AddBPMSegment( BPMSegment(0, BPM1) );
|
||||||
|
}
|
||||||
|
else if( sValueName=="BPM2" )
|
||||||
|
{
|
||||||
|
if (bKIUCompliant)
|
||||||
|
{
|
||||||
|
BPM2 = StringToFloat( sParams[1] );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// LOG an error.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( sValueName=="BPM3" )
|
||||||
|
{
|
||||||
|
if (bKIUCompliant)
|
||||||
|
{
|
||||||
|
BPM3 = StringToFloat( sParams[1] );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// LOG an error.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( sValueName=="BUNKI" )
|
||||||
|
{
|
||||||
|
if (bKIUCompliant)
|
||||||
|
{
|
||||||
|
BPMPos2 = StringToFloat( sParams[1] ) / 100.0f;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// LOG an error.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( sValueName=="BUNKI2" )
|
||||||
|
{
|
||||||
|
if (bKIUCompliant)
|
||||||
|
{
|
||||||
|
BPMPos3 = StringToFloat( sParams[1] ) / 100.0f;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// LOG an error.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( sValueName=="STARTTIME" )
|
||||||
|
{
|
||||||
|
SMGap1 = -StringToFloat( sParams[1] )/100;
|
||||||
|
stepsTiming.m_fBeat0OffsetInSeconds = SMGap1;
|
||||||
|
}
|
||||||
|
// This is currently required for more accurate KIU BPM changes.
|
||||||
|
else if( sValueName=="STARTTIME2" )
|
||||||
|
{
|
||||||
|
if (bKIUCompliant)
|
||||||
|
{
|
||||||
|
SMGap2 = -StringToFloat( sParams[1] )/100;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// LOG an error.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( sValueName=="STARTTIME3" )
|
||||||
|
{
|
||||||
|
// STARTTIME3 only ensures this is a KIU compliant simfile.
|
||||||
|
bKIUCompliant = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if( sValueName=="TICKCOUNT" )
|
||||||
|
{
|
||||||
|
iTickCount = StringToInt( sParams[1] );
|
||||||
if( iTickCount <= 0 )
|
if( iTickCount <= 0 )
|
||||||
{
|
{
|
||||||
LOG->UserLog( "Song file", sPath, "has an invalid tick count: %d.", iTickCount );
|
LOG->UserLog( "Song file", sPath, "has an invalid tick count: %d.", iTickCount );
|
||||||
@@ -43,15 +170,10 @@ static bool LoadFromKSFFile( const RString &sPath, Steps &out, const Song &song,
|
|||||||
}
|
}
|
||||||
out.m_Timing.AddTickcountSegment(TickcountSegment(0, iTickCount));
|
out.m_Timing.AddTickcountSegment(TickcountSegment(0, iTickCount));
|
||||||
}
|
}
|
||||||
else if( sValueName=="STEP" )
|
|
||||||
{
|
|
||||||
RString theSteps = sParams[1];
|
|
||||||
TrimLeft( theSteps );
|
|
||||||
split( theSteps, "\n", vNoteRows, true );
|
|
||||||
}
|
|
||||||
else if( sValueName=="DIFFICULTY" )
|
else if( sValueName=="DIFFICULTY" )
|
||||||
{
|
{
|
||||||
out.SetMeter( max(atoi(sParams[1]), 0) );
|
out.SetMeter( max(StringToInt(sParams[1]), 0) );
|
||||||
}
|
}
|
||||||
// new cases from Aldo_MX's fork:
|
// new cases from Aldo_MX's fork:
|
||||||
else if( sValueName=="PLAYER" )
|
else if( sValueName=="PLAYER" )
|
||||||
@@ -61,14 +183,35 @@ static bool LoadFromKSFFile( const RString &sPath, Steps &out, const Song &song,
|
|||||||
if( sPlayer.find( "double" ) != string::npos )
|
if( sPlayer.find( "double" ) != string::npos )
|
||||||
bDoublesChart = true;
|
bDoublesChart = true;
|
||||||
}
|
}
|
||||||
|
// This should always be last.
|
||||||
|
else if( sValueName=="STEP" )
|
||||||
|
{
|
||||||
|
RString theSteps = sParams[1];
|
||||||
|
TrimLeft( theSteps );
|
||||||
|
split( theSteps, "\n", vNoteRows, true );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( iTickCount == -1 )
|
if( iTickCount == -1 )
|
||||||
{
|
{
|
||||||
iTickCount = 2; // Direct Move 0.5 has a default value of 4... -aj
|
iTickCount = 4;
|
||||||
LOG->UserLog( "Song file", sPath, "doesn't have a TICKCOUNT. Defaulting to %i.", iTickCount );
|
LOG->UserLog( "Song file", sPath, "doesn't have a TICKCOUNT. Defaulting to %i.", iTickCount );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Prepare BPM stuff already if the file uses KSF syntax.
|
||||||
|
if( bKIUCompliant )
|
||||||
|
{
|
||||||
|
if( BPM2 > 0 && BPMPos2 > 0 )
|
||||||
|
{
|
||||||
|
HandleBunki( stepsTiming, BPM1, BPM2, SMGap1, BPMPos2 );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( BPM3 > 0 && BPMPos3 > 0 )
|
||||||
|
{
|
||||||
|
HandleBunki( stepsTiming, BPM2, BPM3, SMGap2, BPMPos3 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
NoteData notedata; // read it into here
|
NoteData notedata; // read it into here
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -148,6 +291,7 @@ static bool LoadFromKSFFile( const RString &sPath, Steps &out, const Song &song,
|
|||||||
int newTick = -1;
|
int newTick = -1;
|
||||||
float fCurBeat = 0.0f;
|
float fCurBeat = 0.0f;
|
||||||
float prevBeat = 0.0f; // Used for hold tails.
|
float prevBeat = 0.0f; // Used for hold tails.
|
||||||
|
|
||||||
for( unsigned r=0; r<vNoteRows.size(); r++ )
|
for( unsigned r=0; r<vNoteRows.size(); r++ )
|
||||||
{
|
{
|
||||||
RString& sRowString = vNoteRows[r];
|
RString& sRowString = vNoteRows[r];
|
||||||
@@ -157,7 +301,7 @@ static bool LoadFromKSFFile( const RString &sPath, Steps &out, const Song &song,
|
|||||||
continue; // skip
|
continue; // skip
|
||||||
|
|
||||||
// All 2s indicates the end of the song.
|
// All 2s indicates the end of the song.
|
||||||
if( sRowString == "2222222222222" )
|
else if( sRowString == "2222222222222" )
|
||||||
{
|
{
|
||||||
// Finish any holds that didn't get...well, finished.
|
// Finish any holds that didn't get...well, finished.
|
||||||
for( t=0; t < notedata.GetNumTracks(); t++ )
|
for( t=0; t < notedata.GetNumTracks(); t++ )
|
||||||
@@ -173,30 +317,21 @@ static bool LoadFromKSFFile( const RString &sPath, Steps &out, const Song &song,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Why do this? Rows made with precise DM05 tags can go up to 13 too -DaisuMaster
|
else if( BeginsWith(sRowString, "|") )
|
||||||
//if( sRowString.size() != 13 )
|
|
||||||
//this is wrong in many ways...
|
|
||||||
/*if( bKIUCompliant )
|
|
||||||
{
|
{
|
||||||
LOG->UserLog( "Song file", sPath, "has illegal syntax \"%s\" which can't be in KIU complient files.",
|
if (bKIUCompliant)
|
||||||
sRowString.c_str() );
|
|
||||||
return false;
|
|
||||||
//In other words: you can't mix ksf's with DM05 tags and ksf's without any DM05 tags
|
|
||||||
//Either one set or another will be read...
|
|
||||||
}*/
|
|
||||||
if( BeginsWith(sRowString, "|B") || BeginsWith(sRowString, "|D") || BeginsWith(sRowString, "|E") )
|
|
||||||
{
|
{
|
||||||
// TODO: Update for Split Timing.
|
// Log an error, ignore the line.
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if ( BeginsWith(sRowString, "|T") )
|
if ( !HandlePipeChars( stepsTiming, sRowString, fCurBeat, iTickCount ) )
|
||||||
{
|
{
|
||||||
RString temp = sRowString.substr(2,sRowString.size()-3);
|
// LOG it first.
|
||||||
newTick = atoi(temp);
|
|
||||||
bTickChangeNeeded = true;
|
|
||||||
out.m_Timing.AddTickcountSegment(TickcountSegment(fCurBeat, newTick));
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
continue;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Is this why improper ksf or some kiucompilant ksf mixed with dm05 ksf are ignored?? -DaisuMaster
|
// Is this why improper ksf or some kiucompilant ksf mixed with dm05 ksf are ignored?? -DaisuMaster
|
||||||
@@ -273,6 +408,7 @@ static bool LoadFromKSFFile( const RString &sPath, Steps &out, const Song &song,
|
|||||||
}
|
}
|
||||||
|
|
||||||
out.SetNoteData( notedata );
|
out.SetNoteData( notedata );
|
||||||
|
out.m_Timing = stepsTiming;
|
||||||
|
|
||||||
out.TidyUpData();
|
out.TidyUpData();
|
||||||
|
|
||||||
@@ -289,12 +425,12 @@ static void LoadTags( const RString &str, Song &out )
|
|||||||
split( str, " - ", asBits, false );
|
split( str, " - ", asBits, false );
|
||||||
// Ignore the difficulty, since we get that elsewhere.
|
// Ignore the difficulty, since we get that elsewhere.
|
||||||
if( asBits.size() == 3 && (
|
if( asBits.size() == 3 && (
|
||||||
!stricmp(asBits[2], "double") ||
|
asBits[2].EqualsNoCase("double") ||
|
||||||
!stricmp(asBits[2], "easy") ||
|
asBits[2].EqualsNoCase("easy") ||
|
||||||
!stricmp(asBits[2], "normal") ||
|
asBits[2].EqualsNoCase("normal") ||
|
||||||
!stricmp(asBits[2], "hard") ||
|
asBits[2].EqualsNoCase("hard") ||
|
||||||
!stricmp(asBits[2], "crazy") ||
|
asBits[2].EqualsNoCase("crazy") ||
|
||||||
!stricmp(asBits[2], "nightmare"))
|
asBits[2].EqualsNoCase("nightmare"))
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
asBits.erase( asBits.begin()+2, asBits.begin()+3 );
|
asBits.erase( asBits.begin()+2, asBits.begin()+3 );
|
||||||
@@ -404,7 +540,7 @@ static bool LoadGlobalData( const RString &sPath, Song &out, bool &bKIUCompliant
|
|||||||
/* TICKCOUNT will be used below if there are DM compliant BPM changes
|
/* TICKCOUNT will be used below if there are DM compliant BPM changes
|
||||||
* and stops. It will be called again in LoadFromKSFFile for the
|
* and stops. It will be called again in LoadFromKSFFile for the
|
||||||
* actual steps. */
|
* actual steps. */
|
||||||
iTickCount = atoi( sParams[1] );
|
iTickCount = StringToInt( sParams[1] );
|
||||||
iTickCount = iTickCount > 0 ? iTickCount : 2; // again, Direct Move uses 4 as a default.
|
iTickCount = iTickCount > 0 ? iTickCount : 2; // again, Direct Move uses 4 as a default.
|
||||||
// add a tickcount for those using the [Player]
|
// add a tickcount for those using the [Player]
|
||||||
// CheckpointsUseTimeSignatures metric. -aj
|
// CheckpointsUseTimeSignatures metric. -aj
|
||||||
@@ -468,21 +604,12 @@ static bool LoadGlobalData( const RString &sPath, Song &out, bool &bKIUCompliant
|
|||||||
{
|
{
|
||||||
if( BPM2 > 0 && BPMPos2 > 0 )
|
if( BPM2 > 0 && BPMPos2 > 0 )
|
||||||
{
|
{
|
||||||
const float BeatsPerSecond = BPM1 / 60.0f;
|
HandleBunki( out.m_SongTiming, BPM1, BPM2, SMGap1, BPMPos2 );
|
||||||
const float beat = (BPMPos2 + SMGap1) * BeatsPerSecond;
|
|
||||||
LOG->Trace( "BPM %f, BPS %f, BPMPos2 %f, beat %f",
|
|
||||||
BPM1, BeatsPerSecond, BPMPos2, beat );
|
|
||||||
out.m_SongTiming.AddBPMSegment( BPMSegment(BeatToNoteRow(beat), BPM2) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( BPM3 > 0 && BPMPos3 > 0 )
|
if( BPM3 > 0 && BPMPos3 > 0 )
|
||||||
{
|
{
|
||||||
const float BeatsPerSecond = BPM2 / 60.0f;
|
HandleBunki( out.m_SongTiming, BPM2, BPM3, SMGap2, BPMPos3 );
|
||||||
//The line below isn't perfect, but works better than previous versions.
|
|
||||||
const float beat = (BPMPos3 + SMGap2) * BeatsPerSecond;
|
|
||||||
LOG->Trace( "BPM %f, BPS %f, BPMPos3 %f, beat %f",
|
|
||||||
BPM2, BeatsPerSecond, BPMPos3, beat );
|
|
||||||
out.m_SongTiming.AddBPMSegment( BPMSegment(BeatToNoteRow(beat), BPM3) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -510,41 +637,12 @@ static bool LoadGlobalData( const RString &sPath, Song &out, bool &bKIUCompliant
|
|||||||
BeginsWith(NoteRowString, "|D") || BeginsWith(NoteRowString, "|E") )
|
BeginsWith(NoteRowString, "|D") || BeginsWith(NoteRowString, "|E") )
|
||||||
{
|
{
|
||||||
bDMRequired = true;
|
bDMRequired = true;
|
||||||
RString temp = NoteRowString.substr(2,NoteRowString.size()-3);
|
if ( !HandlePipeChars( out.m_SongTiming, NoteRowString, fCurBeat, iTickCount ) )
|
||||||
float numTemp = StringToFloat(temp);
|
|
||||||
if (BeginsWith(NoteRowString, "|T"))
|
|
||||||
{
|
{
|
||||||
iTickCount = (int)numTemp;
|
// LOG it first.
|
||||||
TickcountSegment tcs;
|
|
||||||
tcs.m_iStartRow = BeatToNoteRow(fCurBeat);
|
|
||||||
tcs.m_iTicks = iTickCount > ROWS_PER_BEAT ? ROWS_PER_BEAT : iTickCount;
|
|
||||||
out.m_SongTiming.AddTickcountSegment( tcs );
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
else if (BeginsWith(NoteRowString, "|B"))
|
|
||||||
{
|
|
||||||
float fCurBpm = (float)numTemp;
|
|
||||||
//out.m_Timing.AddBPMSegment( BPMSegment( BeatToNoteRow(fCurBeat), (float)numTemp ) );
|
|
||||||
out.m_SongTiming.SetBPMAtBeat( fCurBeat, fCurBpm );
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (BeginsWith(NoteRowString, "|E"))
|
|
||||||
{
|
|
||||||
// Finally! the |E| tag is working as it should. I can die happy now -DaisuMaster
|
|
||||||
float fCurDelay = 60 / out.m_SongTiming.GetBPMAtBeat(fCurBeat) * (float)numTemp / iTickCount;
|
|
||||||
fCurDelay += out.m_SongTiming.GetStopAtRow(BeatToNoteRow(fCurBeat) );
|
|
||||||
out.m_SongTiming.SetStopAtBeat( fCurBeat, fCurDelay, true );
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else if (BeginsWith(NoteRowString, "|D"))
|
|
||||||
{
|
|
||||||
float fCurDelay = out.m_SongTiming.GetStopAtRow(BeatToNoteRow(fCurBeat) );
|
|
||||||
fCurDelay += (float)numTemp / 1000;
|
|
||||||
out.m_SongTiming.SetStopAtBeat( fCurBeat, fCurDelay, true );
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// ignore whatever else...
|
// ignore whatever else...
|
||||||
@@ -583,16 +681,17 @@ bool KSFLoader::LoadFromDir( const RString &sDir, Song &out )
|
|||||||
ASSERT( arrayKSFFileNames.size() );
|
ASSERT( arrayKSFFileNames.size() );
|
||||||
|
|
||||||
bool bKIUCompliant = false;
|
bool bKIUCompliant = false;
|
||||||
/* If only the first file is read, it will cause problems for other simfiles with
|
/* With Split Timing, there has to be a backup Song Timing in case
|
||||||
* different BPM changes and tickcounts. This command will probably have to be
|
* anything goes wrong. Use the first file found to determine said
|
||||||
* changed in the future. */
|
* timing, while also establishing whether this file respects the
|
||||||
|
* Kick It Up syntax. */
|
||||||
if( !LoadGlobalData(out.GetSongDir() + arrayKSFFileNames[0], out, bKIUCompliant) )
|
if( !LoadGlobalData(out.GetSongDir() + arrayKSFFileNames[0], out, bKIUCompliant) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// load the Steps from the rest of the KSF files
|
// load the Steps from the rest of the KSF files
|
||||||
for( unsigned i=0; i<arrayKSFFileNames.size(); i++ )
|
for( unsigned i=0; i<arrayKSFFileNames.size(); i++ )
|
||||||
{
|
{
|
||||||
Steps* pNewNotes = new Steps;
|
Steps* pNewNotes = out.CreateSteps();
|
||||||
if( !LoadFromKSFFile(out.GetSongDir() + arrayKSFFileNames[i], *pNewNotes, out, bKIUCompliant) )
|
if( !LoadFromKSFFile(out.GetSongDir() + arrayKSFFileNames[i], *pNewNotes, out, bKIUCompliant) )
|
||||||
{
|
{
|
||||||
delete pNewNotes;
|
delete pNewNotes;
|
||||||
|
|||||||
@@ -346,8 +346,8 @@ static void ReadTimeSigs( const NameToData_t &mapNameToData, MeasureToTimeSig_t
|
|||||||
|
|
||||||
// this is step or offset data. Looks like "#00705"
|
// this is step or offset data. Looks like "#00705"
|
||||||
const RString &sData = it->second;
|
const RString &sData = it->second;
|
||||||
int iMeasureNo = atoi( sName.substr(1, 3).c_str() );
|
int iMeasureNo = StringToInt( sName.substr(1, 3) );
|
||||||
int iPMSTrackNo = atoi( sName.substr(4, 2).c_str() );
|
int iPMSTrackNo = StringToInt( sName.substr(4, 2) );
|
||||||
if( iPMSTrackNo == PMS_TRACK_TIME_SIG )
|
if( iPMSTrackNo == PMS_TRACK_TIME_SIG )
|
||||||
out[iMeasureNo] = StringToFloat( sData );
|
out[iMeasureNo] = StringToFloat( sData );
|
||||||
}
|
}
|
||||||
@@ -367,9 +367,9 @@ static bool LoadFromPMSFile( const RString &sPath, const NameToData_t &mapNameTo
|
|||||||
int iPlayer = -1;
|
int iPlayer = -1;
|
||||||
RString sData;
|
RString sData;
|
||||||
if( GetTagFromMap( mapNameToData, "#player", sData ) )
|
if( GetTagFromMap( mapNameToData, "#player", sData ) )
|
||||||
iPlayer = atoi(sData);
|
iPlayer = StringToInt(sData);
|
||||||
if( GetTagFromMap( mapNameToData, "#playlevel", sData ) )
|
if( GetTagFromMap( mapNameToData, "#playlevel", sData ) )
|
||||||
out.SetMeter( atoi(sData) );
|
out.SetMeter( StringToInt(sData) );
|
||||||
|
|
||||||
NoteData ndNotes;
|
NoteData ndNotes;
|
||||||
ndNotes.SetNumTracks( NUM_PMS_TRACKS );
|
ndNotes.SetNumTracks( NUM_PMS_TRACKS );
|
||||||
@@ -396,8 +396,8 @@ static bool LoadFromPMSFile( const RString &sPath, const NameToData_t &mapNameTo
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// this is step or offset data. Looks like "#00705"
|
// this is step or offset data. Looks like "#00705"
|
||||||
int iMeasureNo = atoi( sName.substr(1,3).c_str() );
|
int iMeasureNo = StringToInt( sName.substr(1,3) );
|
||||||
int iRawTrackNum = atoi( sName.substr(4,2).c_str() );
|
int iRawTrackNum = StringToInt( sName.substr(4,2) );
|
||||||
int iRowNo = GetMeasureStartRow( mapMeasureToTimeSig, iMeasureNo, sigAdjustments );
|
int iRowNo = GetMeasureStartRow( mapMeasureToTimeSig, iMeasureNo, sigAdjustments );
|
||||||
float fBeatsPerMeasure = GetBeatsPerMeasure( mapMeasureToTimeSig, iMeasureNo, sigAdjustments );
|
float fBeatsPerMeasure = GetBeatsPerMeasure( mapMeasureToTimeSig, iMeasureNo, sigAdjustments );
|
||||||
const RString &sNoteData = it->second;
|
const RString &sNoteData = it->second;
|
||||||
@@ -649,8 +649,8 @@ static void ReadGlobalTags( const NameToData_t &mapNameToData, Song &out, Measur
|
|||||||
if( sName.size() != 6 || sName[0] != '#' || !IsAnInt( sName.substr(1,5) ) )
|
if( sName.size() != 6 || sName[0] != '#' || !IsAnInt( sName.substr(1,5) ) )
|
||||||
continue;
|
continue;
|
||||||
// this is step or offset data. Looks like "#00705"
|
// this is step or offset data. Looks like "#00705"
|
||||||
int iMeasureNo = atoi( sName.substr(1, 3).c_str() );
|
int iMeasureNo = StringToInt( sName.substr(1, 3) );
|
||||||
int iPMSTrackNo = atoi( sName.substr(4, 2).c_str() );
|
int iPMSTrackNo = StringToInt( sName.substr(4, 2) );
|
||||||
int iStepIndex = GetMeasureStartRow( mapMeasureToTimeSig, iMeasureNo, sigAdjustmentsOut );
|
int iStepIndex = GetMeasureStartRow( mapMeasureToTimeSig, iMeasureNo, sigAdjustmentsOut );
|
||||||
float fBeatsPerMeasure = GetBeatsPerMeasure( mapMeasureToTimeSig, iMeasureNo, sigAdjustmentsOut );
|
float fBeatsPerMeasure = GetBeatsPerMeasure( mapMeasureToTimeSig, iMeasureNo, sigAdjustmentsOut );
|
||||||
int iRowsPerMeasure = BeatToNoteRow( fBeatsPerMeasure );
|
int iRowsPerMeasure = BeatToNoteRow( fBeatsPerMeasure );
|
||||||
|
|||||||
+11
-11
@@ -60,7 +60,7 @@ void SMLoader::LoadFromSMTokens(
|
|||||||
out.SetDifficulty( Difficulty_Challenge );
|
out.SetDifficulty( Difficulty_Challenge );
|
||||||
}
|
}
|
||||||
|
|
||||||
out.SetMeter( atoi(sMeter) );
|
out.SetMeter( StringToInt(sMeter) );
|
||||||
vector<RString> saValues;
|
vector<RString> saValues;
|
||||||
split( sRadarValues, ",", saValues, true );
|
split( sRadarValues, ",", saValues, true );
|
||||||
int categories = NUM_RadarCategory - 1; // Fakes aren't counted in the radar values.
|
int categories = NUM_RadarCategory - 1; // Fakes aren't counted in the radar values.
|
||||||
@@ -426,7 +426,7 @@ bool SMLoader::LoadFromBGChangesString( BackgroundChange &change, const RString
|
|||||||
// Backward compatibility:
|
// Backward compatibility:
|
||||||
if( change.m_def.m_sEffect.empty() )
|
if( change.m_def.m_sEffect.empty() )
|
||||||
{
|
{
|
||||||
bool bLoop = atoi( aBGChangeValues[5] ) != 0;
|
bool bLoop = StringToInt( aBGChangeValues[5] ) != 0;
|
||||||
if( !bLoop )
|
if( !bLoop )
|
||||||
change.m_def.m_sEffect = SBE_StretchNoLoop;
|
change.m_def.m_sEffect = SBE_StretchNoLoop;
|
||||||
}
|
}
|
||||||
@@ -436,7 +436,7 @@ bool SMLoader::LoadFromBGChangesString( BackgroundChange &change, const RString
|
|||||||
// Backward compatibility:
|
// Backward compatibility:
|
||||||
if( change.m_def.m_sEffect.empty() )
|
if( change.m_def.m_sEffect.empty() )
|
||||||
{
|
{
|
||||||
bool bRewindMovie = atoi( aBGChangeValues[4] ) != 0;
|
bool bRewindMovie = StringToInt( aBGChangeValues[4] ) != 0;
|
||||||
if( bRewindMovie )
|
if( bRewindMovie )
|
||||||
change.m_def.m_sEffect = SBE_StretchRewind;
|
change.m_def.m_sEffect = SBE_StretchRewind;
|
||||||
}
|
}
|
||||||
@@ -445,7 +445,7 @@ bool SMLoader::LoadFromBGChangesString( BackgroundChange &change, const RString
|
|||||||
// param 9 overrides this.
|
// param 9 overrides this.
|
||||||
// Backward compatibility:
|
// Backward compatibility:
|
||||||
if( change.m_sTransition.empty() )
|
if( change.m_sTransition.empty() )
|
||||||
change.m_sTransition = (atoi( aBGChangeValues[3] ) != 0) ? "CrossFade" : "";
|
change.m_sTransition = (StringToInt( aBGChangeValues[3] ) != 0) ? "CrossFade" : "";
|
||||||
// fall through
|
// fall through
|
||||||
case 3:
|
case 3:
|
||||||
change.m_fRate = StringToFloat( aBGChangeValues[2] );
|
change.m_fRate = StringToFloat( aBGChangeValues[2] );
|
||||||
@@ -575,12 +575,12 @@ bool SMLoader::LoadFromSMFile( const RString &sPath, Song &out, bool bFromCache
|
|||||||
else if( sValueName=="HASMUSIC" )
|
else if( sValueName=="HASMUSIC" )
|
||||||
{
|
{
|
||||||
if( bFromCache )
|
if( bFromCache )
|
||||||
out.m_bHasMusic = atoi( sParams[1] ) != 0;
|
out.m_bHasMusic = StringToInt( sParams[1] ) != 0;
|
||||||
}
|
}
|
||||||
else if( sValueName=="HASBANNER" )
|
else if( sValueName=="HASBANNER" )
|
||||||
{
|
{
|
||||||
if( bFromCache )
|
if( bFromCache )
|
||||||
out.m_bHasBanner = atoi( sParams[1] ) != 0;
|
out.m_bHasBanner = StringToInt( sParams[1] ) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( sValueName=="SAMPLESTART" )
|
else if( sValueName=="SAMPLESTART" )
|
||||||
@@ -611,20 +611,20 @@ bool SMLoader::LoadFromSMFile( const RString &sPath, Song &out, bool bFromCache
|
|||||||
|
|
||||||
else if( sValueName=="SELECTABLE" )
|
else if( sValueName=="SELECTABLE" )
|
||||||
{
|
{
|
||||||
if(!stricmp(sParams[1],"YES"))
|
if(sParams[1].EqualsNoCase("YES"))
|
||||||
out.m_SelectionDisplay = out.SHOW_ALWAYS;
|
out.m_SelectionDisplay = out.SHOW_ALWAYS;
|
||||||
else if(!stricmp(sParams[1],"NO"))
|
else if(sParams[1].EqualsNoCase("NO"))
|
||||||
out.m_SelectionDisplay = out.SHOW_NEVER;
|
out.m_SelectionDisplay = out.SHOW_NEVER;
|
||||||
// ROULETTE from 3.9. It was removed since UnlockManager can serve
|
// ROULETTE from 3.9. It was removed since UnlockManager can serve
|
||||||
// the same purpose somehow. This, of course, assumes you're using
|
// the same purpose somehow. This, of course, assumes you're using
|
||||||
// unlocks. -aj
|
// unlocks. -aj
|
||||||
else if(!stricmp(sParams[1],"ROULETTE"))
|
else if(sParams[1].EqualsNoCase("ROULETTE"))
|
||||||
out.m_SelectionDisplay = out.SHOW_ALWAYS;
|
out.m_SelectionDisplay = out.SHOW_ALWAYS;
|
||||||
/* The following two cases are just fixes to make sure simfiles that
|
/* The following two cases are just fixes to make sure simfiles that
|
||||||
* used 3.9+ features are not excluded here */
|
* used 3.9+ features are not excluded here */
|
||||||
else if(!stricmp(sParams[1],"ES") || !stricmp(sParams[1],"OMES"))
|
else if(sParams[1].EqualsNoCase("ES") || sParams[1].EqualsNoCase("OMES"))
|
||||||
out.m_SelectionDisplay = out.SHOW_ALWAYS;
|
out.m_SelectionDisplay = out.SHOW_ALWAYS;
|
||||||
else if( atoi(sParams[1]) > 0 )
|
else if( StringToInt(sParams[1]) > 0 )
|
||||||
out.m_SelectionDisplay = out.SHOW_ALWAYS;
|
out.m_SelectionDisplay = out.SHOW_ALWAYS;
|
||||||
else
|
else
|
||||||
LOG->UserLog( "Song file", sPath, "has an unknown #SELECTABLE value, \"%s\"; ignored.", sParams[1].c_str() );
|
LOG->UserLog( "Song file", sPath, "has an unknown #SELECTABLE value, \"%s\"; ignored.", sParams[1].c_str() );
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ void SMALoader::LoadFromSMATokens(
|
|||||||
out.SetDifficulty( Difficulty_Challenge );
|
out.SetDifficulty( Difficulty_Challenge );
|
||||||
}
|
}
|
||||||
|
|
||||||
out.SetMeter( atoi(sMeter) );
|
out.SetMeter( StringToInt(sMeter) );
|
||||||
vector<RString> saValues;
|
vector<RString> saValues;
|
||||||
split( sRadarValues, ",", saValues, true );
|
split( sRadarValues, ",", saValues, true );
|
||||||
int categories = NUM_RadarCategory - 1; // Fakes aren't counted in the radar values.
|
int categories = NUM_RadarCategory - 1; // Fakes aren't counted in the radar values.
|
||||||
@@ -244,20 +244,20 @@ bool SMALoader::LoadFromSMAFile( const RString &sPath, Song &out )
|
|||||||
|
|
||||||
else if( sValueName=="SELECTABLE" )
|
else if( sValueName=="SELECTABLE" )
|
||||||
{
|
{
|
||||||
if(!stricmp(sParams[1],"YES"))
|
if(sParams[1].EqualsNoCase("YES"))
|
||||||
out.m_SelectionDisplay = out.SHOW_ALWAYS;
|
out.m_SelectionDisplay = out.SHOW_ALWAYS;
|
||||||
else if(!stricmp(sParams[1],"NO"))
|
else if(sParams[1].EqualsNoCase("NO"))
|
||||||
out.m_SelectionDisplay = out.SHOW_NEVER;
|
out.m_SelectionDisplay = out.SHOW_NEVER;
|
||||||
// ROULETTE from 3.9. It was removed since UnlockManager can serve
|
// ROULETTE from 3.9. It was removed since UnlockManager can serve
|
||||||
// the same purpose somehow. This, of course, assumes you're using
|
// the same purpose somehow. This, of course, assumes you're using
|
||||||
// unlocks. -aj
|
// unlocks. -aj
|
||||||
else if(!stricmp(sParams[1],"ROULETTE"))
|
else if(sParams[1].EqualsNoCase("ROULETTE"))
|
||||||
out.m_SelectionDisplay = out.SHOW_ALWAYS;
|
out.m_SelectionDisplay = out.SHOW_ALWAYS;
|
||||||
/* The following two cases are just fixes to make sure simfiles that
|
/* The following two cases are just fixes to make sure simfiles that
|
||||||
* used 3.9+ features are not excluded here */
|
* used 3.9+ features are not excluded here */
|
||||||
else if(!stricmp(sParams[1],"ES") || !stricmp(sParams[1],"OMES"))
|
else if(sParams[1].EqualsNoCase("ES") || sParams[1].EqualsNoCase("OMES"))
|
||||||
out.m_SelectionDisplay = out.SHOW_ALWAYS;
|
out.m_SelectionDisplay = out.SHOW_ALWAYS;
|
||||||
else if( atoi(sParams[1]) > 0 )
|
else if( StringToInt(sParams[1]) > 0 )
|
||||||
out.m_SelectionDisplay = out.SHOW_ALWAYS;
|
out.m_SelectionDisplay = out.SHOW_ALWAYS;
|
||||||
else
|
else
|
||||||
LOG->UserLog( "Song file", sPath, "has an unknown #SELECTABLE value, \"%s\"; ignored.", sParams[1].c_str() );
|
LOG->UserLog( "Song file", sPath, "has an unknown #SELECTABLE value, \"%s\"; ignored.", sParams[1].c_str() );
|
||||||
@@ -430,13 +430,13 @@ void SMALoader::LoadTimingFromSMAFile( const MsdFile &msd, TimingData &out )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
encountered = true;
|
encountered = true;
|
||||||
rowsPerMeasure = atoi( sParams[1] );
|
rowsPerMeasure = StringToInt( sParams[1] );
|
||||||
}
|
}
|
||||||
else if( sValueName=="BEATSPERMEASURE" )
|
else if( sValueName=="BEATSPERMEASURE" )
|
||||||
{
|
{
|
||||||
TimeSignatureSegment new_seg;
|
TimeSignatureSegment new_seg;
|
||||||
new_seg.m_iStartRow = 0;
|
new_seg.m_iStartRow = 0;
|
||||||
new_seg.m_iNumerator = atoi( sParams[1] );
|
new_seg.m_iNumerator = StringToInt( sParams[1] );
|
||||||
new_seg.m_iDenominator = 4;
|
new_seg.m_iDenominator = 4;
|
||||||
out.AddTimeSignatureSegment( new_seg );
|
out.AddTimeSignatureSegment( new_seg );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -292,18 +292,18 @@ bool SSCLoader::LoadFromSSCFile( const RString &sPath, Song &out, bool bFromCach
|
|||||||
|
|
||||||
else if( sValueName=="SELECTABLE" )
|
else if( sValueName=="SELECTABLE" )
|
||||||
{
|
{
|
||||||
if(!stricmp(sParams[1],"YES"))
|
if(sParams[1].EqualsNoCase("YES"))
|
||||||
out.m_SelectionDisplay = out.SHOW_ALWAYS;
|
out.m_SelectionDisplay = out.SHOW_ALWAYS;
|
||||||
else if(!stricmp(sParams[1],"NO"))
|
else if(sParams[1].EqualsNoCase("NO"))
|
||||||
out.m_SelectionDisplay = out.SHOW_NEVER;
|
out.m_SelectionDisplay = out.SHOW_NEVER;
|
||||||
// ROULETTE from 3.9 is no longer in use.
|
// ROULETTE from 3.9 is no longer in use.
|
||||||
else if(!stricmp(sParams[1],"ROULETTE"))
|
else if(sParams[1].EqualsNoCase("ROULETTE"))
|
||||||
out.m_SelectionDisplay = out.SHOW_ALWAYS;
|
out.m_SelectionDisplay = out.SHOW_ALWAYS;
|
||||||
/* The following two cases are just fixes to make sure simfiles that
|
/* The following two cases are just fixes to make sure simfiles that
|
||||||
* used 3.9+ features are not excluded here */
|
* used 3.9+ features are not excluded here */
|
||||||
else if(!stricmp(sParams[1],"ES") || !stricmp(sParams[1],"OMES"))
|
else if(sParams[1].EqualsNoCase("ES") || sParams[1].EqualsNoCase("OMES"))
|
||||||
out.m_SelectionDisplay = out.SHOW_ALWAYS;
|
out.m_SelectionDisplay = out.SHOW_ALWAYS;
|
||||||
else if( atoi(sParams[1]) > 0 )
|
else if( StringToInt(sParams[1]) > 0 )
|
||||||
out.m_SelectionDisplay = out.SHOW_ALWAYS;
|
out.m_SelectionDisplay = out.SHOW_ALWAYS;
|
||||||
else
|
else
|
||||||
LOG->UserLog( "Song file", sPath, "has an unknown #SELECTABLE value, \"%s\"; ignored.", sParams[1].c_str() );
|
LOG->UserLog( "Song file", sPath, "has an unknown #SELECTABLE value, \"%s\"; ignored.", sParams[1].c_str() );
|
||||||
@@ -466,13 +466,13 @@ bool SSCLoader::LoadFromSSCFile( const RString &sPath, Song &out, bool bFromCach
|
|||||||
else if( sValueName=="HASMUSIC" )
|
else if( sValueName=="HASMUSIC" )
|
||||||
{
|
{
|
||||||
if( bFromCache )
|
if( bFromCache )
|
||||||
out.m_bHasMusic = atoi( sParams[1] ) != 0;
|
out.m_bHasMusic = StringToInt( sParams[1] ) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( sValueName=="HASBANNER" )
|
else if( sValueName=="HASBANNER" )
|
||||||
{
|
{
|
||||||
if( bFromCache )
|
if( bFromCache )
|
||||||
out.m_bHasBanner = atoi( sParams[1] ) != 0;
|
out.m_bHasBanner = StringToInt( sParams[1] ) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This tag will get us to the next section.
|
// This tag will get us to the next section.
|
||||||
@@ -509,7 +509,7 @@ bool SSCLoader::LoadFromSSCFile( const RString &sPath, Song &out, bool bFromCach
|
|||||||
|
|
||||||
else if( sValueName=="METER" )
|
else if( sValueName=="METER" )
|
||||||
{
|
{
|
||||||
pNewNotes->SetMeter( atoi( sParams[1] ) );
|
pNewNotes->SetMeter( StringToInt( sParams[1] ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( sValueName=="RADARVALUES" )
|
else if( sValueName=="RADARVALUES" )
|
||||||
@@ -751,7 +751,7 @@ bool SSCLoader::LoadEditFromMsd( const MsdFile &msd, const RString &sEditFilePat
|
|||||||
|
|
||||||
else if( sValueName=="METER" )
|
else if( sValueName=="METER" )
|
||||||
{
|
{
|
||||||
pNewNotes->SetMeter( atoi( sParams[1] ) );
|
pNewNotes->SetMeter( StringToInt( sParams[1] ) );
|
||||||
bSSCFormat = true;
|
bSSCFormat = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,229 @@
|
|||||||
|
#include "global.h"
|
||||||
|
#include "NotesWriterJson.h"
|
||||||
|
#include "TimingData.h"
|
||||||
|
#include "Json/Value.h"
|
||||||
|
#include "JsonUtil.h"
|
||||||
|
#include "Song.h"
|
||||||
|
#include "BackgroundUtil.h"
|
||||||
|
#include "Steps.h"
|
||||||
|
#include "NoteData.h"
|
||||||
|
#include "GameManager.h"
|
||||||
|
|
||||||
|
void Serialize(const BPMSegment &seg, Json::Value &root)
|
||||||
|
{
|
||||||
|
root["Beat"] = NoteRowToBeat(seg.m_iStartRow);
|
||||||
|
root["BPM"] = seg.m_fBPS * 60;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Serialize(const StopSegment &seg, Json::Value &root)
|
||||||
|
{
|
||||||
|
root["Beat"] = NoteRowToBeat(seg.m_iStartRow);
|
||||||
|
root["Seconds"] = seg.m_fStopSeconds;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Serialize(const TimingData &td, Json::Value &root)
|
||||||
|
{
|
||||||
|
JsonUtil::SerializeVectorObjects( td.m_BPMSegments, Serialize, root["BpmSegments"] );
|
||||||
|
JsonUtil::SerializeVectorObjects( td.m_StopSegments, Serialize, root["StopSegments"] );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Serialize(const LyricSegment &o, Json::Value &root)
|
||||||
|
{
|
||||||
|
root["StartTime"] = (float)o.m_fStartTime;
|
||||||
|
root["Lyric"] = o.m_sLyric;
|
||||||
|
root["Color"] = o.m_Color.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Serialize(const BackgroundDef &o, Json::Value &root)
|
||||||
|
{
|
||||||
|
root["Effect"] = o.m_sEffect;
|
||||||
|
root["File1"] = o.m_sFile1;
|
||||||
|
root["File2"] = o.m_sFile2;
|
||||||
|
root["Color1"] = o.m_sColor1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Serialize(const BackgroundChange &o, Json::Value &root )
|
||||||
|
{
|
||||||
|
Serialize( o.m_def, root["Def"] );
|
||||||
|
root["StartBeat"] = o.m_fStartBeat;
|
||||||
|
root["Rate"] = o.m_fRate;
|
||||||
|
root["Transition"] = o.m_sTransition;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Serialize( const TapNote &o, Json::Value &root )
|
||||||
|
{
|
||||||
|
root = Json::Value(Json::objectValue);
|
||||||
|
|
||||||
|
if( o.type != TapNote::tap )
|
||||||
|
root["Type"] = (int)o.type;
|
||||||
|
if( o.type == TapNote::hold_head )
|
||||||
|
root["SubType"] = (int)o.subType;
|
||||||
|
//root["Source"] = (int)source;
|
||||||
|
if( !o.sAttackModifiers.empty() )
|
||||||
|
root["AttackModifiers"] = o.sAttackModifiers;
|
||||||
|
if( o.fAttackDurationSeconds > 0 )
|
||||||
|
root["AttackDurationSeconds"] = o.fAttackDurationSeconds;
|
||||||
|
if( o.iKeysoundIndex != -1 )
|
||||||
|
root["KeysoundIndex"] = o.iKeysoundIndex;
|
||||||
|
if( o.iDuration > 0 )
|
||||||
|
root["Duration"] = o.iDuration;
|
||||||
|
if( o.pn != PLAYER_INVALID )
|
||||||
|
root["PlayerNumber"] = (int)o.pn;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Serialize( const NoteData &o, Json::Value &root )
|
||||||
|
{
|
||||||
|
root = Json::Value(Json::arrayValue);
|
||||||
|
for(int t=0; t < o.GetNumTracks(); t++ )
|
||||||
|
{
|
||||||
|
NoteData::TrackMap::const_iterator begin, end;
|
||||||
|
o.GetTapNoteRange( t, 0, MAX_NOTE_ROW, begin, end );
|
||||||
|
//NoteData::TrackMap tm = o.GetTrack(t);
|
||||||
|
//FOREACHM_CONST( int, TapNote, tm, iter )
|
||||||
|
for( ; begin != end; ++begin )
|
||||||
|
{
|
||||||
|
int iRow = begin->first;
|
||||||
|
TapNote tn = begin->second;
|
||||||
|
root.resize( root.size()+1 );
|
||||||
|
Json::Value &root2 = root[ root.size()-1 ];
|
||||||
|
root2 = Json::Value(Json::arrayValue);
|
||||||
|
root2.resize(3);
|
||||||
|
root2[(unsigned)0] = NoteRowToBeat(iRow);
|
||||||
|
root2[1] = t;
|
||||||
|
Serialize( tn, root2[2] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Serialize( const RadarValues &o, Json::Value &root )
|
||||||
|
{
|
||||||
|
FOREACH_ENUM( RadarCategory, rc )
|
||||||
|
{
|
||||||
|
root[ RadarCategoryToString(rc) ] = o.m_Values.f[rc];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Serialize( const Steps &o, Json::Value &root )
|
||||||
|
{
|
||||||
|
root["StepsType"] = StringConversion::ToString(o.m_StepsType);
|
||||||
|
|
||||||
|
o.Decompress();
|
||||||
|
|
||||||
|
NoteData nd;
|
||||||
|
o.GetNoteData( nd );
|
||||||
|
Serialize( nd, root["NoteData"] );
|
||||||
|
root["Hash"] = o.GetHash();
|
||||||
|
root["Description"] = o.GetDescription();
|
||||||
|
root["Difficulty"] = DifficultyToString(o.GetDifficulty());
|
||||||
|
root["Meter"] = o.GetMeter();
|
||||||
|
Serialize( o.GetRadarValues( PLAYER_1 ), root["RadarValues"] );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool NotesWriterJson::WriteSong( const RString &sFile, const Song &out, bool bWriteSteps )
|
||||||
|
{
|
||||||
|
Json::Value root;
|
||||||
|
root["SongDir"] = out.GetSongDir();
|
||||||
|
root["GroupName"] = out.m_sGroupName;
|
||||||
|
root["Title"] = out.m_sMainTitle;
|
||||||
|
root["SubTitle"] = out.m_sSubTitle;
|
||||||
|
root["Artist"] = out.m_sArtist;
|
||||||
|
root["TitleTranslit"] = out.m_sMainTitleTranslit;
|
||||||
|
root["SubTitleTranslit"] = out.m_sSubTitleTranslit;
|
||||||
|
root["Genre"] = out.m_sGenre;
|
||||||
|
root["Credit"] = out.m_sCredit;
|
||||||
|
root["Banner"] = out.m_sBannerFile;
|
||||||
|
root["Background"] = out.m_sBackgroundFile;
|
||||||
|
root["LyricsFile"] = out.m_sLyricsFile;
|
||||||
|
root["CDTitle"] = out.m_sCDTitleFile;
|
||||||
|
root["Music"] = out.m_sMusicFile;
|
||||||
|
root["Offset"] = out.m_SongTiming.m_fBeat0OffsetInSeconds;
|
||||||
|
root["SampleStart"] = out.m_fMusicSampleStartSeconds;
|
||||||
|
root["SampleLength"] = out.m_fMusicSampleLengthSeconds;
|
||||||
|
if( out.m_SelectionDisplay == Song::SHOW_ALWAYS )
|
||||||
|
root["Selectable"] = "YES";
|
||||||
|
else if( out.m_SelectionDisplay == Song::SHOW_NEVER )
|
||||||
|
root["Selectable"] = "NO";
|
||||||
|
else
|
||||||
|
root["Selectable"] = "YES";
|
||||||
|
|
||||||
|
root["FirstBeat"] = out.m_fFirstBeat;
|
||||||
|
root["LastBeat"] = out.m_fLastBeat;
|
||||||
|
root["SongFileName"] = out.m_sSongFileName;
|
||||||
|
root["HasMusic"] = out.m_bHasMusic;
|
||||||
|
root["HasBanner"] = out.m_bHasBanner;
|
||||||
|
root["MusicLengthSeconds"] = out.m_fMusicLengthSeconds;
|
||||||
|
|
||||||
|
root["DisplayBpmType"] = StringConversion::ToString(out.m_DisplayBPMType);
|
||||||
|
if( out.m_DisplayBPMType == DISPLAY_BPM_SPECIFIED )
|
||||||
|
{
|
||||||
|
root["SpecifiedBpmMin"] = out.m_fSpecifiedBPMMin;
|
||||||
|
root["SpecifiedBpmMax"] = out.m_fSpecifiedBPMMax;
|
||||||
|
}
|
||||||
|
|
||||||
|
Serialize( out.m_SongTiming, root["TimingData"] );
|
||||||
|
JsonUtil::SerializeVectorObjects( out.m_LyricSegments, Serialize, root["LyricSegments"] );
|
||||||
|
|
||||||
|
{
|
||||||
|
Json::Value &root2 = root["BackgroundChanges"];
|
||||||
|
FOREACH_BackgroundLayer( bl )
|
||||||
|
{
|
||||||
|
Json::Value &root3 = root2[bl];
|
||||||
|
const vector<BackgroundChange> &vBgc = out.GetBackgroundChanges(bl);
|
||||||
|
JsonUtil::SerializeVectorObjects( vBgc, Serialize, root3 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const vector<BackgroundChange> &vBgc = out.GetForegroundChanges();
|
||||||
|
JsonUtil::SerializeVectorObjects( vBgc, Serialize, root["ForegroundChanges"] );
|
||||||
|
}
|
||||||
|
|
||||||
|
JsonUtil::SerializeArrayValues( out.m_vsKeysoundFile, root["KeySounds"] );
|
||||||
|
|
||||||
|
if( bWriteSteps )
|
||||||
|
{
|
||||||
|
vector<const Steps*> vpSteps;
|
||||||
|
FOREACH_CONST( Steps*, out.GetAllSteps(), iter )
|
||||||
|
{
|
||||||
|
if( (*iter)->IsAutogen() )
|
||||||
|
continue;
|
||||||
|
vpSteps.push_back( *iter );
|
||||||
|
}
|
||||||
|
JsonUtil::SerializeVectorPointers<Steps>( vpSteps, Serialize, root["Charts"] );
|
||||||
|
}
|
||||||
|
|
||||||
|
return JsonUtil::WriteFile( root, sFile, false );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NotesWriterJson::WriteSteps( const RString &sFile, const Steps &out )
|
||||||
|
{
|
||||||
|
Json::Value root;
|
||||||
|
Serialize( out, root );
|
||||||
|
return JsonUtil::WriteFile( root, sFile, false );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (c) 2001-2004 Chris Danford, Glenn Maynard
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
* copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||||
|
* whom the Software is furnished to do so, provided that the above
|
||||||
|
* copyright notice(s) and this permission notice appear in all copies of
|
||||||
|
* the Software and that both the above copyright notice(s) and this
|
||||||
|
* permission notice appear in supporting documentation.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||||
|
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||||
|
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||||
|
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||||
|
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
|
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
|
* PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
/* NotesWriterJson - Writes a Song to a .json file. */
|
||||||
|
|
||||||
|
#ifndef NotesWriterJson_H
|
||||||
|
#define NotesWriterJson_H
|
||||||
|
|
||||||
|
class Song;
|
||||||
|
class Steps;
|
||||||
|
|
||||||
|
namespace NotesWriterJson
|
||||||
|
{
|
||||||
|
static bool WriteSong( const RString &sFile, const Song &out, bool bWriteSteps );
|
||||||
|
static bool WriteSteps( const RString &sFile, const Steps &out );
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (c) 2001-2010 Chris Danford, Glenn Maynard
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
* copy of this software and associated documentation files (the
|
||||||
|
* "Software"), to deal in the Software without restriction, including
|
||||||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||||
|
* whom the Software is furnished to do so, provided that the above
|
||||||
|
* copyright notice(s) and this permission notice appear in all copies of
|
||||||
|
* the Software and that both the above copyright notice(s) and this
|
||||||
|
* permission notice appear in supporting documentation.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||||
|
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||||
|
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||||
|
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||||
|
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||||
|
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
|
* PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
@@ -154,7 +154,7 @@ public:
|
|||||||
RageException::Throw( "Parse error in \"ScreenOptionsMaster::%s\".", sParam.c_str() );
|
RageException::Throw( "Parse error in \"ScreenOptionsMaster::%s\".", sParam.c_str() );
|
||||||
|
|
||||||
m_Def.m_bOneChoiceForAllPlayers = false;
|
m_Def.m_bOneChoiceForAllPlayers = false;
|
||||||
const int NumCols = atoi( lCmds.v[0].m_vsArgs[0] );
|
const int NumCols = StringToInt( lCmds.v[0].m_vsArgs[0] );
|
||||||
for( unsigned i=1; i<lCmds.v.size(); i++ )
|
for( unsigned i=1; i<lCmds.v.size(); i++ )
|
||||||
{
|
{
|
||||||
const Command &cmd = lCmds.v[i];
|
const Command &cmd = lCmds.v[i];
|
||||||
@@ -165,7 +165,7 @@ public:
|
|||||||
else if( sName == "selectone" ) m_Def.m_selectType = SELECT_ONE;
|
else if( sName == "selectone" ) m_Def.m_selectType = SELECT_ONE;
|
||||||
else if( sName == "selectnone" ) m_Def.m_selectType = SELECT_NONE;
|
else if( sName == "selectnone" ) m_Def.m_selectType = SELECT_NONE;
|
||||||
else if( sName == "showoneinrow" ) m_Def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW;
|
else if( sName == "showoneinrow" ) m_Def.m_layoutType = LAYOUT_SHOW_ONE_IN_ROW;
|
||||||
else if( sName == "default" ) m_Def.m_iDefault = atoi( cmd.GetArg(1).s ) - 1; // match ENTRY_MODE
|
else if( sName == "default" ) m_Def.m_iDefault = StringToInt( cmd.GetArg(1).s ) - 1; // match ENTRY_MODE
|
||||||
else if( sName == "reloadrowmessages" )
|
else if( sName == "reloadrowmessages" )
|
||||||
{
|
{
|
||||||
for( unsigned a=1; a<cmd.m_vsArgs.size(); a++ )
|
for( unsigned a=1; a<cmd.m_vsArgs.size(); a++ )
|
||||||
@@ -177,7 +177,7 @@ public:
|
|||||||
for( unsigned a=1; a<cmd.m_vsArgs.size(); a++ )
|
for( unsigned a=1; a<cmd.m_vsArgs.size(); a++ )
|
||||||
{
|
{
|
||||||
RString sArg = cmd.m_vsArgs[a];
|
RString sArg = cmd.m_vsArgs[a];
|
||||||
PlayerNumber pn = (PlayerNumber)(atoi(sArg)-1);
|
PlayerNumber pn = (PlayerNumber)(StringToInt(sArg)-1);
|
||||||
ASSERT( pn >= 0 && pn < NUM_PLAYERS );
|
ASSERT( pn >= 0 && pn < NUM_PLAYERS );
|
||||||
m_Def.m_vEnabledForPlayers.insert( pn );
|
m_Def.m_vEnabledForPlayers.insert( pn );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -299,7 +299,7 @@ bool PlayerOptions::FromOneModString( const RString &sOneMod, RString &sErrorOut
|
|||||||
{
|
{
|
||||||
/* XXX We know what they want, is there any reason not to handle it? */
|
/* XXX We know what they want, is there any reason not to handle it? */
|
||||||
/* Yes. We should be strict in handling the format. -Chris */
|
/* Yes. We should be strict in handling the format. -Chris */
|
||||||
sErrorOut = ssprintf("Invalid player options \"%s\"; did you mean '*%d'?", s->c_str(), atoi(*s) );
|
sErrorOut = ssprintf("Invalid player options \"%s\"; did you mean '*%d'?", s->c_str(), StringToInt(*s) );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
+1
-1
@@ -1922,7 +1922,7 @@ RString Profile::MakeUniqueFileNameNoExtension( RString sDir, RString sFileNameB
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
ASSERT( matches.size() == 1 );
|
ASSERT( matches.size() == 1 );
|
||||||
iIndex = atoi( matches[0] )+1;
|
iIndex = StringToInt( matches[0] )+1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -429,7 +429,7 @@ bool ProfileManager::CreateLocalProfile( RString sName, RString &sProfileIDOut )
|
|||||||
vector<RString> vs;
|
vector<RString> vs;
|
||||||
GetLocalProfileIDs( vs );
|
GetLocalProfileIDs( vs );
|
||||||
FOREACH_CONST( RString, vs, s )
|
FOREACH_CONST( RString, vs, s )
|
||||||
iMaxProfileNumber = atoi( *s );
|
iMaxProfileNumber = StringToInt( *s );
|
||||||
|
|
||||||
int iProfileNumber = iMaxProfileNumber + 1;
|
int iProfileNumber = iMaxProfileNumber + 1;
|
||||||
RString sProfileID = ssprintf( "%08d", iProfileNumber );
|
RString sProfileID = ssprintf( "%08d", iProfileNumber );
|
||||||
|
|||||||
@@ -26,8 +26,8 @@ static void GetResolutionFromFileName( RString sPath, int &iWidth, int &iHeight
|
|||||||
if( !re.Compare(sPath, asMatches) )
|
if( !re.Compare(sPath, asMatches) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
iWidth = atoi( asMatches[0].c_str() );
|
iWidth = StringToInt( asMatches[0] );
|
||||||
iHeight = atoi( asMatches[1].c_str() );
|
iHeight = StringToInt( asMatches[1] );
|
||||||
}
|
}
|
||||||
|
|
||||||
RageBitmapTexture::RageBitmapTexture( RageTextureID name ) :
|
RageBitmapTexture::RageBitmapTexture( RageTextureID name ) :
|
||||||
|
|||||||
+2
-2
@@ -51,8 +51,8 @@ void RageTexture::GetFrameDimensionsFromFileName( RString sPath, int* piFramesWi
|
|||||||
*piFramesWide = *piFramesHigh = 1;
|
*piFramesWide = *piFramesHigh = 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
*piFramesWide = atoi(asMatch[0]);
|
*piFramesWide = StringToInt(asMatch[0]);
|
||||||
*piFramesHigh = atoi(asMatch[1]);
|
*piFramesHigh = StringToInt(asMatch[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const RectF *RageTexture::GetTextureCoordRect( int iFrameNo ) const
|
const RectF *RageTexture::GetTextureCoordRect( int iFrameNo ) const
|
||||||
|
|||||||
+18
-3
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
#include <sstream>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@@ -193,8 +194,8 @@ float HHMMSSToSeconds( const RString &sHHMMSS )
|
|||||||
arrayBits.insert(arrayBits.begin(), "0" ); // pad missing bits
|
arrayBits.insert(arrayBits.begin(), "0" ); // pad missing bits
|
||||||
|
|
||||||
float fSeconds = 0;
|
float fSeconds = 0;
|
||||||
fSeconds += atoi( arrayBits[0] ) * 60 * 60;
|
fSeconds += StringToInt( arrayBits[0] ) * 60 * 60;
|
||||||
fSeconds += atoi( arrayBits[1] ) * 60;
|
fSeconds += StringToInt( arrayBits[1] ) * 60;
|
||||||
fSeconds += StringToFloat( arrayBits[2] );
|
fSeconds += StringToFloat( arrayBits[2] );
|
||||||
|
|
||||||
return fSeconds;
|
return fSeconds;
|
||||||
@@ -1695,6 +1696,20 @@ void MakeLower( wchar_t *p, size_t iLen )
|
|||||||
UnicodeUpperLower( p, iLen, g_LowerCase );
|
UnicodeUpperLower( p, iLen, g_LowerCase );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int StringToInt( const RString &sString )
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
istringstream ( sString ) >> ret;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
RString IntToString( const int &iNum )
|
||||||
|
{
|
||||||
|
stringstream ss;
|
||||||
|
ss << iNum;
|
||||||
|
return ss.str();
|
||||||
|
}
|
||||||
|
|
||||||
float StringToFloat( const RString &sString )
|
float StringToFloat( const RString &sString )
|
||||||
{
|
{
|
||||||
float ret = strtof( sString, NULL );
|
float ret = strtof( sString, NULL );
|
||||||
@@ -2141,7 +2156,7 @@ namespace StringConversion
|
|||||||
if( sValue.size() == 0 )
|
if( sValue.size() == 0 )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
out = (atoi(sValue) != 0);
|
out = (StringToInt(sValue) != 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -405,6 +405,16 @@ void MakeUpper( char *p, size_t iLen );
|
|||||||
void MakeLower( char *p, size_t iLen );
|
void MakeLower( char *p, size_t iLen );
|
||||||
void MakeUpper( wchar_t *p, size_t iLen );
|
void MakeUpper( wchar_t *p, size_t iLen );
|
||||||
void MakeLower( wchar_t *p, size_t iLen );
|
void MakeLower( wchar_t *p, size_t iLen );
|
||||||
|
/**
|
||||||
|
* @brief Have a standard way of converting Strings to integers.
|
||||||
|
* @param sString the string to convert.
|
||||||
|
* @return the integer we are after. */
|
||||||
|
int StringToInt( const RString &sString );
|
||||||
|
/**
|
||||||
|
* @brief Have a standard way of converting integers to Strings.
|
||||||
|
* @param iNum the integer to convert.
|
||||||
|
* @return the string we are after. */
|
||||||
|
RString IntToString( const int &iNum );
|
||||||
float StringToFloat( const RString &sString );
|
float StringToFloat( const RString &sString );
|
||||||
bool StringToFloat( const RString &sString, float &fOut );
|
bool StringToFloat( const RString &sString, float &fOut );
|
||||||
|
|
||||||
|
|||||||
+5
-7
@@ -2623,9 +2623,7 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
}
|
}
|
||||||
else if( SM == SM_BackFromDifficultyMeterChange )
|
else if( SM == SM_BackFromDifficultyMeterChange )
|
||||||
{
|
{
|
||||||
int i;
|
int i = StringToInt( ScreenTextEntry::s_sLastAnswer );
|
||||||
std::istringstream ss( ScreenTextEntry::s_sLastAnswer );
|
|
||||||
ss >> i;
|
|
||||||
GAMESTATE->m_pCurSteps[PLAYER_1]->SetMeter(i);
|
GAMESTATE->m_pCurSteps[PLAYER_1]->SetMeter(i);
|
||||||
SetDirty( true );
|
SetDirty( true );
|
||||||
}
|
}
|
||||||
@@ -2652,7 +2650,7 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
}
|
}
|
||||||
else if( SM == SM_BackFromTimeSignatureNumeratorChange )
|
else if( SM == SM_BackFromTimeSignatureNumeratorChange )
|
||||||
{
|
{
|
||||||
int iNum = atoi( ScreenTextEntry::s_sLastAnswer );
|
int iNum = StringToInt( ScreenTextEntry::s_sLastAnswer );
|
||||||
if( iNum > 0 )
|
if( iNum > 0 )
|
||||||
{
|
{
|
||||||
m_pSteps->m_Timing.SetTimeSignatureNumeratorAtBeat( GAMESTATE->m_pPlayerState[PLAYER_1]->m_Position.m_fSongBeat, iNum );
|
m_pSteps->m_Timing.SetTimeSignatureNumeratorAtBeat( GAMESTATE->m_pPlayerState[PLAYER_1]->m_Position.m_fSongBeat, iNum );
|
||||||
@@ -2661,7 +2659,7 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
}
|
}
|
||||||
else if ( SM == SM_BackFromTimeSignatureDenominatorChange )
|
else if ( SM == SM_BackFromTimeSignatureDenominatorChange )
|
||||||
{
|
{
|
||||||
int iDen = atoi( ScreenTextEntry::s_sLastAnswer );
|
int iDen = StringToInt( ScreenTextEntry::s_sLastAnswer );
|
||||||
if( iDen > 0)
|
if( iDen > 0)
|
||||||
{
|
{
|
||||||
m_pSteps->m_Timing.SetTimeSignatureDenominatorAtBeat( GAMESTATE->m_pPlayerState[PLAYER_1]->m_Position.m_fSongBeat, iDen );
|
m_pSteps->m_Timing.SetTimeSignatureDenominatorAtBeat( GAMESTATE->m_pPlayerState[PLAYER_1]->m_Position.m_fSongBeat, iDen );
|
||||||
@@ -2670,7 +2668,7 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
}
|
}
|
||||||
else if ( SM == SM_BackFromTickcountChange )
|
else if ( SM == SM_BackFromTickcountChange )
|
||||||
{
|
{
|
||||||
int iTick = atoi( ScreenTextEntry::s_sLastAnswer );
|
int iTick = StringToInt( ScreenTextEntry::s_sLastAnswer );
|
||||||
if ( iTick >= 0 && iTick <= ROWS_PER_BEAT )
|
if ( iTick >= 0 && iTick <= ROWS_PER_BEAT )
|
||||||
{
|
{
|
||||||
m_pSteps->m_Timing.SetTickcountAtBeat( GAMESTATE->m_pPlayerState[PLAYER_1]->m_Position.m_fSongBeat, iTick );
|
m_pSteps->m_Timing.SetTickcountAtBeat( GAMESTATE->m_pPlayerState[PLAYER_1]->m_Position.m_fSongBeat, iTick );
|
||||||
@@ -2679,7 +2677,7 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
|
|||||||
}
|
}
|
||||||
else if ( SM == SM_BackFromComboChange )
|
else if ( SM == SM_BackFromComboChange )
|
||||||
{
|
{
|
||||||
int iCombo = atoi( ScreenTextEntry::s_sLastAnswer );
|
int iCombo = StringToInt( ScreenTextEntry::s_sLastAnswer );
|
||||||
if ( iCombo >= 0 )
|
if ( iCombo >= 0 )
|
||||||
{
|
{
|
||||||
m_pSteps->m_Timing.SetComboAtBeat( GAMESTATE->m_pPlayerState[PLAYER_1]->m_Position.m_fSongBeat, iCombo );
|
m_pSteps->m_Timing.SetComboAtBeat( GAMESTATE->m_pPlayerState[PLAYER_1]->m_Position.m_fSongBeat, iCombo );
|
||||||
|
|||||||
@@ -2757,7 +2757,7 @@ void ScreenGameplay::SaveReplay()
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
ASSERT( matches.size() == 1 );
|
ASSERT( matches.size() == 1 );
|
||||||
iIndex = atoi( matches[0] )+1;
|
iIndex = StringToInt( matches[0] )+1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
#define SCREEN_MINI_MENU_H
|
#define SCREEN_MINI_MENU_H
|
||||||
|
|
||||||
#include "ScreenOptions.h"
|
#include "ScreenOptions.h"
|
||||||
#include <sstream>
|
|
||||||
#include "GameConstantsAndTypes.h"
|
#include "GameConstantsAndTypes.h"
|
||||||
|
|
||||||
typedef bool (*MenuRowUpdateEnabled)();
|
typedef bool (*MenuRowUpdateEnabled)();
|
||||||
@@ -86,9 +85,7 @@ struct MenuRowDef
|
|||||||
{
|
{
|
||||||
for ( int i = low; i <= high; i++ )
|
for ( int i = low; i <= high; i++ )
|
||||||
{
|
{
|
||||||
std::stringstream ss;
|
choices.push_back(IntToString(i).c_str());
|
||||||
ss << i;
|
|
||||||
choices.push_back(ss.str().c_str());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ static void GameSel( int &sel, bool ToSel, const ConfOption *pConfOption )
|
|||||||
|
|
||||||
sel = 0;
|
sel = 0;
|
||||||
for(unsigned i = 0; i < choices.size(); ++i)
|
for(unsigned i = 0; i < choices.size(); ++i)
|
||||||
if( !stricmp(choices[i], sCurGameName) )
|
if( !choices[i].EqualsNoCase(sCurGameName) )
|
||||||
sel = i;
|
sel = i;
|
||||||
} else {
|
} else {
|
||||||
vector<const Game*> aGames;
|
vector<const Game*> aGames;
|
||||||
@@ -222,12 +222,12 @@ static void Language( int &sel, bool ToSel, const ConfOption *pConfOption )
|
|||||||
{
|
{
|
||||||
sel = -1;
|
sel = -1;
|
||||||
for( unsigned i=0; sel == -1 && i < vs.size(); ++i )
|
for( unsigned i=0; sel == -1 && i < vs.size(); ++i )
|
||||||
if( !stricmp(vs[i], THEME->GetCurLanguage()) )
|
if( !vs[i].EqualsNoCase(THEME->GetCurLanguage()) )
|
||||||
sel = i;
|
sel = i;
|
||||||
|
|
||||||
// If the current language doesn't exist, we'll show BASE_LANGUAGE, so select that.
|
// If the current language doesn't exist, we'll show BASE_LANGUAGE, so select that.
|
||||||
for( unsigned i=0; sel == -1 && i < vs.size(); ++i )
|
for( unsigned i=0; sel == -1 && i < vs.size(); ++i )
|
||||||
if( !stricmp(vs[i], SpecialFiles::BASE_LANGUAGE) )
|
if( !vs[i].EqualsNoCase(SpecialFiles::BASE_LANGUAGE) )
|
||||||
sel = i;
|
sel = i;
|
||||||
|
|
||||||
if( sel == -1 )
|
if( sel == -1 )
|
||||||
@@ -276,7 +276,7 @@ static void RequestedTheme( int &sel, bool ToSel, const ConfOption *pConfOption
|
|||||||
{
|
{
|
||||||
sel = 0;
|
sel = 0;
|
||||||
for( unsigned i=1; i<vsThemeNames.size(); i++ )
|
for( unsigned i=1; i<vsThemeNames.size(); i++ )
|
||||||
if( !stricmp(vsThemeNames[i], PREFSMAN->m_sTheme.Get()) )
|
if( !vsThemeNames[i].EqualsNoCase(PREFSMAN->m_sTheme.Get()) )
|
||||||
sel = i;
|
sel = i;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -302,7 +302,7 @@ static void Announcer( int &sel, bool ToSel, const ConfOption *pConfOption )
|
|||||||
{
|
{
|
||||||
sel = 0;
|
sel = 0;
|
||||||
for( unsigned i=1; i<choices.size(); i++ )
|
for( unsigned i=1; i<choices.size(); i++ )
|
||||||
if( !stricmp(choices[i], ANNOUNCER->GetCurAnnouncerName()) )
|
if( !choices[i].EqualsNoCase(ANNOUNCER->GetCurAnnouncerName()) )
|
||||||
sel = i;
|
sel = i;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -329,7 +329,7 @@ static void DefaultNoteSkin( int &sel, bool ToSel, const ConfOption *pConfOption
|
|||||||
po.FromString( PREFSMAN->m_sDefaultModifiers );
|
po.FromString( PREFSMAN->m_sDefaultModifiers );
|
||||||
sel = 0;
|
sel = 0;
|
||||||
for( unsigned i=0; i < choices.size(); i++ )
|
for( unsigned i=0; i < choices.size(); i++ )
|
||||||
if( !stricmp(choices[i], po.m_sNoteSkin) )
|
if( !choices[i].EqualsNoCase(po.m_sNoteSkin) )
|
||||||
sel = i;
|
sel = i;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -622,14 +622,14 @@ void ScreenPackages::HTTPUpdate()
|
|||||||
m_sResponseName = "Malformed response.";
|
m_sResponseName = "Malformed response.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_iResponseCode = atoi(m_sBUFFER.substr(i+1,j-i).c_str());
|
m_iResponseCode = StringToInt(m_sBUFFER.substr(i+1,j-i));
|
||||||
m_sResponseName = m_sBUFFER.substr( j+1, k-j );
|
m_sResponseName = m_sBUFFER.substr( j+1, k-j );
|
||||||
|
|
||||||
i = m_sBUFFER.find("Content-Length:");
|
i = m_sBUFFER.find("Content-Length:");
|
||||||
j = m_sBUFFER.find("\n", i+1 );
|
j = m_sBUFFER.find("\n", i+1 );
|
||||||
|
|
||||||
if( i != string::npos )
|
if( i != string::npos )
|
||||||
m_iTotalBytes = atoi(m_sBUFFER.substr(i+16,j-i).c_str());
|
m_iTotalBytes = StringToInt(m_sBUFFER.substr(i+16,j-i));
|
||||||
else
|
else
|
||||||
m_iTotalBytes = -1; //We don't know, so go until disconnect
|
m_iTotalBytes = -1; //We don't know, so go until disconnect
|
||||||
|
|
||||||
@@ -696,7 +696,7 @@ bool ScreenPackages::ParseHTTPAddress( const RString &URL, RString &sProto, RStr
|
|||||||
sServer = asMatches[1];
|
sServer = asMatches[1];
|
||||||
if( asMatches[3] != "" )
|
if( asMatches[3] != "" )
|
||||||
{
|
{
|
||||||
iPort = atoi(asMatches[3]);
|
iPort = StringToInt(asMatches[3]);
|
||||||
if( iPort == 0 )
|
if( iPort == 0 )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -619,13 +619,13 @@ void Song::TidyUpData()
|
|||||||
|
|
||||||
// Skip any image that we've already classified
|
// Skip any image that we've already classified
|
||||||
|
|
||||||
if( HasBanner() && stricmp(m_sBannerFile, arrayImages[i])==0 )
|
if( HasBanner() && m_sBannerFile.EqualsNoCase(arrayImages[i]) )
|
||||||
continue; // skip
|
continue; // skip
|
||||||
|
|
||||||
if( HasBackground() && stricmp(m_sBackgroundFile, arrayImages[i])==0 )
|
if( HasBackground() && m_sBackgroundFile.EqualsNoCase(arrayImages[i]) )
|
||||||
continue; // skip
|
continue; // skip
|
||||||
|
|
||||||
if( HasCDTitle() && stricmp(m_sCDTitleFile, arrayImages[i])==0 )
|
if( HasCDTitle() && m_sCDTitleFile.EqualsNoCase(arrayImages[i]) )
|
||||||
continue; // skip
|
continue; // skip
|
||||||
|
|
||||||
// todo: add checks for Jacket, Disc, and CDImage -aj
|
// todo: add checks for Jacket, Disc, and CDImage -aj
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ class Song
|
|||||||
RString m_sSongDir;
|
RString m_sSongDir;
|
||||||
public:
|
public:
|
||||||
void SetSongDir( const RString sDir ) { m_sSongDir = sDir; }
|
void SetSongDir( const RString sDir ) { m_sSongDir = sDir; }
|
||||||
|
RString GetSongDir() { return m_sSongDir; }
|
||||||
|
|
||||||
/** @brief When should this song be displayed in the music wheel? */
|
/** @brief When should this song be displayed in the music wheel? */
|
||||||
enum SelectionDisplay
|
enum SelectionDisplay
|
||||||
|
|||||||
+1
-1
@@ -879,7 +879,7 @@ void SongManager::InitRandomAttacks()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( stricmp(sType,"ATTACK") != 0 )
|
if( !sType.EqualsNoCase("ATTACK") )
|
||||||
{
|
{
|
||||||
LOG->Warn( "Got \"%s:%s\" tag with wrong declaration", sType.c_str(), sAttack.c_str() );
|
LOG->Warn( "Got \"%s:%s\" tag with wrong declaration", sType.c_str(), sAttack.c_str() );
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
+1
-1
@@ -173,7 +173,7 @@ bool SongOptions::FromOneModString( const RString &sOneMod, RString &sErrorOut )
|
|||||||
Regex lives("^([0-9]+) ?(lives|life)$");
|
Regex lives("^([0-9]+) ?(lives|life)$");
|
||||||
if( lives.Compare(sBit, matches) )
|
if( lives.Compare(sBit, matches) )
|
||||||
{
|
{
|
||||||
m_iBatteryLives = atoi( matches[0] );
|
m_iBatteryLives = StringToInt( matches[0] );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1575,6 +1575,14 @@
|
|||||||
RelativePath="NotesLoaderDWI.h"
|
RelativePath="NotesLoaderDWI.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\NotesLoaderJson.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\NotesLoaderJson.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="NotesLoaderKSF.cpp"
|
RelativePath="NotesLoaderKSF.cpp"
|
||||||
>
|
>
|
||||||
@@ -1755,6 +1763,14 @@
|
|||||||
RelativePath="NotesWriterDWI.h"
|
RelativePath="NotesWriterDWI.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\NotesWriterJson.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\NotesWriterJson.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="NotesWriterSM.cpp"
|
RelativePath="NotesWriterSM.cpp"
|
||||||
>
|
>
|
||||||
|
|||||||
+2
-1
@@ -162,7 +162,8 @@ public:
|
|||||||
|
|
||||||
bool IsLoaded() const { return m_Value.IsSet(); }
|
bool IsLoaded() const { return m_Value.IsSet(); }
|
||||||
|
|
||||||
//Hacks for VC6 for all boolean operators.
|
// Hacks for VC6 for all boolean operators.
|
||||||
|
// todo: get rid of these -aj
|
||||||
bool operator ! () const { return !GetValue(); }
|
bool operator ! () const { return !GetValue(); }
|
||||||
bool operator && ( const T& input ) const { return GetValue() && input; }
|
bool operator && ( const T& input ) const { return GetValue() && input; }
|
||||||
bool operator || ( const T& input ) const { return GetValue() || input; }
|
bool operator || ( const T& input ) const { return GetValue() || input; }
|
||||||
|
|||||||
+2
-2
@@ -50,9 +50,9 @@ void XNode::Free()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void XNodeStringValue::GetValue( RString &out ) const { out = m_sValue; }
|
void XNodeStringValue::GetValue( RString &out ) const { out = m_sValue; }
|
||||||
void XNodeStringValue::GetValue( int &out ) const { out = atoi(m_sValue); }
|
void XNodeStringValue::GetValue( int &out ) const { out = StringToInt(m_sValue); }
|
||||||
void XNodeStringValue::GetValue( float &out ) const { out = StringToFloat(m_sValue); }
|
void XNodeStringValue::GetValue( float &out ) const { out = StringToFloat(m_sValue); }
|
||||||
void XNodeStringValue::GetValue( bool &out ) const { out = atoi(m_sValue) != 0; }
|
void XNodeStringValue::GetValue( bool &out ) const { out = StringToInt(m_sValue) != 0; }
|
||||||
void XNodeStringValue::GetValue( unsigned &out ) const { out = strtoul(m_sValue,NULL,0); }
|
void XNodeStringValue::GetValue( unsigned &out ) const { out = strtoul(m_sValue,NULL,0); }
|
||||||
void XNodeStringValue::PushValue( lua_State *L ) const
|
void XNodeStringValue::PushValue( lua_State *L ) const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -192,13 +192,6 @@ typedef StdString::CStdString RString;
|
|||||||
|
|
||||||
#include "RageException.h"
|
#include "RageException.h"
|
||||||
|
|
||||||
#if !defined(WIN32)
|
|
||||||
/** @brief Define stricmp to be strcasecmp. */
|
|
||||||
#define stricmp strcasecmp
|
|
||||||
/** @brief Define strnicmp to be strncasecmp. */
|
|
||||||
#define strnicmp strncasecmp
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Define a few functions if necessary */
|
/* Define a few functions if necessary */
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user