Skip to content

Commit 1a855e5

Browse files
committed
Freeplay Change Mode Keybind
The Co-Op Mode Switch has been given its own keybind, approved by Frakits. FOR TRANSLATORS: The translation string in Options.xml is category.ui.changeMode
1 parent 4147473 commit 1a855e5

File tree

6 files changed

+22
-3
lines changed

6 files changed

+22
-3
lines changed

assets/languages/en/Options.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
<str id="back">Back</str>
4343
<str id="reset">Reset</str>
4444
<str id="pause">Pause</str>
45+
<str id="changeMode">Change Mode</str>
4546
</group>
4647

4748
<str id="category.engine">Engine</str>

assets/languages/pl/Options.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
<str id="back">Wstecz</str>
3939
<str id="reset">Reset</str>
4040
<str id="pause">Pauza</str>
41+
<str id="changeMode">Zmień Tryb</str>
4142
</group>
4243

4344
<str id="category.engine">Silnik</str>

source/funkin/backend/system/Controls.hx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ enum Control
2222
ACCEPT;
2323
BACK;
2424
PAUSE;
25+
CHANGE_MODE;
2526
//CHEAT;
2627
SWITCHMOD;
2728

@@ -145,6 +146,11 @@ class Controls extends FlxActionSet
145146
@:pressed("reset") public var RESET_HOLD(get, set): Bool;
146147
@:justReleased("reset") public var RESET_R(get, set): Bool;
147148

149+
@:gamepad([FlxGamepadInputID.BACK]) // select button
150+
@:justPressed("change-mode") public var CHANGE_MODE(get, set): Bool;
151+
@:pressed("change-mode") public var CHANGE_MODE_HOLD(get, set): Bool;
152+
@:justReleased("change-mode") public var CHANGE_MODE_R(get, set): Bool;
153+
148154
//@:gamepad([])
149155
//@:justPressed("cheat") public var CHEAT(get, set): Bool;
150156
//@:pressed("cheat") public var CHEAT_HOLD(get, set): Bool;

source/funkin/menus/FreeplayState.hx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class FreeplayState extends MusicBeatState
5353
public var diffText:FlxText;
5454

5555
/**
56-
* Text containing the current coop/opponent mode ([TAB] Co-Op mode)
56+
* Text containing the current coop/opponent mode ([KEYBINDS] Co-Op mode)
5757
*/
5858
public var coopText:FlxText;
5959

@@ -237,7 +237,7 @@ class FreeplayState extends MusicBeatState
237237
if (canSelect) {
238238
changeSelection((controls.UP_P ? -1 : 0) + (controls.DOWN_P ? 1 : 0) - FlxG.mouse.wheel);
239239
changeDiff((controls.LEFT_P ? -1 : 0) + (controls.RIGHT_P ? 1 : 0));
240-
changeCoopMode((FlxG.keys.justPressed.TAB ? 1 : 0)); // TODO: make this configurable
240+
changeCoopMode((controls.CHANGE_MODE ? 1 : 0)); // TODO: make this configurable
241241
// putting it before so that its actually smooth
242242
updateOptionsAlpha();
243243
}
@@ -430,7 +430,11 @@ class FreeplayState extends MusicBeatState
430430

431431
updateScore();
432432

433-
var key = "[TAB] "; // TODO: make this configurable
433+
var coopBinds = [CoolUtil.keyToString(Options.P1_CHANGE_MODE[0]), CoolUtil.keyToString(Options.P2_CHANGE_MODE[0])].filter(x -> x != "---");
434+
if (coopBinds.length == 2 && coopBinds[1] == coopBinds[0]) coopBinds.pop();
435+
else if (coopBinds.length == 0) coopBinds.push("---");
436+
437+
var key = '[${coopBinds.join(" / ")}] ';
434438

435439
if (bothEnabled) {
436440
coopText.text = key + coopLabels[curCoopMode];

source/funkin/options/Options.hx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ class Options
117117
public static var P1_ACCEPT:Array<FlxKey> = [ENTER];
118118
public static var P1_BACK:Array<FlxKey> = [BACKSPACE];
119119
public static var P1_PAUSE:Array<FlxKey> = [ENTER];
120+
public static var P1_CHANGE_MODE:Array<FlxKey> = [TAB];
120121

121122
// Misc
122123
public static var P1_RESET:Array<FlxKey> = [R];
@@ -148,6 +149,7 @@ class Options
148149
public static var P2_ACCEPT:Array<FlxKey> = [SPACE];
149150
public static var P2_BACK:Array<FlxKey> = [ESCAPE];
150151
public static var P2_PAUSE:Array<FlxKey> = [ESCAPE];
152+
public static var P2_CHANGE_MODE:Array<FlxKey> = [];
151153

152154
// Misc
153155
public static var P2_RESET:Array<FlxKey> = [];
@@ -179,6 +181,7 @@ class Options
179181
public static var SOLO_ACCEPT(get, null):Array<FlxKey>;
180182
public static var SOLO_BACK(get, null):Array<FlxKey>;
181183
public static var SOLO_PAUSE(get, null):Array<FlxKey>;
184+
public static var SOLO_CHANGE_MODE(get, null):Array<FlxKey>;
182185

183186
// Misc
184187
public static var SOLO_RESET(get, null):Array<FlxKey>;

source/funkin/options/keybinds/KeybindsOptions.hx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ class KeybindsOptions extends MusicBeatSubstate {
9797
name: translate("ui.pause"),
9898
control: 'PAUSE'
9999
},
100+
{
101+
name: translate("ui.changeMode"),
102+
control: 'CHANGE_MODE'
103+
},
100104
]
101105
},
102106
{

0 commit comments

Comments
 (0)