From 06c1b79761311bc9b08123cd383c25c53415405b Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Mon, 29 Nov 2021 21:43:38 -0500 Subject: [PATCH] rename Song.hx class to SongLoad, and removed unneeded shit --- source/Character.hx | 2 +- source/ChartingState.hx | 6 +++--- source/Conductor.hx | 2 +- source/FreeplayState.hx | 2 +- source/PauseSubState.hx | 2 +- source/PlayState.hx | 8 ++++---- source/{Song.hx => SongLoad.hx} | 19 +------------------ source/StoryMenuState.hx | 2 +- 8 files changed, 13 insertions(+), 30 deletions(-) rename source/{Song.hx => SongLoad.hx} (78%) diff --git a/source/Character.hx b/source/Character.hx index bdd0bf6e0..b2eb52899 100644 --- a/source/Character.hx +++ b/source/Character.hx @@ -550,7 +550,7 @@ class Character extends FlxSprite public function loadMappedAnims() { - var swagshit = Song.loadFromJson('picospeaker', 'stress'); + var swagshit = SongLoad.loadFromJson('picospeaker', 'stress'); var notes = swagshit.notes[0]; diff --git a/source/ChartingState.hx b/source/ChartingState.hx index 28255ded8..a544f477a 100644 --- a/source/ChartingState.hx +++ b/source/ChartingState.hx @@ -2,7 +2,7 @@ package; import Conductor.BPMChangeEvent; import Section.SwagSection; -import Song.SwagSong; +import SongLoad.SwagSong; import dsp.FFT; import flixel.FlxSprite; import flixel.FlxStrip; @@ -1275,13 +1275,13 @@ class ChartingState extends MusicBeatState function loadJson(song:String):Void { - PlayState.SONG = Song.loadFromJson(song.toLowerCase(), song.toLowerCase()); + PlayState.SONG = SongLoad.loadFromJson(song.toLowerCase(), song.toLowerCase()); LoadingState.loadAndSwitchState(new ChartingState()); } function loadAutosave():Void { - PlayState.SONG = Song.parseJSONshit(FlxG.save.data.autosave); + PlayState.SONG = SongLoad.parseJSONshit(FlxG.save.data.autosave); FlxG.resetState(); } diff --git a/source/Conductor.hx b/source/Conductor.hx index 02067334c..6be7e9f75 100644 --- a/source/Conductor.hx +++ b/source/Conductor.hx @@ -1,6 +1,6 @@ package; -import Song.SwagSong; +import SongLoad.SwagSong; /** * ... diff --git a/source/FreeplayState.hx b/source/FreeplayState.hx index 455a50c10..30c30cfd7 100644 --- a/source/FreeplayState.hx +++ b/source/FreeplayState.hx @@ -482,7 +482,7 @@ class FreeplayState extends MusicBeatState curDifficulty = 1; }*/ - PlayState.SONG = Song.loadFromJson(poop + '-new', songs[curSelected].songName.toLowerCase()); + PlayState.SONG = SongLoad.loadFromJson(poop + '-new', songs[curSelected].songName.toLowerCase()); PlayState.isStoryMode = false; PlayState.storyDifficulty = curDifficulty; diff --git a/source/PauseSubState.hx b/source/PauseSubState.hx index 1d7e3c1d0..8a1f926a4 100644 --- a/source/PauseSubState.hx +++ b/source/PauseSubState.hx @@ -156,7 +156,7 @@ class PauseSubState extends MusicBeatSubstate case "Resume": close(); case "EASY" | 'NORMAL' | "HARD": - PlayState.SONG = Song.loadFromJson(Highscore.formatSong(PlayState.SONG.song.toLowerCase(), curSelected), + PlayState.SONG = SongLoad.loadFromJson(Highscore.formatSong(PlayState.SONG.song.toLowerCase(), curSelected), PlayState.SONG.song.toLowerCase()); PlayState.storyDifficulty = curSelected; diff --git a/source/PlayState.hx b/source/PlayState.hx index 7adc419eb..917a88b3b 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -1,7 +1,7 @@ package; import Section.SwagSection; -import Song.SwagSong; +import SongLoad.SwagSong; import flixel.FlxCamera; import flixel.FlxObject; import flixel.FlxSprite; @@ -160,7 +160,7 @@ class PlayState extends MusicBeatState persistentDraw = true; if (SONG == null) - SONG = Song.loadFromJson('tutorial'); + SONG = SongLoad.loadFromJson('tutorial'); Conductor.mapBPMChanges(SONG); Conductor.changeBPM(SONG.bpm); @@ -2380,7 +2380,7 @@ class PlayState extends MusicBeatState FlxG.sound.play(Paths.sound('Lights_Shut_off'), function() { // no camFollow so it centers on horror tree - SONG = Song.loadFromJson(storyPlaylist[0].toLowerCase() + difficulty, storyPlaylist[0]); + SONG = SongLoad.loadFromJson(storyPlaylist[0].toLowerCase() + difficulty, storyPlaylist[0]); LoadingState.loadAndSwitchState(new PlayState()); }); } @@ -2388,7 +2388,7 @@ class PlayState extends MusicBeatState { prevCamFollow = camFollow; - SONG = Song.loadFromJson(storyPlaylist[0].toLowerCase() + difficulty, storyPlaylist[0]); + SONG = SongLoad.loadFromJson(storyPlaylist[0].toLowerCase() + difficulty, storyPlaylist[0]); LoadingState.loadAndSwitchState(new PlayState()); } } diff --git a/source/Song.hx b/source/SongLoad.hx similarity index 78% rename from source/Song.hx rename to source/SongLoad.hx index e486a9792..e37d239fe 100644 --- a/source/Song.hx +++ b/source/SongLoad.hx @@ -21,24 +21,8 @@ typedef SwagSong = var validScore:Bool; } -class Song +class SongLoad { - public var song:String; - public var notes:Array>; - public var bpm:Float; - public var needsVoices:Bool = true; - public var speed:Float = 1; - - public var player1:String = 'bf'; - public var player2:String = 'dad'; - - public function new(song, notes, bpm) - { - this.song = song; - this.notes = notes; - this.bpm = bpm; - } - public static function loadFromJson(jsonInput:String, ?folder:String):SwagSong { var rawJson = Assets.getText(Paths.json(folder.toLowerCase() + '/' + jsonInput.toLowerCase())).trim(); @@ -72,7 +56,6 @@ class Song { var swagShit:SwagSong = cast Json.parse(rawJson).song; swagShit.validScore = true; - trace(swagShit.notes[Conductor.curNotes]); // swagShit.notes[0] = cast Json.parse(rawJson).song.notes[Conductor.curNotes]; // by default uses return swagShit; } diff --git a/source/StoryMenuState.hx b/source/StoryMenuState.hx index 8c75e1268..da974ae18 100644 --- a/source/StoryMenuState.hx +++ b/source/StoryMenuState.hx @@ -322,7 +322,7 @@ class StoryMenuState extends MusicBeatState PlayState.storyDifficulty = curDifficulty; - PlayState.SONG = Song.loadFromJson(PlayState.storyPlaylist[0].toLowerCase() + diffic, PlayState.storyPlaylist[0].toLowerCase()); + PlayState.SONG = SongLoad.loadFromJson(PlayState.storyPlaylist[0].toLowerCase() + diffic, PlayState.storyPlaylist[0].toLowerCase()); PlayState.storyWeek = curWeek; PlayState.campaignScore = 0; new FlxTimer().start(1, function(tmr:FlxTimer)