Merge branch 'main' into new-editors
This commit is contained in:
@@ -982,6 +982,19 @@ final class CoolUtil
|
||||
|
||||
return result.join(seperator);
|
||||
}
|
||||
|
||||
public static function deepFlatten(arr:Array<Dynamic>, ?result:Array<Dynamic>):Array<Dynamic> {
|
||||
if(arr == null) return [];
|
||||
if(result == null) result = [];
|
||||
for (e in arr) {
|
||||
if (Std.isOfType(e, Array)) {
|
||||
deepFlatten(e, result);
|
||||
} else {
|
||||
result.push(e);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -994,4 +1007,4 @@ enum abstract CoolSfx(Int) from Int {
|
||||
var CHECKED = 3;
|
||||
var UNCHECKED = 4;
|
||||
var WARNING = 5;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import flixel.util.FlxColor;
|
||||
import flixel.util.typeLimit.OneOfTwo;
|
||||
import funkin.backend.FunkinSprite.XMLAnimType;
|
||||
import funkin.backend.FunkinSprite;
|
||||
import funkin.game.Character;
|
||||
import funkin.backend.system.ErrorCode;
|
||||
import funkin.backend.system.interfaces.IOffsetCompatible;
|
||||
import haxe.xml.Access;
|
||||
@@ -175,8 +176,7 @@ final class XMLUtil {
|
||||
animType: spr.spriteAnimType,
|
||||
x: 0,
|
||||
y: 0,
|
||||
indices: [for(i in 0...spr.frames.frames.length) i],
|
||||
forced: (node.has.forced && node.att.forced == "true") || (!node.has.forced && spr.spriteAnimType == BEAT)
|
||||
indices: [for(i in 0...spr.frames.frames.length) i]
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -202,8 +202,7 @@ final class XMLUtil {
|
||||
animType: animType,
|
||||
x: 0,
|
||||
y: 0,
|
||||
indices: [],
|
||||
forced: false,
|
||||
indices: []
|
||||
};
|
||||
|
||||
if (anim.has.name) animData.name = anim.att.name;
|
||||
@@ -259,24 +258,28 @@ final class XMLUtil {
|
||||
|
||||
if (sprite is FunkinSprite) {
|
||||
var xmlSpr = cast(sprite, FunkinSprite);
|
||||
var name = animData.name;
|
||||
switch(animData.animType) {
|
||||
case BEAT:
|
||||
xmlSpr.beatAnims.push({
|
||||
name: animData.name,
|
||||
forced: animData.forced.getDefault(false)
|
||||
name: name,
|
||||
forced: animData.forced.getDefault(defaultForcedCheck(name, xmlSpr))
|
||||
});
|
||||
case LOOP:
|
||||
xmlSpr.playAnim(animData.name, animData.forced.getDefault(false));
|
||||
xmlSpr.playAnim(name, animData.forced.getDefault(defaultForcedCheck(name, xmlSpr)));
|
||||
default:
|
||||
// nothing
|
||||
}
|
||||
xmlSpr.animDatas.set(animData.name, animData);
|
||||
xmlSpr.animDatas.set(name, animData);
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
return MISSING_PROPERTY;
|
||||
}
|
||||
|
||||
public static inline function defaultForcedCheck(animName:String, sprite:FunkinSprite):Bool
|
||||
return sprite is Character && (animName.startsWith("idle") || animName.startsWith("danceLeft") || animName.startsWith("danceRight")) ? false : sprite.spriteAnimType == BEAT;
|
||||
|
||||
public static inline function fixXMLText(text:String) {
|
||||
var v:String;
|
||||
return [for(l in text.split("\n")) if ((v = l.trim()) != "") v].join("\n");
|
||||
|
||||
Reference in New Issue
Block a user