From 3810662f9fd55400be6d96808256b3c5e94be4ab Mon Sep 17 00:00:00 2001 From: rich <87835336+richTrash21@users.noreply.github.com> Date: Tue, 14 May 2024 04:20:23 +0400 Subject: [PATCH 1/5] freeplay optimization --- source/funkin/ui/freeplay/FreeplayState.hx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/funkin/ui/freeplay/FreeplayState.hx b/source/funkin/ui/freeplay/FreeplayState.hx index 7b7543845..bdaa87ede 100644 --- a/source/funkin/ui/freeplay/FreeplayState.hx +++ b/source/funkin/ui/freeplay/FreeplayState.hx @@ -527,6 +527,9 @@ class FreeplayState extends MusicBeatSubState orangeBackShit.visible = true; alsoOrangeLOL.visible = true; grpTxtScrolls.visible = true; + + // render optimisation + _parentState.persistentDraw = false; }); generateSongList(null, false); @@ -985,6 +988,8 @@ class FreeplayState extends MusicBeatSubState { clearDaCache(daSong.songName); } + // remove and destroy freeplay camera + FlxG.cameras.remove(FlxG.cameras.list[FlxG.cameras.list.length - 1]); } function changeDiff(change:Int = 0, force:Bool = false):Void From 59e409f8e65387a6000710046670c6d8262ad203 Mon Sep 17 00:00:00 2001 From: rich <87835336+richTrash21@users.noreply.github.com> Date: Tue, 14 May 2024 04:30:36 +0400 Subject: [PATCH 2/5] ensure that only freeplay camera gets destroyed --- source/funkin/ui/freeplay/FreeplayState.hx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/funkin/ui/freeplay/FreeplayState.hx b/source/funkin/ui/freeplay/FreeplayState.hx index bdaa87ede..0a2674c8a 100644 --- a/source/funkin/ui/freeplay/FreeplayState.hx +++ b/source/funkin/ui/freeplay/FreeplayState.hx @@ -131,6 +131,7 @@ class FreeplayState extends MusicBeatSubState var exitMovers:ExitMoverData = new Map(); var stickerSubState:StickerSubState; + var funnyCam:FunkinCamera; public static var rememberedDifficulty:Null = Constants.DEFAULT_DIFFICULTY; public static var rememberedSongId:Null = 'tutorial'; @@ -535,7 +536,7 @@ class FreeplayState extends MusicBeatSubState generateSongList(null, false); // dedicated camera for the state so we don't need to fuk around with camera scrolls from the mainmenu / elsewhere - var funnyCam:FunkinCamera = new FunkinCamera('freeplayFunny', 0, 0, FlxG.width, FlxG.height); + funnyCam = new FunkinCamera('freeplayFunny', 0, 0, FlxG.width, FlxG.height); funnyCam.bgColor = FlxColor.TRANSPARENT; FlxG.cameras.add(funnyCam, false); @@ -989,7 +990,7 @@ class FreeplayState extends MusicBeatSubState clearDaCache(daSong.songName); } // remove and destroy freeplay camera - FlxG.cameras.remove(FlxG.cameras.list[FlxG.cameras.list.length - 1]); + FlxG.cameras.remove(funnyCam); } function changeDiff(change:Int = 0, force:Bool = false):Void From 1c352e4e114ed997f842d638ad0483b5a5554cae Mon Sep 17 00:00:00 2001 From: richTrash21 Date: Thu, 23 May 2024 21:50:11 +0400 Subject: [PATCH 3/5] simplify freeplay camera --- source/funkin/ui/freeplay/FreeplayState.hx | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/source/funkin/ui/freeplay/FreeplayState.hx b/source/funkin/ui/freeplay/FreeplayState.hx index 2f8231bb0..2dea92352 100644 --- a/source/funkin/ui/freeplay/FreeplayState.hx +++ b/source/funkin/ui/freeplay/FreeplayState.hx @@ -156,6 +156,12 @@ class FreeplayState extends MusicBeatSubState FlxTransitionableState.skipNextTransIn = true; + // dedicated camera for the state so we don't need to fuk around with camera scrolls from the mainmenu / elsewhere + funnyCam = new FunkinCamera('freeplayFunny', 0, 0, FlxG.width, FlxG.height); + funnyCam.bgColor = FlxColor.TRANSPARENT; + FlxG.cameras.add(funnyCam, false); + this.cameras = [funnyCam]; + if (stickerSubState != null) { this.persistentUpdate = true; @@ -534,15 +540,6 @@ class FreeplayState extends MusicBeatSubState }); generateSongList(null, false); - - // dedicated camera for the state so we don't need to fuk around with camera scrolls from the mainmenu / elsewhere - funnyCam = new FunkinCamera('freeplayFunny', 0, 0, FlxG.width, FlxG.height); - funnyCam.bgColor = FlxColor.TRANSPARENT; - FlxG.cameras.add(funnyCam, false); - - forEach(function(bs) { - bs.cameras = [funnyCam]; - }); } var currentFilter:SongFilter = null; From 4ca30a571d46607c7fa3454bd00c7e16977eb10f Mon Sep 17 00:00:00 2001 From: richTrash21 Date: Thu, 23 May 2024 21:52:28 +0400 Subject: [PATCH 4/5] safety --- source/funkin/ui/freeplay/FreeplayState.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/ui/freeplay/FreeplayState.hx b/source/funkin/ui/freeplay/FreeplayState.hx index 2dea92352..4d1ad7019 100644 --- a/source/funkin/ui/freeplay/FreeplayState.hx +++ b/source/funkin/ui/freeplay/FreeplayState.hx @@ -536,7 +536,7 @@ class FreeplayState extends MusicBeatSubState grpTxtScrolls.visible = true; // render optimisation - _parentState.persistentDraw = false; + if (_parentState != null) _parentState.persistentDraw = false; }); generateSongList(null, false); From 2e4b94d528ca5bd5d369c264424be89bc4f3226d Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Fri, 7 Jun 2024 21:20:04 -0400 Subject: [PATCH 5/5] Fix additional merge conflicts --- source/funkin/ui/freeplay/FreeplayState.hx | 1 - 1 file changed, 1 deletion(-) diff --git a/source/funkin/ui/freeplay/FreeplayState.hx b/source/funkin/ui/freeplay/FreeplayState.hx index 576d44c94..5e07fb396 100644 --- a/source/funkin/ui/freeplay/FreeplayState.hx +++ b/source/funkin/ui/freeplay/FreeplayState.hx @@ -172,7 +172,6 @@ class FreeplayState extends MusicBeatSubState var exitMovers:ExitMoverData = new Map(); var stickerSubState:StickerSubState; - var funnyCam:FunkinCamera; public static var rememberedDifficulty:Null = Constants.DEFAULT_DIFFICULTY; public static var rememberedSongId:Null = 'tutorial';