From e53d987e534265fac2a1bfbd0d37597895cf6eb8 Mon Sep 17 00:00:00 2001 From: Yoshman29 <81191621+YoshiCrafter29@users.noreply.github.com> Date: Fri, 24 Mar 2023 11:17:43 +0100 Subject: [PATCH] fixed flxbackdrop bullshit + mute inst & vocals --- source/funkin/editors/charter/Charter.hx | 46 ++++++++++++++++--- .../funkin/editors/charter/CharterBackdrop.hx | 9 ++-- 2 files changed, 42 insertions(+), 13 deletions(-) diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index 9bb0e0eb..1cd35a2c 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -203,6 +203,15 @@ class Charter extends UIState { }, { label: "Visual metronome" + }, + null, + { + label: "Mute instrumental", + onSelect: _playback_muteinst + }, + { + label: "Mute voices", + onSelect: _playback_mutevoices } ] } @@ -357,10 +366,13 @@ class Charter extends UIState { selection = []; } else { // place note - var note = new CharterNote(); - note.updatePos(FlxG.keys.pressed.SHIFT ? (mousePos.y / 40) : Std.int(mousePos.y / 40), Std.int(mousePos.x / 40), 0, 0); - notesGroup.add(note); - addToUndo(CPlaceNote(note)); + var id = Std.int(mousePos.x / 40); + if (id >= 0 && id < 4 * gridBackdrop.strumlinesAmount) { + var note = new CharterNote(); + note.updatePos(FlxG.keys.pressed.SHIFT ? (mousePos.y / 40) : Std.int(mousePos.y / 40), id, 0, 0); + notesGroup.add(note); + addToUndo(CPlaceNote(note)); + } } } if (FlxG.mouse.justReleasedRight) @@ -463,6 +475,14 @@ class Charter extends UIState { function _playback_metronome(t) { t.icon = (Options.charterMetronomeEnabled = !Options.charterMetronomeEnabled) ? 1 : 0; } + function _playback_muteinst(t) { + FlxG.sound.music.volume = FlxG.sound.music.volume > 0 ? 0 : 1; + t.icon = 1 - Std.int(Math.ceil(FlxG.sound.music.volume)); + } + function _playback_mutevoices(t) { + vocals.volume = vocals.volume > 0 ? 0 : 1; + t.icon = 1 - Std.int(Math.ceil(vocals.volume)); + } #end public inline function sortNotes() @@ -494,13 +514,17 @@ class Charter extends UIState { conductorFollowerSpr.y = lerp(conductorFollowerSpr.y, curStepFloat * 40, 1/3); } charterCamera.scroll.set(conductorFollowerSpr.x + ((conductorFollowerSpr.scale.x - FlxG.width) / 2), conductorFollowerSpr.y - (FlxG.height * 0.5)); - charterCamera.zoom = lerp(charterCamera.zoom, __camZoom, 0.125); + if (charterCamera.zoom != (charterCamera.zoom = lerp(charterCamera.zoom, __camZoom, 0.125))) { + + } } public function handleShortcuts() { if (FlxG.keys.justPressed.DELETE) // DELETE _edit_delete(null); + __crochet = ((60 / Conductor.bpm) * 1000); + if (FlxG.keys.pressed.CONTROL) { if (FlxG.keys.justPressed.Y || (FlxG.keys.pressed.SHIFT && FlxG.keys.justPressed.Z)) // CTRL+Y or CTRL+SHIFT+Z _edit_redo(null); @@ -512,13 +536,21 @@ class Charter extends UIState { _chart_zoomout(null); else if (FlxG.keys.justPressed.NUMPADZERO) // CTRL+[0] _chart_zoomreset(null); + + + if (FlxG.mouse.wheel != 0) { + zoom += 0.25 * FlxG.mouse.wheel; + __camZoom = Math.pow(2, zoom); + } + } else { + if (!FlxG.sound.music.playing) { + Conductor.songPosition -= __crochet * FlxG.mouse.wheel; + } } if (FlxG.keys.justPressed.SPACE) // SPACE _playback_play(null); - __crochet = ((60 / Conductor.bpm) * 1000); - Conductor.songPosition -= __crochet * FlxG.mouse.wheel; if (FlxG.keys.justPressed.D) _playback_forward(null); diff --git a/source/funkin/editors/charter/CharterBackdrop.hx b/source/funkin/editors/charter/CharterBackdrop.hx index ee5326f9..c9f38ed5 100644 --- a/source/funkin/editors/charter/CharterBackdrop.hx +++ b/source/funkin/editors/charter/CharterBackdrop.hx @@ -7,7 +7,7 @@ class CharterBackdrop extends FlxBackdrop { public var strumlinesAmount:Int = 1; public function new() { - super(null, 1, 1, false, true); + super(null, Y, 0, 0); makeGraphic(160, 160, 0xFF272727, true); pixels.lock(); @@ -17,7 +17,7 @@ class CharterBackdrop extends FlxBackdrop { pixels.fillRect(new Rectangle(0, 0, 1, 160), 0xFFDDDDDD); pixels.fillRect(new Rectangle(159, 0, 1, 160), 0xFFDDDDDD); pixels.unlock(); - loadFrame(frame); + // loadFrame(frame); } public override function draw() { @@ -40,10 +40,7 @@ class CharterBackdropDummy extends UISprite { } public override function updateButton() { - __rect.x = parent.x; - __rect.y = 0 - (FlxG.height * (1 - (1 / FlxG.camera.zoom))); - __rect.width = parent.frameWidth * parent.scale.x * parent.strumlinesAmount; - __rect.height = FlxG.height / FlxG.camera.zoom; + camera.getViewRect(__rect); UIState.state.updateRectButtonHandler(this, __rect, onHovered); }