mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 08:11:33 +11:00
Allow deduplicating background tiles
This commit is contained in:
parent
dd119604d8
commit
8158bc1ff3
|
@ -36,6 +36,7 @@ struct BackgroundGfxOption {
|
|||
module_name: String,
|
||||
file_name: String,
|
||||
colours: Colours,
|
||||
deduplicate: bool,
|
||||
}
|
||||
|
||||
impl config::Image for BackgroundGfxOption {
|
||||
|
@ -72,12 +73,30 @@ impl Parse for BackgroundGfxOption {
|
|||
Colours::Colours16
|
||||
};
|
||||
|
||||
let lookahead = input.lookahead1();
|
||||
|
||||
let deduplicate = if lookahead.peek(syn::Ident) {
|
||||
let deduplicate: syn::Ident = input.parse()?;
|
||||
|
||||
if deduplicate == "deduplicate" {
|
||||
true
|
||||
} else {
|
||||
return Err(syn::Error::new_spanned(
|
||||
deduplicate,
|
||||
"Must either be the literal deduplicate or missing",
|
||||
));
|
||||
}
|
||||
} else {
|
||||
false
|
||||
};
|
||||
|
||||
let file_name: syn::LitStr = input.parse()?;
|
||||
|
||||
Ok(Self {
|
||||
module_name: module_name.to_string(),
|
||||
file_name: file_name.value(),
|
||||
colours,
|
||||
deduplicate,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,10 +47,10 @@ impl Game {
|
|||
|
||||
include_background_gfx!(
|
||||
games, "121105",
|
||||
hat => "gfx/hat.png",
|
||||
purple => "gfx/purple.png",
|
||||
hyperspace => "gfx/hyperspace.png",
|
||||
amplitude => "gfx/amplitude.png"
|
||||
hat => deduplicate "gfx/hat.png",
|
||||
purple => deduplicate "gfx/purple.png",
|
||||
hyperspace => deduplicate "gfx/hyperspace.png",
|
||||
amplitude => deduplicate "gfx/amplitude.png"
|
||||
);
|
||||
|
||||
fn get_game(gba: &mut agb::Gba) -> Game {
|
||||
|
|
Loading…
Reference in a new issue