summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/mkasset.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/mkasset.py b/tools/mkasset.py
index f21a2f9..a402e3c 100644
--- a/tools/mkasset.py
+++ b/tools/mkasset.py
@@ -65,11 +65,14 @@ def carve_image(rgba_bytes, tile_width, tile_height, columns) -> Generator[bytea
65 image_y = image_y0 + y # y of current pixel inside image 65 image_y = image_y0 + y # y of current pixel inside image
66 for x in range(tile_width): 66 for x in range(tile_width):
67 image_x = image_x0 + x # x of current pixel inside image 67 image_x = image_x0 + x # x of current pixel inside image
68 tile_bytes[(y * tile_width + x) * 4] = ( 68 for c in range(4):
69 rgba_bytes)[(image_y * image_width + image_x) * 4] 69 tile_bytes[((y * tile_width + x) * 4) + c] = (
70 rgba_bytes)[((image_y * image_width + image_x) * 4) + c]
70 yield tile_bytes.copy() 71 yield tile_bytes.copy()
71 72
72 73
74# TODO: Palettize it like we do for sprites. Use 2-byte indices to allow up to
75# 65k colours.
73def convert_tsx(input_filepath, output_filepath): 76def convert_tsx(input_filepath, output_filepath):
74 """Converts a Tiled .tsx tileset file to a .TS tile set file.""" 77 """Converts a Tiled .tsx tileset file to a .TS tile set file."""
75 xml = ElementTree.parse(input_filepath) 78 xml = ElementTree.parse(input_filepath)