Project

General

Profile

« Previous | Next » 

Revision e9a87113

Added by Leszek Koltunski about 3 years ago

Move the Movement class from ObjectList to individual object classes.

View differences:

src/main/java/org/distorted/main/RubikPreRender.java
129 129
    if( mNewObject!=null )
130 130
      {
131 131
      mNewObject.createTexture();
132
      mView.setMovement(object.getObjectMovementClass());
132
      mView.setMovement(mNewObject.getMovement());
133 133

  
134 134
      if( firstTime ) mNewObject.restorePreferences(mPreferences);
135 135

  
src/main/java/org/distorted/objects/ObjectList.java
44 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}
45 45
                     },
46 46
         TwistyCube.class,
47
         new MovementCube(),
48 47
         0,
49 48
         60
50 49
       ),
......
54 53
                       {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} ,
55 54
                     },
56 55
         TwistyJing.class,
57
         new MovementJing(),
58 56
         1,
59 57
         30
60 58
       ),
......
66 64
                       {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}
67 65
                     },
68 66
         TwistyPyraminx.class,
69
         new MovementPyraminx(),
70 67
         1,
71 68
         30
72 69
       ),
......
77 74
                       {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} ,
78 75
                     },
79 76
         TwistyKilominx.class,
80
         new MovementMinx(),
81 77
         2,
82 78
         30
83 79
       ),
......
88 84
                       {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} ,
89 85
                     },
90 86
         TwistyMegaminx.class,
91
         new MovementMinx(),
92 87
         2,
93 88
         30
94 89
       ),
......
98 93
                       {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} ,
99 94
                     },
100 95
         TwistyUltimate.class,
101
         new MovementUltimate(),
102 96
         3,
103 97
         30
104 98
       ),
......
110 104
                       {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} ,
111 105
                     },
112 106
         TwistyDiamond.class,
113
         new MovementDiamond(),
114 107
         3,
115 108
         60
116 109
       ),
......
120 113
                       {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} ,
121 114
                     },
122 115
         TwistyDino6.class,
123
         new MovementCornerTwisting(),
124 116
         4,
125 117
         60
126 118
       ),
......
130 122
                       {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} ,
131 123
                     },
132 124
         TwistyDino4.class,
133
         new MovementCornerTwisting(),
134 125
         4,
135 126
         60
136 127
       ),
......
140 131
                       {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} ,
141 132
                     },
142 133
         TwistyRedi.class,
143
         new MovementCornerTwisting(),
144 134
         4,
145 135
         60
146 136
       ),
......
150 140
                       {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} ,
151 141
                     },
152 142
         TwistyHelicopter.class,
153
         new MovementHelicopter(),
154 143
         4,
155 144
         60
156 145
       ),
......
161 150
                       {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} ,
162 151
                     },
163 152
         TwistySkewb.class,
164
         new MovementCornerTwisting(),
165 153
         5,
166 154
         60
167 155
       ),
......
171 159
                       {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} ,
172 160
                     },
173 161
         TwistyIvy.class,
174
         new MovementIvy(),
175 162
         5,
176 163
         60
177 164
       ),
......
181 168
                       {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} ,
182 169
                     },
183 170
         TwistyRex.class,
184
         new MovementCornerTwisting(),
185 171
         5,
186 172
         60
187 173
       ),
......
191 177
                       {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} ,
192 178
                     },
193 179
         TwistyBandagedFused.class,
194
         new MovementCube(),
195 180
         6,
196 181
         60
197 182
       ),
......
201 186
                       {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} ,
202 187
                     },
203 188
         TwistyBandaged2Bar.class,
204
         new MovementCube(),
205 189
         6,
206 190
         60
207 191
       ),
......
211 195
                       {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} ,
212 196
                     },
213 197
         TwistyBandaged3Plate.class,
214
         new MovementCube(),
215 198
         6,
216 199
         60
217 200
       ),
......
221 204
                       {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} ,
222 205
                     },
223 206
         TwistyBandagedEvil.class,
224
         new MovementCube(),
225 207
         6,
226 208
         60
227 209
       ),
......
231 213
                       {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} ,
232 214
                     },
233 215
         TwistySquare1.class,
234
         new MovementSquare(),
235 216
         7,
236 217
         60
237 218
       ),
......
241 222
                       {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} ,
242 223
                     },
243 224
         TwistySquare2.class,
244
         new MovementSquare(),
245 225
         7,
246 226
         60
247 227
       ),
......
252 232
                       {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} ,
253 233
                     },
254 234
         TwistyMirror.class,
255
         new MovementCube(),
256 235
         7,
257 236
         60
258 237
       ),
......
266 245

  
267 246
  private final int[] mObjectSizes, mDBLevels, mNumScrambles, mSmallIconIDs, mMediumIconIDs, mBigIconIDs, mHugeIconIDs, mResourceIDs;
