diff --git a/source/KadeEngineData.hx b/source/KadeEngineData.hx index 6d0514d..78d86e4 100644 --- a/source/KadeEngineData.hx +++ b/source/KadeEngineData.hx @@ -66,6 +66,9 @@ class KadeEngineData if (FlxG.save.data.distractions == null) FlxG.save.data.distractions = true; + + if (FlxG.save.data.stepMania == null) + FlxG.save.data.stepMania = false; if (FlxG.save.data.flashing == null) FlxG.save.data.flashing = true; diff --git a/source/Note.hx b/source/Note.hx index fcccf4f..e5e7f5f 100644 --- a/source/Note.hx +++ b/source/Note.hx @@ -17,6 +17,9 @@ class Note extends FlxSprite { public var strumTime:Float = 0; public var baseStrum:Float = 0; + + public var rStrumTime:Float = 0; + public var mustPress:Bool = false; public var noteData:Int = 0; public var rawNoteData:Int = 0; @@ -27,6 +30,8 @@ class Note extends FlxSprite public var modifiedByLua:Bool = false; public var sustainLength:Float = 0; public var isSustainNote:Bool = false; + public var originColor:Int = 0; // The sustain note's original note's color + public var noteSection:Int = 0; public var noteScore:Float = 1; @@ -38,7 +43,12 @@ class Note extends FlxSprite public var rating:String = "shit"; + public var modAngle:Float = 0; // The angle set by modcharts + public var localAngle:Float = 0; // The angle to be edited inside Note.hx + public var dataColor:Array = ['purple', 'blue', 'green', 'red']; + public var quantityColor:Array = [RED_NOTE, 2, BLUE_NOTE, 2, PURP_NOTE, 2, BLUE_NOTE, 2]; + public var arrowAngles:Array = [180, 90, 270, 0]; public var isParent:Bool = false; public var parent:Note = null; @@ -60,10 +70,17 @@ class Note extends FlxSprite x += 50; // MAKE SURE ITS DEFINITELY OFF SCREEN? y -= 2000; + if (inCharter) + { this.strumTime = strumTime; - else + rStrumTime = strumTime; + } + else + { this.strumTime = Math.round(strumTime); + rStrumTime = strumTime - (FlxG.save.data.offset + PlayState.songOffset); + } if (this.strumTime < 0 ) @@ -127,9 +144,27 @@ class Note extends FlxSprite x += swagWidth * noteData; animation.play(dataColor[noteData] + 'Scroll'); + originColor = noteData; // The note's origin color will be checked by its sustain notes - // trace(prevNote); + if (FlxG.save.data.stepMania && !isSustainNote) + { + var strumCheck:Float = rStrumTime; + // I give up on fluctuating bpms. something has to be subtracted from strumCheck to make them look right but idk what. + // I'd use the note's section's start time but neither the note's section nor its start time are accessible by themselves + //strumCheck -= ??? + + var ind:Int = Std.int(Math.round(strumCheck / (Conductor.stepCrochet / 2))); + + var col:Int = 0; + col = quantityColor[ind % 8]; // Set the color depending on the beats + + animation.play(dataColor[col] + 'Scroll'); + localAngle -= arrowAngles[col]; + localAngle += arrowAngles[noteData]; + originColor = col; + } + // we make sure its downscroll and its a SUSTAIN NOTE (aka a trail, not a note) // and flip it so it doesn't look weird. // THIS DOESN'T FUCKING FLIP THE NOTE, CONTRIBUTERS DON'T JUST COMMENT THIS OUT JESUS @@ -144,8 +179,9 @@ class Note extends FlxSprite x += width / 2; - animation.play(dataColor[noteData] + 'holdend'); + originColor = prevNote.originColor; + animation.play(dataColor[originColor] + 'holdend'); // This works both for normal colors and quantization colors updateHitbox(); x -= width / 2; @@ -158,7 +194,7 @@ class Note extends FlxSprite if (prevNote.isSustainNote) { - prevNote.animation.play(dataColor[prevNote.noteData] + 'hold'); + 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; @@ -173,6 +209,7 @@ class Note extends FlxSprite override function update(elapsed:Float) { super.update(elapsed); + angle = modAngle + localAngle; if (!modifiedByLua) if (!sustainActive) diff --git a/source/Options.hx b/source/Options.hx index 574092f..10eb0b0 100644 --- a/source/Options.hx +++ b/source/Options.hx @@ -244,6 +244,26 @@ class DistractionsAndEffectsOption extends Option } } +class StepManiaOption extends Option +{ + public function new(desc:String) + { + super(); + description = desc; + } + public override function press():Bool + { + FlxG.save.data.stepMania = !FlxG.save.data.stepMania; + display = updateDisplay(); + return true; + } + + private override function updateDisplay():String + { + return "Colors by quantization " + (!FlxG.save.data.stepMania ? "off" : "on"); + } +} + class ResetButtonOption extends Option { public function new(desc:String) @@ -833,6 +853,7 @@ class ResetSettings extends Option FlxG.save.data.strumline = null; FlxG.save.data.customStrumLine = null; FlxG.save.data.camzoom = null; + FlxG.save.data.stepMania = null; KadeEngineData.initSave(); confirm = false; trace('All settings have been reset'); diff --git a/source/OptionsMenu.hx b/source/OptionsMenu.hx index 62d3091..f953f01 100644 --- a/source/OptionsMenu.hx +++ b/source/OptionsMenu.hx @@ -42,10 +42,11 @@ class OptionsMenu extends MusicBeatState new OptionCategory("Appearance", [ new DistractionsAndEffectsOption("Toggle stage distractions that can hinder your gameplay."), new CamZoomOption("Toggle the camera zoom in-game."), - new RainbowFPSOption("Make the FPS Counter Rainbow"), + new StepManiaOption("Sets the colors of the arrows depending on quantization instead of direction."), new AccuracyOption("Display accuracy information."), - new NPSDisplayOption("Shows your current Notes Per Second."), new SongPositionOption("Show the songs current position (as a bar)"), + new NPSDisplayOption("Shows your current Notes Per Second."), + new RainbowFPSOption("Make the FPS Counter Rainbow"), new CpuStrums("CPU's strumline lights up when a note hits it."), ]), diff --git a/source/PlayState.hx b/source/PlayState.hx index df80006..e82619d 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -241,6 +241,7 @@ class PlayState extends MusicBeatState // Animation common suffixes private var dataSuffix:Array = ['LEFT', 'DOWN', 'UP', 'RIGHT']; + private var dataColor:Array = ['purple', 'blue', 'green', 'red']; // API stuff @@ -1878,73 +1879,23 @@ class PlayState extends MusicBeatState babyArrow.animation.add('confirm', [12, 16], 24, false); } - case 'normal': - babyArrow.frames = Paths.getSparrowAtlas('NOTE_assets'); - babyArrow.animation.addByPrefix('green', 'arrowUP'); - babyArrow.animation.addByPrefix('blue', 'arrowDOWN'); - babyArrow.animation.addByPrefix('purple', 'arrowLEFT'); - babyArrow.animation.addByPrefix('red', 'arrowRIGHT'); - - babyArrow.antialiasing = true; - babyArrow.setGraphicSize(Std.int(babyArrow.width * 0.7)); - - switch (Math.abs(i)) - { - case 2: - babyArrow.x += Note.swagWidth * 2; - babyArrow.animation.addByPrefix('static', 'arrowUP'); - babyArrow.animation.addByPrefix('pressed', 'up press', 24, false); - babyArrow.animation.addByPrefix('confirm', 'up confirm', 24, false); - case 3: - babyArrow.x += Note.swagWidth * 3; - babyArrow.animation.addByPrefix('static', 'arrowRIGHT'); - babyArrow.animation.addByPrefix('pressed', 'right press', 24, false); - babyArrow.animation.addByPrefix('confirm', 'right confirm', 24, false); - case 1: - babyArrow.x += Note.swagWidth * 1; - babyArrow.animation.addByPrefix('static', 'arrowDOWN'); - babyArrow.animation.addByPrefix('pressed', 'down press', 24, false); - babyArrow.animation.addByPrefix('confirm', 'down confirm', 24, false); - case 0: - babyArrow.x += Note.swagWidth * 0; - babyArrow.animation.addByPrefix('static', 'arrowLEFT'); - babyArrow.animation.addByPrefix('pressed', 'left press', 24, false); - babyArrow.animation.addByPrefix('confirm', 'left confirm', 24, false); - } - default: babyArrow.frames = Paths.getSparrowAtlas('NOTE_assets'); - babyArrow.animation.addByPrefix('green', 'arrowUP'); - babyArrow.animation.addByPrefix('blue', 'arrowDOWN'); - babyArrow.animation.addByPrefix('purple', 'arrowLEFT'); - babyArrow.animation.addByPrefix('red', 'arrowRIGHT'); + for (j in 0...4) + { + babyArrow.animation.addByPrefix(dataColor[j], 'arrow' + dataSuffix[j]); + } + + var lowerDir:String = dataSuffix[i].toLowerCase(); + + babyArrow.animation.addByPrefix('static', 'arrow' + dataSuffix[i]); + babyArrow.animation.addByPrefix('pressed', lowerDir + ' press', 24, false); + babyArrow.animation.addByPrefix('confirm', lowerDir + ' confirm', 24, false); + + babyArrow.x += Note.swagWidth * i; babyArrow.antialiasing = true; babyArrow.setGraphicSize(Std.int(babyArrow.width * 0.7)); - - switch (Math.abs(i)) - { - case 2: - babyArrow.x += Note.swagWidth * 2; - babyArrow.animation.addByPrefix('static', 'arrowUP'); - babyArrow.animation.addByPrefix('pressed', 'up press', 24, false); - babyArrow.animation.addByPrefix('confirm', 'up confirm', 24, false); - case 3: - babyArrow.x += Note.swagWidth * 3; - babyArrow.animation.addByPrefix('static', 'arrowRIGHT'); - babyArrow.animation.addByPrefix('pressed', 'right press', 24, false); - babyArrow.animation.addByPrefix('confirm', 'right confirm', 24, false); - case 1: - babyArrow.x += Note.swagWidth * 1; - babyArrow.animation.addByPrefix('static', 'arrowDOWN'); - babyArrow.animation.addByPrefix('pressed', 'down press', 24, false); - babyArrow.animation.addByPrefix('confirm', 'down confirm', 24, false); - case 0: - babyArrow.x += Note.swagWidth * 0; - babyArrow.animation.addByPrefix('static', 'arrowLEFT'); - babyArrow.animation.addByPrefix('pressed', 'left press', 24, false); - babyArrow.animation.addByPrefix('confirm', 'left confirm', 24, false); - } } babyArrow.updateHitbox(); @@ -2790,18 +2741,6 @@ class PlayState extends MusicBeatState // Accessing the animation name directly to play it var singData:Int = Std.int(Math.abs(daNote.noteData)); dad.playAnim('sing' + dataSuffix[singData] + altAnim, true); - - switch (Math.abs(daNote.noteData)) - { - case 2: - dad.playAnim('singUP' + altAnim, true); - case 3: - dad.playAnim('singRIGHT' + altAnim, true); - case 1: - dad.playAnim('singDOWN' + altAnim, true); - case 0: - dad.playAnim('singLEFT' + altAnim, true); - } if (FlxG.save.data.cpuStrums) { @@ -2844,7 +2783,7 @@ class PlayState extends MusicBeatState daNote.visible = playerStrums.members[Math.floor(Math.abs(daNote.noteData))].visible; daNote.x = playerStrums.members[Math.floor(Math.abs(daNote.noteData))].x; if (!daNote.isSustainNote) - daNote.angle = playerStrums.members[Math.floor(Math.abs(daNote.noteData))].angle; + daNote.modAngle = playerStrums.members[Math.floor(Math.abs(daNote.noteData))].angle; daNote.alpha = playerStrums.members[Math.floor(Math.abs(daNote.noteData))].alpha; } else if (!daNote.wasGoodHit && !daNote.modifiedByLua) @@ -2852,7 +2791,7 @@ class PlayState extends MusicBeatState daNote.visible = strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].visible; daNote.x = strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].x; if (!daNote.isSustainNote) - daNote.angle = strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].angle; + daNote.modAngle = strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].angle; daNote.alpha = strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].alpha; }