summaryrefslogtreecommitdiff
path: root/extras/gfx.py
diff options
context:
space:
mode:
authorBryan Bishop <kanzure@gmail.com>2013-03-20 20:12:48 -0700
committerBryan Bishop <kanzure@gmail.com>2013-03-20 20:12:48 -0700
commit1abb020335e89ace4f51e1c81902e9bbe95c6af2 (patch)
treee2aa1ba901d8f80a808e2f6f090c78c2b0df4830 /extras/gfx.py
parente0e902b1c7612a582a945fd4b0bb31e3b19d5945 (diff)
parentd7757676513e9e02fc67d99a7c60c02f74344292 (diff)
Merge pull request #124 from yenatch/master
hram labels + png make target
Diffstat (limited to 'extras/gfx.py')
-rw-r--r--extras/gfx.py32
1 files changed, 16 insertions, 16 deletions
diff --git a/extras/gfx.py b/extras/gfx.py
index c2307a686..a09e230e3 100644
--- a/extras/gfx.py
+++ b/extras/gfx.py
@@ -1436,8 +1436,8 @@ def mass_to_colored_png(debug=False):
for name in files:
if debug: print os.path.splitext(name), os.path.join(root, name)
if os.path.splitext(name)[1] == '.2bpp':
- if name[:5]+'.pal' in files:
- to_png(os.path.join(root, name), None, os.path.join(root, name[:-5]+'.pal'))
+ if os.path.splitext(name)[0]+'.pal' in files:
+ 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))
@@ -1459,26 +1459,26 @@ def mass_to_colored_png(debug=False):
def mass_decompress(debug=False):
for root, dirs, files in os.walk('../gfx/'):
- for file in files:
- if 'lz' in file:
+ for name in files:
+ if 'lz' in name:
if '/pics' in root:
- if 'front' in file:
+ if 'front' in name:
id = root.split('pics/')[1][:3]
if id != 'egg':
- with open(root+'/'+file, 'rb') as lz: de = Decompressed(lz.read(), 'vert', sizes[int(id)-1])
+ with open(os.path.join(root, name), 'rb') as lz: de = Decompressed(lz.read(), 'vert', sizes[int(id)-1])
else:
- with open(root+'/'+file, 'rb') as lz: de = Decompressed(lz.read(), 'vert', 4)
- to_file(root+'/'+'front.2bpp', de.pic)
- to_file(root+'/'+'tiles.2bpp', de.animtiles)
- elif 'back' in file:
- with open(root+'/'+file, 'rb') as lz: de = Decompressed(lz.read(), 'vert')
- to_file(root+'/'+'back.2bpp', de.output)
+ with open(os.path.join(root, name), 'rb') as lz: de = Decompressed(lz.read(), 'vert', 4)
+ to_file(os.path.join(root, 'front.2bpp'), de.pic)
+ to_file(os.path.join(root, 'tiles.2bpp'), de.animtiles)
+ elif 'back' in name:
+ with open(os.path.join(root, name), 'rb') as lz: de = Decompressed(lz.read(), 'vert')
+ to_file(os.path.join(root, 'back.2bpp'), de.output)
elif '/trainers' in root or '/fx' in root:
- with open(root+'/'+file, 'rb') as lz: de = Decompressed(lz.read(), 'vert')
- to_file(root+'/'+file[:-3]+'.2bpp', de.output)
+ with open(os.path.join(root, name), 'rb') as lz: de = Decompressed(lz.read(), 'vert')
+ to_file(os.path.join(root, os.path.splitext(name)[0]+'.2bpp'), de.output)
else:
- with open(root+'/'+file, 'rb') as lz: de = Decompressed(lz.read())
- to_file(root+file[:-3]+'.2bpp', de.output)
+ 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)
def append_terminator_to_lzs(directory):
# fix lzs that were extracted with a missing terminator