268 247
  private final Class<? extends TwistyObject> mObjectClass;
269
  private final Movement mObjectMovementClass;
270 248
  private final int mRow, mNumSizes;
271 249
  private final int mFOV;
272 250

  
......
565 543

  
566 544
///////////////////////////////////////////////////////////////////////////////////////////////////
567 545

  
568
  ObjectList(int[][] info, Class<? extends TwistyObject> object , Movement movement, int row, int fov)
546
  ObjectList(int[][] info, Class<? extends TwistyObject> object , int row, int fov)
569 547
    {
570 548
    mNumSizes = info.length;
571 549

  
......
590 568
      mHugeIconIDs[i]  = info[i][7];
591 569
      }
592 570

  
593
    mObjectClass         = object;
594
    mObjectMovementClass = movement;
595
    mRow                 = row;
596
    mFOV                 = fov;
571
    mObjectClass= object;
572
    mRow        = row;
573
    mFOV        = fov;
597 574
    }
598 575

  
599 576
///////////////////////////////////////////////////////////////////////////////////////////////////
......
688 665

  
689 666
    return null;
690 667
    }
691

  
692
///////////////////////////////////////////////////////////////////////////////////////////////////
693

  
694
  public Movement getObjectMovementClass()
695
    {
696
    return mObjectMovementClass;
697
    }
698 668
  }
src/main/java/org/distorted/objects/TwistyBandagedAbstract.java
66 66
  private Static4D[] mInitQuats;
67 67
  private int[][] mAxisMap;
68 68
  private int[][] mFaceMap;
69
  private Movement mMovement;
69 70
  ScrambleState[] mStates;
70 71
  float[][] POSITIONS;
71 72
  int[] QUAT_INDICES;
......
468 469
    return ROT_AXIS;
469 470
    }
470 471

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

  
474
  public Movement getMovement()
475
    {
476
    if( mMovement==null ) mMovement = new MovementCube();
477
    return mMovement;
478
    }
479

  
471 480
///////////////////////////////////////////////////////////////////////////////////////////////////
472 481

  
473 482
  public int[] getBasicAngle()
src/main/java/org/distorted/objects/TwistyCube.java
53 53
  private Static4D[] mQuats;
54 54
  private int[] mBasicAngle;
55 55
  private ObjectSticker[] mStickers;
56
  private Movement mMovement;
56 57

  
57 58
///////////////////////////////////////////////////////////////////////////////////////////////////
58 59

  
......
365 366
    return ROT_AXIS;
366 367
    }
367 368

  
369
///////////////////////////////////////////////////////////////////////////////////////////////////
370

  
371
  public Movement getMovement()
372
    {
373
    if( mMovement==null ) mMovement = new MovementCube();
374
    return mMovement;
375
    }
376

  
368 377
///////////////////////////////////////////////////////////////////////////////////////////////////
369 378

  
370 379
  public int[] getBasicAngle()
src/main/java/org/distorted/objects/TwistyDiamond.java
60 60
  private Static4D[] mQuats;
61 61
  private int[] mTetraToFaceMap;
62 62
  private ObjectSticker[] mStickers;
63
  private Movement mMovement;
63 64

  
64 65
///////////////////////////////////////////////////////////////////////////////////////////////////
65 66

  
......
519 520
    return ROT_AXIS;
520 521
    }
521 522

  
523
///////////////////////////////////////////////////////////////////////////////////////////////////
524

  
525
  public Movement getMovement()
526
    {
527
    if( mMovement==null ) mMovement = new MovementDiamond();
528
    return mMovement;
529
    }
530

  
522 531
///////////////////////////////////////////////////////////////////////////////////////////////////
523 532

  
524 533
  public int[] getBasicAngle()
src/main/java/org/distorted/objects/TwistyDino.java
54 54
  private Static4D[] mQuats;
55 55
  private ObjectSticker[] mStickers;
56 56
  private float[][] mCenters;
57
  private Movement mMovement;
57 58
  ScrambleState[] mStates;
58 59

  
59 60
///////////////////////////////////////////////////////////////////////////////////////////////////
......
231 232
    return ROT_AXIS;
232 233
    }
233 234

  
235
///////////////////////////////////////////////////////////////////////////////////////////////////
236

  
237
  public Movement getMovement()
238
    {
239
    if( mMovement==null ) mMovement = new MovementCornerTwisting();
240
    return mMovement;
241
    }
242

  
234 243
///////////////////////////////////////////////////////////////////////////////////////////////////
235 244

  
236 245
  public int[] getBasicAngle()
src/main/java/org/distorted/objects/TwistyHelicopter.java
62 62
  private int[] mQuatIndices;
63 63
  private int[][] mFaceMap;
