summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryenatch <yenatch@gmail.com>2013-09-26 02:49:37 -0400
committeryenatch <yenatch@gmail.com>2013-09-26 02:49:37 -0400
commit92eeee28dd0633655d331e658cdd3a5c6b5c6fab (patch)
treeb531c5c98ff4165217b17881ea2eb8bdb686b3a8
parent96574a08ee25c6118d4e1e5cb8ff334b118817f2 (diff)
map_editor: skip any nonexistent tiles in map rendering
-rw-r--r--pokemontools/map_editor.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/pokemontools/map_editor.py b/pokemontools/map_editor.py
index 0a02cb0..efd9678 100644
--- a/pokemontools/map_editor.py
+++ b/pokemontools/map_editor.py
@@ -322,12 +322,15 @@ class Map:
# Draw one block (4x4 tiles)
block = self.blockdata[block_y * self.width + block_x]
for j, tile in enumerate(self.tileset.blocks[block]):
- # Tile gfx are split in half to make vram mapping easier
- if tile >= 0x80:
- tile -= 0x20
- tile_x = block_x * 32 + (j % 4) * 8
- tile_y = block_y * 32 + (j / 4) * 8
- self.canvas.create_image(index + tile_x, indey + tile_y, image=self.tileset.tiles[tile])
+ try:
+ # Tile gfx are split in half to make vram mapping easier
+ if tile >= 0x80:
+ tile -= 0x20
+ tile_x = block_x * 32 + (j % 4) * 8
+ tile_y = block_y * 32 + (j / 4) * 8
+ self.canvas.create_image(index + tile_x, indey + tile_y, image=self.tileset.tiles[tile])
+ except:
+ pass
class Tileset: