make snap work and add skipping sections

This commit is contained in:
KadeDeveloper 2021-08-07 23:25:05 -07:00
parent b2bed6bcf0
commit bc623721b1

View File

@ -1282,6 +1282,24 @@ class ChartingState extends MusicBeatState
var tab_group_note:FlxUI; var tab_group_note:FlxUI;
function goToSection(section:Int)
{
var beat = section * 4;
var data = TimingStruct.getTimingAtBeat(beat);
if (data == null)
return;
FlxG.sound.music.time = (beat / (data.bpm / 60)) * 1000;
curSection = section;
trace("Going too " + FlxG.sound.music.time + " | " + section + " | Which is at " + beat);
if (FlxG.sound.music.time < 0)
FlxG.sound.music.time = 0;
else if (FlxG.sound.music.time > FlxG.sound.music.length)
FlxG.sound.music.time = FlxG.sound.music.length;
}
function addNoteUI():Void function addNoteUI():Void
{ {
tab_group_note = new FlxUI(null, UI_box); tab_group_note = new FlxUI(null, UI_box);
@ -1634,10 +1652,17 @@ class ChartingState extends MusicBeatState
FlxG.sound.music.time = (data.startTime + ((beats - data.startBeat) / (bpm/60)) ) * 1000; FlxG.sound.music.time = (data.startTime + ((beats - data.startBeat) / (bpm/60)) ) * 1000;
} }
} }
else
FlxG.sound.music.time -= (FlxG.mouse.wheel * Conductor.stepCrochet * 0.4);
if (!PlayState.isSM) if (!PlayState.isSM)
vocals.time = FlxG.sound.music.time; vocals.time = FlxG.sound.music.time;
} }
} }
if (FlxG.keys.justPressed.RIGHT)
goToSection(curSection + 1);
else if (FlxG.keys.justPressed.LEFT)
goToSection(curSection - 1);
} }
if (updateFrame == 4) if (updateFrame == 4)
@ -1677,21 +1702,21 @@ class ChartingState extends MusicBeatState
else if (updateFrame != 5) else if (updateFrame != 5)
updateFrame++; updateFrame++;
snapText.text = "Snap: 1/" + snap + " (" + (doSnapShit ? "Shift to disable, Left or Right to increase/decrease" : "Snap Disabled, Shift to renable.") + ")\nAdd Notes: 1-8 (or click)\nZoom: " + zoomFactor; snapText.text = "Snap: 1/" + snap + " (" + (doSnapShit ? "Shift to disable, CTRL Left or Right to increase/decrease" : "Snap Disabled, Shift to renable.") + ")\nAdd Notes: 1-8 (or click)\nZoom: " + zoomFactor;
if (FlxG.keys.justPressed.RIGHT) if (FlxG.keys.justPressed.RIGHT && FlxG.keys.pressed.CONTROL)
snap = snap * 2; snap = snap * 2;
if (FlxG.keys.justPressed.LEFT) if (FlxG.keys.justPressed.LEFT && FlxG.keys.pressed.CONTROL)
snap = Math.round(snap / 2); snap = Math.round(snap / 2);
if (snap >= 64) if (snap >= 64)
snap = 64; snap = 64;
if (snap <= 4) if (snap <= 4)
snap = 4; snap = 4;
/*
if (FlxG.keys.justPressed.SHIFT) if (FlxG.keys.justPressed.SHIFT)
doSnapShit = !doSnapShit; doSnapShit = !doSnapShit;
*/
doSnapShit = defaultSnap; doSnapShit = defaultSnap;
if (FlxG.keys.pressed.SHIFT) if (FlxG.keys.pressed.SHIFT)