Project

General

Profile

« Previous | Next » 

Revision ad9f5cae

Added by Leszek Koltunski over 2 years ago

Correct a recently introduced bug with restoring records.
Slightely simplify ObjectType.

View differences:

src/main/java/org/distorted/objectlib/main/ObjectType.java
25 25
import org.distorted.library.main.DistortedTexture;
26 26
import org.distorted.library.mesh.MeshSquare;
27 27
import org.distorted.library.type.Static4D;
28

  
28 29
import org.distorted.objectlib.R;
29
import org.distorted.objectlib.objects.TwistyBandaged2Bar;
30
import org.distorted.objectlib.objects.TwistyBandaged3Plate;
31
import org.distorted.objectlib.objects.TwistyBandagedEvil;
32
import org.distorted.objectlib.objects.TwistyBandagedFused;
33
import org.distorted.objectlib.objects.TwistyCube;
34
import org.distorted.objectlib.objects.TwistyDiamond;
35
import org.distorted.objectlib.objects.TwistyDino4;
36
import org.distorted.objectlib.objects.TwistyDino6;
37
import org.distorted.objectlib.objects.TwistyHelicopter;
38
import org.distorted.objectlib.objects.TwistyIvy;
39
import org.distorted.objectlib.objects.TwistyJing;
40
import org.distorted.objectlib.objects.TwistyKilominx;
41
import org.distorted.objectlib.objects.TwistyMegaminx;
42
import org.distorted.objectlib.objects.TwistyMirror;
43
import org.distorted.objectlib.objects.TwistyPyraminx;
44
import org.distorted.objectlib.objects.TwistyRedi;
45
import org.distorted.objectlib.objects.TwistyRex;
46
import org.distorted.objectlib.objects.TwistySkewb;
47
import org.distorted.objectlib.objects.TwistySquare1;
48
import org.distorted.objectlib.objects.TwistySquare2;
49
import org.distorted.objectlib.objects.TwistyUltimate;
30
import org.distorted.objectlib.objects.*;
50 31

  
51 32
///////////////////////////////////////////////////////////////////////////////////////////////////
52 33

  
......
87 68
  ;
88 69

  
89 70
  public static final int NUM_OBJECTS = values().length;
90
  public static final int MAX_LEVEL;
91
  public static final int MAX_SCRAMBLE;
92
  public static final int MAX_OBJECT_SIZE;
71
  public static final int MAX_LEVEL,MAX_SCRAMBLE,MAX_OBJECT_SIZE;
93 72

  
94 73
  private final int mRow, mSize, mDBLevels, mNumScrambles;
95
  private final int mSmallIconID, mMediumIconID, mBigIconID, mHugeIconID;
74
  private final int mSmallIcon, mMediumIcon, mBigIcon, mHugeIcon;
96 75

  
97 76
  private static final ObjectType[] objects;
98 77
  private static int[] mIndices;
......
161 140
  public static int getColumnCount()
162 141
    {
163 142
    if( mIndices==null ) setUpColAndRow();
164

  
165 143
    return mColCount;
166 144
    }
167 145

  
......
170 148
  public static int getRowCount()
171 149
    {
172 150
    if( mIndices==null ) setUpColAndRow();
173

  
174 151
    return mRowCount;
175 152
    }
176 153

  
......
179 156
  public static int[] getIndices()
180 157
    {
181 158
    if( mIndices==null ) setUpColAndRow();
182

  
183 159
    return mIndices;
184 160
    }
185 161

  
......
233 209

  
234 210
///////////////////////////////////////////////////////////////////////////////////////////////////
235 211

  
236
  ObjectType(int row, int size, int db, int scrambles, int smallIcon, int mediumIcon, int bigIcon, int hugeIcon)
212
  ObjectType(int row, int size, int db, int scrambles, int sIcon, int mIcon, int bIcon, int hIcon)
