Skip to content

Commit

Permalink
v0.8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
sayofthelor committed Jul 12, 2023
1 parent a219e0c commit a34f90a
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 27 deletions.
1 change: 1 addition & 0 deletions Project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
<set name="BUILD_DIR" value="export/final" if="final" />
<set name="BUILD_DIR" value="export/release" unless="debug" />
<set name="BUILD_DIR" value="export/32bit" if="32bits" />
<define name="buildcrash" if="final" />

<classpath name="source" />

Expand Down
2 changes: 1 addition & 1 deletion build-crash-dialog.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion build-crash-dialog.sh
Original file line number Diff line number Diff line change
@@ -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 ..
2 changes: 1 addition & 1 deletion engineVersion.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.8.0
0.8.1
12 changes: 12 additions & 0 deletions source/CoolUtil.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -38,6 +39,17 @@ class CoolUtil

public static var difficulties:Array<String> = [];

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> = 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);
Expand Down
32 changes: 8 additions & 24 deletions source/FunkinLua.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit a34f90a

Please sign in to comment.