Added tags #PREVIEW for .sma and #PREVIEWBG for .ssc

Added HasPreviewBG() and GetPreviewBGPath() lua bindings
This commit is contained in:
Marcio Barrientos
2012-01-11 13:53:30 -06:00
parent 446f818923
commit da84ef04ad
5 changed files with 33 additions and 0 deletions
+3
View File
@@ -207,6 +207,9 @@ bool SMALoader::LoadFromSimfile( const RString &sPath, Song &out, bool bFromCach
else if( sValueName=="BACKGROUND" )
out.m_sBackgroundFile = sParams[1];
else if( sValueName=="PREVIEW" )
out.m_sPreviewBGFile = sParams[1];
// Save "#LYRICS" for later, so we can add an internal lyrics tag.
else if( sValueName=="LYRICSPATH" )
+5
View File
@@ -325,6 +325,11 @@ bool SSCLoader::LoadFromSimfile( const RString &sPath, Song &out, bool bFromCach
out.m_sBackgroundFile = sParams[1];
}
else if( sValueName=="PREVIEWBG" )
{
out.m_sPreviewBGFile = sParams[1];
}
else if( sValueName=="JACKET" )
{
out.m_sJacketFile = sParams[1];
+1
View File
@@ -222,6 +222,7 @@ static void WriteGlobalTags( RageFile &f, const Song &out )
f.PutLine( ssprintf( "#CREDIT:%s;", SmEscape(out.m_sCredit).c_str() ) );
f.PutLine( ssprintf( "#BANNER:%s;", SmEscape(out.m_sBannerFile).c_str() ) );
f.PutLine( ssprintf( "#BACKGROUND:%s;", SmEscape(out.m_sBackgroundFile).c_str() ) );
f.PutLine( ssprintf( "#PREVIEWBG:%s;", SmEscape(out.m_sPreviewBGFile).c_str() ) );
f.PutLine( ssprintf( "#JACKET:%s;", SmEscape(out.m_sJacketFile).c_str() ) );
f.PutLine( ssprintf( "#CDIMAGE:%s;", SmEscape(out.m_sCDFile).c_str() ) );
f.PutLine( ssprintf( "#DISCIMAGE:%s;", SmEscape(out.m_sDiscFile).c_str() ) );
+21
View File
@@ -1273,6 +1273,10 @@ bool Song::HasCDImage() const
{
return m_sCDFile != "" && IsAFile(GetCDImagePath());
}
bool Song::HasPreviewBG() const
{
return m_sPreviewBGFile != "" && IsAFile(GetPreviewBGPath());
}
const vector<BackgroundChange> &Song::GetBackgroundChanges( BackgroundLayer bl ) const
{
@@ -1406,6 +1410,11 @@ RString Song::GetCDImagePath() const
return GetSongAssetPath( m_sCDFile, m_sSongDir );
}
RString Song::GetPreviewBGPath() const
{
return GetSongAssetPath( m_sPreviewBGFile, m_sSongDir );
}
RString Song::GetDisplayMainTitle() const
{
if(!PREFSMAN->m_bShowNativeLanguage) return GetTranslitMainTitle();
@@ -1698,6 +1707,15 @@ public:
lua_pushnil(L);
return 1;
}
static int GetPreviewBGPath( T* p, lua_State *L )
{
RString s = p->GetPreviewBGPath();
if( !s.empty() )
lua_pushstring(L, s);
else
lua_pushnil(L);
return 1;
}
static int GetJacketPath( T* p, lua_State *L )
{
RString s = p->GetJacketPath();
@@ -1819,6 +1837,7 @@ public:
static int HasMusic( T* p, lua_State *L ) { lua_pushboolean(L, p->HasMusic()); return 1; }
static int HasBanner( T* p, lua_State *L ) { lua_pushboolean(L, p->HasBanner()); return 1; }
static int HasBackground( T* p, lua_State *L ) { lua_pushboolean(L, p->HasBackground()); return 1; }
static int HasPreviewBG( T* p, lua_State *L ) { lua_pushboolean(L, p->HasPreviewBG()); return 1; }
static int HasJacket( T* p, lua_State *L ) { lua_pushboolean(L, p->HasJacket()); return 1; }
static int HasDisc( T* p, lua_State *L ) { lua_pushboolean(L, p->HasDisc()); return 1; }
static int HasCDImage( T* p, lua_State *L ) { lua_pushboolean(L, p->HasCDImage()); return 1; }
@@ -1975,6 +1994,8 @@ public:
ADD_METHOD( IsDisplayBpmConstant );
ADD_METHOD( IsDisplayBpmRandom );
ADD_METHOD( ShowInDemonstrationAndRanking );
ADD_METHOD( HasPreviewBG );
ADD_METHOD( GetPreviewBGPath );
}
};
+3
View File
@@ -238,6 +238,7 @@ public:
RString m_sLyricsFile;
RString m_sBackgroundFile;
RString m_sCDTitleFile;
RString m_sPreviewBGFile;
AttackArray m_Attacks;
vector<RString> m_sAttackString;
@@ -251,6 +252,7 @@ public:
RString GetLyricsPath() const;
RString GetBackgroundPath() const;
RString GetCDTitlePath() const;
RString GetPreviewBGPath() const;
// For loading only:
bool m_bHasMusic, m_bHasBanner, m_bHasBackground;
@@ -273,6 +275,7 @@ public:
bool HasBGChanges() const;
bool HasLyrics() const;
bool HasAttacks() const;
bool HasPreviewBG() const;
bool Matches(RString sGroup, RString sSong) const;