mirror of
https://github.com/italicsjenga/agb.git
synced 2025-01-11 01:21:34 +11:00
Fix build errors
This commit is contained in:
parent
9affb6dfb7
commit
12ed911f16
|
@ -1,20 +1,18 @@
|
|||
use agb::{
|
||||
display::tiled::{RegularMap, TileFormat, TileSet, TileSetting, VRamManager},
|
||||
display::tiled::{RegularMap, TileFormat, TileSet, TileSetting, TiledMap, VRamManager},
|
||||
include_gfx, rng,
|
||||
};
|
||||
|
||||
use crate::sfx::Sfx;
|
||||
|
||||
include_gfx!("gfx/stars.toml");
|
||||
|
||||
include_gfx!("gfx/help.toml");
|
||||
include_gfx!("gfx/backgrounds.toml");
|
||||
|
||||
pub fn load_palettes(vram: &mut VRamManager) {
|
||||
vram.set_background_palettes(&[
|
||||
stars::stars.palettes[0].clone(),
|
||||
crate::customise::DESCRIPTIONS_1_PALETTE.clone(),
|
||||
crate::customise::DESCRIPTIONS_2_PALETTE.clone(),
|
||||
help::help.palettes[0].clone(),
|
||||
backgrounds::stars.palettes[0].clone(),
|
||||
backgrounds::descriptions1.palettes[0].clone(),
|
||||
backgrounds::descriptions2.palettes[0].clone(),
|
||||
backgrounds::help.palettes[0].clone(),
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -24,7 +22,10 @@ pub(crate) fn load_help_text(
|
|||
help_text_line: u16,
|
||||
at_tile: (u16, u16),
|
||||
) {
|
||||
let help_tileset = TileSet::new(help::help.tiles, agb::display::tiled::TileFormat::FourBpp);
|
||||
let help_tileset = TileSet::new(
|
||||
backgrounds::help.tiles,
|
||||
agb::display::tiled::TileFormat::FourBpp,
|
||||
);
|
||||
|
||||
for x in 0..16 {
|
||||
background.set_tile(
|
||||
|
@ -36,6 +37,35 @@ pub(crate) fn load_help_text(
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn load_description(
|
||||
face_id: usize,
|
||||
descriptions_map: &mut RegularMap,
|
||||
vram: &mut VRamManager,
|
||||
) {
|
||||
let tileset = if face_id < 10 {
|
||||
TileSet::new(
|
||||
backgrounds::descriptions1.tiles,
|
||||
agb::display::tiled::TileFormat::FourBpp,
|
||||
)
|
||||
} else {
|
||||
TileSet::new(
|
||||
backgrounds::descriptions2.tiles,
|
||||
agb::display::tiled::TileFormat::FourBpp,
|
||||
)
|
||||
};
|
||||
|
||||
for y in 0..11 {
|
||||
for x in 0..8 {
|
||||
descriptions_map.set_tile(
|
||||
vram,
|
||||
(x, y).into(),
|
||||
&tileset,
|
||||
TileSetting::new(y * 8 + x + 8 * 11 * (face_id as u16 - 10), false, false, 2),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Expects a 64x32 map
|
||||
fn create_background_map(map: &mut RegularMap, vram: &mut VRamManager, stars_tileset: &TileSet) {
|
||||
for x in 0..64u16 {
|
||||
|
@ -53,13 +83,16 @@ fn create_background_map(map: &mut RegularMap, vram: &mut VRamManager, stars_til
|
|||
}
|
||||
}
|
||||
|
||||
map.set_scroll_pos((0u16, rng::gen().rem_euclid(8) as u16).into());
|
||||
map.set_scroll_pos((0i16, rng::gen().rem_euclid(8) as i16).into());
|
||||
}
|
||||
|
||||
pub fn show_title_screen(background: &mut RegularMap, vram: &mut VRamManager, sfx: &mut Sfx) {
|
||||
background.set_scroll_pos((0_u16, 0_u16).into());
|
||||
vram.set_background_palettes(stars::title.palettes);
|
||||
let tile_set = TileSet::new(stars::title.tiles, agb::display::tiled::TileFormat::FourBpp);
|
||||
background.set_scroll_pos((0i16, 0).into());
|
||||
vram.set_background_palettes(backgrounds::title.palettes);
|
||||
let tile_set = TileSet::new(
|
||||
backgrounds::title.tiles,
|
||||
agb::display::tiled::TileFormat::FourBpp,
|
||||
);
|
||||
background.hide();
|
||||
|
||||
for x in 0..30u16 {
|
||||
|
@ -73,7 +106,7 @@ pub fn show_title_screen(background: &mut RegularMap, vram: &mut VRamManager, sf
|
|||
tile_id,
|
||||
false,
|
||||
false,
|
||||
stars::title.palette_assignments[tile_id as usize],
|
||||
backgrounds::title.palette_assignments[tile_id as usize],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -100,7 +133,7 @@ impl<'a> StarBackground<'a> {
|
|||
background2: &'a mut RegularMap,
|
||||
vram: &'_ mut VRamManager,
|
||||
) -> Self {
|
||||
let stars_tileset = TileSet::new(stars::stars.tiles, TileFormat::FourBpp);
|
||||
let stars_tileset = TileSet::new(backgrounds::stars.tiles, TileFormat::FourBpp);
|
||||
create_background_map(background1, vram, &stars_tileset);
|
||||
create_background_map(background2, vram, &stars_tileset);
|
||||
|
||||
|
@ -116,13 +149,13 @@ impl<'a> StarBackground<'a> {
|
|||
pub fn update(&mut self) {
|
||||
if self.background1_timer == 0 {
|
||||
self.background1
|
||||
.set_scroll_pos(self.background1.scroll_pos() + (1u16, 0).into());
|
||||
.set_scroll_pos(self.background1.scroll_pos() + (1i16, 0).into());
|
||||
self.background1_timer = 2;
|
||||
}
|
||||
|
||||
if self.background2_timer == 0 {
|
||||
self.background2
|
||||
.set_scroll_pos(self.background2.scroll_pos() + (1u16, 0).into());
|
||||
.set_scroll_pos(self.background2.scroll_pos() + (1i16, 0).into());
|
||||
self.background2_timer = 3;
|
||||
}
|
||||
|
||||
|
|
|
@ -163,9 +163,9 @@ pub(crate) fn customise_screen(
|
|||
) -> PlayerDice {
|
||||
agb.sfx.customise();
|
||||
agb.sfx.frame();
|
||||
descriptions_map.set_scroll_pos((u16::MAX - 174, u16::MAX - 52).into());
|
||||
descriptions_map.set_scroll_pos((-174i16, -52).into());
|
||||
|
||||
help_background.set_scroll_pos((u16::MAX - 148, u16::MAX - 34).into());
|
||||
help_background.set_scroll_pos((-148i16, -34).into());
|
||||
crate::background::load_help_text(&mut agb.vram, help_background, 0, (0, 0));
|
||||
|
||||
// create the dice
|
||||
|
|
|
@ -35,5 +35,5 @@ pub fn write_level(
|
|||
);
|
||||
}
|
||||
|
||||
map.set_scroll_pos((-(WIDTH / 2 - 7 * 8 / 2) as u16, -(HEIGHT / 2 - 4) as u16).into());
|
||||
map.set_scroll_pos((-(WIDTH / 2 - 7 * 8 / 2) as i16, -(HEIGHT / 2 - 4) as i16).into());
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use super::sfx::MusicBox;
|
||||
use agb::{
|
||||
display::tiled::{RegularMap, TiledMap, TileFormat, TileSet, TileSetting, VRamManager},
|
||||
display::tiled::{RegularMap, TileFormat, TileSet, TileSetting, TiledMap, VRamManager},
|
||||
sound::mixer::Mixer,
|
||||
};
|
||||
|
||||
|
@ -18,7 +18,7 @@ pub fn show_splash_screen(
|
|||
map: &mut RegularMap,
|
||||
vram: &mut VRamManager,
|
||||
) {
|
||||
map.set_scroll_pos((0u16, 0u16).into());
|
||||
map.set_scroll_pos((0i16, 0i16).into());
|
||||
let (tileset, palette) = match which {
|
||||
SplashScreen::Start => {
|
||||
let tileset = TileSet::new(splash_screens::splash.tiles, TileFormat::FourBpp);
|
||||
|
|
Loading…
Reference in a new issue