shithub: pokecrystal

Download patch

ref: e0e902b1c7612a582a945fd4b0bb31e3b19d5945
parent: 7586281e8bfe093bee4e5723106ff6a9d56b9074
author: Bryan Bishop <[email protected]>
date: Mon Mar 18 00:52:49 EDT 2013

dump tileset pngs in gfx.py

--- a/extras/gfx.py
+++ b/extras/gfx.py
@@ -1492,8 +1492,25 @@
 					new.write(data)
 					new.close()
 
+def lz_to_png_by_file(filename):
+    """
+    Converts a lz file to png. Dumps a 2bpp file too.
+    """
+    assert filename[-3:] == ".lz"
+    lz_data = open(filename, "rb").read()
+    bpp = Decompressed(lz).output
+    bpp_filename = filename.replace(".lz", ".2bpp")
+    to_file(bpp_filename, bpp)
+    to_png(bpp_filename)
 
-
+def dump_tileset_pngs():
+    """
+    Converts .lz format tilesets into .png format tilesets. Also, leaves a
+    bunch of wonderful .2bpp files everywhere for your amusement.
+    """
+    for tileset_id in range(37):
+        tileset_filename = "../gfx/tilesets/" + str(tileset_id).zfill(2) + ".lz"
+        lz_to_png_by_file(tileset_filename)
 
 if __name__ == "__main__":
 	parser = argparse.ArgumentParser()