mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2025-11-25 13:45:49 +00:00
Fix bug where Pico would become locked on every game restart.
This commit is contained in:
parent
688abb5571
commit
d5c7e4ffdb
|
|
@ -17,7 +17,7 @@ import thx.semver.Version;
|
||||||
@:nullSafety
|
@:nullSafety
|
||||||
class Save
|
class Save
|
||||||
{
|
{
|
||||||
public static final SAVE_DATA_VERSION:thx.semver.Version = "2.0.5";
|
public static final SAVE_DATA_VERSION:thx.semver.Version = "2.0.4";
|
||||||
public static final SAVE_DATA_VERSION_RULE:thx.semver.VersionRule = "2.0.x";
|
public static final SAVE_DATA_VERSION_RULE:thx.semver.VersionRule = "2.0.x";
|
||||||
|
|
||||||
// We load this version's saves from a new save path, to maintain SOME level of backwards compatibility.
|
// We load this version's saves from a new save path, to maintain SOME level of backwards compatibility.
|
||||||
|
|
@ -34,19 +34,19 @@ class Save
|
||||||
{
|
{
|
||||||
if (_instance == null)
|
if (_instance == null)
|
||||||
{
|
{
|
||||||
_instance = new Save(FlxG.save.data);
|
return _instance = load();
|
||||||
}
|
}
|
||||||
return _instance;
|
return _instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
var data:RawSaveData;
|
var data:RawSaveData;
|
||||||
|
|
||||||
public static function load():Void
|
public static function load():Save
|
||||||
{
|
{
|
||||||
trace("[SAVE] Loading save...");
|
trace("[SAVE] Loading save...");
|
||||||
|
|
||||||
// Bind save data.
|
// Bind save data.
|
||||||
loadFromSlot(1);
|
return loadFromSlot(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -65,7 +65,9 @@ class Save
|
||||||
public static function getDefault():RawSaveData
|
public static function getDefault():RawSaveData
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
version: Save.SAVE_DATA_VERSION,
|
// Version number is an abstract(Array) internally.
|
||||||
|
// This means it copies by reference, so merging save data overides the version number lol.
|
||||||
|
version: thx.Dynamics.clone(Save.SAVE_DATA_VERSION),
|
||||||
|
|
||||||
volume: 1.0,
|
volume: 1.0,
|
||||||
mute: false,
|
mute: false,
|
||||||
|
|
@ -433,7 +435,9 @@ class Save
|
||||||
{
|
{
|
||||||
if (!data.unlocks.charactersSeen.contains(character))
|
if (!data.unlocks.charactersSeen.contains(character))
|
||||||
{
|
{
|
||||||
|
trace('Character seen: ' + character);
|
||||||
data.unlocks.charactersSeen.push(character);
|
data.unlocks.charactersSeen.push(character);
|
||||||
|
trace('New characters seen list: ' + data.unlocks.charactersSeen);
|
||||||
flush();
|
flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -832,7 +836,7 @@ class Save
|
||||||
* If you set slot to `2`, it will load an independe
|
* If you set slot to `2`, it will load an independe
|
||||||
* @param slot
|
* @param slot
|
||||||
*/
|
*/
|
||||||
static function loadFromSlot(slot:Int):Void
|
static function loadFromSlot(slot:Int):Save
|
||||||
{
|
{
|
||||||
trace("[SAVE] Loading save from slot " + slot + "...");
|
trace("[SAVE] Loading save from slot " + slot + "...");
|
||||||
|
|
||||||
|
|
@ -850,12 +854,14 @@ class Save
|
||||||
trace('[SAVE] Found legacy save data, converting...');
|
trace('[SAVE] Found legacy save data, converting...');
|
||||||
var gameSave = SaveDataMigrator.migrateFromLegacy(legacySaveData);
|
var gameSave = SaveDataMigrator.migrateFromLegacy(legacySaveData);
|
||||||
FlxG.save.mergeData(gameSave.data, true);
|
FlxG.save.mergeData(gameSave.data, true);
|
||||||
|
return gameSave;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
trace('[SAVE] No legacy save data found.');
|
trace('[SAVE] No legacy save data found.');
|
||||||
var gameSave = new Save();
|
var gameSave = new Save();
|
||||||
FlxG.save.mergeData(gameSave.data, true);
|
FlxG.save.mergeData(gameSave.data, true);
|
||||||
|
return gameSave;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -863,6 +869,8 @@ class Save
|
||||||
trace('[SAVE] Found existing save data.');
|
trace('[SAVE] Found existing save data.');
|
||||||
var gameSave = SaveDataMigrator.migrate(FlxG.save.data);
|
var gameSave = SaveDataMigrator.migrate(FlxG.save.data);
|
||||||
FlxG.save.mergeData(gameSave.data, true);
|
FlxG.save.mergeData(gameSave.data, true);
|
||||||
|
|
||||||
|
return gameSave;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [2.0.4] - 2024-09-12
|
||||||
|
Note to self: Only update to 2.1.0 when migration is needed.
|
||||||
|
### Added
|
||||||
|
- `unlocks.charactersSeen:Array<String>` to `Save`
|
||||||
|
- `unlocks.oldChar:Bool` to `Save`
|
||||||
|
|
||||||
## [2.0.5] - 2024-05-21
|
## [2.0.5] - 2024-05-21
|
||||||
### Fixed
|
### Fixed
|
||||||
- Resolved an issue where HTML5 wouldn't store the semantic version properly, causing the game to fail to load the save.
|
- Resolved an issue where HTML5 wouldn't store the semantic version properly, causing the game to fail to load the save.
|
||||||
|
|
|
||||||
|
|
@ -356,7 +356,7 @@ class MainMenuState extends MusicBeatState
|
||||||
#if FEATURE_DEBUG_FUNCTIONS
|
#if FEATURE_DEBUG_FUNCTIONS
|
||||||
// Ctrl+Alt+Shift+P = Character Unlock screen
|
// Ctrl+Alt+Shift+P = Character Unlock screen
|
||||||
// Ctrl+Alt+Shift+W = Meet requirements for Pico Unlock
|
// Ctrl+Alt+Shift+W = Meet requirements for Pico Unlock
|
||||||
// Ctrl+Alt+Shift+L = Revoke requirements for Pico Unlock
|
// Ctrl+Alt+Shift+M = Revoke requirements for Pico Unlock
|
||||||
// Ctrl+Alt+Shift+R = Score/Rank conflict test
|
// Ctrl+Alt+Shift+R = Score/Rank conflict test
|
||||||
// Ctrl+Alt+Shift+N = Mark all characters as not seen
|
// Ctrl+Alt+Shift+N = Mark all characters as not seen
|
||||||
// Ctrl+Alt+Shift+E = Dump save data
|
// Ctrl+Alt+Shift+E = Dump save data
|
||||||
|
|
@ -369,7 +369,7 @@ class MainMenuState extends MusicBeatState
|
||||||
if (FlxG.keys.pressed.CONTROL && FlxG.keys.pressed.ALT && FlxG.keys.pressed.SHIFT && FlxG.keys.justPressed.W)
|
if (FlxG.keys.pressed.CONTROL && FlxG.keys.pressed.ALT && FlxG.keys.pressed.SHIFT && FlxG.keys.justPressed.W)
|
||||||
{
|
{
|
||||||
FunkinSound.playOnce(Paths.sound('confirmMenu'));
|
FunkinSound.playOnce(Paths.sound('confirmMenu'));
|
||||||
// Give the user a score of 1 point on Weekend 1 story mode.
|
// Give the user a score of 1 point on Weekend 1 story mode (Easy difficulty).
|
||||||
// This makes the level count as cleared and displays the songs in Freeplay.
|
// This makes the level count as cleared and displays the songs in Freeplay.
|
||||||
funkin.save.Save.instance.setLevelScore('weekend1', 'easy',
|
funkin.save.Save.instance.setLevelScore('weekend1', 'easy',
|
||||||
{
|
{
|
||||||
|
|
@ -389,14 +389,16 @@ class MainMenuState extends MusicBeatState
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FlxG.keys.pressed.CONTROL && FlxG.keys.pressed.ALT && FlxG.keys.pressed.SHIFT && FlxG.keys.justPressed.L)
|
if (FlxG.keys.pressed.CONTROL && FlxG.keys.pressed.ALT && FlxG.keys.pressed.SHIFT && FlxG.keys.justPressed.M)
|
||||||
{
|
{
|
||||||
FunkinSound.playOnce(Paths.sound('confirmMenu'));
|
FunkinSound.playOnce(Paths.sound('confirmMenu'));
|
||||||
// Give the user a score of 0 points on Weekend 1 story mode.
|
// Give the user a score of 0 points on Weekend 1 story mode (all difficulties).
|
||||||
// This makes the level count as uncleared and no longer displays the songs in Freeplay.
|
// This makes the level count as uncleared and no longer displays the songs in Freeplay.
|
||||||
funkin.save.Save.instance.setLevelScore('weekend1', 'easy',
|
for (diff in ['easy', 'normal', 'hard'])
|
||||||
{
|
{
|
||||||
score: 1,
|
funkin.save.Save.instance.setLevelScore('weekend1', diff,
|
||||||
|
{
|
||||||
|
score: 0,
|
||||||
tallies:
|
tallies:
|
||||||
{
|
{
|
||||||
sick: 0,
|
sick: 0,
|
||||||
|
|
@ -411,6 +413,7 @@ class MainMenuState extends MusicBeatState
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (FlxG.keys.pressed.CONTROL && FlxG.keys.pressed.ALT && FlxG.keys.pressed.SHIFT && FlxG.keys.justPressed.R)
|
if (FlxG.keys.pressed.CONTROL && FlxG.keys.pressed.ALT && FlxG.keys.pressed.SHIFT && FlxG.keys.justPressed.R)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -273,11 +273,6 @@ class TitleState extends MusicBeatState
|
||||||
}
|
}
|
||||||
#end
|
#end
|
||||||
|
|
||||||
if (Save.instance.charactersSeen.contains("pico"))
|
|
||||||
{
|
|
||||||
Save.instance.charactersSeen.remove("pico");
|
|
||||||
Save.instance.oldChar = false;
|
|
||||||
}
|
|
||||||
Conductor.instance.update();
|
Conductor.instance.update();
|
||||||
|
|
||||||
/* if (FlxG.onMobile)
|
/* if (FlxG.onMobile)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue