Project

General

Profile

« Previous | Next » 

Revision a57e6870

Added by Leszek Koltunski over 2 years ago

make numLayers into an int[] (preparation for Cuboids)
Caution: because of previous changes to cubit order in cube, the Solver is broken!

View differences:

src/main/java/org/distorted/objectlib/main/Movement.java
56 56

  
57 57
  abstract int returnPart(int type, int face, float[] touchPoint);
58 58
  abstract boolean isInsideFace(int face, float[] point);
59
  public abstract float returnRotationFactor(int numLayers, int row);
59
  public abstract float returnRotationFactor(int[] numLayers, int row);
60 60

  
61 61
///////////////////////////////////////////////////////////////////////////////////////////////////
62 62

  
src/main/java/org/distorted/objectlib/main/Movement12.java
61 61

  
62 62
///////////////////////////////////////////////////////////////////////////////////////////////////
63 63

  
64
  public float returnRotationFactor(int numLayers, int row)
64
  public float returnRotationFactor(int[] numLayers, int row)
65 65
    {
66 66
    return 1.0f;
67 67
    }
src/main/java/org/distorted/objectlib/main/Movement4.java
86 86
///////////////////////////////////////////////////////////////////////////////////////////////////
87 87
// Jing has nL=2
88 88

  
89
  public float returnRotationFactor(int numLayers, int row)
89
  public float returnRotationFactor(int[] numLayers, int row)
90 90
    {
91
    return numLayers==2 ? 1.0f : ((float)numLayers)/(numLayers-row);
91
    int numL = numLayers[0];
92

  
93
    return numL==2 ? 1.0f : ((float)numL)/(numL-row);
92 94
    }
93 95

  
94 96
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/objectlib/main/Movement6.java
68 68

  
69 69
///////////////////////////////////////////////////////////////////////////////////////////////////
70 70

  
71
  public float returnRotationFactor(int numLayers, int row)
71
  public float returnRotationFactor(int[] numLayers, int row)
72 72
    {
73 73
    return 1.0f;
74 74
    }
src/main/java/org/distorted/objectlib/main/Movement8.java
85 85

  
86 86
///////////////////////////////////////////////////////////////////////////////////////////////////
87 87

  
88
  public float returnRotationFactor(int numLayers, int row)
88
  public float returnRotationFactor(int[] numLayers, int row)
89 89
    {
90 90
    return 1.0f;
91 91
    }
src/main/java/org/distorted/objectlib/main/ObjectControl.java
62 62
    private float mStartRotX, mStartRotY;
63 63
    private float mAxisX, mAxisY;
64 64
    private float mRotationFactor;
65
    private int mLastCubitColor, mLastCubitFace, mLastCubit;
65
    private int mLastCubitColor, mLastCubit;
66 66
    private int mCurrentAxis, mCurrentRow;
67 67
    private float mCurrentAngle, mCurrRotSpeed;
68 68
    private final float[] mLastX;
......
191 191
            if( down )
192 192
              {
193 193
              int color = mInterface.getCurrentColor();
194
              mLastCubitFace = mMovement.getTouchedFace();
195 194
              float[] point = mMovement.getTouchedPoint3D();
196 195
              mLastCubit = object.getCubit(point);
197
              mPreRender.setTextureMap( mLastCubit, mLastCubitFace, color );
198 196
              mLastCubitColor = mInterface.cubitIsLocked(object.getObjectType(),mLastCubit);
197
              mPreRender.setTextureMap( mLastCubit, mLastCubitColor>=0 ? 4 : mMovement.getTouchedFace(), color );
199 198
              }
200 199
            }
201 200
          }
......
297 296
      mStartRotY = y;
298 297

  
299 298
      TwistyObject object = mPreRender.getObject();
300
      int numLayers = object.getNumLayers();
299
      int[] numLayers = object.getNumLayers();
301 300

  
302 301
      Static4D touchPoint2 = new Static4D(x, y, 0, 0);
303 302
      Static4D rotatedTouchPoint2= QuatHelper.rotateVectorByInvertedQuat(touchPoint2, mQuat);
......
447 446

  
448 447
      if( mLastCubitColor>=0 )
449 448
        {
450
        mPreRender.setTextureMap( mLastCubit, mLastCubitFace, mLastCubitColor );
449
        mPreRender.setTextureMap( mLastCubit, 4, mLastCubitColor );
451 450
        mLastCubitColor = -1;
452 451
        }
453 452
      }
src/main/java/org/distorted/objectlib/main/ObjectPreRender.java
262 262
  private void solveNow()
263 263
    {
264 264
    mSolve = false;
265
    mNewObject.solve();
265
    if( mNewObject!=null ) mNewObject.solve();
266 266
    }
