diff --git a/Project.xml b/Project.xml index 98ec7907e..840cf75b1 100644 --- a/Project.xml +++ b/Project.xml @@ -42,6 +42,7 @@ + diff --git a/build-crash-dialog.bat b/build-crash-dialog.bat index f26a6e6be..9ecf1023c 100644 --- a/build-crash-dialog.bat +++ b/build-crash-dialog.bat @@ -3,7 +3,7 @@ cd crash-dialog echo Building crash dialog... haxelib run lime build windows -copy build\openfl\windows\bin\CrashDialog.exe ..\export\release\windows\bin\CrashDialog.exe +copy build\openfl\windows\bin\CrashDialog.exe ..\export\final\windows\bin\CrashDialog.exe cd .. @echo on \ No newline at end of file diff --git a/build-crash-dialog.sh b/build-crash-dialog.sh index 48317bcd0..387f19d44 100644 --- a/build-crash-dialog.sh +++ b/build-crash-dialog.sh @@ -1,5 +1,5 @@ cd crash-dialog echo "Building crash dialog..." haxelib run lime build linux -cp build/openfl/linux/bin/CrashDialog ../export/release/linux/bin/CrashDialog +cp build/openfl/linux/bin/CrashDialog ../export/final/linux/bin/CrashDialog cd .. \ No newline at end of file diff --git a/engineVersion.txt b/engineVersion.txt index 8adc70fdd..c18d72be3 100644 --- a/engineVersion.txt +++ b/engineVersion.txt @@ -1 +1 @@ -0.8.0 \ No newline at end of file +0.8.1 \ No newline at end of file diff --git a/source/CoolUtil.hx b/source/CoolUtil.hx index 9ae3b4394..26c17e01e 100644 --- a/source/CoolUtil.hx +++ b/source/CoolUtil.hx @@ -3,6 +3,7 @@ package; import flixel.util.FlxSave; import flixel.FlxG; import openfl.utils.Assets; +import flixel.util.FlxColor; import lime.utils.Assets as LimeAssets; import lime.utils.AssetLibrary; import lime.utils.AssetManifest; @@ -38,6 +39,17 @@ class CoolUtil public static var difficulties:Array = []; + inline public static function colorFromString(color:String):FlxColor + { + var hideChars = ~/[\t\n\r]/; + var color:String = hideChars.split(color).join('').trim(); + if(color.startsWith('0x')) color = color.substr(4); + + var colorNum:Null = FlxColor.fromString(color); + if(colorNum == null) colorNum = FlxColor.fromString('#$color'); + return colorNum != null ? colorNum : FlxColor.WHITE; + } + inline public static function quantize(f:Float, snap:Float){ // changed so this actually works lol var m:Float = Math.fround(f * snap); diff --git a/source/FunkinLua.hx b/source/FunkinLua.hx index 3cb9daa87..cb3e3d8b8 100644 --- a/source/FunkinLua.hx +++ b/source/FunkinLua.hx @@ -1496,8 +1496,7 @@ class FunkinLua { }); Lua_helper.add_callback(lua, "getColorFromHex", function(color:String) { - if(!color.startsWith('0x')) color = '0xff' + color; - return Std.parseInt(color); + return CoolUtil.colorFromString(color); }); Lua_helper.add_callback(lua, "keyboardJustPressed", function(name:String) @@ -1729,14 +1728,10 @@ class FunkinLua { }); Lua_helper.add_callback(lua, "cameraFlash", function(camera:String, color:String, duration:Float,forced:Bool) { - var colorNum:Int = Std.parseInt(color); - if(!color.startsWith('0x')) colorNum = Std.parseInt('0xff' + color); - cameraFromString(camera).flash(colorNum, duration,null,forced); + cameraFromString(camera).flash(CoolUtil.colorFromString(color), duration,null,forced); }); Lua_helper.add_callback(lua, "cameraFade", function(camera:String, color:String, duration:Float,forced:Bool) { - var colorNum:Int = Std.parseInt(color); - if(!color.startsWith('0x')) colorNum = Std.parseInt('0xff' + color); - cameraFromString(camera).fade(colorNum, duration,false,null,forced); + cameraFromString(camera).fade(CoolUtil.colorFromString(color), duration,false,null,forced); }); Lua_helper.add_callback(lua, "setRatingPercent", function(value:Float) { PlayState.instance.ratingPercent = value; @@ -1847,18 +1842,16 @@ class FunkinLua { }); Lua_helper.add_callback(lua, "makeGraphic", function(obj:String, width:Int, height:Int, color:String) { - var colorNum:Int = Std.parseInt(color); - if(!color.startsWith('0x')) colorNum = Std.parseInt('0xff' + color); var spr:FlxSprite = PlayState.instance.getLuaObject(obj,false); if(spr!=null) { - PlayState.instance.getLuaObject(obj,false).makeGraphic(width, height, colorNum); + PlayState.instance.getLuaObject(obj,false).makeGraphic(width, height, CoolUtil.colorFromString(color)); return; } var object:FlxSprite = Reflect.getProperty(getInstance(), obj); if(object != null) { - object.makeGraphic(width, height, colorNum); + object.makeGraphic(width, height, CoolUtil.colorFromString(color)); } }); Lua_helper.add_callback(lua, "addAnimationByPrefix", function(obj:String, name:String, prefix:String, framerate:Int = 24, loop:Bool = true) { @@ -2462,11 +2455,8 @@ class FunkinLua { var obj:FlxText = getTextObject(tag); if(obj != null) { - var colorNum:Int = Std.parseInt(color); - if(!color.startsWith('0x')) colorNum = Std.parseInt('0xff' + color); - obj.borderSize = size; - obj.borderColor = colorNum; + obj.borderColor = CoolUtil.colorFromString(color); return true; } luaTrace("setTextBorder: Object " + tag + " doesn't exist!", false, false, FlxColor.RED); @@ -2476,10 +2466,7 @@ class FunkinLua { var obj:FlxText = getTextObject(tag); if(obj != null) { - var colorNum:Int = Std.parseInt(color); - if(!color.startsWith('0x')) colorNum = Std.parseInt('0xff' + color); - - obj.color = colorNum; + obj.color = CoolUtil.colorFromString(color); return true; } luaTrace("setTextColor: Object " + tag + " doesn't exist!", false, false, FlxColor.RED); @@ -2729,10 +2716,7 @@ class FunkinLua { Lua_helper.add_callback(lua, "luaSpriteMakeGraphic", function(tag:String, width:Int, height:Int, color:String) { luaTrace("luaSpriteMakeGraphic is deprecated! Use makeGraphic instead", false, true); if(PlayState.instance.modchartSprites.exists(tag)) { - var colorNum:Int = Std.parseInt(color); - if(!color.startsWith('0x')) colorNum = Std.parseInt('0xff' + color); - - PlayState.instance.modchartSprites.get(tag).makeGraphic(width, height, colorNum); + PlayState.instance.modchartSprites.get(tag).makeGraphic(width, height, CoolUtil.colorFromString(color)); } }); Lua_helper.add_callback(lua, "luaSpriteAddAnimationByPrefix", function(tag:String, name:String, prefix:String, framerate:Int = 24, loop:Bool = true) {