From 9f3a11a01a641ac269b79a71d3e2cfcc622a3864 Mon Sep 17 00:00:00 2001
From: Cameron Taylor <cameron.taylor.ninja@gmail.com>
Date: Mon, 31 Jan 2022 14:16:28 -0500
Subject: [PATCH] dynamic chart difficulties in progress

---
 source/Main.hx                   |  2 +-
 source/SongLoad.hx               | 20 ++++++++++++++++----
 source/modding/PolymodHandler.hx |  2 +-
 3 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/source/Main.hx b/source/Main.hx
index 6e9117a0d..5edf6f82a 100644
--- a/source/Main.hx
+++ b/source/Main.hx
@@ -19,7 +19,7 @@ class Main extends Sprite
 	var framerate:Int = 60; // How many frames per second the game should run at.
 	#else
 	// TODO: This should probably be in the options menu?
-	var framerate:Int = 300; // How many frames per second the game should run at.
+	var framerate:Int = 144; // How many frames per second the game should run at.
 	#end
 	var skipSplash:Bool = true; // Whether to skip the flixel splash screen that appears in release mode.
 	var startFullscreen:Bool = false; // Whether to start the game in fullscreen on desktop targets
diff --git a/source/SongLoad.hx b/source/SongLoad.hx
index 3a085c844..86ef861cd 100644
--- a/source/SongLoad.hx
+++ b/source/SongLoad.hx
@@ -12,6 +12,8 @@ typedef SwagSong =
 {
 	var song:String;
 	var notes:FunnyNotes;
+	var difficulties:Array<String>;
+	var noteMap:Map<String, Array<SwagSection>>;
 	var bpm:Float;
 	var needsVoices:Bool;
 	var voiceList:Array<String>;
@@ -119,6 +121,8 @@ class SongLoad
 		return {
 			song: 'Test',
 			notes: {easy: [], normal: [], hard: []},
+			difficulties: ["easy", "normal", "hard"],
+			noteMap: new Map(),
 			bpm: 150,
 			needsVoices: true,
 			player1: 'bf',
@@ -210,10 +214,16 @@ class SongLoad
 
 	public static function parseJSONshit(rawJson:String):SwagSong
 	{
-		var swagShit:SwagSong = cast Json.parse(rawJson).song;
-
-		for (diff in Reflect.fields(Json.parse(rawJson).song.notes))
+		var songParsed:Dynamic = Json.parse(rawJson);
+		var swagShit:SwagSong = cast songParsed.song;
+		swagShit.difficulties = []; // reset it to default before load
+		swagShit.noteMap = new Map();
+		for (diff in Reflect.fields(songParsed.song.notes))
 		{
+			swagShit.difficulties.push(diff);
+			swagShit.noteMap[diff] = cast Reflect.field(songParsed.song.notes, diff);
+			castArrayToNoteData(swagShit.noteMap[diff]);
+
 			switch (diff)
 			{
 				case "easy":
@@ -224,9 +234,11 @@ class SongLoad
 				case "hard":
 					castArrayToNoteData(swagShit.notes.hard);
 			}
-			trace(diff);
 		}
 
+		trace(swagShit.noteMap.toString());
+		trace('that was just notemap string lol');
+
 		swagShit.validScore = true;
 
 		trace("SONG SHIT ABOUTTA WEEK AGOOO");
diff --git a/source/modding/PolymodHandler.hx b/source/modding/PolymodHandler.hx
index d43c36425..51f2e6287 100644
--- a/source/modding/PolymodHandler.hx
+++ b/source/modding/PolymodHandler.hx
@@ -182,7 +182,7 @@ class PolymodHandler
 	}
 	#end
 
-	public static function getAllMods():Array<ModMetadata>
+	public static function getAllMods():Array<#if cpp ModMetadata #else Dynamic #end> // this is shitty but ModMetadata isn't imported on HTML5! And I'm too lazy to actually do it properly!
 	{
 		#if cpp
 		trace('Scanning the mods folder...');