Project

General

Profile

« Previous | Next » 

Revision 61aa85e4

Added by Leszek Koltunski over 2 years ago

Simplify ObjectList: now there's just one object per size.

View differences:

src/main/java/org/distorted/objectlib/main/ObjectList.java
19 19

  
20 20
package org.distorted.objectlib.main;
21 21

  
22
///////////////////////////////////////////////////////////////////////////////////////////////////
23

  
24
/*
25
  CUBE_2 ( 0, new int[] {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} ),
26
  CUBE_3 ( 0, new int[] {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} ),
27
  CUBE_4 ( 0, new int[] {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} ),
28
  CUBE_5 ( 0, new int[] {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} ),
29
  JING_2 ( 1, new int[] {2 , 11, 11, R.raw.jing , R.drawable.ui_small_jing2, R.drawable.ui_medium_jing2, R.drawable.ui_big_jing2, R.drawable.ui_huge_jing2} ),
30
  PYRA_3 ( 1, new int[] {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} ),
31
  PYRA_4 ( 1, new int[] {4 , 14, 17, R.raw.pyra4, R.drawable.ui_small_pyra4, R.drawable.ui_medium_pyra4, R.drawable.ui_big_pyra4, R.drawable.ui_huge_pyra4} ),
32
  PYRA_5 ( 1, new int[] {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} ),
33
  KILO_3 ( 2, new int[] {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} ),
34
  KILO_5 ( 2, new int[] {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} ),
35
  MEGA_3 ( 2, new int[] {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} ),
36
  MEGA_5 ( 2, new int[] {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} ),
37
  ULTI_2 ( 3, new int[] {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 } ),
38
  DIAM_2 ( 3, new int[] {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} ),
39
  DIAM_3 ( 3, new int[] {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} ),
40
  DIAM_4 ( 3, new int[] {4 , 32, 32, R.raw.diam4, R.drawable.ui_small_diam4, R.drawable.ui_medium_diam4, R.drawable.ui_big_diam4, R.drawable.ui_huge_diam4} ),
41
  DINO_3 ( 4, new int[] {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 } ),
42
  DIN4_3 ( 4, new int[] {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 } ),
43
  REDI_3 ( 4, new int[] {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 } ),
44
  HELI_3 ( 4, new int[] {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 } ),
45
  SKEW_2 ( 5, new int[] {2 , 11, 11, R.raw.skew2, R.drawable.ui_small_skew2, R.drawable.ui_medium_skew2, R.drawable.ui_big_skew2, R.drawable.ui_huge_skew2} ),
46
  SKEW_3 ( 5, new int[] {3 , 17, 21, R.raw.skew3, R.drawable.ui_small_skew3, R.drawable.ui_medium_skew3, R.drawable.ui_big_skew3, R.drawable.ui_huge_skew3} ),
47
  IVY_2  ( 5, new int[] {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  } ),
48
  REX_3  ( 5, new int[] {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  } ),
49
  BAN1_3 ( 6, new int[] {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 } ),
50
  BAN2_3 ( 6, new int[] {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 } ),
51
  BAN3_3 ( 6, new int[] {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 } ),
52
  BAN4_3 ( 6, new int[] {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 } ),
53
  SQU1_3 ( 7, new int[] {3 , 24, 24, R.raw.squa1, R.drawable.ui_small_squa1, R.drawable.ui_medium_squa1, R.drawable.ui_big_squa1, R.drawable.ui_huge_squa1} ),
54
  SQU2_3 ( 7, new int[] {3 , 24, 24, R.raw.squa2, R.drawable.ui_small_squa2, R.drawable.ui_medium_squa2, R.drawable.ui_big_squa2, R.drawable.ui_huge_squa2} ),
55
  MIRR_2 ( 7, new int[] {2 , 12, 12, R.raw.mirr2, R.drawable.ui_small_mirr2, R.drawable.ui_medium_mirr2, R.drawable.ui_big_mirr2, R.drawable.ui_huge_mirr2} ),
56
  MIRR_3 ( 7, new int[] {3 , 16, 17, R.raw.mirr3, R.drawable.ui_small_mirr3, R.drawable.ui_medium_mirr3, R.drawable.ui_big_mirr3, R.drawable.ui_huge_mirr3} ),
57
  ;
58
*/
59

  
60 22
import android.content.res.Resources;
61 23

  
62 24
import org.distorted.library.main.DistortedEffects;
......
86 48
import org.distorted.objectlib.objects.TwistySquare2;
87 49
import org.distorted.objectlib.objects.TwistyUltimate;
88 50

  
51
///////////////////////////////////////////////////////////////////////////////////////////////////
52

  
89 53
public enum ObjectList
90 54
  {
91
  ///////////////////// Size // DB Level // NumScrambles // Mesh // small icon // medium icon // big icon // huge icon
92

  
93
  CUBE (
94
         new int[][] {
95
                       {2 , 12, 12, R.drawable.ui_small_cube2, R.drawable.ui_medium_cube2, R.drawable.ui_big_cube2, R.drawable.ui_huge_cube2} ,
96
                       {3 , 16, 17, R.drawable.ui_small_cube3, R.drawable.ui_medium_cube3, R.drawable.ui_big_cube3, R.drawable.ui_huge_cube3} ,
97
                       {4 , 20, 24, R.drawable.ui_small_cube4, R.drawable.ui_medium_cube4, R.drawable.ui_big_cube4, R.drawable.ui_huge_cube4} ,
98
                       {5 , 24, 28, R.drawable.ui_small_cube5, R.drawable.ui_medium_cube5, R.drawable.ui_big_cube5, R.drawable.ui_huge_cube5}
99
                     },
100
         0
101
       ),
102

  
103
  JING (
104
         new int[][] {
105
                       {2 , 11, 11, R.drawable.ui_small_jing2, R.drawable.ui_medium_jing2, R.drawable.ui_big_jing2, R.drawable.ui_huge_jing2} ,
106
                     },
107
         1
108
       ),
109

  
110
  PYRA (
111
         new int[][] {
112
                       {3 , 10, 10, R.drawable.ui_small_pyra3, R.drawable.ui_medium_pyra3, R.drawable.ui_big_pyra3, R.drawable.ui_huge_pyra3} ,
113
                       {4 , 15, 17, R.drawable.ui_small_pyra4, R.drawable.ui_medium_pyra4, R.drawable.ui_big_pyra4, R.drawable.ui_huge_pyra4} ,
114
                       {5 , 20, 23, R.drawable.ui_small_pyra5, R.drawable.ui_medium_pyra5, R.drawable.ui_big_pyra5, R.drawable.ui_huge_pyra5}
115
                     },
116
         1
117
       ),
118

  
119
  KILO (
120
         new int[][] {
121
                       {3 , 18, 18, R.drawable.ui_small_kilo3, R.drawable.ui_medium_kilo3, R.drawable.ui_big_kilo3, R.drawable.ui_huge_kilo3} ,
122
                       {5 , 33, 33, R.drawable.ui_small_kilo5, R.drawable.ui_medium_kilo5, R.drawable.ui_big_kilo5, R.drawable.ui_huge_kilo5} ,
123
                     },
124
         2
125
       ),
126

  
127
  MEGA (
128
         new int[][] {
129
                       {3 , 21, 21, R.drawable.ui_small_mega3, R.drawable.ui_medium_mega3, R.drawable.ui_big_mega3, R.drawable.ui_huge_mega3} ,
130
                       {5 , 35, 37, R.drawable.ui_small_mega5, R.drawable.ui_medium_mega5, R.drawable.ui_big_mega5, R.drawable.ui_huge_mega5} ,
131
                     },
132
         2
133
       ),
134

  
135
  ULTI (
136
         new int[][] {
137
                       {2 , 18, 18, R.drawable.ui_small_ulti, R.drawable.ui_medium_ulti, R.drawable.ui_big_ulti, R.drawable.ui_huge_ulti} ,
138
                     },
139
         3
140
       ),
141

  
142
  DIAM (
143
         new int[][] {
144
                       {2 , 10, 12, R.drawable.ui_small_diam2, R.drawable.ui_medium_diam2, R.drawable.ui_big_diam2, R.drawable.ui_huge_diam2} ,
145
                       {3 , 18, 24, R.drawable.ui_small_diam3, R.drawable.ui_medium_diam3, R.drawable.ui_big_diam3, R.drawable.ui_huge_diam3} ,
146
                       {4 , 32, 32, R.drawable.ui_small_diam4, R.drawable.ui_medium_diam4, R.drawable.ui_big_diam4, R.drawable.ui_huge_diam4} ,
147
                     },
148
         3
149
       ),
150

  
151
  DINO (
152
         new int[][] {
153
                       {3 , 10, 10, R.drawable.ui_small_dino, R.drawable.ui_medium_dino, R.drawable.ui_big_dino, R.drawable.ui_huge_dino} ,
154
                     },
155
         4
156
       ),
157

  
158
  DIN4 (
159
         new int[][] {
160
                       {3 , 7, 7, R.drawable.ui_small_din4, R.drawable.ui_medium_din4, R.drawable.ui_big_din4, R.drawable.ui_huge_din4} ,
161
                     },
162
         4
163
       ),
164

  
165
  REDI (
166
         new int[][] {
167
                       {3 , 14, 16, R.drawable.ui_small_redi, R.drawable.ui_medium_redi, R.drawable.ui_big_redi, R.drawable.ui_huge_redi} ,
168
                     },
169
         4
170
       ),
171

  
172
  HELI (
173
         new int[][] {
174
                       {3 , 18, 20, R.drawable.ui_small_heli, R.drawable.ui_medium_heli, R.drawable.ui_big_heli, R.drawable.ui_huge_heli} ,
175
                     },
176
         4
177
       ),
178

  
179
  SKEW (
180
         new int[][] {
181
                       {2 , 11, 11, R.drawable.ui_small_skew2, R.drawable.ui_medium_skew2, R.drawable.ui_big_skew2, R.drawable.ui_huge_skew2} ,
182
                       {3 , 17, 21, R.drawable.ui_small_skew3, R.drawable.ui_medium_skew3, R.drawable.ui_big_skew3, R.drawable.ui_huge_skew3} ,
183
                     },
184
         5
185
       ),
186

  
187
  IVY  (
188
         new int[][] {
189
                       {2 , 8, 8, R.drawable.ui_small_ivy, R.drawable.ui_medium_ivy, R.drawable.ui_big_ivy, R.drawable.ui_huge_ivy} ,
190
                     },
191
         5
192
       ),
193

  
194
  REX  (
195
         new int[][] {
196
                       {3 , 16, 19, R.drawable.ui_small_rex, R.drawable.ui_medium_rex, R.drawable.ui_big_rex, R.drawable.ui_huge_rex} ,
197
                     },
198
         5
199
       ),
200

  
201
  BAN1 (
202
         new int[][] {
203
                       {3 , 16, 16, R.drawable.ui_small_ban1, R.drawable.ui_medium_ban1, R.drawable.ui_big_ban1, R.drawable.ui_huge_ban1} ,
204
                     },
205
         6
206
       ),
207

  
208
  BAN2 (
209
         new int[][] {
210
                       {3 , 16, 16, R.drawable.ui_small_ban2, R.drawable.ui_medium_ban2, R.drawable.ui_big_ban2, R.drawable.ui_huge_ban2} ,
211
                     },
212
         6
213
       ),
214

  
215
  BAN3 (
216
         new int[][] {
217
                       {3 , 16, 16, R.drawable.ui_small_ban3, R.drawable.ui_medium_ban3, R.drawable.ui_big_ban3, R.drawable.ui_huge_ban3} ,
218
                     },
219
         6
220
       ),
221

  
222
  BAN4 (
223
         new int[][] {
224
                       {3 , 16, 16, R.drawable.ui_small_ban4, R.drawable.ui_medium_ban4, R.drawable.ui_big_ban4, R.drawable.ui_huge_ban4} ,
225
                     },
226
         6
227
       ),
228

  
229
  SQU1 (
230
         new int[][] {
231
                       {3 , 24, 24, R.drawable.ui_small_squa1, R.drawable.ui_medium_squa1, R.drawable.ui_big_squa1, R.drawable.ui_huge_squa1} ,
232
                     },
233
         7
234
       ),
235

  
236
  SQU2 (
237
         new int[][] {
238
                       {3 , 24, 24, R.drawable.ui_small_squa2, R.drawable.ui_medium_squa2, R.drawable.ui_big_squa2, R.drawable.ui_huge_squa2} ,
239
                     },
240
         7
241
       ),
242

  
243
  MIRR (
244
         new int[][] {
245
                       {2 , 12, 12, R.drawable.ui_small_mirr2, R.drawable.ui_medium_mirr2, R.drawable.ui_big_mirr2, R.drawable.ui_huge_mirr2} ,
246
                       {3 , 16, 17, R.drawable.ui_small_mirr3, R.drawable.ui_medium_mirr3, R.drawable.ui_big_mirr3, R.drawable.ui_huge_mirr3} ,
247
                     },
248
         7
249
       ),
55
  CUBE_2 ( 0, 2, 12, 12, R.drawable.small_cube2, R.drawable.medium_cube2, R.drawable.big_cube2, R.drawable.huge_cube2),
56
  CUBE_3 ( 0, 3, 16, 17, R.drawable.small_cube3, R.drawable.medium_cube3, R.drawable.big_cube3, R.drawable.huge_cube3),
57
  CUBE_4 ( 0, 4, 20, 24, R.drawable.small_cube4, R.drawable.medium_cube4, R.drawable.big_cube4, R.drawable.huge_cube4),
58
  CUBE_5 ( 0, 5, 24, 28, R.drawable.small_cube5, R.drawable.medium_cube5, R.drawable.big_cube5, R.drawable.huge_cube5),
59
  JING_2 ( 1, 2, 11, 11, R.drawable.small_jing2, R.drawable.medium_jing2, R.drawable.big_jing2, R.drawable.huge_jing2),
60
  PYRA_3 ( 1, 3, 10, 10, R.drawable.small_pyra3, R.drawable.medium_pyra3, R.drawable.big_pyra3, R.drawable.huge_pyra3),
61
  PYRA_4 ( 1, 4, 14, 17, R.drawable.small_pyra4, R.drawable.medium_pyra4, R.drawable.big_pyra4, R.drawable.huge_pyra4),
62
  PYRA_5 ( 1, 5, 20, 23, R.drawable.small_pyra5, R.drawable.medium_pyra5, R.drawable.big_pyra5, R.drawable.huge_pyra5),
63
  KILO_3 ( 2, 3, 18, 18, R.drawable.small_kilo3, R.drawable.medium_kilo3, R.drawable.big_kilo3, R.drawable.huge_kilo3),
64
  KILO_5 ( 2, 5, 33, 33, R.drawable.small_kilo5, R.drawable.medium_kilo5, R.drawable.big_kilo5, R.drawable.huge_kilo5),
65
  MEGA_3 ( 2, 3, 21, 21, R.drawable.small_mega3, R.drawable.medium_mega3, R.drawable.big_mega3, R.drawable.huge_mega3),
66
  MEGA_5 ( 2, 5, 35, 37, R.drawable.small_mega5, R.drawable.medium_mega5, R.drawable.big_mega5, R.drawable.huge_mega5),
67
  ULTI_2 ( 3, 2, 18, 18, R.drawable.small_ulti , R.drawable.medium_ulti , R.drawable.big_ulti , R.drawable.huge_ulti ),
68
  DIAM_2 ( 3, 2, 10, 12, R.drawable.small_diam2, R.drawable.medium_diam2, R.drawable.big_diam2, R.drawable.huge_diam2),
69
  DIAM_3 ( 3, 3, 18, 24, R.drawable.small_diam3, R.drawable.medium_diam3, R.drawable.big_diam3, R.drawable.huge_diam3),
70
  DIAM_4 ( 3, 4, 32, 32, R.drawable.small_diam4, R.drawable.medium_diam4, R.drawable.big_diam4, R.drawable.huge_diam4),
71
  DINO_3 ( 4, 3, 10, 10, R.drawable.small_dino , R.drawable.medium_dino , R.drawable.big_dino , R.drawable.huge_dino ),
72
  DIN4_3 ( 4, 3,  7,  7, R.drawable.small_din4 , R.drawable.medium_din4 , R.drawable.big_din4 , R.drawable.huge_din4 ),
73
  REDI_3 ( 4, 3, 14, 16, R.drawable.small_redi , R.drawable.medium_redi , R.drawable.big_redi , R.drawable.huge_redi ),
74
  HELI_3 ( 4, 3, 18, 20, R.drawable.small_heli , R.drawable.medium_heli , R.drawable.big_heli , R.drawable.huge_heli ),
75
  SKEW_2 ( 5, 2, 11, 11, R.drawable.small_skew2, R.drawable.medium_skew2, R.drawable.big_skew2, R.drawable.huge_skew2),
76
  SKEW_3 ( 5, 3, 17, 21, R.drawable.small_skew3, R.drawable.medium_skew3, R.drawable.big_skew3, R.drawable.huge_skew3),
77
  IVY_2  ( 5, 2,  8,  8, R.drawable.small_ivy  , R.drawable.medium_ivy  , R.drawable.big_ivy  , R.drawable.huge_ivy  ),
78
  REX_3  ( 5, 3, 16, 19, R.drawable.small_rex  , R.drawable.medium_rex  , R.drawable.big_rex  , R.drawable.huge_rex  ),
79
  BAN1_3 ( 6, 3, 16, 16, R.drawable.small_ban1 , R.drawable.medium_ban1 , R.drawable.big_ban1 , R.drawable.huge_ban1 ),
80
  BAN2_3 ( 6, 3, 16, 16, R.drawable.small_ban2 , R.drawable.medium_ban2 , R.drawable.big_ban2 , R.drawable.huge_ban2 ),
81
  BAN3_3 ( 6, 3, 16, 16, R.drawable.small_ban3 , R.drawable.medium_ban3 , R.drawable.big_ban3 , R.drawable.huge_ban3 ),
82
  BAN4_3 ( 6, 3, 16, 16, R.drawable.small_ban4 , R.drawable.medium_ban4 , R.drawable.big_ban4 , R.drawable.huge_ban4 ),
83
  SQU1_3 ( 7, 3, 24, 24, R.drawable.small_squa1, R.drawable.medium_squa1, R.drawable.big_squa1, R.drawable.huge_squa1),
84
  SQU2_3 ( 7, 3, 24, 24, R.drawable.small_squa2, R.drawable.medium_squa2, R.drawable.big_squa2, R.drawable.huge_squa2),
85
  MIRR_2 ( 7, 2, 12, 12, R.drawable.small_mirr2, R.drawable.medium_mirr2, R.drawable.big_mirr2, R.drawable.huge_mirr2),
86
  MIRR_3 ( 7, 3, 16, 17, R.drawable.small_mirr3, R.drawable.medium_mirr3, R.drawable.big_mirr3, R.drawable.huge_mirr3),
250 87
  ;
251 88

  
252 89
  public static final int NUM_OBJECTS = values().length;
253
  public static final int MAX_NUM_OBJECTS;
254 90
  public static final int MAX_LEVEL;
255 91
  public static final int MAX_SCRAMBLE;
256 92
  public static final int MAX_OBJECT_SIZE;
257 93

  
258
  private final int[] mObjectSizes, mDBLevels, mNumScrambles, mSmallIconIDs, mMediumIconIDs, mBigIconIDs, mHugeIconIDs;
259
  private final int mRow, mNumSizes;
94
  private final int mRow, mSize, mDBLevels, mNumScrambles;
95
  private final int mSmallIconID, mMediumIconID, mBigIconID, mHugeIconID;
260 96

  
261 97
  private static final ObjectList[] objects;
262
  private static int mNumAll;
263 98
  private static int[] mIndices;
264 99
  private static int mColCount, mRowCount;
265 100

  
266 101
  static
267 102
    {
268
    mNumAll = 0;
269
    int num, i = 0;
103
    int i = 0;
270 104
    objects = new ObjectList[NUM_OBJECTS];
271
    int maxNum     = Integer.MIN_VALUE;
272 105
    int maxLevel   = Integer.MIN_VALUE;
273 106
    int maxScramble= Integer.MIN_VALUE;
274 107
    int maxSize    = Integer.MIN_VALUE;
275 108

  
276 109
    for(ObjectList object: ObjectList.values())
277 110
      {
278
      objects[i] = object;
279
      i++;
280
      num = object.mObjectSizes.length;
281
      mNumAll += num;
282
      if( num> maxNum ) maxNum = num;
283

  
284
      for(int j=0; j<num; j++)
285
        {
286
        if( object.mNumScrambles[j]> maxScramble ) maxScramble= object.mNumScrambles[j];
287
        if( object.mDBLevels[j]    > maxLevel    ) maxLevel   = object.mDBLevels[j];
288
        if( object.mObjectSizes[j] > maxSize     ) maxSize    = object.mObjectSizes[j];
289
        }
111
      objects[i++] = object;
112

  
113
      if( object.mNumScrambles> maxScramble ) maxScramble= object.mNumScrambles;
114
      if( object.mDBLevels    > maxLevel    ) maxLevel   = object.mDBLevels;
115
      if( object.mSize        > maxSize     ) maxSize    = object.mSize;
290 116
      }
291 117

  
292
    MAX_NUM_OBJECTS = maxNum;
293 118
    MAX_LEVEL       = maxLevel;
294 119
    MAX_SCRAMBLE    = maxScramble;
295 120
    MAX_OBJECT_SIZE = maxSize;
......
325 150

  
326 151
    for(int object=0; object<NUM_OBJECTS; object++)
327 152
      {
328
      if( objects[object].mRow == row )
329
        {
330
        num += objects[object].mNumSizes;
331
        }
153
      if( objects[object].mRow == row ) num++;
332 154
      }
333 155

  
334 156
    return num;
......
365 187

  
366 188
  public static ObjectList getObject(int ordinal)
367 189
    {
368
    return ordinal>=0 && ordinal<NUM_OBJECTS ? objects[ordinal] : CUBE;
369
    }
370

  
371
///////////////////////////////////////////////////////////////////////////////////////////////////
372

  
373
  public static int pack(int object, int sizeIndex)
374
    {
375
    int ret = 0;
376
    for(int i=0; i<object; i++) ret += objects[i].mObjectSizes.length;
377

  
378
    return ret+sizeIndex;
190
    return ordinal>=0 && ordinal<NUM_OBJECTS ? objects[ordinal] : CUBE_3;
379 191
    }
380 192

  
381 193
///////////////////////////////////////////////////////////////////////////////////////////////////
382 194

  
383
  public static int unpackSizeIndex(int number)
384
    {
385
    int num;
386

  
387
    for(int i=0; i<NUM_OBJECTS; i++)
388
      {
389
      num = objects[i].mObjectSizes.length;
390
      if( number<num ) return number;
391
      number -= num;
392
      }
393

  
394
    return -1;
395
    }
396

  
397
///////////////////////////////////////////////////////////////////////////////////////////////////
398

  
399
  public static int unpackObject(int number)
195
  public static int getOrdinal(String name)
400 196
    {
401
    int num;
402

  
403 197
    for(int i=0; i<NUM_OBJECTS; i++)
404 198
      {
405
      num = objects[i].mObjectSizes.length;
406
      if( number<num ) return i;
407
      number -= num;
408
      }
409

  
410
    return -1;
411
    }
412

  
413
///////////////////////////////////////////////////////////////////////////////////////////////////
414

  
415
  public static int unpackObjectFromString(String obj)
416
    {
417
    int u = obj.indexOf('_');
418
    int l = obj.length();
419

  
420
    if( u>0 )
421
      {
422
      String name = obj.substring(0,u);
423
      int size = Integer.parseInt( obj.substring(u+1,l) );
424

  
425
      for(int i=0; i<NUM_OBJECTS; i++)
426
        {
427
        if( objects[i].name().equals(name) )
428
          {
429
          int sizeIndex = getSizeIndex(i,size);
430
          return pack(i,sizeIndex);
431
          }
432
        }
199
      if( objects[i].name().equals(name) ) return i;
433 200
      }
434 201

  
435 202
    return -1;
......
439 206

  
440 207
  public static String getObjectList()
441 208
    {
442
    String name;
443 209
    StringBuilder list = new StringBuilder();
444
    int len;
445
    int[] sizes;
446 210

  
447 211
    for(int i=0; i<NUM_OBJECTS; i++)
448 212
      {
449
      sizes = objects[i].mObjectSizes;
450
      len   = sizes.length;
451
      name  = objects[i].name();
452

  
453
      for(int j=0; j<len; j++)
454
        {
455
        if( i>0 || j>0 ) list.append(',');
456
        list.append(name);
457
        list.append('_');
458
        list.append(sizes[j]);
459
        }
213
      if( i>0 ) list.append(',');
214
      list.append(objects[i].name());
460 215
      }
461 216

  
462 217
    return list.toString();
......
464 219

  
465 220
///////////////////////////////////////////////////////////////////////////////////////////////////
466 221

  
467
  public static int getTotal()
468
    {
469
    return mNumAll;
470
    }
471

  
472
///////////////////////////////////////////////////////////////////////////////////////////////////
473

  
474
  public static int getDBLevel(int ordinal, int sizeIndex)
475
    {
476
    if( ordinal>=0 && ordinal<NUM_OBJECTS )
477
      {
478
      int num = objects[ordinal].mObjectSizes.length;
479
      return sizeIndex>=0 && sizeIndex<num ? objects[ordinal].mDBLevels[sizeIndex] : 0;
480
      }
481

  
482
    return 0;
483
    }
484

  
485
///////////////////////////////////////////////////////////////////////////////////////////////////
486

  
487
  public static int getNumScramble(int ordinal, int sizeIndex)
222
  public static int getDBLevel(int ordinal)
488 223
    {
489
    if( ordinal>=0 && ordinal<NUM_OBJECTS )
490
      {
491
      int num = objects[ordinal].mObjectSizes.length;
492
      return sizeIndex>=0 && sizeIndex<num ? objects[ordinal].mNumScrambles[sizeIndex] : 0;
493
      }
494

  
495
    return 0;
224
    return ordinal>=0 && ordinal<NUM_OBJECTS ? objects[ordinal].mDBLevels : 0;
496 225
    }
497 226

  
498 227
///////////////////////////////////////////////////////////////////////////////////////////////////
499 228

  
500
  public static int getOrdinal(String name)
229
  public static int getNumScramble(int ordinal)
501 230
    {
502
    for(int i=0; i<NUM_OBJECTS; i++)
503
      {
504
      if(objects[i].name().equals(name)) return i;
505
      }
506

  
507
    return -1;
508
    }
509

  
510
///////////////////////////////////////////////////////////////////////////////////////////////////
511

  
512
  public static int getSizeIndex(int ordinal, int size)
513
    {
514
    if( ordinal>=0 && ordinal<NUM_OBJECTS )
515
      {
516
      int[] sizes = objects[ordinal].getSizes();
517
      int len = sizes.length;
518

  
519
      for(int i=0; i<len; i++)
520
        {
521
        if( sizes[i]==size ) return i;
522
        }
523
      }
524

  
525
    return -1;
526
    }
527

  
528
///////////////////////////////////////////////////////////////////////////////////////////////////
529

  
530
  ObjectList(int[][] info, int row)
531
    {
532
    mNumSizes = info.length;
533

  
534
    mObjectSizes  = new int[mNumSizes];
535
    mDBLevels     = new int[mNumSizes];
536
    mNumScrambles = new int[mNumSizes];
537
    mSmallIconIDs = new int[mNumSizes];
538
    mMediumIconIDs= new int[mNumSizes];
539
    mBigIconIDs   = new int[mNumSizes];
540
    mHugeIconIDs  = new int[mNumSizes];
541

  
542
    for(int i=0; i<mNumSizes; i++)
543
      {
544
      mObjectSizes[i]  = info[i][0];
545
      mDBLevels[i]     = info[i][1];
546
      mNumScrambles[i] = info[i][2];
547
      mSmallIconIDs[i] = info[i][3];
548
      mMediumIconIDs[i]= info[i][4];
549
      mBigIconIDs[i]   = info[i][5];
550
      mHugeIconIDs[i]  = info[i][6];
551
      }
552

  
553
    mRow  = row;
231
    return ordinal>=0 && ordinal<NUM_OBJECTS ? objects[ordinal].mNumScrambles : 0;
554 232
    }
555 233

  
556 234
///////////////////////////////////////////////////////////////////////////////////////////////////
557 235

  
558
  public int[] getSizes()
236
  ObjectList(int row, int size, int db, int scrambles, int smallIcon, int mediumIcon, int bigIcon, int hugeIcon)
559 237
    {
560
    return mObjectSizes;
238
    mRow         = row;
239
    mSize        = size;
240
    mDBLevels    = db;
241
    mNumScrambles= scrambles;
242
    mSmallIconID = smallIcon;
243
    mMediumIconID= mediumIcon;
244
    mBigIconID   = bigIcon;
245
    mHugeIconID  = hugeIcon;
561 246
    }
562 247

  
563 248
///////////////////////////////////////////////////////////////////////////////////////////////////
564 249

  
565
  public int[] getIconIDs(int size)
250
  public int getIconID(int size)
566 251
    {
567 252
    switch(size)
568 253
      {
569
      case 0: return mSmallIconIDs;
570
      case 1: return mMediumIconIDs;
571
      case 2: return mBigIconIDs;
572
      case 3: return mHugeIconIDs;
254
      case 0: return mSmallIconID;
255
      case 1: return mMediumIconID;
256
      case 2: return mBigIconID;
257
      case 3: return mHugeIconID;
573 258
      }
574 259

  
575
    return mSmallIconIDs;
260
    return mSmallIconID;
576 261
    }
577 262

  
578 263
///////////////////////////////////////////////////////////////////////////////////////////////////
579 264

  
580
  public TwistyObject create(int size, Static4D quat, int[][] moves, Resources res, int scrWidth)
265
  public TwistyObject create(Static4D quat, int[][] moves, Resources res, int scrWidth)
581 266
    {
582 267
    DistortedTexture texture = new DistortedTexture();
583 268
    DistortedEffects effects = new DistortedEffects();
......
585 270

  
586 271
    switch(ordinal())
587 272
      {
588
      case  0: return new TwistyCube          (size, quat, texture, mesh, effects, moves, res, scrWidth);
589
      case  1: return new TwistyJing          (size, quat, texture, mesh, effects, moves, res, scrWidth);
590
      case  2: return new TwistyPyraminx      (size, quat, texture, mesh, effects, moves, res, scrWidth);
591
      case  3: return new TwistyKilominx      (size, quat, texture, mesh, effects, moves, res, scrWidth);
592
      case  4: return new TwistyMegaminx      (size, quat, texture, mesh, effects, moves, res, scrWidth);
593
      case  5: return new TwistyUltimate      (size, quat, texture, mesh, effects, moves, res, scrWidth);
594
      case  6: return new TwistyDiamond       (size, quat, texture, mesh, effects, moves, res, scrWidth);
595
      case  7: return new TwistyDino6         (size, quat, texture, mesh, effects, moves, res, scrWidth);
596
      case  8: return new TwistyDino4         (size, quat, texture, mesh, effects, moves, res, scrWidth);
597
      case  9: return new TwistyRedi          (size, quat, texture, mesh, effects, moves, res, scrWidth);
598
      case 10: return new TwistyHelicopter    (size, quat, texture, mesh, effects, moves, res, scrWidth);
599
      case 11: return new TwistySkewb         (size, quat, texture, mesh, effects, moves, res, scrWidth);
600
      case 12: return new TwistyIvy           (size, quat, texture, mesh, effects, moves, res, scrWidth);
601
      case 13: return new TwistyRex           (size, quat, texture, mesh, effects, moves, res, scrWidth);
602
      case 14: return new TwistyBandagedFused (size, quat, texture, mesh, effects, moves, res, scrWidth);
603
      case 15: return new TwistyBandaged2Bar  (size, quat, texture, mesh, effects, moves, res, scrWidth);
604
      case 16: return new TwistyBandaged3Plate(size, quat, texture, mesh, effects, moves, res, scrWidth);
605
      case 17: return new TwistyBandagedEvil  (size, quat, texture, mesh, effects, moves, res, scrWidth);
606
      case 18: return new TwistySquare1       (size, quat, texture, mesh, effects, moves, res, scrWidth);
607
      case 19: return new TwistySquare2       (size, quat, texture, mesh, effects, moves, res, scrWidth);
608
      case 20: return new TwistyMirror        (size, quat, texture, mesh, effects, moves, res, scrWidth);
273
      case  0: return new TwistyCube          (objects[ 0].mSize, quat, texture, mesh, effects, moves, res, scrWidth);
274
      case  1: return new TwistyCube          (objects[ 1].mSize, quat, texture, mesh, effects, moves, res, scrWidth);
275
      case  2: return new TwistyCube          (objects[ 2].mSize, quat, texture, mesh, effects, moves, res, scrWidth);
276
      case  3: return new TwistyCube          (objects[ 3].mSize, quat, texture, mesh, effects, moves, res, scrWidth);
277
      case  4: return new TwistyJing          (objects[ 4].mSize, quat, texture, mesh, effects, moves, res, scrWidth);
278
      case  5: return new TwistyPyraminx      (objects[ 5].mSize, quat, texture, mesh, effects, moves, res, scrWidth);
279
      case  6: return new TwistyPyraminx      (objects[ 6].mSize, quat, texture, mesh, effects, moves, res, scrWidth);
280
      case  7: return new TwistyPyraminx      (objects[ 7].mSize, quat, texture, mesh, effects, moves, res, scrWidth);
281
      case  8: return new TwistyKilominx      (objects[ 8].mSize, quat, texture, mesh, effects, moves, res, scrWidth);
282
      case  9: return new TwistyKilominx      (objects[ 9].mSize, quat, texture, mesh, effects, moves, res, scrWidth);
283
      case 10: return new TwistyMegaminx      (objects[10].mSize, quat, texture, mesh, effects, moves, res, scrWidth);
284
      case 11: return new TwistyMegaminx      (objects[11].mSize, quat, texture, mesh, effects, moves, res, scrWidth);
285
      case 12: return new TwistyUltimate      (objects[12].mSize, quat, texture, mesh, effects, moves, res, scrWidth);
286
      case 13: return new TwistyDiamond       (objects[13].mSize, quat, texture, mesh, effects, moves, res, scrWidth);
287
      case 14: return new TwistyDiamond       (objects[14].mSize, quat, texture, mesh, effects, moves, res, scrWidth);
288
      case 15: return new TwistyDiamond       (objects[15].mSize, quat, texture, mesh, effects, moves, res, scrWidth);
289
      case 16: return new TwistyDino6         (objects[16].mSize, quat, texture, mesh, effects, moves, res, scrWidth);
290
      case 17: return new TwistyDino4         (objects[17].mSize, quat, texture, mesh, effects, moves, res, scrWidth);
291
      case 18: return new TwistyRedi          (objects[18].mSize, quat, texture, mesh, effects, moves, res, scrWidth);
292
      case 19: return new TwistyHelicopter    (objects[19].mSize, quat, texture, mesh, effects, moves, res, scrWidth);
293
      case 20: return new TwistySkewb         (objects[20].mSize, quat, texture, mesh, effects, moves, res, scrWidth);
294
      case 21: return new TwistySkewb         (objects[21].mSize, quat, texture, mesh, effects, moves, res, scrWidth);
295
      case 22: return new TwistyIvy           (objects[22].mSize, quat, texture, mesh, effects, moves, res, scrWidth);
296
      case 23: return new TwistyRex           (objects[23].mSize, quat, texture, mesh, effects, moves, res, scrWidth);
297
      case 24: return new TwistyBandagedFused (objects[24].mSize, quat, texture, mesh, effects, moves, res, scrWidth);
298
      case 25: return new TwistyBandaged2Bar  (objects[25].mSize, quat, texture, mesh, effects, moves, res, scrWidth);
299
      case 26: return new TwistyBandaged3Plate(objects[26].mSize, quat, texture, mesh, effects, moves, res, scrWidth);
300
      case 27: return new TwistyBandagedEvil  (objects[27].mSize, quat, texture, mesh, effects, moves, res, scrWidth);
301
      case 28: return new TwistySquare1       (objects[28].mSize, quat, texture, mesh, effects, moves, res, scrWidth);
302
      case 29: return new TwistySquare2       (objects[29].mSize, quat, texture, mesh, effects, moves, res, scrWidth);
303
      case 30: return new TwistyMirror        (objects[30].mSize, quat, texture, mesh, effects, moves, res, scrWidth);
304
      case 31: return new TwistyMirror        (objects[31].mSize, quat, texture, mesh, effects, moves, res, scrWidth);
609 305
      }
610 306

  
611 307
    return null;

Also available in: Unified diff