1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-05 06:14:36 +00:00

fix layering jitter

This commit is contained in:
Cameron Taylor 2021-06-18 14:18:56 -04:00
parent 1927be79f8
commit 819d6d570d

View file

@ -5,6 +5,7 @@ import flixel.FlxG;
import flixel.FlxSprite; import flixel.FlxSprite;
import flixel.graphics.frames.FlxFrame.FlxFrameAngle; import flixel.graphics.frames.FlxFrame.FlxFrameAngle;
import flixel.math.FlxAngle; import flixel.math.FlxAngle;
import flixel.math.FlxMath;
import flixel.math.FlxMatrix; import flixel.math.FlxMatrix;
import flixel.math.FlxPoint; import flixel.math.FlxPoint;
import openfl.geom.Matrix; import openfl.geom.Matrix;
@ -44,7 +45,6 @@ class FlxSymbol extends FlxSprite
var symbolMap:Map<String, Animation> = new Map(); var symbolMap:Map<String, Animation> = new Map();
public var daFrame:Int = 0; public var daFrame:Int = 0;
public var nestDepth:Int = 0;
public var transformMatrix:Matrix = new Matrix(); public var transformMatrix:Matrix = new Matrix();
@ -65,6 +65,9 @@ class FlxSymbol extends FlxSprite
{ {
case LOOP: case LOOP:
var tempFrame = layer.FR[newFrameNum + firstFrame % layer.FR.length]; var tempFrame = layer.FR[newFrameNum + firstFrame % layer.FR.length];
// newFrameNum += firstFrame;
// newFrameNum = newFrameNum % (tempFrame.I + tempFrame.DU);
// newFrameNum = FlxMath.wrap(newFrameNum, tempFrame.I, tempFrame.I + tempFrame.DU);
newFrameNum += 0; // temp, fix later for good looping newFrameNum += 0; // temp, fix later for good looping
case PLAY_ONCE: case PLAY_ONCE:
newFrameNum += 0; newFrameNum += 0;
@ -72,11 +75,11 @@ class FlxSymbol extends FlxSprite
newFrameNum = firstFrame; newFrameNum = firstFrame;
} }
trace(daLoopType); // trace(daLoopType);
trace(newFrameNum); // trace(newFrameNum);
trace(layer.FR.length); // trace(layer.FR.length);
trace(newFrameNum % layer.FR.length); // trace(newFrameNum % layer.FR.length);
var swagFrame:Frame = layer.FR[newFrameNum % layer.FR.length]; // has modulo just in case???? var swagFrame:Frame = layer.FR[newFrameNum % layer.FR.length]; // has modulo just in case????
@ -150,12 +153,9 @@ class FlxSymbol extends FlxSprite
nestedShit.firstFrame = element.SI.FF; nestedShit.firstFrame = element.SI.FF;
// nestedShit.daFrame += nestedShit.firstFrame; // nestedShit.daFrame += nestedShit.firstFrame;
nestedSymbol.TL.L.reverse();
nestedShit.daLoopType = element.SI.LP; nestedShit.daLoopType = element.SI.LP;
nestedShit.daFrame = daFrame; nestedShit.daFrame = daFrame;
nestedShit.hasFrameByPass = true; nestedShit.hasFrameByPass = true;
nestedShit.nestDepth = nestDepth + 1;
nestedShit.renderFrame(nestedSymbol.TL, coolParsed); nestedShit.renderFrame(nestedSymbol.TL, coolParsed);
// renderFrame(nestedSymbol.TL, coolParsed); // renderFrame(nestedSymbol.TL, coolParsed);
@ -166,14 +166,6 @@ class FlxSymbol extends FlxSprite
} }
} }
function setDaMap(spr:FlxSymbol):Void
{
if (!nestedShit.exists(nestDepth))
nestedShit.set(nestDepth, [spr]);
else
nestedShit.get(nestDepth).push(spr);
}
function changeFrame(frameChange:Int = 0):Void function changeFrame(frameChange:Int = 0):Void
{ {
daFrame += frameChange; daFrame += frameChange;
@ -187,6 +179,10 @@ class FlxSymbol extends FlxSprite
symbolMap.set(symbol.SN, symbol); symbolMap.set(symbol.SN, symbol);
var symbolName = symbol.SN; var symbolName = symbol.SN;
// one time reverse?
symbol.TL.L.reverse();
for (layer in symbol.TL.L) for (layer in symbol.TL.L)
{ {
for (frame in layer.FR) for (frame in layer.FR)
@ -320,6 +316,7 @@ typedef Layer =
typedef Frame = typedef Frame =
{ {
/** Frame index*/
var I:Int; var I:Int;
/** Duration, in frames*/ /** Duration, in frames*/