summaryrefslogtreecommitdiff
path: root/gfx.py
diff options
context:
space:
mode:
Diffstat (limited to 'gfx.py')
-rw-r--r--gfx.py26
1 files changed, 24 insertions, 2 deletions
diff --git a/gfx.py b/gfx.py
index 3d8e950..8b9a66f 100644
--- a/gfx.py
+++ b/gfx.py
@@ -1440,6 +1440,7 @@ def mass_to_colored_png(debug=False):
to_png(os.path.join(root, name), None, os.path.join(root, os.path.splitext(name)[0]+'.pal'))
else:
to_png(os.path.join(root, name))
+ os.touch(os.path.join(root, name))
# only monster and trainer pics for now
for root, dirs, files in os.walk('../gfx/pics/'):
@@ -1450,11 +1451,14 @@ def mass_to_colored_png(debug=False):
to_png(os.path.join(root, name), None, os.path.join(root, 'normal.pal'))
else:
to_png(os.path.join(root, name))
+ os.touch(os.path.join(root, name))
+
for root, dirs, files in os.walk('../gfx/trainers/'):
for name in files:
if debug: print os.path.splitext(name), os.path.join(root, name)
if os.path.splitext(name)[1] == '.2bpp':
to_png(os.path.join(root, name), None, os.path.join(root, name[:-5]+'.pal'))
+ os.touch(os.path.join(root, name))
def mass_decompress(debug=False):
@@ -1479,6 +1483,7 @@ def mass_decompress(debug=False):
else:
with open(os.path.join(root, name), 'rb') as lz: de = Decompressed(lz.read())
to_file(os.path.join(root, os.path.splitext(name)[0]+'.2bpp'), de.output)
+ os.touch(os.path.join(root, name))
def append_terminator_to_lzs(directory):
# fix lzs that were extracted with a missing terminator
@@ -1492,8 +1497,25 @@ def append_terminator_to_lzs(directory):
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()