64 64
  private ObjectSticker[] mStickers;
65
  private Movement mMovement;
65 66

  
66 67
///////////////////////////////////////////////////////////////////////////////////////////////////
67 68

  
......
433 434
    return ROT_AXIS;
434 435
    }
435 436

  
437
///////////////////////////////////////////////////////////////////////////////////////////////////
438

  
439
  public Movement getMovement()
440
    {
441
    if( mMovement==null ) mMovement = new MovementHelicopter();
442
    return mMovement;
443
    }
444

  
436 445
///////////////////////////////////////////////////////////////////////////////////////////////////
437 446

  
438 447
  public int[] getBasicAngle()
src/main/java/org/distorted/objects/TwistyIvy.java
61 61
  private Static4D[] mQuats;
62 62
  private int[][] mFaceMap;
63 63
  private ObjectSticker[] mStickers;
64
  private Movement mMovement;
64 65

  
65 66
///////////////////////////////////////////////////////////////////////////////////////////////////
66 67

  
......
466 467
    return ROT_AXIS;
467 468
    }
468 469

  
470
///////////////////////////////////////////////////////////////////////////////////////////////////
471

  
472
  public Movement getMovement()
473
    {
474
    if( mMovement==null ) mMovement = new MovementIvy();
475
    return mMovement;
476
    }
477

  
469 478
///////////////////////////////////////////////////////////////////////////////////////////////////
470 479

  
471 480
  public int[] getBasicAngle()
src/main/java/org/distorted/objects/TwistyJing.java
60 60
  private float[][] mCenters;
61 61
  private int[][] mFaceMap;
62 62
  private ObjectSticker[] mStickers;
63
  private Movement mMovement;
63 64

  
64 65
///////////////////////////////////////////////////////////////////////////////////////////////////
65 66

  
......
421 422
    return ROT_AXIS;
422 423
    }
423 424

  
425
///////////////////////////////////////////////////////////////////////////////////////////////////
426

  
427
  public Movement getMovement()
428
    {
429
    if( mMovement==null ) mMovement = new MovementJing();
430
    return mMovement;
431
    }
432

  
424 433
///////////////////////////////////////////////////////////////////////////////////////////////////
425 434

  
426 435
  public int[] getBasicAngle()
src/main/java/org/distorted/objects/TwistyMinx.java
82 82
  private ScrambleState[] mStates;
83 83
  private int[] mBasicAngle;
84 84
  private int[] mFaceMap;
85
  private Movement mMovement;
85 86
  Static4D[] mQuats;
86 87
  float[][] mCenterCoords;
87 88
  float[][] mCorners;
......
569 570
    return ROT_AXIS;
570 571
    }
571 572

  
573
///////////////////////////////////////////////////////////////////////////////////////////////////
574

  
575
  public Movement getMovement()
576
    {
577
    if( mMovement==null ) mMovement = new MovementMinx();
578
    return mMovement;
579
    }
580

  
572 581
///////////////////////////////////////////////////////////////////////////////////////////////////
573 582

  
574 583
  public int[] getBasicAngle()
src/main/java/org/distorted/objects/TwistyMirror.java
52 52
  private int[] mBasicAngle;
53 53
  private ObjectSticker[] mStickers;
54 54
  private float[][] mPositions;
55
  private Movement mMovement;
55 56

  
56 57
///////////////////////////////////////////////////////////////////////////////////////////////////
57 58

  
......
646 647
    return ROT_AXIS;
647 648
    }
648 649

  
650
///////////////////////////////////////////////////////////////////////////////////////////////////
651

  
652
  public Movement getMovement()
653
    {
654
    if( mMovement==null ) mMovement = new MovementCube();
655
    return mMovement;
656
    }
657

  
649 658
///////////////////////////////////////////////////////////////////////////////////////////////////
650 659

  
651 660
  public int[] getBasicAngle()
src/main/java/org/distorted/objects/TwistyObject.java
1302 1302
  abstract int getSolvedFunctionIndex();
1303 1303
  abstract ScrambleState[] getScrambleStates();
1304 1304

  
1305
  public abstract Movement getMovement();
1305 1306
  public abstract Static3D[] getRotationAxis();
1306 1307
  public abstract int[] getBasicAngle();
1307 1308
  public abstract int getObjectName(int numLayers);
src/main/java/org/distorted/objects/TwistyPyraminx.java
53 53
  private int[] mBasicAngle;
54 54
  private Static4D[] mQuats;
55 55
  private ObjectSticker[] mStickers;
56
  private Movement mMovement;
56 57

  
57 58
///////////////////////////////////////////////////////////////////////////////////////////////////
58 59

  
......
394 395
    return ROT_AXIS;
395 396
    }
