This commit is contained in:
Edgar 2023-03-10 13:27:46 +01:00
parent 5e02800382
commit df7f915f1b
No known key found for this signature in database
GPG key ID: 70ADAE8F35904387
4 changed files with 56 additions and 37 deletions

48
Cargo.lock generated
View file

@ -17,6 +17,15 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]]
name = "approx"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6"
dependencies = [
"num-traits",
]
[[package]] [[package]]
name = "autocfg" name = "autocfg"
version = "1.1.0" version = "1.1.0"
@ -181,7 +190,7 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
[[package]] [[package]]
name = "ddnet-map-gen" name = "ddnet-map-gen"
version = "0.2.2" version = "0.2.3"
dependencies = [ dependencies = [
"clap", "clap",
"color-eyre", "color-eyre",
@ -196,6 +205,7 @@ dependencies = [
"rand_distr", "rand_distr",
"rand_seeder", "rand_seeder",
"twmap", "twmap",
"vek",
] ]
[[package]] [[package]]
@ -244,6 +254,7 @@ dependencies = [
"az", "az",
"bytemuck", "bytemuck",
"half", "half",
"num-traits",
"serde", "serde",
"typenum", "typenum",
] ]
@ -677,6 +688,15 @@ version = "0.1.21"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342"
[[package]]
name = "rustc_version"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
dependencies = [
"semver",
]
[[package]] [[package]]
name = "rustix" name = "rustix"
version = "0.36.9" version = "0.36.9"
@ -707,6 +727,12 @@ dependencies = [
"regex", "regex",
] ]
[[package]]
name = "semver"
version = "1.0.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a"
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.154" version = "1.0.154"
@ -868,10 +894,11 @@ dependencies = [
[[package]] [[package]]
name = "twmap" name = "twmap"
version = "0.9.1" version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8d22e0085b0a65f399fcac949306194f0217c06aa2217b9e19a01944d162851" checksum = "e572d31d0ba97c8509edd1956d4828cd8c7b5139a7192d7d7865517cddd3aeee"
dependencies = [ dependencies = [
"az",
"bitflags", "bitflags",
"bytemuck", "bytemuck",
"fixed", "fixed",
@ -886,6 +913,7 @@ dependencies = [
"serde_json", "serde_json",
"structview", "structview",
"thiserror", "thiserror",
"vek",
] ]
[[package]] [[package]]
@ -912,6 +940,20 @@ version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]]
name = "vek"
version = "0.15.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8085882662f9bc47fc8b0cdafa5e19df8f592f650c02b9083da8d45ac9eebd17"
dependencies = [
"approx",
"az",
"num-integer",
"num-traits",
"rustc_version",
"serde",
]
[[package]] [[package]]
name = "version_check" name = "version_check"
version = "0.9.4" version = "0.9.4"

View file

@ -2,7 +2,7 @@
name = "ddnet-map-gen" name = "ddnet-map-gen"
authors = ["Edgar <git@edgarluque.com>"] authors = ["Edgar <git@edgarluque.com>"]
description = "A DDraceNetwork map generator." description = "A DDraceNetwork map generator."
version = "0.2.2" version = "0.2.3"
edition = "2021" edition = "2021"
license = "AGPL-3.0-only" license = "AGPL-3.0-only"
repository = "https://github.com/edg-l/ddnet-map-gen" repository = "https://github.com/edg-l/ddnet-map-gen"
@ -24,4 +24,5 @@ rand = "0.8.5"
rand_chacha = "0.3.1" rand_chacha = "0.3.1"
rand_distr = "0.4.3" rand_distr = "0.4.3"
rand_seeder = "0.2.3" rand_seeder = "0.2.3"
twmap = "0.9.1" twmap = "0.10.0"
vek = "0.15.10"

View file

@ -101,12 +101,7 @@ impl MapGenerator for FlyGenerator {
let mut freeze_tiles_layer = TilesLayer::new((height, width)); let mut freeze_tiles_layer = TilesLayer::new((height, width));
freeze_tiles_layer.image = Some(1); freeze_tiles_layer.image = Some(1);
freeze_tiles_layer.tiles = CompressedData::Loaded(freeze_tiles); freeze_tiles_layer.tiles = CompressedData::Loaded(freeze_tiles);
freeze_tiles_layer.color = Color { freeze_tiles_layer.color = Rgba::new(0, 0, 0, 200);
r: 0,
g: 0,
b: 0,
a: 200,
};
let mut physics = Group::physics(); let mut physics = Group::physics();
physics.layers.push(Layer::Game(game_layer)); physics.layers.push(Layer::Game(game_layer));

View file

@ -6,6 +6,7 @@ use fixed::types::I17F15;
use ndarray::Array2; use ndarray::Array2;
use rand::Rng; use rand::Rng;
use twmap::*; use twmap::*;
use vek::{Extent2, Rgba};
pub mod fly; pub mod fly;
pub mod maze; pub mod maze;
@ -49,7 +50,7 @@ pub fn create_initial_map(mapres: &Path) -> Result<TwMap> {
//map.info.version = //map.info.version =
map.images.push(Image::External(ExternalImage { map.images.push(Image::External(ExternalImage {
name: "generic_unhookable".to_string(), name: "generic_unhookable".to_string(),
size: Point::new_same(1024), size: Extent2::new(1024, 1024),
})); }));
map.images.push(Image::Embedded(EmbeddedImage::from_file(mapres.join("basic_freeze.png")).note("Might have failed due to a non existing mapres directory, check out the '--mapres' option.")?)); map.images.push(Image::Embedded(EmbeddedImage::from_file(mapres.join("basic_freeze.png")).note("Might have failed due to a non existing mapres directory, check out the '--mapres' option.")?));
Ok(map) Ok(map)
@ -64,34 +65,14 @@ pub fn quads_sky() -> Group {
let mut quad = Quad::new( let mut quad = Quad::new(
Default::default(), Default::default(),
Point::new(I17F15::from_num(50), I17F15::from_num(30)), Extent2::new(I17F15::from_num(50), I17F15::from_num(30)),
) )
.unwrap(); .unwrap();
quad.colors = [ quad.colors = [
Color { Rgba::new(94, 132, 174, 255),
r: 94, Rgba::new(94, 132, 174, 255),
g: 132, Rgba::new(204, 232, 255, 255),
b: 174, Rgba::new(204, 232, 255, 255),
a: 255,
},
Color {
r: 94,
g: 132,
b: 174,
a: 255,
},
Color {
r: 204,
g: 232,
b: 255,
a: 255,
},
Color {
r: 204,
g: 232,
b: 255,
a: 255,
},
]; ];
quads_layer.quads.push(quad); quads_layer.quads.push(quad);