summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Allow-tiles-to-have-different-attributes-in-different-blocks-(including-X-and-Y-flip).md9
1 files changed, 4 insertions, 5 deletions
diff --git a/Allow-tiles-to-have-different-attributes-in-different-blocks-(including-X-and-Y-flip).md b/Allow-tiles-to-have-different-attributes-in-different-blocks-(including-X-and-Y-flip).md
index bfee3a1..46c97e7 100644
--- a/Allow-tiles-to-have-different-attributes-in-different-blocks-(including-X-and-Y-flip).md
+++ b/Allow-tiles-to-have-different-attributes-in-different-blocks-(including-X-and-Y-flip).md
@@ -108,15 +108,14 @@ for palette_map_name in palette_map_names:
if not line.startswith('\ttilepal'):
continue
line = line[len('\ttilepal '):]
- colors = list(c.strip() for c in line.split(','))
- bank = colors.pop(0)
+ colors = (c.strip() for c in line.split(','))
+ bank = next(colors)
if not reached_vram1 and bank == '1':
reached_vram1 = True
tile_index = 0x80
for color in colors:
tile_attr = color_attrs.get(color, 0)
- if tile_index >= 0x80:
- tile_attr |= 1 << 3
+ tile_attr |= (tile_index >= 0x80) << 3
tile_colors[tile_index] = tile_attr
tile_index += 1
@@ -126,7 +125,7 @@ for palette_map_name in palette_map_names:
with open(metatiles_name, 'rb') as metatiles:
with open(attributes_name, 'wb') as attributes:
for block_tiles in iter(lambda: metatiles.read(16), b''):
- block_attrs = list(tile_colors.get(t, (t >= 0x80) << 3)
+ block_attrs = (tile_colors.get(t, (t >= 0x80) << 3)
for t in block_tiles)
attributes.write(bytes(block_attrs))
metatile_bytes += block_tiles