Project

General

Profile

« Previous | Next » 

Revision 0a7aa15b

Added by Leszek Koltunski over 3 years ago

Separate the notion of maxLevel (in DB) [which has to stay backwards-compatible with previous versions of the app] and 'numScrambles' - the number of times an objects gets scrambled in the 'full scramble' mode. Now the second can be whatever we want without breaking backwards compatibility.

View differences:

src/main/java/org/distorted/dialogs/RubikDialogScoresPagerAdapter.java
118 118
      {
119 119
      int object   = ObjectList.unpackObject(i);
120 120
      int sizeIndex= ObjectList.unpackSizeIndex(i);
121
      lastTab[i]   = ObjectList.getMaxLevel(object, sizeIndex);
121
      lastTab[i]   = ObjectList.getDBLevel(object, sizeIndex);
122 122
      maxTab[i]    = Math.min(lastTab[i],MAX);
123 123
      toDoTab[i]   = 0;
124 124

  
src/main/java/org/distorted/dialogs/RubikDialogScoresView.java
95 95
    boolean inserted = false;
96 96
    long myRecordInMillis = scores.getRecord(object, sizeIndex, level);
97 97
    float myRecordInSeconds = (myRecordInMillis/10)/100.0f;
98
    boolean mySubmitted = scores.isSubmitted(object, sizeIndex, level);
99 98
    String myName = scores.getName();
100 99
    if( myName.length()==0 ) myName = act.getString(R.string.you);
101 100
    int myCountryID = res.getIdentifier( scores.getCountry(), "drawable", packageName);
src/main/java/org/distorted/effects/scramble/ScrambleEffect.java
87 87
  ScrambleEffect()
88 88
    {
89 89
    mRnd = new Random( System.currentTimeMillis() );
90
    mScrambles = new int[ObjectList.MAX_LEVEL][3];
90
    mScrambles = new int[ObjectList.MAX_SCRAMBLE][3];
91 91
    }
92 92

  
93 93
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/objects/ObjectList.java
34 34

  
35 35
public enum ObjectList
36 36
  {
37
  ///////////////////// Size // DB Level // NumScrambles // Mesh // small icon // medium icon // big icon // huge icon
38

  
37 39
  CUBE (
38 40
         new int[][] {
39
                       {2 , 12, R.raw.cube2, R.drawable.ui_small_cube2, R.drawable.ui_medium_cube2, R.drawable.ui_big_cube2, R.drawable.ui_huge_cube2} ,
40
                       {3 , 16, R.raw.cube3, R.drawable.ui_small_cube3, R.drawable.ui_medium_cube3, R.drawable.ui_big_cube3, R.drawable.ui_huge_cube3} ,
41
                       {4 , 20, R.raw.cube4, R.drawable.ui_small_cube4, R.drawable.ui_medium_cube4, R.drawable.ui_big_cube4, R.drawable.ui_huge_cube4} ,
42
                       {5 , 24, R.raw.cube5, R.drawable.ui_small_cube5, R.drawable.ui_medium_cube5, R.drawable.ui_big_cube5, R.drawable.ui_huge_cube5}
41
                       {2 , 12, 12, R.raw.cube2, R.drawable.ui_small_cube2, R.drawable.ui_medium_cube2, R.drawable.ui_big_cube2, R.drawable.ui_huge_cube2} ,
42
                       {3 , 16, 17, R.raw.cube3, R.drawable.ui_small_cube3, R.drawable.ui_medium_cube3, R.drawable.ui_big_cube3, R.drawable.ui_huge_cube3} ,
43
                       {4 , 20, 24, R.raw.cube4, R.drawable.ui_small_cube4, R.drawable.ui_medium_cube4, R.drawable.ui_big_cube4, R.drawable.ui_huge_cube4} ,
44
                       {5 , 24, 28, R.raw.cube5, R.drawable.ui_small_cube5, R.drawable.ui_medium_cube5, R.drawable.ui_big_cube5, R.drawable.ui_huge_cube5}
43 45
                     },
44 46
         TwistyCube.class,
45 47
         new MovementCube(),
......
49 51

  
50 52
  PYRA (
51 53
         new int[][] {
52
                       {3 , 10, R.raw.pyra3, R.drawable.ui_small_pyra3, R.drawable.ui_medium_pyra3, R.drawable.ui_big_pyra3, R.drawable.ui_huge_pyra3} ,
53
                       {4 , 15, R.raw.pyra4, R.drawable.ui_small_pyra4, R.drawable.ui_medium_pyra4, R.drawable.ui_big_pyra4, R.drawable.ui_huge_pyra4} ,
54
                       {5 , 20, R.raw.pyra5, R.drawable.ui_small_pyra5, R.drawable.ui_medium_pyra5, R.drawable.ui_big_pyra5, R.drawable.ui_huge_pyra5}
54
                       {3 , 10, 10, R.raw.pyra3, R.drawable.ui_small_pyra3, R.drawable.ui_medium_pyra3, R.drawable.ui_big_pyra3, R.drawable.ui_huge_pyra3} ,
55
                       {4 , 15, 17, R.raw.pyra4, R.drawable.ui_small_pyra4, R.drawable.ui_medium_pyra4, R.drawable.ui_big_pyra4, R.drawable.ui_huge_pyra4} ,
56
                       {5 , 20, 23, R.raw.pyra5, R.drawable.ui_small_pyra5, R.drawable.ui_medium_pyra5, R.drawable.ui_big_pyra5, R.drawable.ui_huge_pyra5}
55 57
                     },
56 58
         TwistyPyraminx.class,
57 59
         new MovementPyraminx(),
......
61 63

  
62 64
  ULTI (
63 65
         new int[][] {
64
                       {2 , 18, R.raw.ulti, R.drawable.ui_small_ulti, R.drawable.ui_medium_ulti, R.drawable.ui_big_ulti, R.drawable.ui_huge_ulti} ,
66
                       {2 , 18, 18, R.raw.ulti, R.drawable.ui_small_ulti, R.drawable.ui_medium_ulti, R.drawable.ui_big_ulti, R.drawable.ui_huge_ulti} ,
65 67
                     },
66 68
         TwistyUltimate.class,
67 69
         new MovementUltimate(),
......
71 73

  
72 74
  KILO (
73 75
         new int[][] {
74
                       {3 , 18, R.raw.kilo3, R.drawable.ui_small_kilo3, R.drawable.ui_medium_kilo3, R.drawable.ui_big_kilo3, R.drawable.ui_huge_kilo3} ,
75
                       {5 , 33, R.raw.kilo5, R.drawable.ui_small_kilo5, R.drawable.ui_medium_kilo5, R.drawable.ui_big_kilo5, R.drawable.ui_huge_kilo5} ,
76
                       {3 , 18, 18, R.raw.kilo3, R.drawable.ui_small_kilo3, R.drawable.ui_medium_kilo3, R.drawable.ui_big_kilo3, R.drawable.ui_huge_kilo3} ,
77
                       {5 , 33, 33, R.raw.kilo5, R.drawable.ui_small_kilo5, R.drawable.ui_medium_kilo5, R.drawable.ui_big_kilo5, R.drawable.ui_huge_kilo5} ,
76 78
                     },
77 79
         TwistyKilominx.class,
78 80
         new MovementMinx(),
......
82 84

  
83 85
  MEGA (
84 86
         new int[][] {
85
                       {3 , 21, R.raw.mega3, R.drawable.ui_small_mega3, R.drawable.ui_medium_mega3, R.drawable.ui_big_mega3, R.drawable.ui_huge_mega3} ,
86
                       {5 , 35, R.raw.mega5, R.drawable.ui_small_mega5, R.drawable.ui_medium_mega5, R.drawable.ui_big_mega5, R.drawable.ui_huge_mega5} ,
87
                       {3 , 21, 21, R.raw.mega3, R.drawable.ui_small_mega3, R.drawable.ui_medium_mega3, R.drawable.ui_big_mega3, R.drawable.ui_huge_mega3} ,
88
                       {5 , 35, 37, R.raw.mega5, R.drawable.ui_small_mega5, R.drawable.ui_medium_mega5, R.drawable.ui_big_mega5, R.drawable.ui_huge_mega5} ,
87 89
                     },
88 90
         TwistyMegaminx.class,
89 91
         new MovementMinx(),
......
93 95

  
94 96
  DINO (
95 97
         new int[][] {
96
                       {3 , 10, R.raw.dino, R.drawable.ui_small_dino, R.drawable.ui_medium_dino, R.drawable.ui_big_dino, R.drawable.ui_huge_dino} ,
98
                       {3 , 10, 10, R.raw.dino, R.drawable.ui_small_dino, R.drawable.ui_medium_dino, R.drawable.ui_big_dino, R.drawable.ui_huge_dino} ,
97 99
                     },
98 100
         TwistyDino6.class,
99 101
         new MovementDino(),
......
103 105

  
104 106
  DIN4 (
105 107
         new int[][] {
106
                       {3 ,  7, R.raw.dino, R.drawable.ui_small_din4, R.drawable.ui_medium_din4, R.drawable.ui_big_din4, R.drawable.ui_huge_din4} ,
108
                       {3 , 7, 7, R.raw.dino, R.drawable.ui_small_din4, R.drawable.ui_medium_din4, R.drawable.ui_big_din4, R.drawable.ui_huge_din4} ,
107 109
                     },
108 110
         TwistyDino4.class,
109 111
         new MovementDino(),
......
113 115

  
114 116
  REDI (
115 117
         new int[][] {
116
                       {3 , 14, R.raw.redi, R.drawable.ui_small_redi, R.drawable.ui_medium_redi, R.drawable.ui_big_redi, R.drawable.ui_huge_redi} ,
118
                       {3 , 14, 16, R.raw.redi, R.drawable.ui_small_redi, R.drawable.ui_medium_redi, R.drawable.ui_big_redi, R.drawable.ui_huge_redi} ,
117 119
                     },
118 120
         TwistyRedi.class,
119 121
         new MovementRedi(),
......
123 125

  
124 126
  HELI (
125 127
         new int[][] {
126
                       {3 , 18, R.raw.heli, R.drawable.ui_small_heli, R.drawable.ui_medium_heli, R.drawable.ui_big_heli, R.drawable.ui_huge_heli} ,
128
                       {3 , 18, 20, R.raw.heli, R.drawable.ui_small_heli, R.drawable.ui_medium_heli, R.drawable.ui_big_heli, R.drawable.ui_huge_heli} ,
127 129
                     },
128 130
         TwistyHelicopter.class,
129 131
         new MovementHelicopter(),
......
133 135

  
134 136
  SKEW (
135 137
         new int[][] {
136
                       {2 , 11, R.raw.skew2, R.drawable.ui_small_skewb, R.drawable.ui_medium_skewb, R.drawable.ui_big_skewb, R.drawable.ui_huge_skewb} ,
137
                       {3 , 17, R.raw.skew3, R.drawable.ui_small_skewm, R.drawable.ui_medium_skewm, R.drawable.ui_big_skewm, R.drawable.ui_huge_skewm} ,
138
                       {2 , 11, 11, R.raw.skew2, R.drawable.ui_small_skewb, R.drawable.ui_medium_skewb, R.drawable.ui_big_skewb, R.drawable.ui_huge_skewb} ,
139
                       {3 , 17, 21, R.raw.skew3, R.drawable.ui_small_skewm, R.drawable.ui_medium_skewm, R.drawable.ui_big_skewm, R.drawable.ui_huge_skewm} ,
138 140
                     },
139 141
         TwistySkewb.class,
140 142
         new MovementSkewb(),
......
144 146

  
145 147
  IVY  (
146 148
         new int[][] {
147
                       {2 , 8, R.raw.ivy, R.drawable.ui_small_ivy, R.drawable.ui_medium_ivy, R.drawable.ui_big_ivy, R.drawable.ui_huge_ivy} ,
149
                       {2 , 8, 8, R.raw.ivy, R.drawable.ui_small_ivy, R.drawable.ui_medium_ivy, R.drawable.ui_big_ivy, R.drawable.ui_huge_ivy} ,
148 150
                     },
149 151
         TwistyIvy.class,
150 152
         new MovementIvy(),
......
154 156

  
155 157
  REX  (
156 158
         new int[][] {
157
                       {3 , 16, R.raw.rex, R.drawable.ui_small_rex, R.drawable.ui_medium_rex, R.drawable.ui_big_rex, R.drawable.ui_huge_rex} ,
159
                       {3 , 16, 19, R.raw.rex, R.drawable.ui_small_rex, R.drawable.ui_medium_rex, R.drawable.ui_big_rex, R.drawable.ui_huge_rex} ,
158 160
                     },
159 161
         TwistyRex.class,
160 162
         new MovementRex(),
......
164 166

  
165 167
  BAN1 (
166 168
         new int[][] {
167
                       {3 , 16, R.raw.ban1, R.drawable.ui_small_ban1, R.drawable.ui_medium_ban1, R.drawable.ui_big_ban1, R.drawable.ui_huge_ban1} ,
169
                       {3 , 16, 16, R.raw.ban1, R.drawable.ui_small_ban1, R.drawable.ui_medium_ban1, R.drawable.ui_big_ban1, R.drawable.ui_huge_ban1} ,
168 170
                     },
169 171
         TwistyBandagedFused.class,
170 172
         new MovementCube(),
......
174 176

  
175 177
  BAN2 (
176 178
         new int[][] {
177
                       {3 , 16, R.raw.ban2, R.drawable.ui_small_ban2, R.drawable.ui_medium_ban2, R.drawable.ui_big_ban2, R.drawable.ui_huge_ban2} ,
179
                       {3 , 16, 16, R.raw.ban2, R.drawable.ui_small_ban2, R.drawable.ui_medium_ban2, R.drawable.ui_big_ban2, R.drawable.ui_huge_ban2} ,
178 180
                     },
179 181
         TwistyBandaged2Bar.class,
180 182
         new MovementCube(),
......
184 186

  
185 187
  BAN3 (
186 188
         new int[][] {
187
                       {3 , 16, R.raw.ban3, R.drawable.ui_small_ban3, R.drawable.ui_medium_ban3, R.drawable.ui_big_ban3, R.drawable.ui_huge_ban3} ,
189
                       {3 , 16, 16, R.raw.ban3, R.drawable.ui_small_ban3, R.drawable.ui_medium_ban3, R.drawable.ui_big_ban3, R.drawable.ui_huge_ban3} ,
188 190
                     },
189 191
         TwistyBandaged3Plate.class,
190 192
         new MovementCube(),
......
194 196

  
195 197
  BAN4 (
196 198
         new int[][] {
197
                       {3 , 16, R.raw.ban4, R.drawable.ui_small_ban4, R.drawable.ui_medium_ban4, R.drawable.ui_big_ban4, R.drawable.ui_huge_ban4} ,
199
                       {3 , 16, 16, R.raw.ban4, R.drawable.ui_small_ban4, R.drawable.ui_medium_ban4, R.drawable.ui_big_ban4, R.drawable.ui_huge_ban4} ,
198 200
                     },
199 201
         TwistyBandagedEvil.class,
200 202
         new MovementCube(),
......
204 206

  
205 207
  DIAM (
206 208
         new int[][] {
207
                       {2 , 10, R.raw.diam2, R.drawable.ui_small_diam2, R.drawable.ui_medium_diam2, R.drawable.ui_big_diam2, R.drawable.ui_huge_diam2} ,
208
                       {3 , 18, R.raw.diam3, R.drawable.ui_small_diam3, R.drawable.ui_medium_diam3, R.drawable.ui_big_diam3, R.drawable.ui_huge_diam3} ,
209
                       {2 , 10, 12, R.raw.diam2, R.drawable.ui_small_diam2, R.drawable.ui_medium_diam2, R.drawable.ui_big_diam2, R.drawable.ui_huge_diam2} ,
210
                       {3 , 18, 24, R.raw.diam3, R.drawable.ui_small_diam3, R.drawable.ui_medium_diam3, R.drawable.ui_big_diam3, R.drawable.ui_huge_diam3} ,
209 211
                     },
210 212
         TwistyDiamond.class,
211 213
         new MovementDiamond(),
......
215 217

  
216 218
  SQU1 (
217 219
         new int[][] {
218
                       {3 , 24, R.raw.square1, R.drawable.ui_small_square1, R.drawable.ui_medium_square1, R.drawable.ui_big_square1, R.drawable.ui_huge_square1} ,
220
                       {3 , 24, 24, R.raw.square1, R.drawable.ui_small_square1, R.drawable.ui_medium_square1, R.drawable.ui_big_square1, R.drawable.ui_huge_square1} ,
219 221
                     },
220 222
         TwistySquare1.class,
221 223
         new MovementSquare(),
......
225 227

  
226 228
  SQU2 (
227 229
         new int[][] {
228
                       {3 , 24, R.raw.square2, R.drawable.ui_small_square2, R.drawable.ui_medium_square2, R.drawable.ui_big_square2, R.drawable.ui_huge_square2} ,
230
                       {3 , 24, 24, R.raw.square2, R.drawable.ui_small_square2, R.drawable.ui_medium_square2, R.drawable.ui_big_square2, R.drawable.ui_huge_square2} ,
229 231
                     },
230 232
         TwistySquare2.class,
231 233
         new MovementSquare(),
......
237 239
  public static final int NUM_OBJECTS = values().length;
238 240
  public static final int MAX_NUM_OBJECTS;
239 241
  public static final int MAX_LEVEL;
242
  public static final int MAX_SCRAMBLE;
240 243
  public static final int MAX_OBJECT_SIZE;
241 244

  
242
  private final int[] mObjectSizes, mMaxLevels, mSmallIconIDs, mMediumIconIDs, mBigIconIDs, mHugeIconIDs, mResourceIDs;
245
  private final int[] mObjectSizes, mDBLevels, mNumScrambles, mSmallIconIDs, mMediumIconIDs, mBigIconIDs, mHugeIconIDs, mResourceIDs;
243 246
  private final Class<? extends TwistyObject> mObjectClass;
244 247
  private final Movement mObjectMovementClass;
245 248
  private final int mRow, mNumSizes;
......
255 258
    mNumAll = 0;
256 259
    int num, i = 0;
257 260
    objects = new ObjectList[NUM_OBJECTS];
258
    int maxNum  = Integer.MIN_VALUE;
259
    int maxLevel= Integer.MIN_VALUE;
260
    int maxSize = Integer.MIN_VALUE;
261
    int maxNum     = Integer.MIN_VALUE;
262
    int maxLevel   = Integer.MIN_VALUE;
263
    int maxScramble= Integer.MIN_VALUE;
264
    int maxSize    = Integer.MIN_VALUE;
261 265

  
262 266
    for(ObjectList object: ObjectList.values())
263 267
      {
......
269 273

  
270 274
      for(int j=0; j<num; j++)
271 275
        {
272
        if( object.mMaxLevels[j] > maxLevel ) maxLevel = object.mMaxLevels[j];
273
        if( object.mObjectSizes[j] > maxSize) maxSize  = object.mObjectSizes[j];
276
        if( object.mNumScrambles[j]> maxScramble ) maxScramble= object.mNumScrambles[j];
277
        if( object.mDBLevels[j]    > maxLevel    ) maxLevel   = object.mDBLevels[j];
278
        if( object.mObjectSizes[j] > maxSize     ) maxSize    = object.mObjectSizes[j];
274 279
        }
275 280
      }
276 281

  
277 282
    MAX_NUM_OBJECTS = maxNum;
278 283
    MAX_LEVEL       = maxLevel;
284
    MAX_SCRAMBLE    = maxScramble;
279 285
    MAX_OBJECT_SIZE = maxSize;
280 286
    }
281 287

  
......
455 461

  
456 462
///////////////////////////////////////////////////////////////////////////////////////////////////
457 463

  
458
  public static int getMaxLevel(int ordinal, int sizeIndex)
464
  public static int getDBLevel(int ordinal, int sizeIndex)
459 465
    {
460 466
    if( ordinal>=0 && ordinal<NUM_OBJECTS )
461 467
      {
462 468
      int num = objects[ordinal].mObjectSizes.length;
463
      return sizeIndex>=0 && sizeIndex<num ? objects[ordinal].mMaxLevels[sizeIndex] : 0;
469
      return sizeIndex>=0 && sizeIndex<num ? objects[ordinal].mDBLevels[sizeIndex] : 0;
470
      }
471

  
472
    return 0;
473
    }
474

  
475
///////////////////////////////////////////////////////////////////////////////////////////////////
476

  
477
  public static int getNumScramble(int ordinal, int sizeIndex)
478
    {
479
    if( ordinal>=0 && ordinal<NUM_OBJECTS )
480
      {
481
      int num = objects[ordinal].mObjectSizes.length;
482
      return sizeIndex>=0 && sizeIndex<num ? objects[ordinal].mNumScrambles[sizeIndex] : 0;
464 483
      }
465 484

  
466 485
    return 0;
......
529 548
    mNumSizes = info.length;
530 549

  
531 550
    mObjectSizes  = new int[mNumSizes];
532
    mMaxLevels    = new int[mNumSizes];
551
    mDBLevels     = new int[mNumSizes];
552
    mNumScrambles = new int[mNumSizes];
533 553
    mResourceIDs  = new int[mNumSizes];
534 554
    mSmallIconIDs = new int[mNumSizes];
535 555
    mMediumIconIDs= new int[mNumSizes];
......
539 559
    for(int i=0; i<mNumSizes; i++)
540 560
      {
541 561
      mObjectSizes[i]  = info[i][0];
542
      mMaxLevels[i]    = info[i][1];
543
      mResourceIDs[i]  = info[i][2];
544
      mSmallIconIDs[i] = info[i][3];
545
      mMediumIconIDs[i]= info[i][4];
546
      mBigIconIDs[i]   = info[i][5];
547
      mHugeIconIDs[i]  = info[i][6];
562
      mDBLevels[i]     = info[i][1];
563
      mNumScrambles[i] = info[i][2];
564
      mResourceIDs[i]  = info[i][3];
565
      mSmallIconIDs[i] = info[i][4];
566
      mMediumIconIDs[i]= info[i][5];
567
      mBigIconIDs[i]   = info[i][6];
568
      mHugeIconIDs[i]  = info[i][7];
548 569
      }
549 570

  
550 571
    mObjectClass         = object;
......
562 583

  
563 584
///////////////////////////////////////////////////////////////////////////////////////////////////
564 585

  
565
  public int[] getMaxLevels()
586
  public int[] getDBLevels()
587
    {
588
    return mDBLevels;
589
    }
590

  
591
///////////////////////////////////////////////////////////////////////////////////////////////////
592

  
593
  public int[] getNumScrambles()
566 594
    {
567
    return mMaxLevels;
595
    return mNumScrambles;
568 596
    }
569 597

  
570 598
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/screens/RubikScreenPlay.java
178 178
          popupView.setSystemUiVisibility(RubikActivity.FLAGS);
179 179

  
180 180
          final int sizeIndex = ObjectList.getSizeIndex(mObject,mSize);
181
          final int maxLevel = ObjectList.getMaxLevel(mObject, sizeIndex);
182
          final int levelsShown = Math.min(maxLevel,LEVELS_SHOWN);
181
          final int dbLevel = ObjectList.getDBLevel(mObject, sizeIndex);
182
          final int levelsShown = Math.min(dbLevel,LEVELS_SHOWN);
183 183

  
184 184
          mPlayPopup.showAsDropDown(view, margin, margin);
185 185
          mPlayPopup.update(view, mPlayLayoutWidth, (int)(levelsShown*(mMenuItemSize+margin)+3*margin+mMenuItemSize*(LAST_BUTTON-1.0f)));
......
465 465
    mSize  = preferences.getInt("statePlay_size"  , DEF_SIZE  );
466 466

  
467 467
    int sizeIndex = ObjectList.getSizeIndex(mObject,mSize);
468
    int maxLevel = ObjectList.getMaxLevel(mObject, sizeIndex);
468
    int dbLevel = ObjectList.getDBLevel(mObject, sizeIndex);
469 469

  
470 470
    // This means the app has been upgraded to a new version which swapped the
471 471
    // Object for a new one with larger sizeIndex and now getMaxLevel() returns
472 472
    // 0. Reset the object to default, otherwise we'll get a crash later on.
473 473

  
474
    if( maxLevel==0 )
474
    if( dbLevel==0 )
475 475
      {
476 476
      mObject = DEF_OBJECT;
477 477
      mSize   = DEF_SIZE;
......
512 512
  private void adjustLevels(final RubikActivity act)
513 513
    {
514 514
    int sizeIndex = ObjectList.getSizeIndex(mObject,mSize);
515
    int maxLevel = ObjectList.getMaxLevel(mObject, sizeIndex);
516
    int numLevel = Math.min(maxLevel, LEVELS_SHOWN);
515
    int dbLevel = ObjectList.getDBLevel(mObject, sizeIndex);
516
    int numScrambles = ObjectList.getNumScramble(mObject, sizeIndex);
517
    int numLevel = Math.min(dbLevel, LEVELS_SHOWN);
517 518
    String[] levels = new String[numLevel];
518 519

  
519 520
    for(int i=0; i<numLevel-1; i++)
......
526 527
      levels[numLevel-1] = act.getString(R.string.level_full);
527 528
      }
528 529

  
529
    if( mLevelValue>maxLevel || mLevelValue<1 ||
530
       (mLevelValue<maxLevel || mLevelValue>LEVELS_SHOWN ) )
530
    if( mLevelValue>dbLevel || mLevelValue<1 ||
531
       (mLevelValue<dbLevel || mLevelValue>LEVELS_SHOWN ) )
531 532
      {
532 533
      mLevelValue=1;
533 534
      }
......
552 553

  
553 554
    for(int i=0; i<numLevel; i++)
554 555
      {
555
      final int scrambles = i<numLevel-1 ? i+1 : maxLevel;
556
      final int level     = i<numLevel-1 ? i+1 : dbLevel;
557
      final int scrambles = i<numLevel-1 ? i+1 : numScrambles;
556 558
      Button button = new Button(act);
557 559
      button.setLayoutParams(i==0 ? pT : (i==numLevel-1 ? pB : pM));
558 560
      button.setText(levels[i]);
559 561
      button.setTextSize(TypedValue.COMPLEX_UNIT_PX, mMenuTextSize);
560 562

  
561
      int icon = scores.isSolved(mObject, sizeIndex, scrambles-1) ? R.drawable.ui_solved : R.drawable.ui_notsolved;
563
      int icon = scores.isSolved(mObject, sizeIndex, level-1) ? R.drawable.ui_solved : R.drawable.ui_notsolved;
562 564
      button.setCompoundDrawablesWithIntrinsicBounds(icon,0,0,0);
563 565

  
564 566
      button.setOnClickListener( new View.OnClickListener()
......
571 573
          if(pre.isUINotBlocked())
572 574
            {
573 575
            mPlayPopup.dismiss();
574
            mLevelValue = scrambles;
575
            pre.scrambleObject(mLevelValue);
576
            mLevelValue = level;
577
            pre.scrambleObject(scrambles);
576 578
            }
577 579
          }
578 580
        });
src/main/java/org/distorted/tutorials/TutorialState.java
177 177
        int size = play.getSize();
178 178
        int object= play.getObject();
179 179
        int sizeIndex = ObjectList.getSizeIndex(object,size);
180
        int maxLevel = ObjectList.getMaxLevel(object, sizeIndex);
180
        int numScrambles = ObjectList.getNumScramble(object, sizeIndex);
181 181

  
182
        act.getPreRender().scrambleObject(maxLevel);
182
        act.getPreRender().scrambleObject(numScrambles);
183 183
        }
184 184
      });
185 185
    }

Also available in: Unified diff