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.