1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-25 16:24:40 +00:00

Make metadata file loading actually work

This commit is contained in:
EliteMasterEric 2023-07-02 16:17:25 -04:00
parent cddc50bbe5
commit 49ce962e34
3 changed files with 8 additions and 8 deletions

View file

@ -96,14 +96,14 @@ class Paths
return getPath('music/$key.$SOUND_EXT', MUSIC, library); 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 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'; 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'; return 'songs:assets/songs/${song.toLowerCase()}/Inst$suffix.$SOUND_EXT';
} }

View file

@ -12,6 +12,8 @@ import flixel.util.FlxTimer;
import funkin.audiovis.SpectogramSprite; import funkin.audiovis.SpectogramSprite;
import funkin.shaderslmfao.ColorSwap; import funkin.shaderslmfao.ColorSwap;
import funkin.shaderslmfao.LeftMaskShader; import funkin.shaderslmfao.LeftMaskShader;
import funkin.play.song.SongData.SongDataParser;
import funkin.play.song.SongData.SongMetadata;
import funkin.shaderslmfao.TitleOutline; import funkin.shaderslmfao.TitleOutline;
import funkin.ui.AtlasText; import funkin.ui.AtlasText;
import funkin.util.Constants; import funkin.util.Constants;
@ -233,7 +235,7 @@ class TitleState extends MusicBeatState
{ {
if (FlxG.sound.music == null || !FlxG.sound.music.playing) 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); Conductor.mapTimeChanges(freakyMenuMetadata.timeChanges);
FlxG.sound.playMusic(Paths.music('freakyMenu/freakyMenu'), 0); FlxG.sound.playMusic(Paths.music('freakyMenu/freakyMenu'), 0);

View file

@ -195,7 +195,7 @@ class SongDataParser
static function loadMusicMetadataFile(musicPath:String, variation:String = ''):String 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(); var rawJson:String = Assets.getText(musicMetadataFilePath).trim();
@ -395,8 +395,7 @@ abstract SongNoteData(RawSongNoteData)
public function get_stepTime():Float public function get_stepTime():Float
{ {
// TODO: Account for changes in BPM. return Conductor.getTimeInSteps(this.t);
return this.t / Conductor.stepCrochet;
} }
/** /**
@ -581,8 +580,7 @@ abstract SongEventData(RawSongEventData)
public function get_stepTime():Float public function get_stepTime():Float
{ {
// TODO: Account for changes in BPM. return Conductor.getTimeInSteps(this.t);
return this.t / Conductor.stepCrochet;
} }
public var event(get, set):String; public var event(get, set):String;