From 49ce962e3478e5ee3a01ceaa0545d8d22dc956e4 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Sun, 2 Jul 2023 16:17:25 -0400 Subject: [PATCH] Make metadata file loading actually work --- source/funkin/Paths.hx | 4 ++-- source/funkin/TitleState.hx | 4 +++- source/funkin/play/song/SongData.hx | 8 +++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/source/funkin/Paths.hx b/source/funkin/Paths.hx index 60dcfad38..3943d84ee 100644 --- a/source/funkin/Paths.hx +++ b/source/funkin/Paths.hx @@ -96,14 +96,14 @@ class Paths return getPath('music/$key.$SOUND_EXT', MUSIC, library); } - inline static public function voices(song:String, ?suffix:String) + inline static public function voices(song:String, ?suffix:String = '') { if (suffix == null) suffix = ""; // no suffix, for a sorta backwards compatibility with older-ish voice files return 'songs:assets/songs/${song.toLowerCase()}/Voices$suffix.$SOUND_EXT'; } - inline static public function inst(song:String, ?suffix:String) + inline static public function inst(song:String, ?suffix:String = '') { return 'songs:assets/songs/${song.toLowerCase()}/Inst$suffix.$SOUND_EXT'; } diff --git a/source/funkin/TitleState.hx b/source/funkin/TitleState.hx index e217cbec3..e0a08731b 100644 --- a/source/funkin/TitleState.hx +++ b/source/funkin/TitleState.hx @@ -12,6 +12,8 @@ import flixel.util.FlxTimer; import funkin.audiovis.SpectogramSprite; import funkin.shaderslmfao.ColorSwap; import funkin.shaderslmfao.LeftMaskShader; +import funkin.play.song.SongData.SongDataParser; +import funkin.play.song.SongData.SongMetadata; import funkin.shaderslmfao.TitleOutline; import funkin.ui.AtlasText; import funkin.util.Constants; @@ -233,7 +235,7 @@ class TitleState extends MusicBeatState { if (FlxG.sound.music == null || !FlxG.sound.music.playing) { - var freakyMenuMetadata:SongMetadata = SongData.parseMusicMetadata('freakyMenu'); + var freakyMenuMetadata:SongMetadata = SongDataParser.parseMusicMetadata('freakyMenu'); Conductor.mapTimeChanges(freakyMenuMetadata.timeChanges); FlxG.sound.playMusic(Paths.music('freakyMenu/freakyMenu'), 0); diff --git a/source/funkin/play/song/SongData.hx b/source/funkin/play/song/SongData.hx index 6058df766..9e3d56b77 100644 --- a/source/funkin/play/song/SongData.hx +++ b/source/funkin/play/song/SongData.hx @@ -195,7 +195,7 @@ class SongDataParser static function loadMusicMetadataFile(musicPath:String, variation:String = ''):String { - var musicMetadataFilePath:String = (variation != '') ? Paths.json('$MUSIC_DATA_PATH$musicPath/$musicPath-metadata-$variation') : Paths.json('$MUSIC_DATA_PATH$musicPath/$musicPath-metadata'); + var musicMetadataFilePath:String = (variation != '') ? Paths.file('$MUSIC_DATA_PATH$musicPath/$musicPath-metadata-$variation.json') : Paths.file('$MUSIC_DATA_PATH$musicPath/$musicPath-metadata.json'); var rawJson:String = Assets.getText(musicMetadataFilePath).trim(); @@ -395,8 +395,7 @@ abstract SongNoteData(RawSongNoteData) public function get_stepTime():Float { - // TODO: Account for changes in BPM. - return this.t / Conductor.stepCrochet; + return Conductor.getTimeInSteps(this.t); } /** @@ -581,8 +580,7 @@ abstract SongEventData(RawSongEventData) public function get_stepTime():Float { - // TODO: Account for changes in BPM. - return this.t / Conductor.stepCrochet; + return Conductor.getTimeInSteps(this.t); } public var event(get, set):String;