diff options
author | Bryan Bishop <kanzure@gmail.com> | 2013-08-03 16:10:52 -0500 |
---|---|---|
committer | Bryan Bishop <kanzure@gmail.com> | 2013-08-03 16:10:52 -0500 |
commit | 28490230cf68f8045fc63a8c7d3de19c7c1d3bcd (patch) | |
tree | c4d1a3acbc7d34b77a890f8e19a8d7253917be8c /pokemontools/overworldripper.py | |
parent | a14c36eadb75ea3d6fbc4cb3f382d7c9785d9fe9 (diff) |
make a basic python module
Diffstat (limited to 'pokemontools/overworldripper.py')
-rw-r--r-- | pokemontools/overworldripper.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/pokemontools/overworldripper.py b/pokemontools/overworldripper.py new file mode 100644 index 0000000..654f287 --- /dev/null +++ b/pokemontools/overworldripper.py @@ -0,0 +1,18 @@ +import gfx + +def rip_sprites_from_bank(bank, offset=0): + """ + Rips sprites from specified bank. + + Sprites are 4x4. + """ + file_handler = open("../gfx/overworld/bank" + str(hex(bank))[2:] + ".asm", "w") + for sprite in range(0 + offset, 256 + offset): + filename = "../gfx/overworld/" + str(sprite).zfill(3) + ".2bpp" + gfx.get_uncompressed_gfx((bank * 0x4000 + ((sprite - offset) * 4 * 0x10)), 4, filename) + gfx.to_png(filename) + file_handler.write("INCBIN \"" + filename[3:] + "\"\n") + file_handler.close() + +rip_sprites_from_bank(0x30) +rip_sprites_from_bank(0x31, offset=256) |