From d959e73c3f6961e053a5bed2e686064ddc1588b2 Mon Sep 17 00:00:00 2001 From: Lily Lyons Date: Sun, 24 Dec 2023 03:35:15 -0800 Subject: [PATCH] Add the option to not display autotiles in the tilepicker --- crates/components/src/tilepicker.rs | 1 + crates/graphics/src/tilepicker.rs | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/crates/components/src/tilepicker.rs b/crates/components/src/tilepicker.rs index a5d0c9fd..24f6eb2d 100644 --- a/crates/components/src/tilepicker.rs +++ b/crates/components/src/tilepicker.rs @@ -72,6 +72,7 @@ impl Tilepicker { &update_state.graphics, update_state.filesystem, tileset, + true, )?; Ok(Self { diff --git a/crates/graphics/src/tilepicker.rs b/crates/graphics/src/tilepicker.rs index d2604f15..04aab646 100644 --- a/crates/graphics/src/tilepicker.rs +++ b/crates/graphics/src/tilepicker.rs @@ -78,19 +78,24 @@ impl Tilepicker { graphics_state: &GraphicsState, filesystem: &impl luminol_filesystem::FileSystem, tileset: &luminol_data::rpg::Tileset, + include_autotiles: bool, ) -> anyhow::Result { let atlas = graphics_state .atlas_loader .load_atlas(graphics_state, filesystem, tileset)?; let tileset_size = egui::vec2(256., atlas.tileset_height as f32 + 32.); - let tilepicker_data = (47..(384 + 47)) - .step_by(48) - .chain(384..(atlas.tileset_height as i16 / 32 * 8 + 384)) - .collect_vec(); + let tilepicker_data = if include_autotiles { + (47..(384 + 47)) + .step_by(48) + .chain(384..(atlas.tileset_height as i16 / 32 * 8 + 384)) + .collect_vec() + } else { + (384..(atlas.tileset_height as i16 / 32 * 8 + 384)).collect_vec() + }; let tilepicker_data = luminol_data::Table3::new_data( 8, - 1 + (atlas.tileset_height / 32) as usize, + include_autotiles as usize + (atlas.tileset_height / 32) as usize, // bool as usize => 0 = false, 1 = true (saving us an if) 1, tilepicker_data, );