commit 2df35810fbb026df726d4a40bc25da8cb9726392
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Tue Oct 5 12:52:20 2021 +0200

    Simplifications

diff --git a/src/main/java/org/distorted/objectlib/effects/EffectController.java b/src/main/java/org/distorted/objectlib/effects/EffectController.java
index b09f18cf..04d558c1 100644
--- a/src/main/java/org/distorted/objectlib/effects/EffectController.java
+++ b/src/main/java/org/distorted/objectlib/effects/EffectController.java
@@ -27,7 +27,7 @@ import org.distorted.objectlib.helpers.MovesFinished;
 
 public interface EffectController extends EffectListener
   {
-  void addRotation(MovesFinished listener, int axis, int rowBitmap, int angle, long duration);
+  void addRotation(MovesFinished listener, int axis, int rowBitmap, int angle, int duration);
   TwistyObject getOldObject();
   TwistyObject getObject();
   int getNumScrambles();
diff --git a/src/main/java/org/distorted/objectlib/effects/scramble/ScrambleEffect.java b/src/main/java/org/distorted/objectlib/effects/scramble/ScrambleEffect.java
index bdf2b61d..b9a601f5 100644
--- a/src/main/java/org/distorted/objectlib/effects/scramble/ScrambleEffect.java
+++ b/src/main/java/org/distorted/objectlib/effects/scramble/ScrambleEffect.java
@@ -70,7 +70,7 @@ public abstract class ScrambleEffect extends BaseEffect implements EffectListene
   private EffectController mController;
   private int mEffectReturned;
   private int mNumScramblesLeft;
-  private long mDurationPerDegree;
+  private int mDurationPerDegree;
   private final Random mRnd;
   private int[] mBasicAngle;
   private boolean mRotReady, mPluginReady;
@@ -133,13 +133,8 @@ public abstract class ScrambleEffect extends BaseEffect implements EffectListene
       int row  = mScrambles[mNumScrambles][1];
       int angle= mScrambles[mNumScrambles][2];
 
-      int rowBitmap= (1<<row);
-      int absAngle = (angle<0 ? -angle : angle);
-      int basicDegrees  = 360/mBasicAngle[axis];
-      long durationMillis = absAngle*basicDegrees*mDurationPerDegree;
-
       mNumScramblesLeft--;
-      mController.addRotation(this, axis, rowBitmap, angle*basicDegrees, durationMillis);
+      mController.addRotation(this, axis, (1<<row), angle, mDurationPerDegree);
       mNumScrambles++;
       }
     else
diff --git a/src/main/java/org/distorted/objectlib/main/ObjectControl.java b/src/main/java/org/distorted/objectlib/main/ObjectControl.java
index 447e0041..70d85bca 100644
--- a/src/main/java/org/distorted/objectlib/main/ObjectControl.java
+++ b/src/main/java/org/distorted/objectlib/main/ObjectControl.java
@@ -249,14 +249,19 @@ public class ObjectControl
     private void finishRotation()
       {
       computeCurrentSpeedInInchesPerSecond();
-      int angle = mPreRender.getObject().computeNearestAngle(mCurrentAxis,mCurrentAngle, mCurrRotSpeed);
+      TwistyObject object = mPreRender.getObject();
+      int angle = object.computeNearestAngle(mCurrentAxis,mCurrentAngle, mCurrRotSpeed);
       mPreRender.finishRotation(angle);
       mPreRender.rememberMove(mCurrentAxis,mCurrentRow,angle);
 
       if( angle!=0 )
         {
         TwistyActivity act = mAct.get();
-        mActioner.onFinishRotation(act,mCurrentAxis,mCurrentRow,angle);
+
+        int basicAngle= object.getBasicAngle()[mCurrentAxis];
+        int realAngle = (angle*basicAngle)/360;
+
+        mActioner.onFinishRotation(act,mCurrentAxis,mCurrentRow,realAngle);
         }
 
       mContinuingRotation = false;
@@ -657,7 +662,7 @@ public class ObjectControl
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-    public void addRotation(MovesFinished listener, int axis, int rowBitmap, int angle, long duration)
+    public void addRotation(MovesFinished listener, int axis, int rowBitmap, int angle, int duration)
       {
       mPreRender.addRotation(listener,axis,rowBitmap,angle,duration);
       }
diff --git a/src/main/java/org/distorted/objectlib/main/ObjectPreRender.java b/src/main/java/org/distorted/objectlib/main/ObjectPreRender.java
index 6958ff08..8982ea22 100644
--- a/src/main/java/org/distorted/objectlib/main/ObjectPreRender.java
+++ b/src/main/java/org/distorted/objectlib/main/ObjectPreRender.java
@@ -485,10 +485,14 @@ public class ObjectPreRender implements EffectController
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-  public void addRotation(MovesFinished listener, int axis, int rowBitmap, int angle, long duration)
+  public void addRotation(MovesFinished listener, int axis, int rowBitmap, int bareAngle, int millPreDegree)
     {
     mAddRotation = true;
 
+    int basicAngle= mNewObject.getBasicAngle()[axis];
+    int angle     = bareAngle*(360/basicAngle);
+    int duration  = Math.abs(angle)*millPreDegree;
+
     mAddActionListener    = listener;
     mAddRotationAxis      = axis;
     mAddRotationRowBitmap = rowBitmap;
diff --git a/src/main/java/org/distorted/objectlib/main/TwistyObject.java b/src/main/java/org/distorted/objectlib/main/TwistyObject.java
index 3dfca4e3..8f1ba795 100644
--- a/src/main/java/org/distorted/objectlib/main/TwistyObject.java
+++ b/src/main/java/org/distorted/objectlib/main/TwistyObject.java
@@ -1240,6 +1240,20 @@ public abstract class TwistyObject extends DistortedNode
       return mQuat;
       }
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public void apply(Effect effect, int position)
+    {
+    mEffects.apply(effect, position);
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public void remove(long effectID)
+    {
+    mEffects.abortById(effectID);
+    }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 // PUBLIC API
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1261,20 +1275,6 @@ public abstract class TwistyObject extends DistortedNode
     return mNumLayers;
     }
 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public void apply(Effect effect, int position)
-    {
-    mEffects.apply(effect, position);
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public void remove(long effectID)
-    {
-    mEffects.abortById(effectID);
-    }
-
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
   public synchronized void solve()
