mindustry logic execution, map- and schematic- parsing and rendering
-rw-r--r--mindus/assets/blocks/environment/pur-bush.pngbin265 -> 204 bytes
-rw-r--r--mindus/assets/blocks/environment/yellowcoral.pngbin437 -> 382 bytes
-rw-r--r--mindus/src/block/mod.rs23
-rw-r--r--mindus/src/data/renderer.rs23
-rw-r--r--mindus/src/lib.rs5
5 files changed, 39 insertions, 12 deletions
diff --git a/mindus/assets/blocks/environment/pur-bush.png b/mindus/assets/blocks/environment/pur-bush.png
index 76768eb..9fe4180 100644
--- a/mindus/assets/blocks/environment/pur-bush.png
+++ b/mindus/assets/blocks/environment/pur-bush.png
Binary files differ
diff --git a/mindus/assets/blocks/environment/yellowcoral.png b/mindus/assets/blocks/environment/yellowcoral.png
index afad9c8..5a96fe2 100644
--- a/mindus/assets/blocks/environment/yellowcoral.png
+++ b/mindus/assets/blocks/environment/yellowcoral.png
Binary files differ
diff --git a/mindus/src/block/mod.rs b/mindus/src/block/mod.rs
index a1b6df2..188367b 100644
--- a/mindus/src/block/mod.rs
+++ b/mindus/src/block/mod.rs
@@ -604,7 +604,7 @@ macro_rules! make_register {
)+};
impl content::Type {
- pub fn to_block(self) -> Option<&'static Block> {
+ pub const fn to_block(self) -> Option<&'static Block> {
// static L: &[&Block] = &[$(&[<$field:snake:upper>],)+];
// L.get(self as usize).copied()
match self {
@@ -641,6 +641,27 @@ macro_rules! make_register {
}; }
};
}
+impl content::Type {
+ pub const FLOOR: [Self; 94] = {
+ let mut i = 0;
+ let mut bl = [Self::OreCopper; _];
+ let mut oi = 0;
+ while i < Self::ALL.len() {
+ if let Some(b) = Self::ALL[i].to_block()
+ && b.image
+ == Some(&car::map!(
+ crate::data::renderer::load!("empty4"),
+ DynImage::from
+ ))
+ {
+ bl[oi] = Self::ALL[i];
+ oi += 1;
+ }
+ i += 1;
+ }
+ bl
+ };
+}
// pub(self) use make_register;
make_register! {
"metal-wall-1": 1;
diff --git a/mindus/src/data/renderer.rs b/mindus/src/data/renderer.rs
index 095a69d..9f4226e 100644
--- a/mindus/src/data/renderer.rs
+++ b/mindus/src/data/renderer.rs
@@ -15,7 +15,7 @@ use crate::{
};
use atools::prelude::*;
use either::Either;
-use fimg::{BlendingOverlay, BlendingOverlayAt, uninit};
+use fimg::{BlendingOverlay, BlendingOverlayAt, OverlayAtClipping, uninit};
use std::hint::unlikely;
use std::iter::successors;
use std::ops::Coroutine;
@@ -393,6 +393,11 @@ impl Renderable for Map {
);
}
}
+ if Type::FLOOR.contains(&tile.ore) {
+ unsafe {
+ img.overlay_at(&table(tile.ore, scale), scale * x as u32, scale * y as u32);
+ }
+ }
}
}
let mut img = unsafe { img.assume_init() };
@@ -467,17 +472,16 @@ impl Renderable for Map {
position: pctx,
}
});
- unsafe {
- img.as_mut().overlay_at(
- &tile.build_image(ctx.as_ref(), scale),
- scale * x as u32,
- scale * y as u32,
- )
- };
+
+ img.as_mut().clipping_overlay_at(
+ &tile.build_image(ctx.as_ref(), scale),
+ scale * x as u32,
+ scale * y as u32,
+ );
}
}
}
- /// loop 3 for the ores
+ // loop 3 for the ores
for y in 0..self.height {
for x in 0..self.width {
let j = x + self.width * y;
@@ -525,6 +529,7 @@ impl Renderable for Map {
)
};
}
+ o if Type::FLOOR.contains(&o) => {}
ore => unsafe {
img.overlay_at(&table(ore, scale), scale * x as u32, scale * y as u32);
},
diff --git a/mindus/src/lib.rs b/mindus/src/lib.rs
index 4541f8e..64734ed 100644
--- a/mindus/src/lib.rs
+++ b/mindus/src/lib.rs
@@ -10,11 +10,12 @@
coroutine_trait,
likely_unlikely,
portable_simd,
+ const_convert,
derive_const,
try_trait_v2,
try_blocks,
- const_convert,
- coroutines
+ coroutines,
+ const_cmp
)]
#![allow(clippy::redundant_closure_call, incomplete_features)]
#![warn(