Skip to content

Commit

Permalink
fix the problem that some values become out of range
Browse files Browse the repository at this point in the history
  • Loading branch information
tmokmss committed May 20, 2018
1 parent 2ffb636 commit caf44da
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
10 changes: 5 additions & 5 deletions Osu2Saber/Model/Algorithm/ConvertAlgorithm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void MakeLightEffect()
events.Add(ev);
ev = new Event(startTime, EventType.LightLeftLasers, EventLightValue.Off);
events.Add(ev);
ev = new Event(startTime, EventType.RotationAllTrackRings, EventRotationValue.Speed3);
ev = new Event(startTime, EventType.RotationAllTrackRings, 1);
events.Add(ev);

ev = new Event(endTime, EventType.RotationAllTrackRings, EventRotationValue.Stop);
Expand All @@ -87,7 +87,7 @@ void MakeLightEffect()

var ev = new Event(time, EventType.LightBottomBackSideLasers, color);
events.Add(ev);
ev = new Event(time, EventType.RotationSmallTrackRings, EventRotationValue.Speed5);
ev = new Event(time, EventType.RotationSmallTrackRings, 1);
events.Add(ev);


Expand Down Expand Up @@ -158,8 +158,8 @@ protected double ConvertTime(int timeMs)
(int line, int layer) DeterminePosition(float x, float y)
{
// just map notes position to BS screen
var line = (int)Math.Floor(x / OsuScreenXMax * (double)Line.MaxNum);
var layer = (int)Math.Floor(y / OsuScreenYMax * (double)Layer.MaxNum);
var line = (int)Math.Floor(x / (OsuScreenXMax + 1) * (double)Line.MaxNum);
var layer = (int)Math.Floor(y / (OsuScreenYMax + 1) * (double)Layer.MaxNum);
layer = SlideLayer(line, layer, y);
return (line: line, layer: layer);
}
Expand All @@ -172,7 +172,7 @@ int SlideLayer(int line, int layer, float y)

// The larger this value is, the less likely notes appear in center middle.
var fineSection = 12;
var layerIdx = (int)Math.Floor(y / OsuScreenYMax * fineSection);
var layerIdx = (int)Math.Floor(y / (OsuScreenYMax + 1) * fineSection);
if (layerIdx == fineSection / 2) return layer;
if (layerIdx < fineSection / 2) return (int)Layer.Bottom;
return (int)Layer.Top;
Expand Down
3 changes: 2 additions & 1 deletion Osu2Saber/Model/Osu2BsConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ string GenerateMap(Beatmap org)
{
var map = new SaberBeatmap()
{
_version = org.Version,
_origin = org.Version,
_version = "1.5.0",
_beatsPerMinute = CalcOriginalBPM(org),
_beatsPerBar = 16,
_noteJumpSpeed = 10,
Expand Down

0 comments on commit caf44da

Please sign in to comment.