mirror of
https://github.com/Retera/WarsmashModEngine.git
synced 2022-07-31 17:38:59 +02:00
Update with simple status bar
This commit is contained in:
parent
632576323c
commit
2b3e5bdf4a
@ -130,7 +130,7 @@ public class WarsmashGdxMapGame extends ApplicationAdapter implements CanvasProv
|
||||
this.viewer.enableAudio();
|
||||
}
|
||||
try {
|
||||
this.viewer.loadMap(this.warsmashIni.get("Map").getField("FilePath"));
|
||||
this.viewer.loadMap(this.warsmashIni.get("Map").getField("FilePath"), 0);
|
||||
}
|
||||
catch (final IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
@ -222,7 +222,7 @@ public class WarsmashGdxMapGame extends ApplicationAdapter implements CanvasProv
|
||||
cameraRatesElement.getFieldFloatValue("FOV"), cameraRatesElement.getFieldFloatValue("Rotation"),
|
||||
cameraRatesElement.getFieldFloatValue("Distance"), cameraRatesElement.getFieldFloatValue("Forward"),
|
||||
cameraRatesElement.getFieldFloatValue("Strafe"));
|
||||
this.meleeUI = new MeleeUI(this.codebase, this.uiViewport, fontGenerator, this.uiScene, portraitScene,
|
||||
this.meleeUI = new MeleeUI(this.viewer.mapMpq, this.uiViewport, fontGenerator, this.uiScene, portraitScene,
|
||||
cameraPresets, cameraRates, this.viewer, new RootFrameListener() {
|
||||
@Override
|
||||
public void onCreate(final GameUI rootFrame) {
|
||||
|
@ -30,6 +30,7 @@ import com.etheller.warsmash.parsers.fdf.frames.AbstractUIFrame;
|
||||
import com.etheller.warsmash.parsers.fdf.frames.FilterModeTextureFrame;
|
||||
import com.etheller.warsmash.parsers.fdf.frames.SetPoint;
|
||||
import com.etheller.warsmash.parsers.fdf.frames.SimpleFrame;
|
||||
import com.etheller.warsmash.parsers.fdf.frames.SimpleStatusBarFrame;
|
||||
import com.etheller.warsmash.parsers.fdf.frames.SpriteFrame;
|
||||
import com.etheller.warsmash.parsers.fdf.frames.StringFrame;
|
||||
import com.etheller.warsmash.parsers.fdf.frames.TextureFrame;
|
||||
@ -104,16 +105,31 @@ public final class GameUI extends AbstractUIFrame implements UIFrame {
|
||||
catch (final IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
// TODO eliminate duplicate read of skin TXT!!
|
||||
if (dataSource.has("war3mapSkin.txt")) {
|
||||
try (InputStream miscDataTxtStream = dataSource.getResourceAsStream("war3mapSkin.txt")) {
|
||||
skinsTable.readTXT(miscDataTxtStream, true);
|
||||
}
|
||||
catch (final IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
// final Element main = skinsTable.get("Main");
|
||||
// final String skinsField = main.getField("Skins");
|
||||
// final String[] skins = skinsField.split(",");
|
||||
final Element defaultSkin = skinsTable.get("Default");
|
||||
final Element userSkin = skinsTable.get(skin);
|
||||
final Element customSkin = skinsTable.get("CustomSkin");
|
||||
for (final String key : defaultSkin.keySet()) {
|
||||
if (!userSkin.hasField(key)) {
|
||||
userSkin.setField(key, defaultSkin.getField(key));
|
||||
}
|
||||
}
|
||||
if (customSkin != null) {
|
||||
for (final String key : customSkin.keySet()) {
|
||||
userSkin.setField(key, customSkin.getField(key));
|
||||
}
|
||||
}
|
||||
return userSkin;
|
||||
}
|
||||
|
||||
@ -125,16 +141,31 @@ public final class GameUI extends AbstractUIFrame implements UIFrame {
|
||||
catch (final IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
// TODO eliminate duplicate read of skin TXT!!
|
||||
if (dataSource.has("war3mapSkin.txt")) {
|
||||
try (InputStream miscDataTxtStream = dataSource.getResourceAsStream("war3mapSkin.txt")) {
|
||||
skinsTable.readTXT(miscDataTxtStream, true);
|
||||
}
|
||||
catch (final IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
final Element main = skinsTable.get("Main");
|
||||
final String skinsField = main.getField("Skins");
|
||||
final String[] skins = skinsField.split(",");
|
||||
final Element defaultSkin = skinsTable.get("Default");
|
||||
final Element userSkin = skinsTable.get(skins[skinIndex]);
|
||||
final Element customSkin = skinsTable.get("CustomSkin");
|
||||
for (final String key : defaultSkin.keySet()) {
|
||||
if (!userSkin.hasField(key)) {
|
||||
userSkin.setField(key, defaultSkin.getField(key));
|
||||
}
|
||||
}
|
||||
if (customSkin != null) {
|
||||
for (final String key : customSkin.keySet()) {
|
||||
userSkin.setField(key, customSkin.getField(key));
|
||||
}
|
||||
}
|
||||
return userSkin;
|
||||
}
|
||||
|
||||
@ -252,6 +283,17 @@ public final class GameUI extends AbstractUIFrame implements UIFrame {
|
||||
}
|
||||
inflatedFrame = simpleFrame;
|
||||
}
|
||||
else if ("SIMPLESTATUSBAR".equals(frameDefinition.getFrameType())) {
|
||||
final boolean decorateFileNames = frameDefinition.has("DecorateFileNames")
|
||||
|| ((parentDefinitionIfAvailable != null)
|
||||
&& parentDefinitionIfAvailable.has("DecorateFileNames"));
|
||||
final SimpleStatusBarFrame simpleStatusBarFrame = new SimpleStatusBarFrame(frameDefinition.getName(),
|
||||
parent, decorateFileNames);
|
||||
for (final FrameDefinition childDefinition : frameDefinition.getInnerFrames()) {
|
||||
simpleStatusBarFrame.add(inflate(childDefinition, simpleStatusBarFrame, frameDefinition));
|
||||
}
|
||||
inflatedFrame = simpleStatusBarFrame;
|
||||
}
|
||||
else if ("SPRITE".equals(frameDefinition.getFrameType())) {
|
||||
final SpriteFrame spriteFrame = new SpriteFrame(frameDefinition.getName(), parent, this.uiScene,
|
||||
viewport2);
|
||||
@ -448,6 +490,10 @@ public final class GameUI extends AbstractUIFrame implements UIFrame {
|
||||
}
|
||||
|
||||
public Scene getUiScene() {
|
||||
return uiScene;
|
||||
return this.uiScene;
|
||||
}
|
||||
|
||||
public FrameTemplateEnvironment getTemplates() {
|
||||
return this.templates;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,39 @@
|
||||
package com.etheller.warsmash.parsers.fdf.frames;
|
||||
|
||||
import com.etheller.warsmash.parsers.fdf.datamodel.FramePoint;
|
||||
import com.etheller.warsmash.parsers.fdf.datamodel.Vector4Definition;
|
||||
|
||||
public class SimpleStatusBarFrame extends AbstractUIFrame {
|
||||
private final boolean decorateFileNames;
|
||||
private final TextureFrame barFrame;
|
||||
private final TextureFrame borderFrame;
|
||||
|
||||
public SimpleStatusBarFrame(final String name, final UIFrame parent, final boolean decorateFileNames) {
|
||||
super(name, parent);
|
||||
this.decorateFileNames = decorateFileNames;
|
||||
this.barFrame = new TextureFrame(name + "Bar", this, decorateFileNames, new Vector4Definition(0, 1, 0, 1));
|
||||
this.borderFrame = new TextureFrame(name + "Border", this, decorateFileNames,
|
||||
new Vector4Definition(0, 1, 0, 1));
|
||||
this.borderFrame.setSetAllPoints(true);
|
||||
this.barFrame.addSetPoint(new SetPoint(FramePoint.TOPLEFT, this, FramePoint.TOPLEFT, 0, 0));
|
||||
this.barFrame.addSetPoint(new SetPoint(FramePoint.BOTTOMLEFT, this, FramePoint.BOTTOMLEFT, 0, 0));
|
||||
add(this.barFrame);
|
||||
add(this.borderFrame);
|
||||
}
|
||||
|
||||
public boolean isDecorateFileNames() {
|
||||
return this.decorateFileNames;
|
||||
}
|
||||
|
||||
public void setValue(final float value) {
|
||||
this.barFrame.setWidth(this.renderBounds.width * value);
|
||||
}
|
||||
|
||||
public TextureFrame getBarFrame() {
|
||||
return this.barFrame;
|
||||
}
|
||||
|
||||
public TextureFrame getBorderFrame() {
|
||||
return this.borderFrame;
|
||||
}
|
||||
}
|
@ -9,9 +9,9 @@ public class AudioBufferSource {
|
||||
|
||||
}
|
||||
|
||||
public void start(final int value) {
|
||||
public void start(final int value, final float volume, final float pitch) {
|
||||
if (this.buffer != null) {
|
||||
this.buffer.play(1);
|
||||
this.buffer.play(volume, pitch, 0.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,8 @@ public class EventObjectEmitterObject extends GenericObject implements EmitterOb
|
||||
};
|
||||
if (data != null) {
|
||||
return Gdx.audio.newSound(temp);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
System.err.println("Warning: missing sound file: " + this.filename);
|
||||
return null;
|
||||
}
|
||||
@ -59,9 +60,11 @@ public class EventObjectEmitterObject extends GenericObject implements EmitterOb
|
||||
stringBuilder.append(line);
|
||||
stringBuilder.append("\n");
|
||||
}
|
||||
} catch (final UnsupportedEncodingException e) {
|
||||
}
|
||||
catch (final UnsupportedEncodingException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (final IOException e) {
|
||||
}
|
||||
catch (final IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return new MappedData(stringBuilder.toString());
|
||||
@ -88,9 +91,9 @@ public class EventObjectEmitterObject extends GenericObject implements EmitterOb
|
||||
public float distanceCutoff;
|
||||
private float maxDistance;
|
||||
public float minDistance;
|
||||
private float pitch;
|
||||
private float pitchVariance;
|
||||
private float volume;
|
||||
public float pitch;
|
||||
public float pitchVariance;
|
||||
public float volume;
|
||||
public List<Sound> decodedBuffers = new ArrayList<>();
|
||||
/**
|
||||
* If this is an SPL/UBR emitter object, ok will be set to true if the tables
|
||||
@ -119,9 +122,11 @@ public class EventObjectEmitterObject extends GenericObject implements EmitterOb
|
||||
|
||||
if ("SPL".equals(type)) {
|
||||
this.geometryEmitterType = GeometryEmitterFuncs.EMITTER_SPLAT;
|
||||
} else if ("UBR".equals(type)) {
|
||||
}
|
||||
else if ("UBR".equals(type)) {
|
||||
this.geometryEmitterType = GeometryEmitterFuncs.EMITTER_UBERSPLAT;
|
||||
} else if ("SPN".equals(type)) {
|
||||
}
|
||||
else if ("SPN".equals(type)) {
|
||||
this.geometryEmitterType = GeometryEmitterFuncs.EMITTER_SPN;
|
||||
}
|
||||
|
||||
@ -141,20 +146,24 @@ public class EventObjectEmitterObject extends GenericObject implements EmitterOb
|
||||
if ("SPN".equals(type)) {
|
||||
tables.add(viewer.loadGeneric(pathSolver.solve("Splats\\SpawnData.slk", solverParams).finalSrc,
|
||||
FetchDataTypeName.SLK, mappedDataCallback));
|
||||
} else if ("SPL".equals(type)) {
|
||||
}
|
||||
else if ("SPL".equals(type)) {
|
||||
tables.add(viewer.loadGeneric(pathSolver.solve("Splats\\SplatData.slk", solverParams).finalSrc,
|
||||
FetchDataTypeName.SLK, mappedDataCallback));
|
||||
} else if ("UBR".equals(type)) {
|
||||
}
|
||||
else if ("UBR".equals(type)) {
|
||||
tables.add(viewer.loadGeneric(pathSolver.solve("Splats\\UberSplatData.slk", solverParams).finalSrc,
|
||||
FetchDataTypeName.SLK, mappedDataCallback));
|
||||
} else if ("SND".equals(type)) {
|
||||
}
|
||||
else if ("SND".equals(type)) {
|
||||
if (!model.reforged) {
|
||||
tables.add(viewer.loadGeneric(pathSolver.solve("UI\\SoundInfo\\AnimLookups.slk", solverParams).finalSrc,
|
||||
FetchDataTypeName.SLK, mappedDataCallback));
|
||||
}
|
||||
tables.add(viewer.loadGeneric(pathSolver.solve("UI\\SoundInfo\\AnimSounds.slk", solverParams).finalSrc,
|
||||
FetchDataTypeName.SLK, mappedDataCallback));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
// Units\Critters\BlackStagMale\BlackStagMale.mdx has an event object named
|
||||
// "Point01".
|
||||
return;
|
||||
@ -169,7 +178,8 @@ public class EventObjectEmitterObject extends GenericObject implements EmitterOb
|
||||
final Float x = (Float) row.get(name);
|
||||
if (x == null) {
|
||||
return Float.NaN;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return x.floatValue();
|
||||
}
|
||||
}
|
||||
@ -182,7 +192,8 @@ public class EventObjectEmitterObject extends GenericObject implements EmitterOb
|
||||
final Number x = (Number) row.get(name);
|
||||
if (x == null) {
|
||||
return defaultValue;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return x.intValue();
|
||||
}
|
||||
}
|
||||
@ -208,7 +219,8 @@ public class EventObjectEmitterObject extends GenericObject implements EmitterOb
|
||||
// this.internalModel.whenLoaded((model) => this.ok = model.ok)
|
||||
this.ok = this.internalModel.ok;
|
||||
}
|
||||
} else if ("SPL".equals(this.type) || "UBR".equals(this.type)) {
|
||||
}
|
||||
else if ("SPL".equals(this.type) || "UBR".equals(this.type)) {
|
||||
final String texturesExt = model.reforged ? ".dds" : ".blp";
|
||||
|
||||
this.internalTexture = (Texture) viewer.load(
|
||||
@ -234,7 +246,8 @@ public class EventObjectEmitterObject extends GenericObject implements EmitterOb
|
||||
getFloat(row, "LifespanRepeat") },
|
||||
{ getFloat(row, "UVDecayStart"), getFloat(row, "UVDecayEnd"),
|
||||
getFloat(row, "DecayRepeat") }, };
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
this.columns = 1;
|
||||
this.rows = 1;
|
||||
this.lifeSpan = getFloat(row, "BirthTime") + getFloat(row, "PauseTime") + getFloat(row, "Decay");
|
||||
@ -250,7 +263,8 @@ public class EventObjectEmitterObject extends GenericObject implements EmitterOb
|
||||
this.blendDst = blendModes[1];
|
||||
|
||||
this.ok = true;
|
||||
} else if ("SND".equals(this.type)) {
|
||||
}
|
||||
else if ("SND".equals(this.type)) {
|
||||
// Only load sounds if audio is enabled.
|
||||
// This is mostly to save on bandwidth and loading time, especially when loading
|
||||
// full maps.
|
||||
@ -265,7 +279,7 @@ public class EventObjectEmitterObject extends GenericObject implements EmitterOb
|
||||
this.minDistance = getFloat(animSoundsRow, "MinDistance");
|
||||
this.pitch = getFloat(animSoundsRow, "Pitch");
|
||||
this.pitchVariance = getFloat(animSoundsRow, "PitchVariance");
|
||||
this.volume = getFloat(animSoundsRow, "Volume");
|
||||
this.volume = getFloat(animSoundsRow, "Volume") / 127f;
|
||||
|
||||
final String[] fileNames = ((String) animSoundsRow.get("FileNames")).split(",");
|
||||
final GenericResource[] resources = new GenericResource[fileNames.length];
|
||||
@ -279,7 +293,8 @@ public class EventObjectEmitterObject extends GenericObject implements EmitterOb
|
||||
System.err.println("Null sound: " + fileNames[i]);
|
||||
}
|
||||
resources[i] = genericResource;
|
||||
} catch (final Exception exc) {
|
||||
}
|
||||
catch (final Exception exc) {
|
||||
System.err.println("Failed to load sound: " + path);
|
||||
exc.printStackTrace();
|
||||
}
|
||||
@ -294,10 +309,12 @@ public class EventObjectEmitterObject extends GenericObject implements EmitterOb
|
||||
this.ok = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
System.err.println("Unknown event object type: " + this.type + this.id);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
System.err.println("Unknown event object ID: " + this.type + this.id);
|
||||
}
|
||||
}
|
||||
@ -306,11 +323,13 @@ public class EventObjectEmitterObject extends GenericObject implements EmitterOb
|
||||
if (this.globalSequence != -1) {
|
||||
|
||||
return this.getValueAtTime(out, instance.counter % this.globalSequence, 0, this.globalSequence);
|
||||
} else if (instance.sequence != -1) {
|
||||
}
|
||||
else if (instance.sequence != -1) {
|
||||
final long[] interval = this.model.getSequences().get(instance.sequence).getInterval();
|
||||
|
||||
return this.getValueAtTime(out, instance.frame, interval[0], interval[1]);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
out[0] = this.defval[0];
|
||||
|
||||
return -1;
|
||||
@ -324,7 +343,8 @@ public class EventObjectEmitterObject extends GenericObject implements EmitterOb
|
||||
out[0] = 0;
|
||||
|
||||
return i;
|
||||
} else if (this.keyFrames[i] <= frame) {
|
||||
}
|
||||
else if (this.keyFrames[i] <= frame) {
|
||||
out[0] = 1;
|
||||
|
||||
return i;
|
||||
|
@ -47,7 +47,9 @@ public class EventObjectSnd extends EmittedObject<MdxComplexInstance, EventObjec
|
||||
source.connect(panner);
|
||||
|
||||
// Make a sound.
|
||||
source.start(0);
|
||||
source.start(0, emitterObject.volume,
|
||||
(emitterObject.pitch + ((float) Math.random() * emitterObject.pitchVariance * 2))
|
||||
- emitterObject.pitchVariance);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,15 +22,15 @@ public final class UnitAckSound {
|
||||
private final List<Sound> sounds = new ArrayList<>();
|
||||
private final float volume;
|
||||
private final float pitch;
|
||||
private final float pitchVariation;
|
||||
private final float pitchVariance;
|
||||
private final float minDistance;
|
||||
private final float maxDistance;
|
||||
private final float distanceCutoff;
|
||||
|
||||
private Sound lastPlayedSound;
|
||||
|
||||
public static UnitAckSound create(final DataSource dataSource, final DataTable unitAckSounds, final String soundName,
|
||||
final String soundType) {
|
||||
public static UnitAckSound create(final DataSource dataSource, final DataTable unitAckSounds,
|
||||
final String soundName, final String soundType) {
|
||||
final Element row = unitAckSounds.get(soundName + soundType);
|
||||
if (row == null) {
|
||||
return SILENT;
|
||||
@ -40,13 +40,17 @@ public final class UnitAckSound {
|
||||
if ((directoryBase.length() > 1) && !directoryBase.endsWith("\\")) {
|
||||
directoryBase += "\\";
|
||||
}
|
||||
final float volume = row.getFieldFloatValue("Volume");
|
||||
final float volume = row.getFieldFloatValue("Volume") / 127f;
|
||||
final float pitch = row.getFieldFloatValue("Pitch");
|
||||
final float pitchVariation = row.getFieldFloatValue("PitchVariance");
|
||||
float pitchVariance = row.getFieldFloatValue("PitchVariance");
|
||||
if (pitchVariance == 1.0f) {
|
||||
pitchVariance = 0.0f;
|
||||
}
|
||||
final float minDistance = row.getFieldFloatValue("MinDistance");
|
||||
final float maxDistance = row.getFieldFloatValue("MaxDistance");
|
||||
final float distanceCutoff = row.getFieldFloatValue("DistanceCutoff");
|
||||
final UnitAckSound sound = new UnitAckSound(volume, pitch, pitchVariation, minDistance, maxDistance, distanceCutoff);
|
||||
final UnitAckSound sound = new UnitAckSound(volume, pitch, pitchVariance, minDistance, maxDistance,
|
||||
distanceCutoff);
|
||||
for (final String fileName : fileNames.split(",")) {
|
||||
String filePath = directoryBase + fileName;
|
||||
if (!filePath.toLowerCase().endsWith(".wav")) {
|
||||
@ -63,7 +67,7 @@ public final class UnitAckSound {
|
||||
final float maxDistance, final float distanceCutoff) {
|
||||
this.volume = volume;
|
||||
this.pitch = pitch;
|
||||
this.pitchVariation = pitchVariation;
|
||||
this.pitchVariance = pitchVariation;
|
||||
this.minDistance = minDistance;
|
||||
this.maxDistance = maxDistance;
|
||||
this.distanceCutoff = distanceCutoff;
|
||||
@ -96,7 +100,8 @@ public final class UnitAckSound {
|
||||
source.connect(panner);
|
||||
|
||||
// Make a sound.
|
||||
source.start(0);
|
||||
source.start(0, this.volume,
|
||||
(this.pitch + ((float) Math.random() * this.pitchVariance * 2)) - this.pitchVariance);
|
||||
this.lastPlayedSound = source.buffer;
|
||||
final float duration = Extensions.soundLengthExtension.getDuration(this.lastPlayedSound);
|
||||
unit.lastUnitResponseEndTimeMillis = millisTime + (long) (1000 * duration);
|
||||
|
@ -22,7 +22,7 @@ public final class UnitSound {
|
||||
private final List<Sound> sounds = new ArrayList<>();
|
||||
private final float volume;
|
||||
private final float pitch;
|
||||
private final float pitchVariation;
|
||||
private final float pitchVariance;
|
||||
private final float minDistance;
|
||||
private final float maxDistance;
|
||||
private final float distanceCutoff;
|
||||
@ -40,13 +40,16 @@ public final class UnitSound {
|
||||
if ((directoryBase.length() > 1) && !directoryBase.endsWith("\\")) {
|
||||
directoryBase += "\\";
|
||||
}
|
||||
final float volume = row.getFieldFloatValue("Volume");
|
||||
final float volume = row.getFieldFloatValue("Volume") / 127f;
|
||||
final float pitch = row.getFieldFloatValue("Pitch");
|
||||
final float pitchVariation = row.getFieldFloatValue("PitchVariance");
|
||||
float pitchVariance = row.getFieldFloatValue("PitchVariance");
|
||||
if (pitchVariance == 1.0f) {
|
||||
pitchVariance = 0.0f;
|
||||
}
|
||||
final float minDistance = row.getFieldFloatValue("MinDistance");
|
||||
final float maxDistance = row.getFieldFloatValue("MaxDistance");
|
||||
final float distanceCutoff = row.getFieldFloatValue("DistanceCutoff");
|
||||
final UnitSound sound = new UnitSound(volume, pitch, pitchVariation, minDistance, maxDistance, distanceCutoff);
|
||||
final UnitSound sound = new UnitSound(volume, pitch, pitchVariance, minDistance, maxDistance, distanceCutoff);
|
||||
for (final String fileName : fileNames.split(",")) {
|
||||
String filePath = directoryBase + fileName;
|
||||
if (!filePath.toLowerCase().endsWith(".wav")) {
|
||||
@ -63,7 +66,7 @@ public final class UnitSound {
|
||||
final float maxDistance, final float distanceCutoff) {
|
||||
this.volume = volume;
|
||||
this.pitch = pitch;
|
||||
this.pitchVariation = pitchVariation;
|
||||
this.pitchVariance = pitchVariation;
|
||||
this.minDistance = minDistance;
|
||||
this.maxDistance = maxDistance;
|
||||
this.distanceCutoff = distanceCutoff;
|
||||
@ -112,7 +115,8 @@ public final class UnitSound {
|
||||
source.connect(panner);
|
||||
|
||||
// Make a sound.
|
||||
source.start(0);
|
||||
source.start(0, this.volume,
|
||||
(this.pitch + ((float) Math.random() * this.pitchVariance * 2)) - this.pitchVariance);
|
||||
this.lastPlayedSound = source.buffer;
|
||||
return true;
|
||||
}
|
||||
|
@ -192,6 +192,7 @@ public class War3MapViewer extends ModelViewer {
|
||||
private final QuadtreeIntersectorFindsHighestWalkable intersectorFindsHighestWalkable = new QuadtreeIntersectorFindsHighestWalkable();
|
||||
|
||||
private KeyedSounds uiSounds;
|
||||
private int localPlayerIndex;
|
||||
|
||||
public War3MapViewer(final DataSource dataSource, final CanvasProvider canvas) {
|
||||
super(dataSource, canvas);
|
||||
@ -317,18 +318,23 @@ public class War3MapViewer extends ModelViewer {
|
||||
try (InputStream miscDataTxtStream = this.dataSource.getResourceAsStream("UI\\SoundInfo\\UISounds.slk")) {
|
||||
this.uiSoundsTable.readSLK(miscDataTxtStream);
|
||||
}
|
||||
try (InputStream miscDataTxtStream = this.dataSource.getResourceAsStream("UI\\SoundInfo\\AmbienceSounds.slk")) {
|
||||
this.uiSoundsTable.readSLK(miscDataTxtStream);
|
||||
}
|
||||
}
|
||||
|
||||
public GenericResource loadMapGeneric(final String path, final FetchDataTypeName dataType,
|
||||
final LoadGenericCallback callback) {
|
||||
if (this.mapMpq == null) {
|
||||
return loadGeneric(path, dataType, callback);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return loadGeneric(path, dataType, callback, this.dataSource);
|
||||
}
|
||||
}
|
||||
|
||||
public void loadMap(final String mapFilePath) throws IOException {
|
||||
public void loadMap(final String mapFilePath, final int localPlayerIndex) throws IOException {
|
||||
this.localPlayerIndex = localPlayerIndex;
|
||||
final War3Map war3Map = new War3Map(this.gameDataSource, mapFilePath);
|
||||
|
||||
this.mapMpq = war3Map;
|
||||
@ -354,19 +360,22 @@ public class War3MapViewer extends ModelViewer {
|
||||
tilesetSource = new CompoundDataSource(Arrays.asList(compoundDataSource,
|
||||
new SubdirDataSource(compoundDataSource, tileset + ".mpq/"),
|
||||
new SubdirDataSource(compoundDataSource, "_tilesets/" + tileset + ".w3mod/")));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
final byte[] mapData = IOUtils.toByteArray(mapStream);
|
||||
sbc = new SeekableInMemoryByteChannel(mapData);
|
||||
final DataSource internalMpqContentsDataSource = new MpqDataSource(new MPQArchive(sbc), sbc);
|
||||
tilesetSource = new CompoundDataSource(
|
||||
Arrays.asList(compoundDataSource, internalMpqContentsDataSource));
|
||||
}
|
||||
} catch (final IOException exc) {
|
||||
}
|
||||
catch (final IOException exc) {
|
||||
tilesetSource = new CompoundDataSource(
|
||||
Arrays.asList(compoundDataSource, new SubdirDataSource(compoundDataSource, tileset + ".mpq/"),
|
||||
new SubdirDataSource(compoundDataSource, "_tilesets/" + tileset + ".w3mod/")));
|
||||
}
|
||||
} catch (final MPQException e) {
|
||||
}
|
||||
catch (final MPQException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
setDataSource(tilesetSource);
|
||||
@ -440,7 +449,8 @@ public class War3MapViewer extends ModelViewer {
|
||||
modelInstance.setScene(War3MapViewer.this.worldScene);
|
||||
if (bounceIndex == 0) {
|
||||
SequenceUtils.randomBirthSequence(modelInstance);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
SequenceUtils.randomStandSequence(modelInstance);
|
||||
}
|
||||
modelInstance.setLocation(x, y, height);
|
||||
@ -504,10 +514,13 @@ public class War3MapViewer extends ModelViewer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawnUnitConstructionSound(CUnit constructingUnit, CUnit constructedStructure) {
|
||||
UnitSound constructingBuilding = uiSounds.getSound(gameUI.getSkinField("ConstructingBuilding"));
|
||||
public void spawnUnitConstructionSound(final CUnit constructingUnit,
|
||||
final CUnit constructedStructure) {
|
||||
final UnitSound constructingBuilding = War3MapViewer.this.uiSounds
|
||||
.getSound(War3MapViewer.this.gameUI.getSkinField("ConstructingBuilding"));
|
||||
if (constructingBuilding != null) {
|
||||
constructingBuilding.play(worldScene.audioContext, constructedStructure.getX(), constructedStructure.getY());
|
||||
constructingBuilding.playUnitResponse(War3MapViewer.this.worldScene.audioContext,
|
||||
War3MapViewer.this.unitToRenderPeer.get(constructingUnit));
|
||||
}
|
||||
}
|
||||
|
||||
@ -525,10 +538,12 @@ public class War3MapViewer extends ModelViewer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawnUnitConstructionFinishSound(CUnit constructedStructure) {
|
||||
UnitSound constructingBuilding = uiSounds.getSound(gameUI.getSkinField("JobDoneSound"));
|
||||
public void spawnUnitConstructionFinishSound(final CUnit constructedStructure) {
|
||||
final UnitSound constructingBuilding = War3MapViewer.this.uiSounds
|
||||
.getSound(War3MapViewer.this.gameUI.getSkinField("JobDoneSound"));
|
||||
if (constructingBuilding != null) {
|
||||
constructingBuilding.play(worldScene.audioContext, constructedStructure.getX(), constructedStructure.getY());
|
||||
constructingBuilding.play(War3MapViewer.this.worldScene.audioContext,
|
||||
constructedStructure.getX(), constructedStructure.getY());
|
||||
}
|
||||
}
|
||||
|
||||
@ -543,7 +558,8 @@ public class War3MapViewer extends ModelViewer {
|
||||
this.walkableObjectsTree = new Quadtree<>(this.terrain.getEntireMap());
|
||||
if (this.doodadsAndDestructiblesLoaded) {
|
||||
this.loadDoodadsAndDestructibles(this.allObjectData);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
throw new IllegalStateException("transcription of JS has not loaded a map and has no JS async promises");
|
||||
}
|
||||
|
||||
@ -570,7 +586,8 @@ public class War3MapViewer extends ModelViewer {
|
||||
public void loadAfterUI() throws IOException {
|
||||
if (this.unitsAndItemsLoaded) {
|
||||
this.loadUnitsAndItems(this.allObjectData);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
throw new IllegalStateException("transcription of JS has not loaded a map and has no JS async promises");
|
||||
}
|
||||
|
||||
@ -640,7 +657,8 @@ public class War3MapViewer extends ModelViewer {
|
||||
bufferedImage = TgaFile.readTGA(pathingTexture,
|
||||
this.mapMpq.getResourceAsStream(pathingTexture));
|
||||
this.filePathToPathingMap.put(pathingTexture.toLowerCase(), bufferedImage);
|
||||
} catch (final Exception exc) {
|
||||
}
|
||||
catch (final Exception exc) {
|
||||
exc.printStackTrace();
|
||||
}
|
||||
}
|
||||
@ -658,13 +676,15 @@ public class War3MapViewer extends ModelViewer {
|
||||
String path;
|
||||
if (this.mapMpq.has(fileVar)) {
|
||||
path = fileVar;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
path = file;
|
||||
}
|
||||
MdxModel model;
|
||||
if (this.mapMpq.has(path)) {
|
||||
model = (MdxModel) this.load(path, this.mapPathSolver, this.solverParams);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
model = (MdxModel) this.load(fileVar, this.mapPathSolver, this.solverParams);
|
||||
}
|
||||
|
||||
@ -683,7 +703,8 @@ public class War3MapViewer extends ModelViewer {
|
||||
renderDestructableBounds);
|
||||
}
|
||||
this.doodads.add(renderDestructable);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
this.doodads.add(new RenderDoodad(this, model, row, doodad, type, maxPitch, maxRoll));
|
||||
}
|
||||
}
|
||||
@ -716,12 +737,14 @@ public class War3MapViewer extends ModelViewer {
|
||||
pathingTextureImage = TgaFile.readTGA(pathingTexture,
|
||||
this.mapMpq.getResourceAsStream(pathingTexture));
|
||||
this.filePathToPathingMap.put(pathingTexture.toLowerCase(), pathingTextureImage);
|
||||
} catch (final Exception exc) {
|
||||
}
|
||||
catch (final Exception exc) {
|
||||
exc.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
pathingTextureImage = null;
|
||||
}
|
||||
if (pathingTextureImage != null) {
|
||||
@ -800,7 +823,8 @@ public class War3MapViewer extends ModelViewer {
|
||||
// path = "Objects\\StartLocation\\StartLocation.mdx";
|
||||
type = null; /// ??????
|
||||
this.startLocations[playerIndex] = new Vector2(unitX, unitY);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
row = modifications.getUnits().get(unitId);
|
||||
if (row == null) {
|
||||
row = modifications.getItems().get(unitId);
|
||||
@ -812,12 +836,12 @@ public class War3MapViewer extends ModelViewer {
|
||||
path = path.substring(0, path.length() - 4);
|
||||
}
|
||||
|
||||
Element misc = miscData.get("Misc");
|
||||
String itemShadowFile = misc.getField("ItemShadowFile");
|
||||
int itemShadowWidth = misc.getFieldValue("ItemShadowSize", 0);
|
||||
int itemShadowHeight = misc.getFieldValue("ItemShadowSize", 1);
|
||||
int itemShadowX = misc.getFieldValue("ItemShadowOffset", 0);
|
||||
int itemShadowY = misc.getFieldValue("ItemShadowOffset", 1);
|
||||
final Element misc = this.miscData.get("Misc");
|
||||
final String itemShadowFile = misc.getField("ItemShadowFile");
|
||||
final int itemShadowWidth = misc.getFieldValue("ItemShadowSize", 0);
|
||||
final int itemShadowHeight = misc.getFieldValue("ItemShadowSize", 1);
|
||||
final int itemShadowX = misc.getFieldValue("ItemShadowOffset", 0);
|
||||
final int itemShadowY = misc.getFieldValue("ItemShadowOffset", 1);
|
||||
if ((itemShadowFile != null) && !"_".equals(itemShadowFile)) {
|
||||
final String texture = "ReplaceableTextures\\Shadows\\" + itemShadowFile + ".blp";
|
||||
final float shadowX = itemShadowX;
|
||||
@ -838,7 +862,8 @@ public class War3MapViewer extends ModelViewer {
|
||||
|
||||
path += ".mdx";
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
type = WorldEditorDataType.UNITS;
|
||||
path = getUnitModelPath(row);
|
||||
|
||||
@ -857,9 +882,10 @@ public class War3MapViewer extends ModelViewer {
|
||||
final String texturePath = uberSplatInfo.getField("Dir") + "\\" + uberSplatInfo.getField("file")
|
||||
+ ".blp";
|
||||
final float s = uberSplatInfo.getFieldFloatValue("Scale");
|
||||
if (unitsReady) {
|
||||
if (this.unitsReady) {
|
||||
this.terrain.addUberSplat(texturePath, unitX, unitY, 1, s);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (!this.terrain.splats.containsKey(texturePath)) {
|
||||
this.terrain.splats.put(texturePath, new Splat());
|
||||
}
|
||||
@ -914,7 +940,8 @@ public class War3MapViewer extends ModelViewer {
|
||||
final String portraitPath = path.substring(0, path.length() - 4) + "_portrait.mdx";
|
||||
if (this.dataSource.has(portraitPath)) {
|
||||
portraitModel = (MdxModel) this.load(portraitPath, this.mapPathSolver, this.solverParams);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
portraitModel = model;
|
||||
}
|
||||
if (type == WorldEditorDataType.UNITS) {
|
||||
@ -935,7 +962,8 @@ public class War3MapViewer extends ModelViewer {
|
||||
});
|
||||
}
|
||||
return simulationUnit;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
this.items
|
||||
.add(new RenderItem(this, model, row, unitX, unitY, unitZ, unitAngle, soundset, portraitModel)); // TODO
|
||||
// store
|
||||
@ -949,7 +977,8 @@ public class War3MapViewer extends ModelViewer {
|
||||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
System.err.println("Unknown unit ID: " + unitId);
|
||||
}
|
||||
return null;
|
||||
@ -980,14 +1009,16 @@ public class War3MapViewer extends ModelViewer {
|
||||
if (pathingTexture.toLowerCase().endsWith(".tga")) {
|
||||
buildingPathingPixelMap = TgaFile.readTGA(pathingTexture,
|
||||
this.mapMpq.getResourceAsStream(pathingTexture));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
try (InputStream stream = this.mapMpq.getResourceAsStream(pathingTexture)) {
|
||||
buildingPathingPixelMap = ImageIO.read(stream);
|
||||
System.out.println("LOADING BLP PATHING: " + pathingTexture);
|
||||
}
|
||||
}
|
||||
this.filePathToPathingMap.put(pathingTexture.toLowerCase(), buildingPathingPixelMap);
|
||||
} catch (final IOException exc) {
|
||||
}
|
||||
catch (final IOException exc) {
|
||||
System.err.println("Failure to get pathing: " + exc.getClass() + ":" + exc.getMessage());
|
||||
}
|
||||
}
|
||||
@ -1173,7 +1204,8 @@ public class War3MapViewer extends ModelViewer {
|
||||
this.walkableObjectsTree.intersect(rectangleHeap, this.walkablesIntersectionFinder.reset(gdxRayHeap));
|
||||
if (this.walkablesIntersectionFinder.found) {
|
||||
out.set(this.walkablesIntersectionFinder.intersection);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
out.z = Math.max(getWalkableRenderHeight(out.x, out.y), this.terrain.getGroundHeight(out.x, out.y));
|
||||
}
|
||||
}
|
||||
@ -1215,13 +1247,16 @@ public class War3MapViewer extends ModelViewer {
|
||||
final int idx = sel.indexOf(entity);
|
||||
if (idx >= 0) {
|
||||
sel.remove(idx);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
sel.add(entity);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
sel = Arrays.asList(entity);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
sel = Collections.emptyList();
|
||||
}
|
||||
this.doSelectUnit(sel);
|
||||
@ -1265,9 +1300,11 @@ public class War3MapViewer extends ModelViewer {
|
||||
stringBuilder.append(line);
|
||||
stringBuilder.append("\n");
|
||||
}
|
||||
} catch (final UnsupportedEncodingException e) {
|
||||
}
|
||||
catch (final UnsupportedEncodingException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (final IOException e) {
|
||||
}
|
||||
catch (final IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return new MappedData(stringBuilder.toString());
|
||||
@ -1287,9 +1324,11 @@ public class War3MapViewer extends ModelViewer {
|
||||
stringBuilder.append(line);
|
||||
stringBuilder.append("\n");
|
||||
}
|
||||
} catch (final UnsupportedEncodingException e) {
|
||||
}
|
||||
catch (final UnsupportedEncodingException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (final IOException e) {
|
||||
}
|
||||
catch (final IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return stringBuilder.toString();
|
||||
@ -1386,7 +1425,8 @@ public class War3MapViewer extends ModelViewer {
|
||||
public SceneLightManager createLightManager(final boolean simple) {
|
||||
if (simple) {
|
||||
return new W3xScenePortraitLightManager(this, this.lightDirection);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return new W3xSceneWorldLightManager(this);
|
||||
}
|
||||
}
|
||||
@ -1427,6 +1467,10 @@ public class War3MapViewer extends ModelViewer {
|
||||
return this.intersectorFindsHighestWalkable.highestInstance;
|
||||
}
|
||||
|
||||
public int getLocalPlayerIndex() {
|
||||
return this.localPlayerIndex;
|
||||
}
|
||||
|
||||
private static final class QuadtreeIntersectorFindsWalkableRenderHeight
|
||||
implements QuadtreeIntersector<MdxComplexInstance> {
|
||||
private float z;
|
||||
|
@ -12,10 +12,13 @@ import com.etheller.warsmash.util.RenderMathUtils;
|
||||
import com.etheller.warsmash.util.War3ID;
|
||||
import com.etheller.warsmash.viewer5.handlers.mdx.MdxComplexInstance;
|
||||
import com.etheller.warsmash.viewer5.handlers.mdx.MdxModel;
|
||||
import com.etheller.warsmash.viewer5.handlers.w3x.*;
|
||||
import com.etheller.warsmash.viewer5.handlers.w3x.AnimationTokens;
|
||||
import com.etheller.warsmash.viewer5.handlers.w3x.AnimationTokens.PrimaryTag;
|
||||
import com.etheller.warsmash.viewer5.handlers.w3x.AnimationTokens.SecondaryTag;
|
||||
import com.etheller.warsmash.viewer5.handlers.w3x.SequenceUtils;
|
||||
import com.etheller.warsmash.viewer5.handlers.w3x.SplatModel.SplatMover;
|
||||
import com.etheller.warsmash.viewer5.handlers.w3x.UnitSoundset;
|
||||
import com.etheller.warsmash.viewer5.handlers.w3x.War3MapViewer;
|
||||
import com.etheller.warsmash.viewer5.handlers.w3x.environment.PathingGrid;
|
||||
import com.etheller.warsmash.viewer5.handlers.w3x.environment.PathingGrid.MovementType;
|
||||
import com.etheller.warsmash.viewer5.handlers.w3x.rendersim.ability.AbilityDataUI;
|
||||
@ -64,7 +67,6 @@ public class RenderUnit {
|
||||
private boolean corpse;
|
||||
private boolean boneCorpse;
|
||||
private final RenderUnitTypeData typeData;
|
||||
public UnitSound buildSound;
|
||||
|
||||
public RenderUnit(final War3MapViewer map, final MdxModel model, final MutableGameObject row, final float x,
|
||||
final float y, final float z, final int playerIndex, final UnitSoundset soundset,
|
||||
@ -127,7 +129,6 @@ public class RenderUnit {
|
||||
|
||||
final float blendTime = row.getFieldAsFloat(BLEND_TIME, 0);
|
||||
instance.setBlendTime(blendTime * 1000.0f);
|
||||
buildSound = map.getUiSounds().getSound(row.getFieldAsString(BUILD_SOUND_LABEL, 0));
|
||||
}
|
||||
|
||||
this.instance = instance;
|
||||
@ -350,8 +351,9 @@ public class RenderUnit {
|
||||
this.selectionCircle.move(dx, dy, map.terrain.centerOffset);
|
||||
}
|
||||
this.unitAnimationListenerImpl.update();
|
||||
if(!dead && simulationUnit.isConstructing()) {
|
||||
instance.setFrameByRatio(simulationUnit.getConstructionProgress() / simulationUnit.getUnitType().getBuildTime());
|
||||
if (!dead && this.simulationUnit.isConstructing()) {
|
||||
this.instance.setFrameByRatio(
|
||||
this.simulationUnit.getConstructionProgress() / this.simulationUnit.getUnitType().getBuildTime());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,6 +50,7 @@ public class CommandCardIcon extends AbstractRenderableFrame {
|
||||
this.activeHighlightFrame.setVisible(false);
|
||||
this.cooldownFrame.setVisible(false);
|
||||
this.autocastFrame.setVisible(false);
|
||||
setVisible(false);
|
||||
}
|
||||
else {
|
||||
if (commandButton.isEnabled()) {
|
||||
@ -74,6 +75,7 @@ public class CommandCardIcon extends AbstractRenderableFrame {
|
||||
public void setCommandButtonData(final Texture texture, final int abilityHandleId, final int orderId,
|
||||
final int autoCastOrderId, final boolean active, final boolean autoCastActive, final boolean menuButton) {
|
||||
this.menuButton = menuButton;
|
||||
setVisible(true);
|
||||
this.iconFrame.setVisible(true);
|
||||
this.activeHighlightFrame.setVisible(active);
|
||||
this.cooldownFrame.setVisible(false);
|
||||
@ -113,7 +115,7 @@ public class CommandCardIcon extends AbstractRenderableFrame {
|
||||
|
||||
@Override
|
||||
public UIFrame touchDown(final float screenX, final float screenY, final int button) {
|
||||
if (this.renderBounds.contains(screenX, screenY)) {
|
||||
if (isVisible() && this.renderBounds.contains(screenX, screenY)) {
|
||||
return this;
|
||||
}
|
||||
return super.touchDown(screenX, screenY, button);
|
||||
@ -121,7 +123,7 @@ public class CommandCardIcon extends AbstractRenderableFrame {
|
||||
|
||||
@Override
|
||||
public UIFrame touchUp(final float screenX, final float screenY, final int button) {
|
||||
if (this.renderBounds.contains(screenX, screenY)) {
|
||||
if (isVisible() && this.renderBounds.contains(screenX, screenY)) {
|
||||
return this;
|
||||
}
|
||||
return super.touchUp(screenX, screenY, button);
|
||||
|
@ -25,6 +25,7 @@ import com.etheller.warsmash.parsers.fdf.datamodel.AnchorDefinition;
|
||||
import com.etheller.warsmash.parsers.fdf.datamodel.FramePoint;
|
||||
import com.etheller.warsmash.parsers.fdf.datamodel.TextJustify;
|
||||
import com.etheller.warsmash.parsers.fdf.frames.SetPoint;
|
||||
import com.etheller.warsmash.parsers.fdf.frames.SimpleStatusBarFrame;
|
||||
import com.etheller.warsmash.parsers.fdf.frames.SpriteFrame;
|
||||
import com.etheller.warsmash.parsers.fdf.frames.StringFrame;
|
||||
import com.etheller.warsmash.parsers.fdf.frames.TextureFrame;
|
||||
@ -114,6 +115,7 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
|
||||
private StringFrame simpleNameValue;
|
||||
private StringFrame simpleClassValue;
|
||||
private StringFrame simpleBuildingActionLabel;
|
||||
private SimpleStatusBarFrame simpleBuildTimeIndicator;
|
||||
private UIFrame attack1Icon;
|
||||
private TextureFrame attack1IconBackdrop;
|
||||
private StringFrame attack1InfoPanelIconValue;
|
||||
@ -128,7 +130,6 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
|
||||
private StringFrame armorInfoPanelIconLevel;
|
||||
private InfoPanelIconBackdrops damageBackdrops;
|
||||
private InfoPanelIconBackdrops defenseBackdrops;
|
||||
private SpriteFrame buildTimeIndicator;
|
||||
|
||||
private final CommandCardIcon[][] commandCard = new CommandCardIcon[COMMAND_CARD_HEIGHT][COMMAND_CARD_WIDTH];
|
||||
|
||||
@ -174,10 +175,10 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
|
||||
this.cameraManager = new GameCameraManager(cameraPresets, cameraRates);
|
||||
|
||||
this.cameraManager.setupCamera(war3MapViewer.worldScene);
|
||||
if (this.war3MapViewer.startLocations[0] != null) {
|
||||
this.cameraManager.target.x = this.war3MapViewer.startLocations[0].x;
|
||||
this.cameraManager.target.y = this.war3MapViewer.startLocations[0].y;
|
||||
}
|
||||
final float[] startLocation = this.war3MapViewer.simulation.getPlayer(war3MapViewer.getLocalPlayerIndex())
|
||||
.getStartLocation();
|
||||
this.cameraManager.target.x = startLocation[0];
|
||||
this.cameraManager.target.y = startLocation[1];
|
||||
|
||||
this.activeButtonTexture = ImageUtils.getBLPTexture(war3MapViewer.mapMpq,
|
||||
"UI\\Widgets\\Console\\Human\\CommandButton\\human-activebutton.blp");
|
||||
@ -196,15 +197,18 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
|
||||
try {
|
||||
minimapTexture = ImageUtils.getTextureNoColorCorrection(TgaFile.readTGA("war3mapMap.tga",
|
||||
war3MapViewer.dataSource.getResourceAsStream("war3mapMap.tga")));
|
||||
} catch (final IOException e) {
|
||||
}
|
||||
catch (final IOException e) {
|
||||
System.err.println("Could not load minimap TGA file");
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else if (war3MapViewer.dataSource.has("war3mapMap.blp")) {
|
||||
}
|
||||
else if (war3MapViewer.dataSource.has("war3mapMap.blp")) {
|
||||
try {
|
||||
minimapTexture = ImageUtils
|
||||
.getTexture(ImageIO.read(war3MapViewer.dataSource.getResourceAsStream("war3mapMap.blp")));
|
||||
} catch (final IOException e) {
|
||||
}
|
||||
catch (final IOException e) {
|
||||
System.err.println("Could not load minimap BLP file");
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -231,12 +235,14 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
|
||||
this.rootFrameListener.onCreate(this.rootFrame);
|
||||
try {
|
||||
this.rootFrame.loadTOCFile("UI\\FrameDef\\FrameDef.toc");
|
||||
} catch (final IOException exc) {
|
||||
}
|
||||
catch (final IOException exc) {
|
||||
throw new IllegalStateException("Unable to load FrameDef.toc", exc);
|
||||
}
|
||||
try {
|
||||
this.rootFrame.loadTOCFile("UI\\FrameDef\\SmashFrameDef.toc");
|
||||
} catch (final IOException exc) {
|
||||
}
|
||||
catch (final IOException exc) {
|
||||
throw new IllegalStateException("Unable to load SmashFrameDef.toc", exc);
|
||||
}
|
||||
this.damageBackdrops = new InfoPanelIconBackdrops(CAttackType.values(), this.rootFrame, "Damage", "Neutral");
|
||||
@ -285,6 +291,14 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
|
||||
this.simpleNameValue = (StringFrame) this.rootFrame.getFrameByName("SimpleNameValue", 0);
|
||||
this.simpleClassValue = (StringFrame) this.rootFrame.getFrameByName("SimpleClassValue", 0);
|
||||
this.simpleBuildingActionLabel = (StringFrame) this.rootFrame.getFrameByName("SimpleBuildingActionLabel", 0);
|
||||
this.simpleBuildTimeIndicator = (SimpleStatusBarFrame) this.rootFrame.getFrameByName("SimpleBuildTimeIndicator",
|
||||
0);
|
||||
final TextureFrame simpleBuildTimeIndicatorBar = this.simpleBuildTimeIndicator.getBarFrame();
|
||||
simpleBuildTimeIndicatorBar.setTexture("SimpleBuildTimeIndicator", this.rootFrame);
|
||||
final TextureFrame simpleBuildTimeIndicatorBorder = this.simpleBuildTimeIndicator.getBorderFrame();
|
||||
simpleBuildTimeIndicatorBorder.setTexture("SimpleBuildTimeIndicatorBorder", this.rootFrame);
|
||||
this.simpleBuildTimeIndicator.setWidth(GameUI.convertX(this.uiViewport, 0.10538f));
|
||||
this.simpleBuildTimeIndicator.setHeight(GameUI.convertY(this.uiViewport, 0.0103f));
|
||||
|
||||
this.attack1Icon = this.rootFrame.createSimpleFrame("SimpleInfoPanelIconDamage", this.simpleInfoPanelUnitDetail,
|
||||
0);
|
||||
@ -362,13 +376,6 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
|
||||
commandButtonIndex++;
|
||||
}
|
||||
}
|
||||
buildTimeIndicator = (SpriteFrame) this.rootFrame.createFrameByType("SPRITE",
|
||||
"SmashBuildProgressBar", this.rootFrame, "", 0);
|
||||
buildTimeIndicator.addSetPoint(new SetPoint(FramePoint.CENTER, simpleClassValue, FramePoint.CENTER,
|
||||
GameUI.convertX(this.uiViewport, -0.04f),
|
||||
GameUI.convertY(this.uiViewport, -0.025f)));
|
||||
this.rootFrame.setSpriteFrameModel(buildTimeIndicator, this.rootFrame.getSkinField("BuildTimeIndicator"));
|
||||
buildTimeIndicator.setAnimationSpeed(0);
|
||||
|
||||
this.cursorFrame = (SpriteFrame) this.rootFrame.createFrameByType("SPRITE", "SmashCursorFrame", this.rootFrame,
|
||||
"", 0);
|
||||
@ -386,6 +393,9 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
|
||||
@Override
|
||||
public void startUsingAbility(final int abilityHandleId, final int orderId, final boolean rightClick) {
|
||||
// TODO not O(N)
|
||||
if (this.selectedUnit == null) {
|
||||
return;
|
||||
}
|
||||
CAbilityView abilityToUse = null;
|
||||
for (final CAbility ability : this.selectedUnit.getSimulationUnit().getAbilities()) {
|
||||
if (ability.getHandleId() == abilityHandleId) {
|
||||
@ -400,7 +410,8 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
|
||||
stringMsgActivationReceiver);
|
||||
if (!stringMsgActivationReceiver.isUseOk()) {
|
||||
showCommandError(stringMsgActivationReceiver.getMessage());
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
final BooleanAbilityTargetCheckReceiver<Void> noTargetReceiver = BooleanAbilityTargetCheckReceiver
|
||||
.<Void>getInstance().reset();
|
||||
abilityToUse.checkCanTargetNoTarget(this.war3MapViewer.simulation,
|
||||
@ -408,14 +419,16 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
|
||||
if (noTargetReceiver.isTargetable()) {
|
||||
this.unitOrderListener.issueImmediateOrder(this.selectedUnit.getSimulationUnit().getHandleId(),
|
||||
abilityHandleId, orderId, isShiftDown());
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
this.activeCommand = abilityToUse;
|
||||
this.activeCommandOrderId = orderId;
|
||||
this.activeCommandUnit = this.selectedUnit;
|
||||
clearAndRepopulateCommandCard();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
this.unitOrderListener.issueImmediateOrder(this.selectedUnit.getSimulationUnit().getHandleId(),
|
||||
abilityHandleId, orderId, isShiftDown());
|
||||
}
|
||||
@ -431,7 +444,8 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
|
||||
this.activeCommandUnit = null;
|
||||
this.activeCommand = null;
|
||||
this.activeCommandOrderId = -1;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
this.subMenuOrderIdStack.add(orderId);
|
||||
}
|
||||
clearAndRepopulateCommandCard();
|
||||
@ -502,7 +516,8 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
|
||||
if (justLoaded) {
|
||||
this.cursorModelInstance.setScene(this.war3MapViewer.worldScene);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (this.cursorModelInstance != null) {
|
||||
this.cursorModelInstance.detach();
|
||||
this.cursorModelInstance = null;
|
||||
@ -510,7 +525,8 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
|
||||
}
|
||||
this.cursorFrame.setSequence("Target");
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (this.cursorModelInstance != null) {
|
||||
this.cursorModelInstance.detach();
|
||||
this.cursorModelInstance = null;
|
||||
@ -519,30 +535,39 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
|
||||
if (down) {
|
||||
if (left) {
|
||||
this.cursorFrame.setSequence("Scroll Down Left");
|
||||
} else if (right) {
|
||||
}
|
||||
else if (right) {
|
||||
this.cursorFrame.setSequence("Scroll Down Right");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
this.cursorFrame.setSequence("Scroll Down");
|
||||
}
|
||||
} else if (up) {
|
||||
}
|
||||
else if (up) {
|
||||
if (left) {
|
||||
this.cursorFrame.setSequence("Scroll Up Left");
|
||||
} else if (right) {
|
||||
}
|
||||
else if (right) {
|
||||
this.cursorFrame.setSequence("Scroll Up Right");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
this.cursorFrame.setSequence("Scroll Up");
|
||||
}
|
||||
} else if (left) {
|
||||
}
|
||||
else if (left) {
|
||||
this.cursorFrame.setSequence("Scroll Left");
|
||||
} else if (right) {
|
||||
}
|
||||
else if (right) {
|
||||
this.cursorFrame.setSequence("Scroll Right");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
this.cursorFrame.setSequence("Normal");
|
||||
}
|
||||
}
|
||||
if (this.buildTimeIndicator.isVisible() && this.selectedUnit != null) {
|
||||
buildTimeIndicator.setFrameByRatio(Math.min(this.selectedUnit.getSimulationUnit().getConstructionProgress() /
|
||||
this.selectedUnit.getSimulationUnit().getUnitType().getBuildTime(), 0.99f));
|
||||
if (this.simpleBuildTimeIndicator.isVisible() && (this.selectedUnit != null)) {
|
||||
this.simpleBuildTimeIndicator
|
||||
.setValue(Math.min(this.selectedUnit.getSimulationUnit().getConstructionProgress()
|
||||
/ this.selectedUnit.getSimulationUnit().getUnitType().getBuildTime(), 0.99f));
|
||||
}
|
||||
final float groundHeight = Math.max(
|
||||
this.war3MapViewer.terrain.getGroundHeight(this.cameraManager.target.x, this.cameraManager.target.y),
|
||||
@ -610,7 +635,8 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
|
||||
}
|
||||
this.modelInstance = null;
|
||||
this.portraitCameraManager.setModelInstance(null, null);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
final MdxModel portraitModel = unit.portraitModel;
|
||||
if (portraitModel != null) {
|
||||
if (this.modelInstance != null) {
|
||||
@ -648,11 +674,18 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
|
||||
this.attack2Icon.setVisible(false);
|
||||
this.attack1InfoPanelIconLevel.setText("");
|
||||
this.attack2InfoPanelIconLevel.setText("");
|
||||
this.simpleBuildingActionLabel.setText("");
|
||||
this.armorIcon.setVisible(false);
|
||||
this.armorInfoPanelIconLevel.setText("");
|
||||
this.buildTimeIndicator.setVisible(false);
|
||||
} else {
|
||||
this.simpleBuildTimeIndicator.setVisible(false);
|
||||
}
|
||||
else {
|
||||
unit.getSimulationUnit().addStateListener(this);
|
||||
reloadSelectedUnitUI(unit);
|
||||
}
|
||||
}
|
||||
|
||||
private void reloadSelectedUnitUI(final RenderUnit unit) {
|
||||
this.simpleNameValue.setText(unit.getSimulationUnit().getUnitType().getName());
|
||||
String classText = null;
|
||||
for (final CUnitClassification classification : unit.getSimulationUnit().getClassifications()) {
|
||||
@ -667,7 +700,8 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
|
||||
}
|
||||
if (classText != null) {
|
||||
this.simpleClassValue.setText(classText);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
this.simpleClassValue.setText("");
|
||||
}
|
||||
this.unitLifeText.setText(FastNumberFormat.formatWholeNumber(unit.getSimulationUnit().getLife()) + " / "
|
||||
@ -676,13 +710,14 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
|
||||
if (maximumMana > 0) {
|
||||
this.unitManaText.setText(
|
||||
FastNumberFormat.formatWholeNumber(unit.getSimulationUnit().getMana()) + " / " + maximumMana);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
this.unitManaText.setText("");
|
||||
}
|
||||
this.simpleBuildingActionLabel.setText("");
|
||||
|
||||
final boolean anyAttacks = unit.getSimulationUnit().getUnitType().getAttacks().size() > 0;
|
||||
boolean constructing = unit.getSimulationUnit().isConstructing();
|
||||
final boolean constructing = unit.getSimulationUnit().isConstructing();
|
||||
final UIFrame localArmorIcon = this.armorIcon;
|
||||
final TextureFrame localArmorIconBackdrop = this.armorIconBackdrop;
|
||||
final StringFrame localArmorInfoPanelIconValue = this.armorInfoPanelIconValue;
|
||||
@ -696,15 +731,17 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
|
||||
this.attack2Icon.setVisible(attackTwo.isShowUI());
|
||||
this.attack2IconBackdrop.setTexture(this.damageBackdrops.getTexture(attackTwo.getAttackType()));
|
||||
this.attack2InfoPanelIconValue.setText(attackTwo.getMinDamage() + " - " + attackTwo.getMaxDamage());
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
this.attack2Icon.setVisible(false);
|
||||
}
|
||||
|
||||
this.armorIcon.addSetPoint(
|
||||
new SetPoint(FramePoint.TOPLEFT, this.simpleInfoPanelUnitDetail, FramePoint.TOPLEFT,
|
||||
this.armorIcon
|
||||
.addSetPoint(new SetPoint(FramePoint.TOPLEFT, this.simpleInfoPanelUnitDetail, FramePoint.TOPLEFT,
|
||||
GameUI.convertX(this.uiViewport, 0f), GameUI.convertY(this.uiViewport, -0.06025f)));
|
||||
this.armorIcon.positionBounds(this.uiViewport);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
this.attack1Icon.setVisible(false);
|
||||
this.attack2Icon.setVisible(false);
|
||||
|
||||
@ -714,9 +751,9 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
|
||||
}
|
||||
|
||||
localArmorIcon.setVisible(!constructing);
|
||||
buildTimeIndicator.setVisible(constructing);
|
||||
this.simpleBuildTimeIndicator.setVisible(constructing);
|
||||
if (constructing) {
|
||||
buildTimeIndicator.setSequence(0);
|
||||
this.simpleBuildingActionLabel.setText(this.rootFrame.getTemplates().getDecoratedString("CONSTRUCTING"));
|
||||
}
|
||||
final Texture defenseTexture = this.defenseBackdrops
|
||||
.getTexture(unit.getSimulationUnit().getUnitType().getDefenseType());
|
||||
@ -728,7 +765,6 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
|
||||
localArmorInfoPanelIconValue.setText(Integer.toString(unit.getSimulationUnit().getDefense()));
|
||||
clearAndRepopulateCommandCard();
|
||||
}
|
||||
}
|
||||
|
||||
private void clearCommandCard() {
|
||||
for (int j = 0; j < COMMAND_CARD_HEIGHT; j++) {
|
||||
@ -780,7 +816,8 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
|
||||
final Texture suffixTexture = gameUI.loadTexture(gameUI.getSkinField(skinLookupKey));
|
||||
if (suffixTexture != null) {
|
||||
this.damageBackdropTextures[index] = suffixTexture;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
skinLookupKey = "InfoPanelIcon" + prefix + attackType.getCodeKey();
|
||||
this.damageBackdropTextures[index] = gameUI.loadTexture(gameUI.getSkinField(skinLookupKey));
|
||||
}
|
||||
@ -826,7 +863,8 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
|
||||
public void lifeChanged() {
|
||||
if (this.selectedUnit.getSimulationUnit().isDead()) {
|
||||
selectUnit(null);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
this.unitLifeText
|
||||
.setText(FastNumberFormat.formatWholeNumber(this.selectedUnit.getSimulationUnit().getLife()) + " / "
|
||||
+ this.selectedUnit.getSimulationUnit().getMaximumLife());
|
||||
@ -835,7 +873,7 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
|
||||
|
||||
@Override
|
||||
public void ordersChanged(final int abilityHandleId, final int orderId) {
|
||||
selectUnit(selectedUnit);
|
||||
reloadSelectedUnitUI(this.selectedUnit);
|
||||
}
|
||||
|
||||
private void clearAndRepopulateCommandCard() {
|
||||
@ -846,9 +884,11 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
|
||||
final IconUI cancelUI = abilityDataUI.getCancelUI();
|
||||
this.commandButton(cancelUI.getButtonPositionX(), cancelUI.getButtonPositionY(), cancelUI.getIcon(), 0,
|
||||
menuOrderId, 0, false, false, true);
|
||||
} else if (this.selectedUnit.getSimulationUnit().isConstructing()) {
|
||||
}
|
||||
else if (this.selectedUnit.getSimulationUnit().isConstructing()) {
|
||||
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (menuOrderId != 0) {
|
||||
final int exitOrderId = this.subMenuOrderIdStack.size() > 1
|
||||
? this.subMenuOrderIdStack.get(this.subMenuOrderIdStack.size() - 2)
|
||||
@ -901,7 +941,8 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
|
||||
this.activeCommand = null;
|
||||
this.activeCommandOrderId = -1;
|
||||
clearAndRepopulateCommandCard();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
final RenderUnit rayPickUnit = this.war3MapViewer.rayPickUnit(screenX, worldScreenY,
|
||||
this.activeCommandUnitTargetFilter);
|
||||
final boolean shiftDown = isShiftDown();
|
||||
@ -922,7 +963,8 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
|
||||
this.activeCommandOrderId = -1;
|
||||
clearAndRepopulateCommandCard();
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
this.war3MapViewer.getClickLocation(clickLocationTemp, screenX, (int) worldScreenY);
|
||||
clickLocationTemp2.set(clickLocationTemp.x, clickLocationTemp.y);
|
||||
|
||||
@ -933,7 +975,8 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
|
||||
if (target != null) {
|
||||
if (this.activeCommand instanceof CAbilityAttack) {
|
||||
this.war3MapViewer.showConfirmation(clickLocationTemp, 1, 0, 0);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
this.war3MapViewer.showConfirmation(clickLocationTemp, 0, 1, 0);
|
||||
}
|
||||
this.unitOrderListener.issuePointOrder(
|
||||
@ -960,7 +1003,8 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (button == Input.Buttons.RIGHT) {
|
||||
if (getSelectedUnit() != null) {
|
||||
final RenderUnit rayPickUnit = this.war3MapViewer.rayPickUnit(screenX, worldScreenY);
|
||||
@ -988,7 +1032,8 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
|
||||
}
|
||||
this.selectedSoundCount = 0;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
this.war3MapViewer.getClickLocation(clickLocationTemp, screenX, (int) worldScreenY);
|
||||
this.war3MapViewer.showConfirmation(clickLocationTemp, 0, 1, 0);
|
||||
clickLocationTemp2.set(clickLocationTemp.x, clickLocationTemp.y);
|
||||
@ -1024,7 +1069,8 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
final List<RenderUnit> selectedUnits = this.war3MapViewer.selectUnit(screenX, worldScreenY, false);
|
||||
if (!selectedUnits.isEmpty()) {
|
||||
final RenderUnit unit = selectedUnits.get(0);
|
||||
@ -1038,18 +1084,21 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
|
||||
int soundIndex;
|
||||
final int pissedSoundCount = unit.soundset.pissed.getSoundCount();
|
||||
if (unit.getSimulationUnit().isConstructing()) {
|
||||
ackSoundToPlay = unit.buildSound;
|
||||
soundIndex = 0;
|
||||
} else {
|
||||
ackSoundToPlay = this.war3MapViewer.getUiSounds()
|
||||
.getSound(this.rootFrame.getSkinField("ConstructingBuilding"));
|
||||
soundIndex = (int) (Math.random() * ackSoundToPlay.getSoundCount());
|
||||
}
|
||||
else {
|
||||
if ((this.selectedSoundCount >= 3) && (pissedSoundCount > 0)) {
|
||||
soundIndex = this.selectedSoundCount - 3;
|
||||
ackSoundToPlay = unit.soundset.pissed;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
soundIndex = (int) (Math.random() * ackSoundToPlay.getSoundCount());
|
||||
}
|
||||
}
|
||||
if (ackSoundToPlay != null && ackSoundToPlay.playUnitResponse(this.war3MapViewer.worldScene.audioContext, unit,
|
||||
soundIndex)) {
|
||||
if ((ackSoundToPlay != null) && ackSoundToPlay
|
||||
.playUnitResponse(this.war3MapViewer.worldScene.audioContext, unit, soundIndex)) {
|
||||
this.selectedSoundCount++;
|
||||
if ((this.selectedSoundCount - 3) >= pissedSoundCount) {
|
||||
this.selectedSoundCount = 0;
|
||||
@ -1063,12 +1112,14 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
|
||||
if (playedNewSound) {
|
||||
portraitTalk();
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
selectUnit(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (clickedUIFrame instanceof CommandCardIcon) {
|
||||
this.mouseDownUIFrame = (CommandCardIcon) clickedUIFrame;
|
||||
this.mouseDownUIFrame.mouseDown(this.uiViewport);
|
||||
|
Loading…
Reference in New Issue
Block a user