diff --git a/agb-image-converter/src/lib.rs b/agb-image-converter/src/lib.rs index 139c7aad..1cd8356b 100644 --- a/agb-image-converter/src/lib.rs +++ b/agb-image-converter/src/lib.rs @@ -116,8 +116,13 @@ pub fn include_aseprite_inner(input: TokenStream) -> TokenStream { for frame in frames { let width = frame.width(); let height = frame.height(); - assert!(width.is_power_of_two() && width <= 64); - assert!(height.is_power_of_two() && height <= 64); + assert!( + valid_sprite_size(width, height), + "File {} contains sprites with unrepresentable size {}x{}", + filename.display(), + width, + height + ); let image = Image::load_from_dyn_image(frame); add_to_optimiser(&mut optimiser, &image, 8, Some(transparent_colour)); @@ -398,3 +403,21 @@ mod tests { assert_eq!(AnimationDirection::PingPong as usize, 2); } } + +fn valid_sprite_size(width: u32, height: u32) -> bool { + match (width, height) { + (8, 8) => true, + (16, 16) => true, + (32, 32) => true, + (64, 64) => true, + (16, 8) => true, + (32, 8) => true, + (32, 16) => true, + (64, 32) => true, + (8, 16) => true, + (8, 32) => true, + (16, 32) => true, + (32, 64) => true, + (_, _) => false, + } +}