Update some ui and internal systems

This commit is contained in:
Retera 2021-08-06 20:54:18 -04:00
parent ab98d90eab
commit 28a05a8d0f
9 changed files with 56 additions and 39 deletions

View File

@ -1,12 +1,20 @@
[DataSources] [DataSources]
Count=5 Count=9
Type00=Folder Type00=MPQ
Path00="D:\Backups\Warcraft\Data\UIMod" Path00="D:\Games\Warcraft III Patch 1.22\war3.mpq"
Type01=Folder Type01=MPQ
Path01="..\..\resources" Path01="D:\Games\Warcraft III Patch 1.22\War3x.mpq"
Type02=Folder Type02=MPQ
Path02="D:\Backups\Warsmash\Data" Path02="D:\Games\Warcraft III Patch 1.22\War3xlocal.mpq"
Type03=Folder Type03=MPQ
Path03="D:\Games\Warcraft III Patch 1.22\Maps" Path03="D:\Games\Warcraft III Patch 1.22\War3Patch.mpq"
Type04=Folder Type04=MPQ
Path04="." Path04="D:\Games\Warcraft III Patch 1.22\Warsmash\War3Mod.mpq"
Type05=Folder
Path05="..\..\resources"
Type06=Folder
Path06="D:\Backups\Warsmash\Data"
Type07=Folder
Path07="D:\Games\Warcraft III Patch 1.22\Maps"
Type08=Folder
Path08="."

View File

@ -1,20 +0,0 @@
[DataSources]
Count=9
Type00=MPQ
Path00="D:\Games\Warcraft III Patch 1.22\war3.mpq"
Type01=MPQ
Path01="D:\Games\Warcraft III Patch 1.22\War3x.mpq"
Type02=MPQ
Path02="D:\Games\Warcraft III Patch 1.22\War3xlocal.mpq"
Type03=MPQ
Path03="D:\Games\Warcraft III Patch 1.22\War3Patch.mpq"
Type04=MPQ
Path04="D:\Games\Warcraft III Patch 1.22\Warsmash\War3Mod.mpq"
Type05=Folder
Path05="..\..\resources"
Type06=Folder
Path06="D:\Backups\Warsmash\Data"
Type07=Folder
Path07="D:\Games\Warcraft III Patch 1.22\Maps"
Type08=Folder
Path08="."

View File

@ -0,0 +1,12 @@
[DataSources]
Count=5
Type00=Folder
Path00="D:\Backups\Warcraft\Data\UIMod"
Type01=Folder
Path01="..\..\resources"
Type02=Folder
Path02="D:\Backups\Warsmash\Data"
Type03=Folder
Path03="D:\Games\Warcraft III Patch 1.22\Maps"
Type04=Folder
Path04="."

View File

@ -20,6 +20,7 @@ public class SequenceUtils {
public static final EnumSet<SecondaryTag> HIT = EnumSet.of(SecondaryTag.HIT); public static final EnumSet<SecondaryTag> HIT = EnumSet.of(SecondaryTag.HIT);
public static final EnumSet<SecondaryTag> SPELL = EnumSet.of(SecondaryTag.SPELL); public static final EnumSet<SecondaryTag> SPELL = EnumSet.of(SecondaryTag.SPELL);
public static final EnumSet<SecondaryTag> WORK = EnumSet.of(SecondaryTag.WORK); public static final EnumSet<SecondaryTag> WORK = EnumSet.of(SecondaryTag.WORK);
public static final EnumSet<SecondaryTag> FAST = EnumSet.of(SecondaryTag.FAST);
private static final StandSequenceComparator STAND_SEQUENCE_COMPARATOR = new StandSequenceComparator(); private static final StandSequenceComparator STAND_SEQUENCE_COMPARATOR = new StandSequenceComparator();
private static final SecondaryTagSequenceComparator SECONDARY_TAG_SEQUENCE_COMPARATOR = new SecondaryTagSequenceComparator( private static final SecondaryTagSequenceComparator SECONDARY_TAG_SEQUENCE_COMPARATOR = new SecondaryTagSequenceComparator(

View File

@ -1742,4 +1742,8 @@ public class CUnit extends CWidget {
return this.updateType; return this.updateType;
} }
} }
public float getAnimationRunSpeedRatio() {
return this.unitType.getAnimationRunSpeed() / this.speed;
}
} }

View File

