Revision 5cc61ae4
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/objectlib/effects/scramble/ScrambleEffect.java | ||
---|---|---|
24 | 24 |
|
25 | 25 |
import org.distorted.library.effect.Effect; |
26 | 26 |
import org.distorted.library.main.DistortedEffects; |
27 |
import org.distorted.library.main.DistortedFramebuffer; |
|
28 | 27 |
import org.distorted.library.message.EffectListener; |
29 | 28 |
|
30 | 29 |
import org.distorted.objectlib.main.ObjectPreRender; |
31 |
import org.distorted.objectlib.main.ObjectType; |
|
32 | 30 |
import org.distorted.objectlib.main.TwistyObject; |
33 | 31 |
import org.distorted.objectlib.effects.BaseEffect; |
34 | 32 |
import org.distorted.objectlib.helpers.MovesFinished; |
... | ... | |
67 | 65 |
} |
68 | 66 |
} |
69 | 67 |
|
70 |
|
|
71 | 68 |
private int mEffectReturned; |
72 | 69 |
private int mNumScramblesLeft; |
73 | 70 |
private int mDurationPerDegree; |
... | ... | |
91 | 88 |
ScrambleEffect() |
92 | 89 |
{ |
93 | 90 |
mRnd = new Random( System.currentTimeMillis() ); |
94 |
mScrambles = new int[ObjectType.MAX_SCRAMBLE][3]; |
|
95 | 91 |
} |
96 | 92 |
|
97 | 93 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
216 | 212 |
|
217 | 213 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
218 | 214 |
|
219 |
private void effectFinishedAction(final long effectID, final long id)
|
|
215 |
private void effectFinishedAction(final long effectID) |
|
220 | 216 |
{ |
221 | 217 |
mEffectReturned++; |
222 | 218 |
effectFinishedPlugin(effectID); |
... | ... | |
240 | 236 |
|
241 | 237 |
if( effectID == id ) |
242 | 238 |
{ |
243 |
effectFinishedAction(effectID,id);
|
|
239 |
effectFinishedAction(effectID); |
|
244 | 240 |
return; |
245 | 241 |
} |
246 | 242 |
} |
... | ... | |
251 | 247 |
|
252 | 248 |
if( effectID == id ) |
253 | 249 |
{ |
254 |
effectFinishedAction(effectID,id);
|
|
250 |
effectFinishedAction(effectID); |
|
255 | 251 |
return; |
256 | 252 |
} |
257 | 253 |
} |
... | ... | |
275 | 271 |
mBasicAngle = mObject.getBasicAngle(); |
276 | 272 |
|
277 | 273 |
int numScrambles = pre.getNumScrambles(); |
274 |
mScrambles = new int[numScrambles][3]; |
|
278 | 275 |
int dura = (int)(duration*Math.pow(numScrambles,0.66f)); |
279 | 276 |
createBaseEffects(dura,numScrambles); |
280 | 277 |
createEffects (dura,numScrambles); |
src/main/java/org/distorted/objectlib/main/ObjectType.java | ||
---|---|---|
70 | 70 |
; |
71 | 71 |
|
72 | 72 |
public static final int NUM_OBJECTS = values().length; |
73 |
public static final int MAX_SCRAMBLE,MAX_OBJECT_SIZE; |
|
74 | 73 |
|
75 | 74 |
private final int[] mNumLayers; |
76 | 75 |
private final int mNumScrambles; |
... | ... | |
83 | 82 |
{ |
84 | 83 |
int i = 0; |
85 | 84 |
objects = new ObjectType[NUM_OBJECTS]; |
86 |
int maxScramble= Integer.MIN_VALUE; |
|
87 |
int maxSize = Integer.MIN_VALUE; |
|
88 |
|
|
89 |
for(ObjectType object: ObjectType.values()) |
|
90 |
{ |
|
91 |
objects[i++] = object; |
|
92 |
|
|
93 |
if( object.mNumScrambles> maxScramble ) maxScramble= object.mNumScrambles; |
|
94 |
|
|
95 |
int len = object.mNumLayers.length; |
|
96 |
|
|
97 |
for(int j=0; j<len; j++) |
|
98 |
if( object.mNumLayers[j]>maxSize ) maxSize = object.mNumLayers[j]; |
|
99 |
} |
|
100 |
|
|
101 |
MAX_SCRAMBLE = maxScramble; |
|
102 |
MAX_OBJECT_SIZE = maxSize; |
|
85 |
for(ObjectType object: ObjectType.values()) objects[i++] = object; |
|
103 | 86 |
} |
104 | 87 |
|
105 | 88 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Further simplify ObjectType