diff --git a/source/ChartingState.hx b/source/ChartingState.hx index 105d2a1..122af1e 100644 --- a/source/ChartingState.hx +++ b/source/ChartingState.hx @@ -1,5 +1,6 @@ package; +import flixel.FlxCamera; import flixel.addons.ui.FlxUIText; import haxe.zip.Writer; import Conductor.BPMChangeEvent; @@ -42,6 +43,10 @@ class ChartingState extends MusicBeatState { var _file:FileReference; + public var playClaps:Bool = false; + + public var snap:Int = 2; + var UI_box:FlxUITabMenu; /** @@ -91,6 +96,8 @@ class ChartingState extends MusicBeatState private var lastNote:Note; var claps:Array = []; + public var snapText:FlxText; + override function create() { curSection = lastSection; @@ -117,6 +124,9 @@ class ChartingState extends MusicBeatState gridBG = FlxGridOverlay.create(GRID_SIZE, GRID_SIZE, GRID_SIZE * 8, GRID_SIZE * 16); add(gridBG); + snapText = new FlxText(-100,10,0,"Snap: 1/" + snap + " (Control + Left or Right to change.)\nAdd Notes: 1-8 (or click)\n", 24); + snapText.scrollFactor.set(); + gridBlackLine = new FlxSprite(gridBG.x + gridBG.width / 2).makeGraphic(2, Std.int(gridBG.height), FlxColor.BLACK); add(gridBlackLine); @@ -183,6 +193,10 @@ class ChartingState extends MusicBeatState add(curRenderedNotes); add(curRenderedSustains); + add(snapText); + + + super.create(); } @@ -263,6 +277,14 @@ class ChartingState extends MusicBeatState stepperSongVol.value = FlxG.sound.music.volume; stepperSongVol.name = 'song_instvol'; + + var hitsounds = new FlxUICheckBox(10, stepperSongVol.y + 35, null, null, "Play hitsounds", 100); + hitsounds.checked = false; + hitsounds.callback = function() + { + playClaps = hitsounds.checked; + }; + var stepperSongVolLabel = new FlxText(74, 110, 'Instrumental Volume'); var characters:Array = CoolUtil.coolTextFile(Paths.txt('characterList')); @@ -328,7 +350,8 @@ class ChartingState extends MusicBeatState tab_group_song.add(stepperVocalVolLabel); tab_group_song.add(stepperSongVol); tab_group_song.add(stepperSongVolLabel); - + tab_group_song.add(hitsounds); + var tab_group_assets = new FlxUI(null, UI_box); tab_group_assets.name = "Assets"; tab_group_assets.add(noteStyleDropDown); @@ -436,7 +459,6 @@ class ChartingState extends MusicBeatState var applyLength:FlxButton = new FlxButton(10, 100, 'Apply Data'); - tab_group_note.add(writingNotesText); tab_group_note.add(stepperSusLength); tab_group_note.add(stepperSusLengthLabel); tab_group_note.add(applyLength); @@ -608,6 +630,8 @@ class ChartingState extends MusicBeatState { updateHeads(); + snapText.text = "Snap: " + snap; + curStep = recalculateSteps(); if (FlxG.keys.justPressed.ALT && UI_box.selected_tab == 0) @@ -615,64 +639,57 @@ class ChartingState extends MusicBeatState writingNotes = !writingNotes; } - if (writingNotes) - writingNotesText.text = "WRITING NOTES"; - else - writingNotesText.text = ""; - + if (FlxG.keys.pressed.CONTROL && FlxG.keys.justPressed.RIGHT) + snap = snap * 2; + if (FlxG.keys.pressed.CONTROL && FlxG.keys.justPressed.LEFT) + snap = Math.round(snap / 2); + if (snap >= 192) + snap = 192; + if (snap <= 2) + snap = 2; Conductor.songPosition = FlxG.sound.music.time; _song.song = typingShit.text; - var upP = controls.UP_P; - var rightP = controls.RIGHT_P; - var downP = controls.DOWN_P; - var leftP = controls.LEFT_P; + var left = FlxG.keys.justPressed.ONE; + var down = FlxG.keys.justPressed.TWO; + var up = FlxG.keys.justPressed.THREE; + var right = FlxG.keys.justPressed.FOUR; + var leftO = FlxG.keys.justPressed.FIVE; + var downO = FlxG.keys.justPressed.SIX; + var upO = FlxG.keys.justPressed.SEVEN; + var rightO = FlxG.keys.justPressed.EIGHT; - var controlArray:Array = [leftP, downP, upP, rightP]; + var pressArray = [left, down, up, right, leftO, downO, upO, rightO]; - if ((upP || rightP || downP || leftP) && writingNotes) + for (p in 0...pressArray.length) { - for(i in 0...controlArray.length) - { - if (controlArray[i]) - { - for (n in 0..._song.notes[curSection].sectionNotes.length) - { - var note = _song.notes[curSection].sectionNotes[n]; - if (note == null) - continue; - if (note[0] == Conductor.songPosition && note[1] % 4 == i) - { - trace('GAMING'); - _song.notes[curSection].sectionNotes.remove(note); - } - } - trace('adding note'); - _song.notes[curSection].sectionNotes.push([Conductor.songPosition, i, 0]); - updateGrid(); - } - } - + var i = pressArray[p]; + if (i) + addNote(new Note(Conductor.songPosition,p)); } strumLine.y = getYfromStrum((Conductor.songPosition - sectionStartTime()) % (Conductor.stepCrochet * _song.notes[curSection].lengthInSteps)); - curRenderedNotes.forEach(function(note:Note) + + + if (playClaps) { - if (FlxG.sound.music.playing) + curRenderedNotes.forEach(function(note:Note) { - FlxG.overlap(strumLine, note, function(_, _) + if (FlxG.sound.music.playing) { - if(!claps.contains(note)) + FlxG.overlap(strumLine, note, function(_, _) { - claps.push(note); - if(_song.notes[curSection].mustHitSection) FlxG.sound.play(Paths.sound('CLAP')); - else FlxG.sound.play(Paths.sound('SNAP')); - } - }); - } - }); - + if(!claps.contains(note)) + { + claps.push(note); + if(_song.notes[curSection].mustHitSection) FlxG.sound.play(Paths.sound('CLAP')); + else FlxG.sound.play(Paths.sound('SNAP')); + } + }); + } + }); + } /*curRenderedNotes.forEach(function(note:Note) { if (strumLine.overlaps(note) && strumLine.y == note.y) // yandere dev type shit { @@ -857,7 +874,7 @@ class ChartingState extends MusicBeatState var shiftThing:Int = 1; if (FlxG.keys.pressed.SHIFT) shiftThing = 4; - if (!writingNotes) + if (!FlxG.keys.pressed.CONTROL) { if (FlxG.keys.justPressed.RIGHT || FlxG.keys.justPressed.D) changeSection(curSection + shiftThing); @@ -892,7 +909,7 @@ class ChartingState extends MusicBeatState FlxG.sound.music.pause(); vocals.pause(); - FlxG.sound.music.time -= (FlxG.mouse.wheel * Conductor.stepCrochet * 0.4); + FlxG.sound.music.time -= (FlxG.mouse.wheel * Conductor.crochet / snap * 0.4); vocals.time = FlxG.sound.music.time; } diff --git a/source/KadeEngineData.hx b/source/KadeEngineData.hx index 34528b2..0627c24 100644 --- a/source/KadeEngineData.hx +++ b/source/KadeEngineData.hx @@ -72,6 +72,9 @@ class KadeEngineData if (FlxG.save.data.botplay == null) FlxG.save.data.botplay = false; + if (FlxG.save.data.cpuStrums == null) + FlxG.save.data.cpuStrums = false; + Conductor.recalculateTimings(); Main.watermarks = FlxG.save.data.watermark; diff --git a/source/MainMenuState.hx b/source/MainMenuState.hx index dc699de..ef71372 100644 --- a/source/MainMenuState.hx +++ b/source/MainMenuState.hx @@ -35,7 +35,7 @@ class MainMenuState extends MusicBeatState var newGaming:FlxText; var newGaming2:FlxText; - var newInput:Bool = true; + public static var firstStart:Bool = true; public static var nightly:String = ""; @@ -44,6 +44,7 @@ class MainMenuState extends MusicBeatState var magenta:FlxSprite; var camFollow:FlxObject; + public static var finishedFunnyMove:Bool = false; override function create() { @@ -59,9 +60,9 @@ class MainMenuState extends MusicBeatState persistentUpdate = persistentDraw = true; - var bg:FlxSprite = new FlxSprite(-80).loadGraphic(Paths.image('menuBG')); + var bg:FlxSprite = new FlxSprite(-100).loadGraphic(Paths.image('menuBG')); bg.scrollFactor.x = 0; - bg.scrollFactor.y = 0.15; + bg.scrollFactor.y = 0.10; bg.setGraphicSize(Std.int(bg.width * 1.1)); bg.updateHitbox(); bg.screenCenter(); @@ -73,7 +74,7 @@ class MainMenuState extends MusicBeatState magenta = new FlxSprite(-80).loadGraphic(Paths.image('menuDesat')); magenta.scrollFactor.x = 0; - magenta.scrollFactor.y = 0.15; + magenta.scrollFactor.y = 0.10; magenta.setGraphicSize(Std.int(magenta.width * 1.1)); magenta.updateHitbox(); magenta.screenCenter(); @@ -90,7 +91,7 @@ class MainMenuState extends MusicBeatState for (i in 0...optionShit.length) { - var menuItem:FlxSprite = new FlxSprite(0, 60 + (i * 160)); + var menuItem:FlxSprite = new FlxSprite(0, FlxG.height * 1.6); menuItem.frames = tex; menuItem.animation.addByPrefix('idle', optionShit[i] + " basic", 24); menuItem.animation.addByPrefix('selected', optionShit[i] + " white", 24); @@ -100,8 +101,17 @@ class MainMenuState extends MusicBeatState menuItems.add(menuItem); menuItem.scrollFactor.set(); menuItem.antialiasing = true; + if (firstStart) + FlxTween.tween(menuItem,{y: 60 + (i * 160)},1 + (i * 0.25) ,{ease: FlxEase.bounceInOut, onComplete: function(flxTween:FlxTween) + { + finishedFunnyMove = true; + }}); + else + menuItem.y = 60 + (i * 160); } + firstStart = false; + FlxG.camera.follow(camFollow, null, 0.60 * (60 / FlxG.save.data.fpsCap)); var versionShit:FlxText = new FlxText(5, FlxG.height - 18, 0, gameVer + (Main.watermarks ? " FNF - " + kadeEngineVer + " Kade Engine" : ""), 12); @@ -231,18 +241,20 @@ class MainMenuState extends MusicBeatState function changeItem(huh:Int = 0) { - curSelected += huh; - - if (curSelected >= menuItems.length) - curSelected = 0; - if (curSelected < 0) - curSelected = menuItems.length - 1; + if (finishedFunnyMove) + { + curSelected += huh; + if (curSelected >= menuItems.length) + curSelected = 0; + if (curSelected < 0) + curSelected = menuItems.length - 1; + } menuItems.forEach(function(spr:FlxSprite) { spr.animation.play('idle'); - if (spr.ID == curSelected) + if (spr.ID == curSelected && finishedFunnyMove) { spr.animation.play('selected'); camFollow.setPosition(spr.getGraphicMidpoint().x, spr.getGraphicMidpoint().y); diff --git a/source/Options.hx b/source/Options.hx index b4764ca..f3a1473 100644 --- a/source/Options.hx +++ b/source/Options.hx @@ -103,6 +103,29 @@ class DFJKOption extends Option } } +class CpuStrums extends Option +{ + public function new(desc:String) + { + super(); + description = desc; + } + + public override function press():Bool + { + FlxG.save.data.cpuStrums = !FlxG.save.data.cpuStrums; + + display = updateDisplay(); + return true; + } + + private override function updateDisplay():String + { + return FlxG.save.data.dfjk ? "Light CPU Strums" : "CPU Strums stay static"; + } + +} + class DownscrollOption extends Option { public function new(desc:String) diff --git a/source/OptionsMenu.hx b/source/OptionsMenu.hx index 448b1ef..5156348 100644 --- a/source/OptionsMenu.hx +++ b/source/OptionsMenu.hx @@ -43,6 +43,7 @@ class OptionsMenu extends MusicBeatState new AccuracyOption("Display accuracy information."), new NPSDisplayOption("Shows your current Notes Per Second."), new SongPositionOption("Show the songs current position (as a bar)"), + new CpuStrums("CPU's strumline lights up when a note hits it."), #else new DistractionsAndEffectsOption("Toggle stage distractions that can hinder your gameplay.") #end diff --git a/source/PlayState.hx b/source/PlayState.hx index b2a5fc3..7b31a0a 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -2374,14 +2374,17 @@ class PlayState extends MusicBeatState }); } - cpuStrums.forEach(function(spr:FlxSprite) + if (FlxG.save.data.cpuStrums) { - if (spr.animation.finished) + cpuStrums.forEach(function(spr:FlxSprite) { - spr.animation.play('static'); - spr.centerOffsets(); - } - }); + if (spr.animation.finished) + { + spr.animation.play('static'); + spr.centerOffsets(); + } + }); + } if (!inCutscene) keyShit(); diff --git a/source/TitleState.hx b/source/TitleState.hx index 213d816..3bf0d80 100644 --- a/source/TitleState.hx +++ b/source/TitleState.hx @@ -304,6 +304,8 @@ class TitleState extends MusicBeatState transitioning = true; // FlxG.sound.music.stop(); + MainMenuState.firstStart = true; + new FlxTimer().start(2, function(tmr:FlxTimer) { // Get current version of Kade Engine