From ef7a3c1602314d9349b931a9284893dbedcbdb96 Mon Sep 17 00:00:00 2001 From: Yoshman29 <81191621+YoshiCrafter29@users.noreply.github.com> Date: Tue, 28 Mar 2023 23:23:18 +0200 Subject: [PATCH] fixes & dumb shit --- source/funkin/macros/ScriptsMacro.hx | 24 ++++---------------- source/funkin/mods/ModsFolderLibrary.hx | 1 - source/funkin/system/Conductor.hx | 6 ++--- source/funkin/system/GraphicCacheSprite.hx | 3 +-- source/funkin/system/MusicBeatState.hx | 3 ++- source/funkin/system/framerate/FlixelInfo.hx | 3 +++ source/funkin/utils/CoolUtil.hx | 7 ++++++ 7 files changed, 20 insertions(+), 27 deletions(-) diff --git a/source/funkin/macros/ScriptsMacro.hx b/source/funkin/macros/ScriptsMacro.hx index 30e02651..8bed21d1 100644 --- a/source/funkin/macros/ScriptsMacro.hx +++ b/source/funkin/macros/ScriptsMacro.hx @@ -10,26 +10,10 @@ import haxe.macro.Expr; */ class ScriptsMacro { public static function addAdditionalClasses() { - Compiler.include("flixel"); - Compiler.include("away3d"); - Compiler.include("flx3d"); - #if (sys && !web) - Compiler.include("sys"); - #end - - Compiler.include("DateTools"); - Compiler.include("EReg"); - Compiler.include("Lambda"); - Compiler.include("StringBuf"); - Compiler.include("haxe.crypto"); - Compiler.include("haxe.display"); - Compiler.include("haxe.exceptions"); - #if !web - Compiler.include("haxe.extern"); - #end - - Compiler.include("scripting"); - + for(inc in ["flixel", "away3d", "flx3d", "sys", "DateTools", "EReg", "Lambda", "StringBuf", "haxe.crypto", "haxe.display", "haxe.exceptions", "haxe.extern", "scripting"]) { + Compiler.include(inc); + } + // FOR ABSTRACTS Compiler.addGlobalMetadata('haxe.xml', '@:build(hscript.UsingHandler.build())'); } diff --git a/source/funkin/mods/ModsFolderLibrary.hx b/source/funkin/mods/ModsFolderLibrary.hx index b809d2f7..182a6e0d 100644 --- a/source/funkin/mods/ModsFolderLibrary.hx +++ b/source/funkin/mods/ModsFolderLibrary.hx @@ -52,7 +52,6 @@ class ModsFolderLibrary extends AssetLibrary implements ModsAssetLibrary { var path = getAssetPath(); editedTimes[id] = FileSystem.stat(path).mtime.getTime(); var e = Bytes.fromFile(path); - cachedBytes.set(id, e); return e; } diff --git a/source/funkin/system/Conductor.hx b/source/funkin/system/Conductor.hx index 1cd85181..1269623b 100644 --- a/source/funkin/system/Conductor.hx +++ b/source/funkin/system/Conductor.hx @@ -199,10 +199,10 @@ class Conductor var oldStep = curStep; var oldBeat = curBeat; var oldMeasure = curMeasure; - if (curStep != (curStep = Std.int(curStepFloat))) { + if (curStep != (curStep = CoolUtil.floorInt(curStepFloat))) { // updates step - __updateBeat = curBeat != (curBeat = Std.int(curBeatFloat)); - __updateMeasure = __updateBeat && (curMeasure != (curMeasure = Std.int(curMeasureFloat))); + __updateBeat = curBeat != (curBeat = CoolUtil.floorInt(curBeatFloat)); + __updateMeasure = __updateBeat && (curMeasure != (curMeasure = CoolUtil.floorInt(curMeasureFloat))); if (curStep > oldStep) { for(i in oldStep...curStep) { diff --git a/source/funkin/system/GraphicCacheSprite.hx b/source/funkin/system/GraphicCacheSprite.hx index b8d39f38..974e1267 100644 --- a/source/funkin/system/GraphicCacheSprite.hx +++ b/source/funkin/system/GraphicCacheSprite.hx @@ -17,7 +17,7 @@ class GraphicCacheSprite extends FlxSprite { public override function new() { super(); - alpha = 0.001; + alpha = 0.00001; } /** @@ -44,7 +44,6 @@ class GraphicCacheSprite extends FlxSprite { public override function draw() { while (nonRenderedCachedGraphics.length > 0) { - trace("DRAWING GRAPHIC - ", nonRenderedCachedGraphics[0].key); loadGraphic(nonRenderedCachedGraphics.shift()); drawComplex(FlxG.camera); } diff --git a/source/funkin/system/MusicBeatState.hx b/source/funkin/system/MusicBeatState.hx index cd968195..d3b42c24 100644 --- a/source/funkin/system/MusicBeatState.hx +++ b/source/funkin/system/MusicBeatState.hx @@ -1,5 +1,6 @@ package funkin.system; +import flixel.addons.transition.FlxTransitionableState; import funkin.system.framerate.Framerate; import funkin.scripting.DummyScript; import flixel.FlxState; @@ -11,7 +12,7 @@ import funkin.system.Conductor; import flixel.addons.ui.FlxUIState; import funkin.options.PlayerSettings; -class MusicBeatState extends FlxUIState implements IBeatReceiver +class MusicBeatState extends FlxTransitionableState implements IBeatReceiver { private var lastBeat:Float = 0; private var lastStep:Float = 0; diff --git a/source/funkin/system/framerate/FlixelInfo.hx b/source/funkin/system/framerate/FlixelInfo.hx index 4f2bc63b..f945ec78 100644 --- a/source/funkin/system/framerate/FlixelInfo.hx +++ b/source/funkin/system/framerate/FlixelInfo.hx @@ -7,6 +7,8 @@ class FlixelInfo extends FramerateCategory { public override function __enterFrame(t:Int) { if (alpha <= 0.05) return; + + @:privateAccess { var c:Int = 0; for(_ in FlxG.bitmap._cache.keys()) @@ -18,6 +20,7 @@ class FlixelInfo extends FramerateCategory { _text += '\nBitmaps Count: ${c}'; _text += '\nSounds Count: ${FlxG.sound.list.length}'; _text += '\nFlxG.game Childs Count: ${FlxG.game.numChildren}'; + // _text += '\nCached objects count: ${cachedObjects}'; } this.text.text = _text; diff --git a/source/funkin/utils/CoolUtil.hx b/source/funkin/utils/CoolUtil.hx index d96b3ed3..96dfa473 100644 --- a/source/funkin/utils/CoolUtil.hx +++ b/source/funkin/utils/CoolUtil.hx @@ -419,6 +419,13 @@ class CoolUtil public static inline function maxInt(p1:Int, p2:Int) return p1 < p2 ? p2 : p1; + + public static inline function floorInt(e:Float) { + var r = Std.int(e); + if (e < 0 && r != e) + r--; + return r; + } } enum abstract CoolSfx(Int) from Int {