Update ldtk repacker
Changelog: - Remove level rendering. This is done in-game - Report maximum number of tiles present in a levelmain
parent
c8e297265f
commit
c2f673f5b8
|
@ -79,6 +79,7 @@ else:
|
||||||
fileparts[-1] = "lvldata"
|
fileparts[-1] = "lvldata"
|
||||||
converted_filename = '.'.join(fileparts)
|
converted_filename = '.'.join(fileparts)
|
||||||
|
|
||||||
|
max_n_tiles = 0
|
||||||
# Each level should be packed as: [width, 2 bytes][height, 2 bytes][tile_type,entity,water,padding 1,1,1,1 bytes][tile_type,entity,water,padding 1,1,1,1 bytes]...
|
# Each level should be packed as: [width, 2 bytes][height, 2 bytes][tile_type,entity,water,padding 1,1,1,1 bytes][tile_type,entity,water,padding 1,1,1,1 bytes]...
|
||||||
with open(converted_filename, 'wb+') as out_file:
|
with open(converted_filename, 'wb+') as out_file:
|
||||||
out_file.write(struct.pack("<I", n_levels))
|
out_file.write(struct.pack("<I", n_levels))
|
||||||
|
@ -113,6 +114,7 @@ with open(converted_filename, 'wb+') as out_file:
|
||||||
width = level_layout["__cWid"]
|
width = level_layout["__cWid"]
|
||||||
height = level_layout["__cHei"]
|
height = level_layout["__cHei"]
|
||||||
print(f"Dim.: {width}x{height}. N Tiles: {width * height}")
|
print(f"Dim.: {width}x{height}. N Tiles: {width * height}")
|
||||||
|
max_n_tiles = max(max_n_tiles, width*height)
|
||||||
# Create a W x H array of tile information
|
# Create a W x H array of tile information
|
||||||
n_tiles = width * height
|
n_tiles = width * height
|
||||||
tiles_info = [[0,0,0] for _ in range(n_tiles)]
|
tiles_info = [[0,0,0] for _ in range(n_tiles)]
|
||||||
|
@ -154,3 +156,4 @@ with open(converted_filename, 'wb+') as out_file:
|
||||||
# print(tiles_info[y*width + x], end=" ")
|
# print(tiles_info[y*width + x], end=" ")
|
||||||
# print()
|
# print()
|
||||||
|
|
||||||
|
print("Largest number of tiles:", max_n_tiles)
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
source venv/bin/activate
|
source venv/bin/activate
|
||||||
python ldtk_repacker.py $1.ldtk && zstd $1.lvldata && python level_render.py $1.ldtk
|
python ldtk_repacker.py $1.ldtk && zstd $1.lvldata
|
||||||
|
|
Loading…
Reference in New Issue