More correctly special case tile 0

This commit is contained in:
Gwilym Kuiper 2022-02-07 20:44:43 +00:00
parent 666867e933
commit 66a61e33e6
2 changed files with 8 additions and 3 deletions

View file

@ -342,8 +342,13 @@ impl RegularMap {
} }
let tile_index = tile_setting.index(); let tile_index = tile_setting.index();
let new_tile = if tile_index != 0 {
let new_tile_idx = vram.add_tile(tileset_ref, tile_index); let new_tile_idx = vram.add_tile(tileset_ref, tile_index);
let new_tile = Tile::new(new_tile_idx, tile_setting); Tile::new(new_tile_idx, tile_setting)
} else {
Tile::default()
};
self.tiles[pos] = new_tile; self.tiles[pos] = new_tile;
self.tiles_dirty = true; self.tiles_dirty = true;

View file

@ -806,7 +806,7 @@ fn main(mut agb: agb::Gba) -> ! {
let mut music_box = sfx::MusicBox::new(); let mut music_box = sfx::MusicBox::new();
let vblank = agb::interrupt::VBlank::get(); let vblank = agb::interrupt::VBlank::get();
let mut current_level = 0; let mut current_level = 8;
loop { loop {
if current_level == map_tiles::LEVELS.len() as u32 { if current_level == map_tiles::LEVELS.len() as u32 {