From 4b5173f9b7a66030b6898fe07d744984023f6d2e Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Tue, 22 Jun 2021 15:54:53 -0400 Subject: [PATCH] in-engine shit for new chart format --- source/Conductor.hx | 13 +++++-------- source/Note.hx | 2 +- source/PlayState.hx | 29 +++++++++++++++-------------- source/Song.hx | 6 +++--- 4 files changed, 24 insertions(+), 26 deletions(-) diff --git a/source/Conductor.hx b/source/Conductor.hx index 9f3f50031..cbcc10bfb 100644 --- a/source/Conductor.hx +++ b/source/Conductor.hx @@ -6,7 +6,6 @@ import Song.SwagSong; * ... * @author */ - typedef BPMChangeEvent = { var stepTime:Int; @@ -28,9 +27,7 @@ class Conductor public static var bpmChangeMap:Array = []; - public function new() - { - } + public function new() {} public static function mapBPMChanges(song:SwagSong) { @@ -39,11 +36,11 @@ class Conductor var curBPM:Float = song.bpm; var totalSteps:Int = 0; var totalPos:Float = 0; - for (i in 0...song.notes.length) + for (i in 0...song.notes[PlayState.storyDifficulty].length) { - if(song.notes[i].changeBPM && song.notes[i].bpm != curBPM) + if (song.notes[PlayState.storyDifficulty][i].changeBPM && song.notes[PlayState.storyDifficulty][i].bpm != curBPM) { - curBPM = song.notes[i].bpm; + curBPM = song.notes[PlayState.storyDifficulty][i].bpm; var event:BPMChangeEvent = { stepTime: totalSteps, songTime: totalPos, @@ -52,7 +49,7 @@ class Conductor bpmChangeMap.push(event); } - var deltaSteps:Int = song.notes[i].lengthInSteps; + var deltaSteps:Int = song.notes[PlayState.storyDifficulty][i].lengthInSteps; totalSteps += deltaSteps; totalPos += ((60 / curBPM) * 1000 / 4) * deltaSteps; } diff --git a/source/Note.hx b/source/Note.hx index 00acfcb34..63e18be4c 100644 --- a/source/Note.hx +++ b/source/Note.hx @@ -187,7 +187,7 @@ class Note extends FlxSprite prevNote.animation.play('redhold'); } - prevNote.scale.y *= Conductor.stepCrochet / 100 * 1.5 * PlayState.SONG.speed; + prevNote.scale.y *= Conductor.stepCrochet / 100 * 1.5 * PlayState.SONG.speed[PlayState.storyDifficulty]; prevNote.updateHitbox(); // prevNote.setGraphicSize(); } diff --git a/source/PlayState.hx b/source/PlayState.hx index cecedd341..ed6377643 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -1594,7 +1594,7 @@ class PlayState extends MusicBeatState var noteData:Array; // NEW SHIT - noteData = songData.notes; + noteData = songData.notes[storyDifficulty]; for (section in noteData) { @@ -2003,9 +2003,9 @@ class PlayState extends MusicBeatState changeSection(-1); #end - if (generatedMusic && SONG.notes[Std.int(curStep / 16)] != null) + if (generatedMusic && SONG.notes[storyDifficulty][Std.int(curStep / 16)] != null) { - cameraRightSide = SONG.notes[Std.int(curStep / 16)].mustHitSection; + cameraRightSide = SONG.notes[storyDifficulty][Std.int(curStep / 16)].mustHitSection; cameraMovement(); } @@ -2093,7 +2093,8 @@ class PlayState extends MusicBeatState } } - while (unspawnNotes[0] != null && unspawnNotes[0].strumTime - Conductor.songPosition < 1800 / SONG.speed) + while (unspawnNotes[0] != null + && unspawnNotes[0].strumTime - Conductor.songPosition < 1800 / SONG.speed[PlayState.storyDifficulty]) { var dunceNote:Note = unspawnNotes[0]; notes.add(dunceNote); @@ -2122,7 +2123,7 @@ class PlayState extends MusicBeatState if (PreferencesMenu.getPref('downscroll')) { - daNote.y = (strumLine.y + (Conductor.songPosition - daNote.strumTime) * (0.45 * FlxMath.roundDecimal(SONG.speed, 2))); + daNote.y = (strumLine.y + (Conductor.songPosition - daNote.strumTime) * (0.45 * FlxMath.roundDecimal(SONG.speed[storyDifficulty], 2))); if (daNote.isSustainNote) { @@ -2145,7 +2146,7 @@ class PlayState extends MusicBeatState } else { - daNote.y = (strumLine.y - (Conductor.songPosition - daNote.strumTime) * (0.45 * FlxMath.roundDecimal(SONG.speed, 2))); + daNote.y = (strumLine.y - (Conductor.songPosition - daNote.strumTime) * (0.45 * FlxMath.roundDecimal(SONG.speed[storyDifficulty], 2))); if (daNote.isSustainNote && (!daNote.mustPress || (daNote.wasGoodHit || (daNote.prevNote.wasGoodHit && !daNote.canBeHit))) @@ -2166,9 +2167,9 @@ class PlayState extends MusicBeatState var altAnim:String = ""; - if (SONG.notes[Math.floor(curStep / 16)] != null) + if (SONG.notes[storyDifficulty][Math.floor(curStep / 16)] != null) { - if (SONG.notes[Math.floor(curStep / 16)].altAnim) + if (SONG.notes[storyDifficulty][Math.floor(curStep / 16)].altAnim) altAnim = '-alt'; } @@ -2262,9 +2263,9 @@ class PlayState extends MusicBeatState var daPos:Float = 0; for (i in 0...(Std.int(curStep / 16 + sec))) { - if (SONG.notes[i].changeBPM) + if (SONG.notes[storyDifficulty][i].changeBPM) { - daBPM = SONG.notes[i].bpm; + daBPM = SONG.notes[storyDifficulty][i].bpm; } daPos += 4 * (1000 * 60 / daBPM); } @@ -2973,17 +2974,17 @@ class PlayState extends MusicBeatState notes.sort(sortNotes, FlxSort.DESCENDING); } - if (SONG.notes[Math.floor(curStep / 16)] != null) + if (SONG.notes[storyDifficulty][Math.floor(curStep / 16)] != null) { - if (SONG.notes[Math.floor(curStep / 16)].changeBPM) + if (SONG.notes[storyDifficulty][Math.floor(curStep / 16)].changeBPM) { - Conductor.changeBPM(SONG.notes[Math.floor(curStep / 16)].bpm); + Conductor.changeBPM(SONG.notes[storyDifficulty][Math.floor(curStep / 16)].bpm); FlxG.log.add('CHANGED BPM!'); } // else // Conductor.changeBPM(SONG.bpm); } - // FlxG.log.add('change bpm' + SONG.notes[Std.int(curStep / 16)].changeBPM); + // FlxG.log.add('change bpm' + SONG.notes[storyDifficulty][Std.int(curStep / 16)].changeBPM); wiggleShit.update(Conductor.crochet); // HARDCODING FOR MILF ZOOMS! diff --git a/source/Song.hx b/source/Song.hx index 2ea2a2f81..73ca02fe3 100644 --- a/source/Song.hx +++ b/source/Song.hx @@ -10,10 +10,10 @@ using StringTools; typedef SwagSong = { var song:String; - var notes:Array; + var notes:Array>; var bpm:Float; var needsVoices:Bool; - var speed:Float; + var speed:Array; var player1:String; var player2:String; @@ -26,7 +26,7 @@ class Song public var notes:Array; public var bpm:Float; public var needsVoices:Bool = true; - public var speed:Float = 1; + public var speed:Array = [1, 1, 1]; public var player1:String = 'bf'; public var player2:String = 'dad';