mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-24 08:41:34 +11:00
Update agb to handle the new agb-image-converter output
This commit is contained in:
parent
d4a12277eb
commit
9170acb1a8
|
@ -311,24 +311,41 @@ static ChickenSprites: &[Sprite] = &[
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
static MAP_TILES: [u32; 8 * 17] = [
|
static MAP_TILES: [u8; 8 * 17 * 4] = [
|
||||||
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x01111111, 0x01111111, 0x01111111,
|
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
|
||||||
0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x00000000, 0x01010101, 0x01010101,
|
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
|
||||||
0x00000000, 0x00000000, 0x11110000, 0x11100000, 0x11000100, 0x10001100, 0x00011100, 0x00111100,
|
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
|
||||||
0x00000000, 0x00000000, 0x01110001, 0x01100011, 0x01000111, 0x00001111, 0x00011111, 0x00111111,
|
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x01, 0x11, 0x11, 0x11, 0x01, 0x11, 0x11, 0x11, 0x01,
|
||||||
0x00111111, 0x00111111, 0x00111111, 0x00111111, 0x00111111, 0x00111111, 0x00001111, 0x00000111,
|
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
|
||||||
0x00000000, 0x00000000, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111,
|
0x11, 0x11, 0x11, 0x11, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||||
0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x10111111, 0x01101011,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x11, 0x00, 0x00, 0x10, 0x11,
|
||||||
0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x01101011,
|
0x00, 0x01, 0x00, 0x11, 0x00, 0x11, 0x00, 0x10, 0x00, 0x11, 0x01, 0x00, 0x00, 0x11, 0x11, 0x00,
|
||||||
0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11101111, 0x10110111,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x11, 0x01, 0x11, 0x00, 0x10, 0x01,
|
||||||
0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11101111,
|
0x11, 0x01, 0x00, 0x01, 0x11, 0x11, 0x00, 0x00, 0x11, 0x11, 0x01, 0x00, 0x11, 0x11, 0x11, 0x00,
|
||||||
0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111101, 0x11111011, 0x10111011,
|
0x11, 0x11, 0x11, 0x00, 0x11, 0x11, 0x11, 0x00, 0x11, 0x11, 0x11, 0x00, 0x11, 0x11, 0x11, 0x00,
|
||||||
0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x10111011,
|
0x11, 0x11, 0x11, 0x00, 0x11, 0x11, 0x11, 0x00, 0x11, 0x11, 0x00, 0x00, 0x11, 0x01, 0x00, 0x00,
|
||||||
0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11101111, 0x11101011,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
|
||||||
0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11011111, 0x11010111,
|
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
|
||||||
0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x01111111, 0x11010111,
|
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
|
||||||
|
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x10, 0x11, 0x10, 0x10, 0x01,
|
||||||
|
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
|
||||||
|
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x10, 0x10, 0x01,
|
||||||
|
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
|
||||||
|
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x10, 0x11, 0x11, 0x01, 0x11, 0x10,
|
||||||
|
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
|
||||||
|
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x10, 0x11,
|
||||||
|
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
|
||||||
|
0x11, 0x11, 0x11, 0x11, 0x01, 0x11, 0x11, 0x11, 0x11, 0x10, 0x11, 0x11, 0x11, 0x10, 0x11, 0x10,
|
||||||
|
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
|
||||||
|
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x10, 0x11, 0x10,
|
||||||
|
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
|
||||||
|
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x10, 0x11, 0x11, 0x10, 0x10, 0x11,
|
||||||
|
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
|
||||||
|
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x01, 0x11, 0x11, 0x01, 0x01, 0x11,
|
||||||
|
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
|
||||||
|
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x01, 0x11, 0x01, 0x01, 0x11,
|
||||||
];
|
];
|
||||||
|
|
||||||
static MAP_MAP: [u16; 1024] = [
|
static MAP_MAP: [u16; 1024] = [
|
||||||
|
|
|
@ -2,14 +2,14 @@ use crate::display::palette16::Palette16;
|
||||||
|
|
||||||
pub struct TileData {
|
pub struct TileData {
|
||||||
pub palettes: &'static [Palette16],
|
pub palettes: &'static [Palette16],
|
||||||
pub tiles: &'static [u32],
|
pub tiles: &'static [u8],
|
||||||
pub palette_assignments: &'static [u8],
|
pub palette_assignments: &'static [u8],
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TileData {
|
impl TileData {
|
||||||
pub const fn new(
|
pub const fn new(
|
||||||
palettes: &'static [Palette16],
|
palettes: &'static [Palette16],
|
||||||
tiles: &'static [u32],
|
tiles: &'static [u8],
|
||||||
palette_assignments: &'static [u8],
|
palette_assignments: &'static [u8],
|
||||||
) -> Self {
|
) -> Self {
|
||||||
TileData {
|
TileData {
|
||||||
|
|
|
@ -51,17 +51,17 @@ impl TileFormat {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct TileSet<'a> {
|
pub struct TileSet<'a> {
|
||||||
tiles: &'a [u32],
|
tiles: &'a [u8],
|
||||||
format: TileFormat,
|
format: TileFormat,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> TileSet<'a> {
|
impl<'a> TileSet<'a> {
|
||||||
pub fn new(tiles: &'a [u32], format: TileFormat) -> Self {
|
pub fn new(tiles: &'a [u8], format: TileFormat) -> Self {
|
||||||
Self { tiles, format }
|
Self { tiles, format }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn num_tiles(&self) -> usize {
|
fn num_tiles(&self) -> usize {
|
||||||
self.tiles.len() / self.format.tile_size() * 4
|
self.tiles.len() / self.format.tile_size()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,8 +204,8 @@ impl<'a> VRamManager<'a> {
|
||||||
"Stale tile data requested"
|
"Stale tile data requested"
|
||||||
);
|
);
|
||||||
|
|
||||||
let tile_offset = (tile as usize) * data.format.tile_size() / 4;
|
let tile_offset = (tile as usize) * data.format.tile_size();
|
||||||
&data.tiles[tile_offset..(tile_offset + data.format.tile_size() / 4)]
|
&data.tiles[tile_offset..(tile_offset + data.format.tile_size())]
|
||||||
} else {
|
} else {
|
||||||
panic!("Tile set ref must point to existing tile set");
|
panic!("Tile set ref must point to existing tile set");
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue