diff --git a/src/funkin/data/save/Save.hx b/src/funkin/data/save/Save.hx index 7ef6cc4..3fd3f03 100644 --- a/src/funkin/data/save/Save.hx +++ b/src/funkin/data/save/Save.hx @@ -26,19 +26,16 @@ class Save */ public static final SAVE_VERSION_RULE:VersionRule = '1.x'; + /** + * The latest instance of this class. + */ public static var instance(get, never):Save; static var _instance:Null = null; - static function get_instance():Save - { - if (_instance == null) - { - return _instance = loadFromSaveSlot(1); - } - return _instance; - } - + /** + * The recently loaded save data. + */ public var data:SaveStructure = null; public function new(?data:SaveStructure) @@ -109,11 +106,19 @@ class Save */ public function setOptionValues():Void { - FlxG.updateFramerate = options.fps; - FlxG.drawFramerate = options.fps; + if (options.fps > FlxG.drawFramerate) + { + FlxG.updateFramerate = options.fps; + FlxG.drawFramerate = options.fps; + } + else + { + FlxG.drawFramerate = options.fps; + FlxG.updateFramerate = options.fps; + } if (Main.performanceStats != null) - Main.performanceStats.visible = options.fpsCounter; + Main.performanceStats.visible = options.showFps; FlxG.fullscreen = options.fullscreen; @@ -137,6 +142,9 @@ class Save FlxG.save.mergeData(data, true); } + /** + * @return Returns the default save options + */ public static function getDefault():SaveStructure { return { @@ -144,6 +152,7 @@ class Save volume: 1.0, mute: false, + progress: { storyMode: new Map(), highscores: { @@ -151,9 +160,11 @@ class Save freeplay: new Map(), } }, + options: { + // Graphics fps: 60, - fpsCounter: true, + showFps: true, fullscreen: false, antialiasing: true, flashingLights: true, @@ -162,6 +173,7 @@ class Save safeMode: true, devMode: false }, + controls: Controls.getDefaultMappings() }; } @@ -214,4 +226,14 @@ class Save return slot; } + + static function get_instance():Save + { + if (_instance == null) + { + return _instance = loadFromSaveSlot(1); + } + + return _instance; + } } diff --git a/src/funkin/data/save/SaveMigrator.hx b/src/funkin/data/save/SaveMigrator.hx index ddf2f59..e3d8b39 100644 --- a/src/funkin/data/save/SaveMigrator.hx +++ b/src/funkin/data/save/SaveMigrator.hx @@ -116,7 +116,7 @@ class SaveMigrator } newSave.options.fps = options.get('fps'); - newSave.options.fpsCounter = options.get('fpsCounter'); + newSave.options.showFps = options.get('fpsCounter'); newSave.options.fullscreen = options.get('fullscreen'); newSave.options.antialiasing = options.get('antialiasing'); newSave.options.flashingLights = options.get('flashingLights');