diff calc adjustments + stolen assets from fps plus
This commit is contained in:
@ -32,51 +32,99 @@ class DiffCalc
|
||||
gottaHitNote = !i.mustHitSection;
|
||||
|
||||
if (gottaHitNote)
|
||||
cleanedNotes.push(new SmallNote(ii[0],ii[1]));
|
||||
cleanedNotes.push(new SmallNote(ii[0],Math.floor(Math.abs(ii[1]))));
|
||||
}
|
||||
}
|
||||
|
||||
var handOne:Array<SmallNote> = [];
|
||||
var handTwo:Array<SmallNote> = [];
|
||||
|
||||
cleanedNotes.sort((a, b) -> Std.int(a.strumTime - b.strumTime));
|
||||
|
||||
var firstNoteTime = cleanedNotes[0].strumTime;
|
||||
|
||||
// normalize the notes
|
||||
|
||||
for(i in cleanedNotes)
|
||||
{
|
||||
i.strumTime = (i.strumTime - firstNoteTime) * 2;
|
||||
}
|
||||
|
||||
for (i in cleanedNotes)
|
||||
{
|
||||
switch(i.noteData)
|
||||
{
|
||||
case 0:
|
||||
handOne.push(i);
|
||||
case 1:
|
||||
handTwo.push(i);
|
||||
case 2:
|
||||
handTwo.push(i);
|
||||
case 3:
|
||||
handOne.push(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// length in segments of the song
|
||||
var length = ((cleanedNotes[cleanedNotes.length - 1].strumTime / 1000) / 0.5);
|
||||
|
||||
// hackey way of creating a array with a length
|
||||
var segments:Array<Int> = new_Array(1,Std.int(length));
|
||||
|
||||
var segmentsOne:Array<Int> = new_Array(1,Std.int(length));
|
||||
var segmentsTwo:Array<Int> = new_Array(1,Std.int(length));
|
||||
|
||||
// algo loop
|
||||
for(i in cleanedNotes)
|
||||
for(i in handOne)
|
||||
{
|
||||
var index = Std.int(((i.strumTime / 1000)));
|
||||
if (index + 1 > segments.length)
|
||||
if (index + 1 > segmentsOne.length)
|
||||
continue;
|
||||
segments[index] = segments[index] + 1;
|
||||
segmentsOne[index] = segmentsOne[index] + 1;
|
||||
}
|
||||
|
||||
for(i in handTwo)
|
||||
{
|
||||
var index = Std.int(((i.strumTime / 1000)));
|
||||
if (index + 1 > segmentsTwo.length)
|
||||
continue;
|
||||
segmentsTwo[index] = segmentsTwo[index] + 1;
|
||||
}
|
||||
|
||||
// get the average of all of the segments
|
||||
var sum:Float = 0;
|
||||
var sumOne:Float = 0;
|
||||
var sumTwo:Float = 0;
|
||||
|
||||
var newLength = segments.length;
|
||||
|
||||
for (i in segments)
|
||||
var lone = segmentsOne.length;
|
||||
var ltwo = segmentsOne.length;
|
||||
|
||||
for (i in segmentsOne)
|
||||
{
|
||||
if (i == 0) // remove empty/breaks
|
||||
{
|
||||
newLength--;
|
||||
lone--;
|
||||
continue;
|
||||
}
|
||||
//trace(i);
|
||||
sum += i / .5; // half it because otherwise instead of nps its just fucking notes per half second which is dumb and stupid
|
||||
sumOne += i / .5; // half it because otherwise instead of nps its just fucking notes per half second which is dumb and stupid
|
||||
}
|
||||
return HelperFunctions.truncateFloat(sum / newLength,2);
|
||||
|
||||
for (i in segmentsTwo)
|
||||
{
|
||||
if (i == 0) // remove empty/breaks
|
||||
{
|
||||
ltwo--;
|
||||
continue;
|
||||
}
|
||||
//trace(i);
|
||||
sumTwo += i / .5; // half it because otherwise instead of nps its just fucking notes per half second which is dumb and stupid
|
||||
}
|
||||
|
||||
|
||||
var handOneAvg = sumOne / lone;
|
||||
var handTwoAvg = sumTwo / ltwo;
|
||||
|
||||
return HelperFunctions.truncateFloat(handOneAvg > handTwoAvg ? handOneAvg : handTwoAvg,2);
|
||||
}
|
||||
|
||||
static public function new_Array<T>( ArrayType:T, Length:Int ):Array<T> {
|
||||
|
Reference in New Issue
Block a user