Skip to content

Commit

Permalink
fix: Analog inputs without an angle
Browse files Browse the repository at this point in the history
  • Loading branch information
psyGamer committed Jan 1, 2025
1 parent bdb6681 commit 59e8aa0
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions CelesteTAS-EverestInterop/Source/TAS/Input/InputFrame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,14 @@ private InputFrame(ActionLine actionLine, int studioLine, int repeatIndex, int r
actionLineString = actionLine.ToString();
checksum = actionLineString.GetHashCode();

if (float.TryParse(actionLine.FeatherAngle, out float angle)) {
float magnitude = float.TryParse(actionLine.FeatherMagnitude, out float m) ? m : 1.0f;
(StickPosition, StickPositionShort) = AnalogHelper.ComputeAngleVector(angle, magnitude);
if (Actions.Has(Actions.Feather)) {
if (float.TryParse(actionLine.FeatherAngle, out float angle)) {
float magnitude = float.TryParse(actionLine.FeatherMagnitude, out float m) ? m : 1.0f;
(StickPosition, StickPositionShort) = AnalogHelper.ComputeAngleVector(angle, magnitude);
} else {
// Fallback to 0°
(StickPosition, StickPositionShort) = AnalogHelper.ComputeAngleVector(0.0f, 1.0f);
}
}

if (Actions.Has(Actions.LeftDashOnly)) {
Expand Down

0 comments on commit 59e8aa0

Please sign in to comment.