396 397

  
398
///////////////////////////////////////////////////////////////////////////////////////////////////
399

  
400
  public Movement getMovement()
401
    {
402
    if( mMovement==null ) mMovement = new MovementPyraminx();
403
    return mMovement;
404
    }
405

  
397 406
///////////////////////////////////////////////////////////////////////////////////////////////////
398 407

  
399 408
  public int[] getBasicAngle()
src/main/java/org/distorted/objects/TwistyRedi.java
59 59
  private float[][] mCenters;
60 60
  private int[][] mFaceMap;
61 61
  private ObjectSticker[] mStickers;
62
  private Movement mMovement;
62 63

  
63 64
///////////////////////////////////////////////////////////////////////////////////////////////////
64 65

  
......
431 432
    return ROT_AXIS;
432 433
    }
433 434

  
435
///////////////////////////////////////////////////////////////////////////////////////////////////
436

  
437
  public Movement getMovement()
438
    {
439
    if( mMovement==null ) mMovement = new MovementCornerTwisting();
440
    return mMovement;
441
    }
442

  
434 443
///////////////////////////////////////////////////////////////////////////////////////////////////
435 444

  
436 445
  public int[] getBasicAngle()
src/main/java/org/distorted/objects/TwistyRex.java
58 58
  private Static4D[] mQuats;
59 59
  private int[][] mFaceMap;
60 60
  private ObjectSticker[] mStickers;
61
  private Movement mMovement;
61 62

  
62 63
///////////////////////////////////////////////////////////////////////////////////////////////////
63 64

  
......
462 463
    return ROT_AXIS;
463 464
    }
464 465

  
466
///////////////////////////////////////////////////////////////////////////////////////////////////
467

  
468
  public Movement getMovement()
469
    {
470
    if( mMovement==null ) mMovement = new MovementCornerTwisting();
471
    return mMovement;
472
    }
473

  
465 474
///////////////////////////////////////////////////////////////////////////////////////////////////
466 475

  
467 476
  public int[] getBasicAngle()
src/main/java/org/distorted/objects/TwistySkewb.java
56 56
  private Static4D[] mQuats;
57 57
  private int[][] mCornerMap,mEdgeMap,mCenterMap;
58 58
  private ObjectSticker[] mStickers;
59
  private Movement mMovement;
59 60

  
60 61
///////////////////////////////////////////////////////////////////////////////////////////////////
61 62

  
......
571 572
    return ROT_AXIS;
572 573
    }
573 574

  
575
///////////////////////////////////////////////////////////////////////////////////////////////////
576

  
577
  public Movement getMovement()
578
    {
579
    if( mMovement==null ) mMovement = new MovementCornerTwisting();
580
    return mMovement;
581
    }
582

  
574 583
///////////////////////////////////////////////////////////////////////////////////////////////////
575 584

  
576 585
  public int[] getBasicAngle()
src/main/java/org/distorted/objects/TwistySquare.java
54 54
    };
55 55

  
56 56
  private int[] mBasicAngle;
57
  private Movement mMovement;
57 58
  Static4D[] mQuats;
58 59

  
59 60
///////////////////////////////////////////////////////////////////////////////////////////////////
......
170 171
    return ROT_AXIS;
171 172
    }
172 173

  
174
///////////////////////////////////////////////////////////////////////////////////////////////////
175

  
176
  public Movement getMovement()
177
    {
178
    if( mMovement==null ) mMovement = new MovementSquare();
179
    return mMovement;
180
    }
181

  
173 182
///////////////////////////////////////////////////////////////////////////////////////////////////
174 183

  
175 184
  public int[] getBasicAngle()
src/main/java/org/distorted/objects/TwistyUltimate.java
78 78
  private float[][] mCenters;
79 79
  private int[] mQuatIndex;
80 80
  private ObjectSticker[] mStickers;
81
  private Movement mMovement;
81 82

  
82 83
///////////////////////////////////////////////////////////////////////////////////////////////////
83 84

  
......
433 434
    return ROT_AXIS;
434 435
    }
435 436

  
437
///////////////////////////////////////////////////////////////////////////////////////////////////
438

  
439
  public Movement getMovement()
440
    {
441
    if( mMovement==null ) mMovement = new MovementUltimate();
442
    return mMovement;
443
    }
444

  
436 445
///////////////////////////////////////////////////////////////////////////////////////////////////
437 446

  
438 447
  public int[] getBasicAngle()
src/main/java/org/distorted/tutorials/TutorialPreRender.java
97 97
    if( mNewObject!=null )
98 98
      {
99 99
      mNewObject.createTexture();
100
      mView.setMovement(object.getObjectMovementClass());
100
      mView.setMovement(mNewObject.getMovement());
101 101

  
102 102
      if( mScreenWidth!=0 )
103 103
        {

Also available in: Unified diff