From 36ab52b160d1df2d336cb25fb9c973630d52c67a Mon Sep 17 00:00:00 2001 From: Yoshman29 <81191621+YoshiCrafter29@users.noreply.github.com> Date: Sun, 19 Mar 2023 13:15:59 +0100 Subject: [PATCH] gf fix on non codename charts --- buildnumber.txt | 2 +- source/funkin/chart/BaseGameParser.hx | 35 +++++++++++++++++-- source/funkin/chart/Chart.hx | 6 +++- source/funkin/chart/chart-model.json | 40 --------------------- source/funkin/menus/FreeplayState.hx | 1 - source/funkin/system/Conductor.hx | 1 - source/funkin/system/Section.hx | 12 ------- source/funkin/system/Song.hx | 50 --------------------------- source/funkin/utils/CoolUtil.hx | 1 - 9 files changed, 38 insertions(+), 110 deletions(-) delete mode 100644 source/funkin/chart/chart-model.json delete mode 100644 source/funkin/system/Section.hx delete mode 100644 source/funkin/system/Song.hx diff --git a/buildnumber.txt b/buildnumber.txt index 2f4a7459..b8ffba82 100644 --- a/buildnumber.txt +++ b/buildnumber.txt @@ -1 +1 @@ -2607 \ No newline at end of file +2609 \ No newline at end of file diff --git a/source/funkin/chart/BaseGameParser.hx b/source/funkin/chart/BaseGameParser.hx index 85abbdd0..528e68b3 100644 --- a/source/funkin/chart/BaseGameParser.hx +++ b/source/funkin/chart/BaseGameParser.hx @@ -1,7 +1,5 @@ package funkin.chart; -import funkin.system.Song.SwagSong; - class BaseGameParser { public static function parse(data:Dynamic, result:ChartData) { // base fnf chart parsing @@ -18,7 +16,7 @@ class BaseGameParser { result.strumLines.push({ characters: [data.player2], type: 0, - position: "dad", + position: data.player2.startsWith("gf") ? "girlfriend" : "dad", notes: [] }); result.strumLines.push({ @@ -99,4 +97,35 @@ class BaseGameParser { curTime += curCrochet * beatsPerMesure; } } +} +typedef SwagSong = +{ + var song:String; + var notes:Array; + var bpm:Float; + var needsVoices:Bool; + var speed:Float; + var stage:String; + var noteTypes:Array; + + var player1:String; + var player2:String; + var gf:String; + var validScore:Bool; + + // ADDITIONAL STUFF THAT MAY NOT BE PRESENT IN CHART + var ?maxHealth:Float; + var ?beatsPerMesure:Float; + var ?stepsPerBeat:Float; +} + +typedef SwagSection = +{ + var sectionNotes:Array; + var lengthInSteps:Int; + var mustHitSection:Bool; + var bpm:Float; + var changeBPM:Bool; + var altAnim:Bool; + @:optional var camTarget:Null; } \ No newline at end of file diff --git a/source/funkin/chart/Chart.hx b/source/funkin/chart/Chart.hx index e4eae36e..8dd572e8 100644 --- a/source/funkin/chart/Chart.hx +++ b/source/funkin/chart/Chart.hx @@ -3,7 +3,6 @@ package funkin.chart; import funkin.chart.ChartData; import flixel.util.FlxColor; import haxe.io.Path; -import funkin.system.Song.SwagSong; import haxe.Json; #if sys @@ -98,6 +97,10 @@ class Chart { Logs.trace('Could not parse chart for song ${songName} ($difficulty): ${Std.string(e)}', ERROR, RED); } + /** + * CHART CONVERSION + */ + #if REGION if (Reflect.hasField(data, "codenameChart") && Reflect.field(data, "codenameChart") == true) { // codename chart base = data; @@ -105,6 +108,7 @@ class Chart { // base game chart BaseGameParser.parse(data, base); } + #end if (base.meta == null) base.meta = loadChartMeta(songName, difficulty, base.fromMods); diff --git a/source/funkin/chart/chart-model.json b/source/funkin/chart/chart-model.json deleted file mode 100644 index 19ba29d6..00000000 --- a/source/funkin/chart/chart-model.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "meta": { - "song": "Test", - "bpm": 120 - }, - "strumLines": [ - { - "characters": ["bf-pixel"], - "opponent": true, - "notes": [ - { - "time": 1500, - "id": 1, - "type": 0, - "sustainLength": 1500 - } - ] - }, - { - "characters": ["bf"], - "opponent": false, - "notes": [ - { - "time": 1500, - "id": 1, - "type": 0, - "sustainLength": 1500 - } - ] - } - ], - "events": [ - { - "time": 1500, - "type": -1, - "params": ["changeShit", true, false] - } - ], - "codenameChart": true -} \ No newline at end of file diff --git a/source/funkin/menus/FreeplayState.hx b/source/funkin/menus/FreeplayState.hx index b56b3360..d8d56a35 100644 --- a/source/funkin/menus/FreeplayState.hx +++ b/source/funkin/menus/FreeplayState.hx @@ -9,7 +9,6 @@ import flixel.addons.display.FlxGridOverlay; import flixel.text.FlxText; import flixel.util.FlxColor; import lime.utils.Assets; -import funkin.system.Song; import funkin.game.HealthIcon; import funkin.game.Highscore; import haxe.Json; diff --git a/source/funkin/system/Conductor.hx b/source/funkin/system/Conductor.hx index 6cb1fe60..44705092 100644 --- a/source/funkin/system/Conductor.hx +++ b/source/funkin/system/Conductor.hx @@ -5,7 +5,6 @@ import funkin.chart.ChartData; import openfl.Lib; import flixel.FlxState; import funkin.interfaces.IBeatReceiver; -import funkin.system.Song.SwagSong; import flixel.util.FlxSignal.FlxTypedSignal; /** diff --git a/source/funkin/system/Section.hx b/source/funkin/system/Section.hx deleted file mode 100644 index 73f0ba93..00000000 --- a/source/funkin/system/Section.hx +++ /dev/null @@ -1,12 +0,0 @@ -package funkin.system; - -typedef SwagSection = -{ - var sectionNotes:Array; - var lengthInSteps:Int; - var mustHitSection:Bool; - var bpm:Float; - var changeBPM:Bool; - var altAnim:Bool; - @:optional var camTarget:Null; -} \ No newline at end of file diff --git a/source/funkin/system/Song.hx b/source/funkin/system/Song.hx deleted file mode 100644 index 2634fbc2..00000000 --- a/source/funkin/system/Song.hx +++ /dev/null @@ -1,50 +0,0 @@ -package funkin.system; - -import funkin.system.Section.SwagSection; -import haxe.Json; -import haxe.format.JsonParser; -import lime.utils.Assets; - -using StringTools; - -typedef SwagSong = -{ - var song:String; - var notes:Array; - var bpm:Float; - var needsVoices:Bool; - var speed:Float; - var stage:String; - var noteTypes:Array; - - var player1:String; - var player2:String; - var gf:String; - var validScore:Bool; - - // ADDITIONAL STUFF THAT MAY NOT BE PRESENT IN CHART - var ?maxHealth:Float; - var ?beatsPerMesure:Float; - var ?stepsPerBeat:Float; -} - -class Song -{ - public static function loadFromJson(songName:String, ?difficulty:String = "normal"):SwagSong - { - var assetPath = Paths.chart(songName, difficulty); - PlayState.fromMods = Paths.assetsTree.existsSpecific(assetPath, "TEXT", MODS); - var rawJson = Assets.getText(assetPath).trim(); - - rawJson = rawJson.substr(0, rawJson.lastIndexOf('}') + 1); - - return parseJSONshit(rawJson); - } - - public static function parseJSONshit(rawJson:String):SwagSong - { - var swagShit:SwagSong = cast Json.parse(rawJson).song; - swagShit.validScore = true; - return swagShit; - } -} diff --git a/source/funkin/utils/CoolUtil.hx b/source/funkin/utils/CoolUtil.hx index 2ca555a6..1752362f 100644 --- a/source/funkin/utils/CoolUtil.hx +++ b/source/funkin/utils/CoolUtil.hx @@ -1,6 +1,5 @@ package funkin.utils; -import funkin.system.Song; import funkin.system.Conductor; import flixel.system.FlxSoundGroup; import animateatlas.AtlasFrameMaker;