From fc83685b0f4e1c73eb219bcb3c418dadef17f4fc Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Wed, 28 May 2025 19:19:08 -0400 Subject: [PATCH] Remove a bunch of deprecation warnings --- project.hxp | 7 +++---- source/funkin/audio/FunkinSound.hx | 6 +++--- source/funkin/play/ResultState.hx | 16 +++++++-------- source/funkin/ui/PixelatedIcon.hx | 4 ++-- .../ui/charSelect/CharSelectSubState.hx | 20 ++++++++++--------- .../ui/charSelect/CharacterUnlockState.hx | 2 +- source/funkin/ui/debug/DebugMenuSubState.hx | 14 ++++++------- .../ui/debug/anim/DebugBoundingState.hx | 4 ++-- .../handlers/ChartEditorDialogHandler.hx | 2 +- .../ui/debug/stageeditor/StageEditorState.hx | 6 +++--- .../funkin/ui/freeplay/CapsuleOptionsMenu.hx | 10 +++++----- source/funkin/ui/freeplay/FreeplayFlames.hx | 4 ++-- source/funkin/ui/freeplay/FreeplayState.hx | 6 +++--- source/funkin/ui/title/TitleState.hx | 8 ++++---- source/funkin/util/MouseUtil.hx | 6 +++--- .../util/plugins/NewgroundsMedalPlugin.hx | 2 +- 16 files changed, 59 insertions(+), 58 deletions(-) diff --git a/project.hxp b/project.hxp index c1401a5ee..fb12393b5 100644 --- a/project.hxp +++ b/project.hxp @@ -650,11 +650,10 @@ class Project extends HXProject { // Should be false unless explicitly requested. GITHUB_BUILD.apply(this, false); - FEATURE_NEWGROUNDS.apply(this, false); EXCLUDE_ARMV7.apply(this, false); + UNLOCK_EVERYTHING.apply(this, false); FEATURE_COMPRESSED_TEXTURES.apply(this, false); FEATURE_GHOST_TAPPING.apply(this, false); - UNLOCK_EVERYTHING.apply(this, false); // Should be true unless explicitly requested. HARDCODED_CREDITS.apply(this, true); @@ -663,7 +662,6 @@ class Project extends HXProject { FEATURE_FUNKVIS.apply(this, true); FEATURE_PARTIAL_SOUNDS.apply(this, true); FEATURE_VIDEO_PLAYBACK.apply(this, true); - FEATURE_STAGE_EDITOR.apply(this, true); // Should be true on debug builds or if GITHUB_BUILD is enabled. FEATURE_DEBUG_FUNCTIONS.apply(this, isDebug() || GITHUB_BUILD.isEnabled(this)); @@ -673,7 +671,7 @@ class Project extends HXProject { // TODO: Look into ways to optimize logging (maybe by using a thread pool?) FEATURE_LOG_TRACE.apply(this, isDebug()); - FEATURE_NEWGROUNDS.apply(this, !isMobile()); + FEATURE_NEWGROUNDS.apply(this, true); FEATURE_NEWGROUNDS_DEBUG.apply(this, false); FEATURE_NEWGROUNDS_TESTING_MEDALS.apply(this, FEATURE_NEWGROUNDS.isEnabled(this) && FEATURE_DEBUG_FUNCTIONS.isEnabled(this)); FEATURE_NEWGROUNDS_AUTOLOGIN.apply(this, FEATURE_NEWGROUNDS.isEnabled(this) && isWeb()); @@ -702,6 +700,7 @@ class Project extends HXProject { // Should be true except on web and mobile builds. // Chart editor doesn't work there. FEATURE_CHART_EDITOR.apply(this, !(isWeb() || isMobile())); + FEATURE_STAGE_EDITOR.apply(this, !(isWeb() || isMobile())); // Should be true except on web and mobile builds. // Screenshots doesn't work there. diff --git a/source/funkin/audio/FunkinSound.hx b/source/funkin/audio/FunkinSound.hx index 91d2da75c..3c7d255eb 100644 --- a/source/funkin/audio/FunkinSound.hx +++ b/source/funkin/audio/FunkinSound.hx @@ -42,9 +42,9 @@ class FunkinSound extends FlxSound implements ICloneable if (_onVolumeChanged == null) { _onVolumeChanged = new FlxTypedSignalVoid>(); - FlxG.sound.volumeHandler = function(volume:Float) { + FlxG.sound.onVolumeChange.add(function(volume:Float) { _onVolumeChanged.dispatch(volume); - } + }); } return _onVolumeChanged; } @@ -475,7 +475,7 @@ class FunkinSound extends FlxSound implements ICloneable if (autoPlay) sound.play(); sound.volume = volume; - sound.group = FlxG.sound.defaultSoundGroup; + FlxG.sound.defaultSoundGroup.add(sound); sound.persist = persist; sound.important = important; diff --git a/source/funkin/play/ResultState.hx b/source/funkin/play/ResultState.hx index c02e0ff18..8584d63f3 100644 --- a/source/funkin/play/ResultState.hx +++ b/source/funkin/play/ResultState.hx @@ -276,12 +276,12 @@ class ResultState extends MusicBeatSubState if (animData.loopFrame != null) { - animation.animation.finishCallback = (_name:String) -> { + animation.animation.onFinish.add((_name:String) -> { if (animation != null) { animation.animation.play('idle', true, false, animData.loopFrame ?? 0); } - } + }); } // Hide until ready to play. @@ -349,7 +349,7 @@ class ResultState extends MusicBeatSubState new FlxTimer().start(36 / 24, _ -> { scorePopin.visible = true; scorePopin.animation.play("score"); - scorePopin.animation.finishCallback = anim -> {}; + scorePopin.animation.onFinish.add(anim -> {}); }); new FlxTimer().start(37 / 24, _ -> { @@ -379,7 +379,7 @@ class ResultState extends MusicBeatSubState { highscoreNew.visible = true; highscoreNew.animation.play("new"); - highscoreNew.animation.finishCallback = _ -> highscoreNew.animation.play("new", true, false, 16); + highscoreNew.animation.onFinish.add(_ -> highscoreNew.animation.play("new", true, false, 16)); } else { @@ -587,7 +587,7 @@ class ResultState extends MusicBeatSubState // ratingsPopin.animation.play("idle"); // ratingsPopin.visible = true; - ratingsPopin.animation.finishCallback = anim -> { + ratingsPopin.animation.onFinish.add(anim -> { // scorePopin.animation.play("score"); // scorePopin.visible = true; @@ -601,7 +601,7 @@ class ResultState extends MusicBeatSubState { highscoreNew.visible = false; } - }; + }); } refresh(); @@ -1017,7 +1017,7 @@ class ResultState extends MusicBeatSubState } else { - FlxG.switchState(targetState); + FlxG.switchState(() -> targetState); } } }); @@ -1039,7 +1039,7 @@ class ResultState extends MusicBeatSubState } else { - FlxG.switchState(targetState); + FlxG.switchState(() -> targetState); } } } diff --git a/source/funkin/ui/PixelatedIcon.hx b/source/funkin/ui/PixelatedIcon.hx index 8b580ec29..880ed7897 100644 --- a/source/funkin/ui/PixelatedIcon.hx +++ b/source/funkin/ui/PixelatedIcon.hx @@ -86,10 +86,10 @@ class PixelatedIcon extends FlxFilteredSprite this.animation.addByPrefix('confirm', 'confirm0', 10, false); this.animation.addByPrefix('confirm-hold', 'confirm-hold0', 10, true); - this.animation.finishCallback = function(name:String):Void { + this.animation.onFinish.add(function(name:String):Void { trace('Finish pixel animation: ${name}'); if (name == 'confirm') this.animation.play('confirm-hold'); - }; + }); this.animation.play('idle'); } diff --git a/source/funkin/ui/charSelect/CharSelectSubState.hx b/source/funkin/ui/charSelect/CharSelectSubState.hx index 90c233ada..a2e206beb 100644 --- a/source/funkin/ui/charSelect/CharSelectSubState.hx +++ b/source/funkin/ui/charSelect/CharSelectSubState.hx @@ -720,7 +720,7 @@ class CharSelectSubState extends MusicBeatSubState ease: FlxEase.backIn, onComplete: function(_) { funkin.ui.FullScreenScaleMode.enabled = true; - FlxG.switchState(FreeplayState.build( + FlxG.switchState(() -> FreeplayState.build( { { character: curChar, @@ -954,10 +954,10 @@ class CharSelectSubState extends MusicBeatSubState HapticUtil.vibrate(0, 0.2); - cursorDenied.animation.play("idle", true); - cursorDenied.animation.finishCallback = (_) -> { + cursorDenied.animation.play('idle', true); + cursorDenied.animation.onFinish.add((_) -> { cursorDenied.visible = false; - }; + }); } } @@ -1115,14 +1115,16 @@ class CharSelectSubState extends MusicBeatSubState memb.filters = selectedBizz; memb.scale.set(2.6, 2.6); } - if (pressedSelect && memb.animation.curAnim.name == "idle") memb.animation.play("confirm"); - if (autoFollow && !pressedSelect && memb.animation.curAnim.name != "idle") + if (pressedSelect && memb.animation.curAnim.name == 'idle') memb.animation.play('confirm'); + if (autoFollow && !pressedSelect && memb.animation.curAnim.name != 'idle') { memb.animation.play("confirm", false, true); - member.animation.finishCallback = (_) -> { - member.animation.play("idle"); - member.animation.finishCallback = null; + var onFinish:String->Void = null; + onFinish = (_) -> { + member.animation.play('idle'); + member.animation.onFinish.remove(onFinish); }; + member.animation.onFinish.add(onFinish); } } else diff --git a/source/funkin/ui/charSelect/CharacterUnlockState.hx b/source/funkin/ui/charSelect/CharacterUnlockState.hx index 72775a6f6..cade5f408 100644 --- a/source/funkin/ui/charSelect/CharacterUnlockState.hx +++ b/source/funkin/ui/charSelect/CharacterUnlockState.hx @@ -125,7 +125,7 @@ class CharacterUnlockState extends MusicBeatState // Fade to black, then switch state. FlxG.camera.fade(FlxColor.BLACK, 0.75, false, () -> { funkin.FunkinMemory.purgeCache(); - FlxG.switchState(nextState); + FlxG.switchState(() -> nextState); }); } } diff --git a/source/funkin/ui/debug/DebugMenuSubState.hx b/source/funkin/ui/debug/DebugMenuSubState.hx index 155b11f8f..ab946b214 100644 --- a/source/funkin/ui/debug/DebugMenuSubState.hx +++ b/source/funkin/ui/debug/DebugMenuSubState.hx @@ -97,37 +97,37 @@ class DebugMenuSubState extends MusicBeatSubState return item; } - function openChartEditor() + function openChartEditor():Void { FlxTransitionableState.skipNextTransIn = true; FlxG.switchState(() -> new ChartEditorState()); } - function openInputOffsetTesting() + function openInputOffsetTesting():Void { openSubState(new funkin.ui.debug.latency.LatencyState()); trace('Input Offset Testing'); } - function openCharSelect() + function openCharSelect():Void { - FlxG.switchState(new funkin.ui.charSelect.CharSelectSubState()); + FlxG.switchState(() -> new funkin.ui.charSelect.CharSelectSubState()); } - function openAnimationEditor() + function openAnimationEditor():Void { FlxG.switchState(() -> new funkin.ui.debug.anim.DebugBoundingState()); trace('Animation Editor'); } - function testStickers() + function testStickers():Void { openSubState(new funkin.ui.transition.stickers.StickerSubState({})); trace('opened stickers'); } - function openStageEditor() + function openStageEditor():Void { trace('Stage Editor'); } diff --git a/source/funkin/ui/debug/anim/DebugBoundingState.hx b/source/funkin/ui/debug/anim/DebugBoundingState.hx index cb5528e4d..73be8b208 100644 --- a/source/funkin/ui/debug/anim/DebugBoundingState.hx +++ b/source/funkin/ui/debug/anim/DebugBoundingState.hx @@ -68,11 +68,11 @@ class DebugBoundingState extends FlxState function get_haxeUIFocused():Bool { // get the screen position, according to the HUD camera, temp default to FlxG.camera juuust in case? - var hudMousePos:FlxPoint = FlxG.mouse.getScreenPosition(hudCam ?? FlxG.camera); + var hudMousePos:FlxPoint = FlxG.mouse.getViewPosition(hudCam ?? FlxG.camera); return Screen.instance.hasSolidComponentUnderPoint(hudMousePos.x, hudMousePos.y); } - override function create() + override function create():Void { Paths.setCurrentLevel('week1'); diff --git a/source/funkin/ui/debug/charting/handlers/ChartEditorDialogHandler.hx b/source/funkin/ui/debug/charting/handlers/ChartEditorDialogHandler.hx index 59d4286a7..f7784186b 100644 --- a/source/funkin/ui/debug/charting/handlers/ChartEditorDialogHandler.hx +++ b/source/funkin/ui/debug/charting/handlers/ChartEditorDialogHandler.hx @@ -1354,7 +1354,7 @@ class ChartEditorDialogHandler new FlxTimer().start(EPSILON, function(_) { for (handler in dropHandlers) { - if (handler.component.hitTest(FlxG.mouse.screenX, FlxG.mouse.screenY)) + if (handler.component.hitTest(FlxG.mouse.viewX, FlxG.mouse.viewY)) { handler.handler(path); return; diff --git a/source/funkin/ui/debug/stageeditor/StageEditorState.hx b/source/funkin/ui/debug/stageeditor/StageEditorState.hx index a1c56bb85..ae26f4517 100644 --- a/source/funkin/ui/debug/stageeditor/StageEditorState.hx +++ b/source/funkin/ui/debug/stageeditor/StageEditorState.hx @@ -729,8 +729,8 @@ class StageEditorState extends UIState bottomBarSelectText.text = infoSelection; // ui stuff - nameTxt.x = FlxG.mouse.getScreenPosition(camHUD).x; - nameTxt.y = FlxG.mouse.getScreenPosition(camHUD).y - nameTxt.height; + nameTxt.x = FlxG.mouse.getViewPosition(camHUD).x; + nameTxt.y = FlxG.mouse.getViewPosition(camHUD).y - nameTxt.height; // spriteMarker.visible = (moveMode == "assets" && selectedSprite != null); camMarker.visible = moveMode == "chars"; @@ -946,7 +946,7 @@ class StageEditorState extends UIState { if (FlxG.mouse.overlaps(spr) /*spr.overlapsPoint(FlxG.mouse.getWorldPosition(spr.camera), true, spr.camera) */ && Screen.instance != null - && !Screen.instance.hasSolidComponentUnderPoint(FlxG.mouse.screenX, FlxG.mouse.screenY) + && !Screen.instance.hasSolidComponentUnderPoint(FlxG.mouse.viewX, FlxG.mouse.viewY) && WindowManager.instance.windows.length == 0) // ik its stupid but maybe I have other cases soon (i did) return true; diff --git a/source/funkin/ui/freeplay/CapsuleOptionsMenu.hx b/source/funkin/ui/freeplay/CapsuleOptionsMenu.hx index 17aa785c9..bed80f7f8 100644 --- a/source/funkin/ui/freeplay/CapsuleOptionsMenu.hx +++ b/source/funkin/ui/freeplay/CapsuleOptionsMenu.hx @@ -58,9 +58,9 @@ class CapsuleOptionsMenu extends FlxSpriteGroup add(label); add(currentInstrumental); - capsuleMenuBG.animation.finishCallback = function(_) { + capsuleMenuBG.animation.onFinish.add(function(_) { capsuleMenuBG.animation.play('idle', true); - }; + }); capsuleMenuBG.animation.play('open', true); } @@ -73,7 +73,7 @@ class CapsuleOptionsMenu extends FlxSpriteGroup destroy(); return; } - var changedInst = false; + var changedInst:Bool = false; if (!busy) { @@ -128,10 +128,10 @@ class CapsuleOptionsMenu extends FlxSpriteGroup capsuleMenuBG.animation.play('open', true, true); if (leftArrow.moveShitDownTimer != null) leftArrow.moveShitDownTimer.cancel(); if (rightArrow.moveShitDownTimer != null) rightArrow.moveShitDownTimer.cancel(); - capsuleMenuBG.animation.finishCallback = function(_) { + capsuleMenuBG.animation.onFinish.add(function(_) { parent.cleanupCapsuleOptionsMenu(); queueDestroy = true; - }; + }); } /** diff --git a/source/funkin/ui/freeplay/FreeplayFlames.hx b/source/funkin/ui/freeplay/FreeplayFlames.hx index 6dda8d86e..e2e1b74d5 100644 --- a/source/funkin/ui/freeplay/FreeplayFlames.hx +++ b/source/funkin/ui/freeplay/FreeplayFlames.hx @@ -29,9 +29,9 @@ class FreeplayFlames extends FlxSpriteGroup flameCount = 0; // sets the loop... maybe better way to do this lol! - flame.animation.finishCallback = function(_) { + flame.animation.onFinish.add(function(_) { flame.animation.play("flame", true, false, 2); - }; + }); add(flame); } } diff --git a/source/funkin/ui/freeplay/FreeplayState.hx b/source/funkin/ui/freeplay/FreeplayState.hx index 890c6b5ad..ae9b7e3d6 100644 --- a/source/funkin/ui/freeplay/FreeplayState.hx +++ b/source/funkin/ui/freeplay/FreeplayState.hx @@ -1060,10 +1060,10 @@ class FreeplayState extends MusicBeatSubState sparks.animation.play('sparks', true); sparksADD.animation.play('sparks add', true); - sparks.animation.finishCallback = anim -> { + sparks.animation.onFinish.add(anim -> { sparks.visible = false; sparksADD.visible = false; - }; + }); } switch (fromResultsParams?.newRank) @@ -1297,7 +1297,7 @@ class FreeplayState extends MusicBeatSubState FlxG.sound.music?.fadeOut(0.9, 0); new FlxTimer().start(0.9, _ -> { FullScreenScaleMode.enabled = false; - FlxG.switchState(new funkin.ui.charSelect.CharSelectSubState()); + FlxG.switchState(() -> new funkin.ui.charSelect.CharSelectSubState()); }); for (grpSpr in exitMoversCharSel.keys()) { diff --git a/source/funkin/ui/title/TitleState.hx b/source/funkin/ui/title/TitleState.hx index cf16915dd..82838e4a1 100644 --- a/source/funkin/ui/title/TitleState.hx +++ b/source/funkin/ui/title/TitleState.hx @@ -316,10 +316,10 @@ class TitleState extends MusicBeatState function cheatCodeShit():Void { - if (controls.NOTE_DOWN_P || controls.UI_DOWN_P #if mobile || SwipeUtil.justSwipedUp #end) codePress(FlxDirectionFlags.DOWN); - if (controls.NOTE_UP_P || controls.UI_UP_P #if mobile || SwipeUtil.justSwipedDown #end) codePress(FlxDirectionFlags.UP); - if (controls.NOTE_LEFT_P || controls.UI_LEFT_P #if mobile || SwipeUtil.justSwipedLeft #end) codePress(FlxDirectionFlags.LEFT); - if (controls.NOTE_RIGHT_P || controls.UI_RIGHT_P #if mobile || SwipeUtil.justSwipedRight #end) codePress(FlxDirectionFlags.RIGHT); + if (controls.NOTE_DOWN_P || controls.UI_DOWN_P #if mobile || SwipeUtil.justSwipedUp #end) codePress(FlxDirectionFlags.DOWN.toInt()); + if (controls.NOTE_UP_P || controls.UI_UP_P #if mobile || SwipeUtil.justSwipedDown #end) codePress(FlxDirectionFlags.UP.toInt()); + if (controls.NOTE_LEFT_P || controls.UI_LEFT_P #if mobile || SwipeUtil.justSwipedLeft #end) codePress(FlxDirectionFlags.LEFT.toInt()); + if (controls.NOTE_RIGHT_P || controls.UI_RIGHT_P #if mobile || SwipeUtil.justSwipedRight #end) codePress(FlxDirectionFlags.RIGHT.toInt()); } function codePress(input:Int) diff --git a/source/funkin/util/MouseUtil.hx b/source/funkin/util/MouseUtil.hx index 5248437a8..fa498a9a5 100644 --- a/source/funkin/util/MouseUtil.hx +++ b/source/funkin/util/MouseUtil.hx @@ -28,13 +28,13 @@ class MouseUtil if (jusPres) { oldCamPos.set(target.x, target.y); - oldMousePos.set(FlxG.mouse.screenX, FlxG.mouse.screenY); + oldMousePos.set(FlxG.mouse.viewX, FlxG.mouse.viewY); } if (pressed) { - target.x = oldCamPos.x - (FlxG.mouse.screenX - oldMousePos.x); - target.y = oldCamPos.y - (FlxG.mouse.screenY - oldMousePos.y); + target.x = oldCamPos.x - (FlxG.mouse.viewX - oldMousePos.x); + target.y = oldCamPos.y - (FlxG.mouse.viewY - oldMousePos.y); } } diff --git a/source/funkin/util/plugins/NewgroundsMedalPlugin.hx b/source/funkin/util/plugins/NewgroundsMedalPlugin.hx index 1ce0b2454..eb34a4940 100644 --- a/source/funkin/util/plugins/NewgroundsMedalPlugin.hx +++ b/source/funkin/util/plugins/NewgroundsMedalPlugin.hx @@ -113,7 +113,7 @@ class NewgroundsMedalPlugin extends FlxTypedContainer { FlxG.plugins.drawOnTop = true; instance = new NewgroundsMedalPlugin(); - FlxG.plugins.add(instance); + FlxG.plugins.addPlugin(instance); instance.medal.anim.onComplete.add(function() { if (instance.funcs.length > 0)