1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-12-23 21:56:46 +00:00

Play song IDs based on the chart file's "instrumental" field, not the variation ID.

This commit is contained in:
EliteMasterEric 2024-06-06 21:38:00 -04:00
parent e2fbeeb13e
commit ca345e6c4f
3 changed files with 24 additions and 7 deletions

View file

@ -175,6 +175,12 @@ class PlayState extends MusicBeatSubState
*/
public var currentVariation:String = Constants.DEFAULT_VARIATION;
/**
* The currently selected instrumental ID.
* @default `''`
*/
public var currentInstrumental:String = '';
/**
* The currently active Stage. This is the object containing all the props.
*/
@ -603,6 +609,7 @@ class PlayState extends MusicBeatSubState
currentSong = params.targetSong;
if (params.targetDifficulty != null) currentDifficulty = params.targetDifficulty;
if (params.targetVariation != null) currentVariation = params.targetVariation;
if (params.targetInstrumental != null) currentInstrumental = params.targetInstrumental;
isPracticeMode = params.practiceMode ?? false;
isBotPlayMode = params.botPlayMode ?? false;
isMinimalMode = params.minimalMode ?? false;
@ -1968,7 +1975,7 @@ class PlayState extends MusicBeatSubState
if (!overrideMusic && !isGamePaused && currentChart != null)
{
currentChart.playInst(1.0, false);
currentChart.playInst(1.0, currentInstrumental, false);
}
if (FlxG.sound.music == null)

View file

@ -682,9 +682,9 @@ class SongDifficulty
FlxG.sound.cache(getInstPath(instrumental));
}
public function playInst(volume:Float = 1.0, looped:Bool = false):Void
public function playInst(volume:Float = 1.0, instId:String = '', looped:Bool = false):Void
{
var suffix:String = (variation != null && variation != '' && variation != 'default') ? '-$variation' : '';
var suffix:String = (instId != '') ? '-$instId' : '';
FlxG.sound.music = FunkinSound.load(Paths.inst(this.song.id, suffix), volume, looped, false, true);

View file

@ -1726,11 +1726,20 @@ class FreeplayState extends MusicBeatSubState
FlxG.log.warn('WARN: could not find song with id (${cap.songData.songId})');
return;
}
var targetDifficulty:String = currentDifficulty;
var targetVariation:String = targetSong.getFirstValidVariation(targetDifficulty);
var targetDifficultyId:String = currentDifficulty;
var targetVariation:String = targetSong.getFirstValidVariation(targetDifficultyId);
PlayStatePlaylist.campaignId = cap.songData.levelId;
var targetDifficulty:SongDifficulty = targetSong.getDifficulty(targetDifficultyId, targetVariation);
if (targetDifficulty == null)
{
FlxG.log.warn('WARN: could not find difficulty with id (${targetDifficultyId})');
return;
}
// TODO: Change this with alternate instrumentals
var targetInstId:String = targetDifficulty.characters.instrumental;
// Visual and audio effects.
FunkinSound.playOnce(Paths.sound('confirmMenu'));
dj.confirm();
@ -1779,8 +1788,9 @@ class FreeplayState extends MusicBeatSubState
LoadingState.loadPlayState(
{
targetSong: targetSong,
targetDifficulty: targetDifficulty,
targetDifficulty: targetDifficultyId,
targetVariation: targetVariation,
targetInstrumental: targetInstId,
practiceMode: false,
minimalMode: false,