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/TwistyBandaged2Bar.java
21 21

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

  
24
import org.distorted.helpers.ScrambleStateGraph;
24 25
import org.distorted.library.main.DistortedEffects;
25 26
import org.distorted.library.main.DistortedTexture;
26 27
import org.distorted.library.mesh.MeshSquare;
......
67 68
                     DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
68 69
    {
69 70
    super(size, quat, texture, mesh, effects, moves, ObjectList.BAN2, res, scrWidth);
71

  
72
    mStates = new ScrambleStateGraph[]
73
      {
74
      new ScrambleStateGraph( new int[][] { {}                                          , {0,1,1, 0,-1,1, 2,1,2, 2,-1,2}, {} }),
75
      new ScrambleStateGraph( new int[][] { {0,-1,1, 0,1,1, 0,2,1, 2,-1,1, 2,1,1, 2,2,1}, {0,2,1, 2,2,1}                , {} }),
76
      new ScrambleStateGraph( new int[][] { {}, {0,2,2, 2,2,2}                , {0,-1,2, 0,1,2, 0,2,2, 2,-1,2, 2,1,2, 2,2,2} })
77
      };
70 78
    }
71 79

  
72 80
///////////////////////////////////////////////////////////////////////////////////////////////////
......
86 94
///////////////////////////////////////////////////////////////////////////////////////////////////
87 95
// PUBLIC API
88 96

  
89
  public void randomizeNewScramble(int[][] scramble, Random rnd, int curr, int totalScrambles)
90
    {
91
    if( curr==0 )
92
      {
93
      int random = rnd.nextInt(4);
94

  
95
      scramble[curr][0] = 1;
96
      scramble[curr][1] = random>1      ?  2:0;
97
      scramble[curr][2] = random%2 == 0 ? -1:1;
98
      }
99
    else
100
      {
101
      boolean even = ((curr%2) == 0);
102
      int angle = rnd.nextInt(4);
103

  
104
      scramble[curr][0] = even ? 1 : scramble[0][1];
105
      scramble[curr][1] = rnd.nextInt(3);
106

  
107
      if( even == (scramble[curr][1]==1) )
108
        {
109
        switch(angle)
110
          {
111
          case 0: scramble[curr][2] = -2; break;
112
          case 1: scramble[curr][2] = -1; break;
113
          case 2: scramble[curr][2] =  1; break;
114
          case 3: scramble[curr][2] =  2; break;
115
          }
116
        }
117
      else
118
        {
119
        scramble[curr][2] = angle>1 ? 2:-2;
120
        }
121
      }
122
    }
123

  
124
///////////////////////////////////////////////////////////////////////////////////////////////////
125

  
126 97
  public int getObjectName(int numLayers)
127 98
    {
128 99
    return R.string.bandaged_2bar;

Also available in: Unified diff