diff --git a/Project.xml b/Project.xml index 64a5bff..abbb6a2 100644 --- a/Project.xml +++ b/Project.xml @@ -3,7 +3,7 @@ - + diff --git a/README.md b/README.md index 905335c..3524e2e 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,7 @@ Includes: - [MagMan - Extra Keys](https://gamebanana.com/members/1684859) - Cam - Making Dave and Bambi Moddable/Fanmade Dave Engine - [ShadowMario - Custom Audio Code](https://gamebanana.com/mods/309789) +- [KadeDev - Kade Engine 1.2](https://gamebanana.com/mods/44291) ## Dependencies you need to build the Engine ![image](https://github.com/CamtheKirby/VsDave-Modable/assets/92703353/321ccc06-a418-4220-bb90-fa2b96e61744) diff --git a/mods/test/data/charts/test-settings.json b/mods/test/data/charts/test-settings.json new file mode 100644 index 0000000..3d5dd32 --- /dev/null +++ b/mods/test/data/charts/test-settings.json @@ -0,0 +1,5 @@ +{ + "songCreators": "Kawai Sprite & MtH", + "songHeadings": "funkinHeading", + "creditsTxt": "The testiest song on the planet" + } \ No newline at end of file diff --git a/mods/test/data/charts/test-settings.txt b/mods/test/data/charts/test-settings.txt deleted file mode 100644 index f1a0378..0000000 --- a/mods/test/data/charts/test-settings.txt +++ /dev/null @@ -1 +0,0 @@ -Kawai Sprite & MtH:funkinHeading:The testiest song on the planet \ No newline at end of file diff --git a/mods/test/guides/How 2 Add Credits.txt b/mods/test/guides/How 2 Add Settings.txt similarity index 65% rename from mods/test/guides/How 2 Add Credits.txt rename to mods/test/guides/How 2 Add Settings.txt index 175faff..7c6a60e 100644 --- a/mods/test/guides/How 2 Add Credits.txt +++ b/mods/test/guides/How 2 Add Settings.txt @@ -1,8 +1,12 @@ -First off in data folder go to the charts folder and create a txt file named yoursong-settings +First off in data folder go to the charts folder and copy the test json file and name it yoursong-settings.json Example: -credit the people who made the song:theHeading:The credit text +{ + "songCreators": "The Song Creators", + "songHeadings": "theHeading", + "creditsTxt": "the txt" + } diff --git a/mods/test/images/stages/test/not yet.txt b/mods/test/images/stages/test/not yet.txt new file mode 100644 index 0000000..e69de29 diff --git a/source/CreditsPopUp.hx b/source/CreditsPopUp.hx index 6a6d6f6..cdf48ee 100644 --- a/source/CreditsPopUp.hx +++ b/source/CreditsPopUp.hx @@ -1,5 +1,7 @@ package; +import haxe.Json; +import sys.io.File; import sys.FileSystem; import flixel.group.FlxSpriteGroup; import flixel.group.FlxSpriteGroup.FlxTypedSpriteGroup; @@ -15,6 +17,7 @@ typedef SongHeading = { var ?animation:Animation; var iconOffset:Float; } + class CreditsPopUp extends FlxSpriteGroup { public var bg:FlxSprite; @@ -24,8 +27,9 @@ class CreditsPopUp extends FlxSpriteGroup public var funnyIcon:FlxSprite; var iconOffset:Float; var curHeading:SongHeading; - var custom:Array; public static var songCreator:String = ''; + var rawJsonSettings:String; + var jsonSettings:PlayState.Settings; public function new(x:Float, y:Float) { @@ -35,8 +39,9 @@ class CreditsPopUp extends FlxSpriteGroup var songCreatorIcon:String = ''; var headingPath:SongHeading = null; if (FreeplayState.isaCustomSong) { - if (FileSystem.exists(TitleState.modFolder + '/data/charts/' + PlayState.SONG.song.toLowerCase() + '-settings.txt')) { - custom = CoolUtil.coolTextFile(TitleState.modFolder + '/data/charts/' + PlayState.SONG.song.toLowerCase() + '-settings.txt'); + if (FileSystem.exists(TitleState.modFolder + '/data/charts/' + PlayState.SONG.song.toLowerCase() + '-settings.json')) { + rawJsonSettings = File.getContent(TitleState.modFolder + '/data/charts/' + PlayState.SONG.song.toLowerCase() + '-settings.json'); + jsonSettings = cast Json.parse(rawJsonSettings); } } @@ -69,12 +74,8 @@ class CreditsPopUp extends FlxSpriteGroup songCreator = 'sibottle'; default: if (FreeplayState.isaCustomSong) { - if (FileSystem.exists(TitleState.modFolder + '/data/charts/' + PlayState.SONG.song.toLowerCase() + '-settings.txt')) { - for (i in 0...custom.length) - { - var data:Array = custom[i].split(':'); - songCreator = data[0]; - } + if (FileSystem.exists(TitleState.modFolder + '/data/charts/' + PlayState.SONG.song.toLowerCase() + '-settings.json')) { + songCreator = jsonSettings.songCreators; } } } @@ -119,12 +120,8 @@ class CreditsPopUp extends FlxSpriteGroup animation: new Animation('expunged', 'Expunged', 24, true, [false, false]), iconOffset: 0}; default: if (FreeplayState.isaCustomSong) { - if (FileSystem.exists(TitleState.modFolder + '/data/charts/' + PlayState.SONG.song.toLowerCase() + '-settings.txt')) { - for (i in 0...custom.length) - { - var data:Array = custom[i].split(':'); - headingPath = {path: 'songHeadings/' + data[1], antiAliasing: false, iconOffset: 0}; - } + if (FileSystem.exists(TitleState.modFolder + '/data/charts/' + PlayState.SONG.song.toLowerCase() + '-settings.json')) { + headingPath = {path: 'songHeadings/' + jsonSettings.songHeadings, antiAliasing: false, iconOffset: 0}; } } } @@ -136,12 +133,9 @@ class CreditsPopUp extends FlxSpriteGroup headingPath = {path: 'songHeadings/interdimensionalHeading', antiAliasing: false, iconOffset: 0}; default: if (FreeplayState.isaCustomSong) { - if (FileSystem.exists(TitleState.modFolder + '/data/charts/' + PlayState.SONG.song.toLowerCase() + '-settings.txt')) { - for (i in 0...custom.length) - { - var data:Array = custom[i].split(':'); - headingPath = {path: 'songHeadings/' + data[1], antiAliasing: false, iconOffset: 0}; - } + if (FileSystem.exists(TitleState.modFolder + '/data/charts/' + PlayState.SONG.song.toLowerCase() + '-settings.json')) { + headingPath = {path: 'songHeadings/' + jsonSettings.songHeadings, antiAliasing: false, iconOffset: 0}; + } } } @@ -158,9 +152,11 @@ class CreditsPopUp extends FlxSpriteGroup if (FileSystem.exists('assets/shared/images/' + headingPath.path + '.png')) { trace('yay'); bg.loadGraphic(Paths.image(headingPath.path)); - } else { + } else if (FileSystem.exists(TitleState.modFolder + '/images/' + headingPath.path + '.png')) { trace('nae'); bg.loadGraphic(Paths.customImage(TitleState.modFolder + '/images/' + headingPath.path)); + } else { + bg.loadGraphic(Paths.image('songHeadings/daveHeading')); } } else @@ -178,10 +174,14 @@ class CreditsPopUp extends FlxSpriteGroup funnyIcon = new FlxSprite(0, 0, Paths.image('songCreators/${songCreatorIcon != '' ? songCreatorIcon : songCreator}')); rescaleIcon(); add(funnyIcon); - } else { + } else if (FileSystem.exists(TitleState.modFolder + '/images/songCreators/' + songCreator + '.png')) { funnyIcon = new FlxSprite(0, 0, Paths.customImage(TitleState.modFolder + '/images/songCreators/' + songCreator)); rescaleIcon(); add(funnyIcon); + } else { + funnyIcon = new FlxSprite(0, 0, Paths.image('songCreators/MoldyGH')); + rescaleIcon(); + add(funnyIcon); } diff --git a/source/Main.hx b/source/Main.hx index 2ec04f4..9f80868 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.0"; + public static var applicationName:String = "Friday Night Funkin' | VS. Dave and Bambi 3.0b | Moddable 1.0.1"; // 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 fbf6155..6f70d0e 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.0'; + public static var fanmadeEngineVer:String = '1.0.1'; public static var engineVers:Array = [ diff --git a/source/PlayState.hx b/source/PlayState.hx index fddde1a..189afd2 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -114,6 +114,13 @@ typedef BackgroundJson = var antialiasing:Bool; } +typedef Settings = +{ + var songCreators:String; + var songHeadings:String; + var creditsTxt:String; +} + class PlayState extends MusicBeatState { public static var mania:Int = 0; @@ -321,8 +328,6 @@ class PlayState extends MusicBeatState var songPosBar:FlxBar; var songPosBG:FlxSprite; - - var custom:Array; var bfNoteCamOffset:Array = new Array(); var dadNoteCamOffset:Array = new Array(); @@ -367,6 +372,9 @@ class PlayState extends MusicBeatState public var rawJsonStage:String; public var jsonStage:StageJson; + var rawJsonSettings:String; + var jsonSettings:Settings; + var tristan:BGSprite; var curTristanAnim:String; @@ -509,8 +517,9 @@ class PlayState extends MusicBeatState resetShader(); if (FreeplayState.isaCustomSong) { - if (FileSystem.exists(TitleState.modFolder + '/data/charts/' + PlayState.SONG.song.toLowerCase() + '-settings.txt')) { - custom = CoolUtil.coolTextFile(TitleState.modFolder + '/data/charts/' + PlayState.SONG.song.toLowerCase() + '-settings.txt'); + if (FileSystem.exists(TitleState.modFolder + '/data/charts/' + PlayState.SONG.song.toLowerCase() + '-settings.json')) { + rawJsonSettings = File.getContent(TitleState.modFolder + '/data/charts/' + PlayState.SONG.song.toLowerCase() + '-settings.json'); + jsonSettings = cast Json.parse(rawJsonSettings); } } @@ -1388,15 +1397,12 @@ class PlayState extends MusicBeatState case 'kabunga': credits = LanguageManager.getTextString('kabunga_credit'); default: - if (FreeplayState.isaCustomSong && (FileSystem.exists(TitleState.modFolder + '/data/charts/' + PlayState.SONG.song.toLowerCase() + '-settings.txt'))) { - for (i in 0...custom.length) - { - var data:Array = custom[i].split(':'); - if (data[2] == null) { + if (FreeplayState.isaCustomSong && (FileSystem.exists(TitleState.modFolder + '/data/charts/' + PlayState.SONG.song.toLowerCase() + '-settings.json'))) { + + if (jsonSettings.creditsTxt == '') { credits = ''; } else { - credits = data[2]; - } + credits = jsonSettings.creditsTxt; } } else { credits = '';