267 267

  
268 268
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/objectlib/main/ObjectType.java
34 34

  
35 35
public enum ObjectType
36 36
  {
37
  CUBE_2 ( 2, 12, R.drawable.s_cube_2, R.drawable.m_cube_2, R.drawable.b_cube_2, R.drawable.h_cube_2),
38
  CUBE_3 ( 3, 17, R.drawable.s_cube_3, R.drawable.m_cube_3, R.drawable.b_cube_3, R.drawable.h_cube_3),
39
  CUBE_4 ( 4, 24, R.drawable.s_cube_4, R.drawable.m_cube_4, R.drawable.b_cube_4, R.drawable.h_cube_4),
40
  CUBE_5 ( 5, 28, R.drawable.s_cube_5, R.drawable.m_cube_5, R.drawable.b_cube_5, R.drawable.h_cube_5),
41
  JING_2 ( 2, 11, R.drawable.s_jing_2, R.drawable.m_jing_2, R.drawable.b_jing_2, R.drawable.h_jing_2),
42
  PYRA_3 ( 3, 10, R.drawable.s_pyra_3, R.drawable.m_pyra_3, R.drawable.b_pyra_3, R.drawable.h_pyra_3),
43
  PYRA_4 ( 4, 17, R.drawable.s_pyra_4, R.drawable.m_pyra_4, R.drawable.b_pyra_4, R.drawable.h_pyra_4),
44
  PYRA_5 ( 5, 23, R.drawable.s_pyra_5, R.drawable.m_pyra_5, R.drawable.b_pyra_5, R.drawable.h_pyra_5),
45
  KILO_3 ( 3, 18, R.drawable.s_kilo_3, R.drawable.m_kilo_3, R.drawable.b_kilo_3, R.drawable.h_kilo_3),
46
  KILO_5 ( 5, 33, R.drawable.s_kilo_5, R.drawable.m_kilo_5, R.drawable.b_kilo_5, R.drawable.h_kilo_5),
47
  MEGA_3 ( 3, 21, R.drawable.s_mega_3, R.drawable.m_mega_3, R.drawable.b_mega_3, R.drawable.h_mega_3),
48
  MEGA_5 ( 5, 37, R.drawable.s_mega_5, R.drawable.m_mega_5, R.drawable.b_mega_5, R.drawable.h_mega_5),
49
  ULTI_2 ( 2, 18, R.drawable.s_ulti_2, R.drawable.m_ulti_2, R.drawable.b_ulti_2, R.drawable.h_ulti_2),
50
  DIAM_2 ( 2, 12, R.drawable.s_diam_2, R.drawable.m_diam_2, R.drawable.b_diam_2, R.drawable.h_diam_2),
51
  DIAM_3 ( 3, 24, R.drawable.s_diam_3, R.drawable.m_diam_3, R.drawable.b_diam_3, R.drawable.h_diam_3),
52
  DIAM_4 ( 4, 32, R.drawable.s_diam_4, R.drawable.m_diam_4, R.drawable.b_diam_4, R.drawable.h_diam_4),
53
  DINO_3 ( 3, 10, R.drawable.s_dino_3, R.drawable.m_dino_3, R.drawable.b_dino_3, R.drawable.h_dino_3),
54
  DIN4_3 ( 3,  7, R.drawable.s_din4_3, R.drawable.m_din4_3, R.drawable.b_din4_3, R.drawable.h_din4_3),
55
  REDI_3 ( 3, 16, R.drawable.s_redi_3, R.drawable.m_redi_3, R.drawable.b_redi_3, R.drawable.h_redi_3),
56
  HELI_3 ( 3, 20, R.drawable.s_heli_3, R.drawable.m_heli_3, R.drawable.b_heli_3, R.drawable.h_heli_3),
57
  SKEW_2 ( 2, 11, R.drawable.s_skew_2, R.drawable.m_skew_2, R.drawable.b_skew_2, R.drawable.h_skew_2),
58
  SKEW_3 ( 3, 21, R.drawable.s_skew_3, R.drawable.m_skew_3, R.drawable.b_skew_3, R.drawable.h_skew_3),
59
  IVY_2  ( 2,  8, R.drawable.s_ivy_2 , R.drawable.m_ivy_2 , R.drawable.b_ivy_2 , R.drawable.h_ivy_2 ),
60
  REX_3  ( 3, 19, R.drawable.s_rex_3 , R.drawable.m_rex_3 , R.drawable.b_rex_3 , R.drawable.h_rex_3 ),
61
  BAN1_3 ( 3, 16, R.drawable.s_ban1_3, R.drawable.m_ban1_3, R.drawable.b_ban1_3, R.drawable.h_ban1_3),
62
  BAN2_3 ( 3, 16, R.drawable.s_ban2_3, R.drawable.m_ban2_3, R.drawable.b_ban2_3, R.drawable.h_ban2_3),
63
  BAN3_3 ( 3, 16, R.drawable.s_ban3_3, R.drawable.m_ban3_3, R.drawable.b_ban3_3, R.drawable.h_ban3_3),
64
  BAN4_3 ( 3, 16, R.drawable.s_ban4_3, R.drawable.m_ban4_3, R.drawable.b_ban4_3, R.drawable.h_ban4_3),
65
  SQU1_3 ( 3, 24, R.drawable.s_squ1_3, R.drawable.m_squ1_3, R.drawable.b_squ1_3, R.drawable.h_squ1_3),
66
  SQU2_3 ( 3, 24, R.drawable.s_squ2_3, R.drawable.m_squ2_3, R.drawable.b_squ2_3, R.drawable.h_squ2_3),
67
  MIRR_2 ( 2, 12, R.drawable.s_mirr_2, R.drawable.m_mirr_2, R.drawable.b_mirr_2, R.drawable.h_mirr_2),
68
  MIRR_3 ( 3, 17, R.drawable.s_mirr_3, R.drawable.m_mirr_3, R.drawable.b_mirr_3, R.drawable.h_mirr_3),
37
  CUBE_2 ( new int[] {2,2,2}      , 12, R.drawable.s_cube_2, R.drawable.m_cube_2, R.drawable.b_cube_2, R.drawable.h_cube_2),
38
  CUBE_3 ( new int[] {3,3,3}      , 17, R.drawable.s_cube_3, R.drawable.m_cube_3, R.drawable.b_cube_3, R.drawable.h_cube_3),
39
  CUBE_4 ( new int[] {4,4,4}      , 24, R.drawable.s_cube_4, R.drawable.m_cube_4, R.drawable.b_cube_4, R.drawable.h_cube_4),
40
  CUBE_5 ( new int[] {5,5,5}      , 28, R.drawable.s_cube_5, R.drawable.m_cube_5, R.drawable.b_cube_5, R.drawable.h_cube_5),
41
  JING_2 ( new int[] {2,2,2,2}    , 11, R.drawable.s_jing_2, R.drawable.m_jing_2, R.drawable.b_jing_2, R.drawable.h_jing_2),
42
  PYRA_3 ( new int[] {3,3,3,3}    , 10, R.drawable.s_pyra_3, R.drawable.m_pyra_3, R.drawable.b_pyra_3, R.drawable.h_pyra_3),
43
  PYRA_4 ( new int[] {4,4,4,4}    , 17, R.drawable.s_pyra_4, R.drawable.m_pyra_4, R.drawable.b_pyra_4, R.drawable.h_pyra_4),
44
  PYRA_5 ( new int[] {5,5,5,5}    , 23, R.drawable.s_pyra_5, R.drawable.m_pyra_5, R.drawable.b_pyra_5, R.drawable.h_pyra_5),
45
  KILO_3 ( new int[] {3,3,3,3,3,3}, 18, R.drawable.s_kilo_3, R.drawable.m_kilo_3, R.drawable.b_kilo_3, R.drawable.h_kilo_3),
46
  KILO_5 ( new int[] {5,5,5,5,5,5}, 33, R.drawable.s_kilo_5, R.drawable.m_kilo_5, R.drawable.b_kilo_5, R.drawable.h_kilo_5),
47
  MEGA_3 ( new int[] {3,3,3,3,3,3}, 21, R.drawable.s_mega_3, R.drawable.m_mega_3, R.drawable.b_mega_3, R.drawable.h_mega_3),
48
  MEGA_5 ( new int[] {5,5,5,5,5,5}, 37, R.drawable.s_mega_5, R.drawable.m_mega_5, R.drawable.b_mega_5, R.drawable.h_mega_5),
49
  ULTI_2 ( new int[] {2,2,2,2}    , 18, R.drawable.s_ulti_2, R.drawable.m_ulti_2, R.drawable.b_ulti_2, R.drawable.h_ulti_2),
50
  DIAM_2 ( new int[] {2,2,2,2}    , 12, R.drawable.s_diam_2, R.drawable.m_diam_2, R.drawable.b_diam_2, R.drawable.h_diam_2),
51
  DIAM_3 ( new int[] {3,3,3,3}    , 24, R.drawable.s_diam_3, R.drawable.m_diam_3, R.drawable.b_diam_3, R.drawable.h_diam_3),
52
  DIAM_4 ( new int[] {4,4,4,4}    , 32, R.drawable.s_diam_4, R.drawable.m_diam_4, R.drawable.b_diam_4, R.drawable.h_diam_4),
53
  DINO_3 ( new int[] {3,3,3,3}    , 10, R.drawable.s_dino_3, R.drawable.m_dino_3, R.drawable.b_dino_3, R.drawable.h_dino_3),
54
  DIN4_3 ( new int[] {3,3,3,3}    ,  7, R.drawable.s_din4_3, R.drawable.m_din4_3, R.drawable.b_din4_3, R.drawable.h_din4_3),
55
  REDI_3 ( new int[] {3,3,3,3}    , 16, R.drawable.s_redi_3, R.drawable.m_redi_3, R.drawable.b_redi_3, R.drawable.h_redi_3),
56
  HELI_3 ( new int[] {3,3,3,3,3,3}, 20, R.drawable.s_heli_3, R.drawable.m_heli_3, R.drawable.b_heli_3, R.drawable.h_heli_3),
57
  SKEW_2 ( new int[] {2,2,2,2}    , 11, R.drawable.s_skew_2, R.drawable.m_skew_2, R.drawable.b_skew_2, R.drawable.h_skew_2),
58
  SKEW_3 ( new int[] {3,3,3,3}    , 21, R.drawable.s_skew_3, R.drawable.m_skew_3, R.drawable.b_skew_3, R.drawable.h_skew_3),
59
  IVY_2  ( new int[] {2,2,2,2}    ,  8, R.drawable.s_ivy_2 , R.drawable.m_ivy_2 , R.drawable.b_ivy_2 , R.drawable.h_ivy_2 ),
60
  REX_3  ( new int[] {3,3,3,3}    , 19, R.drawable.s_rex_3 , R.drawable.m_rex_3 , R.drawable.b_rex_3 , R.drawable.h_rex_3 ),
61
  BAN1_3 ( new int[] {3,3,3}      , 16, R.drawable.s_ban1_3, R.drawable.m_ban1_3, R.drawable.b_ban1_3, R.drawable.h_ban1_3),
62
  BAN2_3 ( new int[] {3,3,3}      , 16, R.drawable.s_ban2_3, R.drawable.m_ban2_3, R.drawable.b_ban2_3, R.drawable.h_ban2_3),
63
  BAN3_3 ( new int[] {3,3,3}      , 16, R.drawable.s_ban3_3, R.drawable.m_ban3_3, R.drawable.b_ban3_3, R.drawable.h_ban3_3),
64
  BAN4_3 ( new int[] {3,3,3}      , 16, R.drawable.s_ban4_3, R.drawable.m_ban4_3, R.drawable.b_ban4_3, R.drawable.h_ban4_3),
65
  SQU1_3 ( new int[] {3,2,3}      , 24, R.drawable.s_squ1_3, R.drawable.m_squ1_3, R.drawable.b_squ1_3, R.drawable.h_squ1_3),
66
  SQU2_3 ( new int[] {3,2,3}      , 24, R.drawable.s_squ2_3, R.drawable.m_squ2_3, R.drawable.b_squ2_3, R.drawable.h_squ2_3),
67
  MIRR_2 ( new int[] {2,2,2}      , 12, R.drawable.s_mirr_2, R.drawable.m_mirr_2, R.drawable.b_mirr_2, R.drawable.h_mirr_2),
68
  MIRR_3 ( new int[] {3,3,3}      , 17, R.drawable.s_mirr_3, R.drawable.m_mirr_3, R.drawable.b_mirr_3, R.drawable.h_mirr_3),
69 69
  ;
70 70

  
71 71
  public static final int NUM_OBJECTS = values().length;
72 72
  public static final int MAX_SCRAMBLE,MAX_OBJECT_SIZE;
73 73

  
74
  private final int mSize, mNumScrambles;
74
  private final int[] mNumLayers;
75
  private final int mNumScrambles;
75 76
  private final int mSmallIcon, mMediumIcon, mBigIcon, mHugeIcon;
76 77

  
77 78
  private static final ObjectType[] objects;
......
88 89
      objects[i++] = object;
89 90

  
90 91
      if( object.mNumScrambles> maxScramble ) maxScramble= object.mNumScrambles;
91
      if( object.mSize        > maxSize     ) maxSize    = object.mSize;
92

  
93
      int len = object.mNumLayers.length;
94

  
95
      for(int j=0; j<len; j++)
96
        if( object.mNumLayers[j]>maxSize ) maxSize = object.mNumLayers[j];
92 97
      }
93 98

  
94 99
    MAX_SCRAMBLE    = maxScramble;
......
123 128

  
124 129
///////////////////////////////////////////////////////////////////////////////////////////////////
125 130

  
126
  ObjectType(int size, int scrambles, int sIcon, int mIcon, int bIcon, int hIcon)
131
  ObjectType(int[] numLayers, int scrambles, int sIcon, int mIcon, int bIcon, int hIcon)
