diff --git a/source/Main.hx b/source/Main.hx index 6595adf3ea..576120ba2d 100644 --- a/source/Main.hx +++ b/source/Main.hx @@ -5,6 +5,7 @@ import flixel.FlxGame; import flixel.FlxState; import flixel.system.debug.log.LogStyle; import haxe.CallStack; +import haxe.EntryPoint; import haxe.Log; import haxe.io.Path; import openfl.Lib; @@ -16,7 +17,6 @@ import openfl.text.TextFormat; import states.TitleState; import ui.SimpleInfoDisplay; import ui.logs.Logs; -import ui.logs.LogFrontEnd; import sys.FileSystem; import sys.io.File; import sys.io.Process; @@ -59,10 +59,9 @@ class Main extends Sprite { logsOverlay.visible = false; addChild(logsOverlay); - /*untyped FlxG.log = new LogFrontEnd(); - LogStyle.WARNING.callback = (data) -> trace(data, WARNING); - LogStyle.ERROR.callback = (data) -> trace(data, ERROR); - LogStyle.NOTICE.callback = (data) -> trace(data, LOG); */ + LogStyle.WARNING.onLog.add(data -> trace(data, WARNING)); + LogStyle.ERROR.onLog.add(data -> trace(data, ERROR)); + LogStyle.NOTICE.onLog.add(data -> trace(data)); display = new SimpleInfoDisplay(8, 3, 0xFFFFFF, "_sans"); addChild(display); @@ -207,11 +206,11 @@ class Main extends Sprite { :~~!!!!!!!!7777777777777?????J???J???????????????????J?????????????????????JJJ??JJJJJ?????JJ??J???JJJJJJ?JJJJ! .^!~77?777!77777777777????????JJJJJJJJJ?J????????????????JJJJ????????????JJJJJJJJ?JJJJJJJJJ?JJJ?JJJ?JJJJJ?JYJJJ?. .~~!???????????????J????JJ??JJJJJJYJJJJJJJJJ?JJJJ??J??JJ?JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ??J?JJJJJJJYYJJJJ7 - .~~7YYYJJJ?JJJJ??JJJJ?J?JJJ?JJJJJJYYYYYYYJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ?????!7JY5555YYJJJ! - :~7YYYYYYYYYYJJJYJJYJJJJYJJJYYYYYYYYYYYYYYYJYYJYYY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YYYJJYYY5YJ5YY5555YYJJJJJJJJJJ??!~: .:: .:~7?JY55YYYYYYYYYYYYY5YJJJJJJJJ???777777!!!!!!!!!!~~!!!!!!!~!55YYYJYYJJJJJJJJJ??7!: diff --git a/source/states/PlayState.hx b/source/states/PlayState.hx index 184b81869a..a579172a12 100644 --- a/source/states/PlayState.hx +++ b/source/states/PlayState.hx @@ -1676,7 +1676,7 @@ class PlayState extends MusicBeatState { for (susNote in 0...Math.floor(swagNote.sustainLength / Std.int(Conductor.stepCrochet))) { oldNote = unspawnNotes[unspawnNotes.length - 1]; - var sustainNote:Note = new Note(daStrumTime + (Conductor.stepCrochet * susNote) + (Conductor.stepCrochet / (Options.getData("downscroll") ? 1 : FlxMath.roundDecimal(speed, + var sustainNote:Note = new Note(daStrumTime + (Conductor.stepCrochet * susNote) + (Conductor.stepCrochet / ((Options.getData("downscroll") || SONG.modchartingTools) ? 1 : FlxMath.roundDecimal(speed, 2))), noteData, oldNote, true, char, songNotes[4], null, chars, gottaHitNote); sustainNote.scrollFactor.set(); diff --git a/source/ui/HealthIcon.hx b/source/ui/HealthIcon.hx index 1a153d14e0..27890142fd 100644 --- a/source/ui/HealthIcon.hx +++ b/source/ui/HealthIcon.hx @@ -1,5 +1,6 @@ package ui; +import flixel.FlxSprite; import haxe.Json; import lime.utils.Assets; @@ -34,7 +35,7 @@ class HealthIcon extends TrackerSprite { fps: 24, antialiasing: true }; - for (path in ['$char-icons', 'icon-$char', char]) { + for (path in [char, '$char-icons', 'icon-$char']) { if (Assets.exists(Paths.image('icons/$path'))) { iconPath = path; break; @@ -56,10 +57,20 @@ class HealthIcon extends TrackerSprite { animation.addByPrefix('lose', '${char}-lose0', iconConfig.fps, true, isPlayer); animation.addByPrefix('win', '${char}-win0', iconConfig.fps, true, isPlayer); } else { - loadGraphic(Paths.gpuBitmap('icons/$iconPath'), true, 150, 150); + var dummy:FlxSprite = new FlxSprite().loadGraphic(Paths.gpuBitmap('icons/$iconPath')); + + if (dummy.height != 150) // damn psych engine edge cases >:( + loadGraphic(Paths.gpuBitmap('icons/$iconPath'), true, Std.int(dummy.width / 2), Std.int(dummy.height)); + else + loadGraphic(Paths.gpuBitmap('icons/$iconPath'), true, 150, 150); + dummy.destroy(); + dummy = null; + var winFrame:Int = (width >= 450 ? 2 : 0); + var loseFrame:Int = (width >= 300 ? 1 : 0); + + animation.add('win', [winFrame], 0, false, isPlayer); + animation.add('lose', [loseFrame], 0, false, isPlayer); animation.add('neutral', [0], 0, false, isPlayer); - animation.add('lose', [1], 0, false, isPlayer); - animation.add('win', [2], 0, false, isPlayer); } animation.play('neutral'); diff --git a/source/ui/logs/LogFrontEnd.hx b/source/ui/logs/LogFrontEnd.hx deleted file mode 100644 index 7732f9abd1..0000000000 --- a/source/ui/logs/LogFrontEnd.hx +++ /dev/null @@ -1,48 +0,0 @@ -package ui.logs; - -import flixel.system.debug.log.LogStyle; - -class LogFrontEnd extends flixel.system.frontEnds.LogFrontEnd { - override public function advanced(data:Any, ?style:LogStyle, fireOnce:Bool = false) { - if (style == null) - style = LogStyle.NORMAL; - - if (!(data is Array)) - data = [data]; - - // Check null game since `FlxG.save.bind` may be called before `new FlxGame` - #if FLX_DEBUG - if (FlxG.game == null || FlxG.game.debugger == null) - { - _standardTraceFunction(data); - } - else if (FlxG.game.debugger.log.add(data, style, fireOnce)) - { - #end - #if (FLX_DEBUG && FLX_SOUND_SYSTEM && !FLX_UNIT_TEST) - if (style.errorSound != null) - { - final sound = FlxAssets.getSound(style.errorSound); - if (sound != null) - FlxG.sound.load(sound).play(); - } - #end - - #if FLX_DEBUG - if (style.openConsole) - FlxG.debugger.visible = true; - #end - - if (style.callbackFunction != null) - style.callbackFunction(); - - if (style.callback != null) - style.callback(data); - - #if FLX_DEBUG - } - #end - if (style.throwException) - throw style.toLogString(data); - } -} \ No newline at end of file diff --git a/source/utilities/CoolUtil.hx b/source/utilities/CoolUtil.hx index 5c7dad2883..c42a3a9b96 100644 --- a/source/utilities/CoolUtil.hx +++ b/source/utilities/CoolUtil.hx @@ -12,10 +12,12 @@ import lime.app.Application; import lime.graphics.Image; import lime.utils.Assets; import ui.logs.Logs; +import haxe.EntryPoint; import haxe.Log; import haxe.Json; import haxe.PosInfos; + /** * Helper class with lots of utilitiy functions. */ @@ -345,21 +347,23 @@ class CoolUtil { **/ public static function print(message:String, ?type:PrintType = LOG, ?pos_infos:PosInfos):Void { untyped __cpp__("std::cout << {0}", '${Log.formatOutput('${messageFromPrintType(type)} $message', pos_infos)}\n'); - switch (type) { - case DEBUG: - Logs.debug(Log.formatOutput(message, pos_infos)); - case WARNING: - Logs.warn(Log.formatOutput(message, pos_infos)); - case ERROR: - Logs.error(Log.formatOutput(message, pos_infos)); - default: - Logs.log(Log.formatOutput(message, pos_infos)); - } + EntryPoint.runInMainThread(() -> { + switch (type) { + case DEBUG: + Logs.debug(Log.formatOutput(message, pos_infos)); + case WARNING: + Logs.warn(Log.formatOutput(message, pos_infos)); + case ERROR: + Logs.error(Log.formatOutput(message, pos_infos)); + default: + Logs.log(Log.formatOutput(message, pos_infos)); + } + }); } - public static function messageFromPrintType(?type:PrintType = LOG):String{ + public static function messageFromPrintType(?type:PrintType = LOG):String { var messagePrefix:String; - switch (type){ + switch (type) { case DEBUG: messagePrefix = '${ansi_colors["green"]} DEBUG'; case WARNING: @@ -377,7 +381,7 @@ class CoolUtil { @author Leather128 **/ - public dynamic static function haxe_trace(v:Dynamic, ?infos:Null){} + public dynamic static function haxe_trace(v:Dynamic, ?infos:Null) {} public static inline function getCurrentVersion():String { return 'v' + Application.current.meta.get('version'); @@ -391,7 +395,7 @@ class CoolUtil { var difficultyExtension:String = difficulty == 'normal' ? '' : '-$difficulty'; var difficultyExtensionMeta:String = (difficulty == 'nightmare' || difficulty == 'erect') ? '-erect' : ''; - if(mix != null && Assets.exists('$difficultyExtensionMeta-$mix')){ + if (mix != null && Assets.exists('$difficultyExtensionMeta-$mix')) { difficultyExtensionMeta += '-$mix'; }