diff --git a/source/animate/AnimateTimeline.hx b/source/animate/AnimateTimeline.hx index 6153a4dc0..13008dda7 100644 --- a/source/animate/AnimateTimeline.hx +++ b/source/animate/AnimateTimeline.hx @@ -32,7 +32,7 @@ class AnimateTimeline extends FlxTypedGroup super(); hudCamShit = new FlxCamera(); - hudCamShit.bgColor = null; + hudCamShit.bgColor = FlxColor.TRANSPARENT; FlxG.cameras.add(hudCamShit, false); playhead = new FlxSprite(0, -12).makeGraphic(2, 10, FlxColor.MAGENTA); diff --git a/source/animate/FlxAnimate.hx b/source/animate/FlxAnimate.hx index f7189d162..bd99a70c5 100644 --- a/source/animate/FlxAnimate.hx +++ b/source/animate/FlxAnimate.hx @@ -10,6 +10,9 @@ import flixel.math.FlxPoint; import flixel.math.FlxRect; import flixel.system.FlxAssets.FlxGraphicAsset; import haxe.Json; +import haxe.Utf8; +import haxe.format.JsonParser; +import lime.text.UTF8String; import openfl.Assets; import openfl.display.BitmapData; import openfl.geom.Rectangle; @@ -37,7 +40,8 @@ class FlxAnimate extends FlxSymbol override function draw() { - super.draw(); + // having this commented out fixes some wacky scaling bullshit? + // super.draw(); if (FlxG.keys.justPressed.ONE) { @@ -116,10 +120,13 @@ class FlxAnimate extends FlxSymbol trace(json); + var funnyJson:Dynamic = {}; if (Assets.exists(json)) - json = Assets.getText(json); + funnyJson = JaySon.parseFile(json); - data = cast Json.parse(json).ATLAS; + // trace(json); + + data = cast funnyJson.ATLAS; for (sprite in data.SPRITES) { @@ -140,6 +147,24 @@ class FlxAnimate extends FlxSymbol } } +/** + * HL json encoding fix for some wacky bullshit + * https://github.com/HaxeFoundation/haxe/issues/6930#issuecomment-384570392 + */ +class JaySon +{ + public static function parseFile(name:String) + { + var cont = Assets.getText(name); + function is(n:Int, what:Int) + return cont.charCodeAt(n) == what; + return JsonParser.parse(cont.substr(if (is(0, 65279)) /// looks like a HL target, skipping only first character here: + 1 else if (is(0, 239) && is(1, 187) && is(2, 191)) /// it seems to be Neko or PHP, start from position 3: + 3 else /// all other targets, that prepare the UTF string correctly + 0)); + } +} + typedef AnimateObject = { SPRITES:Array diff --git a/source/animate/FlxSymbol.hx b/source/animate/FlxSymbol.hx index 0ed7e808b..a54dc8a96 100644 --- a/source/animate/FlxSymbol.hx +++ b/source/animate/FlxSymbol.hx @@ -99,24 +99,24 @@ class FlxSymbol extends FlxSprite // newFrameNum = newFrameNum % (tempFrame.I + tempFrame.DU); // newFrameNum = FlxMath.wrap(newFrameNum, tempFrame.I, tempFrame.I + tempFrame.DU); - trace(newFrameNum % keyFrames.length); - trace(newFrameNum); - trace(keyFrames); + // trace(newFrameNum % keyFrames.length); + // trace(newFrameNum); + // trace(keyFrames); newFrameNum = keyFrames[newFrameNum % keyFrames.length]; // temp, fix later for good looping case PLAY_ONCE: - trace(newFrameNum); - trace(keyFrames.length - 1); - trace(keyFrameMap.get(newFrameNum + firstFrame)); - trace(keyFrameMap.get(keyFrames[keyFrames.length - 1])); - trace(layer.LN); - trace(keyFrames); + // trace(newFrameNum); + // trace(keyFrames.length - 1); + // trace(keyFrameMap.get(newFrameNum + firstFrame)); + // trace(keyFrameMap.get(keyFrames[keyFrames.length - 1])); + // trace(layer.LN); + // trace(keyFrames); newFrameNum = Std.int(Math.min(newFrameNum + firstFrame, keyFrames.length - 1)); case SINGLE_FRAME: - trace(layer); - trace(firstFrame); - trace(newFrameNum); - trace(layer.LN); - trace(keyFrames); + // trace(layer); + // trace(firstFrame); + // trace(newFrameNum); + // trace(layer.LN); + // trace(keyFrames); newFrameNum = keyFrames[firstFrame]; } @@ -134,7 +134,7 @@ class FlxSymbol extends FlxSprite // if (newFrameNum >= frame.I && newFrameNum < frame.I + frame.DU) // { - trace(daLoopType); + // trace(daLoopType); for (element in swagFrame.E) { if (Reflect.hasField(element, 'ASI')) @@ -143,6 +143,7 @@ class FlxSymbol extends FlxSprite var dumbassMatrix:Matrix = new Matrix(m3d[0], m3d[1], m3d[4], m3d[5], m3d[12], m3d[13]); var spr:FlxSymbol = new FlxSymbol(0, 0, coolParsed); + spr.setPosition(x, y); matrixExposed = true; spr.frames = frames; spr.frame = spr.frames.getByName(element.ASI.N); @@ -159,8 +160,7 @@ class FlxSymbol extends FlxSprite // spr.origin.x += origin.x; // spr.origin.y += origin.y; - spr.antialiasing = true; - // if (layer.LN != 'head') + // spr.antialiasing = true; spr.draw(); if (FlxG.keys.justPressed.ONE) @@ -171,7 +171,7 @@ class FlxSymbol extends FlxSprite else { var nestedSymbol = symbolMap.get(element.SI.SN); - var nestedShit:FlxSymbol = new FlxSymbol(0, 0, coolParse); + var nestedShit:FlxSymbol = new FlxSymbol(x, y, coolParse); nestedShit.frames = frames; var swagMatrix:FlxMatrix = new FlxMatrix(element.SI.M3D[0], element.SI.M3D[1], element.SI.M3D[4], element.SI.M3D[5], element.SI.M3D[12],