127 132
    {
128
    mSize        = size;
133
    mNumLayers   = numLayers;
129 134
    mNumScrambles= scrambles;
130 135
    mSmallIcon   = sIcon;
131 136
    mMediumIcon  = mIcon;
......
157 162
    MeshSquare mesh          = new MeshSquare(20,20);   // mesh of the node, not of the cubits
158 163

  
159 164
    int ord = ordinal();
160
    int size= objects[ord].mSize;
165
    int[] numL= objects[ord].mNumLayers;
161 166

  
162 167
    switch(ord)
163 168
      {
164 169
      case  0:
165 170
      case  1:
166 171
      case  2:
167
      case  3: return new TwistyCube          (size, quat, move, texture, mesh, effects, res, scrWidth);
168
      case  4: return new TwistyJing          (size, quat, move, texture, mesh, effects, res, scrWidth);
172
      case  3: return new TwistyCube          (numL, quat, move, texture, mesh, effects, res, scrWidth);
173
      case  4: return new TwistyJing          (numL, quat, move, texture, mesh, effects, res, scrWidth);
169 174
      case  5:
170 175
      case  6:
171
      case  7: return new TwistyPyraminx      (size, quat, move, texture, mesh, effects, res, scrWidth);
176
      case  7: return new TwistyPyraminx      (numL, quat, move, texture, mesh, effects, res, scrWidth);
172 177
      case  8:
173
      case  9: return new TwistyKilominx      (size, quat, move, texture, mesh, effects, res, scrWidth);
178
      case  9: return new TwistyKilominx      (numL, quat, move, texture, mesh, effects, res, scrWidth);
174 179
      case 10:
175
      case 11: return new TwistyMegaminx      (size, quat, move, texture, mesh, effects, res, scrWidth);
176
      case 12: return new TwistyUltimate      (size, quat, move, texture, mesh, effects, res, scrWidth);
180
      case 11: return new TwistyMegaminx      (numL, quat, move, texture, mesh, effects, res, scrWidth);
181
      case 12: return new TwistyUltimate      (numL, quat, move, texture, mesh, effects, res, scrWidth);
177 182
      case 13:
178 183
      case 14:
179
      case 15: return new TwistyDiamond       (size, quat, move, texture, mesh, effects, res, scrWidth);
180
      case 16: return new TwistyDino6         (size, quat, move, texture, mesh, effects, res, scrWidth);
181
      case 17: return new TwistyDino4         (size, quat, move, texture, mesh, effects, res, scrWidth);
182
      case 18: return new TwistyRedi          (size, quat, move, texture, mesh, effects, res, scrWidth);
183
      case 19: return new TwistyHelicopter    (size, quat, move, texture, mesh, effects, res, scrWidth);
184
      case 15: return new TwistyDiamond       (numL, quat, move, texture, mesh, effects, res, scrWidth);
185
      case 16: return new TwistyDino6         (numL, quat, move, texture, mesh, effects, res, scrWidth);
186
      case 17: return new TwistyDino4         (numL, quat, move, texture, mesh, effects, res, scrWidth);
187
      case 18: return new TwistyRedi          (numL, quat, move, texture, mesh, effects, res, scrWidth);
188
      case 19: return new TwistyHelicopter    (numL, quat, move, texture, mesh, effects, res, scrWidth);
184 189
      case 20:
185
      case 21: return new TwistySkewb         (size, quat, move, texture, mesh, effects, res, scrWidth);
186
      case 22: return new TwistyIvy           (size, quat, move, texture, mesh, effects, res, scrWidth);
187
      case 23: return new TwistyRex           (size, quat, move, texture, mesh, effects, res, scrWidth);
188
      case 24: return new TwistyBandagedFused (size, quat, move, texture, mesh, effects, res, scrWidth);
189
      case 25: return new TwistyBandaged2Bar  (size, quat, move, texture, mesh, effects, res, scrWidth);
190
      case 26: return new TwistyBandaged3Plate(size, quat, move, texture, mesh, effects, res, scrWidth);
191
      case 27: return new TwistyBandagedEvil  (size, quat, move, texture, mesh, effects, res, scrWidth);
192
      case 28: return new TwistySquare1       (size, quat, move, texture, mesh, effects, res, scrWidth);
193
      case 29: return new TwistySquare2       (size, quat, move, texture, mesh, effects, res, scrWidth);
190
      case 21: return new TwistySkewb         (numL, quat, move, texture, mesh, effects, res, scrWidth);
191
      case 22: return new TwistyIvy           (numL, quat, move, texture, mesh, effects, res, scrWidth);
192
      case 23: return new TwistyRex           (numL, quat, move, texture, mesh, effects, res, scrWidth);
193
      case 24: return new TwistyBandagedFused (numL, quat, move, texture, mesh, effects, res, scrWidth);
194
      case 25: return new TwistyBandaged2Bar  (numL, quat, move, texture, mesh, effects, res, scrWidth);
195
      case 26: return new TwistyBandaged3Plate(numL, quat, move, texture, mesh, effects, res, scrWidth);
196
      case 27: return new TwistyBandagedEvil  (numL, quat, move, texture, mesh, effects, res, scrWidth);
197
      case 28: return new TwistySquare1       (numL, quat, move, texture, mesh, effects, res, scrWidth);
198
      case 29: return new TwistySquare2       (numL, quat, move, texture, mesh, effects, res, scrWidth);
194 199
      case 30:
195
      case 31: return new TwistyMirror        (size, quat, move, texture, mesh, effects, res, scrWidth);
200
      case 31: return new TwistyMirror        (numL, quat, move, texture, mesh, effects, res, scrWidth);
196 201
      }
197 202

  
198 203
    return null;
src/main/java/org/distorted/objectlib/main/Twisty12.java
53 53

  
54 54
///////////////////////////////////////////////////////////////////////////////////////////////////
55 55

  
56
  public Twisty12(int numLayers, int realSize, Static4D quat, Static3D move, DistortedTexture texture,
56
  public Twisty12(int[] numLayers, int realSize, Static4D quat, Static3D move, DistortedTexture texture,
57 57
                  MeshSquare mesh, DistortedEffects effects, Resources res, int scrWidth)
58 58
    {
59 59
    super(numLayers, realSize, quat, move, texture, mesh, effects, res, scrWidth);
......
93 93
    {
94 94
    return 0.35f;
95 95
    }
96

  
97
///////////////////////////////////////////////////////////////////////////////////////////////////
98

  
99
  protected float returnMultiplier()
100
    {
101
    return 1.0f;
102
    }
103 96
}
src/main/java/org/distorted/objectlib/main/Twisty4.java
39 39

  
40 40
///////////////////////////////////////////////////////////////////////////////////////////////////
41 41

  
42
  public Twisty4(int numLayers, int realSize, Static4D quat, Static3D move, DistortedTexture texture,
42
  public Twisty4(int[] numLayers, int realSize, Static4D quat, Static3D move, DistortedTexture texture,
43 43
                 MeshSquare mesh, DistortedEffects effects, Resources res, int scrWidth)
44 44
    {
45 45
    super(numLayers, realSize, quat, move, texture, mesh, effects, res, scrWidth);
......
79 79
    {
80 80
    return 0.88f;
81 81
    }
82

  
83
///////////////////////////////////////////////////////////////////////////////////////////////////
84

  
85
  protected float returnMultiplier()
86
    {
87
    return getNumLayers()/(SQ6/3);
88
    }
89 82
}
src/main/java/org/distorted/objectlib/main/Twisty6.java
40 40

  
41 41
///////////////////////////////////////////////////////////////////////////////////////////////////
42 42

  
43
  public Twisty6(int numLayers, int realSize, Static4D quat, Static3D move, DistortedTexture texture,
43
  public Twisty6(int[] numLayers, int realSize, Static4D quat, Static3D move, DistortedTexture texture,
44 44
                 MeshSquare mesh, DistortedEffects effects, Resources res, int scrWidth)
45 45
    {
46 46
    super(numLayers, realSize, quat, move, texture, mesh, effects, res, scrWidth);
......
80 80
    {
81 81
    return 0.5f;
82 82
    }
83

  
84
///////////////////////////////////////////////////////////////////////////////////////////////////
85

  
86
  protected float returnMultiplier()
87
    {
88
    return getNumLayers();
89
    }
90 83
}
src/main/java/org/distorted/objectlib/main/Twisty8.java
41 41

  
42 42
///////////////////////////////////////////////////////////////////////////////////////////////////
43 43

  
44
  public Twisty8(int numLayers, int realSize, Static4D quat, Static3D move, DistortedTexture texture,
44
  public Twisty8(int[] numLayers, int realSize, Static4D quat, Static3D move, DistortedTexture texture,
45 45
                 MeshSquare mesh, DistortedEffects effects, Resources res, int scrWidth)
46 46
    {
47 47
    super(numLayers, realSize, quat, move, texture, mesh, effects, res, scrWidth);
......
81 81
    {
82 82
    return 0.65f;
83 83
    }
84

  
85
///////////////////////////////////////////////////////////////////////////////////////////////////
86

  
87
  protected float returnMultiplier()
88
    {
89
    return 1.5f;
90
    }
91 84
}
src/main/java/org/distorted/objectlib/main/TwistyObject.java
47 47
import org.distorted.library.type.Static1D;
48 48
import org.distorted.library.type.Static3D;
49 49
import org.distorted.library.type.Static4D;
50

  
50 51
import org.distorted.objectlib.BuildConfig;
51 52
import org.distorted.objectlib.helpers.FactoryCubit;
52 53
import org.distorted.objectlib.helpers.FactorySticker;
......
106 107
  private final float[][] mOrigPos;
107 108
  private final Static3D mNodeScale;
108 109
  private final Static4D mQuat;
109
  private final int mNumLayers, mRealSize;
110
  private final int[] mNumLayers;
111
  private final int mRealSize;
110 112
  private final DistortedEffects mEffects;
111 113
  private final VertexEffectRotate mRotateEffect;
112 114
  private final Dynamic1D mRotationAngle;
......
137 139

  
138 140
///////////////////////////////////////////////////////////////////////////////////////////////////
139 141

  
140
  TwistyObject(int numLayers, int realSize, Static4D quat, Static3D move, DistortedTexture nodeTexture,
142
  TwistyObject(int[] numLayers, int realSize, Static4D quat, Static3D move, DistortedTexture nodeTexture,
141 143
               MeshSquare nodeMesh, DistortedEffects nodeEffects, Resources res, int screenWidth)
142 144
    {
143 145
    super(nodeTexture,nodeEffects,nodeMesh);
......
320 322

  
321 323
///////////////////////////////////////////////////////////////////////////////////////////////////
322 324

  
323
  private MeshBase createCubitMesh(int cubit, int numLayers)
325
  private MeshBase createCubitMesh(int cubit, int[] numLayers)
324 326
    {
325 327
    int variant = getCubitVariant(cubit,numLayers);
326 328

  
......
348 350

  
349 351
///////////////////////////////////////////////////////////////////////////////////////////////////
350 352

  
351
  private void createDataStructuresForSolved(int numLayers)
353
  private void createDataStructuresForSolved(int[] numLayers)
352 354
    {
353 355
    mTmpQuats = new int[NUM_QUATS];
354 356
    mSolvedQuats = new int[NUM_CUBITS][];
......
387 389
// Color index, i.e. the index into the 'FACE_COLORS' table.
388 390
// else (edge or corner cubit, more than one non-black face): return -2.
389 391

  
390
  protected int retCubitSolvedStatus(int cubit, int numLayers)
392
  protected int retCubitSolvedStatus(int cubit, int[] numLayers)
391 393
    {
392 394
    int numNonBlack=0, nonBlackIndex=-1, color;
393 395

  
......
987 989
      android.util.Log.e("object", "invalid rotation axis: "+axis);
988 990
      return;
989 991
      }
990
    if( row<0 || row>=mNumLayers )
992
    if( row<0 || row>=mNumLayers[axis] )
991 993
      {
992 994
      android.util.Log.e("object", "invalid rotation row: "+row);
993 995
      return;
......
1186 1188
    }
1187 1189

  
1188 1190
///////////////////////////////////////////////////////////////////////////////////////////////////
1191
// only called with figuring out which cubit was touched in MODE_REPLACE, which is only used in
1192
// during setting up the initial position in the solver.
1189 1193

  
1190 1194
  int getCubit(float[] point3D)
1191 1195
    {
1192 1196
    float dist, minDist = Float.MAX_VALUE;
1193 1197
    int currentBest=-1;
1194
    float multiplier = returnMultiplier();
1198
    float multiplier = mNumLayers[0];
1195 1199

  
1196 1200
    point3D[0] *= multiplier;
1197 1201
    point3D[1] *= multiplier;
......
1300 1304

  
1301 1305
///////////////////////////////////////////////////////////////////////////////////////////////////
1302 1306

  
1303
  public int getNumLayers()
1307
  public int[] getNumLayers()
1304 1308
    {
1305 1309
    return mNumLayers;
1306 1310
    }
......
1326 1330
///////////////////////////////////////////////////////////////////////////////////////////////////
1327 1331

  
1328 1332
  protected abstract int getFOV();
1329
  protected abstract float returnMultiplier();
1330 1333
  protected abstract float getScreenRatio();
1331 1334
  protected abstract int getNumFaceColors();
1332 1335
  protected abstract int getColor(int face);
1333
  protected abstract float[][] getCuts(int numLayers);
1336
  protected abstract float[][] getCuts(int[] numLayers);
1334 1337
  protected abstract int getNumCubitFaces();
1335 1338
  protected abstract Static4D[] getQuats();
1336
  protected abstract float[][] getCubitPositions(int numLayers);
1337
  protected abstract int getCubitVariant(int cubit, int numLayers);
1338
  protected abstract int getNumCubitVariants(int numLayers);
1339
  protected abstract Static4D getQuat(int cubit, int numLayers);
1340
  protected abstract ObjectShape getObjectShape(int cubit, int numLayers);
1341
  protected abstract int[] getSolvedQuats(int cubit, int numLayers);
1339
  protected abstract float[][] getCubitPositions(int[] numLayers);
1340
  protected abstract int getCubitVariant(int cubit, int[] numLayers);
1341
  protected abstract int getNumCubitVariants(int[] numLayers);
1342
  protected abstract Static4D getQuat(int cubit, int[] numLayers);
1343
  protected abstract ObjectShape getObjectShape(int cubit, int[] numLayers);
1344
  protected abstract int[] getSolvedQuats(int cubit, int[] numLayers);
1342 1345
  protected abstract int getSolvedFunctionIndex();
1343 1346
  protected abstract ScrambleState[] getScrambleStates();
1344
  protected abstract int getNumStickerTypes(int numLayers);
1347
  protected abstract int getNumStickerTypes(int[] numLayers);
1345 1348
  protected abstract ObjectSticker retSticker(int face);
1346
  protected abstract int getFaceColor(int cubit, int cubitface, int numLayers);
1347
  protected abstract int getResource(int mNumLayers);
1348
  protected abstract ObjectType intGetObjectType(int numLayers);
1349
  protected abstract int getFaceColor(int cubit, int cubitface, int[] numLayers);
1350
  protected abstract int getResource(int[] numLayers);
1351
  protected abstract ObjectType intGetObjectType(int[] numLayers);
1349 1352
  protected abstract Movement getMovement();
1350 1353

  
1351 1354
  public abstract Static3D[] getRotationAxis();
1352 1355
  public abstract int[] getBasicAngle();
1353 1356
  public abstract int getNumFaces();
1354
  public abstract int getObjectName(int numLayers);
1355
  public abstract int getInventor(int numLayers);
1356
  public abstract int getComplexity(int numLayers);
1357
  public abstract int getObjectName(int[] numLayers);
1358
  public abstract int getInventor(int[] numLayers);
1359
  public abstract int getComplexity(int[] numLayers);
1357 1360
  }
src/main/java/org/distorted/objectlib/main/TwistyObjectScrambler.java
30 30
  private final ScrambleState[] mStates;
31 31
  private final int mType;
32 32
  private final int mNumAxis;
33
  private final int mNumLayers;
33
  private final int[] mNumLayers;
34 34

  
35 35
  // type=0, i.e. main
36 36
  private int mCurrState;
......
54 54

  
55 55
///////////////////////////////////////////////////////////////////////////////////////////////////
56 56

  
57
  TwistyObjectScrambler(int type, int numAxis, int numLayers, ScrambleState[] states)
57
  TwistyObjectScrambler(int type, int numAxis, int[] numLayers, ScrambleState[] states)
58 58
    {
59 59
    mType = type;
60 60
    mNumAxis = numAxis;
......
109 109
    {
110 110
    if( mScrambleTable ==null )
111 111
      {
112
      mScrambleTable = new int[mNumAxis][mNumLayers];
112
      mScrambleTable = new int[mNumAxis][];
113 113
      }
114 114
    if( mNumOccurences ==null )
115 115
      {
......
125 125
      }
126 126

  
127 127
    for(int i=0; i<mNumAxis; i++)
128
      for(int j=0; j<mNumLayers; j++) mScrambleTable[i][j] = 0;
128
      {
129
      int len = mNumLayers[i];
130
      mScrambleTable[i] = new int[len];
131
      for(int j=0; j<len; j++) mScrambleTable[i][j] = 0;
132
      }
129 133
    }
130 134

  
131 135
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/objectlib/objects/TwistyBandaged2Bar.java
35 35

  
36 36
public class TwistyBandaged2Bar extends TwistyBandagedAbstract
37 37
{
38
  public TwistyBandaged2Bar(int size, Static4D quat, Static3D move, DistortedTexture texture,
38
  public TwistyBandaged2Bar(int[] numL, Static4D quat, Static3D move, DistortedTexture texture,
39 39
                            MeshSquare mesh, DistortedEffects effects, Resources res, int scrWidth)
40 40
    {
41
    super(size, quat, move, texture, mesh, effects, res, scrWidth);
41
    super(numL, quat, move, texture, mesh, effects, res, scrWidth);
42 42
    }
43 43

  
44 44
///////////////////////////////////////////////////////////////////////////////////////////////////
......
60 60

  
61 61
///////////////////////////////////////////////////////////////////////////////////////////////////
62 62

  
63
  protected int getResource(int numLayers)
63
  protected int getResource(int[] numLayers)
64 64
    {
65 65
    return R.raw.ban2;
66 66
    }
......
116 116
///////////////////////////////////////////////////////////////////////////////////////////////////
117 117
// PUBLIC API
118 118

  
119
  public ObjectType intGetObjectType(int numLayers)
119
  public ObjectType intGetObjectType(int[] numLayers)
120 120
    {
121 121
    return ObjectType.BAN2_3;
122 122
    }
123 123

  
124 124
///////////////////////////////////////////////////////////////////////////////////////////////////
125 125

  
126
  public int getObjectName(int numLayers)
126
  public int getObjectName(int[] numLayers)
127 127
    {
128 128
    return R.string.bandaged_2bar;
129 129
    }
130 130

  
131 131
///////////////////////////////////////////////////////////////////////////////////////////////////
132 132

  
133
  public int getInventor(int numLayers)
133
  public int getInventor(int[] numLayers)
134 134
    {
135 135
    return R.string.bandaged_2bar_inventor;
136 136
    }
137 137

  
138 138
///////////////////////////////////////////////////////////////////////////////////////////////////
139 139

  
140
  public int getComplexity(int numLayers)
140
  public int getComplexity(int[] numLayers)
141 141
    {
142 142
    return 8;
143 143
    }
src/main/java/org/distorted/objectlib/objects/TwistyBandaged3Plate.java
35 35

  
36 36
public class TwistyBandaged3Plate extends TwistyBandagedAbstract
37 37
{
38
  public TwistyBandaged3Plate(int size, Static4D quat, Static3D move, DistortedTexture texture,
38
  public TwistyBandaged3Plate(int[] numL, Static4D quat, Static3D move, DistortedTexture texture,
39 39
                              MeshSquare mesh, DistortedEffects effects, Resources res, int scrWidth)
40 40
    {
41
    super(size, quat, move, texture, mesh, effects, res, scrWidth);
41
    super(numL, quat, move, texture, mesh, effects, res, scrWidth);
42 42
    }
43 43

  
44 44
///////////////////////////////////////////////////////////////////////////////////////////////////
......
73 73

  
74 74
///////////////////////////////////////////////////////////////////////////////////////////////////
75 75

  
76
  protected int getResource(int numLayers)
76
  protected int getResource(int[] numLayers)
77 77
    {
78 78
    return R.raw.ban3;
79 79
    }
......
123 123
///////////////////////////////////////////////////////////////////////////////////////////////////
124 124
// PUBLIC API
125 125

  
126
  public ObjectType intGetObjectType(int numLayers)
126
  public ObjectType intGetObjectType(int[] numLayers)
127 127
    {
128 128
    return ObjectType.BAN3_3;
129 129
    }
130 130

  
131 131
///////////////////////////////////////////////////////////////////////////////////////////////////
132 132

  
133
  public int getObjectName(int numLayers)
133
  public int getObjectName(int[] numLayers)
134 134
    {
135 135
    return R.string.bandaged_3plate;
136 136
    }
137 137

  
138 138
///////////////////////////////////////////////////////////////////////////////////////////////////
139 139

  
140
  public int getInventor(int numLayers)
140
  public int getInventor(int[] numLayers)
141 141
    {
142 142
    return R.string.bandaged_3plate_inventor;
143 143
    }
144 144

  
145 145
///////////////////////////////////////////////////////////////////////////////////////////////////
146 146

  
147
  public int getComplexity(int numLayers)
147
  public int getComplexity(int[] numLayers)
148 148
    {
149 149
    return 8;
150 150
    }
src/main/java/org/distorted/objectlib/objects/TwistyBandagedAbstract.java
80 80

  
81 81
///////////////////////////////////////////////////////////////////////////////////////////////////
82 82

  
83
  TwistyBandagedAbstract(int size, Static4D quat, Static3D move, DistortedTexture texture,
83
  TwistyBandagedAbstract(int[] numL, Static4D quat, Static3D move, DistortedTexture texture,
84 84
                         MeshSquare mesh, DistortedEffects effects, Resources res, int scrWidth)
85 85
    {
86
    super(size, size, quat, move, texture, mesh, effects, res, scrWidth);
86
    super(numL, numL[0], quat, move, texture, mesh, effects, res, scrWidth);
87 87
    }
88 88

  
89 89
///////////////////////////////////////////////////////////////////////////////////////////////////
......
128 128

  
129 129
///////////////////////////////////////////////////////////////////////////////////////////////////
130 130

  
131
  protected int[] getSolvedQuats(int cubit, int numLayers)
131
  protected int[] getSolvedQuats(int cubit, int[] numLayers)
132 132
    {
133 133
    if( mQuats==null ) initializeQuats();
134 134
    int status = retCubitSolvedStatus(cubit,numLayers);
......
161 161

  
162 162
///////////////////////////////////////////////////////////////////////////////////////////////////
163 163

  
164
  protected ObjectShape getObjectShape(int cubit, int numLayers)
164
  protected ObjectShape getObjectShape(int cubit, int[] numLayers)
165 165
    {
166 166
    int variant = getCubitVariant(cubit,numLayers);
167 167

  
......
225 225

  
226 226
///////////////////////////////////////////////////////////////////////////////////////////////////
227 227

  
228
  protected Static4D getQuat(int cubit, int numLayers)
228
  protected Static4D getQuat(int cubit, int[] numLayers)
229 229
    {
230 230
    if( mInitQuats ==null )
231 231
      {
......
245 245

  
246 246
///////////////////////////////////////////////////////////////////////////////////////////////////
247 247

  
248
  protected int getNumCubitVariants(int numLayers)
248
  protected int getNumCubitVariants(int[] numLayers)
249 249
    {
250 250
    return mDimensions.length;
251 251
    }
252 252

  
253 253
///////////////////////////////////////////////////////////////////////////////////////////////////
254 254

  
255
  protected int getCubitVariant(int cubit, int numLayers)
255
  protected int getCubitVariant(int cubit, int[] numLayers)
256 256
    {
257 257
    float[][] pos = getPositions();
258 258

  
......
308 308

  
309 309
///////////////////////////////////////////////////////////////////////////////////////////////////
310 310

  
311
  protected float[][] getCubitPositions(int size)
311
  protected float[][] getCubitPositions(int[] numLayers)
312 312
    {
313 313
    int numCubits = getNumCubits();
314 314
    float[][] tmp = new float[numCubits][];
......
331 331

  
332 332
///////////////////////////////////////////////////////////////////////////////////////////////////
333 333

  
334
  protected float[][] getCuts(int numLayers)
334
  protected float[][] getCuts(int[] numLayers)
335 335
    {
336
    if( numLayers<2 ) return null;
336
    int numL = numLayers[0];
337

  
338
    if( numL<2 ) return null;
337 339

  
338 340
    if( mCuts==null )
339 341
      {
340
      mCuts = new float[3][numLayers-1];
342
      mCuts = new float[3][numL-1];
341 343

  
342
      for(int i=0; i<numLayers-1; i++)
344
      for(int i=0; i<numL-1; i++)
343 345
        {
344
        float cut = (2-numLayers)*0.5f + i;
346
        float cut = (2-numL)*0.5f + i;
345 347
        mCuts[0][i] = cut;
346 348
        mCuts[1][i] = cut;
347 349
        mCuts[2][i] = cut;
......
353 355

  
354 356
///////////////////////////////////////////////////////////////////////////////////////////////////
355 357

  
356
  private void getLayerRotatable(int numLayers)
358
  private void getLayerRotatable(int[] numLayers)
357 359
    {
358 360
    if( mLayerRotatable==null )
359 361
      {
360 362
      int numAxis = ROT_AXIS.length;
361
      boolean[] tmp = new boolean[numLayers];
362
      for(int i=0; i<numLayers; i++) tmp[i] = true;
363 363
      mLayerRotatable = new boolean[numAxis][];
364
      for(int i=0; i<numAxis; i++) mLayerRotatable[i] = tmp;
364

  
365
      for(int i=0; i<numAxis; i++)
366
        {
367
        mLayerRotatable[i] = new boolean[numLayers[i]];
368
        for(int j=0; j<numLayers[i]; j++) mLayerRotatable[i][j] = true;
369
        }
365 370
      }
366 371
    }
367 372

  
......
374 379

  
375 380
///////////////////////////////////////////////////////////////////////////////////////////////////
376 381

  
377
  protected int getNumStickerTypes(int numLayers)
382
  protected int getNumStickerTypes(int[] numLayers)
378 383
    {
379 384
    return NUM_STICKERS;
380 385
    }
......
416 421

  
417 422
///////////////////////////////////////////////////////////////////////////////////////////////////
418 423

  
419
  protected int getFaceColor(int cubit, int cubitface, int numLayers)
424
  protected int getFaceColor(int cubit, int cubitface, int[] numLayers)
420 425
    {
421 426
    if( mFaceMap==null )
422 427
      {
......
453 458
    for(int i=0; i<len; i++) position += pos[3*i+posIndex];
454 459
    position /= len;
455 460

  
456
    boolean reaches  = multiplier*position + dim[dimIndex]*0.5f > (numLayers-1)*0.5f;
461
    boolean reaches  = multiplier*position + dim[dimIndex]*0.5f > (numLayers[0]-1)*0.5f;
457 462

  
458 463
    return reaches ? stickerIndex*NUM_FACE_COLORS + face : NUM_TEXTURES;
459 464
    }
......
472 477
    {
473 478
    if( mMovement==null )
474 479
      {
475
      int numLayers = getNumLayers();
480
      int[] numLayers = getNumLayers();
476 481
      if( mCuts==null ) getCuts(numLayers);
477 482
      getLayerRotatable(numLayers);
478
      mMovement = new Movement6(ROT_AXIS,mCuts,mLayerRotatable,numLayers,TYPE_NOT_SPLIT,ENABLED);
483
      mMovement = new Movement6(ROT_AXIS,mCuts,mLayerRotatable,numLayers[0],TYPE_NOT_SPLIT,ENABLED);
479 484
      }
480 485
    return mMovement;
481 486
    }
src/main/java/org/distorted/objectlib/objects/TwistyBandagedEvil.java
35 35

  
36 36
public class TwistyBandagedEvil extends TwistyBandagedAbstract
37 37
{
38
  public TwistyBandagedEvil(int size, Static4D quat, Static3D move, DistortedTexture texture, MeshSquare mesh,
38
  public TwistyBandagedEvil(int[] numL, Static4D quat, Static3D move, DistortedTexture texture, MeshSquare mesh,
39 39
                            DistortedEffects effects, Resources res, int scrWidth)
40 40
    {
41
    super(size, quat, move, texture, mesh, effects, res, scrWidth);
41
    super(numL, quat, move, texture, mesh, effects, res, scrWidth);
42 42
    }
43 43

  
44 44
///////////////////////////////////////////////////////////////////////////////////////////////////
......
201 201

  
202 202
///////////////////////////////////////////////////////////////////////////////////////////////////
203 203

  
204
  protected int getResource(int numLayers)
204
  protected int getResource(int[] numLayers)
205 205
    {
206 206
    return R.raw.ban4;
207 207
    }
......
247 247
///////////////////////////////////////////////////////////////////////////////////////////////////
248 248
// PUBLIC API
249 249

  
250
  public ObjectType intGetObjectType(int numLayers)
250
  public ObjectType intGetObjectType(int[] numLayers)
251 251
    {
252 252
    return ObjectType.BAN4_3;
253 253
    }
254 254

  
255 255
///////////////////////////////////////////////////////////////////////////////////////////////////
256 256

  
257
  public int getObjectName(int numLayers)
257
  public int getObjectName(int[] numLayers)
258 258
    {
259 259
    return R.string.bandaged_evil;
260 260
    }
261 261

  
262 262
///////////////////////////////////////////////////////////////////////////////////////////////////
263 263

  
264
  public int getInventor(int numLayers)
264
  public int getInventor(int[] numLayers)
265 265
    {
266 266
    return R.string.bandaged_evil_inventor;
267 267
    }
268 268

  
269 269
///////////////////////////////////////////////////////////////////////////////////////////////////
270 270

  
271
  public int getComplexity(int numLayers)
271
  public int getComplexity(int[] numLayers)
272 272
    {
273 273
    return 8;
274 274
    }
src/main/java/org/distorted/objectlib/objects/TwistyBandagedFused.java
35 35

  
36 36
public class TwistyBandagedFused extends TwistyBandagedAbstract
37 37
{
38
  public TwistyBandagedFused(int size, Static4D quat, Static3D move, DistortedTexture texture,
38
  public TwistyBandagedFused(int[] numL, Static4D quat, Static3D move, DistortedTexture texture,
39 39
                             MeshSquare mesh, DistortedEffects effects, Resources res, int scrWidth)
40 40
    {
41
    super(size, quat, move, texture, mesh, effects, res, scrWidth);
41
    super(numL, quat, move, texture, mesh, effects, res, scrWidth);
42 42
    }
43 43

  
44 44
///////////////////////////////////////////////////////////////////////////////////////////////////
......
60 60

  
61 61
///////////////////////////////////////////////////////////////////////////////////////////////////
62 62

  
63
  protected int getResource(int numLayers)
63
  protected int getResource(int[] numLayers)
64 64
    {
65 65
    return R.raw.ban1;
66 66
    }
......
116 116
///////////////////////////////////////////////////////////////////////////////////////////////////
117 117
// PUBLIC APi
118 118

  
119
  public ObjectType intGetObjectType(int numLayers)
119
  public ObjectType intGetObjectType(int[] numLayers)
120 120
    {
121 121
    return ObjectType.BAN1_3;
122 122
    }
123 123

  
124 124
///////////////////////////////////////////////////////////////////////////////////////////////////
125 125

  
126
  public int getObjectName(int numLayers)
126
  public int getObjectName(int[] numLayers)
127 127
    {
128 128
    return R.string.bandaged_fused;
129 129
    }
130 130

  
131 131
///////////////////////////////////////////////////////////////////////////////////////////////////
132 132

  
133
  public int getInventor(int numLayers)
133
  public int getInventor(int[] numLayers)
134 134
    {
135 135
    return R.string.bandaged_fused_inventor;
136 136
    }
137 137

  
138 138
///////////////////////////////////////////////////////////////////////////////////////////////////
139 139

  
140
  public int getComplexity(int numLayers)
140
  public int getComplexity(int[] numLayers)
141 141
    {
142 142
    return 8;
143 143
    }
src/main/java/org/distorted/objectlib/objects/TwistyCube.java
65 65

  
66 66
///////////////////////////////////////////////////////////////////////////////////////////////////
67 67

  
68
  public TwistyCube(int size, Static4D quat, Static3D move, DistortedTexture texture,
68
  public TwistyCube(int[] numL, Static4D quat, Static3D move, DistortedTexture texture,
69 69
                    MeshSquare mesh, DistortedEffects effects, Resources res, int scrWidth)
70 70
    {
71
    super(size, size, quat, move, texture, mesh, effects, res, scrWidth);
71
    super(numL, numL[0], quat, move, texture, mesh, effects, res, scrWidth);
72 72
    }
73 73

  
74 74
///////////////////////////////////////////////////////////////////////////////////////////////////
......
77 77
    {
78 78
    if( mStates==null )
79 79
      {
80
      int size = getNumLayers();
80
      int[] numL = getNumLayers();
81 81
      int[][] m = new int[16][];
82
      for(int i=1; i<16; i++) m[i] = createEdges(size,i);
82
      for(int i=1; i<16; i++) m[i] = createEdges(numL[0],i);
83 83

  
84 84
      mStates = new ScrambleState[]
85 85
        {
......
107 107

  
108 108
///////////////////////////////////////////////////////////////////////////////////////////////////
109 109

  
110
  protected int getResource(int numLayers)
110
  protected int getResource(int[] numLayers)
111 111
    {
112
    switch(numLayers)
112
    switch(numLayers[0])
113 113
      {
114 114
      case 2: return R.raw.cube2;
115 115
      case 3: return R.raw.cube3;
......
179 179

  
180 180
///////////////////////////////////////////////////////////////////////////////////////////////////
181 181

  
182
  protected int[] getSolvedQuats(int cubit, int numLayers)
182
  protected int[] getSolvedQuats(int cubit, int[] numLayers)
183 183
    {
184 184
    if( mQuats ==null ) initializeQuats();
185 185
    int status = retCubitSolvedStatus(cubit,numLayers);
......
195 195

  
196 196
///////////////////////////////////////////////////////////////////////////////////////////////////
197 197

  
198
  protected ObjectShape getObjectShape(int cubit, int numLayers)
198
  protected ObjectShape getObjectShape(int cubit, int[] numLayers)
199 199
    {
200 200
    int extraI, extraV, num;
201 201
    float height;
202 202
    int variant = getCubitVariant(cubit,numLayers);
203
    int numL = numLayers[0];
203 204

  
204
    switch(numLayers)
205
    switch(numL)
205 206
        {
206 207
        case 2 : num = 6; extraI = 2; extraV = 2; height = 0.045f; break;
207 208
        case 3 : num = 5; extraI = 2; extraV = 2; height = 0.045f; break;
......
246 247
      {
247 248
      int extraI2, extraV2, num2;
248 249

  
249
      switch(numLayers)
250
      switch(numL)
250 251
        {
251 252
        case 2 : num2 = 6; extraI2 = 2; extraV2 = 2; break;
252 253
        case 3 : num2 = 5; extraI2 = 1; extraV2 = 0; break;
......
267 268

  
268 269
///////////////////////////////////////////////////////////////////////////////////////////////////
269 270

  
270
  protected float[][] getCubitPositions(int numLayers)
271
  protected float[][] getCubitPositions(int[] numLayers)
271 272
    {
272
    if( numLayers==1 ) return new float[][] {{ 0.0f, 0.0f, 0.0f }};
273
    int numL = numLayers[0];
273 274

  
274
    int numCubits = getNumCornersAndEdges(numLayers) + 6*(numLayers-2)*(numLayers-2);
275
    if( numL==1 ) return new float[][] {{ 0.0f, 0.0f, 0.0f }};
276

  
277
    int numCubits = getNumCornersAndEdges(numL) + 6*(numL-2)*(numL-2);
275 278
    float[][] tmp = new float[numCubits][];
276 279

  
277
    final float LEN = 0.5f*(numLayers-1);
280
    final float LEN = 0.5f*(numL-1);
278 281
    int currentPosition = 0;
279 282

  
280 283
    tmp[currentPosition++] = new float[] {-LEN,-LEN,-LEN};
......
286 289
    tmp[currentPosition++] = new float[] {+LEN,+LEN,-LEN};
287 290
    tmp[currentPosition++] = new float[] {+LEN,+LEN,+LEN};
288 291

  
289
    for(int i=1; i<numLayers-1; i++)
292
    for(int i=1; i<numL-1; i++)
290 293
      tmp[currentPosition++] = new float[] { i-LEN,  -LEN,  -LEN };
291
    for(int i=1; i<numLayers-1; i++)
294
    for(int i=1; i<numL-1; i++)
292 295
      tmp[currentPosition++] = new float[] { i-LEN,  -LEN,  +LEN };
293
    for(int i=1; i<numLayers-1; i++)
296
    for(int i=1; i<numL-1; i++)
294 297
      tmp[currentPosition++] = new float[] { i-LEN,  +LEN,  -LEN };
295
    for(int i=1; i<numLayers-1; i++)
298
    for(int i=1; i<numL-1; i++)
296 299
      tmp[currentPosition++] = new float[] { i-LEN,  +LEN,  +LEN };
297
    for(int i=1; i<numLayers-1; i++)
300
    for(int i=1; i<numL-1; i++)
298 301
      tmp[currentPosition++] = new float[] {  -LEN, i-LEN,  -LEN };
299
    for(int i=1; i<numLayers-1; i++)
302
    for(int i=1; i<numL-1; i++)
300 303
      tmp[currentPosition++] = new float[] {  -LEN, i-LEN,  +LEN };
301
    for(int i=1; i<numLayers-1; i++)
304
    for(int i=1; i<numL-1; i++)
302 305
      tmp[currentPosition++] = new float[] {  +LEN, i-LEN,  -LEN };
303
    for(int i=1; i<numLayers-1; i++)
306
    for(int i=1; i<numL-1; i++)
304 307
      tmp[currentPosition++] = new float[] {  +LEN, i-LEN,  +LEN };
305
    for(int i=1; i<numLayers-1; i++)
308
    for(int i=1; i<numL-1; i++)
306 309
      tmp[currentPosition++] = new float[] {  -LEN,  -LEN, i-LEN };
307
    for(int i=1; i<numLayers-1; i++)
310
    for(int i=1; i<numL-1; i++)
308 311
      tmp[currentPosition++] = new float[] {  -LEN,  +LEN, i-LEN };
309
    for(int i=1; i<numLayers-1; i++)
312
    for(int i=1; i<numL-1; i++)
310 313
      tmp[currentPosition++] = new float[] {  +LEN,  -LEN, i-LEN };
311
    for(int i=1; i<numLayers-1; i++)
314
    for(int i=1; i<numL-1; i++)
312 315
      tmp[currentPosition++] = new float[] {  +LEN,  +LEN, i-LEN };
313 316

  
314
    for(int y=1; y<numLayers-1; y++)
315
      for(int z=1; z<numLayers-1; z++)
317
    for(int y=1; y<numL-1; y++)
318
      for(int z=1; z<numL-1; z++)
316 319
        tmp[currentPosition++] = new float[] {+LEN,y-LEN,z-LEN};
317 320

  
318
    for(int y=1; y<numLayers-1; y++)
319
      for(int z=1; z<numLayers-1; z++)
321
    for(int y=1; y<numL-1; y++)
322
      for(int z=1; z<numL-1; z++)
320 323
        tmp[currentPosition++] = new float[] {-LEN,y-LEN,z-LEN};
321 324

  
322
    for(int x=1; x<numLayers-1; x++)
323
      for(int z=1; z<numLayers-1; z++)
325
    for(int x=1; x<numL-1; x++)
326
      for(int z=1; z<numL-1; z++)
324 327
        tmp[currentPosition++] = new float[] {x-LEN,+LEN,z-LEN};
325 328

  
326
    for(int x=1; x<numLayers-1; x++)
327
      for(int z=1; z<numLayers-1; z++)
329
    for(int x=1; x<numL-1; x++)
330
      for(int z=1; z<numL-1; z++)
328 331
        tmp[currentPosition++] = new float[] {x-LEN,-LEN,z-LEN};
329 332

  
330
    for(int x=1; x<numLayers-1; x++)
331
      for(int y=1; y<numLayers-1; y++)
333
    for(int x=1; x<numL-1; x++)
334
      for(int y=1; y<numL-1; y++)
332 335
        tmp[currentPosition++] = new float[] {x-LEN,y-LEN,+LEN};
333 336

  
334
    for(int x=1; x<numLayers-1; x++)
335
      for(int y=1; y<numLayers-1; y++)
337
    for(int x=1; x<numL-1; x++)
338
      for(int y=1; y<numL-1; y++)
336 339
        tmp[currentPosition++] = new float[] {x-LEN,y-LEN,-LEN};
337 340

  
338 341
    return tmp;
......
340 343

  
341 344
///////////////////////////////////////////////////////////////////////////////////////////////////
342 345

  
343
  protected Static4D getQuat(int cubit, int numLayers)
346
  protected Static4D getQuat(int cubit, int[] numLayers)
344 347
    {
345 348
    if( mQuats ==null ) initializeQuats();
346 349

  
347
    int num = cubit - getNumCornersAndEdges(numLayers);
350
    int numL = numLayers[0];
351
    int num = cubit - getNumCornersAndEdges(numL);
348 352

  
349 353
    if( num>=0 )
350 354
      {
351
      int face = num/((numLayers-2)*(numLayers-2));
355
      int face = num/((numL-2)*(numL-2));
352 356

  
353 357
      switch(face)
354 358
        {
......
366 370

  
367 371
///////////////////////////////////////////////////////////////////////////////////////////////////
368 372

  
369
  protected int getNumCubitVariants(int numLayers)
373
  protected int getNumCubitVariants(int[] numLayers)
370 374
    {
371
    return numLayers>2 ? 2:1;
375
    return numLayers[0]>2 ? 2:1;
372 376
    }
373 377

  
374 378
///////////////////////////////////////////////////////////////////////////////////////////////////
375 379

  
376
  protected int getCubitVariant(int cubit, int numLayers)
380
  protected int getCubitVariant(int cubit, int[] numLayers)
377 381
    {
378
    return cubit < getNumCornersAndEdges(numLayers) ? 0 : 1;
382
    return cubit < getNumCornersAndEdges(numLayers[0]) ? 0 : 1;
379 383
    }
380 384

  
381 385
///////////////////////////////////////////////////////////////////////////////////////////////////
382 386

  
383
  protected int getFaceColor(int cubit, int cubitface, int numLayers)
387
  protected int getFaceColor(int cubit, int cubitface, int[] numLayers)
384 388
    {
385
    int cornersAndEdges = getNumCornersAndEdges(numLayers);
389
    int numL = numLayers[0];
390
    int cornersAndEdges = getNumCornersAndEdges(numL);
386 391

  
387 392
    if( cubit<cornersAndEdges )
388 393
      {
389
      return CUBITS[cubit].getRotRow(cubitface/2) == (cubitface%2==0 ? (1<<(numLayers-1)):1) ? cubitface : NUM_TEXTURES;
394
      return CUBITS[cubit].getRotRow(cubitface/2) == (cubitface%2==0 ? (1<<(numL-1)):1) ? cubitface : NUM_TEXTURES;
390 395
      }
391 396
    else
392 397
      {
393
      int numCentersPerFace = (numLayers-2)*(numLayers-2);
398
      int numCentersPerFace = (numL-2)*(numL-2);
394 399
      return cubitface == 4 ? (cubit-cornersAndEdges)/numCentersPerFace : NUM_TEXTURES;
395 400
      }
396 401
    }
......
409 414

  
410 415
      if( ObjectControl.isInIconMode() )
411 416
        {
412
        switch(getNumLayers())
417
        int[] numLayers = getNumLayers();
418

  
419
        switch(numLayers[0])
413 420
          {
414 421
          case 2: stroke*=1.8f; break;
415 422
          case 3: stroke*=2.0f; break;
......
434 441

  
435 442
///////////////////////////////////////////////////////////////////////////////////////////////////
436 443

  
437
  protected float[][] getCuts(int numLayers)
444
  protected float[][] getCuts(int[] numLayers)
438 445
    {
439
    if( numLayers<2 ) return null;
446
    int numL = numLayers[0];
447
    if( numL<2 ) return null;
440 448

  
441 449
    if( mCuts==null )
442 450
      {
443
      mCuts = new float[3][numLayers-1];
451
      mCuts = new float[3][numL-1];
444 452

  
445
      for(int i=0; i<numLayers-1; i++)
453
      for(int i=0; i<numL-1; i++)
446 454
        {
447
        float cut = (2-numLayers)*0.5f + i;
455
        float cut = (2-numL)*0.5f + i;
448 456
        mCuts[0][i] = cut;
449 457
        mCuts[1][i] = cut;
450 458
        mCuts[2][i] = cut;
......
456 464

  
457 465
///////////////////////////////////////////////////////////////////////////////////////////////////
458 466

  
459
  private void getLayerRotatable(int numLayers)
467
  private void getLayerRotatable(int[] numLayers)
460 468
    {
461 469
    if( mLayerRotatable==null )
462 470
      {
463 471
      int numAxis = ROT_AXIS.length;
464
      boolean[] tmp = new boolean[numLayers];
465
      for(int i=0; i<numLayers; i++) tmp[i] = true;
466 472
      mLayerRotatable = new boolean[numAxis][];
467
      for(int i=0; i<numAxis; i++) mLayerRotatable[i] = tmp;
473

  
474
      for(int i=0; i<numAxis; i++)
475
        {
476
        mLayerRotatable[i] = new boolean[numLayers[i]];
477
        for(int j=0; j<numLayers[i]; j++) mLayerRotatable[i][j] = true;
478
        }
468 479
      }
469 480
    }
470 481

  
......
477 488

  
478 489
///////////////////////////////////////////////////////////////////////////////////////////////////
479 490

  
480
  protected int getNumStickerTypes(int numLayers)
491
  protected int getNumStickerTypes(int[] numLayers)
481 492
    {
482 493
    return 1;
483 494
    }
......
503 514
    {
504 515
    if( mMovement==null )
505 516
      {
506
      int numLayers = getNumLayers();
517
      int[] numLayers = getNumLayers();
507 518
      if( mCuts==null ) getCuts(numLayers);
508 519
      getLayerRotatable(numLayers);
509
      mMovement = new Movement6(ROT_AXIS,mCuts,mLayerRotatable,numLayers,TYPE_NOT_SPLIT,ENABLED);
520
      mMovement = new Movement6(ROT_AXIS,mCuts,mLayerRotatable,numLayers[0],TYPE_NOT_SPLIT,ENABLED);
510 521
      }
511 522
    return mMovement;
512 523
    }
......
521 532

  
522 533
///////////////////////////////////////////////////////////////////////////////////////////////////
523 534

  
524
  public ObjectType intGetObjectType(int numLayers)
535
  public ObjectType intGetObjectType(int[] numLayers)
525 536
    {
526
    switch(numLayers)
537
    switch(numLayers[0])
527 538
      {
528 539
      case 2: return ObjectType.CUBE_2;
529 540
      case 3: return ObjectType.CUBE_3;
......
536 547

  
537 548
///////////////////////////////////////////////////////////////////////////////////////////////////
538 549

  
539
  public int getObjectName(int numLayers)
550
  public int getObjectName(int[] numLayers)
540 551
    {
541
    switch(numLayers)
552
    switch(numLayers[0])
542 553
      {
543 554
      case 2: return R.string.cube2;
544 555
      case 3: return R.string.cube3;
......
550 561

  
551 562
///////////////////////////////////////////////////////////////////////////////////////////////////
552 563

  
553
  public int getInventor(int numLayers)
564
  public int getInventor(int[] numLayers)
554 565
    {
555
    switch(numLayers)
566
    switch(numLayers[0])
556 567
      {
557 568
      case 2: return R.string.cube2_inventor;
558 569
      case 3: return R.string.cube3_inventor;
......
564 575

  
565 576
///////////////////////////////////////////////////////////////////////////////////////////////////
566 577

  
567
  public int getComplexity(int numLayers)
578
  public int getComplexity(int[] numLayers)
568 579
    {
569
    switch(numLayers)
580
    switch(numLayers[0])
570 581
      {
571 582
      case 2: return 4;
572 583
      case 3: return 6;
src/main/java/org/distorted/objectlib/objects/TwistyDiamond.java
69 69

  
70 70
///////////////////////////////////////////////////////////////////////////////////////////////////
71 71

  
72
  public TwistyDiamond(int size, Static4D quat, Static3D move, DistortedTexture texture,
72
  public TwistyDiamond(int[] numL, Static4D quat, Static3D move, DistortedTexture texture,
73 73
                       MeshSquare mesh, DistortedEffects effects, Resources res, int scrWidth)
74 74
    {
75
    super(size, size, quat, move, texture, mesh, effects, res, scrWidth);
75
    super(numL, numL[0], quat, move, texture, mesh, effects, res, scrWidth);
76 76
    }
77 77

  
78 78
///////////////////////////////////////////////////////////////////////////////////////////////////
......
81 81
    {
82 82
    if( mStates==null )
83 83
      {
84
      int size = getNumLayers();
85
      int[] tmp = new int[3*2*size];
84
      int[] numLayers = getNumLayers();
85
      int numL = numLayers[0];
86
      int[] tmp = new int[3*2*numL];
86 87

  
87
      for(int i=0; i<2*size; i++)
88
      for(int i=0; i<2*numL; i++)
88 89
        {
89
        tmp[3*i  ] = (i<size) ?  i:i-size;
90
        tmp[3*i  ] = (i<numL) ?  i:i-numL;
90 91
        tmp[3*i+1] = (i%2==0) ? -1:1;
91 92
        tmp[3*i+2] = 0;
92 93
        }
......
102 103

  
103 104
///////////////////////////////////////////////////////////////////////////////////////////////////
104 105

  
105
  protected int getResource(int numLayers)
106
  protected int getResource(int[] numLayers)
106 107
    {
107
    switch(numLayers)
108
    switch(numLayers[0])
108 109
      {
109 110
      case 2: return R.raw.diam2;
110 111
      case 3: return R.raw.diam3;
......
138 139

  
139 140
///////////////////////////////////////////////////////////////////////////////////////////////////
140 141

  
141
  protected int[] getSolvedQuats(int cubit, int numLayers)
142
  protected int[] getSolvedQuats(int cubit, int[] numLayers)
142 143
    {
143 144
    if( mQuats==null ) initializeQuats();
144 145
    if( mFaceMap==null ) mFaceMap = new int[] {4,0,6,2,7,3,5,1};
......
163 164

  
164 165
///////////////////////////////////////////////////////////////////////////////////////////////////
165 166

  
166
  protected int getNumStickerTypes(int numLayers)
167
  protected int getNumStickerTypes(int[] numLayers)
167 168
    {
168 169
    return 1;
169 170
    }
170 171

  
171 172
///////////////////////////////////////////////////////////////////////////////////////////////////
172 173

  
173
  protected float[][] getCuts(int numLayers)
174
  protected float[][] getCuts(int[] numLayers)
174 175
    {
175
    if( numLayers<2 ) return null;
176
    int numL = numLayers[0];
177
    if( numL<2 ) return null;
176 178

  
177 179
    if( mCuts==null )
178 180
      {
179
      mCuts = new float[4][numLayers-1];
180
      float cut = (SQ6/6)*(2-numLayers);
181
      mCuts = new float[4][numL-1];
182
      float cut = (SQ6/6)*(2-numL);
181 183

  
182
      for(int i=0; i<numLayers-1; i++)
184
      for(int i=0; i<numL-1; i++)
183 185
        {
184 186
        mCuts[0][i] = cut;
185 187
        mCuts[1][i] = cut;
......
194 196

  
195 197
///////////////////////////////////////////////////////////////////////////////////////////////////
196 198

  
197
  private void getLayerRotatable(int numLayers)
199
  private void getLayerRotatable(int[] numLayers)
198 200
    {
199 201
    if( mLayerRotatable==null )
200 202
      {
201 203
      int numAxis = ROT_AXIS.length;
202
      boolean[] tmp = new boolean[numLayers];
203
      for(int i=0; i<numLayers; i++) tmp[i] = true;
204 204
      mLayerRotatable = new boolean[numAxis][];
205
      for(int i=0; i<numAxis; i++) mLayerRotatable[i] = tmp;
205

  
206
      for(int i=0; i<numAxis; i++)
207
        {
208
        mLayerRotatable[i] = new boolean[numLayers[i]];
209
        for(int j=0; j<numLayers[i]; j++) mLayerRotatable[i][j] = true;
210
        }
206 211
      }
207 212
    }
208 213

  
......
322 327

  
323 328
///////////////////////////////////////////////////////////////////////////////////////////////////
324 329

  
325
  protected float[][] getCubitPositions(int layers)
330
  protected float[][] getCubitPositions(int[] numLayers)
326 331
    {
332
    int layers = numLayers[0];
327 333
    int numO = getNumOctahedrons(layers);
328 334
    int numT = getNumTetrahedrons(layers);
329 335
    int index = 0;
......
369 375

  
370 376
///////////////////////////////////////////////////////////////////////////////////////////////////
371 377

  
372
  protected ObjectShape getObjectShape(int cubit, int numLayers)
378
  protected ObjectShape getObjectShape(int cubit, int[] numLayers)
373 379
    {
374 380
    int variant = getCubitVariant(cubit,numLayers);
375
    int N = numLayers>3 ? 5:6;
376
    int E = numLayers>2 ? (numLayers>3 ? 0:1):2;
381
    int numL = numLayers[0];
382
    int N = numL>3 ? 5:6;
383
    int E = numL>2 ? (numL>3 ? 0:1):2;
377 384

  
378 385
    if( variant==0 )
379 386
      {
......
423 430

  
424 431
///////////////////////////////////////////////////////////////////////////////////////////////////
425 432

  
426
  protected Static4D getQuat(int cubit, int numLayers)
433
  protected Static4D getQuat(int cubit, int[] numLayers)
427 434
    {
428 435
    if( mQuats==null ) initializeQuats();
429
    int numO = getNumOctahedrons(numLayers);
436

  
437
    int numL = numLayers[0];
438
    int numO = getNumOctahedrons(numL);
430 439

  
431 440
    if( cubit<numO ) return mQuats[0];
432 441

  
433
    switch( retFaceTetraBelongsTo(cubit-numO, numLayers) )
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff