Fun UI changes to stylize with a slightly smaller footprint UI, inspired by 2018 demo

This commit is contained in:
Retera 2021-08-01 01:01:10 -04:00
parent 019a7d8bba
commit ab98d90eab
19 changed files with 306 additions and 141 deletions

View File

@ -1,20 +1,12 @@
[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="."
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

@ -0,0 +1,20 @@
[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

@ -1,47 +0,0 @@
[DataSources]
Count=5
Type00=Folder
Path00="D:\Backups\Warcraft\Data\HiResFlat"
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="."
[Map]
//FilePath="CombatUnitTests.w3x"
//FilePath="PitchRoll.w3x"
//FilePath="PeonStartingBase_Simple.w3x"
FilePath="PeonStartingBase_Scythe.w3x"
//FilePath="MyStromguarde.w3m"
//FilePath="ColdArrows.w3m"
//FilePath="DungeonGoldMine.w3m"
//FilePath="PlayerPeasants.w3m"
//FilePath="FireLord.w3x"
//FilePath="Maps\Campaign\NightElf03.w3m"
//FilePath="PhoenixAttack.w3x"
//FilePath="LightEnvironmentTest.w3x"
//FilePath="TorchLight2.w3x"
//FilePath="OrcAssault.w3x"
//FilePath="FrostyVsFarm.w3m"
//FilePath="ModelTest.w3x"
//FilePath="SpinningSample.w3x"
//FilePath="Maps\Campaign\Prologue02.w3m"
//FilePath="Pathing.w3x"
//FilePath="ItemFacing.w3x"
//FilePath=SomeParticleTests.w3x
//FilePath="PeonMiningMultiHall.w3x"
//FilePath="QuadtreeBugs.w3x"
//FilePath="test2.w3x"
//FilePath="FarseerHoldPositionTest.w3x"
//FilePath="Ramps.w3m"
//FilePath="V1\Farm.w3x"
//FilePath="PenguinWorld.w3x"
//FilePath="Maps\FrozenThrone\Campaign\UndeadX09.w3x"
//FilePath="LavellaLagoon.w3x"
//FilePath="WiceOrc.w3x"
//FilePath="NorthrendPathingDoodle.w3x"
//FilePath="Maps\Campaign\Prologue01.w3m"

View File

@ -127,6 +127,7 @@ public class WarsmashGdxMapScreen implements InputProcessor, Screen {
Gdx.gl30.glEnable(GL30.GL_SCISSOR_TEST);
final Scene portraitScene = this.viewer.addSimpleScene();
portraitScene.alpha = true;
this.uiScene = this.viewer.addSimpleScene();
this.uiScene.alpha = true;
if (ENABLE_AUDIO) {
@ -334,8 +335,8 @@ public class WarsmashGdxMapScreen implements InputProcessor, Screen {
private Rectangle setupWorldFrameViewport(final int width, final int height) {
this.tempRect.x = 0;
this.tempRect.width = width;
final float topHeight = 0.02666f * height;
final float bottomHeight = 0.21333f * height;
final float topHeight = 0;// 0.02666f * height;
final float bottomHeight = 0;// 0.21333f * height;
this.tempRect.y = (int) bottomHeight;
this.tempRect.height = height - (int) (topHeight + bottomHeight);
return this.tempRect;

View File

@ -25,7 +25,7 @@ public class WarsmashConstants {
// find it yet so I used this
public static final String DEFAULT_STRING = "Default string";
public static final boolean CATCH_CURSOR = true;
public static final boolean CATCH_CURSOR = false;
public static final boolean VERBOSE_LOGGING = true;
public static final boolean ENABLE_DEBUG = false;
public static final char SPECIAL_ESCAPE_KEYCODE = 0x7E;

View File

@ -153,8 +153,8 @@ public class TerrainShaders {
" float hU = texelFetch(height_texture, height_pos + off.zy, 0).r;\r\n" + //
" vec3 normal = normalize(vec3(hL - hR, hD - hU, 2.0));\r\n" + //
"\r\n" + //
" UV = vec2(vPosition.x, 1 - vPosition.y);\r\n" + //
// " UV = vec2(vPosition.x==0?0.01:0.99, vPosition.y==0?0.99:0.01);\r\n" + //
// " UV = vec2(vPosition.x, 1 - vPosition.y);\r\n" + //
" UV = vec2(vPosition.x==0?0.01:0.99, vPosition.y==0?0.99:0.01);\r\n" + //
" texture_indices = texelFetch(terrain_texture_list, pos, 0);\r\n" + //
" pathing_map_uv = (vPosition + pos) * 4; \r\n" + //
"\r\n" + //

View File

@ -112,7 +112,7 @@ public class CSimulation implements CPlayerAPI {
for (int i = 0; i < WarsmashConstants.MAX_PLAYERS; i++) {
final CBasePlayer configPlayer = config.getPlayer(i);
final War3MapConfigStartLoc startLoc = config.getStartLoc(configPlayer.getStartLocationIndex());
final CRace defaultRace = CRace.ORC;
final CRace defaultRace = CRace.NIGHTELF;
final CPlayer newPlayer = new CPlayer(defaultRace, new float[] { startLoc.getX(), startLoc.getY() },
configPlayer);
this.players.add(newPlayer);

View File

@ -66,7 +66,7 @@ public class CAbilityInventory extends AbstractGenericNoIconAbility {
@Override
public boolean checkBeforeQueue(final CSimulation game, final CUnit caster, final int orderId,
final AbilityTarget target) {
if ((orderId >= OrderIds.itemdrag00) && (orderId <= OrderIds.itemdrag05)) {
if ((orderId >= OrderIds.itemdrag00) && (orderId <= OrderIds.itemdrag08)) {
for (int i = 0; i < this.itemsHeld.length; i++) {
if (this.itemsHeld[i] == target) {
final CItem temp = this.itemsHeld[i];
@ -80,7 +80,7 @@ public class CAbilityInventory extends AbstractGenericNoIconAbility {
}
}
}
else if ((orderId >= OrderIds.itemuse00) && (orderId <= OrderIds.itemuse05)) {
else if ((orderId >= OrderIds.itemuse00) && (orderId <= OrderIds.itemuse08)) {
final CAbility cAbility = this.itemsHeldAbilities[orderId - OrderIds.itemuse00].get(0);
int forwardedOrderId = orderId;
if (cAbility instanceof GenericSingleIconActiveAbility) {
@ -158,7 +158,7 @@ public class CAbilityInventory extends AbstractGenericNoIconAbility {
}
}
else {
if ((orderId >= OrderIds.itemdrag00) && (orderId <= OrderIds.itemdrag05)) {
if ((orderId >= OrderIds.itemdrag00) && (orderId <= OrderIds.itemdrag08)) {
if (target instanceof CItem) {
final int slot = getSlot((CItem) target);
if (slot != -1) {
@ -197,7 +197,7 @@ public class CAbilityInventory extends AbstractGenericNoIconAbility {
@Override
public void checkCanTargetNoTarget(final CSimulation game, final CUnit unit, final int orderId,
final AbilityTargetCheckReceiver<Void> receiver) {
if ((orderId >= OrderIds.itemuse00) && (orderId <= OrderIds.itemuse05)) {
if ((orderId >= OrderIds.itemuse00) && (orderId <= OrderIds.itemuse08)) {
receiver.targetOk(null);
}
else {
@ -208,7 +208,7 @@ public class CAbilityInventory extends AbstractGenericNoIconAbility {
@Override
protected void innerCheckCanUse(final CSimulation game, final CUnit unit, final int orderId,
final AbilityActivationReceiver receiver) {
if ((orderId >= OrderIds.itemuse00) && (orderId <= OrderIds.itemuse05)) {
if ((orderId >= OrderIds.itemuse00) && (orderId <= OrderIds.itemuse08)) {
final int slot = orderId - OrderIds.itemuse00;
if (this.itemsHeldAbilities[slot].size() < 1) {
receiver.notAnActiveAbility();

View File

@ -0,0 +1,84 @@
package com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilities.item;
import com.etheller.warsmash.util.War3ID;
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.CSimulation;
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.CUnit;
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.CWidget;
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilities.generic.AbstractGenericNoIconAbility;
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilities.targeting.AbilityPointTarget;
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.behaviors.CBehavior;
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.combat.attacks.CUnitAttack;
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.util.AbilityActivationReceiver;
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.util.AbilityTargetCheckReceiver;
public class CAbilityItemAttackBonus extends AbstractGenericNoIconAbility {
private final int damageBonus;
public CAbilityItemAttackBonus(final int handleId, final War3ID alias, final int damageBonus) {
super(handleId, alias);
this.damageBonus = damageBonus;
}
@Override
public void onAdd(final CSimulation game, final CUnit unit) {
for (final CUnitAttack attack : unit.getAttacks()) {
attack.setTemporaryDamageBonus(attack.getTemporaryDamageBonus() + this.damageBonus);
}
}
@Override
public void onRemove(final CSimulation game, final CUnit unit) {
for (final CUnitAttack attack : unit.getAttacks()) {
attack.setTemporaryDamageBonus(attack.getTemporaryDamageBonus() - this.damageBonus);
}
}
@Override
public void onTick(final CSimulation game, final CUnit unit) {
}
@Override
public CBehavior begin(final CSimulation game, final CUnit caster, final int orderId, final CWidget target) {
return null;
}
@Override
public CBehavior begin(final CSimulation game, final CUnit caster, final int orderId,
final AbilityPointTarget point) {
return null;
}
@Override
public CBehavior beginNoTarget(final CSimulation game, final CUnit caster, final int orderId) {
return null;
}
@Override
public void checkCanTarget(final CSimulation game, final CUnit unit, final int orderId, final CWidget target,
final AbilityTargetCheckReceiver<CWidget> receiver) {
receiver.orderIdNotAccepted();
}
@Override
public void checkCanTarget(final CSimulation game, final CUnit unit, final int orderId,
final AbilityPointTarget target, final AbilityTargetCheckReceiver<AbilityPointTarget> receiver) {
receiver.orderIdNotAccepted();
}
@Override
public void checkCanTargetNoTarget(final CSimulation game, final CUnit unit, final int orderId,
final AbilityTargetCheckReceiver<Void> receiver) {
receiver.orderIdNotAccepted();
}
@Override
protected void innerCheckCanUse(final CSimulation game, final CUnit unit, final int orderId,
final AbilityActivationReceiver receiver) {
receiver.notAnActiveAbility();
}
@Override
public void onCancelFromQueue(final CSimulation game, final CUnit unit, final int orderId) {
}
}

View File

@ -0,0 +1,33 @@
package com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilities.types.definitions.impl;
import java.util.EnumSet;
import java.util.List;
import com.etheller.warsmash.units.manager.MutableObjectData.MutableGameObject;
import com.etheller.warsmash.util.War3ID;
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilities.types.CAbilityType;
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilities.types.definitions.CAbilityTypeDefinition;
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilities.types.impl.CAbilityTypeItemAttackBonus;
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilities.types.impl.CAbilityTypeItemAttackBonusLevelData;
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.combat.CTargetType;
public class CAbilityTypeDefinitionItemAttackBonus
extends AbstractCAbilityTypeDefinition<CAbilityTypeItemAttackBonusLevelData> implements CAbilityTypeDefinition {
protected static final War3ID ATTACK_BONUS = War3ID.fromString("Iatt");
@Override
protected CAbilityTypeItemAttackBonusLevelData createLevelData(final MutableGameObject abilityEditorData,
final int level) {
final String targetsAllowedAtLevelString = abilityEditorData.getFieldAsString(TARGETS_ALLOWED, level);
final int attackBonus = abilityEditorData.getFieldAsInteger(ATTACK_BONUS, level);
final EnumSet<CTargetType> targetsAllowedAtLevel = CTargetType.parseTargetTypeSet(targetsAllowedAtLevelString);
return new CAbilityTypeItemAttackBonusLevelData(targetsAllowedAtLevel, attackBonus);
}
@Override
protected CAbilityType<?> innerCreateAbilityType(final War3ID alias, final MutableGameObject abilityEditorData,
final List<CAbilityTypeItemAttackBonusLevelData> levelData) {
return new CAbilityTypeItemAttackBonus(alias, abilityEditorData.getCode(), levelData);
}
}

View File

@ -0,0 +1,23 @@
package com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilities.types.impl;
import java.util.List;
import com.etheller.warsmash.util.War3ID;
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilities.CAbility;
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilities.item.CAbilityItemAttackBonus;
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilities.types.CAbilityType;
public class CAbilityTypeItemAttackBonus extends CAbilityType<CAbilityTypeItemAttackBonusLevelData> {
public CAbilityTypeItemAttackBonus(final War3ID alias, final War3ID code,
final List<CAbilityTypeItemAttackBonusLevelData> levelData) {
super(alias, code, levelData);
}
@Override
public CAbility createAbility(final int handleId) {
final CAbilityTypeItemAttackBonusLevelData levelData = getLevelData(0);
return new CAbilityItemAttackBonus(handleId, getAlias(), levelData.getDamageBonus());
}
}

View File

@ -0,0 +1,19 @@
package com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilities.types.impl;
import java.util.EnumSet;
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilities.types.CAbilityTypeLevelData;
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.combat.CTargetType;
public class CAbilityTypeItemAttackBonusLevelData extends CAbilityTypeLevelData {
private final int damageBonus;
public CAbilityTypeItemAttackBonusLevelData(final EnumSet<CTargetType> targetsAllowed, final int damageBonus) {
super(targetsAllowed);
this.damageBonus = damageBonus;
}
public int getDamageBonus() {
return this.damageBonus;
}
}

View File

@ -10,14 +10,16 @@ import com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilities.CAbility;
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilities.CAbilityGeneric;
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilities.types.CAbilityType;
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilities.types.definitions.CAbilityTypeDefinition;
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilities.types.definitions.impl.*;
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilities.types.definitions.impl.CAbilityTypeDefinitionChannelTest;
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilities.types.definitions.impl.CAbilityTypeDefinitionColdArrows;
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilities.types.definitions.impl.CAbilityTypeDefinitionCoupleInstant;
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilities.types.definitions.impl.CAbilityTypeDefinitionGoldMine;
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilities.types.definitions.impl.CAbilityTypeDefinitionHarvest;
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilities.types.definitions.impl.CAbilityTypeDefinitionHumanRepair;
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilities.types.definitions.impl.CAbilityTypeDefinitionInventory;
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilities.types.definitions.impl.CAbilityTypeDefinitionInvulnerable;
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilities.types.definitions.impl.CAbilityTypeDefinitionItemAttackBonus;
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilities.types.definitions.impl.CAbilityTypeDefinitionItemHeal;
import com.etheller.warsmash.viewer5.handlers.w3x.simulation.abilities.types.definitions.impl.CAbilityTypeDefinitionReturnResources;
public class CAbilityData {
@ -43,6 +45,7 @@ public class CAbilityData {
this.codeToAbilityTypeDefinition.put(War3ID.fromString("Avul"), new CAbilityTypeDefinitionInvulnerable());
this.codeToAbilityTypeDefinition.put(War3ID.fromString("Acoi"), new CAbilityTypeDefinitionCoupleInstant());
this.codeToAbilityTypeDefinition.put(War3ID.fromString("AIhe"), new CAbilityTypeDefinitionItemHeal());
this.codeToAbilityTypeDefinition.put(War3ID.fromString("AIat"), new CAbilityTypeDefinitionItemAttackBonus());
}
public CAbilityType<?> getAbilityType(final War3ID alias) {

View File

@ -25,68 +25,74 @@ public class OrderIds {
* An item targeted order that move the target item to a certain inventory slot
* of the ordered hero.
*/
public static final int itemdrag00 = 852002;
public static final int itemdrag00 = 952002;
/**
* An item targeted order that move the target item to a certain inventory slot
* of the ordered hero.
*/
public static final int itemdrag01 = 852003;
public static final int itemdrag01 = 952003;
/**
* An item targeted order that move the target item to a certain inventory slot
* of the ordered hero.
*/
public static final int itemdrag02 = 852004;
public static final int itemdrag02 = 952004;
/**
* An item targeted order that move the target item to a certain inventory slot
* of the ordered hero.
*/
public static final int itemdrag03 = 852005;
public static final int itemdrag03 = 952005;
/**
* An item targeted order that move the target item to a certain inventory slot
* of the ordered hero.
*/
public static final int itemdrag04 = 852006;
public static final int itemdrag04 = 952006;
/**
* An item targeted order that move the target item to a certain inventory slot
* of the ordered hero.
*/
public static final int itemdrag05 = 852007;
public static final int itemdrag05 = 952007;
public static final int itemdrag06 = 952008;
public static final int itemdrag07 = 952009;
public static final int itemdrag08 = 952010;
/**
* An order that will make the ordered hero use the item in a certain inventory
* slot. If it's an order with no target or object or point targeted depends on
* the type of item.
*/
public static final int itemuse00 = 852008;
public static final int itemuse00 = 952011; // War3 852008 !! Smash 852011
/**
* An order that will make the ordered hero use the item in a certain inventory
* slot. If it's an order with no target or object or point targeted depends on
* the type of item.
*/
public static final int itemuse01 = 852009;
public static final int itemuse01 = 952012;// War3 852009
/**
* An order that will make the ordered hero use the item in a certain inventory
* slot. If it's an order with no target or object or point targeted depends on
* the type of item.
*/
public static final int itemuse02 = 852010;
public static final int itemuse02 = 952013;// War3 852010
/**
* An order that will make the ordered hero use the item in a certain inventory
* slot. If it's an order with no target or object or point targeted depends on
* the type of item.
*/
public static final int itemuse03 = 852011;
public static final int itemuse03 = 952014;// War3 852011
/**
* An order that will make the ordered hero use the item in a certain inventory
* slot. If it's an order with no target or object or point targeted depends on
* the type of item.
*/
public static final int itemuse04 = 852012;
public static final int itemuse04 = 952015;// War3 852012
/**
* An order that will make the ordered hero use the item in a certain inventory
* slot. If it's an order with no target or object or point targeted depends on
* the type of item.
*/
public static final int itemuse05 = 852013;
public static final int itemuse05 = 952016;// War3 852013
public static final int itemuse06 = 952017;// War3 852013
public static final int itemuse07 = 952018;// War3 852013
public static final int itemuse08 = 952019;// War3 852013
/**
* Order for AIaa ability, which blizzard made for tome of attack, but never
* used it. But it can actually change caster's base attack!

View File

@ -231,7 +231,7 @@ public enum JassGameEventsWar3 {
public static JassGameEventsWar3[] VALUES;
static {
final JassGameEventsWar3[] localValuesArray = values();
final JassGameEventsWar3 endValue = localValuesArray[localValuesArray.length];
final JassGameEventsWar3 endValue = localValuesArray[localValuesArray.length - 1];
VALUES = new JassGameEventsWar3[endValue.getEventId() + 1];
for (final JassGameEventsWar3 event : localValuesArray) {
VALUES[event.getEventId()] = event;

View File

@ -163,11 +163,11 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
private static final long WORLD_FRAME_MESSAGE_FADE_DURATION = WORLD_FRAME_MESSAGE_EXPIRE_MILLIS
- WORLD_FRAME_MESSAGE_FADEOUT_MILLIS;
private static final String BUILDING_PATHING_PREVIEW_KEY = "buildingPathingPreview";
public static final float DEFAULT_COMMAND_CARD_ICON_WIDTH = 0.039f;
public static final float DEFAULT_COMMAND_CARD_ICON_WIDTH = 0.03254f;
public static final float DEFAULT_INVENTORY_ICON_WIDTH = 0.03125f;
private static final int COMMAND_CARD_WIDTH = 4;
private static final int COMMAND_CARD_HEIGHT = 3;
private static final int INVENTORY_WIDTH = 2;
private static final int COMMAND_CARD_WIDTH = 6;
private static final int COMMAND_CARD_HEIGHT = 2;
private static final int INVENTORY_WIDTH = 3;
private static final int INVENTORY_HEIGHT = 3;
private static final Vector2 screenCoordsVector = new Vector2();
@ -357,9 +357,16 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
}
private MeleeUIMinimap createMinimap(final War3MapViewer war3MapViewer) {
final Rectangle minimapDisplayArea = new Rectangle(18.75f * this.widthRatioCorrection,
13.75f * this.heightRatioCorrection, 278.75f * this.widthRatioCorrection,
276.25f * this.heightRatioCorrection);
screenCoordsVector.x = this.uiViewport.getScreenX();
screenCoordsVector.y = 0;
this.uiViewport.unproject(screenCoordsVector);
final float mapScale = 0.7f;
final Rectangle minimapDisplayArea = new Rectangle(
screenCoordsVector.x + (18.75f * this.widthRatioCorrection * mapScale),
13.75f * this.heightRatioCorrection * mapScale, 278.75f * this.widthRatioCorrection * mapScale,
276.25f * this.heightRatioCorrection * mapScale);
final Rectangle minimapBorderArea = new Rectangle(screenCoordsVector.x, 0,
512f * this.widthRatioCorrection * mapScale, 512f * this.heightRatioCorrection * mapScale);
Texture minimapTexture = null;
if (war3MapViewer.dataSource.has("war3mapMap.tga")) {
try {
@ -374,13 +381,16 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
else if (war3MapViewer.dataSource.has("war3mapMap.blp")) {
minimapTexture = ImageUtils.getAnyExtensionTexture(war3MapViewer.dataSource, "war3mapMap.blp");
}
final Texture mapBorder = ImageUtils.getAnyExtensionTexture(war3MapViewer.dataSource,
"ui\\console\\nightelf\\nightelfuitilemapborder.blp");
final Texture[] teamColors = new Texture[WarsmashConstants.MAX_PLAYERS];
for (int i = 0; i < teamColors.length; i++) {
teamColors[i] = ImageUtils.getAnyExtensionTexture(war3MapViewer.dataSource,
"ReplaceableTextures\\" + ReplaceableIds.getPathString(1) + ReplaceableIds.getIdString(i) + ".blp");
}
final Rectangle playableMapArea = war3MapViewer.terrain.getPlayableMapArea();
return new MeleeUIMinimap(minimapDisplayArea, playableMapArea, minimapTexture, teamColors);
return new MeleeUIMinimap(minimapDisplayArea, playableMapArea, minimapTexture, teamColors, mapBorder,
minimapBorderArea);
}
/**
@ -605,10 +615,10 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
this.unitManaText = (StringFrame) this.rootFrame.getFrameByName("UnitPortraitManaPointText", 0);
final float infoPanelUnitDetailWidth = GameUI.convertY(this.uiViewport, 0.180f);
final float infoPanelUnitDetailHeight = GameUI.convertY(this.uiViewport, 0.112f);
final float infoPanelUnitDetailHeight = GameUI.convertY(this.uiViewport, 0.072f);
this.smashSimpleInfoPanel = this.rootFrame.createSimpleFrame("SmashSimpleInfoPanel", this.rootFrame, 0);
this.smashSimpleInfoPanel
.addAnchor(new AnchorDefinition(FramePoint.BOTTOM, 0, GameUI.convertY(this.uiViewport, 0.0f)));
this.smashSimpleInfoPanel.addAnchor(new AnchorDefinition(FramePoint.BOTTOM,
GameUI.convertX(this.uiViewport, -0.1f), GameUI.convertY(this.uiViewport, 0.0f)));
this.smashSimpleInfoPanel.setWidth(infoPanelUnitDetailWidth);
this.smashSimpleInfoPanel.setHeight(infoPanelUnitDetailHeight);
@ -666,9 +676,9 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
queueIconFrameBackdrop0
.addSetPoint(new SetPoint(FramePoint.CENTER, this.queueIconFrames[0], FramePoint.CENTER, 0, 0));
this.queueIconFrames[0].set(queueIconFrameBackdrop0);
this.queueIconFrames[0]
.addSetPoint(new SetPoint(FramePoint.CENTER, this.smashSimpleInfoPanel, FramePoint.BOTTOMLEFT,
(infoPanelUnitDetailWidth * (15 + 19f)) / 256, (infoPanelUnitDetailWidth * (66 + 19f)) / 256));
this.queueIconFrames[0].addSetPoint(new SetPoint(FramePoint.CENTER, this.smashSimpleInfoPanel,
FramePoint.BOTTOMLEFT, (infoPanelUnitDetailWidth * (15 + 19f)) / 256,
((infoPanelUnitDetailWidth * (66 + 19f)) / 256) - GameUI.convertY(this.uiViewport, 0.01f)));
final float frontQueueIconWidth = (infoPanelUnitDetailWidth * 38) / 256;
this.queueIconFrames[0].setWidth(frontQueueIconWidth);
this.queueIconFrames[0].setHeight(frontQueueIconWidth);
@ -685,7 +695,7 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
.addSetPoint(new SetPoint(FramePoint.CENTER, this.queueIconFrames[i], FramePoint.CENTER, 0, 0));
this.queueIconFrames[i].addSetPoint(new SetPoint(FramePoint.CENTER, this.smashSimpleInfoPanel,
FramePoint.BOTTOMLEFT, (infoPanelUnitDetailWidth * (13 + 14.5f + (40 * (i - 1)))) / 256,
(infoPanelUnitDetailWidth * (24 + 14.5f)) / 256));
((infoPanelUnitDetailWidth * (24 + 14.5f)) / 256) - GameUI.convertY(this.uiViewport, 0.01f)));
final float queueIconWidth = (infoPanelUnitDetailWidth * 29) / 256;
this.queueIconFrames[i].setWidth(queueIconWidth);
this.queueIconFrames[i].setHeight(queueIconWidth);
@ -732,9 +742,9 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
this.smashAttack1IconWrapper = (SimpleFrame) this.rootFrame.createSimpleFrame("SmashSimpleInfoPanelIconDamage",
this.simpleInfoPanelUnitDetail, 0);
this.smashAttack1IconWrapper.addSetPoint(new SetPoint(FramePoint.TOPLEFT, this.simpleInfoPanelUnitDetail,
FramePoint.TOPLEFT, 0, GameUI.convertY(this.uiViewport, -0.032f)));
FramePoint.TOPLEFT, 0, GameUI.convertY(this.uiViewport, -0.022f)));
this.smashAttack1IconWrapper.setWidth(GameUI.convertX(this.uiViewport, 0.1f));
this.smashAttack1IconWrapper.setHeight(GameUI.convertY(this.uiViewport, 0.030125f));
this.smashAttack1IconWrapper.setHeight(GameUI.convertY(this.uiViewport, 0.020125f));
this.attack1Icon = this.rootFrame.createSimpleFrame("SimpleInfoPanelIconDamage", this.smashAttack1IconWrapper,
0);
this.attack1IconBackdrop = (TextureFrame) this.rootFrame.getFrameByName("InfoPanelIconBackdrop", 0);
@ -745,9 +755,9 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
this.simpleInfoPanelUnitDetail, 0);
this.smashAttack2IconWrapper
.addSetPoint(new SetPoint(FramePoint.TOPLEFT, this.simpleInfoPanelUnitDetail, FramePoint.TOPLEFT,
GameUI.convertX(this.uiViewport, 0.1f), GameUI.convertY(this.uiViewport, -0.03125f)));
GameUI.convertX(this.uiViewport, 0.1f), GameUI.convertY(this.uiViewport, -0.02125f)));
this.smashAttack2IconWrapper.setWidth(GameUI.convertX(this.uiViewport, 0.1f));
this.smashAttack2IconWrapper.setHeight(GameUI.convertY(this.uiViewport, 0.030125f));
this.smashAttack2IconWrapper.setHeight(GameUI.convertY(this.uiViewport, 0.020125f));
this.attack2Icon = this.rootFrame.createSimpleFrame("SimpleInfoPanelIconDamage", this.smashAttack2IconWrapper,
1);
this.attack2IconBackdrop = (TextureFrame) this.rootFrame.getFrameByName("InfoPanelIconBackdrop", 1);
@ -757,9 +767,9 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
this.smashArmorIconWrapper = (SimpleFrame) this.rootFrame.createSimpleFrame("SmashSimpleInfoPanelIconArmor",
this.simpleInfoPanelUnitDetail, 0);
this.smashArmorIconWrapper.addSetPoint(new SetPoint(FramePoint.TOPLEFT, this.simpleInfoPanelUnitDetail,
FramePoint.TOPLEFT, GameUI.convertX(this.uiViewport, 0f), GameUI.convertY(this.uiViewport, -0.0625f)));
FramePoint.TOPLEFT, GameUI.convertX(this.uiViewport, 0f), GameUI.convertY(this.uiViewport, -0.0425f)));
this.smashArmorIconWrapper.setWidth(GameUI.convertX(this.uiViewport, 0.1f));
this.smashArmorIconWrapper.setHeight(GameUI.convertY(this.uiViewport, 0.030125f));
this.smashArmorIconWrapper.setHeight(GameUI.convertY(this.uiViewport, 0.020125f));
this.armorIcon = this.rootFrame.createSimpleFrame("SimpleInfoPanelIconArmor", this.smashArmorIconWrapper, 0);
this.armorIconBackdrop = (TextureFrame) this.rootFrame.getFrameByName("InfoPanelIconBackdrop", 0);
this.armorInfoPanelIconValue = (StringFrame) this.rootFrame.getFrameByName("InfoPanelIconValue", 0);
@ -768,9 +778,9 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
this.smashHeroInfoPanelWrapper = (SimpleFrame) this.rootFrame.createSimpleFrame("SmashSimpleInfoPanelIconHero",
this.simpleInfoPanelUnitDetail, 0);
this.smashHeroInfoPanelWrapper.addSetPoint(new SetPoint(FramePoint.TOPLEFT, this.simpleInfoPanelUnitDetail,
FramePoint.TOPLEFT, GameUI.convertX(this.uiViewport, 0.1f), GameUI.convertY(this.uiViewport, -0.029f)));
FramePoint.TOPLEFT, GameUI.convertX(this.uiViewport, 0.1f), GameUI.convertY(this.uiViewport, -0.02f)));
this.smashHeroInfoPanelWrapper.setWidth(GameUI.convertX(this.uiViewport, 0.1f));
this.smashHeroInfoPanelWrapper.setHeight(GameUI.convertY(this.uiViewport, 0.0625f));
this.smashHeroInfoPanelWrapper.setHeight(GameUI.convertY(this.uiViewport, 0.0325f));
this.heroInfoPanel = this.rootFrame.createSimpleFrame("SimpleInfoPanelIconHero", this.smashHeroInfoPanelWrapper,
0);
this.primaryAttributeIcon = (TextureFrame) this.rootFrame.getFrameByName("InfoPanelIconHeroIcon", 0);
@ -780,10 +790,11 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
this.inventoryBarFrame = (SimpleFrame) this.rootFrame.createSimpleFrame("SmashSimpleInventoryBar",
this.rootFrame, 0);
this.inventoryBarFrame.setWidth(GameUI.convertX(this.uiViewport, 0.079f));
this.inventoryBarFrame.setHeight(GameUI.convertY(this.uiViewport, 0.115f));
this.inventoryBarFrame.addSetPoint(new SetPoint(FramePoint.BOTTOMRIGHT, this.consoleUI, FramePoint.BOTTOMLEFT,
GameUI.convertX(this.uiViewport, 0.591f), GameUI.convertY(this.uiViewport, 0.0f)));
this.inventoryBarFrame.setWidth(GameUI.convertX(this.uiViewport, 0.115f));
this.inventoryBarFrame.setHeight(GameUI.convertY(this.uiViewport, 0.079f));
this.inventoryBarFrame.addSetPoint(new SetPoint(FramePoint.BOTTOMLEFT, this.consoleUI, FramePoint.BOTTOMRIGHT,
GameUI.convertX(this.uiViewport, 0.15f - 0.256f),
GameUI.convertY(this.uiViewport, -0.006f + (DEFAULT_INVENTORY_ICON_WIDTH * 1.25f))));
if (GameUI.DEBUG) {
final FilterModeTextureFrame placeholderPreview = new FilterModeTextureFrame(null, this.inventoryBarFrame,
@ -827,10 +838,9 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
this.inventoryTitleFrame = this.rootFrame.createStringFrame("SmashInventoryText", this.inventoryBarFrame,
new Color(0xFCDE12FF), TextJustify.CENTER, TextJustify.MIDDLE, 0.0109f);
this.rootFrame.setText(this.inventoryTitleFrame, this.rootFrame.getTemplates().getDecoratedString("INVENTORY"));
this.inventoryTitleFrame
.addSetPoint(new SetPoint(FramePoint.TOPLEFT, this.inventoryBarFrame, FramePoint.TOPLEFT,
GameUI.convertX(this.uiViewport, 0.004f), GameUI.convertY(this.uiViewport, 0.0165625f)));
this.inventoryTitleFrame.setWidth(GameUI.convertX(this.uiViewport, 0.071f));
this.inventoryTitleFrame.addSetPoint(new SetPoint(FramePoint.TOP, this.inventoryBarFrame, FramePoint.TOP,
GameUI.convertX(this.uiViewport, 0.000f), GameUI.convertY(this.uiViewport, 0.0165625f)));
this.inventoryTitleFrame.setWidth(GameUI.convertX(this.uiViewport, 0.10f));// 0.071f
this.inventoryTitleFrame.setHeight(GameUI.convertX(this.uiViewport, 0.01125f));
this.inventoryTitleFrame.setFontShadowColor(new Color(0f, 0f, 0f, 0.9f));
this.inventoryTitleFrame.setFontShadowOffsetX(GameUI.convertX(this.uiViewport, 0.001f));
@ -869,9 +879,12 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
"SmashCommandButton_" + (commandButtonIndex) + "_Cooldown", this.rootFrame, "", 0);
final SpriteFrame autocastFrame = (SpriteFrame) this.rootFrame.createFrameByType("SPRITE",
"SmashCommandButton_" + (commandButtonIndex) + "_Autocast", this.rootFrame, "", 0);
final int indexing = i + (j * COMMAND_CARD_WIDTH);
final int displayXIndex = i;// indexing % 6;
final int displayYIndex = j;// indexing / 6;
commandCardIcon.addAnchor(new AnchorDefinition(FramePoint.BOTTOMLEFT,
GameUI.convertX(this.uiViewport, 0.6175f + (0.0434f * i)),
GameUI.convertY(this.uiViewport, 0.095f - (0.044f * j))));
GameUI.convertX(this.uiViewport, 0.4155f + (0.03621f * displayXIndex)),
GameUI.convertY(this.uiViewport, 0.0375f - (0.03621f * displayYIndex))));
commandCardIcon.setWidth(GameUI.convertX(this.uiViewport, DEFAULT_COMMAND_CARD_ICON_WIDTH));
commandCardIcon.setHeight(GameUI.convertY(this.uiViewport, DEFAULT_COMMAND_CARD_ICON_WIDTH));
iconFrame.addSetPoint(new SetPoint(FramePoint.CENTER, commandCardIcon, FramePoint.CENTER, 0, 0));
@ -1344,7 +1357,7 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
}
this.meleeUIMinimap.render(batch, this.war3MapViewer.units);
this.meleeUIMinimap.render(batch, this.war3MapViewer.units, this.uiViewport);
this.timeIndicator.setFrameByRatio(this.war3MapViewer.simulation.getGameTimeOfDay()
/ this.war3MapViewer.simulation.getGameplayConstants().getGameDayHours());
for (final TextTag textTag : this.war3MapViewer.textTags) {
@ -2158,7 +2171,7 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
this.smashArmorIconWrapper.addSetPoint(
new SetPoint(FramePoint.TOPLEFT, this.simpleInfoPanelUnitDetail, FramePoint.TOPLEFT,
GameUI.convertX(this.uiViewport, 0f), GameUI.convertY(this.uiViewport, -0.0625f)));
GameUI.convertX(this.uiViewport, 0f), GameUI.convertY(this.uiViewport, -0.0425f)));
this.smashArmorIconWrapper.positionBounds(this.rootFrame, this.uiViewport);
this.armorIcon.positionBounds(this.rootFrame, this.uiViewport);
}
@ -2168,7 +2181,7 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
this.smashArmorIconWrapper.addSetPoint(
new SetPoint(FramePoint.TOPLEFT, this.simpleInfoPanelUnitDetail, FramePoint.TOPLEFT,
GameUI.convertX(this.uiViewport, 0f), GameUI.convertY(this.uiViewport, -0.032f)));
GameUI.convertX(this.uiViewport, 0f), GameUI.convertY(this.uiViewport, -0.021f)));
this.smashArmorIconWrapper.positionBounds(this.rootFrame, this.uiViewport);
this.armorIcon.positionBounds(this.rootFrame, this.uiViewport);
}
@ -2363,12 +2376,17 @@ public class MeleeUI implements CUnitStateListener, CommandButtonListener, Comma
public void resize(final Rectangle viewport) {
this.cameraManager.resize(viewport);
positionPortrait();
screenCoordsVector.x = this.uiViewport.getScreenX();
screenCoordsVector.y = 0;
this.uiViewport.unproject(screenCoordsVector);
this.meleeUIMinimap.resizeNewX(screenCoordsVector.x);
}
public void positionPortrait() {
this.projectionTemp1.x = 422 * this.widthRatioCorrection;
this.projectionTemp1.x = 222 * this.widthRatioCorrection;
this.projectionTemp1.y = 57 * this.heightRatioCorrection;
this.projectionTemp2.x = (422 + 167) * this.widthRatioCorrection;
this.projectionTemp2.x = (222 + 167) * this.widthRatioCorrection;
this.projectionTemp2.y = (57 + 170) * this.heightRatioCorrection;
this.uiViewport.project(this.projectionTemp1);
this.uiViewport.project(this.projectionTemp2);

View File

@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.utils.viewport.Viewport;
import com.etheller.warsmash.viewer5.handlers.w3x.rendersim.RenderUnit;
public class MeleeUIMinimap {
@ -12,13 +13,17 @@ public class MeleeUIMinimap {
private final Texture minimapTexture;
private final Rectangle playableMapArea;
private final Texture[] teamColors;
private final Texture mapBorder;
private final Rectangle minimapBorderArea;
public MeleeUIMinimap(final Rectangle displayArea, final Rectangle playableMapArea, final Texture minimapTexture,
final Texture[] teamColors) {
final Texture[] teamColors, final Texture mapBorder, final Rectangle minimapBorderArea) {
this.playableMapArea = playableMapArea;
this.minimapTexture = minimapTexture;
this.teamColors = teamColors;
this.minimap = displayArea;
this.mapBorder = mapBorder;
this.minimapBorderArea = minimapBorderArea;
final float worldWidth = playableMapArea.getWidth();
final float worldHeight = playableMapArea.getHeight();
final float worldSize = Math.max(worldWidth, worldHeight);
@ -30,7 +35,9 @@ public class MeleeUIMinimap {
minimapFilledHeight);
}
public void render(final SpriteBatch batch, final Iterable<RenderUnit> units) {
public void render(final SpriteBatch batch, final Iterable<RenderUnit> units, final Viewport uiViewport) {
batch.draw(this.mapBorder, this.minimapBorderArea.x, this.minimapBorderArea.y, this.minimapBorderArea.width,
this.minimapBorderArea.height);
batch.draw(this.minimapTexture, this.minimap.x, this.minimap.y, this.minimap.width, this.minimap.height);
for (final RenderUnit unit : units) {
@ -59,4 +66,11 @@ public class MeleeUIMinimap {
public boolean containsMouse(final float x, final float y) {
return this.minimapFilledArea.contains(x, y);
}
public void resizeNewX(final float x) {
final float dx = x - this.minimapBorderArea.x;
this.minimapBorderArea.x += dx;
this.minimap.x += dx;
this.minimapFilledArea.x += dx;
}
}

View File

@ -2,14 +2,13 @@ Frame "SIMPLEFRAME" "SmashConsoleInventoryCover" {
DecorateFileNames,
SetAllPoints,
// The top of the UI console
Texture "SmashConsoleInventoryCoverTexture" {
File "ConsoleInventoryCoverTexture",
Width 0.128,
Height 0.176,
AlphaMode "ALPHAKEY",
TexCoord 0, 1, 0.3125, 1,
Anchor BOTTOMLEFT,0.472,0.0,
}
// Texture "SmashConsoleInventoryCoverTexture" {
// File "ConsoleInventoryCoverTexture",
// Width 0.128,
// Height 0.176,
// AlphaMode "ALPHAKEY",
// TexCoord 0, 1, 0.3125, 1,
// Anchor BOTTOMLEFT,0.472,0.0,
// }
}

View File

@ -14,7 +14,7 @@ String "UnitPortraitTextTemplate" {
Frame "SIMPLEFRAME" "UnitPortrait" {
DecorateFileNames,
SetPoint BOTTOMLEFT,"ConsoleUI",BOTTOMLEFT,0.211,0,
SetPoint BOTTOMLEFT,"ConsoleUI",BOTTOMLEFT,0.111,0,
Width 0.0835,
Height 0.114,