Merge branch 'KadeDev:master' into master
This commit is contained in:
commit
933cbee67b
@ -65,4 +65,5 @@ This game was made with love to Newgrounds and its community. Extra love to Tom
|
||||
### Shoutouts
|
||||
- [GWebDev](https://github.com/GrowtopiaFli) - Video Code
|
||||
- [Rozebud](https://github.com/ThatRozebudDude) - Ideas (that I stole)
|
||||
- [Puyo](https://github.com/daniel11420) - Setting up appveyor and a lot of other help
|
||||
- [Puyo](https://github.com/daniel11420) - Setting up appveyor and a lot of other help
|
||||
- [Smokey](https://twitter.com/Smokey_5_) - telling me that I should do the tricky asset loading
|
Binary file not shown.
Binary file not shown.
@ -1,5 +1,12 @@
|
||||
package;
|
||||
|
||||
import lime.app.Application;
|
||||
#if windows
|
||||
import Discord.DiscordClient;
|
||||
#end
|
||||
import openfl.display.BitmapData;
|
||||
import openfl.utils.Assets;
|
||||
import flixel.ui.FlxBar;
|
||||
import haxe.Exception;
|
||||
import flixel.tweens.FlxEase;
|
||||
import flixel.tweens.FlxTween;
|
||||
@ -25,15 +32,26 @@ class Caching extends MusicBeatState
|
||||
var toBeDone = 0;
|
||||
var done = 0;
|
||||
|
||||
var loaded = false;
|
||||
|
||||
var text:FlxText;
|
||||
var kadeLogo:FlxSprite;
|
||||
|
||||
public static var bitmapData:Map<String,FlxGraphic>;
|
||||
|
||||
var images = [];
|
||||
var music = [];
|
||||
var charts = [];
|
||||
|
||||
|
||||
override function create()
|
||||
{
|
||||
FlxG.mouse.visible = false;
|
||||
|
||||
FlxG.worldBounds.set(0,0);
|
||||
|
||||
bitmapData = new Map<String,FlxGraphic>();
|
||||
|
||||
text = new FlxText(FlxG.width / 2, FlxG.height / 2 + 300,0,"Loading...");
|
||||
text.size = 34;
|
||||
text.alignment = FlxTextAlign.CENTER;
|
||||
@ -48,50 +66,35 @@ class Caching extends MusicBeatState
|
||||
|
||||
kadeLogo.alpha = 0;
|
||||
|
||||
add(kadeLogo);
|
||||
add(text);
|
||||
PlayerSettings.init();
|
||||
|
||||
trace('starting caching..');
|
||||
|
||||
sys.thread.Thread.create(() -> {
|
||||
cache();
|
||||
});
|
||||
#if windows
|
||||
DiscordClient.initialize();
|
||||
|
||||
Application.current.onExit.add (function (exitCode) {
|
||||
DiscordClient.shutdown();
|
||||
});
|
||||
|
||||
#end
|
||||
|
||||
|
||||
Highscore.load();
|
||||
|
||||
FlxG.save.bind('funkin', 'ninjamuffin99');
|
||||
|
||||
KadeEngineData.initSave();
|
||||
|
||||
|
||||
super.create();
|
||||
}
|
||||
|
||||
var calledDone = false;
|
||||
|
||||
override function update(elapsed)
|
||||
{
|
||||
|
||||
if (toBeDone != 0 && done != toBeDone)
|
||||
if (FlxG.save.data.cacheImages)
|
||||
{
|
||||
var alpha = HelperFunctions.truncateFloat(done / toBeDone * 100,2) / 100;
|
||||
kadeLogo.alpha = alpha;
|
||||
text.alpha = alpha;
|
||||
text.text = "Loading... (" + done + "/" + toBeDone + ")";
|
||||
}
|
||||
trace("caching images...");
|
||||
|
||||
super.update(elapsed);
|
||||
}
|
||||
|
||||
|
||||
function cache()
|
||||
{
|
||||
|
||||
var images = [];
|
||||
var music = [];
|
||||
var charts = [];
|
||||
|
||||
trace("caching images...");
|
||||
|
||||
for (i in FileSystem.readDirectory(FileSystem.absolutePath("assets/shared/images/characters")))
|
||||
{
|
||||
if (!i.endsWith(".png"))
|
||||
continue;
|
||||
images.push(i);
|
||||
for (i in FileSystem.readDirectory(FileSystem.absolutePath("assets/shared/images/characters")))
|
||||
{
|
||||
if (!i.endsWith(".png"))
|
||||
continue;
|
||||
images.push(i);
|
||||
}
|
||||
}
|
||||
|
||||
trace("caching music...");
|
||||
@ -104,13 +107,63 @@ class Caching extends MusicBeatState
|
||||
|
||||
toBeDone = Lambda.count(images) + Lambda.count(music);
|
||||
|
||||
var bar = new FlxBar(10,FlxG.height - 50,FlxBarFillDirection.LEFT_TO_RIGHT,FlxG.width,40,null,"done",0,toBeDone);
|
||||
bar.color = FlxColor.PURPLE;
|
||||
|
||||
add(bar);
|
||||
|
||||
add(kadeLogo);
|
||||
add(text);
|
||||
|
||||
trace('starting caching..');
|
||||
|
||||
// update thread
|
||||
|
||||
sys.thread.Thread.create(() -> {
|
||||
while(!loaded)
|
||||
{
|
||||
if (toBeDone != 0 && done != toBeDone)
|
||||
{
|
||||
var alpha = HelperFunctions.truncateFloat(done / toBeDone * 100,2) / 100;
|
||||
kadeLogo.alpha = alpha;
|
||||
text.alpha = alpha;
|
||||
text.text = "Loading... (" + done + "/" + toBeDone + ")";
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// cache thread
|
||||
|
||||
sys.thread.Thread.create(() -> {
|
||||
cache();
|
||||
});
|
||||
|
||||
super.create();
|
||||
}
|
||||
|
||||
var calledDone = false;
|
||||
|
||||
override function update(elapsed)
|
||||
{
|
||||
super.update(elapsed);
|
||||
}
|
||||
|
||||
|
||||
function cache()
|
||||
{
|
||||
|
||||
trace("LOADING: " + toBeDone + " OBJECTS.");
|
||||
|
||||
for (i in images)
|
||||
{
|
||||
var replaced = i.replace(".png","");
|
||||
FlxG.bitmap.add(Paths.image("characters/" + replaced,"shared"));
|
||||
trace("cached " + replaced);
|
||||
var data:BitmapData = BitmapData.fromFile("assets/shared/images/characters/" + i);
|
||||
trace('id ' + replaced + ' file - assets/shared/images/characters/' + i + ' ${data.width}');
|
||||
var graph = FlxGraphic.fromBitmapData(data);
|
||||
graph.persist = true;
|
||||
graph.destroyOnNoUse = false;
|
||||
bitmapData.set(replaced,graph);
|
||||
done++;
|
||||
}
|
||||
|
||||
@ -125,6 +178,10 @@ class Caching extends MusicBeatState
|
||||
|
||||
trace("Finished caching...");
|
||||
|
||||
loaded = true;
|
||||
|
||||
trace(Assets.cache.hasBitmapData('GF_assets'));
|
||||
|
||||
FlxG.switchState(new TitleState());
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ class Character extends FlxSprite
|
||||
{
|
||||
case 'gf':
|
||||
// GIRLFRIEND CODE
|
||||
tex = Paths.getSparrowAtlas('characters/GF_assets');
|
||||
tex = Paths.getSparrowAtlas('GF_assets','shared',true);
|
||||
frames = tex;
|
||||
animation.addByPrefix('cheer', 'GF Cheer', 24, false);
|
||||
animation.addByPrefix('singLEFT', 'GF left note', 24, false);
|
||||
@ -51,7 +51,7 @@ class Character extends FlxSprite
|
||||
playAnim('danceRight');
|
||||
|
||||
case 'gf-christmas':
|
||||
tex = Paths.getSparrowAtlas('characters/gfChristmas');
|
||||
tex = Paths.getSparrowAtlas('gfChristmas','shared',true);
|
||||
frames = tex;
|
||||
animation.addByPrefix('cheer', 'GF Cheer', 24, false);
|
||||
animation.addByPrefix('singLEFT', 'GF left note', 24, false);
|
||||
@ -70,7 +70,7 @@ class Character extends FlxSprite
|
||||
playAnim('danceRight');
|
||||
|
||||
case 'gf-car':
|
||||
tex = Paths.getSparrowAtlas('characters/gfCar');
|
||||
tex = Paths.getSparrowAtlas('gfCar','shared',true);
|
||||
frames = tex;
|
||||
animation.addByIndices('singUP', 'GF Dancing Beat Hair blowing CAR', [0], "", 24, false);
|
||||
animation.addByIndices('danceLeft', 'GF Dancing Beat Hair blowing CAR', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false);
|
||||
@ -82,7 +82,7 @@ class Character extends FlxSprite
|
||||
playAnim('danceRight');
|
||||
|
||||
case 'gf-pixel':
|
||||
tex = Paths.getSparrowAtlas('characters/gfPixel');
|
||||
tex = Paths.getSparrowAtlas('gfPixel','shared',true);
|
||||
frames = tex;
|
||||
animation.addByIndices('singUP', 'GF IDLE', [2], "", 24, false);
|
||||
animation.addByIndices('danceLeft', 'GF IDLE', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false);
|
||||
@ -98,7 +98,7 @@ class Character extends FlxSprite
|
||||
|
||||
case 'dad':
|
||||
// DAD ANIMATION LOADING CODE
|
||||
tex = Paths.getSparrowAtlas('characters/DADDY_DEAREST', 'shared');
|
||||
tex = Paths.getSparrowAtlas('DADDY_DEAREST','shared',true);
|
||||
frames = tex;
|
||||
animation.addByPrefix('idle', 'Dad idle dance', 24);
|
||||
animation.addByPrefix('singUP', 'Dad Sing Note UP', 24);
|
||||
@ -110,7 +110,7 @@ class Character extends FlxSprite
|
||||
|
||||
playAnim('idle');
|
||||
case 'spooky':
|
||||
tex = Paths.getSparrowAtlas('characters/spooky_kids_assets');
|
||||
tex = Paths.getSparrowAtlas('spooky_kids_assets','shared',true);
|
||||
frames = tex;
|
||||
animation.addByPrefix('singUP', 'spooky UP NOTE', 24, false);
|
||||
animation.addByPrefix('singDOWN', 'spooky DOWN note', 24, false);
|
||||
@ -123,7 +123,7 @@ class Character extends FlxSprite
|
||||
|
||||
playAnim('danceRight');
|
||||
case 'mom':
|
||||
tex = Paths.getSparrowAtlas('characters/Mom_Assets');
|
||||
tex = Paths.getSparrowAtlas('Mom_Assets','shared',true);
|
||||
frames = tex;
|
||||
|
||||
animation.addByPrefix('idle', "Mom Idle", 24, false);
|
||||
@ -139,7 +139,7 @@ class Character extends FlxSprite
|
||||
playAnim('idle');
|
||||
|
||||
case 'mom-car':
|
||||
tex = Paths.getSparrowAtlas('characters/momCar');
|
||||
tex = Paths.getSparrowAtlas('momCar','shared',true);
|
||||
frames = tex;
|
||||
|
||||
animation.addByPrefix('idle', "Mom Idle", 24, false);
|
||||
@ -154,7 +154,7 @@ class Character extends FlxSprite
|
||||
|
||||
playAnim('idle');
|
||||
case 'monster':
|
||||
tex = Paths.getSparrowAtlas('characters/Monster_Assets');
|
||||
tex = Paths.getSparrowAtlas('Monster_Assets','shared',true);
|
||||
frames = tex;
|
||||
animation.addByPrefix('idle', 'monster idle', 24, false);
|
||||
animation.addByPrefix('singUP', 'monster up note', 24, false);
|
||||
@ -165,7 +165,7 @@ class Character extends FlxSprite
|
||||
loadOffsetFile(curCharacter);
|
||||
playAnim('idle');
|
||||
case 'monster-christmas':
|
||||
tex = Paths.getSparrowAtlas('characters/monsterChristmas');
|
||||
tex = Paths.getSparrowAtlas('monsterChristmas','shared',true);
|
||||
frames = tex;
|
||||
animation.addByPrefix('idle', 'monster idle', 24, false);
|
||||
animation.addByPrefix('singUP', 'monster up note', 24, false);
|
||||
@ -176,7 +176,7 @@ class Character extends FlxSprite
|
||||
loadOffsetFile(curCharacter);
|
||||
playAnim('idle');
|
||||
case 'pico':
|
||||
tex = Paths.getSparrowAtlas('characters/Pico_FNF_assetss');
|
||||
tex = Paths.getSparrowAtlas('Pico_FNF_assetss','shared',true);
|
||||
frames = tex;
|
||||
animation.addByPrefix('idle', "Pico Idle Dance", 24);
|
||||
animation.addByPrefix('singUP', 'pico Up note0', 24, false);
|
||||
@ -207,7 +207,7 @@ class Character extends FlxSprite
|
||||
flipX = true;
|
||||
|
||||
case 'bf':
|
||||
var tex = Paths.getSparrowAtlas('characters/BOYFRIEND', 'shared');
|
||||
var tex = Paths.getSparrowAtlas('BOYFRIEND','shared',true);
|
||||
frames = tex;
|
||||
|
||||
trace(tex.frames.length);
|
||||
@ -236,7 +236,7 @@ class Character extends FlxSprite
|
||||
flipX = true;
|
||||
|
||||
case 'bf-christmas':
|
||||
var tex = Paths.getSparrowAtlas('characters/bfChristmas');
|
||||
var tex = Paths.getSparrowAtlas('bfChristmas','shared',true);
|
||||
frames = tex;
|
||||
animation.addByPrefix('idle', 'BF idle dance', 24, false);
|
||||
animation.addByPrefix('singUP', 'BF NOTE UP0', 24, false);
|
||||
@ -255,7 +255,7 @@ class Character extends FlxSprite
|
||||
|
||||
flipX = true;
|
||||
case 'bf-car':
|
||||
var tex = Paths.getSparrowAtlas('characters/bfCar');
|
||||
var tex = Paths.getSparrowAtlas('bfCar','shared',true);
|
||||
frames = tex;
|
||||
animation.addByPrefix('idle', 'BF idle dance', 24, false);
|
||||
animation.addByPrefix('singUP', 'BF NOTE UP0', 24, false);
|
||||
@ -272,7 +272,7 @@ class Character extends FlxSprite
|
||||
|
||||
flipX = true;
|
||||
case 'bf-pixel':
|
||||
frames = Paths.getSparrowAtlas('characters/bfPixel');
|
||||
frames = Paths.getSparrowAtlas('bfPixel','shared',true);
|
||||
animation.addByPrefix('idle', 'BF IDLE', 24, false);
|
||||
animation.addByPrefix('singUP', 'BF UP NOTE', 24, false);
|
||||
animation.addByPrefix('singLEFT', 'BF LEFT NOTE', 24, false);
|
||||
@ -297,7 +297,7 @@ class Character extends FlxSprite
|
||||
|
||||
flipX = true;
|
||||
case 'bf-pixel-dead':
|
||||
frames = Paths.getSparrowAtlas('characters/bfPixelsDEAD');
|
||||
frames = Paths.getSparrowAtlas('bfPixelsDEAD','shared',true);
|
||||
animation.addByPrefix('singUP', "BF Dies pixel", 24, false);
|
||||
animation.addByPrefix('firstDeath', "BF Dies pixel", 24, false);
|
||||
animation.addByPrefix('deathLoop', "Retry Loop", 24, true);
|
||||
@ -313,7 +313,7 @@ class Character extends FlxSprite
|
||||
flipX = true;
|
||||
|
||||
case 'senpai':
|
||||
frames = Paths.getSparrowAtlas('characters/senpai');
|
||||
frames = Paths.getSparrowAtlas('senpai','shared',true);
|
||||
animation.addByPrefix('idle', 'Senpai Idle', 24, false);
|
||||
animation.addByPrefix('singUP', 'SENPAI UP NOTE', 24, false);
|
||||
animation.addByPrefix('singLEFT', 'SENPAI LEFT NOTE', 24, false);
|
||||
@ -329,7 +329,7 @@ class Character extends FlxSprite
|
||||
|
||||
antialiasing = false;
|
||||
case 'senpai-angry':
|
||||
frames = Paths.getSparrowAtlas('characters/senpai');
|
||||
frames = Paths.getSparrowAtlas('senpai','shared',true);
|
||||
animation.addByPrefix('idle', 'Angry Senpai Idle', 24, false);
|
||||
animation.addByPrefix('singUP', 'Angry Senpai UP NOTE', 24, false);
|
||||
animation.addByPrefix('singLEFT', 'Angry Senpai LEFT NOTE', 24, false);
|
||||
@ -345,7 +345,7 @@ class Character extends FlxSprite
|
||||
antialiasing = false;
|
||||
|
||||
case 'spirit':
|
||||
frames = Paths.getPackerAtlas('characters/spirit');
|
||||
frames = Paths.getPackerAtlas('spirit','shared',true);
|
||||
animation.addByPrefix('idle', "idle spirit_", 24, false);
|
||||
animation.addByPrefix('singUP', "up_", 24, false);
|
||||
animation.addByPrefix('singRIGHT', "right_", 24, false);
|
||||
@ -362,7 +362,7 @@ class Character extends FlxSprite
|
||||
antialiasing = false;
|
||||
|
||||
case 'parents-christmas':
|
||||
frames = Paths.getSparrowAtlas('characters/mom_dad_christmas_assets');
|
||||
frames = Paths.getSparrowAtlas('mom_dad_christmas_assets','shared',true);
|
||||
animation.addByPrefix('idle', 'Parent Christmas Idle', 24, false);
|
||||
animation.addByPrefix('singUP', 'Parent Up Note Dad', 24, false);
|
||||
animation.addByPrefix('singDOWN', 'Parent Down Note Dad', 24, false);
|
||||
|
@ -75,7 +75,7 @@ class ChartingState extends MusicBeatState
|
||||
|
||||
var gridBG:FlxSprite;
|
||||
|
||||
var _song:SwagSong;
|
||||
public static var _song:SwagSong;
|
||||
|
||||
var typingShit:FlxInputText;
|
||||
/*
|
||||
@ -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)\n", 14);
|
||||
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.scrollFactor.set();
|
||||
|
||||
gridBlackLine = new FlxSprite(gridBG.x + gridBG.width / 2).makeGraphic(2, Std.int(gridBG.height), FlxColor.BLACK);
|
||||
@ -661,12 +661,14 @@ class ChartingState extends MusicBeatState
|
||||
|
||||
var writingNotes:Bool = false;
|
||||
var doSnapShit:Bool = true;
|
||||
|
||||
public var diff:Float = 0;
|
||||
|
||||
override function update(elapsed:Float)
|
||||
{
|
||||
updateHeads();
|
||||
|
||||
snapText.text = "Snap: 1/" + snap + " (" + (doSnapShit ? "Control to disable" : "Snap Disabled, Control to renable") + ")\nAdd Notes: 1-8 (or click)\n";
|
||||
snapText.text = "Song Diff: " + diff + "\nSnap: 1/" + snap + " (" + (doSnapShit ? "Control to disable" : "Snap Disabled, Control to renable") + ")\nAdd Notes: 1-8 (or click)";
|
||||
|
||||
curStep = recalculateSteps();
|
||||
|
||||
@ -1260,6 +1262,9 @@ class ChartingState extends MusicBeatState
|
||||
curRenderedSustains.add(sustainVis);
|
||||
}
|
||||
}
|
||||
|
||||
if (_song != null)
|
||||
diff = DiffCalc.CalculateDiff(_song);
|
||||
}
|
||||
|
||||
private function addSection(lengthInSteps:Int = 16):Void
|
||||
|
@ -1,3 +1,5 @@
|
||||
import openfl.system.System;
|
||||
import flixel.math.FlxMath;
|
||||
import Song.SwagSong;
|
||||
|
||||
class SmallNote // basically Note.hx but small as fuck
|
||||
@ -14,18 +16,26 @@ class SmallNote // basically Note.hx but small as fuck
|
||||
|
||||
class DiffCalc
|
||||
{
|
||||
public static function CalculateDiff(song:SwagSong)
|
||||
|
||||
public static var scale = 3 * 1.8;
|
||||
|
||||
public static function CalculateDiff(song:SwagSong, ?accuracy:Float = .93)
|
||||
{
|
||||
trace('calcuilafjwaf');
|
||||
// cleaned notes
|
||||
var cleanedNotes:Array<SmallNote> = [];
|
||||
|
||||
if (song.notes == null)
|
||||
return 0.0;
|
||||
|
||||
if (song.notes.length == 0)
|
||||
return 0.0;
|
||||
|
||||
// find all of the notes
|
||||
for(i in song.notes) // sections
|
||||
{
|
||||
for (ii in i.sectionNotes) // notes
|
||||
{
|
||||
if (ii[2] != 0) // skip helds
|
||||
continue;
|
||||
var gottaHitNote:Bool = i.mustHitSection;
|
||||
|
||||
if (ii[1] > 3)
|
||||
@ -41,6 +51,8 @@ class DiffCalc
|
||||
|
||||
cleanedNotes.sort((a, b) -> Std.int(a.strumTime - b.strumTime));
|
||||
|
||||
|
||||
|
||||
var firstNoteTime = cleanedNotes[0].strumTime;
|
||||
|
||||
// normalize the notes
|
||||
@ -57,84 +69,293 @@ class DiffCalc
|
||||
case 0:
|
||||
handOne.push(i);
|
||||
case 1:
|
||||
handTwo.push(i);
|
||||
handOne.push(i);
|
||||
case 2:
|
||||
handTwo.push(i);
|
||||
case 3:
|
||||
handOne.push(i);
|
||||
handTwo.push(i);
|
||||
}
|
||||
}
|
||||
|
||||
var leftHandCol:Array<Float> = []; // d 0
|
||||
var leftMHandCol:Array<Float> = []; // f 1
|
||||
var rightMHandCol:Array<Float> = []; // j 2
|
||||
var rightHandCol:Array<Float> = []; // k 3
|
||||
|
||||
for(i in 0...handOne.length - 1)
|
||||
{
|
||||
if (handOne[i].noteData == 0)
|
||||
leftHandCol.push(handOne[i].strumTime);
|
||||
else
|
||||
leftMHandCol.push(handOne[i].strumTime);
|
||||
}
|
||||
for(i in 0...handTwo.length - 1)
|
||||
{
|
||||
if (handTwo[i].noteData == 3)
|
||||
rightHandCol.push(handTwo[i].strumTime);
|
||||
else
|
||||
rightMHandCol.push(handTwo[i].strumTime);
|
||||
}
|
||||
|
||||
|
||||
// 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 segmentsOne:Array<Int> = new_Array(1,Std.int(length));
|
||||
var segmentsTwo:Array<Int> = new_Array(1,Std.int(length));
|
||||
|
||||
var segmentsOne = new haxe.ds.Vector(Math.floor(length));
|
||||
|
||||
var segmentsTwo = new haxe.ds.Vector(Math.floor(length));
|
||||
|
||||
for(i in 0...segmentsOne.length)
|
||||
segmentsOne[i] = new Array<SmallNote>();
|
||||
for(i in 0...segmentsTwo.length)
|
||||
segmentsTwo[i] = new Array<SmallNote>();
|
||||
|
||||
// algo loop
|
||||
for(i in handOne)
|
||||
{
|
||||
var index = Std.int(((i.strumTime / 1000)));
|
||||
if (index + 1 > segmentsOne.length)
|
||||
var index = Std.int((((i.strumTime * 2) / 1000)));
|
||||
if (index + 1 > length)
|
||||
continue;
|
||||
segmentsOne[index] = segmentsOne[index] + 1;
|
||||
segmentsOne[index].push(i);
|
||||
}
|
||||
|
||||
for(i in handTwo)
|
||||
{
|
||||
var index = Std.int(((i.strumTime / 1000)));
|
||||
if (index + 1 > segmentsTwo.length)
|
||||
var index = Std.int((((i.strumTime * 2) / 1000)));
|
||||
if (index + 1 > length)
|
||||
continue;
|
||||
segmentsTwo[index] = segmentsTwo[index] + 1;
|
||||
segmentsTwo[index].push(i);
|
||||
}
|
||||
|
||||
// get the average of all of the segments
|
||||
var sumOne:Float = 0;
|
||||
var sumTwo:Float = 0;
|
||||
|
||||
|
||||
var lone = segmentsOne.length;
|
||||
var ltwo = segmentsOne.length;
|
||||
|
||||
for (i in segmentsOne)
|
||||
// Remove 0 intervals
|
||||
/*for(i in 0...segmentsOne.length)
|
||||
{
|
||||
if (i == 0) // remove empty/breaks
|
||||
{
|
||||
lone--;
|
||||
continue;
|
||||
}
|
||||
//trace(i);
|
||||
sumOne += i / .5; // half it because otherwise instead of nps its just fucking notes per half second which is dumb and stupid
|
||||
if (segmentsOne[i].length == 0)
|
||||
segmentsOne[i] = null;
|
||||
}
|
||||
|
||||
for (i in segmentsTwo)
|
||||
for(i in 0...segmentsTwo.length)
|
||||
{
|
||||
if (i == 0) // remove empty/breaks
|
||||
{
|
||||
ltwo--;
|
||||
if (segmentsTwo[i].length == 0)
|
||||
segmentsTwo[i] = null;
|
||||
}*/
|
||||
|
||||
|
||||
var hand_npsOne:Array<Float> = new Array<Float>();
|
||||
var hand_npsTwo:Array<Float> = new Array<Float>();
|
||||
|
||||
for(i in segmentsOne)
|
||||
{
|
||||
if (i == null)
|
||||
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
|
||||
hand_npsOne.push(i.length * scale * 1.6);
|
||||
}
|
||||
for(i in segmentsTwo)
|
||||
{
|
||||
if (i == null)
|
||||
continue;
|
||||
hand_npsTwo.push(i.length * scale * 1.6);
|
||||
}
|
||||
|
||||
|
||||
var handOneAvg = sumOne / lone;
|
||||
var handTwoAvg = sumTwo / ltwo;
|
||||
var hand_diffOne:Array<Float> = new Array<Float>();
|
||||
var hand_diffTwo:Array<Float> = new Array<Float>();
|
||||
|
||||
return HelperFunctions.truncateFloat(handOneAvg > handTwoAvg ? handOneAvg : handTwoAvg,2);
|
||||
for(i in 0...segmentsOne.length)
|
||||
{
|
||||
var ve = segmentsOne[i];
|
||||
if (ve == null)
|
||||
continue;
|
||||
var fuckYouOne:Array<SmallNote> = [];
|
||||
var fuckYouTwo:Array<SmallNote> = [];
|
||||
for(note in ve)
|
||||
{
|
||||
switch(note.noteData)
|
||||
{
|
||||
case 0: // fingie 1
|
||||
fuckYouOne.push(note);
|
||||
case 1: // fingie 2
|
||||
fuckYouTwo.push(note);
|
||||
}
|
||||
}
|
||||
|
||||
var one = fingieCalc(fuckYouOne,leftHandCol);
|
||||
var two = fingieCalc(fuckYouTwo,leftMHandCol);
|
||||
|
||||
|
||||
var bigFuck = ((((one > two ? one : two) * 8) + (hand_npsOne[i] / scale) * 5) / 13) * scale;
|
||||
|
||||
//trace(bigFuck + " - hand one [" + i + "]");
|
||||
|
||||
|
||||
hand_diffOne.push(bigFuck);
|
||||
}
|
||||
|
||||
for(i in 0...segmentsTwo.length)
|
||||
{
|
||||
var ve = segmentsTwo[i];
|
||||
if (ve == null)
|
||||
continue;
|
||||
var fuckYouOne:Array<SmallNote> = [];
|
||||
var fuckYouTwo:Array<SmallNote> = [];
|
||||
for(note in ve)
|
||||
{
|
||||
switch(note.noteData)
|
||||
{
|
||||
case 2: // fingie 1
|
||||
fuckYouOne.push(note);
|
||||
case 3: // fingie 2
|
||||
fuckYouTwo.push(note);
|
||||
}
|
||||
}
|
||||
|
||||
var one = fingieCalc(fuckYouOne,rightMHandCol);
|
||||
var two = fingieCalc(fuckYouTwo,rightHandCol);
|
||||
|
||||
var bigFuck = ((((one > two ? one : two) * 8) + (hand_npsTwo[i] / scale) * 5) / 13) * scale;
|
||||
|
||||
hand_diffTwo.push(bigFuck);
|
||||
|
||||
// trace(bigFuck + " - hand two [" + i + "]");
|
||||
}
|
||||
|
||||
for (i in 0...4)
|
||||
{
|
||||
smoothBrain(hand_npsOne,0);
|
||||
smoothBrain(hand_npsTwo,0);
|
||||
|
||||
smoothBrainTwo(hand_diffOne);
|
||||
smoothBrainTwo(hand_diffTwo);
|
||||
}
|
||||
|
||||
//trace(hand_diffOne);
|
||||
//trace(hand_diffTwo);
|
||||
|
||||
//trace(hand_npsOne);
|
||||
//trace(hand_npsTwo);
|
||||
|
||||
var point_npsOne:Array<Float> = new Array<Float>();
|
||||
var point_npsTwo:Array<Float> = new Array<Float>();
|
||||
|
||||
for(i in segmentsOne)
|
||||
{
|
||||
if (i == null)
|
||||
continue;
|
||||
point_npsOne.push(i.length);
|
||||
}
|
||||
for(i in segmentsTwo)
|
||||
{
|
||||
if (i == null)
|
||||
continue;
|
||||
point_npsTwo.push(i.length);
|
||||
}
|
||||
|
||||
var maxPoints:Float = 0;
|
||||
|
||||
for(i in point_npsOne)
|
||||
maxPoints += i;
|
||||
for(i in point_npsTwo)
|
||||
maxPoints += i;
|
||||
|
||||
if (accuracy > .965)
|
||||
accuracy = .965;
|
||||
|
||||
return HelperFunctions.truncateFloat(chisel(accuracy,hand_diffOne,hand_diffTwo,point_npsOne,point_npsTwo,maxPoints),2);
|
||||
}
|
||||
|
||||
static public function new_Array<T>( ArrayType:T, Length:Int ):Array<T> {
|
||||
var empty:Null<T> = null;
|
||||
var newArray:Array<T> = new Array<T>();
|
||||
|
||||
for ( i in 0...Length ) {
|
||||
newArray.push( empty );
|
||||
public static function chisel(scoreGoal:Float,diffOne:Array<Float>,diffTwo:Array<Float>,pointsOne:Array<Float>,pointsTwo:Array<Float>,maxPoints:Float)
|
||||
{
|
||||
var lowerBound:Float = 0;
|
||||
var upperBound:Float = 100;
|
||||
|
||||
while(upperBound - lowerBound > 0.01)
|
||||
{
|
||||
var average:Float = (upperBound + lowerBound) / 2;
|
||||
var amtOfPoints:Float = calcuate(average,diffOne,pointsOne) + calcuate(average,diffTwo,pointsTwo);
|
||||
if (amtOfPoints / maxPoints < scoreGoal)
|
||||
lowerBound = average;
|
||||
else
|
||||
upperBound = average;
|
||||
|
||||
}
|
||||
return upperBound;
|
||||
}
|
||||
|
||||
public static function calcuate(midPoint:Float,diff:Array<Float>,points:Array<Float>)
|
||||
{
|
||||
var output:Float = 0;
|
||||
|
||||
for (i in 0...diff.length)
|
||||
{
|
||||
var res = diff[i];
|
||||
if (midPoint > res)
|
||||
output += points[i];
|
||||
else
|
||||
output += points[i] * Math.pow(midPoint / res,1.2);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
public static function findStupid(strumTime:Float, array:Array<Float>)
|
||||
{
|
||||
for(i in 0...array.length)
|
||||
if (array[i] == strumTime)
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static function fingieCalc(floats:Array<SmallNote>, columArray:Array<Float>):Float
|
||||
{
|
||||
var sum:Float = 0;
|
||||
if (floats.length == 0)
|
||||
return 0;
|
||||
var startIndex = findStupid(floats[0].strumTime,columArray);
|
||||
if (startIndex == -1)
|
||||
return 0;
|
||||
for(i in floats)
|
||||
{
|
||||
sum += columArray[startIndex + 1] - columArray[startIndex];
|
||||
startIndex++;
|
||||
}
|
||||
|
||||
if (sum == 0)
|
||||
return 0;
|
||||
|
||||
return (1375 * (floats.length)) / sum;
|
||||
}
|
||||
|
||||
// based arrayer
|
||||
// basicily smmoth the shit
|
||||
public static function smoothBrain(npsVector:Array<Float>, weirdchamp:Float)
|
||||
{
|
||||
var floatOne = weirdchamp;
|
||||
var floatTwo = weirdchamp;
|
||||
|
||||
for (i in 0...npsVector.length)
|
||||
{
|
||||
var result = npsVector[i];
|
||||
|
||||
var chunker = floatOne;
|
||||
floatOne = floatTwo;
|
||||
floatTwo = result;
|
||||
|
||||
npsVector[i] = (chunker + floatOne + floatTwo) / 3;
|
||||
}
|
||||
}
|
||||
|
||||
// Smooth the shit but less
|
||||
public static function smoothBrainTwo(diffVector:Array<Float>)
|
||||
{
|
||||
var floatZero:Float = 0;
|
||||
|
||||
for(i in 0...diffVector.length)
|
||||
{
|
||||
var result = diffVector[i];
|
||||
|
||||
var fuck = floatZero;
|
||||
floatZero = result;
|
||||
diffVector[i] = (fuck + floatZero) / 2;
|
||||
}
|
||||
|
||||
return newArray;
|
||||
}
|
||||
}
|
@ -64,7 +64,6 @@ class FreeplayState extends MusicBeatState
|
||||
{
|
||||
var data:Array<String> = initSonglist[i].split(':');
|
||||
var meta = new SongMetadata(data[0], Std.parseInt(data[2]), data[1]);
|
||||
#if debug
|
||||
songs.push(meta);
|
||||
var format = StringTools.replace(meta.songName, " ", "-");
|
||||
switch (format) {
|
||||
@ -78,24 +77,7 @@ class FreeplayState extends MusicBeatState
|
||||
FreeplayState.loadDiff(2,format,meta.songName,diffs);
|
||||
FreeplayState.songData.set(meta.songName,diffs);
|
||||
trace('loaded diffs for ' + meta.songName);
|
||||
#else
|
||||
if(Std.parseInt(data[2]) <= FlxG.save.data.weekUnlocked - 1)
|
||||
{
|
||||
songs.push(meta);
|
||||
var format = StringTools.replace(meta.songName, " ", "-");
|
||||
switch (format) {
|
||||
case 'Dad-Battle': format = 'Dadbattle';
|
||||
case 'Philly-Nice': format = 'Philly';
|
||||
}
|
||||
|
||||
var diffs = [];
|
||||
FreeplayState.loadDiff(0,format,meta.songName,diffs);
|
||||
FreeplayState.loadDiff(1,format,meta.songName,diffs);
|
||||
FreeplayState.loadDiff(2,format,meta.songName,diffs);
|
||||
FreeplayState.songData.set(meta.songName,diffs);
|
||||
trace('loaded diffs for ' + meta.songName);
|
||||
}
|
||||
#end
|
||||
}
|
||||
|
||||
//trace("\n" + diffList);
|
||||
|
@ -97,6 +97,9 @@ class KadeEngineData
|
||||
if (FlxG.save.data.optimize == null)
|
||||
FlxG.save.data.optimize = false;
|
||||
|
||||
if (FlxG.save.data.cacheImages == null)
|
||||
FlxG.save.data.cacheImages = false;
|
||||
|
||||
var gamepad:FlxGamepad = FlxG.gamepads.lastActive;
|
||||
|
||||
KeyBinds.gamepad = gamepad != null;
|
||||
|
@ -119,6 +119,29 @@ class CpuStrums extends Option
|
||||
|
||||
}
|
||||
|
||||
class GraphicLoading extends Option
|
||||
{
|
||||
public function new(desc:String)
|
||||
{
|
||||
super();
|
||||
description = desc;
|
||||
}
|
||||
|
||||
public override function press():Bool
|
||||
{
|
||||
FlxG.save.data.cacheImages = !FlxG.save.data.cacheImages;
|
||||
|
||||
display = updateDisplay();
|
||||
return true;
|
||||
}
|
||||
|
||||
private override function updateDisplay():String
|
||||
{
|
||||
return FlxG.save.data.cacheImages ? "Preload Characters" : "Do not Preload Characters";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class DownscrollOption extends Option
|
||||
{
|
||||
public function new(desc:String)
|
||||
|
@ -59,6 +59,7 @@ class OptionsMenu extends MusicBeatState
|
||||
new ScoreScreen("Show the score screen after the end of a song"),
|
||||
new ShowInput("Display every single input in the score screen."),
|
||||
new Optimization("No backgrounds, no characters, centered notes, no player 2."),
|
||||
new GraphicLoading("On startup, cache every character. Significantly decrease load times. (HIGH MEMORY)"),
|
||||
new BotPlay("Showcase your charts and mods with autoplay.")
|
||||
]),
|
||||
|
||||
|
@ -1,5 +1,8 @@
|
||||
package;
|
||||
|
||||
import openfl.utils.Assets;
|
||||
import flixel.graphics.FlxGraphic;
|
||||
import flixel.system.FlxAssets.FlxGraphicAsset;
|
||||
import flixel.FlxG;
|
||||
import flixel.graphics.frames.FlxAtlasFrames;
|
||||
import openfl.utils.AssetType;
|
||||
@ -125,13 +128,30 @@ class Paths
|
||||
return 'assets/fonts/$key';
|
||||
}
|
||||
|
||||
inline static public function getSparrowAtlas(key:String, ?library:String)
|
||||
inline static public function getSparrowAtlas(key:String, ?library:String, ?isCharacter:Bool = false)
|
||||
{
|
||||
if (isCharacter)
|
||||
if (FlxG.save.data.cacheImages)
|
||||
return FlxAtlasFrames.fromSparrow(imageCached(key), file('images/characters/$key.xml', library));
|
||||
else
|
||||
return FlxAtlasFrames.fromSparrow(image('characters/$key'), file('images/characters/$key.xml'));
|
||||
return FlxAtlasFrames.fromSparrow(image(key, library), file('images/$key.xml', library));
|
||||
}
|
||||
|
||||
inline static public function getPackerAtlas(key:String, ?library:String)
|
||||
inline static public function imageCached(key:String):FlxGraphic
|
||||
{
|
||||
var data = Caching.bitmapData.get(key);
|
||||
trace('finding ${key} - ${data.bitmap}');
|
||||
return data;
|
||||
}
|
||||
|
||||
inline static public function getPackerAtlas(key:String, ?library:String, ?isCharacter:Bool = false)
|
||||
{
|
||||
if (isCharacter)
|
||||
if (FlxG.save.data.cacheImages)
|
||||
return FlxAtlasFrames.fromSpriteSheetPacker(imageCached(key), file('images/$key.txt', library));
|
||||
else
|
||||
return FlxAtlasFrames.fromSpriteSheetPacker(image('characters/$key'), file('images/characters/$key.txt'));
|
||||
return FlxAtlasFrames.fromSpriteSheetPacker(image(key, library), file('images/$key.txt', library));
|
||||
}
|
||||
}
|
||||
|
@ -2776,7 +2776,7 @@ class PlayState extends MusicBeatState
|
||||
else
|
||||
{
|
||||
FlxG.sound.playMusic(Paths.music('freakyMenu'));
|
||||
FlxG.switchState(new MainMenuState());
|
||||
FlxG.switchState(new StoryMenuState());
|
||||
}
|
||||
|
||||
#if windows
|
||||
|
@ -75,7 +75,7 @@ class ResultsScreen extends FlxSubState
|
||||
text.text = "Week Cleared!";
|
||||
}
|
||||
|
||||
comboText = new FlxText(20,-75,0,'Judgements:\nSicks - ${PlayState.sicks}\nGoods - ${PlayState.goods}\nBads - ${PlayState.bads}\n\nCombo Breaks: ${(PlayState.isStoryMode ? PlayState.campaignMisses : PlayState.misses)}\nHighest Combo: ${PlayState.highestCombo + 1}\n\nScore: ${PlayState.instance.songScore}\nAccuracy: ${HelperFunctions.truncateFloat(PlayState.instance.accuracy,2)}%\n\n${Ratings.GenerateLetterRank(PlayState.instance.accuracy)}\n\nF1 - View replay\nF2 - Replay song
|
||||
comboText = new FlxText(20,-75,0,'Judgements:\nSicks - ${PlayState.sicks}\nGoods - ${PlayState.goods}\nBads - ${PlayState.bads}\n\nCombo Breaks: ${(PlayState.isStoryMode ? PlayState.campaignMisses : PlayState.misses)}\nHighest Combo: ${PlayState.highestCombo + 1}\nScore: ${PlayState.instance.songScore}\nAccuracy: ${HelperFunctions.truncateFloat(PlayState.instance.accuracy,2)}%\n\n${Ratings.GenerateLetterRank(PlayState.instance.accuracy)}\n\nF1 - View replay\nF2 - Replay song
|
||||
');
|
||||
comboText.size = 28;
|
||||
comboText.setBorderStyle(FlxTextBorderStyle.OUTLINE,FlxColor.BLACK,4,1);
|
||||
|
@ -67,16 +67,7 @@ class TitleState extends MusicBeatState
|
||||
trace("Loaded " + openfl.Assets.getLibrary("default").assetsLoaded + " assets (DEFAULT)");
|
||||
}
|
||||
|
||||
PlayerSettings.init();
|
||||
|
||||
#if windows
|
||||
DiscordClient.initialize();
|
||||
|
||||
Application.current.onExit.add (function (exitCode) {
|
||||
DiscordClient.shutdown();
|
||||
});
|
||||
|
||||
#end
|
||||
|
||||
curWacky = FlxG.random.getObject(getIntroTextShit());
|
||||
|
||||
@ -93,14 +84,8 @@ class TitleState extends MusicBeatState
|
||||
trace('NEWGROUNDS LOL');
|
||||
#end
|
||||
|
||||
FlxG.save.bind('funkin', 'ninjamuffin99');
|
||||
|
||||
KadeEngineData.initSave();
|
||||
|
||||
// var file:SMFile = SMFile.loadFile("file.sm");
|
||||
// this was testing things
|
||||
|
||||
Highscore.load();
|
||||
|
||||
#if FREEPLAY
|
||||
FlxG.switchState(new FreeplayState());
|
||||
|
Loading…
x
Reference in New Issue
Block a user