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/objects/TwistyIvy.java
76 76

  
77 77
///////////////////////////////////////////////////////////////////////////////////////////////////
78 78

  
79
  public TwistyIvy(int size, Static4D quat, Static3D move, DistortedTexture texture,
79
  public TwistyIvy(int[] numL, Static4D quat, Static3D move, DistortedTexture texture,
80 80
                   MeshSquare mesh, DistortedEffects effects, Resources res, int scrWidth)
81 81
    {
82
    super(size, size, quat, move, texture, mesh, effects, res, scrWidth);
82
    super(numL, numL[0], quat, move, texture, mesh, effects, res, scrWidth);
83 83
    }
84 84

  
85 85
///////////////////////////////////////////////////////////////////////////////////////////////////
......
101 101

  
102 102
///////////////////////////////////////////////////////////////////////////////////////////////////
103 103

  
104
  protected int getResource(int numLayers)
104
  protected int getResource(int[] numLayers)
105 105
    {
106 106
    return R.raw.ivy;
107 107
    }
......
130 130

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

  
133
  protected int[] getSolvedQuats(int cubit, int numLayers)
133
  protected int[] getSolvedQuats(int cubit, int[] numLayers)
134 134
    {
135 135
    if( mQuats==null ) initializeQuats();
136 136
    int status = retCubitSolvedStatus(cubit,numLayers);
......
154 154

  
155 155
///////////////////////////////////////////////////////////////////////////////////////////////////
156 156

  
157
  protected int getNumStickerTypes(int numLayers)
157
  protected int getNumStickerTypes(int[] numLayers)
158 158
    {
159 159
    return NUM_STICKERS;
160 160
    }
161 161

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

  
164
  protected float[][] getCuts(int numLayers)
164
  protected float[][] getCuts(int[] numLayers)
165 165
    {
166 166
    if( mCuts==null )
167 167
      {
......
174 174

  
175 175
///////////////////////////////////////////////////////////////////////////////////////////////////
176 176

  
177
  private void getLayerRotatable(int numLayers)
177
  private void getLayerRotatable(int[] numLayers)
178 178
    {
179 179
    if( mLayerRotatable==null )
180 180
      {
181 181
      int numAxis = ROT_AXIS.length;
182
      boolean[] tmp = new boolean[numLayers];
183
      for(int i=0; i<numLayers; i++) tmp[i] = true;
184 182
      mLayerRotatable = new boolean[numAxis][];
185
      for(int i=0; i<numAxis; i++) mLayerRotatable[i] = tmp;
183

  
184
      for(int i=0; i<numAxis; i++)
185
        {
186
        mLayerRotatable[i] = new boolean[numLayers[i]];
187
        for(int j=0; j<numLayers[i]; j++) mLayerRotatable[i][j] = true;
188
        }
186 189
      }
187 190
    }
188 191

  
......
195 198

  
196 199
///////////////////////////////////////////////////////////////////////////////////////////////////
197 200

  
198
  protected float[][] getCubitPositions(int numLayers)
201
  protected float[][] getCubitPositions(int[] numLayers)
199 202
    {
200
    final float DIST_CORNER = numLayers-1;
201
    final float DIST_CENTER = numLayers-1;
203
    final float DIST_CORNER = numLayers[0]-1;
204
    final float DIST_CENTER = numLayers[0]-1;
202 205

  
203 206
    final float[][] CENTERS = new float[10][];
204 207

  
......
218 221

  
219 222
///////////////////////////////////////////////////////////////////////////////////////////////////
220 223

  
221
  protected ObjectShape getObjectShape(int cubit, int numLayers)
224
  protected ObjectShape getObjectShape(int cubit, int[] numLayers)
222 225
    {
223 226
    int variant = getCubitVariant(cubit,numLayers);
224 227

  
......
375 378

  
376 379
///////////////////////////////////////////////////////////////////////////////////////////////////
377 380

  
378
  protected Static4D getQuat(int cubit, int numLayers)
381
  protected Static4D getQuat(int cubit, int[] numLayers)
379 382
    {
380 383
    if( mQuats==null ) initializeQuats();
381 384

  
......
399 402

  
400 403
///////////////////////////////////////////////////////////////////////////////////////////////////
401 404

  
402
  protected int getNumCubitVariants(int numLayers)
405
  protected int getNumCubitVariants(int[] numLayers)
403 406
    {
404 407
    return 2;
405 408
    }
406 409

  
407 410
///////////////////////////////////////////////////////////////////////////////////////////////////
408 411

  
409
  protected int getCubitVariant(int cubit, int numLayers)
412
  protected int getCubitVariant(int cubit, int[] numLayers)
410 413
    {
411 414
    return cubit<4 ? 0:1;
412 415
    }
413 416

  
414 417
///////////////////////////////////////////////////////////////////////////////////////////////////
415 418

  
416
  protected int getFaceColor(int cubit, int cubitface, int numLayers)
419
  protected int getFaceColor(int cubit, int cubitface, int[] numLayers)
417 420
    {
418 421
    if( mFaceMap==null )
419 422
      {
......
476 479
    {
477 480
    if( mMovement==null )
478 481
      {
479
      int numLayers = getNumLayers();
482
      int[] numLayers = getNumLayers();
480 483
      if( mCuts==null ) getCuts(numLayers);
481 484
      getLayerRotatable(numLayers);
482
      mMovement = new Movement6(ROT_AXIS,mCuts,mLayerRotatable,numLayers,TYPE_SPLIT_CORNER,ENABLED);
485
      mMovement = new Movement6(ROT_AXIS,mCuts,mLayerRotatable,numLayers[0],TYPE_SPLIT_CORNER,ENABLED);
483 486
      }
484 487
    return mMovement;
485 488
    }
......
494 497

  
495 498
///////////////////////////////////////////////////////////////////////////////////////////////////
496 499

  
497
  public ObjectType intGetObjectType(int numLayers)
500
  public ObjectType intGetObjectType(int[] numLayers)
498 501
    {
499 502
    return ObjectType.IVY_2;
500 503
    }
501 504

  
502 505
///////////////////////////////////////////////////////////////////////////////////////////////////
503 506

  
504
  public int getObjectName(int numLayers)
507
  public int getObjectName(int[] numLayers)
505 508
    {
506 509
    return R.string.ivy2;
507 510
    }
508 511

  
509 512
///////////////////////////////////////////////////////////////////////////////////////////////////
510 513

  
511
  public int getInventor(int numLayers)
514
  public int getInventor(int[] numLayers)
512 515
    {
513 516
    return R.string.ivy2_inventor;
514 517
    }
515 518

  
516 519
///////////////////////////////////////////////////////////////////////////////////////////////////
517 520

  
518
  public int getComplexity(int numLayers)
521
  public int getComplexity(int[] numLayers)
519 522
    {
520 523
    return 1;
521 524
    }

Also available in: Unified diff