We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It would be handy to quickly be able to export a blk file as a tilemap.
Obviously it's not algorithmically challenging, but here's a python script to demonstrate what I mean:
#!/usr/bin/env python import argparse if __name__ == "__main__": ap = argparse.ArgumentParser(description="Convert blk files to tilemaps") ap.add_argument("-b", "--bst", default="gfx/blocksets/overworld.bst", help="blockset to use") ap.add_argument("-w", "--width", required=True, help="width of blk file") ap.add_argument("blk", help="blk file to convert") args = ap.parse_args() bst_file = bytearray(open(args.bst, "rb").read()) num_bst_blocks = len(bst_file) // 16 blk_file = bytearray(open(args.blk, "rb").read()) num_blk_blocks = len(blk_file) tilemap = bytearray([0 for x in range(num_blk_blocks * 16)]) width = int(args.width) height = num_blk_blocks // width for block_y in range(height): for block_x in range(width): block_index = block_y * width + block_x block_id = blk_file[block_index] assert block_id < num_bst_blocks block_tiles = bst_file[block_id * 16:(block_id + 1) * 16] base_y = block_y * 4 base_x = block_x * 4 for tile_y in range(4): for tile_x in range(4): tile_index = (base_y + tile_y) * (width * 4) + (base_x + tile_x) tilemap[tile_index] = block_tiles[tile_y * 4 + tile_x] out_file = open(args.blk + ".tilemap", "wb") out_file.write(tilemap) out_file.close()
For example, it turns this blk file:
Into this tilemap:
The text was updated successfully, but these errors were encountered:
No branches or pull requests
It would be handy to quickly be able to export a blk file as a tilemap.
Obviously it's not algorithmically challenging, but here's a python script to demonstrate what I mean:
blktotilemap.py
For example, it turns this blk file:
Into this tilemap:
The text was updated successfully, but these errors were encountered: