summaryrefslogtreecommitdiff
path: root/hercules/code/clienttoserver
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-07-20 19:53:27 +0300
committerAndrei Karas <akaras@inbox.ru>2016-07-20 19:54:43 +0300
commit593ef2f485d0d4e11e82678e6d01cad4d85e62a8 (patch)
tree09e89af01c9a99e17495ca89854ca580198bbb67 /hercules/code/clienttoserver
parentbc4ab6e28a09c2965b9fc6ccfec0c7f279f6f092 (diff)
downloadevol-tools-593ef2f485d0d4e11e82678e6d01cad4d85e62a8.tar.gz
evol-tools-593ef2f485d0d4e11e82678e6d01cad4d85e62a8.tar.bz2
evol-tools-593ef2f485d0d4e11e82678e6d01cad4d85e62a8.tar.xz
evol-tools-593ef2f485d0d4e11e82678e6d01cad4d85e62a8.zip
hercules: improve a bit map cache converter.
Diffstat (limited to 'hercules/code/clienttoserver')
-rw-r--r--hercules/code/clienttoserver/maps.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/hercules/code/clienttoserver/maps.py b/hercules/code/clienttoserver/maps.py
index 055255a..0cdafb4 100644
--- a/hercules/code/clienttoserver/maps.py
+++ b/hercules/code/clienttoserver/maps.py
@@ -34,6 +34,19 @@ def findFirstGid(tilesets, tile):
break
return found
+# 0 - walkable ground
+# 1 - non walkable wall
+# 2 - air allowed shootable too
+# 3 - water allowed water, shootable too
+# 4 - sit, walkable ground
+# 5 - none
+def convertTileType(tile):
+# if tile == 4:
+# tile = 0;
+ if tile > 128 or tile < 0:
+ tile = 1
+ return tile
+
def recreateMapCache():
destDir = "../../server-data/db/re/"
srcDir = "../../client-data/maps/"
@@ -86,9 +99,7 @@ def recreateMapCache():
tileType = 0
else:
firstgid = findFirstGid(tilesets, tile)
- tileType = tile - firstgid;
- if tileType > 128 or tileType < 0:
- tileType = 1
+ tileType = convertTileType(tile - firstgid);
tiles.append(tileType)
elif encoding == "csv":
binData = data.childNodes[0].data.strip()
@@ -102,7 +113,7 @@ def recreateMapCache():
tileType = 0
else:
firstgid = findFirstGid(tilesets, tile)
- tileType = tile - firstgid;
+ tileType = convertTileType(tile - firstgid);
# tmx collision format
# 0 - walkable ground
# 1 - non walkable wall