Revision ea889ebf
Added by Leszek Koltunski over 1 year ago
src/main/java/org/distorted/objectlib/objects/TwistyRex.java | ||
---|---|---|
21 | 21 |
import org.distorted.objectlib.helpers.ObjectFaceShape; |
22 | 22 |
import org.distorted.objectlib.helpers.ObjectSignature; |
23 | 23 |
import org.distorted.objectlib.helpers.ObjectVertexEffects; |
24 |
import org.distorted.objectlib.scrambling.ScrambleEdgeGenerator; |
|
25 | 24 |
import org.distorted.objectlib.main.InitData; |
26 | 25 |
import org.distorted.objectlib.touchcontrol.TouchControlHexahedron; |
27 | 26 |
import org.distorted.objectlib.main.ObjectType; |
... | ... | |
69 | 68 |
} |
70 | 69 |
|
71 | 70 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
71 |
// single state; middle layer doesn't move. |
|
72 | 72 |
|
73 | 73 |
public int[][] getScrambleEdges() |
74 | 74 |
{ |
75 |
if( mEdges==null ) mEdges = ScrambleEdgeGenerator.getScrambleEdgesSingle(mBasicAngle); |
|
75 |
if( mEdges==null ) |
|
76 |
{ |
|
77 |
mEdges = new int[][] { { 0,0,1,0, 4,0,5,0, 6,0,7,0, 10,0,11,0, 12,0,13,0, 16,0,17,0, 18,0,19,0, 22,0,23,0 } }; |
|
78 |
} |
|
76 | 79 |
return mEdges; |
77 | 80 |
} |
78 | 81 |
|
src/main/java/org/distorted/objectlib/objects/TwistyVoid.java | ||
---|---|---|
76 | 76 |
} |
77 | 77 |
|
78 | 78 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
79 |
// +5 missing - it is the 180 deg rotation of the middle layer which we don't want. |
|
79 | 80 |
|
80 |
private void insertSection(int[] table, int startIndex, int size, int startAlg, int state)
|
|
81 |
private void insertSection(int[] table, int index, int alg, int state)
|
|
81 | 82 |
{ |
82 |
for(int i=0; i<size; i++) |
|
83 |
{ |
|
84 |
table[2*(i+startIndex) ] = startAlg +i; |
|
85 |
table[2*(i+startIndex)+1] = state; |
|
86 |
} |
|
83 |
table[index ] = alg; |
|
84 |
table[index+ 1] = state; |
|
85 |
table[index+ 2] = alg+1; |
|
86 |
table[index+ 3] = state; |
|
87 |
table[index+ 4] = alg+2; |
|
88 |
table[index+ 5] = state; |
|
89 |
table[index+ 6] = alg+3; |
|
90 |
table[index+ 7] = state; |
|
91 |
table[index+ 8] = alg+4; |
|
92 |
table[index+ 9] = state; |
|
93 |
table[index+10] = alg+6; |
|
94 |
table[index+11] = state; |
|
95 |
table[index+12] = alg+7; |
|
96 |
table[index+13] = state; |
|
97 |
table[index+14] = alg+8; |
|
98 |
table[index+15] = state; |
|
87 | 99 |
} |
88 | 100 |
|
89 | 101 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
90 | 102 |
|
91 | 103 |
private int[] createEdge(int stateX, int stateY, int stateZ) |
92 | 104 |
{ |
93 |
int size = 8;
|
|
105 |
int size= 8; |
|
94 | 106 |
int num = 0; |
95 |
if( stateX>=0 ) num += size; |
|
96 |
if( stateY>=0 ) num += size; |
|
97 |
if( stateZ>=0 ) num += size; |
|
98 |
|
|
99 |
int[] ret = new int[2*num]; |
|
100 |
|
|
101 |
if( stateX>=0 ) |
|
102 |
{ |
|
103 |
insertSection(ret,0,size,0,stateX); |
|
104 |
if( stateY>=0 ) |
|
105 |
{ |
|
106 |
insertSection(ret,size,size,size+1,stateY); |
|
107 |
if( stateZ>=0 ) insertSection(ret,2*size,size,2*size+2,stateZ); |
|
108 |
} |
|
109 |
else |
|
110 |
{ |
|
111 |
if( stateZ>=0 ) insertSection(ret,size,size,2*size+2,stateZ); |
|
112 |
} |
|
113 |
} |
|
114 |
else |
|
115 |
{ |
|
116 |
if( stateY>=0 ) |
|
117 |
{ |
|
118 |
insertSection(ret,0,size,size+1,stateY); |
|
119 |
if( stateZ>=0 ) insertSection(ret,size,size,2*size+2,stateZ); |
|
120 |
} |
|
121 |
else |
|
122 |
{ |
|
123 |
if( stateZ>=0 ) insertSection(ret,0,size,2*size+2,stateZ); |
|
124 |
} |
|
125 |
} |
|
107 |
if( stateX>=0 ) num += 2*size; |
|
108 |
if( stateY>=0 ) num += 2*size; |
|
109 |
if( stateZ>=0 ) num += 2*size; |
|
110 |
|
|
111 |
int[] ret = new int[num]; |
|
112 |
|
|
113 |
int index = 0; |
|
114 |
int alg = 0; |
|
115 |
if( stateX>=0 ) { insertSection(ret,index,alg,stateX); index+= (2*size);} |
|
116 |
alg += (size+1); |
|
117 |
if( stateY>=0 ) { insertSection(ret,index,alg,stateY); index+= (2*size);} |
|
118 |
alg += (size+1); |
|
119 |
if( stateZ>=0 ) { insertSection(ret,index,alg,stateZ); } |
|
126 | 120 |
|
127 | 121 |
return ret; |
128 | 122 |
} |
src/main/java/org/distorted/objectlib/scrambling/ScrambleEdgeGenerator.java | ||
---|---|---|
20 | 20 |
for(int i=0; i<num; i++) |
21 | 21 |
{ |
22 | 22 |
table[2*(i+startIndex) ] = startAlg +i; |
23 |
|
|
24 |
//android.util.Log.e("D", " "+(2*(i+startIndex))+" : "+(startAlg+i)); |
|
25 |
|
|
26 | 23 |
table[2*(i+startIndex)+1] = state; |
27 |
|
|
28 |
//android.util.Log.e("D", " "+(2*(i+startIndex)+1)+" : "+(state)); |
|
29 | 24 |
} |
30 | 25 |
} |
31 | 26 |
|
... | ... | |
33 | 28 |
|
34 | 29 |
private static int[] createEdge(int sizeX, int sizeY, int sizeZ, int stateX, int stateY, int stateZ) |
35 | 30 |
{ |
36 |
//android.util.Log.e("D", "creating edge"); |
|
37 |
|
|
38 | 31 |
int num = 0; |
39 | 32 |
int consX = ((sizeY!=sizeZ) ? 2:6)*sizeX; |
40 | 33 |
int consY = ((sizeX!=sizeZ) ? 2:6)*sizeY; |
Also available in: Unified diff
Correct scramble tables for the Rex and Void Cubes.