1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-15 19:33:36 +00:00

week metadata bullshit for free[;ay

This commit is contained in:
Cameron Taylor 2021-02-24 20:52:59 -05:00
parent 000a01664d
commit eff2a19257

View file

@ -14,7 +14,7 @@ using StringTools;
class FreeplayState extends MusicBeatState class FreeplayState extends MusicBeatState
{ {
var songs:Array<String> = []; var songs:Array<SongMetadata> = [];
var selector:FlxText; var selector:FlxText;
var curSelected:Int = 0; var curSelected:Int = 0;
@ -30,7 +30,12 @@ class FreeplayState extends MusicBeatState
override function create() override function create()
{ {
songs = CoolUtil.coolTextFile(Paths.txt('freeplaySonglist')); var initSonglist = CoolUtil.coolTextFile(Paths.txt('freeplaySonglist'));
for (i in 0...initSonglist.length)
{
songs.push(new SongMetadata(initSonglist[i], 1));
}
/* /*
if (FlxG.sound.music != null) if (FlxG.sound.music != null)
@ -47,40 +52,19 @@ class FreeplayState extends MusicBeatState
#end #end
if (StoryMenuState.weekUnlocked[2] || isDebug) if (StoryMenuState.weekUnlocked[2] || isDebug)
{ addWeek(['Spookeez', 'South', 'Monster'], 2);
songs.push('Spookeez');
songs.push('South');
songs.push('Monster');
}
if (StoryMenuState.weekUnlocked[3] || isDebug) if (StoryMenuState.weekUnlocked[3] || isDebug)
{ addWeek(['Pico', 'Philly', 'Blammed'], 3);
songs.push('Pico');
songs.push('Philly');
songs.push('Blammed');
}
if (StoryMenuState.weekUnlocked[4] || isDebug) if (StoryMenuState.weekUnlocked[4] || isDebug)
{ addWeek(['Satin-Panties', 'High', 'Milf'], 4);
songs.push('Satin-Panties');
songs.push('High');
songs.push('Milf');
}
if (StoryMenuState.weekUnlocked[5] || isDebug) if (StoryMenuState.weekUnlocked[5] || isDebug)
{ addWeek(['Cocoa', 'Eggnog', 'Winter-Horrorland'], 5);
songs.push('Cocoa');
songs.push('Eggnog');
songs.push('Winter-Horrorland');
}
if (StoryMenuState.weekUnlocked[6] || isDebug) if (StoryMenuState.weekUnlocked[6] || isDebug)
{ addWeek(['Senpai', 'Roses', 'Thorns'], 6);
songs.push('Senpai');
songs.push('Roses');
songs.push('Thorns');
// songs.push('Winter-Horrorland');
}
// LOAD MUSIC // LOAD MUSIC
@ -94,7 +78,7 @@ class FreeplayState extends MusicBeatState
for (i in 0...songs.length) for (i in 0...songs.length)
{ {
var songText:Alphabet = new Alphabet(0, (70 * i) + 30, songs[i], true, false); var songText:Alphabet = new Alphabet(0, (70 * i) + 30, songs[i].songName, true, false);
songText.isMenuItem = true; songText.isMenuItem = true;
songText.targetY = i; songText.targetY = i;
grpSongs.add(songText); grpSongs.add(songText);
@ -151,6 +135,19 @@ class FreeplayState extends MusicBeatState
super.create(); super.create();
} }
public function addSong(songName:String, weekNum:Int)
{
songs.push(new SongMetadata(songName, weekNum));
}
public function addWeek(songs:Array<String>, weekNum:Int)
{
for (song in songs)
{
addSong(song, weekNum);
}
}
override function update(elapsed:Float) override function update(elapsed:Float)
{ {
super.update(elapsed); super.update(elapsed);
@ -192,17 +189,16 @@ class FreeplayState extends MusicBeatState
if (accepted) if (accepted)
{ {
var poop:String = Highscore.formatSong(songs[curSelected].toLowerCase(), curDifficulty); var poop:String = Highscore.formatSong(songs[curSelected].songName.toLowerCase(), curDifficulty);
trace(poop); trace(poop);
PlayState.SONG = Song.loadFromJson(poop, songs[curSelected].toLowerCase()); PlayState.SONG = Song.loadFromJson(poop, songs[curSelected].songName.toLowerCase());
PlayState.isStoryMode = false; PlayState.isStoryMode = false;
PlayState.storyDifficulty = curDifficulty; PlayState.storyDifficulty = curDifficulty;
// QUICK DUMB MATH PlayState.storyWeek = songs[curSelected].week;
// gets story week from currently selected, will be fuckie if things are NOT in order! trace('CUR WEEK' + PlayState.storyWeek);
PlayState.storyWeek = Math.ceil((curSelected + 1) / 3);
LoadingState.loadAndSwitchState(new PlayState()); LoadingState.loadAndSwitchState(new PlayState());
} }
} }
@ -217,7 +213,7 @@ class FreeplayState extends MusicBeatState
curDifficulty = 0; curDifficulty = 0;
#if !switch #if !switch
intendedScore = Highscore.getScore(songs[curSelected], curDifficulty); intendedScore = Highscore.getScore(songs[curSelected].songName, curDifficulty);
#end #end
switch (curDifficulty) switch (curDifficulty)
@ -250,12 +246,12 @@ class FreeplayState extends MusicBeatState
// selector.y = (70 * curSelected) + 30; // selector.y = (70 * curSelected) + 30;
#if !switch #if !switch
intendedScore = Highscore.getScore(songs[curSelected], curDifficulty); intendedScore = Highscore.getScore(songs[curSelected].songName, curDifficulty);
// lerpScore = 0; // lerpScore = 0;
#end #end
#if PRELOAD_ALL #if PRELOAD_ALL
FlxG.sound.playMusic(Paths.inst(songs[curSelected]), 0); FlxG.sound.playMusic(Paths.inst(songs[curSelected].songName), 0);
#end #end
var bullShit:Int = 0; var bullShit:Int = 0;
@ -276,3 +272,15 @@ class FreeplayState extends MusicBeatState
} }
} }
} }
class SongMetadata
{
public var songName:String = "";
public var week:Int = 0;
public function new(song:String, week:Int)
{
this.songName = song;
this.week = week;
}
}