From 5599b8ca161f5f18a87eb3f5a6e1a5b59086a9c0 Mon Sep 17 00:00:00 2001 From: Yoshman29 <81191621+YoshiCrafter29@users.noreply.github.com> Date: Sat, 18 Feb 2023 16:45:49 +0100 Subject: [PATCH] low memory mode --- assets/data/stages/limo.hx | 8 ++- assets/data/stages/limo.xml | 59 +++++++++++-------- assets/data/stages/mall.xml | 10 +++- assets/data/stages/school.xml | 7 ++- assets/data/stages/tank.xml | 38 +++++++----- buildnumber.txt | 2 +- source/funkin/game/Stage.hx | 10 ++++ .../funkin/menus/credits/CreditsCodename.hx | 3 +- source/funkin/options/Options.hx | 3 +- source/funkin/options/OptionsMenu.hx | 6 +- source/funkin/options/OptionsScreen.hx | 2 +- ...haviourOptions.hx => AppearanceOptions.hx} | 6 +- 12 files changed, 99 insertions(+), 55 deletions(-) rename source/funkin/options/categories/{BehaviourOptions.hx => AppearanceOptions.hx} (79%) diff --git a/assets/data/stages/limo.hx b/assets/data/stages/limo.hx index 7dbcb89f..2aa3e280 100644 --- a/assets/data/stages/limo.hx +++ b/assets/data/stages/limo.hx @@ -10,8 +10,12 @@ function update(elapsed:Float) { } // back limo drive - for(e in [bgLimo, dancer1, dancer2, dancer3, dancer4, dancer5]) { - e.rotOffset.x = Math.sin(curBeatFloat / 4) * Math.cos(curBeatFloat / 16) * 85; + if (Options.lowMemoryMode) { + bgLimo.rotOffset.x = Math.sin(curBeatFloat / 4) * Math.cos(curBeatFloat / 16) * 85; + } else { + for(e in [bgLimo, dancer1, dancer2, dancer3, dancer4, dancer5]) { + e.rotOffset.x = Math.sin(curBeatFloat / 4) * Math.cos(curBeatFloat / 16) * 85; + } } } function beatHit(curBeat:Int) { diff --git a/assets/data/stages/limo.xml b/assets/data/stages/limo.xml index 0c3b9d69..c7a22080 100644 --- a/assets/data/stages/limo.xml +++ b/assets/data/stages/limo.xml @@ -4,36 +4,43 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + \ No newline at end of file diff --git a/assets/data/stages/mall.xml b/assets/data/stages/mall.xml index 119eda44..d0dc99c6 100644 --- a/assets/data/stages/mall.xml +++ b/assets/data/stages/mall.xml @@ -1,12 +1,18 @@ - + + + + - + + + + diff --git a/assets/data/stages/school.xml b/assets/data/stages/school.xml index 06a043b4..25387ec9 100644 --- a/assets/data/stages/school.xml +++ b/assets/data/stages/school.xml @@ -9,14 +9,17 @@ + - + + + diff --git a/assets/data/stages/tank.xml b/assets/data/stages/tank.xml index b76c4fc4..58d742e9 100644 --- a/assets/data/stages/tank.xml +++ b/assets/data/stages/tank.xml @@ -2,16 +2,23 @@ + - - - + + + + + - - - - - + + + + + + + + + @@ -21,10 +28,13 @@ - - - - - - + + + + + + + + + \ No newline at end of file diff --git a/buildnumber.txt b/buildnumber.txt index 74a75f5f..333ad531 100644 --- a/buildnumber.txt +++ b/buildnumber.txt @@ -1 +1 @@ -2253 \ No newline at end of file +2260 \ No newline at end of file diff --git a/source/funkin/game/Stage.hx b/source/funkin/game/Stage.hx index 76709338..e9514ac1 100644 --- a/source/funkin/game/Stage.hx +++ b/source/funkin/game/Stage.hx @@ -1,5 +1,6 @@ package funkin.game; +import funkin.options.Options; import flixel.FlxG; import flixel.FlxState; import flixel.FlxSprite; @@ -50,7 +51,16 @@ class Stage extends FlxBasic implements IBeatReceiver { if (spritesParentFolder.charAt(spritesParentFolder.length-1) != "/") spritesParentFolder = spritesParentFolder + "/"; } + var elems = []; for(node in stageXML.elements) { + if (node.name == "high-memory" && !Options.lowMemoryMode) + for(e in node.elements) + elems.push(e); + else + elems.push(node); + } + + for(node in elems) { var sprite:Dynamic = switch(node.name) { case "sprite" | "spr" | "sparrow": if (!node.has.sprite || !node.has.name || !node.has.x || !node.has.y) continue; diff --git a/source/funkin/menus/credits/CreditsCodename.hx b/source/funkin/menus/credits/CreditsCodename.hx index 2d705aee..5b80d55c 100644 --- a/source/funkin/menus/credits/CreditsCodename.hx +++ b/source/funkin/menus/credits/CreditsCodename.hx @@ -52,7 +52,7 @@ class CreditsCodename extends OptionsScreen { public override function createAdditional() { for(k=>c in contributors) { - var spr = new FlxSprite(0, k * 96); + var spr = new FlxSprite(0, (OptionsScreen.optionHeight * (k+0.5)) - 48); spr.antialiasing = true; spr.setUnstretchedGraphicSize(96, 96, false); spr.updateHitbox(); @@ -87,7 +87,6 @@ class CreditsCodename extends OptionsScreen { for(k=>spr in contributorsSprites) { var alpha = options[k]; spr.x = alpha.x - 10; - spr.y = alpha.y - ((alpha.height - spr.height) / 2); } } diff --git a/source/funkin/options/Options.hx b/source/funkin/options/Options.hx index f63d460a..62036d8f 100644 --- a/source/funkin/options/Options.hx +++ b/source/funkin/options/Options.hx @@ -25,9 +25,10 @@ class Options public static var antialiasing:Bool = true; public static var volume:Float = 1; public static var week6PixelPerfect:Bool = true; + public static var lowMemoryMode:Bool = false; public static var betaUpdates:Bool = false; public static var hitWindow:Float = 250; - public static var framerate:Int = 1000; + public static var framerate:Int = 120; public static var lastLoadedMod:String = null; diff --git a/source/funkin/options/OptionsMenu.hx b/source/funkin/options/OptionsMenu.hx index 13bc89e0..06b048b8 100644 --- a/source/funkin/options/OptionsMenu.hx +++ b/source/funkin/options/OptionsMenu.hx @@ -32,9 +32,9 @@ class OptionsMenu extends MusicBeatState { state: GameplayOptions }, { - name: 'Behaviour', - desc: 'Change Behaviour options such as Flashing menus...', - state: BehaviourOptions + name: 'Appearance', + desc: 'Change Appearance options such as Flashing menus...', + state: AppearanceOptions }, { name: 'Miscellaneous', diff --git a/source/funkin/options/OptionsScreen.hx b/source/funkin/options/OptionsScreen.hx index 97c7e2ff..9aad209d 100644 --- a/source/funkin/options/OptionsScreen.hx +++ b/source/funkin/options/OptionsScreen.hx @@ -93,7 +93,7 @@ class OptionsScreen extends MusicBeatState { FlxG.camera.scroll.y = lerp(FlxG.camera.scroll.y, scrollDest.y, 0.25); for(option in options) { - var angle = Math.cos((option.y + (optionHeight / 2) - (FlxG.camera.scroll.y + (FlxG.height / 2))) / FlxG.height * Math.PI); + var angle = Math.cos((option.y + (optionHeight / 2) - (FlxG.camera.scroll.y + (FlxG.height / 2))) / (FlxG.height * 1.25) * Math.PI); option.x = -50 + (Math.abs(angle) * 150); } diff --git a/source/funkin/options/categories/BehaviourOptions.hx b/source/funkin/options/categories/AppearanceOptions.hx similarity index 79% rename from source/funkin/options/categories/BehaviourOptions.hx rename to source/funkin/options/categories/AppearanceOptions.hx index a28fa36c..5d47d243 100644 --- a/source/funkin/options/categories/BehaviourOptions.hx +++ b/source/funkin/options/categories/AppearanceOptions.hx @@ -1,6 +1,6 @@ package funkin.options.categories; -class BehaviourOptions extends OptionsScreen { +class AppearanceOptions extends OptionsScreen { public override function create() { options = [ new Checkbox( @@ -15,6 +15,10 @@ class BehaviourOptions extends OptionsScreen { "Flashing Menu", "If unchecked, will disable menu flashing when you select an option in the Main Menu, and other flashs will be slower", "flashingMenu"), + new Checkbox( + "Low Memory Mode", + "If checked, will disable certain background elements in stages to reduce memory usage.", + "lowMemoryMode"), new Checkbox( "Auto Pause", "If checked, switching windows will pause the game",