diff --git a/Scripts/Data/Chart/Chart.cs b/Scripts/Data/Chart/Chart.cs index 2bcbe79..1629d52 100644 --- a/Scripts/Data/Chart/Chart.cs +++ b/Scripts/Data/Chart/Chart.cs @@ -163,7 +163,7 @@ namespace WacK.Data.Chart curNote = new NotePlay( curTime, mb, chartNote.Item2.position, chartNote.Item2.size, - type: NotePlayType.HoldMid, + type: chartNote.Item2.value == "1" ? NotePlayType.HoldMid : NotePlayType.HoldMidInvis, holdIndex: chartNote.Item2.holdIdx, holdNext: chartNote.Item2.holdNextIdx ); @@ -244,14 +244,14 @@ namespace WacK.Data.Chart { curHoldNote[np.holdIdx].points[curTime] = np; } - else - { + // else + // { if (!playNotes.ContainsKey(curTime)) { playNotes[curTime] = new List(); } playNotes[curTime].Add(np); - } + // } } // NoteEvent -- tempo changes diff --git a/Scripts/Data/Chart/NotePlay.cs b/Scripts/Data/Chart/NotePlay.cs index 4ff1d1f..eb90564 100755 --- a/Scripts/Data/Chart/NotePlay.cs +++ b/Scripts/Data/Chart/NotePlay.cs @@ -7,6 +7,7 @@ namespace WacK.Data.Chart Touch, HoldStart, HoldMid, + HoldMidInvis, HoldEnd, Chain, SnapIn, diff --git a/Scripts/Data/Mer/Mer.cs b/Scripts/Data/Mer/Mer.cs index d60aa10..2138991 100644 --- a/Scripts/Data/Mer/Mer.cs +++ b/Scripts/Data/Mer/Mer.cs @@ -114,8 +114,8 @@ namespace WacK.Data.Mer notes[currentMeasure].Add((currentBeat, new MerNote(int.Parse(tokens[5]), int.Parse(tokens[6]), holdIndex: int.Parse(tokens[4]), holdNext: int.Parse(tokens[8]), type: MerType.HoldStart, bonus: true))); ++playableNoteCount; break; - case "10": // hold middle - notes[currentMeasure].Add((currentBeat, new MerNote(int.Parse(tokens[5]), int.Parse(tokens[6]), holdIndex: int.Parse(tokens[4]), holdNext: int.Parse(tokens[8]), type: MerType.HoldMid))); + case "10": // hold middle; value = should draw? + notes[currentMeasure].Add((currentBeat, new MerNote(int.Parse(tokens[5]), int.Parse(tokens[6]), value: tokens[7],holdIndex: int.Parse(tokens[4]), holdNext: int.Parse(tokens[8]), type: MerType.HoldMid))); break; case "11": // hold end notes[currentMeasure].Add((currentBeat, new MerNote(int.Parse(tokens[5]), int.Parse(tokens[6]), holdIndex: int.Parse(tokens[4]), type: MerType.HoldEnd))); diff --git a/Scripts/Things/TunnelObjects/THNoteHold.cs b/Scripts/Things/TunnelObjects/THNoteHold.cs index 0adb10d..d3da2b4 100644 --- a/Scripts/Things/TunnelObjects/THNoteHold.cs +++ b/Scripts/Things/TunnelObjects/THNoteHold.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using System.Linq; using System.Reflection.Metadata; using Godot; @@ -25,11 +26,23 @@ namespace WacK.Things.TunnelObjects holdScroll.AddChild(longThing); longThing.Position = new Vector2(0, (float)-holdNoteData.time * Play.ScrollPxPerSec); - if (holdNoteData.points.Count > 0) + // only draw visible hold-mids + var drawableMids = holdNoteData.points.Values.Where(e => e.type == NotePlayType.HoldMid).ToList(); + if (drawableMids.Count > 0) + { + var lastMid = holdNoteData.points.Values[^1]; + if (drawableMids[^1] != lastMid) drawableMids.Add(lastMid); + } + else + { + drawableMids = holdNoteData.points.Values.ToList(); + } + + if (drawableMids.Count() > 0) { NotePlay lastHold = holdNoteData; float segmentPos = 0; - foreach (var (_, curNote) in holdNoteData.points) + foreach (var curNote in drawableMids) { var curLength = Play.ScrollPxPerSec * (float)(curNote.time - lastHold.time); var segment = CreateSegment(lastHold, curNote); @@ -42,7 +55,7 @@ namespace WacK.Things.TunnelObjects } else { - GD.PrintErr("Tried to create a long note with no segments!"); + GD.PrintErr("Tried to create a Hold note's long with no drawable segments!"); } }