From ffb726d8a1c95bf5832942db42fed60b10bdbc37 Mon Sep 17 00:00:00 2001 From: Kade M Date: Wed, 7 Jul 2021 15:59:33 -0700 Subject: [PATCH] fix some stuff --- source/ChartingState.hx | 39 +++++++++++++++++++++++++-------------- source/Conductor.hx | 6 ++++++ source/DiffCalc.hx | 9 +++++++-- 3 files changed, 38 insertions(+), 16 deletions(-) diff --git a/source/ChartingState.hx b/source/ChartingState.hx index a1c01d3..0b38c9a 100644 --- a/source/ChartingState.hx +++ b/source/ChartingState.hx @@ -129,7 +129,7 @@ class ChartingState extends MusicBeatState blackBorder.alpha = 0.3; - snapText = new FlxText(60,10,0,"Snap: 1/" + snap + " (Press Control to unsnap the cursor)\nAdd Notes: 1-8 (or click)\nDiff: 0", 14); + snapText = new FlxText(60,10,0,"Snap: 1/" + snap + " (Press SHIFT to unsnap the cursor)\nAdd Notes: 1-8 (or click)\nDiff: 0", 14); snapText.scrollFactor.set(); gridBlackLine = new FlxSprite(gridBG.x + gridBG.width / 2).makeGraphic(2, Std.int(gridBG.height), FlxColor.BLACK); @@ -660,7 +660,7 @@ class ChartingState extends MusicBeatState } var writingNotes:Bool = false; - var doSnapShit:Bool = true; + var doSnapShit:Bool = false; public var diff:Float = 0; @@ -668,7 +668,7 @@ class ChartingState extends MusicBeatState { updateHeads(); - snapText.text = "Song Diff: " + diff + "\nSnap: 1/" + snap + " (" + (doSnapShit ? "Control to disable" : "Snap Disabled, Control to renable") + ")\nAdd Notes: 1-8 (or click)"; + snapText.text = "Snap: 1/" + snap + " (" + (doSnapShit ? "Shift to disable" : "Snap Disabled, Shift to renable. It's a bit buggy") + ")\nAdd Notes: 1-8 (or click)"; curStep = recalculateSteps(); @@ -681,7 +681,7 @@ class ChartingState extends MusicBeatState if (snap <= 1) snap = 1;*/ - if (FlxG.keys.justPressed.CONTROL) + if (FlxG.keys.justPressed.SHIFT) doSnapShit = !doSnapShit; Conductor.songPosition = FlxG.sound.music.time; @@ -961,17 +961,30 @@ class ChartingState extends MusicBeatState vocals.pause(); claps.splice(0, claps.length); - var stepMs = curStep * Conductor.stepCrochet; + var amount = FlxG.mouse.wheel; - - trace(Conductor.stepCrochet / snap); + if(amount > 0 && strumLine.y < gridBG.y) + amount = 0; if (doSnapShit) - FlxG.sound.music.time = stepMs - (FlxG.mouse.wheel * Conductor.stepCrochet / snap); - else - FlxG.sound.music.time -= (FlxG.mouse.wheel * Conductor.stepCrochet * 0.4); - trace(stepMs + " + " + Conductor.stepCrochet / snap + " -> " + FlxG.sound.music.time); + { + var increase:Int = 0; + if (amount < 0) + increase = 1; + else + increase = -1; + + trace(increase + " - " + curStep + " - " + (curStep + increase)); + + curStep += increase; + + var stepMs = curStep * Conductor.stepCrochet; + + FlxG.sound.music.time = stepMs; + } + else + FlxG.sound.music.time -= (amount * Conductor.stepCrochet * 0.4); vocals.time = FlxG.sound.music.time; } @@ -1187,7 +1200,7 @@ class ChartingState extends MusicBeatState function updateGrid():Void { remove(gridBG); - gridBG = FlxGridOverlay.create(GRID_SIZE, GRID_SIZE, GRID_SIZE * 8, GRID_SIZE * _song.notes[curSection].lengthInSteps); + gridBG = FlxGridOverlay.create(GRID_SIZE, GRID_SIZE, GRID_SIZE * 8, GRID_SIZE * 16); add(gridBG); remove(gridBlackLine); @@ -1263,8 +1276,6 @@ class ChartingState extends MusicBeatState } } - if (_song != null) - diff = DiffCalc.CalculateDiff(_song); } private function addSection(lengthInSteps:Int = 16):Void diff --git a/source/Conductor.hx b/source/Conductor.hx index 03847d1..4560078 100644 --- a/source/Conductor.hx +++ b/source/Conductor.hx @@ -28,6 +28,8 @@ class Conductor public static var safeZoneOffset:Float = Math.floor((safeFrames / 60) * 1000); // is calculated in create(), is safeFrames in milliseconds public static var timeScale:Float = Conductor.safeZoneOffset / 166; + public static var lengthInSteps:Float = 0; + public static var bpmChangeMap:Array = []; public function new() @@ -74,5 +76,9 @@ class Conductor crochet = ((60 / bpm) * 1000); stepCrochet = crochet / 4; + + lengthInSteps = (FlxG.sound.music.length / stepCrochet); + + trace("\nLength in in steps: " + lengthInSteps); } } \ No newline at end of file diff --git a/source/DiffCalc.hx b/source/DiffCalc.hx index 5f2d240..8d075e0 100644 --- a/source/DiffCalc.hx +++ b/source/DiffCalc.hx @@ -16,7 +16,6 @@ class SmallNote // basically Note.hx but small as fuck class DiffCalc { - public static var scale = 3 * 1.8; public static function CalculateDiff(song:SwagSong, ?accuracy:Float = .93) @@ -77,6 +76,8 @@ class DiffCalc } } + // collect all of the notes in each col + var leftHandCol:Array = []; // d 0 var leftMHandCol:Array = []; // f 1 var rightMHandCol:Array = []; // j 2 @@ -106,6 +107,8 @@ class DiffCalc var segmentsTwo = new haxe.ds.Vector(Math.floor(length)); + // set em all to array's (so no null's) + for(i in 0...segmentsOne.length) segmentsOne[i] = new Array(); for(i in 0...segmentsTwo.length) @@ -141,6 +144,7 @@ class DiffCalc segmentsTwo[i] = null; }*/ + // get nps for both hands var hand_npsOne:Array = new Array(); var hand_npsTwo:Array = new Array(); @@ -157,7 +161,8 @@ class DiffCalc continue; hand_npsTwo.push(i.length * scale * 1.6); } - + + // get the diff vector's for all of the hands var hand_diffOne:Array = new Array(); var hand_diffTwo:Array = new Array();