fix sm charts putting notes in wrong sections
This commit is contained in:
parent
9d9f767af6
commit
0c925f337b
@ -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 = {
|
||||
|
@ -108,4 +108,4 @@ class SMHeader
|
||||
}
|
||||
}
|
||||
}
|
||||
#end
|
||||
#end
|
Loading…
x
Reference in New Issue
Block a user