Revision 74c9af0d
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/objects/MovementCornerTwisting.java | ||
---|---|---|
23 | 23 |
|
24 | 24 |
class MovementCornerTwisting extends Movement6 |
25 | 25 |
{ |
26 |
private static final int[] NUM_ENABLED = {2,2,2,2,2,2}; |
|
27 |
|
|
26 | 28 |
private static final int[][][] ENABLED = new int[][][] |
27 | 29 |
{ |
28 |
{{2,0,1},{2,3,1},{2,2,3},{2,0,2}},
|
|
29 |
{{2,2,3},{2,3,1},{2,0,1},{2,0,2}},
|
|
30 |
{{2,1,2},{2,0,1},{2,0,3},{2,2,3}},
|
|
31 |
{{2,1,2},{2,2,3},{2,0,3},{2,0,1}},
|
|
32 |
{{2,0,3},{2,0,2},{2,1,2},{2,1,3}},
|
|
33 |
{{2,1,2},{2,0,2},{2,0,3},{2,1,3}},
|
|
30 |
{{0,1},{3,1},{2,3},{0,2}},
|
|
31 |
{{2,3},{3,1},{0,1},{0,2}},
|
|
32 |
{{1,2},{0,1},{0,3},{2,3}},
|
|
33 |
{{1,2},{2,3},{0,3},{0,1}},
|
|
34 |
{{0,3},{0,2},{1,2},{1,3}},
|
|
35 |
{{1,2},{0,2},{0,3},{1,3}},
|
|
34 | 36 |
}; |
35 | 37 |
|
36 | 38 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
41 | 43 |
} |
42 | 44 |
|
43 | 45 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
44 |
// _____________ |
|
45 |
// | \ 0 / | |
|
46 |
// | \ / | |
|
47 |
// | 3 | | 1 | |
|
48 |
// | / \ | |
|
49 |
// | / 2 \ | |
|
50 |
// ------------- |
|
51 | 46 |
|
52 | 47 |
void computeEnabledAxis(int face, float[] touchPoint, int[] enabled) |
53 | 48 |
{ |
54 | 49 |
boolean p0 = touchPoint[1] >= touchPoint[0]; |
55 | 50 |
boolean p1 = touchPoint[1] >=-touchPoint[0]; |
56 |
int quarter = p0 ? (p1 ? 0:3) : (p1 ? 1:2);
|
|
51 |
int part = p0 ? (p1 ? 0:3) : (p1 ? 1:2);
|
|
57 | 52 |
|
58 |
enabled[0] = ENABLED[face][quarter][0];
|
|
59 |
enabled[1] = ENABLED[face][quarter][1];
|
|
60 |
enabled[2] = ENABLED[face][quarter][2];
|
|
53 |
int num = NUM_ENABLED[face];
|
|
54 |
enabled[0] = num;
|
|
55 |
System.arraycopy(ENABLED[face][part], 0, enabled, 1, num);
|
|
61 | 56 |
} |
62 | 57 |
} |
63 | 58 |
|
Also available in: Unified diff
Next step on the way to completely do away with object Movement classes.