Skip to content

Commit 18f1d62

Browse files
committed
Fix juice stream placement blueprint being initially visually offset
- Closes #31423. - Regressed in #30411. Admittedly, I don't completely understand all of the pieces here, because code quality of this placement blueprint code is ALL-CAPS ATROCIOUS, but I believe the failure mode to be something along the lines of: - User activates juice stream tool, blueprint gets created in initial state. It reads in a mouse position far outside of the playfield, and sets internal positioning appropriately. - When the user moves the mouse into the bounds of the playfield, some positions update (the ones inside `UpdateTimeAndPosition()`, but the fruit markers are for *nested* objects, and `updateHitObjectFromPath()` is responsible for updating those... however, it only fires if the `editablePath.PathId` changes, which it won't here, because there is only one path vertex until the user commits the starting point of the juice stream and it's always at (0,0). - Therefore the position of the starting fruit marker remains bogus until left click, at which point the path changes and everything returns to *relative* sanity. The solution essentially relies on inlining the broken method and only guarding the relevant part of processing behind the path version check (which is actually updating the path). Everything else that can touch positions of nesteds (like default application, and the drawable piece updates) is allowed to happen unconditionally.
1 parent e7070bd commit 18f1d62

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

osu.Game.Rulesets.Catch/Edit/Blueprints/JuiceStreamPlacementBlueprint.cs

+5-14
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,9 @@ public override void UpdateTimeAndPosition(SnapResult result)
8888
switch (PlacementActive)
8989
{
9090
case PlacementState.Waiting:
91-
if (!(result.Time is double snappedTime)) return;
92-
9391
HitObject.OriginalX = ToLocalSpace(result.ScreenSpacePosition).X;
94-
HitObject.StartTime = snappedTime;
92+
if (result.Time is double snappedTime)
93+
HitObject.StartTime = snappedTime;
9594
break;
9695

9796
case PlacementState.Active:
@@ -107,21 +106,13 @@ public override void UpdateTimeAndPosition(SnapResult result)
107106
Vector2 startPosition = CatchHitObjectUtils.GetStartPosition(HitObjectContainer, HitObject);
108107
editablePath.Position = nestedOutlineContainer.Position = scrollingPath.Position = startPosition;
109108

110-
updateHitObjectFromPath();
111-
}
112-
113-
private void updateHitObjectFromPath()
114-
{
115-
if (lastEditablePathId == editablePath.PathId)
116-
return;
109+
if (lastEditablePathId != editablePath.PathId)
110+
editablePath.UpdateHitObjectFromPath(HitObject);
111+
lastEditablePathId = editablePath.PathId;
117112

118-
editablePath.UpdateHitObjectFromPath(HitObject);
119113
ApplyDefaultsToHitObject();
120-
121114
scrollingPath.UpdatePathFrom(HitObjectContainer, HitObject);
122115
nestedOutlineContainer.UpdateNestedObjectsFrom(HitObjectContainer, HitObject);
123-
124-
lastEditablePathId = editablePath.PathId;
125116
}
126117

127118
private double positionToTime(float relativeYPosition)

0 commit comments

Comments
 (0)