From 95d0baeb4a79a9a0c239c736d43729574751fa58 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Wed, 18 Jan 2023 19:00:33 +0100 Subject: [PATCH] fixed bug with leaving steel grid after passing it in an irregular way MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit When using DF style reflecting steel walls together with MM style fixed steel grid, it is possible to point the laser towards the grid in a non 90° angle and still passing through it (with the laser beam being reflected inside the grid until it leaves the grid on the other side). However, this did not work when passing the steel grid from bottom to top (upwards) into an "empty space" element. This change fixes handling this special case. --- src/game_mm/mm_game.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/game_mm/mm_game.c b/src/game_mm/mm_game.c index bb027cd0..316c891e 100644 --- a/src/game_mm/mm_game.c +++ b/src/game_mm/mm_game.c @@ -958,7 +958,8 @@ static void DeactivateLaserTargetElement(void) void ScanLaser(void) { - int element; + int element = EL_EMPTY; + int last_element = EL_EMPTY; int end = 0, rf = laser.num_edges; // do not scan laser again after the game was lost for whatever reason @@ -1044,6 +1045,8 @@ void ScanLaser(void) hit_mask, LX, LY, ELX, ELY); #endif + last_element = element; + element = Tile[ELX][ELY]; laser.dest_element = element; @@ -1062,6 +1065,12 @@ void ScanLaser(void) ELX, ELY, element); #endif + // special case: leaving fixed MM steel grid (upwards) with non-90° angle + if (element == EL_EMPTY && + IS_GRID_STEEL(last_element) && + laser.current_angle % 4) // angle is not 90° + element = last_element; + if (element == EL_EMPTY) { if (!HitOnlyAnEdge(hit_mask)) -- 2.34.1