From 11c76edd93ca03ca85f822f4a2245ab76a683a0e Mon Sep 17 00:00:00 2001 From: CuckyDev Date: Mon, 12 Jul 2021 01:43:05 -0400 Subject: [PATCH] Fix beat code and pixel sustain ends --- source/MusicBeatState.hx | 16 +++++++++++++--- source/MusicBeatSubstate.hx | 16 +++++++++++++--- source/Note.hx | 23 ++++++++++++++--------- source/PlayState.hx | 16 ++++++++-------- source/TitleState.hx | 2 ++ 5 files changed, 50 insertions(+), 23 deletions(-) diff --git a/source/MusicBeatState.hx b/source/MusicBeatState.hx index 6eb151c..9deb2bf 100644 --- a/source/MusicBeatState.hx +++ b/source/MusicBeatState.hx @@ -53,11 +53,21 @@ class MusicBeatState extends FlxUIState //everyStep(); var nextStep:Int = updateCurStep(); - if (nextStep > curStep && curStep >= 0) + if (nextStep >= 0) { - for (i in curStep...nextStep) + if (nextStep > curStep) { - curStep++; + for (i in curStep...nextStep) + { + curStep++; + updateBeat(); + stepHit(); + } + } + else if (nextStep < curStep) + { + //Song reset? + curStep = nextStep; updateBeat(); stepHit(); } diff --git a/source/MusicBeatSubstate.hx b/source/MusicBeatSubstate.hx index 1be9789..ee15697 100644 --- a/source/MusicBeatSubstate.hx +++ b/source/MusicBeatSubstate.hx @@ -26,11 +26,21 @@ class MusicBeatSubstate extends FlxSubState //everyStep(); var nextStep = updateCurStep(); - if (nextStep > curStep && curStep >= 0) + if (nextStep >= 0) { - for (i in curStep...nextStep) + if (nextStep > curStep) { - curStep++; + for (i in curStep...nextStep) + { + curStep++; + updateBeat(); + stepHit(); + } + } + else if (nextStep < curStep) + { + //Song reset? + curStep = nextStep; updateBeat(); stepHit(); } diff --git a/source/Note.hx b/source/Note.hx index 1c0985c..58c70c0 100644 --- a/source/Note.hx +++ b/source/Note.hx @@ -35,6 +35,8 @@ class Note extends FlxSprite public var noteScore:Float = 1; + public var noteYOff:Int = 0; + public static var swagWidth:Float = 160 * 0.7; public static var PURP_NOTE:Int = 0; public static var GREEN_NOTE:Int = 2; @@ -92,8 +94,6 @@ class Note extends FlxSprite //defaults if no noteStyle was found in chart var noteTypeCheck:String = 'normal'; - if (PlayState.curStage.startsWith('school')) - noteTypeCheck = 'pixel'; if (inCharter) { @@ -185,6 +185,14 @@ class Note extends FlxSprite x += width / 2; + switch (noteTypeCheck) + { + case 'pixel': + noteYOff = -13; + default: + noteYOff = 0; + } + originColor = prevNote.originColor; animation.play(dataColor[originColor] + 'holdend'); // This works both for normal colors and quantization colors @@ -192,9 +200,8 @@ class Note extends FlxSprite x -= width / 2; - if (noteTypeCheck == 'pixel') - x += 30; - + //if (noteTypeCheck == 'pixel') + // x += 30; if (inCharter) x += 30; @@ -202,10 +209,8 @@ class Note extends FlxSprite { prevNote.animation.play(dataColor[prevNote.originColor] + 'hold'); - if(FlxG.save.data.scrollSpeed != 1) - prevNote.scale.y *= Conductor.stepCrochet / 100 * 1.5 * FlxG.save.data.scrollSpeed; - else - prevNote.scale.y *= Conductor.stepCrochet / 100 * 1.5 * PlayState.SONG.speed; + prevNote.noteYOff = 0; + prevNote.scale.y *= (0.45 * Conductor.stepCrochet * FlxMath.roundDecimal(PlayStateChangeables.scrollSpeed == 1 ? PlayState.SONG.speed : PlayStateChangeables.scrollSpeed, 2)) / prevNote.height * 1.01; //The 1.01 is so that there aren't odd 1 pixel gaps as the notes scroll prevNote.updateHitbox(); // prevNote.setGraphicSize(); } diff --git a/source/PlayState.hx b/source/PlayState.hx index c7b846b..772ac89 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -2640,6 +2640,8 @@ class PlayState extends MusicBeatState if (generatedMusic) { + var holdArray:Array = [controls.LEFT, controls.DOWN, controls.UP, controls.RIGHT]; + notes.forEachAlive(function(daNote:Note) { // instead of doing stupid y > FlxG.height @@ -2661,14 +2663,12 @@ class PlayState extends MusicBeatState { if (daNote.mustPress) daNote.y = (playerStrums.members[Math.floor(Math.abs(daNote.noteData))].y - + - 0.45 * (Conductor.songPosition - daNote.strumTime) * FlxMath.roundDecimal(PlayStateChangeables.scrollSpeed == 1 ? SONG.speed : PlayStateChangeables.scrollSpeed, - 2)); + + 0.45 * (Conductor.songPosition - daNote.strumTime) * FlxMath.roundDecimal(PlayStateChangeables.scrollSpeed == 1 ? SONG.speed : PlayStateChangeables.scrollSpeed, + 2)) - daNote.noteYOff; else daNote.y = (strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].y - + - 0.45 * (Conductor.songPosition - daNote.strumTime) * FlxMath.roundDecimal(PlayStateChangeables.scrollSpeed == 1 ? SONG.speed : PlayStateChangeables.scrollSpeed, - 2)); + + 0.45 * (Conductor.songPosition - daNote.strumTime) * FlxMath.roundDecimal(PlayStateChangeables.scrollSpeed == 1 ? SONG.speed : PlayStateChangeables.scrollSpeed, + 2)) - daNote.noteYOff; if (daNote.isSustainNote) { // Remember = minus makes notes go up, plus makes them go down @@ -2710,11 +2710,11 @@ class PlayState extends MusicBeatState if (daNote.mustPress) daNote.y = (playerStrums.members[Math.floor(Math.abs(daNote.noteData))].y - 0.45 * (Conductor.songPosition - daNote.strumTime) * FlxMath.roundDecimal(PlayStateChangeables.scrollSpeed == 1 ? SONG.speed : PlayStateChangeables.scrollSpeed, - 2)); + 2)) + daNote.noteYOff; else daNote.y = (strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].y - 0.45 * (Conductor.songPosition - daNote.strumTime) * FlxMath.roundDecimal(PlayStateChangeables.scrollSpeed == 1 ? SONG.speed : PlayStateChangeables.scrollSpeed, - 2)); + 2)) + daNote.noteYOff; if (daNote.isSustainNote) { daNote.y -= daNote.height / 2; diff --git a/source/TitleState.hx b/source/TitleState.hx index dadc361..13c4660 100644 --- a/source/TitleState.hx +++ b/source/TitleState.hx @@ -364,6 +364,8 @@ class TitleState extends MusicBeatState switch (curBeat) { + case 0: + deleteCoolText(); case 1: createCoolText(['ninjamuffin99', 'phantomArcade', 'kawaisprite', 'evilsk8er']); // credTextShit.visible = true;