Skip to content

Commit

Permalink
More Rail Fixes
Browse files Browse the repository at this point in the history
Overlapping points are possible now
  • Loading branch information
DonavinDraws committed Feb 16, 2024
1 parent 23280fd commit 2304d87
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions Fushigi/ui/widgets/LevelViewport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,6 @@ mHoveredObject is CourseActor &&
}
}


dragRelease = false;
}

Expand Down Expand Up @@ -1008,6 +1007,11 @@ Vector2[] GetPoints()
bool isSelected = mEditContext.IsSelected(rail);
bool hovered = MathUtil.HitTestLineLoopPoint(GetPoints(), 10f, ImGui.GetMousePos());

//Rail selection disabled for now as it conflicts with point selection
//Putting it at the top of the for loop should make it prioritize points -Donavin
if (hovered)
newHoveredObject = rail;

CourseRail.CourseRailPoint selectedPoint = null;

foreach (var point in rail.mPoints)
Expand Down Expand Up @@ -1036,9 +1040,11 @@ Vector2[] GetPoints()
if (selectedPoint != null && ImGui.IsMouseReleased(0))
{
//Check if point matches an existing point, remove if intersected
var matching = rail.mPoints.Where(x => x.mTranslate == selectedPoint.mTranslate).ToList();
if (matching.Count > 1)
rail.mPoints.Remove(selectedPoint);
//The base game has overlapping points, this breaks things

// var matching = rail.mPoints.Where(x => x.mTranslate == selectedPoint.mTranslate).ToList();
// if (matching.Count > 1)
// rail.mPoints.Remove(selectedPoint);
}

bool add_point = ImGui.IsMouseClicked(0) && ImGui.IsMouseDown(0) && ImGui.GetIO().KeyAlt;
Expand Down Expand Up @@ -1080,10 +1086,6 @@ Vector2[] GetPoints()
this.mEditContext.Select(newPoint);
newHoveredObject = newPoint;
}

//Rail selection disabled for now as it conflicts with point selection
// if (hovered)
// newHoveredObject = rail;
}

foreach (CourseRail rail in mArea.mRailHolder.mRails)
Expand Down

0 comments on commit 2304d87

Please sign in to comment.