Skip to content

Commit

Permalink
feat: Re-add right thumb-stick speed control
Browse files Browse the repository at this point in the history
  • Loading branch information
psyGamer committed Jan 1, 2025
1 parent 5a502be commit 4c0b118
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CelesteTAS-EverestInterop/Source/EverestInterop/Hotkeys.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ private static GamePadState GetGamePadState() {
for (int i = 0; i < 4; i++) {
var state = GamePad.GetState((PlayerIndex) i);
if (state.IsConnected) {
break;
return state;
}
}

Expand Down
15 changes: 11 additions & 4 deletions CelesteTAS-EverestInterop/Source/TAS/Manager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,15 @@ public static void UpdateMeta() {
break;
}

// Allow altering the playback speed with the right thumb-stick
float normalSpeed = Hotkeys.RightThumbSticksX switch {
>= 0.001f => Hotkeys.RightThumbSticksX * TasSettings.FastForwardSpeed,
<= -0.001f => (1 + Hotkeys.RightThumbSticksX) * TasSettings.SlowForwardSpeed,
_ => 1.0f,
};

// Apply fast / slow forwarding
switch (NextState)
{
switch (NextState) {
case State.Running when Hotkeys.FastForward.Check:
PlaybackSpeed = TasSettings.FastForwardSpeed;
break;
Expand All @@ -216,15 +222,16 @@ public static void UpdateMeta() {
NextState = State.SlowForward;
break;
case State.Paused or State.SlowForward:
PlaybackSpeed = 1.0f;
PlaybackSpeed = normalSpeed;
NextState = State.Paused;
break;

case State.FrameAdvance:
PlaybackSpeed = normalSpeed;
break;

default:
PlaybackSpeed = Controller.HasFastForward ? Controller.CurrentFastForward!.Speed : 1.0f;
PlaybackSpeed = Controller.HasFastForward ? Controller.CurrentFastForward!.Speed : normalSpeed;
break;
}
}
Expand Down

0 comments on commit 4c0b118

Please sign in to comment.