rewind controller support

This commit is contained in:
RandomityGuy 2023-05-14 19:03:27 +05:30
parent 581e5de970
commit 1e6141cdff
2 changed files with 12 additions and 3 deletions

View file

@ -992,12 +992,16 @@ class MarbleWorld extends Scheduler {
var realDt = dt;
if ((Key.isDown(Settings.controlsSettings.rewind) || MarbleGame.instance.touchInput.rewindButton.pressed)
if ((Key.isDown(Settings.controlsSettings.rewind)
|| MarbleGame.instance.touchInput.rewindButton.pressed
|| Gamepad.isDown(Settings.gamepadSettings.rewind))
&& Settings.optionsSettings.rewindEnabled
&& !this.isWatching) {
this.rewinding = true;
} else {
if ((Key.isReleased(Settings.controlsSettings.rewind) || !MarbleGame.instance.touchInput.rewindButton.pressed)
if ((Key.isReleased(Settings.controlsSettings.rewind)
|| !MarbleGame.instance.touchInput.rewindButton.pressed
|| Gamepad.isReleased(Settings.gamepadSettings.rewind))
&& this.rewinding) {
if (this.isRecording) {
this.replay.spliceReplay(timeState.currentAttemptTime);

View file

@ -93,6 +93,7 @@ typedef GamepadSettings = {
var axisDeadzone:Float;
var respawn:Array<String>;
var blast:Array<String>;
var rewind:Array<String>;
}
typedef PlayStatistics = {
@ -178,7 +179,8 @@ class Settings {
invertYAxis: false,
axisDeadzone: 0.15,
respawn: ["back"],
blast: ["X", "LB", "RB"]
blast: ["X", "LB", "RB"],
rewind: ["Y"],
}
public static var playStatistics:PlayStatistics = {
@ -389,6 +391,9 @@ class Settings {
if (json.gamepad != null) {
gamepadSettings = json.gamepad;
}
if (gamepadSettings.rewind == null) {
gamepadSettings.rewind = ["Y"];
}
if (json.stats != null) {
playStatistics = json.stats;
}