Skip to content

Commit

Permalink
albumId loading fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ninjamuffin99 committed Oct 2, 2024
1 parent b329a6e commit 47284c2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
16 changes: 15 additions & 1 deletion source/funkin/play/song/Song.hx
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ class Song implements IPlayStateScriptedClass implements IRegistryEntry<SongMeta
* List the album IDs for each variation of the song.
* @return A map of variation IDs to album IDs.
*/
public function listAlbums():Map<String, String>
public function listAlbums(variation:String):Map<String, String>
{
var result:Map<String, String> = new Map<String, String>();

Expand All @@ -275,6 +275,20 @@ class Song implements IPlayStateScriptedClass implements IRegistryEntry<SongMeta
return result;
}

/**
* Input a difficulty ID and a variation ID, and get the album ID.
* @param diffId
* @param variation
* @return String
*/
public function getAlbumId(diffId:String, variation:String):String
{
var diff:Null<SongDifficulty> = getDifficulty(diffId, variation);
if (diff == null) return '';

return diff.album ?? '';
}

/**
* Populate the difficulty data from the provided metadata.
* Does not load chart data (that is triggered later when we want to play the song).
Expand Down
4 changes: 2 additions & 2 deletions source/funkin/ui/freeplay/FreeplayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ class FreeplayState extends MusicBeatSubState

albumRoll.playIntro();
var daSong = grpCapsules.members[curSelected].freeplayData;
albumRoll.albumId = daSong?.data.listAlbums().get(currentDifficulty);
albumRoll.albumId = daSong?.data.getAlbumId(currentDifficulty, currentVariation);

if (!fromCharSelect)
{
Expand Down Expand Up @@ -1788,7 +1788,7 @@ class FreeplayState extends MusicBeatSubState
}

// Set the album graphic and play the animation if relevant.
var newAlbumId:Null<String> = daSong?.data.listAlbums().get(currentVariation);
var newAlbumId:Null<String> = daSong?.data.getAlbumId(currentDifficulty, currentVariation);
if (albumRoll.albumId != newAlbumId)
{
albumRoll.albumId = newAlbumId;
Expand Down

0 comments on commit 47284c2

Please sign in to comment.