diff --git a/src/main/java/Buffer.java b/src/main/java/Buffer.java index 13656d4..5c0a92d 100644 --- a/src/main/java/Buffer.java +++ b/src/main/java/Buffer.java @@ -71,7 +71,7 @@ public class Buffer extends DoublyLinkedList.Node { } public void write8C(int i) { - data[position++] = (byte) (-i); + data[position++] = (byte) -i; } public void write8S(int j) { @@ -154,7 +154,7 @@ public class Buffer extends DoublyLinkedList.Node { } public byte read8C() { - return (byte) (-data[position++]); + return (byte) -data[position++]; } public byte read8S() { diff --git a/src/main/java/Censor.java b/src/main/java/Censor.java index f2f2fdd..a2808ae 100644 --- a/src/main/java/Censor.java +++ b/src/main/java/Censor.java @@ -118,7 +118,7 @@ public class Censor { public static String apply(String s) { char[] ac = s.toCharArray(); method495(ac); - String s1 = (new String(ac)).trim(); + String s1 = new String(ac).trim(); ac = s1.toLowerCase().toCharArray(); String s2 = s1.toLowerCase(); method505(ac); @@ -135,7 +135,7 @@ public class Censor { } method498(s1.toCharArray(), 2, ac); method499(0, ac); - return (new String(ac)).trim(); + return new String(ac).trim(); } public static void method498(char[] ac, int i, char[] ac1) { @@ -923,11 +923,11 @@ public class Censor { for (int l = 0; l < ac.length; l++) { char c = ac[ac.length - l - 1]; if ((c >= 'a') && (c <= 'z')) { - k = (k * 38) + ((c - 97) + 1); + k = (((k * 38) + c) - 97) + 1; } else if (c == '\'') { k = (k * 38) + 27; } else if ((c >= '0') && (c <= '9')) { - k = (k * 38) + ((c - 48) + 28); + k = (((k * 38) + c) - 48) + 28; } else if (c != 0) { return 0; } diff --git a/src/main/java/Draw2D.java b/src/main/java/Draw2D.java index c10df45..5a1e23f 100644 --- a/src/main/java/Draw2D.java +++ b/src/main/java/Draw2D.java @@ -73,11 +73,11 @@ public class Draw2D { int err = dx - dy; while (true) { - if (x1 >= left && x1 < right && y1 >= top && y1 < bottom) { + if ((x1 >= left) && (x1 < right) && (y1 >= top) && (y1 < bottom)) { pixels[x1 + (y1 * width)] = rgb; } - if (x1 == x2 && y1 == y2) { + if ((x1 == x2) && (y1 == y2)) { break; } diff --git a/src/main/java/Game.java b/src/main/java/Game.java index 482cef7..e7df996 100644 --- a/src/main/java/Game.java +++ b/src/main/java/Game.java @@ -796,7 +796,7 @@ public class Game extends GameShell { int done = total - ondemand.remaining(); if (done > 0) { - drawProgress(65, "Loading animations - " + (done * 100) / total + "%"); + drawProgress(65, "Loading animations - " + done * 100 / total + "%"); } handleOnDemandRequests(); @@ -828,7 +828,7 @@ public class Game extends GameShell { int done = total - ondemand.remaining(); if (done > 0) { - drawProgress(70, "Loading models - " + (done * 100) / total + "%"); + drawProgress(70, "Loading models - " + done * 100 / total + "%"); } handleOnDemandRequests(); @@ -861,7 +861,7 @@ public class Game extends GameShell { int done = total - ondemand.remaining(); if (done > 0) { - drawProgress(75, "Loading maps - " + (done * 100) / total + "%"); + drawProgress(75, "Loading maps - " + done * 100 / total + "%"); } handleOnDemandRequests(); @@ -1948,7 +1948,7 @@ public class Game extends GameShell { Arrays.fill(pixels, 0); for (int z = 1; z < 103; z++) { - int offset = (52 + (48 * 512)) + ((103 - z) * 512 * 4); + int offset = 52 + (48 * 512) + ((103 - z) * 512 * 4); for (int x = 1; x < 103; x++) { if ((levelTileFlags[level][x][z] & 0x18) == 0) { @@ -3445,7 +3445,7 @@ public class Game extends GameShell { int length = in.read8UC(); int start = in.position; - if (player.name != null && player.visible) { + if ((player.name != null) && player.visible) { long name37 = StringUtil.toBase37(player.name); boolean ignore = false; @@ -3944,6 +3944,7 @@ public class Game extends GameShell { if (request.store == 0) { Model.unpack(request.data, request.file); + if ((ondemand.getModelFlags(request.file) & 0x62) != 0) { redrawSidebar = true; if (chatInterfaceID != -1) { @@ -5969,7 +5970,8 @@ public class Game extends GameShell { redrawChatback = true; } - if (((key == 13 /*Carriage Return*/) || (key == KeyEvent.VK_ENTER)) && (chatTyped.length() > 0)) { + /*Carriage Return*/ + if (((key == 13) || (key == KeyEvent.VK_ENTER)) && (chatTyped.length() > 0)) { if (rights == 2) { if (chatTyped.equals("::clientdrop")) { tryReconnect(); @@ -6873,7 +6875,7 @@ public class Game extends GameShell { while (!done) { done = true; for (int i = 0; i < (menuSize - 1); i++) { - if (menuAction[i] >= 1000 || menuAction[i + 1] <= 1000) { + if ((menuAction[i] >= 1000) || (menuAction[i + 1] <= 1000)) { continue; } @@ -9254,7 +9256,7 @@ public class Game extends GameShell { } // one of our points failed to project - if (x0 == -1 || x1 == -1 || x2 == -1 || x3 == -1) { + if ((x0 == -1) || (x1 == -1) || (x2 == -1) || (x3 == -1)) { continue; } @@ -10171,7 +10173,7 @@ public class Game extends GameShell { if (Signlink.mainapp != null) { return Signlink.openurl(s); } else { - return new DataInputStream((new URL(getCodeBase(), s)).openStream()); + return new DataInputStream(new URL(getCodeBase(), s).openStream()); } } if (aSocket832 != null) { @@ -10378,10 +10380,10 @@ public class Game extends GameShell { } y += 30; - fontBold12.drawStringTaggable("Username: " + username + ((titleLoginField == 0) & (loopCycle % 40 < 20) ? "@yel@|" : ""), (w / 2) - 90, y, 0xffffff, true); + fontBold12.drawStringTaggable("Username: " + username + (titleLoginField == 0 & loopCycle % 40 < 20 ? "@yel@|" : ""), (w / 2) - 90, y, 0xffffff, true); y += 15; - fontBold12.drawStringTaggable("Password: " + StringUtil.toAsterisks(password) + ((titleLoginField == 1) & (loopCycle % 40 < 20) ? "@yel@|" : ""), (w / 2) - 88, y, 0xffffff, true); + fontBold12.drawStringTaggable("Password: " + StringUtil.toAsterisks(password) + (titleLoginField == 1 & loopCycle % 40 < 20 ? "@yel@|" : ""), (w / 2) - 88, y, 0xffffff, true); if (!hideButtons) { int x = (w / 2) - 80; diff --git a/src/main/java/IfType.java b/src/main/java/IfType.java index 3546097..1966a4b 100644 --- a/src/main/java/IfType.java +++ b/src/main/java/IfType.java @@ -249,7 +249,7 @@ public class IfType { iface.spellFlags = in.read16U(); } - if (iface.optionType == OPTION_TYPE_STANDARD || iface.optionType == OPTION_TYPE_TOGGLE || iface.optionType == OPTION_TYPE_SELECT || iface.optionType == OPTION_TYPE_CONTINUE) { + if ((iface.optionType == OPTION_TYPE_STANDARD) || (iface.optionType == OPTION_TYPE_TOGGLE) || (iface.optionType == OPTION_TYPE_SELECT) || (iface.optionType == OPTION_TYPE_CONTINUE)) { iface.option = in.readString(); if (iface.option.length() == 0) { diff --git a/src/main/java/Image24.java b/src/main/java/Image24.java index fe4b6a3..9b491cd 100644 --- a/src/main/java/Image24.java +++ b/src/main/java/Image24.java @@ -118,7 +118,7 @@ public class Image24 extends DoublyLinkedList.Node { int[] pixels = new int[cropW * cropH]; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { - pixels[((y + cropY) * cropW) + (x + cropX)] = this.pixels[(y * width) + x]; + pixels[((y + cropY) * cropW) + x + cropX] = this.pixels[(y * width) + x]; } } this.pixels = pixels; @@ -332,8 +332,8 @@ public class Image24 extends DoublyLinkedList.Node { int cos = (int) (Math.cos((double) angle / 326.11000000000001D) * 65536D); sin = (sin * zoom) >> 8; cos = (cos * zoom) >> 8; - int leftX = (anchorX << 16) + ((midY * sin) + (midX * cos)); - int lefty = (anchorY << 16) + ((midY * cos) - (midX * sin)); + int leftX = (anchorX << 16) + (midY * sin) + (midX * cos); + int lefty = ((anchorY << 16) + (midY * cos)) - (midX * sin); int leftOff = x + (y * Draw2D.width); for (y = 0; y < height; y++) { int lineOffset = lineOffsets[y]; @@ -361,8 +361,8 @@ public class Image24 extends DoublyLinkedList.Node { int cos = (int) (Math.cos(radians) * 65536D); sin = (sin * zoom) >> 8; cos = (cos * zoom) >> 8; - int leftX = (anchorX << 16) + ((centerY * sin) + (centerX * cos)); - int leftY = (anchorY << 16) + ((centerY * cos) - (centerX * sin)); + int leftX = (anchorX << 16) + (centerY * sin) + (centerX * cos); + int leftY = ((anchorY << 16) + (centerY * cos)) - (centerX * sin); int leftOff = x + (y * Draw2D.width); for (y = 0; y < height; y++) { diff --git a/src/main/java/OnDemand.java b/src/main/java/OnDemand.java index b7bc50a..3020fff 100644 --- a/src/main/java/OnDemand.java +++ b/src/main/java/OnDemand.java @@ -345,7 +345,7 @@ public class OnDemand implements Runnable { synchronized (lock) { for (OnDemandRequest request : requests) { - if (request.store == store && request.file == file) { + if ((request.store == store) && (request.file == file)) { return; } } @@ -661,7 +661,7 @@ public class OnDemand implements Runnable { loadedPretechFiles++; } - message = "Loading extra files - " + (loadedPretechFiles * 100) / totalPrefetchFiles + "%"; + message = "Loading extra files - " + loadedPretechFiles * 100 / totalPrefetchFiles + "%"; requestCount++; if (requestCount == 10) { @@ -692,7 +692,7 @@ public class OnDemand implements Runnable { if (loadedPretechFiles < totalPrefetchFiles) { loadedPretechFiles++; } - message = "Loading extra files - " + (loadedPretechFiles * 100) / totalPrefetchFiles + "%"; + message = "Loading extra files - " + loadedPretechFiles * 100 / totalPrefetchFiles + "%"; requestCount++; if (requestCount == 10) { return; diff --git a/src/main/java/Scene.java b/src/main/java/Scene.java index 3e70b4c..fca9280 100644 --- a/src/main/java/Scene.java +++ b/src/main/java/Scene.java @@ -1427,7 +1427,7 @@ public class Scene { } } - if (decor != null && !occluded(occludeLevel, tileX, tileZ, decor.entity.minY)) { + if ((decor != null) && !occluded(occludeLevel, tileX, tileZ, decor.entity.minY)) { drawWallDecor(frontWallTypes, decor, true); } @@ -1481,7 +1481,7 @@ public class Scene { if (tile.checkLocSpans != 0) { boolean draw = true; for (int i = 0; i < tile.locCount; i++) { - if (!tile.locs[i].drawn() && (tile.locSpan[i] & tile.checkLocSpans) == tile.blockLocSpans) { + if (!tile.locs[i].drawn() && ((tile.locSpan[i] & tile.checkLocSpans) == tile.blockLocSpans)) { draw = false; break; } @@ -1661,14 +1661,14 @@ public class Scene { SceneObjStack stack = tile.objStack; - if (stack != null && stack.offset != 0) { + if ((stack != null) && (stack.offset != 0)) { drawObjStack(stack, stack.offset); } if (tile.backWallTypes != 0) { SceneWallDecoration decor = tile.wallDecoration; - if (decor != null && !occluded(occludeLevel, tileX, tileZ, decor.entity.minY)) { + if ((decor != null) && !occluded(occludeLevel, tileX, tileZ, decor.entity.minY)) { drawWallDecor(tile.backWallTypes, decor, false); } @@ -1761,9 +1761,9 @@ public class Scene { if ((decor.type & 0x100) != 0) { boolean draw = false; - if (front && nearestZ < nearestX) { + if (front && (nearestZ < nearestX)) { draw = true; - } else if (!front && nearestZ >= nearestX) { + } else if (!front && (nearestZ >= nearestX)) { draw = true; } @@ -1777,9 +1777,9 @@ public class Scene { if ((decor.type & 0x200) != 0) { boolean draw = false; - if (front && nearestZ > nearestX) { + if (front && (nearestZ > nearestX)) { draw = true; - } else if (!front && nearestZ <= nearestX) { + } else if (!front && (nearestZ <= nearestX)) { draw = true; } diff --git a/src/main/java/Signlink.java b/src/main/java/Signlink.java index fbcd1aa..b776e1d 100644 --- a/src/main/java/Signlink.java +++ b/src/main/java/Signlink.java @@ -263,7 +263,7 @@ public class Signlink implements Runnable { savereq = null; } else if (urlreq != null) { try { - urlstream = new DataInputStream((new URL(mainapp.getCodeBase(), urlreq)).openStream()); + urlstream = new DataInputStream(new URL(mainapp.getCodeBase(), urlreq).openStream()); } catch (Exception _ex) { urlstream = null; }