1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-05 06:14:36 +00:00

Fix a critical issue causing instrumental variations to not load on web.

This commit is contained in:
EliteMasterEric 2024-04-23 18:32:07 -04:00
parent def8fc6977
commit 374c042ad0
2 changed files with 10 additions and 5 deletions

View file

@ -609,28 +609,33 @@ class SongDifficulty
return cast events;
}
public function cacheInst(instrumental = ''):Void
public function getInstPath(instrumental = ''):String
{
if (characters != null)
{
if (instrumental != '' && characters.altInstrumentals.contains(instrumental))
{
var instId = '-$instrumental';
FlxG.sound.cache(Paths.inst(this.song.id, instId));
return Paths.inst(this.song.id, instId);
}
else
{
// Fallback to default instrumental.
var instId = (characters.instrumental ?? '') != '' ? '-${characters.instrumental}' : '';
FlxG.sound.cache(Paths.inst(this.song.id, instId));
return Paths.inst(this.song.id, instId);
}
}
else
{
FlxG.sound.cache(Paths.inst(this.song.id));
return Paths.inst(this.song.id);
}
}
public function cacheInst(instrumental = ''):Void
{
FlxG.sound.cache(getInstPath(instrumental));
}
public function playInst(volume:Float = 1.0, looped:Bool = false):Void
{
var suffix:String = (variation != null && variation != '' && variation != 'default') ? '-$variation' : '';

View file

@ -77,7 +77,7 @@ class LoadingState extends MusicBeatSubState
var difficulty:String = playParams.targetDifficulty ?? Constants.DEFAULT_DIFFICULTY;
var variation:String = playParams.targetVariation ?? Constants.DEFAULT_VARIATION;
var targetChart:SongDifficulty = playParams.targetSong?.getDifficulty(difficulty, variation);
var instPath:String = Paths.inst(targetChart.song.id);
var instPath:String = targetChart.getInstPath(playParams.targetInstrumental);
var voicesPaths:Array<String> = targetChart.buildVoiceList();
checkLoadSong(instPath);