Merge pull request #603 from Aikoyori/kademan

added note shifting im sure its a useful feature
This commit is contained in:
Kade M 2021-05-27 21:43:35 -07:00 committed by GitHub
commit 99c602254e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -284,7 +284,7 @@ class ChartingState extends MusicBeatState
stepperSongVol.name = 'song_instvol';
var hitsounds = new FlxUICheckBox(10, stepperSongVol.y + 35, null, null, "Play hitsounds", 100);
var hitsounds = new FlxUICheckBox(10, stepperSongVol.y + 60, null, null, "Play hitsounds", 100);
hitsounds.checked = false;
hitsounds.callback = function()
{
@ -293,6 +293,22 @@ class ChartingState extends MusicBeatState
var stepperSongVolLabel = new FlxText(74, 110, 'Instrumental Volume');
var shiftNoteDialLabel = new FlxText(10, 245, 'Shift Note FWD by (Section)');
var stepperShiftNoteDial:FlxUINumericStepper = new FlxUINumericStepper(10, 260, 1, 0, -1000, 1000, 0);
stepperShiftNoteDial.name = 'song_shiftnote';
var shiftNoteDialLabel2 = new FlxText(10, 275, 'Shift Note FWD by (Step)');
var stepperShiftNoteDialstep:FlxUINumericStepper = new FlxUINumericStepper(10, 290, 1, 0, -1000, 1000, 0);
stepperShiftNoteDialstep.name = 'song_shiftnotems';
var shiftNoteDialLabel3 = new FlxText(10, 305, 'Shift Note FWD by (ms)');
var stepperShiftNoteDialms:FlxUINumericStepper = new FlxUINumericStepper(10, 320, 1, 0, -1000, 1000, 2);
stepperShiftNoteDialms.name = 'song_shiftnotems';
var shiftNoteButton:FlxButton = new FlxButton(10, 335, "Shift", function()
{
shiftNotes(Std.int(stepperShiftNoteDial.value),Std.int(stepperShiftNoteDialstep.value),Std.int(stepperShiftNoteDialms.value));
});
var characters:Array<String> = CoolUtil.coolTextFile(Paths.txt('characterList'));
var gfVersions:Array<String> = CoolUtil.coolTextFile(Paths.txt('gfVersionList'));
var stages:Array<String> = CoolUtil.coolTextFile(Paths.txt('stageList'));
@ -356,6 +372,13 @@ class ChartingState extends MusicBeatState
tab_group_song.add(stepperVocalVolLabel);
tab_group_song.add(stepperSongVol);
tab_group_song.add(stepperSongVolLabel);
tab_group_song.add(shiftNoteDialLabel);
tab_group_song.add(stepperShiftNoteDial);
tab_group_song.add(shiftNoteDialLabel2);
tab_group_song.add(stepperShiftNoteDialstep);
tab_group_song.add(shiftNoteDialLabel3);
tab_group_song.add(stepperShiftNoteDialms);
tab_group_song.add(shiftNoteButton);
tab_group_song.add(hitsounds);
var tab_group_assets = new FlxUI(null, UI_box);
@ -1278,6 +1301,64 @@ class ChartingState extends MusicBeatState
updateGrid();
}
private function newSection(lengthInSteps:Int = 16):SwagSection
{
var sec:SwagSection = {
lengthInSteps: lengthInSteps,
bpm: _song.bpm,
changeBPM: false,
mustHitSection: true,
sectionNotes: [],
typeOfSection: 0,
altAnim: false
};
return sec;
}
function shiftNotes(measure:Int=0,step:Int=0,ms:Int = 0):Void
{
var newSong = [];
var millisecadd = (((measure*4)+step/4)*(60000/_song.bpm))+ms;
if(millisecadd > 0)
{
for(i in 0...Std.int((measure/16+step+(ms/(60000/_song.bpm)*16))))
{
newSong.unshift(newSection());
}
}
for (daSection1 in 0..._song.notes.length)
{
newSong.push(newSection());
}
for (daSection in 0...(_song.notes.length))
{
//trace("section "+daSection);
for(daNote in 0...(_song.notes[daSection].sectionNotes.length))
{
//trace("note #"+daNote+" with data "+_song.notes[daSection].sectionNotes[daNote]);
var newtiming = _song.notes[daSection].sectionNotes[daNote][0]+millisecadd;
//trace("newtiming",newtiming);
//trace("future section",futureSection);
if(newtiming<0)
{
newtiming = 0;
}
var futureSection = Math.floor(newtiming/4/(60000/_song.bpm));
_song.notes[daSection].sectionNotes[daNote][0] = newtiming;
newSong[futureSection].sectionNotes.push(_song.notes[daSection].sectionNotes[daNote]);
//newSong.notes[daSection].sectionNotes.remove(_song.notes[daSection].sectionNotes[daNote]);
}
}
//trace("DONE BITCH");
_song.notes = newSong;
updateGrid();
updateNoteUI();
}
private function addNote(?n:Note):Void
{
var noteStrum = getStrumTime(dummyArrow.y) + sectionStartTime();