Project

General

Profile

« Previous | Next » 

Revision 38589947

Added by Leszek Koltunski over 2 years ago

Unify scrambling across all 4 bandaged objects.

View differences:

src/main/java/org/distorted/objects/TwistyBandagedAbstract.java
23 23

  
24 24
import org.distorted.helpers.ObjectShape;
25 25
import org.distorted.helpers.ObjectSticker;
26
import org.distorted.helpers.ScrambleStateGraph;
26 27
import org.distorted.library.main.DistortedEffects;
27 28
import org.distorted.library.main.DistortedTexture;
28 29
import org.distorted.library.mesh.MeshSquare;
29 30
import org.distorted.library.type.Static3D;
30 31
import org.distorted.library.type.Static4D;
31 32

  
33
import java.util.Random;
34

  
32 35
///////////////////////////////////////////////////////////////////////////////////////////////////
33 36

  
34 37
abstract class TwistyBandagedAbstract extends TwistyObject
......
148 151
      }
149 152
    }
150 153

  
154
  private int mCurrState;
155
  private int mIndexExcluded;
156
  ScrambleStateGraph[] mStates;
157

  
151 158
///////////////////////////////////////////////////////////////////////////////////////////////////
152 159

  
153 160
  TwistyBandagedAbstract(int size, Static4D quat, DistortedTexture texture, MeshSquare mesh,
......
443 450
///////////////////////////////////////////////////////////////////////////////////////////////////
444 451
// PUBLIC API
445 452

  
453
  public void randomizeNewScramble(int[][] scramble, Random rnd, int curr, int totalScrambles)
454
    {
455
    if( curr==0 )
456
      {
457
      mCurrState     = 0;
458
      mIndexExcluded =-1;
459
      }
460

  
461
    int total = mStates[mCurrState].getTotal(mIndexExcluded);
462
    int random= rnd.nextInt(total);
463
    int[] info= mStates[mCurrState].getInfo(random,mIndexExcluded);
464

  
465
    scramble[curr][0] = info[0];
466
    scramble[curr][1] = info[1];
467
    scramble[curr][2] = info[2];
468

  
469
    mCurrState     = info[3];
470
    mIndexExcluded = info[0];
471
    }
472

  
473
///////////////////////////////////////////////////////////////////////////////////////////////////
474

  
446 475
  public Static3D[] getRotationAxis()
447 476
    {
448 477
    return ROT_AXIS;

Also available in: Unified diff