mirror of
https://github.com/Retera/WarsmashModEngine.git
synced 2022-07-31 17:38:59 +02:00
Fix cliff loading issue, fix null timer case, fix script loading issue
This commit is contained in:
parent
c6bb695b2c
commit
6f310092b9
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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<JassValue> arguments, final GlobalScope globalScope,
|
||||
final TriggerExecutionScope triggerScope) {
|
||||
final CTimerJass timer = arguments.get(0).visit(ObjectJassValueVisitor.<CTimerJass>getInstance());
|
||||
final CTimerJass timer = nullable(arguments, 0, ObjectJassValueVisitor.<CTimerJass>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);
|
||||
|
@ -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,8 +589,26 @@ public class Terrain {
|
||||
|
||||
int bottomLeftCliffTex = bottomLeft.getCliffTexture();
|
||||
if (bottomLeftCliffTex == 15) {
|
||||
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)))) {
|
||||
final boolean verticalRamp = ((bottomLeft.isRamp()) != (bottomRight.isRamp()))
|
||||
@ -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);
|
||||
}
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user