Use deduplicated tiles for hatwiz splash screens

This commit is contained in:
Gwilym Inzani 2023-08-29 14:55:23 +01:00
parent b39f99990c
commit 201a127673

View file

@ -1,9 +1,9 @@
use super::sfx::SfxPlayer; 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, agb::include_background_gfx!(splash_screens,
splash => "gfx/splash.png", splash => deduplicate "gfx/splash.png",
thanks_for_playing => "gfx/thanks_for_playing.png", thanks_for_playing => deduplicate "gfx/thanks_for_playing.png",
); );
pub enum SplashScreen { pub enum SplashScreen {
@ -18,13 +18,19 @@ pub fn show_splash_screen(
vram: &mut VRamManager, vram: &mut VRamManager,
) { ) {
map.set_scroll_pos((0i16, 0i16).into()); map.set_scroll_pos((0i16, 0i16).into());
let tileset = match which { let (tileset, settings) = match which {
SplashScreen::Start => TileSet::new(splash_screens::splash.tiles, TileFormat::FourBpp), SplashScreen::Start => (
TileSet::new(splash_screens::splash.tiles, TileFormat::FourBpp),
splash_screens::splash.tile_settings,
),
SplashScreen::End => TileSet::new( SplashScreen::End => (
TileSet::new(
splash_screens::thanks_for_playing.tiles, splash_screens::thanks_for_playing.tiles,
TileFormat::FourBpp, TileFormat::FourBpp,
), ),
splash_screens::thanks_for_playing.tile_settings,
),
}; };
let vblank = agb::interrupt::VBlank::get(); let vblank = agb::interrupt::VBlank::get();
@ -40,7 +46,7 @@ pub fn show_splash_screen(
vram, vram,
(x, y).into(), (x, y).into(),
&tileset, &tileset,
TileSetting::from_raw(y * 30 + x), settings[(y * 30 + x) as usize],
); );
} }