1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-04 22:04:29 +00:00

fix to song selection

This commit is contained in:
Cameron Taylor 2023-09-28 20:29:19 -04:00 committed by EliteMasterEric
parent 9446f268e0
commit 8009045e76
2 changed files with 32 additions and 31 deletions

View file

@ -22,6 +22,7 @@ import flixel.tweens.FlxEase;
import flixel.tweens.FlxTween; import flixel.tweens.FlxTween;
import flixel.util.FlxColor; import flixel.util.FlxColor;
import funkin.data.song.SongRegistry; import funkin.data.song.SongRegistry;
import funkin.data.level.LevelRegistry;
import flixel.util.FlxSpriteUtil; import flixel.util.FlxSpriteUtil;
import flixel.util.FlxTimer; import flixel.util.FlxTimer;
import funkin.Controls.Control; import funkin.Controls.Control;
@ -71,6 +72,7 @@ class FreeplayState extends MusicBeatSubState
var grpSongs:FlxTypedGroup<Alphabet>; var grpSongs:FlxTypedGroup<Alphabet>;
var grpCapsules:FlxTypedGroup<SongMenuItem>; var grpCapsules:FlxTypedGroup<SongMenuItem>;
var curCapsule:SongMenuItem;
var curPlaying:Bool = false; var curPlaying:Bool = false;
var dj:DJBoyfriend; var dj:DJBoyfriend;
@ -120,40 +122,29 @@ class FreeplayState extends MusicBeatSubState
addSong('Pyro', 'weekend1', 'darnell'); addSong('Pyro', 'weekend1', 'darnell');
#end #end
var initSonglist = CoolUtil.coolTextFile(Paths.txt('freeplaySonglist')); // var initSonglist = CoolUtil.coolTextFile(Paths.txt('freeplaySonglist'));
for (i in 0...initSonglist.length) // for (i in 0...initSonglist.length)
{ // {
songs.push(new FreeplaySongData(initSonglist[i], 'tutorial', 'gf')); // songs.push(new FreeplaySongData(initSonglist[i], 'tutorial', 'gf'));
} // }
if (FlxG.sound.music != null) if (FlxG.sound.music != null)
{ {
if (!FlxG.sound.music.playing) FlxG.sound.playMusic(Paths.music('freakyMenu/freakyMenu')); if (!FlxG.sound.music.playing) FlxG.sound.playMusic(Paths.music('freakyMenu/freakyMenu'));
} }
// if (StoryMenuState.weekUnlocked[2] || isDebug) // programmatically adds the songs via LevelRegistry and SongRegistry
addWeek(['Bopeebo', 'Fresh', 'Dadbattle'], 'week1', ['dad']); for (coolWeek in LevelRegistry.instance.listBaseGameLevelIds())
{
// if (StoryMenuState.weekUnlocked[2] || isDebug) for (coolSong in LevelRegistry.instance.parseEntryData(coolWeek).songs)
addWeek(['Spookeez', 'South', 'Monster'], 'week2', ['spooky', 'spooky', 'monster']); {
var metadata = SongRegistry.instance.parseEntryMetadata(coolSong);
// if (StoryMenuState.weekUnlocked[3] || isDebug) var char = metadata.playData.characters.opponent;
addWeek(['Pico', 'Philly-Nice', 'Blammed'], 'week3', ['pico']); var songName = metadata.songName;
addSong(songName, coolWeek, char);
// if (StoryMenuState.weekUnlocked[4] || isDebug) }
addWeek(['Satin-Panties', 'High', 'MILF'], 'week4', ['mom']); }
// if (StoryMenuState.weekUnlocked[5] || isDebug)
addWeek(['Cocoa', 'Eggnog', 'Winter-Horrorland'], 'week5', ['parents-christmas', 'parents-christmas', 'monster-christmas']);
// if (StoryMenuState.weekUnlocked[6] || isDebug)
addWeek(['Senpai', 'Roses', 'Thorns'], 'week6', ['senpai', 'senpai', 'spirit']);
// if (StoryMenuState.weekUnlocked[7] || isDebug)
addWeek(['Ugh', 'Guns', 'Stress'], 'week7', ['tankman']);
addWeek(["Darnell", "lit-up", "2hot", "blazin"], 'weekend1', ['darnell']);
// LOAD MUSIC // LOAD MUSIC
@ -593,7 +584,9 @@ class FreeplayState extends MusicBeatSubState
var funnyMenu:SongMenuItem = grpCapsules.recycle(SongMenuItem); var funnyMenu:SongMenuItem = grpCapsules.recycle(SongMenuItem);
funnyMenu.init(FlxG.width, 0, tempSongs[i].songName); funnyMenu.init(FlxG.width, 0, tempSongs[i].songName);
if (tempSongs[i].songCharacter != null) funnyMenu.setCharacter(tempSongs[i].songCharacter); if (tempSongs[i].songCharacter != null) funnyMenu.setCharacter(tempSongs[i].songCharacter);
funnyMenu.onConfirm = capsuleOnConfirmDefault; funnyMenu.onConfirm = function() {
capsuleOnConfirmDefault(funnyMenu);
};
funnyMenu.y = funnyMenu.intendedY(i + 1) + 10; funnyMenu.y = funnyMenu.intendedY(i + 1) + 10;
funnyMenu.targetPos.x = funnyMenu.x; funnyMenu.targetPos.x = funnyMenu.x;
funnyMenu.ID = i; funnyMenu.ID = i;
@ -954,7 +947,7 @@ class FreeplayState extends MusicBeatSubState
} }
} }
function capsuleOnConfirmDefault():Void function capsuleOnConfirmDefault(cap:SongMenuItem):Void
{ {
// var poop:String = songs[curSelected].songName.toLowerCase(); // var poop:String = songs[curSelected].songName.toLowerCase();
@ -969,7 +962,9 @@ class FreeplayState extends MusicBeatSubState
}*/ }*/
PlayStatePlaylist.isStoryMode = false; PlayStatePlaylist.isStoryMode = false;
var targetSong:Song = SongDataParser.fetchSong(songs[curSelected].songName.toLowerCase());
var songId:String = cap.songTitle.toLowerCase();
var targetSong:Song = SongRegistry.instance.fetchEntry(songId);
var targetDifficulty:String = switch (curDifficulty) var targetDifficulty:String = switch (curDifficulty)
{ {
case 0: case 0:

View file

@ -166,14 +166,20 @@ class SongMenuItem extends FlxSpriteGroup
{ {
var charPath:String = "freeplay/icons/"; var charPath:String = "freeplay/icons/";
trace(char);
switch (char) switch (char)
{ {
case "monster-christmas": case "monster-christmas":
charPath += "monsterpixel"; charPath += "monsterpixel";
case "mom": case "mom-car":
charPath += "mommypixel"; charPath += "mommypixel";
case "dad": case "dad":
charPath += "daddypixel"; charPath += "daddypixel";
case "darnell-blazin":
charPath += "darnellpixel";
case "senpai-angry":
charPath += "senpaipixel";
default: default:
charPath += char + "pixel"; charPath += char + "pixel";
} }