237 213
    {
238 214
    mRow         = row;
239 215
    mSize        = size;
240 216
    mDBLevels    = db;
241 217
    mNumScrambles= scrambles;
242
    mSmallIconID = smallIcon;
243
    mMediumIconID= mediumIcon;
244
    mBigIconID   = bigIcon;
245
    mHugeIconID  = hugeIcon;
218
    mSmallIcon   = sIcon;
219
    mMediumIcon  = mIcon;
220
    mBigIcon     = bIcon;
221
    mHugeIcon    = hIcon;
246 222
    }
247 223

  
248 224
///////////////////////////////////////////////////////////////////////////////////////////////////
......
251 227
    {
252 228
    switch(size)
253 229
      {
254
      case 0: return mSmallIconID;
255
      case 1: return mMediumIconID;
256
      case 2: return mBigIconID;
257
      case 3: return mHugeIconID;
230
      case 0: return mSmallIcon;
231
      case 1: return mMediumIcon;
232
      case 2: return mBigIcon;
233
      case 3: return mHugeIcon;
258 234
      }
259 235

  
260
    return mSmallIconID;
236
    return mSmallIcon;
261 237
    }
262 238

  
263 239
///////////////////////////////////////////////////////////////////////////////////////////////////
......
268 244
    DistortedEffects effects = new DistortedEffects();
269 245
    MeshSquare mesh          = new MeshSquare(20,20);   // mesh of the node, not of the cubits
270 246

  
271
    switch(ordinal())
247
    int ord = ordinal();
248
    int size= objects[ord].mSize;
249

  
250
    switch(ord)
272 251
      {
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);
252
      case  0:
253
      case  1:
254
      case  2:
255
      case  3: return new TwistyCube          (size, quat, texture, mesh, effects, moves, res, scrWidth);
256
      case  4: return new TwistyJing          (size, quat, texture, mesh, effects, moves, res, scrWidth);
257
      case  5:
258
      case  6:
259
      case  7: return new TwistyPyraminx      (size, quat, texture, mesh, effects, moves, res, scrWidth);
260
      case  8:
261
      case  9: return new TwistyKilominx      (size, quat, texture, mesh, effects, moves, res, scrWidth);
262
      case 10:
263
      case 11: return new TwistyMegaminx      (size, quat, texture, mesh, effects, moves, res, scrWidth);
264
      case 12: return new TwistyUltimate      (size, quat, texture, mesh, effects, moves, res, scrWidth);
265
      case 13:
266
      case 14:
267
      case 15: return new TwistyDiamond       (size, quat, texture, mesh, effects, moves, res, scrWidth);
268
      case 16: return new TwistyDino6         (size, quat, texture, mesh, effects, moves, res, scrWidth);
269
      case 17: return new TwistyDino4         (size, quat, texture, mesh, effects, moves, res, scrWidth);
270
      case 18: return new TwistyRedi          (size, quat, texture, mesh, effects, moves, res, scrWidth);
271
      case 19: return new TwistyHelicopter    (size, quat, texture, mesh, effects, moves, res, scrWidth);
272
      case 20:
273
      case 21: return new TwistySkewb         (size, quat, texture, mesh, effects, moves, res, scrWidth);
274
      case 22: return new TwistyIvy           (size, quat, texture, mesh, effects, moves, res, scrWidth);
275
      case 23: return new TwistyRex           (size, quat, texture, mesh, effects, moves, res, scrWidth);
276
      case 24: return new TwistyBandagedFused (size, quat, texture, mesh, effects, moves, res, scrWidth);
277
      case 25: return new TwistyBandaged2Bar  (size, quat, texture, mesh, effects, moves, res, scrWidth);
278
      case 26: return new TwistyBandaged3Plate(size, quat, texture, mesh, effects, moves, res, scrWidth);
279
      case 27: return new TwistyBandagedEvil  (size, quat, texture, mesh, effects, moves, res, scrWidth);
280
      case 28: return new TwistySquare1       (size, quat, texture, mesh, effects, moves, res, scrWidth);
281
      case 29: return new TwistySquare2       (size, quat, texture, mesh, effects, moves, res, scrWidth);
282
      case 30:
283
      case 31: return new TwistyMirror        (size, quat, texture, mesh, effects, moves, res, scrWidth);
305 284
      }
306 285

  
307 286
    return null;

Also available in: Unified diff