From a353e659d02b23569efa9b698d7fbdadbd60483b Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Fri, 10 Feb 2012 19:49:53 -0500 Subject: [PATCH] [editorKeysounds] Can add KS, but... 1) A physical note is shown in the editor. We do need a separate graphic for auto keysounds. 2) The keysound only plays if you "hit" the note. Auto keysound notes should play regardless of hit or miss. Time to make this branch public. Anyone want to help tackle this? --- Themes/_fallback/Languages/en.ini | 1 + src/ScreenEdit.cpp | 48 ++++++++++++++++++++++--------- 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/Themes/_fallback/Languages/en.ini b/Themes/_fallback/Languages/en.ini index fc2fabdeff..e6a6e1230d 100644 --- a/Themes/_fallback/Languages/en.ini +++ b/Themes/_fallback/Languages/en.ini @@ -1373,6 +1373,7 @@ Routine Player=Player Track %d=Track %d None=None New Sound=New Sound +Enter New Keysound File=Enter the name of the new keysound file.\nPlease make sure it is spelt right. [ScreenEditMenu] HeaderText=Edit Song/Steps diff --git a/src/ScreenEdit.cpp b/src/ScreenEdit.cpp index 87de3d60df..3cc997d143 100644 --- a/src/ScreenEdit.cpp +++ b/src/ScreenEdit.cpp @@ -75,6 +75,7 @@ AutoScreenMessage( SM_BackFromInsertCourseAttack ); AutoScreenMessage( SM_BackFromInsertCourseAttackPlayerOptions ); AutoScreenMessage( SM_BackFromCourseModeMenu ); AutoScreenMessage( SM_BackFromKeysoundTrack ); +AutoScreenMessage( SM_BackFromNewKeysound ); AutoScreenMessage( SM_DoRevertToLastSave ); AutoScreenMessage( SM_DoRevertFromDisk ); AutoScreenMessage( SM_BackFromTimingDataInformation ); @@ -2934,6 +2935,8 @@ void ScreenEdit::ScrollTo( float fDestinationBeat ) m_soundChangeLine.Play(); } +static LocalizedString NEW_KEYSOUND_FILE("ScreenEdit", "Enter New Keysound File"); + void ScreenEdit::HandleMessage( const Message &msg ) { if( msg == "Judgment" ) @@ -3188,31 +3191,33 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM ) { unsigned int sound = ScreenMiniMenu::s_viLastAnswers[track]; vector &kses = m_pSong->m_vsKeysoundFile; + if (sound == kses.size()) + { + // create a new sound (filename), point it. + // if it's empty, make it an auto keysound. + ScreenTextEntry::TextEntry(SM_BackFromNewKeysound, NEW_KEYSOUND_FILE, "", 64); + return; + } const TapNote &oldNote = m_NoteDataEdit.GetTapNote(track, row); - TapNote newNote = oldNote; + TapNote newNote = oldNote; // need to lose the const. not feeling like casting. if (sound < kses.size()) { // set note at this row to use this keysound file. // if it's empty, make it an auto keysound. newNote.iKeysoundIndex = sound; - } - else if (sound == kses.size()) - { - // create a new sound (filename), point it. - // if it's empty, make it an auto keysound. + if (newNote.type == TapNote::empty) + { + newNote.type = TapNote::autoKeysound; // keysounds need something non empty. + } } else // sound > kses.size() { // remove the sound. if it's an auto keysound, make it empty. newNote.iKeysoundIndex = -1; - } - if (newNote.type == TapNote::autoKeysound && newNote.iKeysoundIndex == -1) - { - newNote.type = TapNote::empty; // autoKeysound with no sound is pointless. - } - else if (newNote.type == TapNote::empty && newNote.iKeysoundIndex != -1) - { - newNote.type = TapNote::autoKeysound; // keysounds need something non empty. + if (newNote.type == TapNote::autoKeysound) + { + newNote.type = TapNote::empty; // autoKeysound with no sound is pointless. + } } m_NoteDataEdit.SetTapNote(track, row, newNote); } @@ -3222,6 +3227,21 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM ) } SetDirty(true); } + else if (SM == SM_BackFromNewKeysound && !ScreenTextEntry::s_bCancelledLast) + { + RString answer = ScreenTextEntry::s_sLastAnswer; + const int track = ScreenMiniMenu::s_iLastRowCode; // still keeps the same value. + const int row = this->GetRow(); + const TapNote &oldNote = m_NoteDataEdit.GetTapNote(track, row); + TapNote newNote = oldNote; // need to lose the const. not feeling like casting. + vector &kses = m_pSong->m_vsKeysoundFile; + newNote.iKeysoundIndex = kses.size(); + kses.push_back(answer); + if (newNote.type == TapNote::empty) + newNote.type = TapNote::autoKeysound; // keysounds need something non empty. + m_NoteDataEdit.SetTapNote(track, row, newNote); + SetDirty(true); + } else if( SM == SM_BackFromOptions ) { // The options may have changed the note skin.