Merge branch 'KadeDev:master' into master

This commit is contained in:
CyndaquilDAC 2021-07-07 19:36:43 -05:00 committed by GitHub
commit 49dd9e0914
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 68 additions and 17 deletions

View File

@ -129,7 +129,7 @@ class ChartingState extends MusicBeatState
blackBorder.alpha = 0.3; 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(); snapText.scrollFactor.set();
gridBlackLine = new FlxSprite(gridBG.x + gridBG.width / 2).makeGraphic(2, Std.int(gridBG.height), FlxColor.BLACK); 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 writingNotes:Bool = false;
var doSnapShit:Bool = true; var doSnapShit:Bool = false;
public var diff:Float = 0; public var diff:Float = 0;
@ -668,7 +668,7 @@ class ChartingState extends MusicBeatState
{ {
updateHeads(); 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(); curStep = recalculateSteps();
@ -681,7 +681,7 @@ class ChartingState extends MusicBeatState
if (snap <= 1) if (snap <= 1)
snap = 1;*/ snap = 1;*/
if (FlxG.keys.justPressed.CONTROL) if (FlxG.keys.justPressed.SHIFT)
doSnapShit = !doSnapShit; doSnapShit = !doSnapShit;
Conductor.songPosition = FlxG.sound.music.time; Conductor.songPosition = FlxG.sound.music.time;
@ -961,17 +961,30 @@ class ChartingState extends MusicBeatState
vocals.pause(); vocals.pause();
claps.splice(0, claps.length); claps.splice(0, claps.length);
var stepMs = curStep * Conductor.stepCrochet; var amount = FlxG.mouse.wheel;
if(amount > 0 && strumLine.y < gridBG.y)
trace(Conductor.stepCrochet / snap); amount = 0;
if (doSnapShit) if (doSnapShit)
FlxG.sound.music.time = stepMs - (FlxG.mouse.wheel * Conductor.stepCrochet / snap); {
else var increase:Int = 0;
FlxG.sound.music.time -= (FlxG.mouse.wheel * Conductor.stepCrochet * 0.4);
trace(stepMs + " + " + Conductor.stepCrochet / snap + " -> " + FlxG.sound.music.time);
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; vocals.time = FlxG.sound.music.time;
} }
@ -1187,7 +1200,7 @@ class ChartingState extends MusicBeatState
function updateGrid():Void function updateGrid():Void
{ {
remove(gridBG); 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); add(gridBG);
remove(gridBlackLine); remove(gridBlackLine);
@ -1263,8 +1276,6 @@ class ChartingState extends MusicBeatState
} }
} }
if (_song != null)
diff = DiffCalc.CalculateDiff(_song);
} }
private function addSection(lengthInSteps:Int = 16):Void private function addSection(lengthInSteps:Int = 16):Void
@ -1493,7 +1504,7 @@ class ChartingState extends MusicBeatState
"song": _song "song": _song
}; };
var data:String = Json.stringify(json); var data:String = Json.stringify(json,null," ");
if ((data != null) && (data.length > 0)) if ((data != null) && (data.length > 0))
{ {

View File

@ -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 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 timeScale:Float = Conductor.safeZoneOffset / 166;
public static var lengthInSteps:Float = 0;
public static var bpmChangeMap:Array<BPMChangeEvent> = []; public static var bpmChangeMap:Array<BPMChangeEvent> = [];
public function new() public function new()
@ -74,5 +76,9 @@ class Conductor
crochet = ((60 / bpm) * 1000); crochet = ((60 / bpm) * 1000);
stepCrochet = crochet / 4; stepCrochet = crochet / 4;
lengthInSteps = (FlxG.sound.music.length / stepCrochet);
trace("\nLength in in steps: " + lengthInSteps);
} }
} }

View File

@ -16,7 +16,6 @@ class SmallNote // basically Note.hx but small as fuck
class DiffCalc class DiffCalc
{ {
public static var scale = 3 * 1.8; public static var scale = 3 * 1.8;
public static function CalculateDiff(song:SwagSong, ?accuracy:Float = .93) 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<Float> = []; // d 0 var leftHandCol:Array<Float> = []; // d 0
var leftMHandCol:Array<Float> = []; // f 1 var leftMHandCol:Array<Float> = []; // f 1
var rightMHandCol:Array<Float> = []; // j 2 var rightMHandCol:Array<Float> = []; // j 2
@ -106,6 +107,8 @@ class DiffCalc
var segmentsTwo = new haxe.ds.Vector(Math.floor(length)); 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) for(i in 0...segmentsOne.length)
segmentsOne[i] = new Array<SmallNote>(); segmentsOne[i] = new Array<SmallNote>();
for(i in 0...segmentsTwo.length) for(i in 0...segmentsTwo.length)
@ -141,6 +144,7 @@ class DiffCalc
segmentsTwo[i] = null; segmentsTwo[i] = null;
}*/ }*/
// get nps for both hands
var hand_npsOne:Array<Float> = new Array<Float>(); var hand_npsOne:Array<Float> = new Array<Float>();
var hand_npsTwo:Array<Float> = new Array<Float>(); var hand_npsTwo:Array<Float> = new Array<Float>();
@ -158,6 +162,7 @@ class DiffCalc
hand_npsTwo.push(i.length * scale * 1.6); hand_npsTwo.push(i.length * scale * 1.6);
} }
// get the diff vector's for all of the hands
var hand_diffOne:Array<Float> = new Array<Float>(); var hand_diffOne:Array<Float> = new Array<Float>();
var hand_diffTwo:Array<Float> = new Array<Float>(); var hand_diffTwo:Array<Float> = new Array<Float>();

View File

@ -1460,14 +1460,43 @@ class PlayState extends MusicBeatState
if (dataNotes.length != 0) if (dataNotes.length != 0)
{ {
var coolNote = dataNotes[0]; var coolNote = dataNotes[0];
if (dataNotes.length > 1) // stacked notes or really close ones
{
for(i in 0...dataNotes.length)
{
if (i == 0) // skip the first note
continue;
var note = dataNotes[i];
if (!note.isSustainNote && (note.strumTime - coolNote.strumTime) < 2)
{
trace('found a stacked/really close note ' + (note.strumTime - coolNote.strumTime));
// just fuckin remove it since it's a stacked note and shouldn't be there
note.kill();
notes.remove(note, true);
note.destroy();
}
}
}
goodNoteHit(coolNote); goodNoteHit(coolNote);
var noteDiff:Float = -(coolNote.strumTime - Conductor.songPosition); var noteDiff:Float = -(coolNote.strumTime - Conductor.songPosition);
ana.hit = true; ana.hit = true;
ana.hitJudge = Ratings.CalculateRating(noteDiff, Math.floor((PlayStateChangeables.safeFrames / 60) * 1000)); ana.hitJudge = Ratings.CalculateRating(noteDiff, Math.floor((PlayStateChangeables.safeFrames / 60) * 1000));
ana.nearestNote = [coolNote.strumTime,coolNote.noteData,coolNote.sustainLength]; ana.nearestNote = [coolNote.strumTime,coolNote.noteData,coolNote.sustainLength];
} }
else if (!FlxG.save.data.ghost)
{
noteMiss(data,null);
ana.hit = false;
ana.hitJudge = "shit";
ana.nearestNote = [];
}
} }