From 0cb23f7972af48197b150713ff193a3bc3d7f77b Mon Sep 17 00:00:00 2001 From: Detoria Date: Wed, 24 Mar 2021 04:48:14 -0300 Subject: [PATCH] Fixed Note Speed --- source/Note.hx | 58 +++++++++++++++++++++---------- source/OptionsMenu.hx | 80 +++++++++++++++++++++++++++++++++++++++---- source/PlayState.hx | 11 ++++-- 3 files changed, 121 insertions(+), 28 deletions(-) diff --git a/source/Note.hx b/source/Note.hx index c7cde28..88793ec 100644 --- a/source/Note.hx +++ b/source/Note.hx @@ -40,8 +40,9 @@ class Note extends FlxSprite if (prevNote == null) prevNote = this; - if (FlxG.save.data.downscroll) - flipY = true; + // And have up and down arrows flipped too? Nop + /* if (FlxG.save.data.downscroll) + flipY = true; */ this.prevNote = prevNote; isSustainNote = sustainNote; @@ -49,6 +50,7 @@ class Note extends FlxSprite x += 50; // MAKE SURE ITS DEFINITELY OFF SCREEN? y -= 2000; + this.strumTime = strumTime + FlxG.save.data.offset; this.noteData = noteData; @@ -64,20 +66,30 @@ class Note extends FlxSprite animation.add('redScroll', [7]); animation.add('blueScroll', [5]); animation.add('purpleScroll', [4]); - + + // Hold piece + animation.add('purplehold', [0]); + animation.add('greenhold', [2]); + animation.add('redhold', [3]); + animation.add('bluehold', [1]); + if (isSustainNote) { loadGraphic(Paths.image('weeb/pixelUI/arrowEnds'), true, 7, 6); - animation.add('purpleholdend', [4]); - animation.add('greenholdend', [6]); - animation.add('redholdend', [7]); - animation.add('blueholdend', [5]); - - animation.add('purplehold', [0]); - animation.add('greenhold', [2]); - animation.add('redhold', [3]); - animation.add('bluehold', [1]); + if(!FlxG.save.data.downscroll) + { + // Trail end + animation.add('purpleholdend', [4]); + animation.add('greenholdend', [6]); + animation.add('redholdend', [7]); + animation.add('blueholdend', [5]); + }else { + animation.add('purpleholdend', [4], 0, false, false, true); + animation.add('greenholdend', [6], 0, false, false, true); + animation.add('redholdend', [7], 0, false, false, true); + animation.add('blueholdend', [5], 0, false, false, true); + } } setGraphicSize(Std.int(width * PlayState.daPixelZoom)); @@ -90,16 +102,24 @@ class Note extends FlxSprite animation.addByPrefix('redScroll', 'red0'); animation.addByPrefix('blueScroll', 'blue0'); animation.addByPrefix('purpleScroll', 'purple0'); - - animation.addByPrefix('purpleholdend', 'pruple end hold'); - animation.addByPrefix('greenholdend', 'green hold end'); - animation.addByPrefix('redholdend', 'red hold end'); - animation.addByPrefix('blueholdend', 'blue hold end'); - + animation.addByPrefix('purplehold', 'purple hold piece'); animation.addByPrefix('greenhold', 'green hold piece'); animation.addByPrefix('redhold', 'red hold piece'); animation.addByPrefix('bluehold', 'blue hold piece'); + + if(!FlxG.save.data.downscroll) + { + animation.addByPrefix('purpleholdend', 'pruple end hold'); + animation.addByPrefix('greenholdend', 'green hold end'); + animation.addByPrefix('redholdend', 'red hold end'); + animation.addByPrefix('blueholdend', 'blue hold end'); + }else { + animation.addByPrefix('purpleholdend', 'pruple end hold', 0, false, false, true); + animation.addByPrefix('greenholdend', 'green hold end', 0, false, false, true); + animation.addByPrefix('redholdend', 'red hold end', 0, false, false, true); + animation.addByPrefix('blueholdend', 'blue hold end', 0, false, false, true); + } setGraphicSize(Std.int(width * 0.7)); updateHitbox(); @@ -164,7 +184,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 * FlxG.save.data.noteSpeed; prevNote.updateHitbox(); // prevNote.setGraphicSize(); } diff --git a/source/OptionsMenu.hx b/source/OptionsMenu.hx index 68ee6e7..1dea8a7 100644 --- a/source/OptionsMenu.hx +++ b/source/OptionsMenu.hx @@ -17,6 +17,8 @@ class OptionsMenu extends MusicBeatState { var selector:FlxText; var curSelected:Int = 0; + var chartSpeed:FlxText; + var speedState:String; var controlsStrings:Array = []; @@ -31,6 +33,7 @@ class OptionsMenu extends MusicBeatState "\n" + (FlxG.save.data.downscroll ? 'Downscroll' : 'Upscroll') + "\nAccuracy " + (!FlxG.save.data.accuracyDisplay ? "off" : "on") + "\nSong Position " + (!FlxG.save.data.songPosition ? "off" : "on") + + "\nNote Speed" + "\nEtterna Mode " + (!FlxG.save.data.etternaMode ? "off" : "on") + "\nLoad replays"); @@ -61,6 +64,20 @@ class OptionsMenu extends MusicBeatState versionShit.setFormat("VCR OSD Mono", 16, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK); add(versionShit); + var tmp_Speed:Float = FlxG.save.data.noteSpeed; + + chartSpeed = new FlxText(FlxG.width - 387, FlxG.height - 18, 0, "Note Speed (Hover, then Left and Right): " + tmp_Speed, 12); + chartSpeed.scrollFactor.set(); + chartSpeed.setFormat("VCR OSD Mono", 16, FlxColor.WHITE, LEFT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK); + + if(tmp_Speed == -1) chartSpeed.x = FlxG.width - 470; + else if(tmp_Speed == 1.5 || tmp_Speed == 2.5 || tmp_Speed == 3.5) chartSpeed.x = FlxG.width - 405; + else chartSpeed.x = FlxG.width - 387; + + if(FlxG.save.data.noteSpeed > 0) chartSpeed.text = "Note Speed (Hover, then Left and Right): " + FlxG.save.data.noteSpeed.toString(); + else chartSpeed.text = "Note Speed (Hover, then Left and Right): Song Based"; + add(chartSpeed); + super.create(); } @@ -77,21 +94,72 @@ class OptionsMenu extends MusicBeatState if (controls.RIGHT_R) { - FlxG.save.data.offset++; - versionShit.text = "Offset (Left, Right): " + FlxG.save.data.offset; + if(curSelected != 5) + { + FlxG.save.data.offset++; + versionShit.text = "Offset (Left, Right): " + FlxG.save.data.offset; + }else { + if(FlxG.save.data.noteSpeed < 4.0) + if(FlxG.save.data.noteSpeed == -1) FlxG.save.data.noteSpeed = 1.0; + else FlxG.save.data.noteSpeed += 0.5; + + grpControls.remove(grpControls.members[curSelected]); + var ctrl:Alphabet = new Alphabet(0, (70 * curSelected) + 30, "Note Speed", true, false); + ctrl.isMenuItem = true; + ctrl.targetY = curSelected - 5; + grpControls.add(ctrl); + + if(FlxG.save.data.noteSpeed > 0) speedState = FlxG.save.data.noteSpeed.toString(); + else speedState = "Song Based"; + + chartSpeed.text = "Note Speed (Hover, then Left and Right): " + speedState; + + trace(FlxG.save.data.noteSpeed); + } } if (controls.LEFT_R) + { + if(curSelected != 5) { FlxG.save.data.offset--; versionShit.text = "Offset (Left, Right): " + FlxG.save.data.offset; + }else { + if(FlxG.save.data.noteSpeed > 1.0) FlxG.save.data.noteSpeed -= 0.5; + else FlxG.save.data.noteSpeed = -1; + + trace(FlxG.save.data.noteSpeed); + var speedState = ""; + + if(FlxG.save.data.noteSpeed > 0) speedState = FlxG.save.data.noteSpeed.toString(); + else speedState = "Song Based"; + + chartSpeed.text = "Note Speed (Hover, then Left and Right): " + speedState; + + grpControls.remove(grpControls.members[curSelected]); + var ctrl:Alphabet = new Alphabet(0, (70 * curSelected) + 30, "Note Speed", true, false); + ctrl.isMenuItem = true; + ctrl.targetY = curSelected - 5; + grpControls.add(ctrl); + + trace(FlxG.save.data.noteSpeed); } + } + if(controls.LEFT_R && curSelected == 5 || controls.RIGHT_R && curSelected == 5 ) + { + var tmp_Speed:Float = FlxG.save.data.noteSpeed; + + if(tmp_Speed == -1) chartSpeed.x = FlxG.width - 470; + else if(tmp_Speed == 1.5 || tmp_Speed == 2.5 || tmp_Speed == 3.5) chartSpeed.x = FlxG.width - 405; + else chartSpeed.x = FlxG.width - 387; + } if (controls.ACCEPT) { - if (curSelected != 6) + if (curSelected != 7 && curSelected != 5) grpControls.remove(grpControls.members[curSelected]); + switch(curSelected) { case 0: @@ -129,13 +197,13 @@ class OptionsMenu extends MusicBeatState ctrl.isMenuItem = true; ctrl.targetY = curSelected - 4; grpControls.add(ctrl); - case 5: + case 6: FlxG.save.data.etternaMode = !FlxG.save.data.etternaMode; var ctrl:Alphabet = new Alphabet(0, (70 * curSelected) + 30, "Etterna Mode " + (!FlxG.save.data.etternaMode ? "off" : "on"), true, false); ctrl.isMenuItem = true; - ctrl.targetY = curSelected - 5; + ctrl.targetY = curSelected - 6; grpControls.add(ctrl); - case 6: + case 7: trace('switch'); FlxG.switchState(new LoadReplayState()); } diff --git a/source/PlayState.hx b/source/PlayState.hx index e4b9508..cdbc079 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -1878,9 +1878,14 @@ class PlayState extends MusicBeatState } if (FlxG.save.data.downscroll) - daNote.y = (strumLine.y - (Conductor.songPosition - daNote.strumTime) * (-0.45 * FlxMath.roundDecimal(SONG.speed, 2))); + if(FlxG.save.data.noteSpeed != -1) + daNote.y = (strumLine.y - (Conductor.songPosition - daNote.strumTime) * (-0.45 * FlxMath.roundDecimal(FlxG.save.data.noteSpeed, 2))); + else daNote.y = (strumLine.y - (Conductor.songPosition - daNote.strumTime) * (-0.45 * FlxMath.roundDecimal(SONG.speed, 2))); else - daNote.y = (strumLine.y - (Conductor.songPosition - daNote.strumTime) * (0.45 * FlxMath.roundDecimal(SONG.speed, 2))); + if(FlxG.save.data.noteSpeed != -1) + daNote.y = (strumLine.y - (Conductor.songPosition - daNote.strumTime) * (0.45 * FlxMath.roundDecimal(FlxG.save.data.noteSpeed, 2))); + else daNote.y = (strumLine.y - (Conductor.songPosition - daNote.strumTime) * (0.45 * FlxMath.roundDecimal(SONG.speed, 2))); + //trace(daNote.y); // WIP interpolation shit? Need to fix the pause issue // daNote.y = (strumLine.y - (songTime - daNote.strumTime) * (0.45 * PlayState.SONG.speed)); @@ -3025,4 +3030,4 @@ class PlayState extends MusicBeatState } var curLight:Int = 0; -} +} \ No newline at end of file