From: Holger Schemel Date: Mon, 10 Apr 2023 11:31:55 +0000 (+0200) Subject: improved scanning laser outside level, but inside visible playfield area X-Git-Tag: 4.3.6.0~36 X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=commitdiff_plain;h=98cdc60c12229af0a1672372157d52afe8edd3d0 improved scanning laser outside level, but inside visible playfield area This change adds checking that not only the current, but also the next step of the laser beam is still inside the visible playfield area. This is a correction of commit dea6197b. --- diff --git a/src/game_mm/mm_game.c b/src/game_mm/mm_game.c index 0aaaadda..87ee350c 100644 --- a/src/game_mm/mm_game.c +++ b/src/game_mm/mm_game.c @@ -1073,9 +1073,13 @@ 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) + // laser next step position + int x = cSX + LX + XS; + int y = cSY + LY + YS; + + // check if next step of laser is still inside visible playfield area + if (x >= REAL_SX && x < REAL_SX + FULL_SXSIZE && + y >= REAL_SY && y < REAL_SY + FULL_SYSIZE) { // go on with another step LX += XS;