From 32a0eda1b03eefeab62ccddb734282cbc747a394 Mon Sep 17 00:00:00 2001 From: bctix <51544115+bctix@users.noreply.github.com> Date: Tue, 26 Nov 2024 19:00:25 -0500 Subject: [PATCH] Add extra charter controls (#412) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add new charter controls * typo.... * boundin fix --------- Co-authored-by: ⍚~Nex <87421482+NexIsDumb@users.noreply.github.com> --- source/funkin/editors/charter/Charter.hx | 30 ++++++++++++++++++++++++ source/funkin/editors/ui/UISlider.hx | 1 + 2 files changed, 31 insertions(+) diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index 99f6f6909..cf13c0c23 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -341,6 +341,7 @@ class Charter extends UIState { null, { label: "↑ Speed 25%", + keybind: [PERIOD], onSelect: _playback_speed_raise }, { @@ -349,6 +350,7 @@ class Charter extends UIState { }, { label: "↓ Speed 25%", + keybind: [COMMA], onSelect: _playback_speed_lower }, null, @@ -362,6 +364,22 @@ class Charter extends UIState { keybind: [D], onSelect: _playback_forward }, + { + label: "Go to start of section", + keybind: [SHIFT, S], + onSelect: _playback_section_start + }, + null, + { + label: "Go back a step", + keybind: [W], + onSelect: _playback_back_step + }, + { + label: "Go forward a step", + keybind: [S], + onSelect: _playback_forward_step + }, null, { label: "Metronome", @@ -1579,6 +1597,18 @@ class Charter extends UIState { if (FlxG.sound.music.playing) return; Conductor.songPosition += (Conductor.beatsPerMeasure * __crochet); } + function _playback_section_start(_) { + if(FlxG.sound.music.playing) return; + Conductor.songPosition = (Conductor.beatsPerMeasure * (60000 / Conductor.bpm)) * curMeasure; + } + function _playback_back_step(_) { + if (FlxG.sound.music.playing) return; + Conductor.songPosition -= Conductor.stepCrochet; + } + function _playback_forward_step(_) { + if (FlxG.sound.music.playing) return; + Conductor.songPosition += Conductor.stepCrochet; + } function _song_start(_) { if (FlxG.sound.music.playing) return; Conductor.songPosition = 0; diff --git a/source/funkin/editors/ui/UISlider.hx b/source/funkin/editors/ui/UISlider.hx index 277c7b95d..091886c1c 100644 --- a/source/funkin/editors/ui/UISlider.hx +++ b/source/funkin/editors/ui/UISlider.hx @@ -26,6 +26,7 @@ class UISlider extends UISprite { public var value(default, set):Float = 0; public function set_value(newVal:Float):Float { + newVal = FlxMath.bound(newVal, segments[0].start, segments[segments.length-1].end); __barProgress = __calcProgress(newVal); if (onChange != null) onChange(newVal); if (valueStepper != null) valueStepper.value = newVal; return value = newVal;