rename Song.hx class to SongLoad, and removed unneeded shit

This commit is contained in:
Cameron Taylor 2021-11-29 21:43:38 -05:00
parent 47703418bf
commit 06c1b79761
8 changed files with 13 additions and 30 deletions

View file

@ -550,7 +550,7 @@ class Character extends FlxSprite
public function loadMappedAnims() public function loadMappedAnims()
{ {
var swagshit = Song.loadFromJson('picospeaker', 'stress'); var swagshit = SongLoad.loadFromJson('picospeaker', 'stress');
var notes = swagshit.notes[0]; var notes = swagshit.notes[0];

View file

@ -2,7 +2,7 @@ package;
import Conductor.BPMChangeEvent; import Conductor.BPMChangeEvent;
import Section.SwagSection; import Section.SwagSection;
import Song.SwagSong; import SongLoad.SwagSong;
import dsp.FFT; import dsp.FFT;
import flixel.FlxSprite; import flixel.FlxSprite;
import flixel.FlxStrip; import flixel.FlxStrip;
@ -1275,13 +1275,13 @@ class ChartingState extends MusicBeatState
function loadJson(song:String):Void 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()); LoadingState.loadAndSwitchState(new ChartingState());
} }
function loadAutosave():Void function loadAutosave():Void
{ {
PlayState.SONG = Song.parseJSONshit(FlxG.save.data.autosave); PlayState.SONG = SongLoad.parseJSONshit(FlxG.save.data.autosave);
FlxG.resetState(); FlxG.resetState();
} }

View file

@ -1,6 +1,6 @@
package; package;
import Song.SwagSong; import SongLoad.SwagSong;
/** /**
* ... * ...

View file

@ -482,7 +482,7 @@ class FreeplayState extends MusicBeatState
curDifficulty = 1; 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.isStoryMode = false;
PlayState.storyDifficulty = curDifficulty; PlayState.storyDifficulty = curDifficulty;

View file

@ -156,7 +156,7 @@ class PauseSubState extends MusicBeatSubstate
case "Resume": case "Resume":
close(); close();
case "EASY" | 'NORMAL' | "HARD": 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.SONG.song.toLowerCase());
PlayState.storyDifficulty = curSelected; PlayState.storyDifficulty = curSelected;

View file

@ -1,7 +1,7 @@
package; package;
import Section.SwagSection; import Section.SwagSection;
import Song.SwagSong; import SongLoad.SwagSong;
import flixel.FlxCamera; import flixel.FlxCamera;
import flixel.FlxObject; import flixel.FlxObject;
import flixel.FlxSprite; import flixel.FlxSprite;
@ -160,7 +160,7 @@ class PlayState extends MusicBeatState
persistentDraw = true; persistentDraw = true;
if (SONG == null) if (SONG == null)
SONG = Song.loadFromJson('tutorial'); SONG = SongLoad.loadFromJson('tutorial');
Conductor.mapBPMChanges(SONG); Conductor.mapBPMChanges(SONG);
Conductor.changeBPM(SONG.bpm); Conductor.changeBPM(SONG.bpm);
@ -2380,7 +2380,7 @@ class PlayState extends MusicBeatState
FlxG.sound.play(Paths.sound('Lights_Shut_off'), function() FlxG.sound.play(Paths.sound('Lights_Shut_off'), function()
{ {
// no camFollow so it centers on horror tree // 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()); LoadingState.loadAndSwitchState(new PlayState());
}); });
} }
@ -2388,7 +2388,7 @@ class PlayState extends MusicBeatState
{ {
prevCamFollow = camFollow; prevCamFollow = camFollow;
SONG = Song.loadFromJson(storyPlaylist[0].toLowerCase() + difficulty, storyPlaylist[0]); SONG = SongLoad.loadFromJson(storyPlaylist[0].toLowerCase() + difficulty, storyPlaylist[0]);
LoadingState.loadAndSwitchState(new PlayState()); LoadingState.loadAndSwitchState(new PlayState());
} }
} }

View file

@ -21,24 +21,8 @@ typedef SwagSong =
var validScore:Bool; var validScore:Bool;
} }
class Song class SongLoad
{ {
public var song:String;
public var notes:Array<Array<SwagSection>>;
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 public static function loadFromJson(jsonInput:String, ?folder:String):SwagSong
{ {
var rawJson = Assets.getText(Paths.json(folder.toLowerCase() + '/' + jsonInput.toLowerCase())).trim(); 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; var swagShit:SwagSong = cast Json.parse(rawJson).song;
swagShit.validScore = true; swagShit.validScore = true;
trace(swagShit.notes[Conductor.curNotes]);
// swagShit.notes[0] = cast Json.parse(rawJson).song.notes[Conductor.curNotes]; // by default uses // swagShit.notes[0] = cast Json.parse(rawJson).song.notes[Conductor.curNotes]; // by default uses
return swagShit; return swagShit;
} }

View file

@ -322,7 +322,7 @@ class StoryMenuState extends MusicBeatState
PlayState.storyDifficulty = curDifficulty; 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.storyWeek = curWeek;
PlayState.campaignScore = 0; PlayState.campaignScore = 0;
new FlxTimer().start(1, function(tmr:FlxTimer) new FlxTimer().start(1, function(tmr:FlxTimer)