diff --git a/Project.xml b/Project.xml
index 1cd68c07..1daf1e60 100644
--- a/Project.xml
+++ b/Project.xml
@@ -67,8 +67,7 @@
-
-
+
-
-
-
-
-
-
-
+
+
+
+
+
-
-
-
+
+
+
diff --git a/source/FPS_Mem.hx b/source/FPS_Mem.hx
index 609e198e..2c6decc4 100644
--- a/source/FPS_Mem.hx
+++ b/source/FPS_Mem.hx
@@ -52,7 +52,10 @@ class FPS_Mem extends TextField
static inline var memDiv:Float = 1 / 1024 / 1024 * 100;
static inline function formatBytes(bytes:Float):Float {
- return Math.round(bytes * memDiv) * 0.01;
+ return
+ #if web FlxMath.roundDecimal( #end
+ Math.round(bytes * memDiv) * 0.01
+ #if web , 2 ) #end ;
}
var memPeak:Float = 0;
diff --git a/source/Main.hx b/source/Main.hx
index 15998fa9..5cbc301f 100644
--- a/source/Main.hx
+++ b/source/Main.hx
@@ -83,7 +83,6 @@ class Main extends Sprite
private function init(?E:Event):Void
{
- #if web throw("no."); #end
if (hasEventListener(Event.ADDED_TO_STAGE))
removeEventListener(Event.ADDED_TO_STAGE, init);
diff --git a/source/funkin/objects/HealthIcon.hx b/source/funkin/objects/HealthIcon.hx
index b735fc37..5a254fbe 100644
--- a/source/funkin/objects/HealthIcon.hx
+++ b/source/funkin/objects/HealthIcon.hx
@@ -26,7 +26,7 @@ class HealthIcon extends FlxSpriteExt {
else antialiasing = Preferences.getPref('antialiasing');
var icon = "face";
- if (Paths.exists(Paths.png('icons/$char', null), IMAGE)) // Check if icon exists
+ if (Paths.exists(Paths.png('icons/$char'), IMAGE)) // Check if icon exists
icon = char;
loadImage('icons/$icon'); // Load first to get the resolution
diff --git a/source/funkin/sound/FlxFunkSound.hx b/source/funkin/sound/FlxFunkSound.hx
index b9b7112b..348273ba 100644
--- a/source/funkin/sound/FlxFunkSound.hx
+++ b/source/funkin/sound/FlxFunkSound.hx
@@ -16,7 +16,6 @@ import openfl.media.Sound;
@:access(lime.media.AudioSource)
@:access(openfl.media.SoundMixer)
@:access(openfl.media.Sound)
-@:access(flixel.FlxGame)
class FlxFunkSound extends FlxBasic
{
@:noCompletion
@@ -245,10 +244,10 @@ class FlxFunkSound extends FlxBasic
if (time != __lastTime) {
__lastTime = time;
- __lastTick = Main.game._total;
+ __lastTick = FlxG.game.ticks;
return time;
}
- return time + Main.game._total - __lastTick;
+ return time + FlxG.game.ticks - __lastTick;
}
}
\ No newline at end of file
diff --git a/source/funkin/states/LoadingState.hx b/source/funkin/states/LoadingState.hx
index 1fd4e4a8..2f97a437 100644
--- a/source/funkin/states/LoadingState.hx
+++ b/source/funkin/states/LoadingState.hx
@@ -10,7 +10,7 @@ class LoadingState extends MusicBeatState
public function init(stage:StageJson, characters:Array, song:String)
{
- #if !mobile
+ #if desktop
var addedAssets:Array = []; // Prevent repeating assets
stageAssets = Stage.getStageAssets(stage);
@@ -47,7 +47,7 @@ class LoadingState extends MusicBeatState
public function start()
{
- #if !mobile
+ #if desktop
var start = openfl.Lib.getTimer();
if (onStart != null)
diff --git a/source/funkin/states/menus/StoryMenuState.hx b/source/funkin/states/menus/StoryMenuState.hx
index 49ada77a..f7ce80c5 100644
--- a/source/funkin/states/menus/StoryMenuState.hx
+++ b/source/funkin/states/menus/StoryMenuState.hx
@@ -214,8 +214,10 @@ class StoryMenuState extends MusicBeatState {
rightArrow.playAnim(getKey('UI_RIGHT', PRESSED) ? 'press' : 'idle');
leftArrow.playAnim(getKey('UI_LEFT', PRESSED) ? 'press' : 'idle');
- if (getKey('UI_RIGHT', JUST_PRESSED)) changeDifficulty(1);
- if (getKey('UI_LEFT', JUST_PRESSED)) changeDifficulty(-1);
+ if (difficultySelectors.visible) {
+ if (getKey('UI_RIGHT', JUST_PRESSED)) changeDifficulty(1);
+ if (getKey('UI_LEFT', JUST_PRESSED)) changeDifficulty(-1);
+ }
}
if (getKey('ACCEPT', JUST_PRESSED)) {
diff --git a/source/funkin/util/Paths.hx b/source/funkin/util/Paths.hx
index 4d842171..542972e0 100644
--- a/source/funkin/util/Paths.hx
+++ b/source/funkin/util/Paths.hx
@@ -11,7 +11,7 @@ import sys.FileSystem;
class Paths
{
- inline public static var SOUND_EXT = #if web "mp3" #else "ogg" #end;
+ inline public static var SOUND_EXT = "ogg";
public static var currentLevel(default, set):String = "";
public static function set_currentLevel(value:String)
@@ -60,12 +60,16 @@ class Paths
}
#end
- if (library != null) {
- if (level != null) {
+ if (library != null)
+ {
+ if (level != null)
+ {
final levelPath = getLibraryPathForce(file, library, level);
if (exists(levelPath, type))
return levelPath;
- } else {
+ }
+ else
+ {
final libraryPath = getLibraryPath(file, library);
if (exists(libraryPath, type))
return libraryPath;
@@ -92,7 +96,10 @@ class Paths
inline static function getLibraryPathForce(file:String, library:String, ?level:String, root:String = "assets"):String
{
- return (level != null) ? '$library:$root/$library/$level/$file' : '$library:$root/$library/$file';
+ if (level != null)
+ return '$root/$library/$level/$file';
+
+ return '$root/$library/$file';
}
inline static public function getModPath(file:String):String
diff --git a/source/funkin/util/backend/AssetManager.hx b/source/funkin/util/backend/AssetManager.hx
index f67491a7..c34593b3 100644
--- a/source/funkin/util/backend/AssetManager.hx
+++ b/source/funkin/util/backend/AssetManager.hx
@@ -96,13 +96,15 @@ class Asset
return null;
}
- function __disposeSound(sound:Sound):Sound @:privateAccess {
+ function __disposeSound(sound:Sound):Sound @:privateAccess
+ {
+ #if !web
var buffer = sound.__buffer;
-
if (buffer != null) {
buffer.data.buffer = null;
buffer.data = null;
}
+ #end
sound.close();
@@ -288,9 +290,11 @@ class AssetManager
}
}
+ #if sys
while ((stageImages.length + charImages.length + songSounds.length) > 0) {
Sys.sleep(0.01);
}
+ #end
for (key => bitmap in bitmaps) {
__cacheFromBitmap(key, bitmap.bitmap, false, bitmap.lod);
diff --git a/source/funkin/util/modding/ModdingUtil.hx b/source/funkin/util/modding/ModdingUtil.hx
index 07be0126..52477094 100644
--- a/source/funkin/util/modding/ModdingUtil.hx
+++ b/source/funkin/util/modding/ModdingUtil.hx
@@ -57,7 +57,7 @@ class ModdingUtil {
public static function clearScripts():Void
{
FunkScript.globalVariables.clear();
- #if !mobile
+ #if DEV_TOOLS
if (Main.console != null)
Main.console.clear();
#end
@@ -207,10 +207,10 @@ class ModdingUtil {
inline public static function errorPrint(txt:String) print(txt, ERROR);
inline public static function warningPrint(txt:String) print(txt, WARNING);
inline public static function print(text:String, type:PrintType):Void {
- #if mobile
- trace("[" + type + "] " + text);
- #else
+ #if DEV_TOOLS
Main.console.print(text, type);
+ #else
+ trace("[" + type + "] " + text);
#end
}