Fixed issues around deleting the final 2 segments of a hold.

This commit is contained in:
Goatgarien
2023-02-05 23:15:48 -08:00
parent a6be9e759a
commit 84a1248234
2 changed files with 46 additions and 5 deletions
+30
View File
@@ -1732,7 +1732,26 @@ namespace BAKKA_Editor
int delIndex = selectedNoteIndex;
NoteOperation op = chart.Notes[selectedNoteIndex].IsHold ? new RemoveHoldNote(chart, chart.Notes[selectedNoteIndex]) : new RemoveNote(chart, chart.Notes[selectedNoteIndex]);
NoteOperation op2 = null;
if (chart.Notes[selectedNoteIndex].NoteType == NoteType.HoldStartBonusFlair || chart.Notes[selectedNoteIndex].NoteType == NoteType.HoldStartNoBonus)
{
if(chart.Notes[selectedNoteIndex].NextNote.NoteType == NoteType.HoldEnd)
{
op2 = new RemoveHoldNote(chart, chart.Notes[selectedNoteIndex].NextNote);
}
}
if (chart.Notes[selectedNoteIndex].NoteType == NoteType.HoldEnd)
{
if (chart.Notes[selectedNoteIndex].PrevNote.NoteType == NoteType.HoldStartBonusFlair || chart.Notes[selectedNoteIndex].PrevNote.NoteType == NoteType.HoldStartNoBonus)
{
op2 = new RemoveHoldNote(chart, chart.Notes[selectedNoteIndex].PrevNote);
}
}
opManager.InvokeAndPush(op);
if (op2 != null)
{
opManager.InvokeAndPush(op2);
}
UpdateControlsFromOperation(op, OperationDirection.Redo);
if (selectedNoteIndex == delIndex)
{
@@ -1853,6 +1872,17 @@ namespace BAKKA_Editor
if (op != null)
{
UpdateControlsFromOperation(op, OperationDirection.Undo);
if (op.GetType() == typeof(RemoveHoldNote))
{
foreach (var note in chart.Notes)
{
if (note.IsHold && note.NextNote == null && note.PrevNote == null)
{
undoToolStripMenuItem_Click(sender, e);
return;
}
}
}
}
}
}
+16 -5
View File
@@ -148,7 +148,8 @@ namespace BAKKA_Editor.Operations
if (nextNote != null)
{
nextNote.PrevNote = null;
nextNote.NoteType = Note.NoteType;
if (nextNote.NoteType == NoteType.HoldJoint)
nextNote.NoteType = Note.NoteType;
}
break;
case NoteType.HoldJoint:
@@ -157,8 +158,11 @@ namespace BAKKA_Editor.Operations
nextNote.PrevNote = prevNote;
break;
case NoteType.HoldEnd:
prevNote.NextNote = null;
prevNote.NoteType = NoteType.HoldEnd;
if (prevNote != null)
{
prevNote.NextNote = null;
prevNote.NoteType = NoteType.HoldEnd;
}
break;
default:
break;
@@ -184,13 +188,20 @@ namespace BAKKA_Editor.Operations
nextNote.PrevNote = Note;
break;
case NoteType.HoldEnd:
prevNote.NextNote = Note;
prevNote.NoteType = prevNoteType;
if (prevNote != null)
{
prevNote.NextNote = Note;
prevNote.NoteType = prevNoteType;
}
break;
default:
break;
}
Chart.Notes.Add(Note);
if (nextNote == null && prevNote == null)
{
//popAgain = true;
}
}
}
}