mirror of
https://github.com/italicsjenga/agb.git
synced 2025-01-11 09:31:34 +11:00
Fix hyperspace roll using the wrong palette assignments
This commit is contained in:
parent
ea75823900
commit
b2e15c8e7b
|
@ -8,12 +8,7 @@ use crate::sfx::Sfx;
|
||||||
include_gfx!("gfx/backgrounds.toml");
|
include_gfx!("gfx/backgrounds.toml");
|
||||||
|
|
||||||
pub fn load_palettes(vram: &mut VRamManager) {
|
pub fn load_palettes(vram: &mut VRamManager) {
|
||||||
vram.set_background_palettes(&[
|
vram.set_background_palettes(backgrounds::stars.palettes);
|
||||||
backgrounds::stars.palettes[0].clone(),
|
|
||||||
backgrounds::descriptions1.palettes[0].clone(),
|
|
||||||
backgrounds::descriptions2.palettes[0].clone(),
|
|
||||||
backgrounds::help.palettes[0].clone(),
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn load_help_text(
|
pub(crate) fn load_help_text(
|
||||||
|
@ -28,11 +23,18 @@ pub(crate) fn load_help_text(
|
||||||
);
|
);
|
||||||
|
|
||||||
for x in 0..16 {
|
for x in 0..16 {
|
||||||
|
let tile_id = help_text_line * 16 + x;
|
||||||
|
|
||||||
background.set_tile(
|
background.set_tile(
|
||||||
vram,
|
vram,
|
||||||
(x + at_tile.0, at_tile.1).into(),
|
(x + at_tile.0, at_tile.1).into(),
|
||||||
&help_tileset,
|
&help_tileset,
|
||||||
TileSetting::new(help_text_line * 16 + x, false, false, 3),
|
TileSetting::new(
|
||||||
|
tile_id,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
backgrounds::help.palette_assignments[tile_id as usize],
|
||||||
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,25 +44,32 @@ pub(crate) fn load_description(
|
||||||
descriptions_map: &mut RegularMap,
|
descriptions_map: &mut RegularMap,
|
||||||
vram: &mut VRamManager,
|
vram: &mut VRamManager,
|
||||||
) {
|
) {
|
||||||
let tileset = if face_id < 10 {
|
let (tileset, palette_assignments) = if face_id < 10 {
|
||||||
TileSet::new(
|
(
|
||||||
backgrounds::descriptions1.tiles,
|
TileSet::new(
|
||||||
agb::display::tiled::TileFormat::FourBpp,
|
backgrounds::descriptions1.tiles,
|
||||||
|
agb::display::tiled::TileFormat::FourBpp,
|
||||||
|
),
|
||||||
|
backgrounds::descriptions1.palette_assignments,
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
TileSet::new(
|
(
|
||||||
backgrounds::descriptions2.tiles,
|
TileSet::new(
|
||||||
agb::display::tiled::TileFormat::FourBpp,
|
backgrounds::descriptions2.tiles,
|
||||||
|
agb::display::tiled::TileFormat::FourBpp,
|
||||||
|
),
|
||||||
|
backgrounds::descriptions2.palette_assignments,
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
for y in 0..11 {
|
for y in 0..11 {
|
||||||
for x in 0..8 {
|
for x in 0..8 {
|
||||||
|
let tile_id = y * 8 + x + 8 * 11 * (face_id as u16 - 10);
|
||||||
descriptions_map.set_tile(
|
descriptions_map.set_tile(
|
||||||
vram,
|
vram,
|
||||||
(x, y).into(),
|
(x, y).into(),
|
||||||
&tileset,
|
&tileset,
|
||||||
TileSetting::new(y * 8 + x + 8 * 11 * (face_id as u16 - 10), false, false, 2),
|
TileSetting::new(tile_id, false, false, palette_assignments[tile_id as usize]),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,12 +81,16 @@ fn create_background_map(map: &mut RegularMap, vram: &mut VRamManager, stars_til
|
||||||
for y in 0..32u16 {
|
for y in 0..32u16 {
|
||||||
let blank = rng::gen().rem_euclid(32) < 30;
|
let blank = rng::gen().rem_euclid(32) < 30;
|
||||||
|
|
||||||
let tile_id = if blank {
|
let (tile_id, palette_id) = if blank {
|
||||||
(1 << 10) - 1
|
((1 << 10) - 1, 0)
|
||||||
} else {
|
} else {
|
||||||
rng::gen().rem_euclid(64) as u16
|
let tile_id = rng::gen().rem_euclid(64) as u16;
|
||||||
|
(
|
||||||
|
tile_id,
|
||||||
|
backgrounds::stars.palette_assignments[tile_id as usize],
|
||||||
|
)
|
||||||
};
|
};
|
||||||
let tile_setting = TileSetting::new(tile_id, false, false, 0);
|
let tile_setting = TileSetting::new(tile_id, false, false, palette_id);
|
||||||
|
|
||||||
map.set_tile(vram, (x, y).into(), stars_tileset, tile_setting);
|
map.set_tile(vram, (x, y).into(), stars_tileset, tile_setting);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue