mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Replace CatchHitObject.X usage to EffectiveX and OriginalX
This commit is contained in:
@ -84,7 +84,7 @@ namespace osu.Game.Rulesets.Catch.Tests
|
|||||||
|
|
||||||
public float Position
|
public float Position
|
||||||
{
|
{
|
||||||
get => HitObject?.X ?? position;
|
get => HitObject?.EffectiveX ?? position;
|
||||||
set => position = value;
|
set => position = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ namespace osu.Game.Rulesets.Catch.Tests
|
|||||||
|
|
||||||
private void attemptCatch(Fruit fruit)
|
private void attemptCatch(Fruit fruit)
|
||||||
{
|
{
|
||||||
fruit.X += catcher.X;
|
fruit.OriginalX += catcher.X;
|
||||||
fruit.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty
|
fruit.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty
|
||||||
{
|
{
|
||||||
CircleSize = circleSize
|
CircleSize = circleSize
|
||||||
|
@ -75,7 +75,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
|
|||||||
|
|
||||||
case JuiceStream juiceStream:
|
case JuiceStream juiceStream:
|
||||||
// Todo: BUG!! Stable used the last control point as the final position of the path, but it should use the computed path instead.
|
// Todo: BUG!! Stable used the last control point as the final position of the path, but it should use the computed path instead.
|
||||||
lastPosition = juiceStream.X + juiceStream.Path.ControlPoints[^1].Position.Value.X;
|
lastPosition = juiceStream.OriginalX + juiceStream.Path.ControlPoints[^1].Position.Value.X;
|
||||||
|
|
||||||
// Todo: BUG!! Stable attempted to use the end time of the stream, but referenced it too early in execution and used the start time instead.
|
// Todo: BUG!! Stable attempted to use the end time of the stream, but referenced it too early in execution and used the start time instead.
|
||||||
lastStartTime = juiceStream.StartTime;
|
lastStartTime = juiceStream.StartTime;
|
||||||
@ -86,7 +86,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
|
|||||||
catchObject.XOffset = 0;
|
catchObject.XOffset = 0;
|
||||||
|
|
||||||
if (catchObject is TinyDroplet)
|
if (catchObject is TinyDroplet)
|
||||||
catchObject.XOffset = Math.Clamp(rng.Next(-20, 20), -catchObject.X, CatchPlayfield.WIDTH - catchObject.X);
|
catchObject.XOffset = Math.Clamp(rng.Next(-20, 20), -catchObject.OriginalX, CatchPlayfield.WIDTH - catchObject.OriginalX);
|
||||||
else if (catchObject is Droplet)
|
else if (catchObject is Droplet)
|
||||||
rng.Next(); // osu!stable retrieved a random droplet rotation
|
rng.Next(); // osu!stable retrieved a random droplet rotation
|
||||||
}
|
}
|
||||||
@ -100,7 +100,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
|
|||||||
|
|
||||||
private static void applyHardRockOffset(CatchHitObject hitObject, ref float? lastPosition, ref double lastStartTime, FastRandom rng)
|
private static void applyHardRockOffset(CatchHitObject hitObject, ref float? lastPosition, ref double lastStartTime, FastRandom rng)
|
||||||
{
|
{
|
||||||
float offsetPosition = hitObject.X;
|
float offsetPosition = hitObject.OriginalX;
|
||||||
double startTime = hitObject.StartTime;
|
double startTime = hitObject.StartTime;
|
||||||
|
|
||||||
if (lastPosition == null)
|
if (lastPosition == null)
|
||||||
@ -126,7 +126,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
|
|||||||
if (positionDiff == 0)
|
if (positionDiff == 0)
|
||||||
{
|
{
|
||||||
applyRandomOffset(ref offsetPosition, timeDiff / 4d, rng);
|
applyRandomOffset(ref offsetPosition, timeDiff / 4d, rng);
|
||||||
hitObject.XOffset = offsetPosition - hitObject.X;
|
hitObject.XOffset = offsetPosition - hitObject.OriginalX;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
|
|||||||
if (Math.Abs(positionDiff) < timeDiff / 3)
|
if (Math.Abs(positionDiff) < timeDiff / 3)
|
||||||
applyOffset(ref offsetPosition, positionDiff);
|
applyOffset(ref offsetPosition, positionDiff);
|
||||||
|
|
||||||
hitObject.XOffset = offsetPosition - hitObject.X;
|
hitObject.XOffset = offsetPosition - hitObject.OriginalX;
|
||||||
|
|
||||||
lastPosition = offsetPosition;
|
lastPosition = offsetPosition;
|
||||||
lastStartTime = startTime;
|
lastStartTime = startTime;
|
||||||
@ -230,9 +230,9 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
|
|||||||
currentObject.HyperDashTarget = null;
|
currentObject.HyperDashTarget = null;
|
||||||
currentObject.DistanceToHyperDash = 0;
|
currentObject.DistanceToHyperDash = 0;
|
||||||
|
|
||||||
int thisDirection = nextObject.X > currentObject.X ? 1 : -1;
|
int thisDirection = nextObject.EffectiveX > currentObject.EffectiveX ? 1 : -1;
|
||||||
double timeToNext = nextObject.StartTime - currentObject.StartTime - 1000f / 60f / 4; // 1/4th of a frame of grace time, taken from osu-stable
|
double timeToNext = nextObject.StartTime - currentObject.StartTime - 1000f / 60f / 4; // 1/4th of a frame of grace time, taken from osu-stable
|
||||||
double distanceToNext = Math.Abs(nextObject.X - currentObject.X) - (lastDirection == thisDirection ? lastExcess : halfCatcherWidth);
|
double distanceToNext = Math.Abs(nextObject.EffectiveX - currentObject.EffectiveX) - (lastDirection == thisDirection ? lastExcess : halfCatcherWidth);
|
||||||
float distanceToHyper = (float)(timeToNext * Catcher.BASE_SPEED - distanceToNext);
|
float distanceToHyper = (float)(timeToNext * Catcher.BASE_SPEED - distanceToNext);
|
||||||
|
|
||||||
if (distanceToHyper < 0)
|
if (distanceToHyper < 0)
|
||||||
|
@ -32,8 +32,8 @@ namespace osu.Game.Rulesets.Catch.Difficulty.Preprocessing
|
|||||||
// We will scale everything by this factor, so we can assume a uniform CircleSize among beatmaps.
|
// We will scale everything by this factor, so we can assume a uniform CircleSize among beatmaps.
|
||||||
var scalingFactor = normalized_hitobject_radius / halfCatcherWidth;
|
var scalingFactor = normalized_hitobject_radius / halfCatcherWidth;
|
||||||
|
|
||||||
NormalizedPosition = BaseObject.X * scalingFactor;
|
NormalizedPosition = BaseObject.EffectiveX * scalingFactor;
|
||||||
LastNormalizedPosition = LastObject.X * scalingFactor;
|
LastNormalizedPosition = LastObject.EffectiveX * scalingFactor;
|
||||||
|
|
||||||
// Every strain interval is hard capped at the equivalent of 375 BPM streaming speed as a safety measure
|
// Every strain interval is hard capped at the equivalent of 375 BPM streaming speed as a safety measure
|
||||||
StrainTime = Math.Max(40, DeltaTime);
|
StrainTime = Math.Max(40, DeltaTime);
|
||||||
|
@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
|||||||
|
|
||||||
protected override double InitialLifetimeOffset => HitObject.TimePreempt;
|
protected override double InitialLifetimeOffset => HitObject.TimePreempt;
|
||||||
|
|
||||||
protected override float SamplePlaybackPosition => HitObject.X / CatchPlayfield.WIDTH;
|
protected override float SamplePlaybackPosition => HitObject.EffectiveX / CatchPlayfield.WIDTH;
|
||||||
|
|
||||||
public int RandomSeed => HitObject?.RandomSeed ?? 0;
|
public int RandomSeed => HitObject?.RandomSeed ?? 0;
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ namespace osu.Game.Rulesets.Catch.Objects
|
|||||||
AddNested(new TinyDroplet
|
AddNested(new TinyDroplet
|
||||||
{
|
{
|
||||||
StartTime = t + lastEvent.Value.Time,
|
StartTime = t + lastEvent.Value.Time,
|
||||||
X = X + Path.PositionAt(
|
X = OriginalX + Path.PositionAt(
|
||||||
lastEvent.Value.PathProgress + (t / sinceLastTick) * (e.PathProgress - lastEvent.Value.PathProgress)).X,
|
lastEvent.Value.PathProgress + (t / sinceLastTick) * (e.PathProgress - lastEvent.Value.PathProgress)).X,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -93,7 +93,7 @@ namespace osu.Game.Rulesets.Catch.Objects
|
|||||||
{
|
{
|
||||||
Samples = dropletSamples,
|
Samples = dropletSamples,
|
||||||
StartTime = e.Time,
|
StartTime = e.Time,
|
||||||
X = X + Path.PositionAt(e.PathProgress).X,
|
X = OriginalX + Path.PositionAt(e.PathProgress).X,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -104,14 +104,14 @@ namespace osu.Game.Rulesets.Catch.Objects
|
|||||||
{
|
{
|
||||||
Samples = this.GetNodeSamples(nodeIndex++),
|
Samples = this.GetNodeSamples(nodeIndex++),
|
||||||
StartTime = e.Time,
|
StartTime = e.Time,
|
||||||
X = X + Path.PositionAt(e.PathProgress).X,
|
X = OriginalX + Path.PositionAt(e.PathProgress).X,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public float EndX => X + this.CurvePositionAt(1).X;
|
public float EndX => OriginalX + this.CurvePositionAt(1).X;
|
||||||
|
|
||||||
public double Duration
|
public double Duration
|
||||||
{
|
{
|
||||||
|
@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.Catch.Replays
|
|||||||
|
|
||||||
void moveToNext(PalpableCatchHitObject h)
|
void moveToNext(PalpableCatchHitObject h)
|
||||||
{
|
{
|
||||||
float positionChange = Math.Abs(lastPosition - h.X);
|
float positionChange = Math.Abs(lastPosition - h.EffectiveX);
|
||||||
double timeAvailable = h.StartTime - lastTime;
|
double timeAvailable = h.StartTime - lastTime;
|
||||||
|
|
||||||
// So we can either make it there without a dash or not.
|
// So we can either make it there without a dash or not.
|
||||||
@ -56,7 +56,7 @@ namespace osu.Game.Rulesets.Catch.Replays
|
|||||||
// todo: get correct catcher size, based on difficulty CS.
|
// todo: get correct catcher size, based on difficulty CS.
|
||||||
const float catcher_width_half = CatcherArea.CATCHER_SIZE * 0.3f * 0.5f;
|
const float catcher_width_half = CatcherArea.CATCHER_SIZE * 0.3f * 0.5f;
|
||||||
|
|
||||||
if (lastPosition - catcher_width_half < h.X && lastPosition + catcher_width_half > h.X)
|
if (lastPosition - catcher_width_half < h.EffectiveX && lastPosition + catcher_width_half > h.EffectiveX)
|
||||||
{
|
{
|
||||||
// we are already in the correct range.
|
// we are already in the correct range.
|
||||||
lastTime = h.StartTime;
|
lastTime = h.StartTime;
|
||||||
@ -66,12 +66,12 @@ namespace osu.Game.Rulesets.Catch.Replays
|
|||||||
|
|
||||||
if (impossibleJump)
|
if (impossibleJump)
|
||||||
{
|
{
|
||||||
addFrame(h.StartTime, h.X);
|
addFrame(h.StartTime, h.EffectiveX);
|
||||||
}
|
}
|
||||||
else if (h.HyperDash)
|
else if (h.HyperDash)
|
||||||
{
|
{
|
||||||
addFrame(h.StartTime - timeAvailable, lastPosition);
|
addFrame(h.StartTime - timeAvailable, lastPosition);
|
||||||
addFrame(h.StartTime, h.X);
|
addFrame(h.StartTime, h.EffectiveX);
|
||||||
}
|
}
|
||||||
else if (dashRequired)
|
else if (dashRequired)
|
||||||
{
|
{
|
||||||
@ -80,23 +80,23 @@ namespace osu.Game.Rulesets.Catch.Replays
|
|||||||
double timeWeNeedToSave = timeAtNormalSpeed - timeAvailable;
|
double timeWeNeedToSave = timeAtNormalSpeed - timeAvailable;
|
||||||
double timeAtDashSpeed = timeWeNeedToSave / 2;
|
double timeAtDashSpeed = timeWeNeedToSave / 2;
|
||||||
|
|
||||||
float midPosition = (float)Interpolation.Lerp(lastPosition, h.X, (float)timeAtDashSpeed / timeAvailable);
|
float midPosition = (float)Interpolation.Lerp(lastPosition, h.EffectiveX, (float)timeAtDashSpeed / timeAvailable);
|
||||||
|
|
||||||
// dash movement
|
// dash movement
|
||||||
addFrame(h.StartTime - timeAvailable + 1, lastPosition, true);
|
addFrame(h.StartTime - timeAvailable + 1, lastPosition, true);
|
||||||
addFrame(h.StartTime - timeAvailable + timeAtDashSpeed, midPosition);
|
addFrame(h.StartTime - timeAvailable + timeAtDashSpeed, midPosition);
|
||||||
addFrame(h.StartTime, h.X);
|
addFrame(h.StartTime, h.EffectiveX);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
double timeBefore = positionChange / movement_speed;
|
double timeBefore = positionChange / movement_speed;
|
||||||
|
|
||||||
addFrame(h.StartTime - timeBefore, lastPosition);
|
addFrame(h.StartTime - timeBefore, lastPosition);
|
||||||
addFrame(h.StartTime, h.X);
|
addFrame(h.StartTime, h.EffectiveX);
|
||||||
}
|
}
|
||||||
|
|
||||||
lastTime = h.StartTime;
|
lastTime = h.StartTime;
|
||||||
lastPosition = h.X;
|
lastPosition = h.EffectiveX;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var obj in Beatmap.HitObjects)
|
foreach (var obj in Beatmap.HitObjects)
|
||||||
|
@ -216,7 +216,7 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
var halfCatchWidth = catchWidth * 0.5f;
|
var halfCatchWidth = catchWidth * 0.5f;
|
||||||
|
|
||||||
// this stuff wil disappear once we move fruit to non-relative coordinate space in the future.
|
// this stuff wil disappear once we move fruit to non-relative coordinate space in the future.
|
||||||
var catchObjectPosition = fruit.X;
|
var catchObjectPosition = fruit.EffectiveX;
|
||||||
var catcherPosition = Position.X;
|
var catcherPosition = Position.X;
|
||||||
|
|
||||||
return catchObjectPosition >= catcherPosition - halfCatchWidth &&
|
return catchObjectPosition >= catcherPosition - halfCatchWidth &&
|
||||||
@ -250,10 +250,10 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
{
|
{
|
||||||
var target = hitObject.HyperDashTarget;
|
var target = hitObject.HyperDashTarget;
|
||||||
var timeDifference = target.StartTime - hitObject.StartTime;
|
var timeDifference = target.StartTime - hitObject.StartTime;
|
||||||
double positionDifference = target.X - X;
|
double positionDifference = target.EffectiveX - X;
|
||||||
var velocity = positionDifference / Math.Max(1.0, timeDifference - 1000.0 / 60.0);
|
var velocity = positionDifference / Math.Max(1.0, timeDifference - 1000.0 / 60.0);
|
||||||
|
|
||||||
SetHyperDashState(Math.Abs(velocity), target.X);
|
SetHyperDashState(Math.Abs(velocity), target.EffectiveX);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
SetHyperDashState();
|
SetHyperDashState();
|
||||||
|
Reference in New Issue
Block a user