From a6e74da707b7adf339a2ce5c43faf27e8cc7fe91 Mon Sep 17 00:00:00 2001 From: Jared Roberts Date: Mon, 16 Sep 2002 05:49:46 +0000 Subject: [PATCH] Added #TRANSLITERATION tag, and made it preferred over the full title when sorting. Also noticed that a lot of string copying is done during the ABC sort (and it's call to GetFullTitle)-- optimizing this away may make in-between songs go much faster... --- stepmania/NEWS | 3 +++ stepmania/src/MusicWheel.h | 5 +++-- stepmania/src/NotesLoaderSM.cpp | 3 +++ stepmania/src/Song.cpp | 9 ++++++++- stepmania/src/song.h | 2 ++ 5 files changed, 19 insertions(+), 3 deletions(-) diff --git a/stepmania/NEWS b/stepmania/NEWS index d98e7ebbd6..74d7267c61 100644 --- a/stepmania/NEWS +++ b/stepmania/NEWS @@ -1,4 +1,7 @@ ------------------------CVS after 3.00 beta 6---------------- +NEW FEATURE: #TRANSLITERATION tag-- this is used in sorting + so songs like sana & matsuri can go in the proper alphabetic group, + but still be displayed in their proper language (once we support that) NEW FEATURE: DWI tree loading via "DWIPath". NEW FEATURE: Pump couples support. BUG FIX: Editor no longer crashes if you try to drag a hold note up diff --git a/stepmania/src/MusicWheel.h b/stepmania/src/MusicWheel.h index 83b12a6de1..4cca386e1e 100644 --- a/stepmania/src/MusicWheel.h +++ b/stepmania/src/MusicWheel.h @@ -188,8 +188,9 @@ protected: // if( IsAnInt(sTemp) ) // sTemp = "NUM"; // return sTemp; - case SORT_TITLE: - sTemp = pSong->GetFullTitle(); + case SORT_TITLE: + sTemp = pSong->GetTransliteration(); + if(sTemp.IsEmpty()) sTemp = pSong->GetFullTitle(); sTemp.MakeUpper(); sTemp = (sTemp.GetLength() > 0) ? sTemp.Left(1) : ""; if( IsAnInt(sTemp) ) diff --git a/stepmania/src/NotesLoaderSM.cpp b/stepmania/src/NotesLoaderSM.cpp index 39c7596a9a..ea3eb4facb 100644 --- a/stepmania/src/NotesLoaderSM.cpp +++ b/stepmania/src/NotesLoaderSM.cpp @@ -74,6 +74,9 @@ bool SMLoader::LoadFromSMFile( CString sPath, Song &out ) else if( 0==stricmp(sValueName,"SUBTITLE") ) out.m_sSubTitle = sParams[1]; + else if( 0==stricmp(sValueName,"TRANSLITERATION") ) + out.m_sTransliteration = sParams[1]; + else if( 0==stricmp(sValueName,"ARTIST") ) out.m_sArtist = sParams[1]; diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index c04ed9ca52..4454dc32a0 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -627,6 +627,7 @@ void Song::SaveToSMFile( CString sPath, bool bSavingCache ) fprintf( fp, "#TITLE:%s;\n", m_sMainTitle ); fprintf( fp, "#SUBTITLE:%s;\n", m_sSubTitle ); + fprintf( fp, "#TRANSLITERATION:%s;\n", m_sTransliteration ); fprintf( fp, "#ARTIST:%s;\n", m_sArtist ); fprintf( fp, "#CREDIT:%s;\n", m_sCredit ); fprintf( fp, "#BANNER:%s;\n", m_sBannerFile ); @@ -797,7 +798,13 @@ int CompareSongPointersByTitle(const void *arg1, const void *arg2) const Song* pSong1 = *(const Song**)arg1; const Song* pSong2 = *(const Song**)arg2; - int ret = pSong1->GetFullTitle().CompareNoCase(pSong2->GetFullTitle()); + //Prefer transliterations to full titles + CString sTitle1 = pSong1->GetTransliteration(); + CString sTitle2 = pSong2->GetTransliteration(); + if(sTitle1.IsEmpty()) sTitle1 = pSong1->GetFullTitle(); + if(sTitle2.IsEmpty()) sTitle2 = pSong2->GetFullTitle(); + + int ret = sTitle1.CompareNoCase(sTitle2); if(ret != 0) return ret; /* The titles are the same. Ensure we get a consistent ordering diff --git a/stepmania/src/song.h b/stepmania/src/song.h index 69150f10f1..7b957abb77 100644 --- a/stepmania/src/song.h +++ b/stepmania/src/song.h @@ -89,10 +89,12 @@ public: CString m_sMainTitle; CString m_sSubTitle; + CString m_sTransliteration; CString m_sArtist; CString m_sCredit; CString GetFullTitle() const { return m_sMainTitle + (m_sSubTitle.GetLength()? (" " + m_sSubTitle):""); } + CString GetTransliteration() const { return m_sTransliteration; } CString m_sMusicFile; DWORD m_iMusicBytes;