diff --git a/Themes/_fallback/Languages/en.ini b/Themes/_fallback/Languages/en.ini index 472690cd56..505e6582ca 100644 --- a/Themes/_fallback/Languages/en.ini +++ b/Themes/_fallback/Languages/en.ini @@ -817,6 +817,7 @@ CoinsPerCredit=Coins Per Credit Connection=Connection Convert pause to beats=Convert stop to beats Convert delay to beats=Convert delay to beats +Convert selection to attack=Convert selection to Attack Convert selection to pause=Convert selection to stop Convert selection to delay=Convert selection to delay Convert selection to warp=Convert selection to Warp Segment diff --git a/src/ScreenEdit.cpp b/src/ScreenEdit.cpp index 16176e75b9..c9f872448a 100644 --- a/src/ScreenEdit.cpp +++ b/src/ScreenEdit.cpp @@ -571,6 +571,8 @@ static MenuDef g_AlterMenu( EditMode_Full, true, true, 0, NULL ), MenuRowDef(ScreenEdit::convert_to_fake, "Convert selection to fake", true, EditMode_Full, true, true, 0, NULL ), + MenuRowDef(ScreenEdit::convert_to_attack, "Convert selection to attack", true, + EditMode_Full, true, true, 0, NULL), MenuRowDef(ScreenEdit::routine_invert_notes, "Invert notes' player", true, EditMode_Full, true, true, 0, NULL ), MenuRowDef(ScreenEdit::routine_mirror_1_to_2, "Mirror Player 1 to 2", true, @@ -4114,6 +4116,29 @@ void ScreenEdit::HandleAlterMenuChoice(AlterMenuChoice c, const vector &iAn SetDirty(true); break; } + case convert_to_attack: + { + float startBeat = NoteRowToBeat(m_NoteFieldEdit.m_iBeginMarker); + float endBeat = NoteRowToBeat(m_NoteFieldEdit.m_iEndMarker); + TimingData &timing = GetAppropriateTiming(); + float &start = g_fLastInsertAttackPositionSeconds; + float &length = g_fLastInsertAttackDurationSeconds; + start = timing.GetElapsedTimeFromBeat(startBeat); + length = timing.GetElapsedTimeFromBeat(endBeat) - start; + + AttackArray &attacks = GAMESTATE->m_bIsUsingStepTiming ? + m_pSteps->m_Attacks : m_pSong->m_Attacks; + int iAttack = FindAttackAtTime(attacks, start); + + PlayerOptions po; + if (iAttack >= 0) + po.FromString(attacks[iAttack].sModifiers); + + GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.Assign( ModsLevel_Preferred, po ); + SCREENMAN->AddNewScreenToTop( "ScreenPlayerOptions", SM_BackFromInsertStepAttackPlayerOptions ); + SetDirty(true); + break; + } case convert_to_fake: { float startBeat = NoteRowToBeat(m_NoteFieldEdit.m_iBeginMarker); diff --git a/src/ScreenEdit.h b/src/ScreenEdit.h index c8b8fa6854..5df94954ce 100644 --- a/src/ScreenEdit.h +++ b/src/ScreenEdit.h @@ -409,6 +409,7 @@ public: convert_to_delay, /**< Convert the range into a DelaySegment. */ convert_to_warp, /**< Convert the range into a WarpSegment. */ convert_to_fake, /**< Convert the range into a FakeSegment. */ + convert_to_attack, /**< Convert the range into an Attack. */ routine_invert_notes, /**< Switch which player hits the note. */ routine_mirror_1_to_2, /**< Mirror Player 1's notes for Player 2. */ routine_mirror_2_to_1, /**< Mirror Player 2's notes for Player 1. */