X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame_mm%2Fmm_game.c;h=87ee350cc78027170fcc03aaeeeae3a87bbddbda;hb=98cdc60c12229af0a1672372157d52afe8edd3d0;hp=b0743369f8acf99bff6ce4a9600e33ed88e1510d;hpb=f00dbcf8e990eabe51b7b92cc7fb320ef10e4b6e;p=rocksndiamonds.git diff --git a/src/game_mm/mm_game.c b/src/game_mm/mm_game.c index b0743369..87ee350c 100644 --- a/src/game_mm/mm_game.c +++ b/src/game_mm/mm_game.c @@ -139,11 +139,10 @@ static DelayCounter overload_delay = { 0 }; #define MM_MASK_GRID_2 5 #define MM_MASK_GRID_3 6 #define MM_MASK_GRID_4 7 -#define MM_MASK_GRID_CLOSED 8 -#define MM_MASK_RECTANGLE 9 -#define MM_MASK_CIRCLE 10 +#define MM_MASK_RECTANGLE 8 +#define MM_MASK_CIRCLE 9 -#define NUM_MM_MASKS 11 +#define NUM_MM_MASKS 10 // element masks for scanning pixels of MM elements static const char mm_masks[NUM_MM_MASKS][16][16 + 1] = @@ -292,24 +291,6 @@ static const char mm_masks[NUM_MM_MASKS][16][16 + 1] = " XXX XXXX ", " XX XXXXX ", }, - { - " XXXXXX XXXXXX ", - "XXXXXXXXXXXXXXXX", - "XXXXXXXXXXXXXXXX", - "XXXXXXXXXXXXXXXX", - "XXXXXXXXXXXXXXXX", - "XXXXXXXXXXXXXXXX", - "XXXXXXXXXXXXXXXX", - " XXXXXXXXXXXXXX ", - " XXXXXXXXXXXXXX ", - "XXXXXXXXXXXXXXXX", - "XXXXXXXXXXXXXXXX", - "XXXXXXXXXXXXXXXX", - "XXXXXXXXXXXXXXXX", - "XXXXXXXXXXXXXXXX", - "XXXXXXXXXXXXXXXX", - " XXXXXX XXXXXX ", - }, { "XXXXXXXXXXXXXXXX", "XXXXXXXXXXXXXXXX", @@ -847,12 +828,12 @@ static void GameOver_MM(int game_over_cause) static void AddLaserEdge(int lx, int ly) { - int clx = dSX + lx; - int cly = dSY + ly; - int sxsize = MAX(SXSIZE, lev_fieldx * TILEX); - int sysize = MAX(SYSIZE, lev_fieldy * TILEY); + int full_sxsize = MAX(FULL_SXSIZE, lev_fieldx * TILEX); + int full_sysize = MAX(FULL_SYSIZE, lev_fieldy * TILEY); - if (clx < -2 || cly < -2 || clx >= sxsize + 2 || cly >= sysize + 2) + // 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) { Warn("AddLaserEdge: out of bounds: %d, %d", lx, ly); @@ -905,7 +886,7 @@ static int getMaskFromElement(int element) else if (IS_GRID(element)) return MM_MASK_GRID_1 + get_element_phase(element); else if (IS_DF_GRID(element)) - return MM_MASK_GRID_CLOSED; + return MM_MASK_RECTANGLE; else if (IS_RECTANGLE(element)) return MM_MASK_RECTANGLE; else @@ -990,6 +971,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); } @@ -1091,6 +1073,21 @@ static void ScanLaser(void) if (!IN_LEV_FIELD(ELX, ELY)) { + // 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; + LY += YS; + + continue; + } + element = EL_EMPTY; laser.dest_element = element;