X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame_mm%2Fmm_game.c;h=316c891edea811616016ef637d49bde1764c50ed;hb=3ca52442121dc311d2ead0dbf3b366ea367fcdeb;hp=45c65634a9985556c75420f04edc463ead080198;hpb=7f33353a6e8ce4dc9a3b7a604a4c7deb836544f7;p=rocksndiamonds.git diff --git a/src/game_mm/mm_game.c b/src/game_mm/mm_game.c index 45c65634..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)) @@ -1120,6 +1129,14 @@ void ScanLaser(void) if (rf) DrawLaser(rf - 1, DL_LASER_ENABLED); rf = laser.num_edges; + + if (!IS_DF_WALL_STEEL(element)) + { + // only used for scanning DF steel walls; reset for all other elements + last_LX = 0; + last_LY = 0; + last_hit_mask = 0; + } } #if 0 @@ -1465,6 +1482,10 @@ boolean HitElement(int element, int hit_mask) // this is more precise: check if laser would go through the center if ((ELX * TILEX + 14 - LX) * YS != (ELY * TILEY + 14 - LY) * XS) { + // prevent cutting through laser emitter with laser beam + if (IS_LASER(element)) + return TRUE; + // skip the whole element before continuing the scan do {