From 37ab09803775617ad52618c56d5a429feab69825 Mon Sep 17 00:00:00 2001 From: Cam the Kirby <92703353+CamtheKirby@users.noreply.github.com> Date: Sun, 19 May 2024 13:45:00 -0500 Subject: [PATCH] Added Settings for freepplay, made the character select json more easier to understand and fixing a typo --- Project.xml | 2 +- assets/preload/data/FreeplaySettings.json | 13 +++++ assets/preload/data/characterSelect.json | 68 +++++++++++----------- assets/preload/sounds/nothing.ogg | Bin 0 -> 4467 bytes mods/test/data/FreeplaySettings.json | 6 ++ mods/test/data/characterSelect.json | 6 +- skins/characterSelect.json | 26 ++++----- source/CharacterSelectState.hx | 21 +++---- source/FreeplayState.hx | 66 ++++++++++++++++++--- source/Main.hx | 2 +- 10 files changed, 140 insertions(+), 70 deletions(-) create mode 100644 assets/preload/data/FreeplaySettings.json create mode 100644 assets/preload/sounds/nothing.ogg create mode 100644 mods/test/data/FreeplaySettings.json diff --git a/Project.xml b/Project.xml index 0c043c5..ac7e42f 100644 --- a/Project.xml +++ b/Project.xml @@ -3,7 +3,7 @@ - + diff --git a/assets/preload/data/FreeplaySettings.json b/assets/preload/data/FreeplaySettings.json new file mode 100644 index 0000000..a67c18f --- /dev/null +++ b/assets/preload/data/FreeplaySettings.json @@ -0,0 +1,13 @@ +{ + "skipSelect": [ + "five-nights", + "vs-dave-rap", + "vs-dave-rap-two" + ], + "noExtraKeys": [ + "five-nights", + "vs-dave-rap", + "vs-dave-rap-two", + "overdrive" + ] +} \ No newline at end of file diff --git a/assets/preload/data/characterSelect.json b/assets/preload/data/characterSelect.json index 6421572..fed04af 100644 --- a/assets/preload/data/characterSelect.json +++ b/assets/preload/data/characterSelect.json @@ -3,128 +3,128 @@ { "newCharacter": [ { - "casename": "bf", + "playername": "bf", "thecharactername": "Boyfriend", - "thenotemsagain": [1, 1, 1, 1], + "thenotems": [1, 1, 1, 1], "notestyle": "" }, { - "casename": "bf-pixel", + "playername": "bf-pixel", "thecharactername": "Pixel Boyfriend", - "thenotemsagain": [1, 1, 1, 1], + "thenotems": [1, 1, 1, 1], "notestyle": "" } ], "mainName": "bf", - "thehotemsithink": [1, 1, 1, 1] + "mainnotems": [1, 1, 1, 1] }, { "newCharacter": [ { - "casename": "dave", + "playername": "dave", "thecharactername": "Dave", - "thenotemsagain": [0.25, 0.25, 2, 2], + "thenotems": [0.25, 0.25, 2, 2], "notestyle": "" } ], "mainName": "dave", - "thehotemsithink": [0.25, 0.25, 2, 2] + "mainnotems": [0.25, 0.25, 2, 2] }, { "newCharacter": [ { - "casename": "bambi-new", + "playername": "bambi-new", "thecharactername": "Bambi", - "thenotemsagain": [0, 0, 3, 0] + "thenotems": [0, 0, 3, 0] } ], "mainName": "bambi", - "thehotemsithink": [0, 0, 3, 0] + "mainnotems": [0, 0, 3, 0] }, { "newCharacter": [ { - "casename": "tristan", + "playername": "tristan", "thecharactername": "Tristan", - "thenotemsagain": [2, 0.5, 0.5, 0.5], + "thenotems": [2, 0.5, 0.5, 0.5], "notestyle": "" } ], "mainName": "tristan", - "thehotemsithink": [2, 0.5, 0.5, 0.5] + "mainnotems": [2, 0.5, 0.5, 0.5] }, { "newCharacter": [ { - "casename": "tristan-golden", + "playername": "tristan-golden", "thecharactername": "Tristan Golden", - "thenotemsagain": [0.25, 0.25, 0.25, 2], + "thenotems": [0.25, 0.25, 0.25, 2], "notestyle": "" } ], "mainName": "tristan-golden", - "thehotemsithink": [0.25, 0.25, 0.25, 2] + "mainnotems": [0.25, 0.25, 0.25, 2] }, { "newCharacter": [ { - "casename": "dave-angey", + "playername": "dave-angey", "thecharactername": "3D Dave", - "thenotemsagain": [2, 2, 0.25, 0.25], + "thenotems": [2, 2, 0.25, 0.25], "notestyle": "3D" }, { - "casename": "dave-festival-3d", + "playername": "dave-festival-3d", "thecharactername": "3D Dave Festival", - "thenotemsagain": [2, 2, 0.25, 0.25], + "thenotems": [2, 2, 0.25, 0.25], "notestyle": "3D" } ], "mainName": "dave-angey", - "thehotemsithink": [2, 2, 0.25, 0.25] + "mainnotems": [2, 2, 0.25, 0.25] }, { "newCharacter": [ { - "casename": "bambi-3d", + "playername": "bambi-3d", "thecharactername": "Expunged", - "thenotemsagain": [0, 3, 0, 0], + "thenotems": [0, 3, 0, 0], "notestyle": "3D" } ], "mainName": "bambi-3d", - "thehotemsithink": [0, 3, 0, 0] + "mainnotems": [0, 3, 0, 0] }, { "newCharacter": [ { - "casename": "shaggy", + "playername": "shaggy", "thecharactername": "Shaggy", - "thenotemsagain": [1, 1, 1, 1], + "thenotems": [1, 1, 1, 1], "notestyle": "" }, { - "casename": "supershaggy", + "playername": "supershaggy", "thecharactername": "Shaggy (0.001%)", - "thenotemsagain": [1, 1, 1, 1], + "thenotems": [1, 1, 1, 1], "notestyle": "" }, { - "casename": "godshaggy", + "playername": "godshaggy", "thecharactername": "Shaggy (0.002%)", - "thenotemsagain": [1, 1, 1, 1], + "thenotems": [1, 1, 1, 1], "notestyle": "" }, { - "casename": "redshaggy", + "playername": "redshaggy", "thecharactername": "Red Shaggy", - "thenotemsagain": [1, 1, 1, 1], + "thenotems": [1, 1, 1, 1], "notestyle": "" } ], "mainName": "shaggy", - "thehotemsithink": [1, 1, 1, 1] + "mainnotems": [1, 1, 1, 1] } ] } \ No newline at end of file diff --git a/assets/preload/sounds/nothing.ogg b/assets/preload/sounds/nothing.ogg new file mode 100644 index 0000000000000000000000000000000000000000..9c923133da7b82907ec8f4a529c94273fa644021 GIT binary patch literal 4467 zcmeGgZBSEJ_J*${$Ra|-KqHf2CUmZ0nwLX?Q5k^ob7>Q1VF zK!IWi6azARB+;bER92|i*%`FuLr^|MM7J|5l?t^^cUaw>y1#bMdkK_vJMGSN_FwPZ zT<$&R+;iSNANQO~>ak<#$PKyLh}b#l{WiXd5<)3^TbHNR6CgLkr!JCWC-F5(DzS6D z5j!ccy0LU~pMSx>UTNptovcJak)=IZuq#z}jD13zcZd|gmb0UyqNAdI9VKG(a7})x zT3d9Com5n&)xBNxmZqqLPjF_#PgA6RJ71$qNX{)&$BK6eV??`zQBedZCx42k^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Bdg1EqJsd z(%OQ1a+-|_JKKWed{1Q9E{0zgt+J}u13iaoPi@M(Em`486~g6qy+6mwg!0DDP!lzd z$tZ+6IYn`+6=31ke4uM@!s7tu3k63BkXTH(^y_v#)E^gsgn}@qwrfwMMEPfs>fVZm z7YTE9goC=}Mq7DDIMl7jjTR@w96#;SetCyW$GRM_2BE01Ny0{Uhr=6IbD*e7qTY2l zp4}WI^uJJ=`vsx=XV-^8@1>fcYef1MY(gmYBtj7%=ayD9bzd2VMCV52%L*Zl4>gw; z$KofI@hcnu)BPz1*kkZ>y-;@7<+^6Y-Wy*n-@jk}pR)(qg_j2oA?8%2JEp3rkLl%J z*xKN=Ex6ww(dc0H#A@N!T$53u*eb1)@WPr~vTH9(tA#YHjS@ql|QznJc13zhkOp(`?>Tqyh)P&tUq@I?CY;<$BTHm>iV~HoKlrW* zhkcbG!&y6nLcBo+iBQ0kl_8}&5hf$hSzQPa1pHkH5Cm+TJ77YT;LQXrF(F4gF@vRZ zbRw)E2!KuyAqbW(exx819^qWV_3KXDemf!}KTnD2i+9`4h)%}Hn1vUbAN9)B``I7W z=_cgz%X{_(FLzoV$f=xxtOFW$;)Gmr;WUl!Wv{G@u(md}NGDrypS+#Ik~-mj$&(D} z7!$7S(+Ih5i4LGKu=n2cL1IkS=!U#E`E36z3Bz`AdWJhsCX2%_>_#ZD`nF$9^$1(o z70ipUxf@12tKLQ9GY@2+UNh`+KQc3tLzU8`ey6io7=Fd>(h`uF=!xu^tw~*-F=p{lj+)!Ozuq=*?{|zSHyHBP_PB{qI s8->h-7^2W<&Ic#4rqRg%ig-jqRw5elUlAfL{^9<~SPu#`; var mainName:String; - var thehotemsithink:Array; + var mainnotems:Array; } typedef TheActualChar = { -var casename:String; +var playername:String; var thecharactername:String; -var thenotemsagain:Array; +var thenotems:Array; var notestyle:String; } class CharacterInSelect @@ -185,35 +185,36 @@ class CharacterSelectState extends MusicBeatState for (character in json.characters) { // Normal var mainName:String = character.mainName; - var thehotemsithink:Array = character.thehotemsithink; + var thehotemsithink:Array = character.mainnotems; var newCharacterForms:Array = []; for (newChar in character.newCharacter) { - newCharacterForms.push(new CharacterForm(newChar.casename, newChar.thecharactername, newChar.thenotemsagain, newChar.notestyle)); + newCharacterForms.push(new CharacterForm(newChar.playername, newChar.thecharactername, newChar.thenotems, newChar.notestyle)); } characters.push(new CharacterInSelect(mainName, thehotemsithink, newCharacterForms)); } - + if (FileSystem.exists(TitleState.modFolder + 'Skins/characterSelect.json')) { for (character in jsonCustom.characters) { // For Globle Characters var mainName:String = character.mainName; - var thehotemsithink:Array = character.thehotemsithink; + var thehotemsithink:Array = character.mainnotems; var newCharacterForms:Array = []; for (newChar in character.newCharacter) { - newCharacterForms.push(new CharacterForm(newChar.casename, newChar.thecharactername, newChar.thenotemsagain, newChar.notestyle)); + newCharacterForms.push(new CharacterForm(newChar.playername, newChar.thecharactername, newChar.thenotems, newChar.notestyle)); } characters.push(new CharacterInSelect(mainName, thehotemsithink, newCharacterForms)); } + } if (FileSystem.exists(TitleState.modFolder + '/data/characterSelect.json')) { for (character in jsonCustom2.characters) { // For Characters in Mod Packs var mainName:String = character.mainName; - var thehotemsithink:Array = character.thehotemsithink; + var thehotemsithink:Array = character.mainnotems; var newCharacterForms:Array = []; for (newChar in character.newCharacter) { - newCharacterForms.push(new CharacterForm(newChar.casename, newChar.thecharactername, newChar.thenotemsagain, newChar.notestyle)); + newCharacterForms.push(new CharacterForm(newChar.playername, newChar.thecharactername, newChar.thenotems, newChar.notestyle)); } characters.push(new CharacterInSelect(mainName, thehotemsithink, newCharacterForms)); diff --git a/source/FreeplayState.hx b/source/FreeplayState.hx index 9f2040e..a344ce4 100644 --- a/source/FreeplayState.hx +++ b/source/FreeplayState.hx @@ -24,10 +24,19 @@ import flixel.addons.util.FlxAsyncLoop; import flixel.graphics.FlxGraphic; import openfl.display.BitmapData; import openfl.utils.Assets as OpenFlAssets; - +import haxe.Json; +import haxe.format.JsonParser; +import sys.FileSystem; +import sys.io.File; using StringTools; +typedef FreeplaySettings = +{ + var skipSelect:Array; + var noExtraKeys:Array; +} + class FreeplayState extends MusicBeatState { var songs:Array = []; @@ -57,10 +66,14 @@ class FreeplayState extends MusicBeatState private var CurrentPack:Int = 0; private var NameAlpha:Alphabet; + public var rawJsonF:String; + public var jsonF:FreeplaySettings; + public var rawJsonFM:String; + public var jsonFM:FreeplaySettings; var loadingPack:Bool = false; - var songColors:Array = + var songColors:Array = // Couldn't get this to work in the json I'll get you one day [ 0xFF00137F, // GF but its actually dave! 0xFF4965FF, // DAVE @@ -78,21 +91,21 @@ class FreeplayState extends MusicBeatState 0xFF0162F5, // OVERDRIVE 0xFF119A2B, // CHEATING 0xFFFF0000, // UNFAIRNESS - 0xFF810000, // EXPLOITATION + 0xFF810000, // EXPLOITATION ]; public static var skipSelect:Array = [ - 'five-nights', + /*'five-nights', 'vs-dave-rap', - 'vs-dave-rap-two' + 'vs-dave-rap-two' */ ]; public static var noExtraKeys:Array = [ - 'five-nights', + /*'five-nights', 'vs-dave-rap', 'vs-dave-rap-two', - 'overdrive' + 'overdrive'*/ ]; private var camFollow:FlxObject; @@ -130,7 +143,33 @@ class FreeplayState extends MusicBeatState #if desktop DiscordClient.changePresence("In the Freeplay Menu", null); #end isaCustomSong = false; - + rawJsonF = File.getContent(Paths.json('FreeplaySettings')); + jsonF = cast Json.parse(rawJsonF); + + if (FileSystem.exists(TitleState.modFolder + '/data/FreeplaySettings.json')) { + rawJsonFM = File.getContent(TitleState.modFolder + '/data/FreeplaySettings.json'); + jsonFM = cast Json.parse(rawJsonFM); + + for (i in jsonFM.skipSelect) { + skipSelect.push(i); + } + + for (i in jsonFM.noExtraKeys) { + noExtraKeys.push(i); + } + } + + trace(songColors); + + for (i in jsonF.skipSelect) { + skipSelect.push(i); + } + + for (i in jsonF.noExtraKeys) { + noExtraKeys.push(i); + } + + awaitingExploitation = (FlxG.save.data.exploitationState == 'awaiting'); showCharText = FlxG.save.data.wasInCharSelect; @@ -666,7 +705,15 @@ class FreeplayState extends MusicBeatState default: FlxG.sound.music.fadeOut(1, 0); if (isaCustomSong) { + if (FileSystem.exists(TitleState.modFolder + '/data/charts/' + (songs[curSelected].songName.toLowerCase() + '.json'))) { PlayState.SONG = Song.loadFromCustomJson(songs[curSelected].songName.toLowerCase()/*, curDifficulty*/); + } else { + var deathSound:FlxSound = new FlxSound(); + deathSound.loadEmbedded(Paths.soundRandom('missnote', 1, 3)); + deathSound.volume = FlxG.random.float(0.6, 1); + deathSound.play(); + FlxG.camera.shake(0.05, 0.1); + } } else { PlayState.SONG = Song.loadFromJson(Highscore.formatSong(songs[curSelected].songName.toLowerCase(), curDifficulty)); } @@ -824,7 +871,9 @@ class FreeplayState extends MusicBeatState #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); @@ -868,6 +917,7 @@ class FreeplayState extends MusicBeatState pressSpeeds = new Array(); pressUnlockNumber = new FlxRandom().int(20, 40); } + function recursedUnlock() { canInteract = false; diff --git a/source/Main.hx b/source/Main.hx index 25cccbb..62457d3 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 | Extra Keys Addon 2.0.2"; + public static var applicationName:String = "Friday Night Funkin' | VS. Dave and Bambi 3.0b | Moddable ?.?.?"; // You can pretty much ignore everything from here on - your code should go in your states.