@@ -14,7 +14,7 @@ type spinnerstate struct {
1414 rotationCount int64
1515 lastRotationCount int64
1616 scoringRotationCount int64
17- rotationCountF float64
17+ rotationCountF float32
1818 rotationCountFD float64
1919 frameVariance float64
2020 theoreticalVelocity float64
@@ -80,6 +80,36 @@ func (spinner *Spinner) UpdateFor(player *difficultyPlayer, time int64, _ bool)
8080 numFinishedTotal ++
8181
8282 if player .cursor .IsReplayFrame && time > int64 (spinner .hitSpinner .GetStartTime ()) && time < int64 (spinner .hitSpinner .GetEndTime ()) {
83+ maxAccelThisFrame := player .diff .GetModifiedTime (spinner .maxAcceleration * timeDiff )
84+
85+ if player .diff .CheckModActive (difficulty .SpunOut ) || player .diff .CheckModActive (difficulty .Relax2 ) {
86+ state .currentVelocity = 0.03
87+ } else if state .theoreticalVelocity > state .currentVelocity {
88+ accel := maxAccelThisFrame
89+ if state .currentVelocity < 0 && player .diff .CheckModActive (difficulty .Relax ) {
90+ accel /= 4
91+ }
92+
93+ state .currentVelocity += min (state .theoreticalVelocity - state .currentVelocity , accel )
94+ } else {
95+ accel := - maxAccelThisFrame
96+ if state .currentVelocity > 0 && player .diff .CheckModActive (difficulty .Relax ) {
97+ accel /= 4
98+ }
99+
100+ state .currentVelocity += max (state .theoreticalVelocity - state .currentVelocity , accel )
101+ }
102+
103+ state .currentVelocity = max (- 0.05 , min (state .currentVelocity , 0.05 ))
104+
105+ if len (spinner .players ) == 1 {
106+ if state .currentVelocity == 0 {
107+ spinner .hitSpinner .PauseSpinSample ()
108+ } else {
109+ spinner .hitSpinner .StartSpinSample ()
110+ }
111+ }
112+
83113 decay1 := math .Pow (0.9 , timeDiff / FrameTime )
84114 state .rpm = state .rpm * decay1 + (1.0 - decay1 )* (math .Abs (state .currentVelocity )* 1000 )/ (math .Pi * 2 )* 60
85115
@@ -118,7 +148,11 @@ func (spinner *Spinner) UpdateFor(player *difficultyPlayer, time int64, _ bool)
118148
119149 if math .Abs (angleDiff ) < math .Pi {
120150 if player .diff .GetModifiedTime (state .frameVariance ) > FrameTime * 1.04 {
121- state .theoreticalVelocity = angleDiff / player .diff .GetModifiedTime (timeDiff )
151+ if timeDiff > 0 {
152+ state .theoreticalVelocity = angleDiff / player .diff .GetModifiedTime (timeDiff )
153+ } else {
154+ state .theoreticalVelocity = 0
155+ }
122156 } else {
123157 state .theoreticalVelocity = angleDiff / FrameTime
124158 }
@@ -129,45 +163,15 @@ func (spinner *Spinner) UpdateFor(player *difficultyPlayer, time int64, _ bool)
129163
130164 state .lastAngle = mouseAngle
131165
132- maxAccelThisFrame := player .diff .GetModifiedTime (spinner .maxAcceleration * timeDiff )
133-
134- if player .diff .CheckModActive (difficulty .SpunOut ) || player .diff .CheckModActive (difficulty .Relax2 ) {
135- state .currentVelocity = 0.03
136- } else if state .theoreticalVelocity > state .currentVelocity {
137- accel := maxAccelThisFrame
138- if state .currentVelocity < 0 && player .diff .CheckModActive (difficulty .Relax ) {
139- accel /= 4
140- }
141-
142- state .currentVelocity += min (state .theoreticalVelocity - state .currentVelocity , accel )
143- } else {
144- accel := - maxAccelThisFrame
145- if state .currentVelocity > 0 && player .diff .CheckModActive (difficulty .Relax ) {
146- accel /= 4
147- }
148-
149- state .currentVelocity += max (state .theoreticalVelocity - state .currentVelocity , accel )
150- }
151-
152- state .currentVelocity = max (- 0.05 , min (state .currentVelocity , 0.05 ))
153-
154- if len (spinner .players ) == 1 {
155- if state .currentVelocity == 0 {
156- spinner .hitSpinner .PauseSpinSample ()
157- } else {
158- spinner .hitSpinner .StartSpinSample ()
159- }
160- }
161-
162166 rotationAddition := state .currentVelocity * timeDiff
163167
164168 state .rotationCountFD += rotationAddition
165- state .rotationCountF += math .Abs (rotationAddition / math .Pi )
169+ state .rotationCountF += float32 ( math .Abs (float64 ( float32 ( rotationAddition )) / math .Pi ) )
166170
167171 if len (spinner .players ) == 1 {
168172 spinner .hitSpinner .SetRotation (player .diff .GetModifiedTime (state .rotationCountFD ))
169173 spinner .hitSpinner .SetRPM (state .rpm )
170- spinner .hitSpinner .UpdateCompletion (state .rotationCountF / float64 (state .requirement ))
174+ spinner .hitSpinner .UpdateCompletion (float64 ( state .rotationCountF ) / float64 (state .requirement ))
171175 }
172176
173177 state .rotationCount = int64 (state .rotationCountF )
0 commit comments