diff --git a/source/smTools/SMFile.hx b/source/smTools/SMFile.hx index bb9ab6b..72111eb 100644 --- a/source/smTools/SMFile.hx +++ b/source/smTools/SMFile.hx @@ -3,6 +3,7 @@ package smTools; import sys.io.File; import haxe.Exception; import lime.app.Application; +import Section.SwagSection; import haxe.Json; class SMFile @@ -168,6 +169,7 @@ class SMFile if (!isDouble) section.mustHitSection = true; + @:privateAccess for(i in 0...measure._measure.length - 1) @@ -184,6 +186,23 @@ class SMFile currentBeat = noteRow / 48; + if (currentBeat % 4 == 0) + { + // ok new section time + song.notes.push(section); + section = { + sectionNotes: [], + lengthInSteps: 16, + typeOfSection: 0, + startTime: 0.0, + endTime: 0.0, + mustHitSection: false, + bpm: header.getBPM(0), + changeBPM: false, + altAnim: false + }; + } + var seg = TimingStruct.getTimingAtBeat(currentBeat); var timeInSec:Float = (seg.startTime + ((currentBeat - seg.startBeat) / (seg.bpm/60))); @@ -264,6 +283,35 @@ class SMFile song.eventObjects = header.changeEvents; } + var newSections = []; + + for(s in 0...song.notes.length) // lets go ahead and make sure each note is actually in their own section haha + { + var sec:SwagSection = { + startTime: song.notes[s].startTime, + endTime: song.notes[s].endTime, + lengthInSteps: 16, + bpm: song.bpm, + changeBPM: false, + mustHitSection: song.notes[s].mustHitSection, + sectionNotes: [], + typeOfSection: 0, + altAnim: song.notes[s].altAnim + }; + for(i in song.notes) + { + for(ii in i.sectionNotes) + { + if (ii[0] >= sec.startTime && ii[0] < sec.endTime) + sec.sectionNotes.push(ii); + } + } + newSections.push(sec); + } + + + song.notes = newSections; + // save da song var json = { diff --git a/source/smTools/SMHeader.hx b/source/smTools/SMHeader.hx index 950da4f..5f0db7b 100644 --- a/source/smTools/SMHeader.hx +++ b/source/smTools/SMHeader.hx @@ -108,4 +108,4 @@ class SMHeader } } } -#end +#end \ No newline at end of file