diff --git a/Project.xml b/Project.xml index abbb6a2..f565a81 100644 --- a/Project.xml +++ b/Project.xml @@ -3,7 +3,7 @@ - + diff --git a/assets/preload/locale/en-US/textList.txt b/assets/preload/locale/en-US/textList.txt index 9ad6c4a..4f2e0c0 100644 --- a/assets/preload/locale/en-US/textList.txt +++ b/assets/preload/locale/en-US/textList.txt @@ -90,6 +90,7 @@ option_disable_fps==Disable FPS & Memory Counter option_enable_fps==Enable FPS & Memory Counter option_songBarType_ShowTime==Song Bar Type: Time Left +option_songBarType_ShowTimeOld==Song Bar Type: Time Left Old option_songBarType_SongName==Song Bar Type: Show Song Name option_enable_compat==Compatibility Mode ON diff --git a/mods/test/data/charts/test-settings.json b/mods/test/data/charts/test-settings.json index 2ca1e81..bfc5b21 100644 --- a/mods/test/data/charts/test-settings.json +++ b/mods/test/data/charts/test-settings.json @@ -6,5 +6,6 @@ "intro": "", "windowName": "", "healthDrain": "", + "healthBarBG": "", "exploitationEffect": false } \ No newline at end of file diff --git a/mods/test/images/ui/testBar.png b/mods/test/images/ui/testBar.png new file mode 100644 index 0000000..4b3b400 Binary files /dev/null and b/mods/test/images/ui/testBar.png differ diff --git a/source/FreeplayState.hx b/source/FreeplayState.hx index 9aa67ca..c613005 100644 --- a/source/FreeplayState.hx +++ b/source/FreeplayState.hx @@ -671,6 +671,11 @@ class FreeplayState extends MusicBeatState changeDiff(1); if (controls.LEFT_P) changeDiff(-1); + if(FlxG.keys.justPressed.M) { + #if PRELOAD_ALL + FlxG.sound.playMusic(Paths.inst(songs[curSelected].songName), 0); + #end + } if (controls.BACK && canInteract) { loadingPack = true; @@ -955,12 +960,6 @@ class FreeplayState extends MusicBeatState #if !switch intendedScore = Highscore.getScore(songs[curSelected].songName, curDifficulty); #end - - #if PRELOAD_ALL - //if (FileSystem.exists('assets/songs' + songs[curSelected].songName)) { - FlxG.sound.playMusic(Paths.inst(songs[curSelected].songName), 0); - //} - #end curChar = Highscore.getChar(songs[curSelected].songName, curDifficulty); } diff --git a/source/Main.hx b/source/Main.hx index 9f80868..9e1a598 100644 --- a/source/Main.hx +++ b/source/Main.hx @@ -25,7 +25,7 @@ class Main extends Sprite public static var fps:FpsDisplay; - public static var applicationName:String = "Friday Night Funkin' | VS. Dave and Bambi 3.0b | Moddable 1.0.1"; + public static var applicationName:String = "Friday Night Funkin' | VS. Dave and Bambi 3.0b | Moddable 1.5.0"; // You can pretty much ignore everything from here on - your code should go in your states. diff --git a/source/MainMenuState.hx b/source/MainMenuState.hx index 6f70d0e..a621c6c 100644 --- a/source/MainMenuState.hx +++ b/source/MainMenuState.hx @@ -74,7 +74,7 @@ class MainMenuState extends MusicBeatState public static var daRealEngineVer:String = 'Dave'; public static var engineVer:String = '3.0b'; - public static var fanmadeEngineVer:String = '1.0.1'; + public static var fanmadeEngineVer:String = '1.5.0'; public static var engineVers:Array = [ diff --git a/source/MusicPlayerState.hx b/source/MusicPlayerState.hx index b0995d9..92f6afe 100644 --- a/source/MusicPlayerState.hx +++ b/source/MusicPlayerState.hx @@ -19,6 +19,9 @@ import lime.utils.Assets; #if desktop import Discord.DiscordClient; #end +import sys.FileSystem; +import sys.io.File; + using StringTools; @@ -49,6 +52,12 @@ class MusicPlayerState extends MusicBeatState { FlxG.autoPause = false; var initSonglist = CoolUtil.coolTextFile(Paths.txt('djSonglist')); //ah yeah dj song list + var customList = []; + for (folder in FileSystem.readDirectory(TitleState.modFolder + '/songs')){ + if (FileSystem.isDirectory(TitleState.modFolder + '/songs/' + folder) && !customList.contains(folder)) + customList.push('internal,' + folder + ',bf-old,good,true'); + } + for (i in 0...initSonglist.length) { var splitstring:Array = initSonglist[i].split(","); @@ -94,6 +103,21 @@ class MusicPlayerState extends MusicBeatState } } + for (i in 0...customList.length) + { + var splitstring:Array = customList[i].split(","); + if (FileSystem.exists(TitleState.modFolder + '/songs/' + splitstring[1] + '/Voices.ogg')) { + songs.push(new PlaySongMetadata(splitstring[1], splitstring[0] == "external", splitstring[2],splitstring[3] == "bad",splitstring[1] != 'vs-dave-rap', true)); + + if (splitstring[0] != "external" && splitstring[1] != 'vs-dave-rap') //remove this later + { + songs.push(new PlaySongMetadata(splitstring[1], splitstring[0] == "external", splitstring[2],splitstring[3] == "bad",false)); + } + } else { + songs.push(new PlaySongMetadata(splitstring[1], splitstring[0] == "external", splitstring[2],splitstring[3] == "bad",false, true)); + } + } + bg = new FlxSprite().loadGraphic(Paths.image('backgrounds/Aadsta')); bg.loadGraphic(MainMenuState.randomizeBG()); bg.color = 0xFFFD719B; @@ -299,6 +323,11 @@ class MusicPlayerState extends MusicBeatState ShowBar(songs[curSelected].songCharacter); if (!songs[curSelected].ExternalSong) { + if (songs[curSelected].isCustom) { + FreeplayState.isaCustomSong = true; + } else { + FreeplayState.isaCustomSong = false; + } currentlyplaying = true; if (songs[curSelected].hasVocals) { @@ -454,13 +483,15 @@ class PlaySongMetadata public var ShowBadIcon:Bool = false; public var songCharacter:String = ""; public var hasVocals:Bool = true; + public var isCustom:Bool = false; - public function new(song:String, external:Bool, songCharacter:String, bad:Bool, vocal:Bool) + public function new(song:String, external:Bool, songCharacter:String, bad:Bool, vocal:Bool, isCustom:Bool = false) { this.songName = song; this.ExternalSong = external; this.songCharacter = songCharacter; this.ShowBadIcon = bad; this.hasVocals = vocal; + this.isCustom = isCustom; } } diff --git a/source/OptionsMenu.hx b/source/OptionsMenu.hx index 62cff09..17ca6c8 100644 --- a/source/OptionsMenu.hx +++ b/source/OptionsMenu.hx @@ -37,6 +37,7 @@ class OptionsMenu extends MusicBeatState var curLanguage:String = LanguageManager.save.data.language; var songBarOptions = [ 'ShowTime', + 'ShowTimeOld', 'SongName', ]; var curSongBarOptionSelected:Int; diff --git a/source/Paths.hx b/source/Paths.hx index 339b7e1..e784152 100644 --- a/source/Paths.hx +++ b/source/Paths.hx @@ -166,7 +166,12 @@ class Paths inline static public function customImage(key:String) { + if (FileSystem.exists('${key}.png')) { return (FlxGraphic.fromBitmapData(BitmapData.fromFile('${key}.png'))); + } else { + trace('bro that doesn\'t exist ' + '${key}.png'); + return (FlxGraphic.fromBitmapData(BitmapData.fromFile('assets/shared/images/blank.png'))); + } } inline static public function music(key:String, ?library:String) { diff --git a/source/PauseSubState.hx b/source/PauseSubState.hx index 523116d..6f7cc8b 100644 --- a/source/PauseSubState.hx +++ b/source/PauseSubState.hx @@ -134,7 +134,7 @@ class PauseSubState extends MusicBeatSubstate for (i in 0...menuItems.length) { - var songText:Alphabet = new Alphabet(0, (70 * i) + 30, LanguageManager.getTextString('${menuItems[i].optionName}'), true, false); + var songText:Alphabet = new Alphabet(0, (70 * i) + 30, i != 4 ? LanguageManager.getTextString('pause_${menuItems[i].optionName}') : menuItems[i].optionName, true, false); songText.isMenuItem = true; songText.targetY = i; grpMenuShit.add(songText); diff --git a/source/PlayState.hx b/source/PlayState.hx index 842d07d..165b021 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -122,6 +122,7 @@ typedef Settings = { var intro:String; var windowName:String; var healthDrain:String; + var healthBarBG:String; var exploitationEffect:Bool; } @@ -1367,6 +1368,7 @@ class PlayState extends MusicBeatState } var healthBarPath = ''; + var customHealthBar = false; switch (SONG.song.toLowerCase()) { case 'exploitation': @@ -1376,10 +1378,23 @@ class PlayState extends MusicBeatState case 'five-nights': healthBarPath = Paths.image('ui/fnafengine'); default: + if (FreeplayState.isaCustomSong && settingsExist) { + if (FileSystem.exists(Paths.image('ui/' + jsonSettings.healthBarBG))) { + healthBarPath = Paths.image('ui/' + jsonSettings.healthBarBG); + } else { + if (jsonSettings.healthBarBG != '' && jsonSettings.healthBarBG != null) { + customHealthBar = true; + healthBarPath = TitleState.modFolder + '/images/ui/' + jsonSettings.healthBarBG; + } else { + healthBarPath = Paths.image('ui/healthBar'); + } + } + } else { healthBarPath = Paths.image('ui/healthBar'); + } } - healthBarBG = new FlxSprite(0, FlxG.height * 0.9).loadGraphic(healthBarPath); + healthBarBG = new FlxSprite(0, FlxG.height * 0.9).loadGraphic(customHealthBar ? Paths.customImage(healthBarPath) : healthBarPath); // I'm learning if (scrollType == 'downscroll') healthBarBG.y = 50; healthBarBG.screenCenter(X); @@ -3150,8 +3165,16 @@ class PlayState extends MusicBeatState } if (songName != null && barType == 'ShowTime') + { + songName.text = FlxStringUtil.formatTime(FlxG.sound.music.time / 1000) + ' / ' + FlxStringUtil.formatTime(FlxG.sound.music.length / 1000); + songName.x = 551; + } + + + if (barType == 'ShowTimeOld') { songName.text = FlxStringUtil.formatTime((FlxG.sound.music.length - FlxG.sound.music.time) / 1000); + songName.x = 615; } if (startingSong && startTimer != null && !startTimer.active)