From 4d2cc3b00c11ec8dcf555c20ba629ac841e1096e Mon Sep 17 00:00:00 2001 From: Yoshman29 Date: Thu, 13 Oct 2022 19:14:01 +0200 Subject: [PATCH] controls NOTE_LEFT --- buildnumber.txt | 2 +- source/funkin/game/PlayState.hx | 6 +-- source/funkin/options/Options.hx | 36 ++++++++++++++++ source/funkin/system/Controls.hx | 72 ++++++++++++++++++++++++++++++++ 4 files changed, 112 insertions(+), 4 deletions(-) diff --git a/buildnumber.txt b/buildnumber.txt index 82a1667b..00c22e59 100644 --- a/buildnumber.txt +++ b/buildnumber.txt @@ -1 +1 @@ -426 \ No newline at end of file +429 \ No newline at end of file diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index 0ac6abf4..8b510bad 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -1281,9 +1281,9 @@ class PlayState extends MusicBeatState private function keyShit():Void { // HOLDING - var pressed = [controls.LEFT, controls.DOWN, controls.UP, controls.RIGHT]; - var justPressed = [controls.LEFT_P, controls.DOWN_P, controls.UP_P, controls.RIGHT_P]; - var justReleased = [controls.LEFT_R, controls.DOWN_R, controls.UP_R, controls.RIGHT_R]; + var pressed = [controls.NOTE_LEFT, controls.NOTE_DOWN, controls.NOTE_UP, controls.NOTE_RIGHT]; + var justPressed = [controls.NOTE_LEFT_P, controls.NOTE_DOWN_P, controls.NOTE_UP_P, controls.NOTE_RIGHT_P]; + var justReleased = [controls.NOTE_LEFT_R, controls.NOTE_DOWN_R, controls.NOTE_UP_R, controls.NOTE_RIGHT_R]; var event = scripts.event("onKeyShit", new InputSystemEvent([controls.LEFT, controls.DOWN, controls.UP, controls.RIGHT], [controls.LEFT_P, controls.DOWN_P, controls.UP_P, controls.RIGHT_P], [controls.LEFT_R, controls.DOWN_R, controls.UP_R, controls.RIGHT_R])); if (event.cancelled) return; diff --git a/source/funkin/options/Options.hx b/source/funkin/options/Options.hx index 550f0c09..a18375dc 100644 --- a/source/funkin/options/Options.hx +++ b/source/funkin/options/Options.hx @@ -22,6 +22,10 @@ class Options /** * PLAYER 1 CONTROLS */ + public static var P1_NOTE_LEFT:Array = [A]; + public static var P1_NOTE_DOWN:Array = [S]; + public static var P1_NOTE_UP:Array = [W]; + public static var P1_NOTE_RIGHT:Array = [D]; public static var P1_LEFT:Array = [A]; public static var P1_DOWN:Array = [S]; public static var P1_UP:Array = [W]; @@ -34,6 +38,10 @@ class Options /** * PLAYER 2 CONTROLS (ALT) */ + public static var P2_NOTE_LEFT:Array = [LEFT]; + public static var P2_NOTE_DOWN:Array = [DOWN]; + public static var P2_NOTE_UP:Array = [UP]; + public static var P2_NOTE_RIGHT:Array = [RIGHT]; public static var P2_LEFT:Array = [LEFT]; public static var P2_DOWN:Array = [DOWN]; public static var P2_UP:Array = [UP]; @@ -46,6 +54,10 @@ class Options /** * SOLO GETTERS & SETTERS */ + public static var SOLO_NOTE_LEFT(get, null):Array; + public static var SOLO_NOTE_DOWN(get, null):Array; + public static var SOLO_NOTE_UP(get, null):Array; + public static var SOLO_NOTE_RIGHT(get, null):Array; public static var SOLO_LEFT(get, null):Array; public static var SOLO_DOWN(get, null):Array; public static var SOLO_UP(get, null):Array; @@ -81,6 +93,30 @@ class Options for(e in P2_RIGHT) a.push(e); return a; } + private static function get_SOLO_NOTE_LEFT() { + var a:Array = []; + for(e in P1_NOTE_LEFT) a.push(e); + for(e in P2_NOTE_LEFT) a.push(e); + return a; + } + private static function get_SOLO_NOTE_DOWN() { + var a:Array = []; + for(e in P1_NOTE_DOWN) a.push(e); + for(e in P2_NOTE_DOWN) a.push(e); + return a; + } + private static function get_SOLO_NOTE_UP() { + var a:Array = []; + for(e in P1_NOTE_UP) a.push(e); + for(e in P2_NOTE_UP) a.push(e); + return a; + } + private static function get_SOLO_NOTE_RIGHT() { + var a:Array = []; + for(e in P1_NOTE_RIGHT) a.push(e); + for(e in P2_NOTE_RIGHT) a.push(e); + return a; + } private static function get_SOLO_ACCEPT() { var a:Array = []; for(e in P1_ACCEPT) a.push(e); diff --git a/source/funkin/system/Controls.hx b/source/funkin/system/Controls.hx index 1b0054e0..25d6fc9b 100644 --- a/source/funkin/system/Controls.hx +++ b/source/funkin/system/Controls.hx @@ -130,6 +130,66 @@ class Controls extends FlxActionSet public var gamepadsAdded:Array = []; public var keyboardScheme = KeyboardScheme.None; + public var UP(get, never):Bool; + + inline function get_UP() + return _up.check(); + + public var LEFT(get, never):Bool; + + inline function get_LEFT() + return _left.check(); + + public var RIGHT(get, never):Bool; + + inline function get_RIGHT() + return _right.check(); + + public var DOWN(get, never):Bool; + + inline function get_DOWN() + return _down.check(); + + public var UP_P(get, never):Bool; + + inline function get_UP_P() + return _upP.check(); + + public var LEFT_P(get, never):Bool; + + inline function get_LEFT_P() + return _leftP.check(); + + public var RIGHT_P(get, never):Bool; + + inline function get_RIGHT_P() + return _rightP.check(); + + public var DOWN_P(get, never):Bool; + + inline function get_DOWN_P() + return _downP.check(); + + public var UP_R(get, never):Bool; + + inline function get_UP_R() + return _upR.check(); + + public var LEFT_R(get, never):Bool; + + inline function get_LEFT_R() + return _leftR.check(); + + public var RIGHT_R(get, never):Bool; + + inline function get_RIGHT_R() + return _rightR.check(); + + public var DOWN_R(get, never):Bool; + + inline function get_DOWN_R() + return _downR.check(); + public var NOTE_UP(get, never):Bool; inline function get_NOTE_UP() @@ -512,6 +572,10 @@ class Controls extends FlxActionSet inline bindKeys(Control.DOWN, Options.SOLO_DOWN); inline bindKeys(Control.LEFT, Options.SOLO_LEFT); inline bindKeys(Control.RIGHT, Options.SOLO_RIGHT); + inline bindKeys(Control.NOTE_UP, Options.SOLO_NOTE_UP); + inline bindKeys(Control.NOTE_DOWN, Options.SOLO_NOTE_DOWN); + inline bindKeys(Control.NOTE_LEFT, Options.SOLO_NOTE_LEFT); + inline bindKeys(Control.NOTE_RIGHT, Options.SOLO_NOTE_RIGHT); inline bindKeys(Control.ACCEPT, Options.SOLO_ACCEPT); inline bindKeys(Control.BACK, Options.SOLO_BACK); inline bindKeys(Control.PAUSE, Options.SOLO_PAUSE); @@ -521,6 +585,10 @@ class Controls extends FlxActionSet inline bindKeys(Control.DOWN, Options.P1_DOWN); inline bindKeys(Control.LEFT, Options.P1_LEFT); inline bindKeys(Control.RIGHT, Options.P1_RIGHT); + inline bindKeys(Control.NOTE_UP, Options.P1_NOTE_UP); + inline bindKeys(Control.NOTE_DOWN, Options.P1_NOTE_DOWN); + inline bindKeys(Control.NOTE_LEFT, Options.P1_NOTE_LEFT); + inline bindKeys(Control.NOTE_RIGHT, Options.P1_NOTE_RIGHT); inline bindKeys(Control.ACCEPT, Options.P1_ACCEPT); inline bindKeys(Control.BACK, Options.P1_BACK); inline bindKeys(Control.PAUSE, Options.P1_PAUSE); @@ -530,6 +598,10 @@ class Controls extends FlxActionSet inline bindKeys(Control.DOWN, Options.P2_DOWN); inline bindKeys(Control.LEFT, Options.P2_LEFT); inline bindKeys(Control.RIGHT, Options.P2_RIGHT); + inline bindKeys(Control.NOTE_UP, Options.P2_NOTE_UP); + inline bindKeys(Control.NOTE_DOWN, Options.P2_NOTE_DOWN); + inline bindKeys(Control.NOTE_LEFT, Options.P2_NOTE_LEFT); + inline bindKeys(Control.NOTE_RIGHT, Options.P2_NOTE_RIGHT); inline bindKeys(Control.ACCEPT, Options.P2_ACCEPT); inline bindKeys(Control.BACK, Options.P2_BACK); inline bindKeys(Control.PAUSE, Options.P2_PAUSE);