Merge branch 'main' into translations-system
This commit is contained in:
@@ -33,6 +33,8 @@ enum abstract XMLAnimType(Int)
|
||||
|
||||
class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements IOffsetCompatible implements IXMLEvents
|
||||
{
|
||||
public var extra:Map<String, Dynamic> = [];
|
||||
|
||||
public var spriteAnimType:XMLAnimType = NONE;
|
||||
public var beatAnims:Array<BeatAnim> = [];
|
||||
public var name:String;
|
||||
@@ -225,7 +227,7 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I
|
||||
for (key in animOffsets.keys()) {
|
||||
final point = animOffsets[key];
|
||||
animOffsets.remove(key);
|
||||
if(point != null)
|
||||
if (point != null)
|
||||
point.put();
|
||||
}
|
||||
animOffsets = null;
|
||||
@@ -320,19 +322,8 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I
|
||||
return animateAtlas != null ? (animateAtlas.anim.animsMap.exists(AnimName)
|
||||
|| animateAtlas.anim.symbolDictionary.exists(AnimName)) : animation.exists(AnimName);
|
||||
|
||||
public inline function getAnimName()
|
||||
{
|
||||
var name = null;
|
||||
if (animateAtlas != null)
|
||||
{
|
||||
name = atlasPlayingAnim;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (animation.curAnim != null)
|
||||
name = animation.curAnim.name;
|
||||
}
|
||||
return name;
|
||||
public inline function getAnimName() {
|
||||
return (animateAtlas != null) ? atlasPlayingAnim : animation.name;
|
||||
}
|
||||
|
||||
public inline function removeAnimation(name:String) {
|
||||
@@ -356,8 +347,7 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I
|
||||
animation.stop();
|
||||
}
|
||||
|
||||
public inline function isAnimFinished()
|
||||
{
|
||||
public inline function isAnimFinished() {
|
||||
return animateAtlas != null ? (animateAtlas.anim.finished) : (animation.curAnim != null ? animation.curAnim.finished : true);
|
||||
}
|
||||
#end
|
||||
|
||||
@@ -230,7 +230,7 @@ class Chart {
|
||||
if(data.meta != null && Reflect.hasField(data.meta, "parsedColor")) Reflect.deleteField(data.meta, "parsedColor");
|
||||
}
|
||||
|
||||
data.events = saveEventsInChart != true ? null : Reflect.copy(chart.events); // same here once again
|
||||
data.events = saveEventsInChart != true ? null : Reflect.copy(chart.events); // same here once again
|
||||
data.fromMods = null;
|
||||
|
||||
var sortedData:Dynamic = {};
|
||||
|
||||
@@ -131,7 +131,7 @@ class FNFLegacyParser {
|
||||
|
||||
if ((swagSection.mustHitSection && strumLine.type == OPPONENT) ||
|
||||
(!swagSection.mustHitSection && strumLine.type == PLAYER))
|
||||
sectionNote[1] += 4;
|
||||
sectionNote[1] += 4;
|
||||
swagSection.sectionNotes.push(note);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,8 +14,8 @@ final class FreeplayAlphaUpdateEvent extends CancellableEvent {
|
||||
*/
|
||||
public var selectedAlpha:Float;
|
||||
/**
|
||||
* The alpha when something is playing and selected
|
||||
*/
|
||||
* The alpha when something is playing and selected
|
||||
*/
|
||||
public var selectedPlayingAlpha:Float;
|
||||
/**
|
||||
* The lerp of the alpha
|
||||
|
||||
@@ -363,12 +363,12 @@ class FunkinShader extends FlxShader implements IHScriptCustomBehaviour {
|
||||
}
|
||||
|
||||
public function hget(name:String):Dynamic {
|
||||
if (__instanceFields.contains(name) || __instanceFields.contains('get_${name}')) {
|
||||
if (__instanceFields.contains(name) || __instanceFields.contains('get_${name}'))
|
||||
return Reflect.getProperty(this, name);
|
||||
}
|
||||
if (!Reflect.hasField(data, name)) return null;
|
||||
var field = Reflect.field(data, name);
|
||||
var cl = Type.getClassName(Type.getClass(field));
|
||||
if (!Reflect.hasField(data, name))
|
||||
return null;
|
||||
var field:Dynamic = Reflect.field(data, name);
|
||||
var cl:String = Type.getClassName(Type.getClass(field));
|
||||
|
||||
// little problem we are facing boys...
|
||||
|
||||
@@ -394,45 +394,37 @@ class FunkinShader extends FlxShader implements IHScriptCustomBehaviour {
|
||||
if (!Reflect.hasField(data, name)) {
|
||||
Reflect.setField(data, name, val);
|
||||
return val;
|
||||
} else {
|
||||
var field = Reflect.field(data, name);
|
||||
var cl = Type.getClassName(Type.getClass(field));
|
||||
// cant do "field is ShaderInput" for some reason
|
||||
if (cl.startsWith("openfl.display.ShaderParameter")) {
|
||||
@:privateAccess
|
||||
if (field.__length <= 1) {
|
||||
// that means we wait for a single number, instead of an array
|
||||
@:privateAccess
|
||||
if (field.__isInt && !(val is Int)) {
|
||||
throw new ShaderTypeException(name, Type.getClass(val), 'Int');
|
||||
return null;
|
||||
} else
|
||||
@:privateAccess
|
||||
if (field.__isBool && !(val is Bool)) {
|
||||
throw new ShaderTypeException(name, Type.getClass(val), 'Bool');
|
||||
return null;
|
||||
} else
|
||||
@:privateAccess
|
||||
if (field.__isFloat && !(val is Float)) {
|
||||
throw new ShaderTypeException(name, Type.getClass(val), 'Float');
|
||||
return null;
|
||||
}
|
||||
return field.value = [val];
|
||||
} else {
|
||||
if (!(val is Array)) {
|
||||
throw new ShaderTypeException(name, Type.getClass(val), Array);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
var field:Dynamic = Reflect.field(data, name);
|
||||
var cl:String = Type.getClassName(Type.getClass(field));
|
||||
// cant do "field is ShaderInput" for some reason
|
||||
if (cl.startsWith("openfl.display.ShaderParameter")) {
|
||||
@:privateAccess
|
||||
if (field.__length <= 1) {
|
||||
if ((val is Array))
|
||||
return field.value = val;
|
||||
}
|
||||
} else if (cl.startsWith("openfl.display.ShaderInput")) {
|
||||
// shader input!!
|
||||
if (!(val is BitmapData)) {
|
||||
throw new ShaderTypeException(name, Type.getClass(val), BitmapData);
|
||||
return null;
|
||||
}
|
||||
field.input = cast val;
|
||||
// that means we wait for a single number, instead of an array
|
||||
if (field.__isInt && !(val is Int))
|
||||
throw new ShaderTypeException(name, Type.getClass(val), 'Int');
|
||||
else if (field.__isBool && !(val is Bool))
|
||||
throw new ShaderTypeException(name, Type.getClass(val), 'Bool');
|
||||
else if (field.__isFloat && !(val is Float))
|
||||
throw new ShaderTypeException(name, Type.getClass(val), 'Float');
|
||||
|
||||
return field.value = [val];
|
||||
} else {
|
||||
if (!(val is Array))
|
||||
throw new ShaderTypeException(name, Type.getClass(val), Array);
|
||||
|
||||
return field.value = val;
|
||||
}
|
||||
} else if (cl.startsWith("openfl.display.ShaderInput")) {
|
||||
// shader input!!
|
||||
if (!(val is BitmapData)) {
|
||||
throw new ShaderTypeException(name, Type.getClass(val), BitmapData);
|
||||
}
|
||||
field.input = cast val;
|
||||
}
|
||||
|
||||
return val;
|
||||
|
||||
@@ -19,6 +19,7 @@ class CommandLineHandler {
|
||||
#end
|
||||
Sys.println("-nocolor | Disables colors in the terminal");
|
||||
Sys.println("-nogpubitmap | Forces GPU only bitmaps off");
|
||||
Sys.println("-nocwdfix | Turns off automatic working directory fix");
|
||||
Sys.exit(0);
|
||||
#if MOD_SUPPORT
|
||||
case "-m" | "-mod" | "-currentmod":
|
||||
@@ -59,6 +60,8 @@ class CommandLineHandler {
|
||||
Main.noTerminalColor = true;
|
||||
case "-nogpubitmap":
|
||||
Main.forceGPUOnlyBitmapsOff = true;
|
||||
case "-nocwdfix":
|
||||
Main.noCwdFix = true;
|
||||
case "-livereload":
|
||||
// do nothing
|
||||
default:
|
||||
|
||||
@@ -585,7 +585,7 @@ class Controls extends FlxActionSet
|
||||
#else
|
||||
for (gamepad in controls.gamepadsAdded)
|
||||
if (gamepadsAdded.indexOf(gamepad) == -1)
|
||||
gamepadsAdded.push(gamepad);
|
||||
gamepadsAdded.push(gamepad);
|
||||
#end
|
||||
|
||||
mergeKeyboardScheme(controls.keyboardScheme);
|
||||
|
||||
@@ -32,11 +32,11 @@ class Logs {
|
||||
var prefix = "[FLIXEL]";
|
||||
var color:ConsoleColor = LIGHTGRAY;
|
||||
var level:Level = INFO;
|
||||
if (Style == LogStyle.CONSOLE) {prefix = "> "; color = WHITE; level = INFO; } else
|
||||
if (Style == LogStyle.ERROR) {prefix = "[FLIXEL]"; color = RED; level = ERROR; } else
|
||||
if (Style == LogStyle.NORMAL) {prefix = "[FLIXEL]"; color = WHITE; level = INFO; } else
|
||||
if (Style == LogStyle.NOTICE) {prefix = "[FLIXEL]"; color = GREEN; level = VERBOSE;} else
|
||||
if (Style == LogStyle.WARNING) {prefix = "[FLIXEL]"; color = YELLOW; level = WARNING;}
|
||||
if (Style == LogStyle.CONSOLE) {prefix = "> "; color = WHITE; level = INFO; } else
|
||||
if (Style == LogStyle.ERROR) {prefix = "[FLIXEL]"; color = RED; level = ERROR; } else
|
||||
if (Style == LogStyle.NORMAL) {prefix = "[FLIXEL]"; color = WHITE; level = INFO; } else
|
||||
if (Style == LogStyle.NOTICE) {prefix = "[FLIXEL]"; color = GREEN; level = VERBOSE;} else
|
||||
if (Style == LogStyle.WARNING) {prefix = "[FLIXEL]"; color = YELLOW; level = WARNING;}
|
||||
|
||||
var d:Dynamic = Data;
|
||||
if (!(d is Array))
|
||||
@@ -56,11 +56,11 @@ class Logs {
|
||||
logText('${Std.string(time.getHours()).addZeros(2)}:${Std.string(time.getMinutes()).addZeros(2)}:${Std.string(time.getSeconds()).addZeros(2)}', DARKMAGENTA),
|
||||
logText(' |'),
|
||||
switch(level) {
|
||||
case WARNING: logText(' WARNING ', DARKYELLOW);
|
||||
case ERROR: logText(' ERROR ', DARKRED);
|
||||
case TRACE: logText(' TRACE ', GRAY);
|
||||
case VERBOSE: logText(' VERBOSE ', DARKMAGENTA);
|
||||
default: logText(' INFORMATION ', CYAN);
|
||||
case WARNING: logText(' WARNING ', DARKYELLOW);
|
||||
case ERROR: logText(' ERROR ', DARKRED);
|
||||
case TRACE: logText(' TRACE ', GRAY);
|
||||
case VERBOSE: logText(' VERBOSE ', DARKMAGENTA);
|
||||
default: logText(' INFORMATION ', CYAN);
|
||||
},
|
||||
logText('] ')
|
||||
];
|
||||
|
||||
@@ -24,6 +24,10 @@ import sys.thread.Thread;
|
||||
import sys.io.File;
|
||||
#end
|
||||
import funkin.backend.assets.ModsFolder;
|
||||
#if android
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
#end
|
||||
|
||||
class Main extends Sprite
|
||||
{
|
||||
@@ -198,9 +202,23 @@ class Main extends Sprite
|
||||
for(b in pool.clear())
|
||||
b.destroy();
|
||||
}
|
||||
|
||||
openfl.display3D.utils.UInt8Buff._pools.clear();
|
||||
}
|
||||
|
||||
MemoryUtil.clearMajor();
|
||||
}
|
||||
|
||||
public static var noCwdFix:Bool = false;
|
||||
public static function fixWorkingDirectory() {
|
||||
#if windows
|
||||
if (!noCwdFix && !sys.FileSystem.exists('manifest/default.json')) {
|
||||
Sys.setCwd(haxe.io.Path.directory(Sys.programPath()));
|
||||
}
|
||||
#elseif android
|
||||
Sys.setCwd(Path.addTrailingSlash(VERSION.SDK_INT > 30 ? Context.getObbDir() : Context.getExternalFilesDir()));
|
||||
#elseif (ios || switch)
|
||||
Sys.setCwd(Path.addTrailingSlash(openfl.filesystem.File.applicationStorageDirectory.nativePath));
|
||||
#end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package funkin.backend.system.macros;
|
||||
#if macro
|
||||
class NewHaxeWarning {
|
||||
public static function warn() {
|
||||
#if (haxe >= "4.3.0")
|
||||
#if (haxe >= "4.3.0" && !display)
|
||||
Sys.println("====================");
|
||||
Sys.println("[ WARNING ]");
|
||||
Sys.println("Compiling with Haxe 4.3.0 isnt fully recommended yet, but it does work.");
|
||||
|
||||
@@ -101,7 +101,7 @@ class AsyncUpdater {
|
||||
progress.files = files.length;
|
||||
progress.step = DOWNLOADING_ASSETS;
|
||||
trace('starting assets download');
|
||||
doFile([for(e in files) e], [for(e in fileNames) e], function() {
|
||||
doFile([for(e in files) e], fileNames.copy(), function() {
|
||||
progress.curFile = -1;
|
||||
progress.curFileName = null;
|
||||
progress.files = 1;
|
||||
|
||||
@@ -207,7 +207,7 @@ class CoolUtil
|
||||
* @return String Result without any kind of IP
|
||||
*/
|
||||
public static inline function removeIP(msg:String):String {
|
||||
return ~/\d+.\d+.\d+.\d+/.replace(msg, "[Your IP]"); // For now its just IPs but who knows in the future.. - Nex
|
||||
return ~/\d+.\d+.\d+.\d+/.replace(msg, "[Your IP]"); // For now its just IPs but who knows in the future.. - Nex
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -134,7 +134,7 @@ class MemoryUtil {
|
||||
if (process.exitCode() != 0) return "Unknown";
|
||||
var lines = process.stdout.readAll().toString().split("\n");
|
||||
for (line in lines) {
|
||||
if (line.indexOf("Type:") == 0) {
|
||||
if (line.startsWith("Type:")) {
|
||||
return line.substring("Type:".length).trim();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -285,10 +285,12 @@ class XMLUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* Trims and removes spacing from the nodeValue in the XML
|
||||
*
|
||||
* WARNING: will edit directly the node!
|
||||
*/
|
||||
public static function fixSpacingInNode(node:Access):Access {
|
||||
var arr = [for(x in node.x) x];
|
||||
var arr = Lambda.array(node.x);
|
||||
for(i => n in arr) {
|
||||
if(n.nodeType == PCData) {
|
||||
if(i == 0) n.nodeValue = n.nodeValue.ltrim();
|
||||
|
||||
Reference in New Issue
Block a user