From dea6197b6bd9678dbe2f1acc0fd2611d4f41c7ae Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Fri, 7 Apr 2023 12:53:26 +0200 Subject: [PATCH 1/1] fixed scanning laser outside level, but inside visible playfield area --- src/game_mm/mm_game.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/game_mm/mm_game.c b/src/game_mm/mm_game.c index c89a9008..09fa1d04 100644 --- a/src/game_mm/mm_game.c +++ b/src/game_mm/mm_game.c @@ -850,6 +850,7 @@ static void AddLaserEdge(int lx, int ly) int full_sxsize = MAX(FULL_SXSIZE, lev_fieldx * TILEX); int full_sysize = MAX(FULL_SYSIZE, lev_fieldy * TILEY); + // check if laser is still inside visible playfield area (or inside level) if (cSX + lx < REAL_SX || cSX + lx >= REAL_SX + full_sxsize || cSY + ly < REAL_SY || cSY + ly >= REAL_SY + full_sysize) { @@ -989,6 +990,7 @@ static int ScanPixel(void) } else { + // check if laser is still inside visible playfield area pixel = (cSX + px < REAL_SX || cSX + px >= REAL_SX + FULL_SXSIZE || cSY + py < REAL_SY || cSY + py >= REAL_SY + FULL_SYSIZE); } @@ -1090,6 +1092,17 @@ static void ScanLaser(void) if (!IN_LEV_FIELD(ELX, ELY)) { + // check if laser is still inside visible playfield area + if (cSX + LX >= REAL_SX && cSX + LX < REAL_SX + FULL_SXSIZE && + cSY + LY >= REAL_SY && cSY + LY < REAL_SY + FULL_SYSIZE) + { + // go on with another step + LX += XS; + LY += YS; + + continue; + } + element = EL_EMPTY; laser.dest_element = element; -- 2.34.1