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/TwistyJing.java
73 73

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

  
76
  public TwistyJing(int size, Static4D quat, Static3D move, DistortedTexture texture,
76
  public TwistyJing(int[] numL, Static4D quat, Static3D move, DistortedTexture texture,
77 77
                    MeshSquare mesh, DistortedEffects effects, Resources res, int scrWidth)
78 78
    {
79
    super(size, size, quat, move, texture, mesh, effects, res, scrWidth);
79
    super(numL, numL[0], quat, move, texture, mesh, effects, res, scrWidth);
80 80
    }
81 81

  
82 82
///////////////////////////////////////////////////////////////////////////////////////////////////
......
98 98

  
99 99
///////////////////////////////////////////////////////////////////////////////////////////////////
100 100

  
101
  protected int getResource(int numLayers)
101
  protected int getResource(int[] numLayers)
102 102
    {
103 103
    return R.raw.jing;
104 104
    }
......
126 126

  
127 127
///////////////////////////////////////////////////////////////////////////////////////////////////
128 128

  
129
  protected int[] getSolvedQuats(int cubit, int numLayers)
129
  protected int[] getSolvedQuats(int cubit, int[] numLayers)
130 130
    {
131 131
    if( mQuats==null ) initializeQuats();
132 132
    int status = retCubitSolvedStatus(cubit,numLayers);
......
135 135

  
136 136
///////////////////////////////////////////////////////////////////////////////////////////////////
137 137

  
138
  protected float[][] getCubitPositions(int size)
138
  protected float[][] getCubitPositions(int[] numLayers)
139 139
    {
140 140
    if( mCenters==null )
141 141
      {
......
180 180

  
181 181
///////////////////////////////////////////////////////////////////////////////////////////////////
182 182

  
183
  protected int getNumStickerTypes(int numLayers)
183
  protected int getNumStickerTypes(int[] numLayers)
184 184
    {
185 185
    return 3;
186 186
    }
187 187

  
188 188
///////////////////////////////////////////////////////////////////////////////////////////////////
189 189

  
190
  protected float[][] getCuts(int size)
190
  protected float[][] getCuts(int[] numLayers)
191 191
    {
192 192
    if( mCuts==null )
193 193
      {
......
200 200

  
201 201
///////////////////////////////////////////////////////////////////////////////////////////////////
202 202

  
203
  private void getLayerRotatable(int numLayers)
203
  private void getLayerRotatable(int[] numLayers)
204 204
    {
205 205
    if( mLayerRotatable==null )
206 206
      {
207 207
      int numAxis = ROT_AXIS.length;
208
      boolean[] tmp = new boolean[numLayers];
209
      for(int i=0; i<numLayers; i++) tmp[i] = true;
210 208
      mLayerRotatable = new boolean[numAxis][];
211
      for(int i=0; i<numAxis; i++) mLayerRotatable[i] = tmp;
209

  
210
      for(int i=0; i<numAxis; i++)
211
        {
212
        mLayerRotatable[i] = new boolean[numLayers[i]];
213
        for(int j=0; j<numLayers[i]; j++) mLayerRotatable[i][j] = true;
214
        }
212 215
      }
213 216
    }
214 217

  
......
221 224

  
222 225
///////////////////////////////////////////////////////////////////////////////////////////////////
223 226

  
224
  protected int getFaceColor(int cubit, int cubitface, int size)
227
  protected int getFaceColor(int cubit, int cubitface, int[] numLayers)
225 228
    {
226 229
    if( mFaceMap==null )
227 230
      {
......
255 258

  
256 259
///////////////////////////////////////////////////////////////////////////////////////////////////
257 260

  
258
  protected ObjectShape getObjectShape(int cubit, int numLayers)
261
  protected ObjectShape getObjectShape(int cubit, int[] numLayers)
259 262
    {
260 263
    int variant = getCubitVariant(cubit,numLayers);
261 264

  
......
363 366

  
364 367
///////////////////////////////////////////////////////////////////////////////////////////////////
365 368

  
366
  protected Static4D getQuat(int cubit, int numLayers)
369
  protected Static4D getQuat(int cubit, int[] numLayers)
367 370
    {
368 371
    if( mQuats==null ) initializeQuats();
369 372
    if( mRotQuat ==null ) mRotQuat = new int[] {0,1,2,7,0,2,7,6,3,10,0,1,3,5};
......
372 375

  
373 376
///////////////////////////////////////////////////////////////////////////////////////////////////
374 377

  
375
  protected int getNumCubitVariants(int numLayers)
378
  protected int getNumCubitVariants(int[] numLayers)
376 379
    {
377 380
    return 3;
378 381
    }
379 382

  
380 383
///////////////////////////////////////////////////////////////////////////////////////////////////
381 384

  
382
  protected int getCubitVariant(int cubit, int numLayers)
385
  protected int getCubitVariant(int cubit, int[] numLayers)
383 386
    {
384 387
    return cubit<4 ? 0 : (cubit<10?1:2);
385 388
    }
......
434 437
    {
435 438
    if( mMovement==null )
436 439
      {
437
      int numLayers = getNumLayers();
440
      int[] numLayers = getNumLayers();
438 441
      if( mCuts==null ) getCuts(numLayers);
439 442
      getLayerRotatable(numLayers);
440
      mMovement = new Movement4(ROT_AXIS,mCuts,mLayerRotatable,numLayers,TYPE_NOT_SPLIT,ENABLED);
443
      mMovement = new Movement4(ROT_AXIS,mCuts,mLayerRotatable,numLayers[0],TYPE_NOT_SPLIT,ENABLED);
441 444
      }
442 445
    return mMovement;
443 446
    }
......
452 455

  
453 456
///////////////////////////////////////////////////////////////////////////////////////////////////
454 457

  
455
  public ObjectType intGetObjectType(int numLayers)
458
  public ObjectType intGetObjectType(int[] numLayers)
456 459
    {
457 460
    return ObjectType.JING_2;
458 461
    }
459 462

  
460 463
///////////////////////////////////////////////////////////////////////////////////////////////////
461 464

  
462
  public int getObjectName(int numLayers)
465
  public int getObjectName(int[] numLayers)
463 466
    {
464 467
    return R.string.jing;
465 468
    }
466 469

  
467 470
///////////////////////////////////////////////////////////////////////////////////////////////////
468 471

  
469
  public int getInventor(int numLayers)
472
  public int getInventor(int[] numLayers)
470 473
    {
471 474
    return R.string.jing_inventor;
472 475
    }
473 476

  
474 477
///////////////////////////////////////////////////////////////////////////////////////////////////
475 478

  
476
  public int getComplexity(int numLayers)
479
  public int getComplexity(int[] numLayers)
477 480
    {
478 481
    return 4;
479 482
    }

Also available in: Unified diff