summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-01-16 21:07:36 +0200
committerAndrei Karas <akaras@inbox.ru>2011-01-16 21:07:36 +0200
commitbbc9fe0a36bc1637a6414c20d5b15574018f400a (patch)
tree694a6c6fb2cbc30901013841af934a6b6101464e
parent3b541786969301af6ba2d747371ab85cf980035c (diff)
downloadevol-tools-bbc9fe0a36bc1637a6414c20d5b15574018f400a.tar.gz
evol-tools-bbc9fe0a36bc1637a6414c20d5b15574018f400a.tar.bz2
evol-tools-bbc9fe0a36bc1637a6414c20d5b15574018f400a.tar.xz
evol-tools-bbc9fe0a36bc1637a6414c20d5b15574018f400a.zip
Fix incorrect conversion from pixels to tiles in map converter.
-rw-r--r--tmwcon/src/converter/Process.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/tmwcon/src/converter/Process.java b/tmwcon/src/converter/Process.java
index 088cee5..5241e81 100644
--- a/tmwcon/src/converter/Process.java
+++ b/tmwcon/src/converter/Process.java
@@ -54,10 +54,10 @@ public class Process {
}
private static int[] resolveBounds(Rectangle in, boolean warp) {
- int x = in.x / 32;
- int y = in.y / 32;
- int width = in.width / 32;
- int height = in.height / 32;
+ int x = Math.round((float)in.x / (float)32);
+ int y = Math.round((float)in.y / (float)32);
+ int width = Math.round((float)in.width / (float)32);
+ int height = Math.round((float)in.height / (float)32);
if (!warp) {
if (width > 1) --width;
if (height > 1) --height;
@@ -81,7 +81,7 @@ public class Process {
if (y < 0) return;
int[] shape = resolveBounds(bounds, true);
System.out.printf("Usable warp found: %s\n", name);
- out.printf("%s.gat,%d,%d\twarp\t%s\t%d,%d,%s.gat,%d,%d\n", map, shape[0], shape[1], name, shape[2], shape[3], dest, x / 32, y / 32);
+ out.printf("%s.gat,%d,%d\twarp\t%s\t%d,%d,%s.gat,%d,%d\n", map, shape[0], shape[1], name, shape[2], shape[3], dest, Math.round((float)x / (float)32), Math.round((float)y / (float)32));
}
private static int handleMob(PrintWriter out, String map, String name, Rectangle bounds, Properties props) {