@ -75,7 +75,8 @@ public class CUnitType {
private final int properNamesCount; private final int properNamesCount;
private final boolean canFlee; private final boolean canFlee;
private final int priority; private final int priority;
private boolean revivesHeroes; private final boolean revivesHeroes;
private final float animationRunSpeed;
public CUnitType(final String name, final String legacyName, final War3ID typeId, final int maxLife, public CUnitType(final String name, final String legacyName, final War3ID typeId, final int maxLife,
final int manaInitial, final int manaMaximum, final int speed, final int defense, final String abilityList, final int manaInitial, final int manaMaximum, final int speed, final int defense, final String abilityList,
@ -93,7 +94,7 @@ public class CUnitType {
final float strengthPerLevel, final int agility, final float agilityPerLevel, final int intelligence, final float strengthPerLevel, final int agility, final float agilityPerLevel, final int intelligence,
final float intelligencePerLevel, final CPrimaryAttribute primaryAttribute, final float intelligencePerLevel, final CPrimaryAttribute primaryAttribute,
final List<War3ID> heroAbilityList, final List<String> heroProperNames, final int properNamesCount, final List<War3ID> heroAbilityList, final List<String> heroProperNames, final int properNamesCount,
final boolean canFlee, final int priority, boolean revivesHeroes) { final boolean canFlee, final int priority, final boolean revivesHeroes, final float animationRunSpeed) {
this.name = name; this.name = name;
this.legacyName = legacyName; this.legacyName = legacyName;
this.typeId = typeId; this.typeId = typeId;
@ -148,6 +149,7 @@ public class CUnitType {
this.canFlee = canFlee; this.canFlee = canFlee;
this.priority = priority; this.priority = priority;
this.revivesHeroes = revivesHeroes; this.revivesHeroes = revivesHeroes;
this.animationRunSpeed = animationRunSpeed;
} }
public String getName() { public String getName() {
@ -363,6 +365,10 @@ public class CUnitType {
} }
public boolean isRevivesHeroes() { public boolean isRevivesHeroes() {
return revivesHeroes; return this.revivesHeroes;
}
public float getAnimationRunSpeed() {
return this.animationRunSpeed;
} }
} }

View File

@ -274,6 +274,7 @@ public class CAbilityInventory extends AbstractGenericNoIconAbility {
for (final CAbility ability : this.itemsHeldAbilities[slotIndex]) { for (final CAbility ability : this.itemsHeldAbilities[slotIndex]) {
hero.remove(simulation, ability); hero.remove(simulation, ability);
} }
this.itemsHeldAbilities[slotIndex].clear();
droppedItem.setHidden(false); droppedItem.setHidden(false);
droppedItem.setPointAndCheckUnstuck(x, y, simulation); droppedItem.setPointAndCheckUnstuck(x, y, simulation);
} }
@ -295,6 +296,7 @@ public class CAbilityInventory extends AbstractGenericNoIconAbility {
for (final CAbility ability : this.itemsHeldAbilities[index]) { for (final CAbility ability : this.itemsHeldAbilities[index]) {
hero.remove(simulation, ability); hero.remove(simulation, ability);
} }
this.itemsHeldAbilities[index].clear();
itemToDrop.setPointAndCheckUnstuck(x, y, simulation); itemToDrop.setPointAndCheckUnstuck(x, y, simulation);
} }
} }

View File

@ -325,8 +325,8 @@ public class CBehaviorMove implements CBehavior {
return this; return this;
} }
} }
this.unit.getUnitAnimationListener().playAnimation(false, PrimaryTag.WALK, SequenceUtils.EMPTY, 1.0f, this.unit.getUnitAnimationListener().playAnimation(false, PrimaryTag.WALK, SequenceUtils.FAST,
true); this.unit.getAnimationRunSpeedRatio(), true);
this.wasWithinPropWindow = true; this.wasWithinPropWindow = true;
} }
while (continueDistance > 0); while (continueDistance > 0);

View File

