From 201a1276732f4e87e61ad1a53fd2d5aa6350a06f Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Tue, 29 Aug 2023 14:55:23 +0100 Subject: [PATCH] Use deduplicated tiles for hatwiz splash screens --- .../src/splash_screen.rs | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/examples/the-hat-chooses-the-wizard/src/splash_screen.rs b/examples/the-hat-chooses-the-wizard/src/splash_screen.rs index fb90190f..2c13a1ac 100644 --- a/examples/the-hat-chooses-the-wizard/src/splash_screen.rs +++ b/examples/the-hat-chooses-the-wizard/src/splash_screen.rs @@ -1,9 +1,9 @@ use super::sfx::SfxPlayer; -use agb::display::tiled::{RegularMap, TileFormat, TileSet, TileSetting, TiledMap, VRamManager}; +use agb::display::tiled::{RegularMap, TileFormat, TileSet, TiledMap, VRamManager}; agb::include_background_gfx!(splash_screens, - splash => "gfx/splash.png", - thanks_for_playing => "gfx/thanks_for_playing.png", + splash => deduplicate "gfx/splash.png", + thanks_for_playing => deduplicate "gfx/thanks_for_playing.png", ); pub enum SplashScreen { @@ -18,12 +18,18 @@ pub fn show_splash_screen( vram: &mut VRamManager, ) { map.set_scroll_pos((0i16, 0i16).into()); - let tileset = match which { - SplashScreen::Start => TileSet::new(splash_screens::splash.tiles, TileFormat::FourBpp), + let (tileset, settings) = match which { + SplashScreen::Start => ( + TileSet::new(splash_screens::splash.tiles, TileFormat::FourBpp), + splash_screens::splash.tile_settings, + ), - SplashScreen::End => TileSet::new( - splash_screens::thanks_for_playing.tiles, - TileFormat::FourBpp, + SplashScreen::End => ( + TileSet::new( + splash_screens::thanks_for_playing.tiles, + TileFormat::FourBpp, + ), + splash_screens::thanks_for_playing.tile_settings, ), }; @@ -40,7 +46,7 @@ pub fn show_splash_screen( vram, (x, y).into(), &tileset, - TileSetting::from_raw(y * 30 + x), + settings[(y * 30 + x) as usize], ); }