diff options
author | Bryan Bishop <kanzure@gmail.com> | 2013-12-28 17:04:15 -0800 |
---|---|---|
committer | Bryan Bishop <kanzure@gmail.com> | 2013-12-28 17:04:15 -0800 |
commit | 6ec167512e05c3541308fbbaa7e91cf53942e533 (patch) | |
tree | 85350b4414bd03cd3155a171563f0fce0b6d35ad /pokemontools/map_gfx.py | |
parent | f0aaf3cd568c485af40690ce0f18a6cd456ed02e (diff) | |
parent | 70cd4f7c00b33a398ed7af071773c06ca335c105 (diff) |
Merge pull request #62 from yenatch/battle-animations
* event command macro storetext actually took one param
* PointerLabel{Before,After}Bank now take a label instead of the redundant BANK(label), label
* use the from_asm() method for all macros
* no more macro logic in the preprocessor
* read and write RGB macros for palettes instead of binary chunks
* battle animation macros
Diffstat (limited to 'pokemontools/map_gfx.py')
-rw-r--r-- | pokemontools/map_gfx.py | 26 |
1 files changed, 3 insertions, 23 deletions
diff --git a/pokemontools/map_gfx.py b/pokemontools/map_gfx.py index 77e7d56..b06f0df 100644 --- a/pokemontools/map_gfx.py +++ b/pokemontools/map_gfx.py @@ -178,29 +178,9 @@ def read_palettes(time_of_day=1, config=config): filename = "{}.pal".format(actual_time_of_day) filepath = os.path.join(config.palette_dir, filename) - num_colors = 4 - color_length = 2 - palette_length = num_colors * color_length - - pals = bytearray(open(filepath, "rb").read()) - num_pals = len(pals) / palette_length - - for pal in xrange(num_pals): - palettes += [[]] - - for color in xrange(num_colors): - i = pal * palette_length - i += color * color_length - word = pals[i] + pals[i+1] * 0x100 - - palettes[pal] += [[ - c & 0x1f for c in [ - word >> 0, - word >> 5, - word >> 10, - ] - ]] - + lines = open(filepath, "r").readlines() + colors = gfx.read_rgb_macros(lines) + palettes = [colors[i:i+4] for i in xrange(0, len(colors), 4)] return palettes def load_sprite_image(address, config=config): |