new keybind
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
||||
2097
|
||||
2101
|
||||
@@ -0,0 +1,10 @@
|
||||
package funkin.cutscenes;
|
||||
|
||||
class DialogueCutscene extends Cutscene {
|
||||
public var dialoguePath:String;
|
||||
|
||||
public function new(dialoguePath:String, callback:Void->Void) {
|
||||
super(callback);
|
||||
this.dialoguePath = dialoguePath;
|
||||
}
|
||||
}
|
||||
@@ -47,7 +47,9 @@ class ScriptedCutscene extends Cutscene {
|
||||
script.call("destroy");
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
|
||||
// VIDEOS
|
||||
#if REGION
|
||||
public function startVideo(path:String, ?callback:Void->Void) {
|
||||
persistentDraw = false;
|
||||
openSubState(new VideoCutscene(path, function() {
|
||||
@@ -55,4 +57,26 @@ class ScriptedCutscene extends Cutscene {
|
||||
callback();
|
||||
}));
|
||||
}
|
||||
|
||||
public var isVideoPlaying(get, null):Bool;
|
||||
|
||||
private inline function get_isVideoPlaying()
|
||||
return subState is VideoCutscene;
|
||||
#end
|
||||
|
||||
// DIALOGUE
|
||||
#if REGION
|
||||
public function startDialogue(path:String, ?callback:Void->Void) {
|
||||
persistentDraw = true;
|
||||
openSubState(new VideoCutscene(path, function() {
|
||||
if (callback != null)
|
||||
callback();
|
||||
}));
|
||||
}
|
||||
|
||||
public var isDialoguePlaying(get, null):Bool;
|
||||
|
||||
private inline function get_isDialoguePlaying()
|
||||
return subState is DialogueCutscene;
|
||||
#end
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package funkin.macros;
|
||||
|
||||
#if macro
|
||||
using StringTools;
|
||||
|
||||
class OptionsMacro {
|
||||
public static function build():Array<Field> {
|
||||
var fields = Context.getBuildFields();
|
||||
|
||||
for(f in fields) {
|
||||
switch(f.kind) {
|
||||
case FProp(get, set, t, e):
|
||||
if (f.name.startsWith('SOLO_') && get == "get" && set == "null") {
|
||||
// Auto-create getters for solo (P1/P2) keybinds
|
||||
var name = f.name.substr(5);
|
||||
var getterName = 'get_SOLO_$name';
|
||||
var ponename = 'P1_$name';
|
||||
var ptwoname = 'P2_$name';
|
||||
var newFuncExpr:Expr = macro {
|
||||
var a:Array<FlxKey> = [];
|
||||
for(e in ${{
|
||||
pos: Context.currentPos(),
|
||||
expr: EConst(CIdent(ponename))
|
||||
}}) a.push(e);
|
||||
for(e in ${{
|
||||
pos: Context.currentPos(),
|
||||
expr: EConst(CIdent(ptwoname))
|
||||
}}) a.push(e);
|
||||
return a;
|
||||
};
|
||||
|
||||
fields.push({
|
||||
name: getterName,
|
||||
kind: FFun({
|
||||
expr: newFuncExpr,
|
||||
args: []
|
||||
}),
|
||||
pos: Context.currentPos(),
|
||||
access: [APrivate, AStatic, AInline]
|
||||
});
|
||||
}
|
||||
default:
|
||||
// nothing
|
||||
}
|
||||
}
|
||||
|
||||
return fields;
|
||||
}
|
||||
}
|
||||
#end
|
||||
@@ -122,7 +122,7 @@ class MainMenuState extends MusicBeatState
|
||||
|
||||
#if MOD_SUPPORT
|
||||
// make it customisable
|
||||
if (FlxG.keys.justPressed.TAB) {
|
||||
if (controls.SWITCHMOD) {
|
||||
openSubState(new ModSwitchMenu());
|
||||
persistentUpdate = false;
|
||||
persistentDraw = true;
|
||||
|
||||
@@ -6,6 +6,7 @@ import openfl.Lib;
|
||||
import flixel.util.FlxSave;
|
||||
import flixel.input.keyboard.FlxKey;
|
||||
|
||||
@:build(funkin.macros.OptionsMacro.build())
|
||||
class Options
|
||||
{
|
||||
@:dox(hide) public static var __save:FlxSave;
|
||||
@@ -41,6 +42,7 @@ class Options
|
||||
public static var P1_BACK:Array<FlxKey> = [BACKSPACE];
|
||||
public static var P1_PAUSE:Array<FlxKey> = [ENTER];
|
||||
public static var P1_RESET:Array<FlxKey> = [R];
|
||||
public static var P1_SWITCHMOD:Array<FlxKey> = [TAB];
|
||||
|
||||
/**
|
||||
* PLAYER 2 CONTROLS (ALT)
|
||||
@@ -57,6 +59,7 @@ class Options
|
||||
public static var P2_BACK:Array<FlxKey> = [ESCAPE];
|
||||
public static var P2_PAUSE:Array<FlxKey> = [ESCAPE];
|
||||
public static var P2_RESET:Array<FlxKey> = [];
|
||||
public static var P2_SWITCHMOD:Array<FlxKey> = [];
|
||||
|
||||
/**
|
||||
* SOLO GETTERS
|
||||
@@ -73,82 +76,8 @@ class Options
|
||||
public static var SOLO_BACK(get, null):Array<FlxKey>;
|
||||
public static var SOLO_PAUSE(get, null):Array<FlxKey>;
|
||||
public static var SOLO_RESET(get, null):Array<FlxKey>;
|
||||
public static var SOLO_SWITCHMOD(get, null):Array<FlxKey>;
|
||||
|
||||
// GETTERS REGION
|
||||
#if REGION
|
||||
private static function get_SOLO_LEFT() {
|
||||
var a:Array<FlxKey> = [];
|
||||
for(e in P1_LEFT) a.push(e);
|
||||
for(e in P2_LEFT) a.push(e);
|
||||
return a;
|
||||
}
|
||||
private static function get_SOLO_DOWN() {
|
||||
var a:Array<FlxKey> = [];
|
||||
for(e in P1_DOWN) a.push(e);
|
||||
for(e in P2_DOWN) a.push(e);
|
||||
return a;
|
||||
}
|
||||
private static function get_SOLO_UP() {
|
||||
var a:Array<FlxKey> = [];
|
||||
for(e in P1_UP) a.push(e);
|
||||
for(e in P2_UP) a.push(e);
|
||||
return a;
|
||||
}
|
||||
private static function get_SOLO_RIGHT() {
|
||||
var a:Array<FlxKey> = [];
|
||||
for(e in P1_RIGHT) a.push(e);
|
||||
for(e in P2_RIGHT) a.push(e);
|
||||
return a;
|
||||
}
|
||||
private static function get_SOLO_NOTE_LEFT() {
|
||||
var a:Array<FlxKey> = [];
|
||||
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<FlxKey> = [];
|
||||
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<FlxKey> = [];
|
||||
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<FlxKey> = [];
|
||||
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<FlxKey> = [];
|
||||
for(e in P1_ACCEPT) a.push(e);
|
||||
for(e in P2_ACCEPT) a.push(e);
|
||||
return a;
|
||||
}
|
||||
private static function get_SOLO_BACK() {
|
||||
var a:Array<FlxKey> = [];
|
||||
for(e in P1_BACK) a.push(e);
|
||||
for(e in P2_BACK) a.push(e);
|
||||
return a;
|
||||
}
|
||||
private static function get_SOLO_PAUSE() {
|
||||
var a:Array<FlxKey> = [];
|
||||
for(e in P1_PAUSE) a.push(e);
|
||||
for(e in P2_PAUSE) a.push(e);
|
||||
return a;
|
||||
}
|
||||
private static function get_SOLO_RESET() {
|
||||
var a:Array<FlxKey> = [];
|
||||
for(e in P1_RESET) a.push(e);
|
||||
for(e in P2_RESET) a.push(e);
|
||||
return a;
|
||||
}
|
||||
#end
|
||||
public static function load() {
|
||||
if (__save == null) __save = new FlxSave();
|
||||
__save.bind("options");
|
||||
|
||||
@@ -33,7 +33,6 @@ class KeybindSetting extends FlxTypedSpriteGroup<FlxSprite> {
|
||||
super();
|
||||
this.value = value;
|
||||
title = new Alphabet(0, 0, name, true);
|
||||
title.setPosition(100, 0);
|
||||
add(title);
|
||||
|
||||
var controlArrayP1:Array<FlxKey> = Reflect.field(Options, 'P1_${value}');
|
||||
@@ -65,6 +64,8 @@ class KeybindSetting extends FlxTypedSpriteGroup<FlxSprite> {
|
||||
var min = Math.min(icon.scale.x, icon.scale.y);
|
||||
icon.scale.set(min, min);
|
||||
add(icon);
|
||||
|
||||
title.setPosition(100, 0);
|
||||
}
|
||||
|
||||
setPosition(x, y);
|
||||
@@ -79,9 +80,7 @@ class KeybindSetting extends FlxTypedSpriteGroup<FlxSprite> {
|
||||
}
|
||||
|
||||
public function changeKeybind(callback:Void->Void, cancelCallback:Void->Void, p2:Bool = false) {
|
||||
|
||||
var flicker = FlxFlicker.flicker(this, 0, Options.flashingMenu ? 0.06 : 0.15, true, false, function(t) {
|
||||
});
|
||||
var flicker = FlxFlicker.flicker(this, 0, Options.flashingMenu ? 0.06 : 0.15, true, false, function(t) {});
|
||||
|
||||
KeybindsOptions.instance.persistentDraw = true;
|
||||
KeybindsOptions.instance.persistentUpdate = false;
|
||||
|
||||
@@ -77,6 +77,15 @@ class KeybindsOptions extends MusicBeatSubstate {
|
||||
control: 'PAUSE'
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'Engine',
|
||||
settings: [
|
||||
{
|
||||
name: 'Switch Mod',
|
||||
control: 'SWITCHMOD'
|
||||
},
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
@@ -165,9 +174,9 @@ class KeybindsOptions extends MusicBeatSubstate {
|
||||
}
|
||||
}
|
||||
add(alphabets);
|
||||
changeSelection(1);
|
||||
|
||||
add(camFollow);
|
||||
|
||||
changeSelection(1);
|
||||
}
|
||||
|
||||
public override function destroy() {
|
||||
|
||||
@@ -45,6 +45,7 @@ enum abstract Action(String) to String from String {
|
||||
var PAUSE = "pause";
|
||||
var RESET = "reset";
|
||||
var CHEAT = "cheat";
|
||||
var SWITCHMOD = "switchmod";
|
||||
}
|
||||
|
||||
enum Device
|
||||
@@ -73,6 +74,7 @@ enum Control
|
||||
BACK;
|
||||
PAUSE;
|
||||
CHEAT;
|
||||
SWITCHMOD;
|
||||
}
|
||||
|
||||
enum KeyboardScheme
|
||||
@@ -120,6 +122,7 @@ class Controls extends FlxActionSet
|
||||
var _pause = new FlxActionDigital(Action.PAUSE);
|
||||
var _reset = new FlxActionDigital(Action.RESET);
|
||||
var _cheat = new FlxActionDigital(Action.CHEAT);
|
||||
var _switchMod = new FlxActionDigital(Action.SWITCHMOD);
|
||||
|
||||
#if (haxe >= "4.0.0")
|
||||
var byName:Map<String, FlxActionDigital> = [];
|
||||
@@ -275,6 +278,11 @@ class Controls extends FlxActionSet
|
||||
inline function get_CHEAT()
|
||||
return _cheat.check();
|
||||
|
||||
public var SWITCHMOD(get, never):Bool;
|
||||
|
||||
inline function get_SWITCHMOD()
|
||||
return _switchMod.check();
|
||||
|
||||
public function new(name, scheme = None)
|
||||
{
|
||||
super(name);
|
||||
@@ -310,6 +318,7 @@ class Controls extends FlxActionSet
|
||||
add(_pause);
|
||||
add(_reset);
|
||||
add(_cheat);
|
||||
add(_switchMod);
|
||||
|
||||
for (action in digitalActions)
|
||||
byName[action.name] = action;
|
||||
@@ -365,6 +374,7 @@ class Controls extends FlxActionSet
|
||||
case PAUSE: _pause;
|
||||
case RESET: _reset;
|
||||
case CHEAT: _cheat;
|
||||
case SWITCHMOD: _switchMod;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -426,6 +436,8 @@ class Controls extends FlxActionSet
|
||||
func(_reset, JUST_PRESSED);
|
||||
case CHEAT:
|
||||
func(_cheat, JUST_PRESSED);
|
||||
case SWITCHMOD:
|
||||
func(_switchMod, JUST_PRESSED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -580,6 +592,7 @@ class Controls extends FlxActionSet
|
||||
inline bindKeys(Control.BACK, Options.SOLO_BACK);
|
||||
inline bindKeys(Control.PAUSE, Options.SOLO_PAUSE);
|
||||
inline bindKeys(Control.RESET, Options.SOLO_RESET);
|
||||
inline bindKeys(Control.SWITCHMOD, Options.SOLO_SWITCHMOD);
|
||||
case Duo(true):
|
||||
inline bindKeys(Control.UP, Options.P1_UP);
|
||||
inline bindKeys(Control.DOWN, Options.P1_DOWN);
|
||||
@@ -593,6 +606,7 @@ class Controls extends FlxActionSet
|
||||
inline bindKeys(Control.BACK, Options.P1_BACK);
|
||||
inline bindKeys(Control.PAUSE, Options.P1_PAUSE);
|
||||
inline bindKeys(Control.RESET, Options.P1_RESET);
|
||||
inline bindKeys(Control.SWITCHMOD, Options.P1_SWITCHMOD);
|
||||
case Duo(false):
|
||||
inline bindKeys(Control.UP, Options.P2_UP);
|
||||
inline bindKeys(Control.DOWN, Options.P2_DOWN);
|
||||
@@ -606,6 +620,7 @@ class Controls extends FlxActionSet
|
||||
inline bindKeys(Control.BACK, Options.P2_BACK);
|
||||
inline bindKeys(Control.PAUSE, Options.P2_PAUSE);
|
||||
inline bindKeys(Control.RESET, Options.P2_RESET);
|
||||
inline bindKeys(Control.SWITCHMOD, Options.P2_SWITCHMOD);
|
||||
case None: // nothing
|
||||
case Custom: // nothing
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user