mirror of
https://github.com/Retera/WarsmashModEngine.git
synced 2022-07-31 17:38:59 +02:00
Update instant attack effects not to setScene until location is assigned
This commit is contained in:
parent
fa1656922f
commit
11e9a965dc
@ -508,15 +508,13 @@ public class War3MapViewer extends AbstractMdxModelViewer {
|
||||
final float height = War3MapViewer.this.terrain.getGroundHeight(targetX, targetY)
|
||||
+ target.getFlyHeight() + target.getImpactZ();
|
||||
|
||||
System.out.println(
|
||||
"Spawning INSTANT: " + missileArt + " at " + targetX + ", " + targetY + ", " + height);
|
||||
final MdxModel model = (MdxModel) load(missileArt, War3MapViewer.this.mapPathSolver,
|
||||
War3MapViewer.this.solverParams);
|
||||
final MdxComplexInstance modelInstance = (MdxComplexInstance) model.addInstance();
|
||||
modelInstance.setTeamColor(source.getPlayerIndex());
|
||||
modelInstance.setScene(War3MapViewer.this.worldScene);
|
||||
SequenceUtils.randomBirthSequence(modelInstance);
|
||||
modelInstance.setLocation(targetX, targetY, height);
|
||||
modelInstance.setScene(War3MapViewer.this.worldScene);
|
||||
War3MapViewer.this.projectiles
|
||||
.add(new RenderAttackInstant(modelInstance, War3MapViewer.this, angleToTarget));
|
||||
}
|
||||
|
@ -1,7 +1,14 @@
|
||||
package com.etheller.warsmash.viewer5.handlers.w3x.rendersim;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.etheller.warsmash.parsers.mdlx.Sequence;
|
||||
import com.etheller.warsmash.viewer5.handlers.mdx.MdxComplexInstance;
|
||||
import com.etheller.warsmash.viewer5.handlers.mdx.MdxModel;
|
||||
import com.etheller.warsmash.viewer5.handlers.mdx.SequenceLoopMode;
|
||||
import com.etheller.warsmash.viewer5.handlers.w3x.AnimationTokens.PrimaryTag;
|
||||
import com.etheller.warsmash.viewer5.handlers.w3x.IndexedSequence;
|
||||
import com.etheller.warsmash.viewer5.handlers.w3x.SequenceUtils;
|
||||
import com.etheller.warsmash.viewer5.handlers.w3x.War3MapViewer;
|
||||
|
||||
public class RenderAttackInstant implements RenderEffect {
|
||||
@ -11,15 +18,14 @@ public class RenderAttackInstant implements RenderEffect {
|
||||
final float yaw) {
|
||||
this.modelInstance = modelInstance;
|
||||
final MdxModel model = (MdxModel) this.modelInstance.model;
|
||||
// final List<Sequence> sequences = model.getSequences();
|
||||
// final IndexedSequence sequence = SequenceUtils.selectSequence(PrimaryTag.DEATH, SequenceUtils.EMPTY, sequences,
|
||||
// true);
|
||||
// if ((sequence != null) && (sequence.index != -1)) {
|
||||
// this.modelInstance.setSequenceLoopMode(SequenceLoopMode.NEVER_LOOP);
|
||||
// this.modelInstance.setSequence(sequence.index);
|
||||
// }
|
||||
final List<Sequence> sequences = model.getSequences();
|
||||
final IndexedSequence sequence = SequenceUtils.selectSequence(PrimaryTag.DEATH, SequenceUtils.EMPTY, sequences,
|
||||
true);
|
||||
if ((sequence != null) && (sequence.index != -1)) {
|
||||
this.modelInstance.setSequenceLoopMode(SequenceLoopMode.NEVER_LOOP);
|
||||
this.modelInstance.setSequence(sequence.index);
|
||||
}
|
||||
this.modelInstance.localRotation.setFromAxisRad(0, 0, 1, yaw);
|
||||
System.out.println("creating " + this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -27,7 +33,6 @@ public class RenderAttackInstant implements RenderEffect {
|
||||
|
||||
final boolean everythingDone = this.modelInstance.sequenceEnded;
|
||||
if (everythingDone) {
|
||||
System.out.println("removing " + this);
|
||||
war3MapViewer.worldScene.removeInstance(this.modelInstance);
|
||||
}
|
||||
return everythingDone;
|
||||
|
Loading…
Reference in New Issue
Block a user