Skip to content

Commit

Permalink
Fixed annoying week save data bug
Browse files Browse the repository at this point in the history
  • Loading branch information
AnimatingLegend committed Feb 16, 2024
1 parent 563a151 commit 5dbacf6
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 33 deletions.
8 changes: 0 additions & 8 deletions assets/preload/data/weekNames.txt

This file was deleted.

45 changes: 24 additions & 21 deletions source/FreeplayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class FreeplayState extends MusicBeatState
var isDebug:Bool = false;

#if debug
addSong('test', 5, 'bf-pixel');
isDebug = true;
#end

Expand All @@ -74,27 +75,29 @@ class FreeplayState extends MusicBeatState
FlxG.sound.playMusic(Paths.music('freakyMenu'));
}

// (Re)Adding the 'isDebug' function since weeks are locked :sob:
if (FlxG.save.data.weekUnlocked && StoryMenuState.weekUnlocked[1] || isDebug)
addWeek(['Bopeebo', 'Fresh', 'Dadbattle'], 1, ['dad']);

if (FlxG.save.data.weekUnlocked && StoryMenuState.weekUnlocked[2] || isDebug)
addWeek(['Spookeez', 'South', 'Monster'], 2, ['spooky', 'spooky', 'monster']);

if (FlxG.save.data.weekUnlocked && StoryMenuState.weekUnlocked[3] || isDebug)
addWeek(['Pico', 'Philly', 'Blammed'], 3, ['pico']);

if (FlxG.save.data.weekUnlocked && StoryMenuState.weekUnlocked[4] || isDebug)
addWeek(['Satin-Panties', 'High', 'Milf'], 4, ['mom']);

if (FlxG.save.data.weekUnlocked && StoryMenuState.weekUnlocked[5] || isDebug)
addWeek(['Cocoa', 'Eggnog', 'Winter-Horrorland'], 5, ['parents-christmas', 'parents-christmas', 'monster-christmas']);

if (FlxG.save.data.weekUnlocked && StoryMenuState.weekUnlocked[6] || isDebug)
addWeek(['Senpai', 'Roses', 'Thorns'], 6, ['senpai', 'senpai', 'spirit']);

if (FlxG.save.data.weekUnlocked && StoryMenuState.weekUnlocked[7] || isDebug)
addWeek(['Ugh', 'Guns', 'Stress'], 7, ['tankman']);
if (!FlxG.save.data.weekUnlocked)
{
if (StoryMenuState.weekUnlocked[1] || isDebug)
addWeek(['Bopeebo', 'Fresh', 'Dadbattle'], 1, ['dad']);

if (StoryMenuState.weekUnlocked[2] || isDebug)
addWeek(['Spookeez', 'South', 'Monster'], 2, ['spooky', 'spooky', 'monster']);

if (StoryMenuState.weekUnlocked[3] || isDebug)
addWeek(['Pico', 'Philly', 'Blammed'], 3, ['pico']);

if (StoryMenuState.weekUnlocked[4] || isDebug)
addWeek(['Satin-Panties', 'High', 'Milf'], 4, ['mom']);

if (StoryMenuState.weekUnlocked[5] || isDebug)
addWeek(['Cocoa', 'Eggnog', 'Winter-Horrorland'], 5, ['parents-christmas', 'parents-christmas', 'monster-christmas']);

if (StoryMenuState.weekUnlocked[6] || isDebug)
addWeek(['Senpai', 'Roses', 'Thorns'], 6, ['senpai', 'senpai', 'spirit']);

if (StoryMenuState.weekUnlocked[7] || isDebug)
addWeek(['Ugh', 'Guns', 'Stress'], 7, ['tankman']);
}


bg = new FlxSprite().loadGraphic(Paths.image('menuDesat'));
Expand Down
3 changes: 1 addition & 2 deletions source/MainMenuState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ class MainMenuState extends MusicBeatState
{
startExitState(new FreeplayState());
});
// asset only visible when week7 is either beaten, or unlocked.
if (FlxG.save.data.weekUnlocked[7] /**|| StoryMenuState.weekUnlocked[7]**/) {
if (!FlxG.save.data.weekUnlocked || StoryMenuState.weekUnlocked[7]) {
menuItems.createItem(null, null, "kickstarter", selectDonate, true);
} else {
menuItems.createItem(null, null, "donate", selectDonate, true);
Expand Down
13 changes: 11 additions & 2 deletions source/StoryMenuState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,16 @@ class StoryMenuState extends MusicBeatState
['tankman', 'bf', 'gf']
];

var weekNames:Array<String> = CoolUtil.coolTextFile(Paths.txt('weekNames'));
public static var weekNames:Array<String> = [
"Tutorial",
"Daddy Dearest",
"Spooky Month",
"PICO",
"MOMMY MUST MURDER",
"RED SNOW",
"Hating Simulator ft. Moawling",
"TANKMAN"
];

var txtWeekTitle:FlxText;

Expand Down Expand Up @@ -385,7 +394,7 @@ class StoryMenuState extends MusicBeatState
updateText();
}

function unlockWeeks():Array<Bool>
public static function unlockWeeks():Array<Bool>
{
var weeks:Array<Bool> = [];

Expand Down
5 changes: 5 additions & 0 deletions source/TitleState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ class TitleState extends MusicBeatState
VideoState.seenVideo = FlxG.save.data.seenVideo;
}

if (FlxG.save.data.weekUnlocked != null) {
StoryMenuState.weekUnlocked = StoryMenuState.unlockWeeks();
FlxG.save.flush();
}

#if FREEPLAY
FlxG.switchState(new FreeplayState());
#elseif CHARTING
Expand Down

0 comments on commit 5dbacf6

Please sign in to comment.