diff --git a/core/src/com/etheller/warsmash/WarsmashGdxMapScreen.java b/core/src/com/etheller/warsmash/WarsmashGdxMapScreen.java index 3ca6c6f..fcc8009 100644 --- a/core/src/com/etheller/warsmash/WarsmashGdxMapScreen.java +++ b/core/src/com/etheller/warsmash/WarsmashGdxMapScreen.java @@ -208,7 +208,7 @@ public class WarsmashGdxMapScreen implements InputProcessor, Screen { throw new RuntimeException(e); } this.commonEnv = Jass2.loadCommon(this.viewer.mapMpq, this.uiViewport, this.uiScene, this.viewer, this.meleeUI, - "Scripts\\common.j", "Scripts\\Blizzard.j", "war3map.j"); + "Scripts\\common.j", "Scripts\\Blizzard.j", "Scripts\\war3map.j"); this.commonEnv.main(); } diff --git a/core/src/com/etheller/warsmash/parsers/jass/Jass2.java b/core/src/com/etheller/warsmash/parsers/jass/Jass2.java index 5b9734a..e35a469 100644 --- a/core/src/com/etheller/warsmash/parsers/jass/Jass2.java +++ b/core/src/com/etheller/warsmash/parsers/jass/Jass2.java @@ -155,7 +155,12 @@ public class Jass2 { final JassProgramVisitor jassProgramVisitor = new JassProgramVisitor(); final CommonEnvironment environment = new CommonEnvironment(jassProgramVisitor, dataSource, uiViewport, uiScene, war3MapViewer, meleeUI); - for (final String jassFile : files) { + for (String jassFilePath : files) { + if (!dataSource.has(jassFilePath)) { + jassFilePath = jassFilePath + .substring(Math.max(jassFilePath.lastIndexOf('/'), jassFilePath.lastIndexOf('\\')) + 1); + } + final String jassFile = jassFilePath; try { JassLexer lexer; try { @@ -698,10 +703,13 @@ public class Jass2 { @Override public JassValue call(final List arguments, final GlobalScope globalScope, final TriggerExecutionScope triggerScope) { - final CTimerJass timer = arguments.get(0).visit(ObjectJassValueVisitor.getInstance()); + final CTimerJass timer = nullable(arguments, 0, ObjectJassValueVisitor.getInstance()); final Double timeout = arguments.get(1).visit(RealJassValueVisitor.getInstance()); final boolean periodic = arguments.get(2).visit(BooleanJassValueVisitor.getInstance()); final JassFunction handlerFunc = nullable(arguments, 3, JassFunctionJassValueVisitor.getInstance()); + if (timer == null) { + return null; + } if (!timer.isRunning()) { timer.setTimeoutTime(timeout.floatValue()); timer.setRepeats(periodic); diff --git a/core/src/com/etheller/warsmash/viewer5/handlers/w3x/environment/Terrain.java b/core/src/com/etheller/warsmash/viewer5/handlers/w3x/environment/Terrain.java index d295a75..8ce00ac 100644 --- a/core/src/com/etheller/warsmash/viewer5/handlers/w3x/environment/Terrain.java +++ b/core/src/com/etheller/warsmash/viewer5/handlers/w3x/environment/Terrain.java @@ -446,7 +446,8 @@ public class Terrain { float rampHeight = 0f; // Check if in one of the configurations the bottom_left is a ramp - XLoop: for (int xOffset = -1; xOffset <= 0; xOffset++) { + XLoop: + for (int xOffset = -1; xOffset <= 0; xOffset++) { for (int yOffset = -1; yOffset <= 0; yOffset++) { if (((i + xOffset) >= 0) && ((i + xOffset) < (this.columns - 1)) && ((j + yOffset) >= 0) && ((j + yOffset) < (this.rows - 1))) { @@ -588,7 +589,25 @@ public class Terrain { int bottomLeftCliffTex = bottomLeft.getCliffTexture(); if (bottomLeftCliffTex == 15) { - bottomLeftCliffTex -= 14; + final int topLeftCliffTex = topLeft.getCliffTexture(); + if (topLeftCliffTex == 15) { + final int topRightCliffTex = topRight.getCliffTexture(); + if (topRightCliffTex == 15) { + final int bottomRightCliffTex = bottomRight.getCliffTexture(); + if (bottomRightCliffTex == 15) { + bottomLeftCliffTex -= 14; + } + else { + bottomLeftCliffTex = bottomRightCliffTex; + } + } + else { + bottomLeftCliffTex = topRightCliffTex; + } + } + else { + bottomLeftCliffTex = topLeftCliffTex; + } } if (!(facingDown && (j == 0)) && !(!facingDown && (j >= (this.rows - 2))) && !(facingLeft && (i == 0)) && !(!facingLeft && (i >= (this.columns - 2)))) { @@ -817,7 +836,8 @@ public class Terrain { } private int realTileTexture(final int x, final int y) { - ILoop: for (int i = -1; i < 1; i++) { + ILoop: + for (int i = -1; i < 1; i++) { for (int j = -1; j < 1; j++) { if (((x + i) >= 0) && ((x + i) < this.columns) && ((y + j) >= 0) && ((y + j) < this.rows)) { if (this.corners[x + i][y + j].cliff) { @@ -1468,7 +1488,7 @@ public class Terrain { (Texture) this.viewer.load(path, PathSolver.DEFAULT, null), splat.locations, this.centerOffset, splat.unitMapping.isEmpty() ? null : splat.unitMapping, false, false, false); splatModel.color[3] = splat.opacity; - this.addSplatBatchModel(path, splatModel); + addSplatBatchModel(path, splatModel); } } @@ -1492,7 +1512,7 @@ public class Terrain { if (splatModel == null) { splatModel = new SplatModel(Gdx.gl30, (Texture) this.viewer.load(path, PathSolver.DEFAULT, null), new ArrayList<>(), this.centerOffset, new ArrayList<>(), unshaded, noDepthTest, highPriority); - this.addSplatBatchModel(path, splatModel); + addSplatBatchModel(path, splatModel); } return splatModel.add(x - scale, y - scale, x + scale, y + scale, z, this.centerOffset); } @@ -1504,7 +1524,7 @@ public class Terrain { splatModel = new SplatModel(Gdx.gl30, (Texture) this.viewer.load(texture, PathSolver.DEFAULT, null), new ArrayList<>(), this.centerOffset, new ArrayList<>(), false, false, false); splatModel.color[3] = opacity; - this.addSplatBatchModel(texture, splatModel); + addSplatBatchModel(texture, splatModel); } return splatModel.add(x, y, x2, y2, zDepthUpward, this.centerOffset); } diff --git a/core/src/com/etheller/warsmash/viewer5/handlers/w3x/ui/MenuUI.java b/core/src/com/etheller/warsmash/viewer5/handlers/w3x/ui/MenuUI.java index b3966fe..22ef0ee 100644 --- a/core/src/com/etheller/warsmash/viewer5/handlers/w3x/ui/MenuUI.java +++ b/core/src/com/etheller/warsmash/viewer5/handlers/w3x/ui/MenuUI.java @@ -783,7 +783,8 @@ public class MenuUI { player.setName(MenuUI.this.rootFrame.getTrigStr(mapInfo.getPlayers().get(i).getName())); } Jass2.loadConfig(map, MenuUI.this.uiViewport, MenuUI.this.uiScene, MenuUI.this.rootFrame, - war3MapConfig, "Scripts\\common.j", "Scripts\\Blizzard.j", "war3map.j").config(); + war3MapConfig, "Scripts\\common.j", "Scripts\\Blizzard.j", "Scripts\\war3map.j") + .config(); for (int i = 0; i < WarsmashConstants.MAX_PLAYERS; i++) { final CBasePlayer player = war3MapConfig.getPlayer(i); if (player.getController() == CMapControl.USER) {