@ -172,6 +172,8 @@ public class CUnitData {
private static final War3ID CAN_FLEE = War3ID.fromString("ufle"); private static final War3ID CAN_FLEE = War3ID.fromString("ufle");
private static final War3ID PRIORITY = War3ID.fromString("upri"); private static final War3ID PRIORITY = War3ID.fromString("upri");
private static final War3ID ANIMATION_RUN_SPEED = War3ID.fromString("urun");
private final CGameplayConstants gameplayConstants; private final CGameplayConstants gameplayConstants;
private final MutableObjectData unitData; private final MutableObjectData unitData;
private final Map<War3ID, CUnitType> unitIdToUnitType = new HashMap<>(); private final Map<War3ID, CUnitType> unitIdToUnitType = new HashMap<>();
@ -245,7 +247,7 @@ public class CUnitData {
if (!unitsTrained.isEmpty() || !researchesAvailable.isEmpty()) { if (!unitsTrained.isEmpty() || !researchesAvailable.isEmpty()) {
unit.add(simulation, new CAbilityQueue(handleIdAllocator.createId(), unitsTrained, researchesAvailable)); unit.add(simulation, new CAbilityQueue(handleIdAllocator.createId(), unitsTrained, researchesAvailable));
} }
if(unitTypeInstance.isRevivesHeroes()) { if (unitTypeInstance.isRevivesHeroes()) {
unit.add(simulation, new CAbilityReviveHero(handleIdAllocator.createId())); unit.add(simulation, new CAbilityReviveHero(handleIdAllocator.createId()));
} }
if (!unitsTrained.isEmpty() || unitTypeInstance.isRevivesHeroes()) { if (!unitsTrained.isEmpty() || unitTypeInstance.isRevivesHeroes()) {
@ -283,6 +285,8 @@ public class CUnitData {
final int unitLevel = unitType.getFieldAsInteger(UNIT_LEVEL, 0); final int unitLevel = unitType.getFieldAsInteger(UNIT_LEVEL, 0);
final int priority = unitType.getFieldAsInteger(PRIORITY, 0); final int priority = unitType.getFieldAsInteger(PRIORITY, 0);
final float animationRunSpeed = unitType.getFieldAsFloat(ANIMATION_RUN_SPEED, 0);
final float moveHeight = unitType.getFieldAsFloat(MOVE_HEIGHT, 0); final float moveHeight = unitType.getFieldAsFloat(MOVE_HEIGHT, 0);
final String movetp = unitType.getFieldAsString(MOVE_TYPE, 0); final String movetp = unitType.getFieldAsString(MOVE_TYPE, 0);
final float collisionSize = unitType.getFieldAsFloat(COLLISION_SIZE, 0); final float collisionSize = unitType.getFieldAsFloat(COLLISION_SIZE, 0);
@ -455,7 +459,7 @@ public class CUnitData {
final int foodUsed = unitType.getFieldAsInteger(FOOD_USED, 0); final int foodUsed = unitType.getFieldAsInteger(FOOD_USED, 0);
final int foodMade = unitType.getFieldAsInteger(FOOD_MADE, 0); final int foodMade = unitType.getFieldAsInteger(FOOD_MADE, 0);
boolean revivesHeroes = unitType.getFieldAsBoolean(REVIVES_HEROES, 0); final boolean revivesHeroes = unitType.getFieldAsBoolean(REVIVES_HEROES, 0);
final String unitsTrainedString = unitType.getFieldAsString(UNITS_TRAINED, 0); final String unitsTrainedString = unitType.getFieldAsString(UNITS_TRAINED, 0);
final String[] unitsTrainedStringItems = unitsTrainedString.trim().split(","); final String[] unitsTrainedStringItems = unitsTrainedString.trim().split(",");
@ -545,7 +549,7 @@ public class CUnitData {
goldCost, lumberCost, foodUsed, foodMade, buildTime, preventedPathingTypes, requiredPathingTypes, goldCost, lumberCost, foodUsed, foodMade, buildTime, preventedPathingTypes, requiredPathingTypes,
propWindow, turnRate, requirements, unitLevel, hero, strength, strPlus, agility, agiPlus, propWindow, turnRate, requirements, unitLevel, hero, strength, strPlus, agility, agiPlus,
intelligence, intPlus, primaryAttribute, heroAbilityList, heroProperNames, properNamesCount, intelligence, intPlus, primaryAttribute, heroAbilityList, heroProperNames, properNamesCount,
canFlee, priority, revivesHeroes); canFlee, priority, revivesHeroes, animationRunSpeed);
this.unitIdToUnitType.put(typeId, unitTypeInstance); this.unitIdToUnitType.put(typeId, unitTypeInstance);
this.jassLegacyNameToUnitId.put(legacyName, typeId); this.jassLegacyNameToUnitId.put(legacyName, typeId);
} }