fix sm charts putting notes in wrong sections

This commit is contained in:
KadeDeveloper 2021-08-11 16:10:51 -07:00
parent 9d9f767af6
commit 0c925f337b
2 changed files with 49 additions and 1 deletions

View File

@ -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
@ -169,6 +170,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 = {