From 86f210ae85014f9aab40778b45450be2662fb105 Mon Sep 17 00:00:00 2001 From: Joey Gouly Date: Sat, 15 Feb 2025 09:01:54 +0000 Subject: [PATCH 1/2] fix(lev): use correct order of vertices in Level::new() Ground polygons in elma must be anti-clockwise. --- src/lev.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lev.rs b/src/lev.rs index 4a92bca..d781caa 100644 --- a/src/lev.rs +++ b/src/lev.rs @@ -295,10 +295,10 @@ impl Level { polygons: vec![Polygon { grass: false, vertices: vec![ - Position::new(10., 0.), - Position::new(10., 7.), - Position::new(0., 7.), Position::new(0., 0.), + Position::new(0., 7.), + Position::new(15., 7.), + Position::new(15., 0.), ], }], objects: vec![ From 1af152e2914b4ca99670006c2c2990388e6301af Mon Sep 17 00:00:00 2001 From: Joey Gouly Date: Sat, 15 Feb 2025 09:06:27 +0000 Subject: [PATCH 2/2] fix(level): fix integrity check calculations commit 0080fb902951 negates the y-coordinates on load/save, this means the integrity checks must be changed to take this into account. This is the same as Elmanager does. --- src/lev.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lev.rs b/src/lev.rs index d781caa..1868740 100644 --- a/src/lev.rs +++ b/src/lev.rs @@ -752,7 +752,7 @@ impl Level { for poly in &self.polygons { for vertex in &poly.vertices { - pol_sum += vertex.x + vertex.y; + pol_sum += vertex.x - vertex.y; } } @@ -763,11 +763,11 @@ impl Level { ObjectType::Killer => 3, ObjectType::Player => 4, }; - obj_sum += obj.position.x + obj.position.y + f64::from(obj_type); + obj_sum += obj.position.x - obj.position.y + f64::from(obj_type); } for pic in &self.pictures { - pic_sum += pic.position.x + pic.position.y; + pic_sum += pic.position.x - pic.position.y; } let sum = (pol_sum + obj_sum + pic_sum) * 3_247.764_325_643;