hedgewars/uLandGraphics.pas
changeset 3595 341e407e3754
parent 3554 066faceb977d
child 3596 51062794ed01
equal deleted inserted replaced
3594:aeca3d8f1b29 3595:341e407e3754
   144 var i: LongInt;
   144 var i: LongInt;
   145 begin
   145 begin
   146 if ((y + dy) and LAND_HEIGHT_MASK) = 0 then
   146 if ((y + dy) and LAND_HEIGHT_MASK) = 0 then
   147     for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do
   147     for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do
   148         if (not isMap and ((Land[y + dy, i] and lfIndestructible) = 0)) or ((Land[y + dy, i] and lfBasic) <> 0) then
   148         if (not isMap and ((Land[y + dy, i] and lfIndestructible) = 0)) or ((Land[y + dy, i] and lfBasic) <> 0) then
   149 {$IFDEF DOWNSCALE}
   149             if (cReducedQuality and rqBlurryLand) = 0 then
   150             LandPixels[(y + dy) div 2, i div 2]:= 0;
   150                 LandPixels[y + dy, i]:= 0
   151 {$ELSE}
   151             else
   152             LandPixels[y + dy, i]:= 0;
   152                 LandPixels[(y + dy) div 2, i div 2]:= 0;
   153 {$ENDIF}
   153 
   154 if ((y - dy) and LAND_HEIGHT_MASK) = 0 then
   154 if ((y - dy) and LAND_HEIGHT_MASK) = 0 then
   155     for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do
   155     for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do
   156         if (not isMap and ((Land[y - dy, i] and lfIndestructible) = 0)) or ((Land[y - dy, i] and lfBasic) <> 0) then
   156         if (not isMap and ((Land[y - dy, i] and lfIndestructible) = 0)) or ((Land[y - dy, i] and lfBasic) <> 0) then
   157 {$IFDEF DOWNSCALE}
   157             if (cReducedQuality and rqBlurryLand) = 0 then
   158              LandPixels[(y - dy) div 2, i div 2]:= 0;
   158                 LandPixels[y - dy, i]:= 0
   159 {$ELSE}
   159             else
   160              LandPixels[y - dy, i]:= 0;
   160                 LandPixels[(y - dy) div 2, i div 2]:= 0;
   161 {$ENDIF}
   161 
   162 if ((y + dx) and LAND_HEIGHT_MASK) = 0 then
   162 if ((y + dx) and LAND_HEIGHT_MASK) = 0 then
   163     for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do
   163     for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do
   164         if (not isMap and ((Land[y + dx, i] and lfIndestructible) = 0)) or ((Land[y + dx, i] and lfBasic) <> 0) then
   164         if (not isMap and ((Land[y + dx, i] and lfIndestructible) = 0)) or ((Land[y + dx, i] and lfBasic) <> 0) then
   165 {$IFDEF DOWNSCALE}
   165             if (cReducedQuality and rqBlurryLand) = 0 then
   166             LandPixels[(y + dx) div 2, i div 2]:= 0;
   166                 LandPixels[y + dx, i]:= 0
   167 {$ELSE}
   167             else
   168             LandPixels[y + dx, i]:= 0;
   168                 LandPixels[(y + dx) div 2, i div 2]:= 0;
   169 {$ENDIF}
   169 
   170 if ((y - dx) and LAND_HEIGHT_MASK) = 0 then
   170 if ((y - dx) and LAND_HEIGHT_MASK) = 0 then
   171     for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do
   171     for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do
   172         if (not isMap and ((Land[y - dx, i] and lfIndestructible) = 0)) or ((Land[y - dx, i] and lfBasic) <> 0) then
   172         if (not isMap and ((Land[y - dx, i] and lfIndestructible) = 0)) or ((Land[y - dx, i] and lfBasic) <> 0) then
   173 {$IFDEF DOWNSCALE}
   173             if (cReducedQuality and rqBlurryLand) = 0 then
   174              LandPixels[(y - dx) div 2, i div 2]:= 0;
   174                 LandPixels[y - dx, i]:= 0
   175 {$ELSE}
   175             else
   176              LandPixels[y - dx, i]:= 0;
   176                 LandPixels[(y - dx) div 2, i div 2]:= 0;
   177 {$ENDIF}
   177 
   178 end;
   178 end;
   179 
   179 
   180 procedure FillLandCircleLinesBG(x, y, dx, dy: LongInt);
   180 procedure FillLandCircleLinesBG(x, y, dx, dy: LongInt);
   181 var i: LongInt;
   181 var i: LongInt;
   182 begin
   182 begin
   183 if ((y + dy) and LAND_HEIGHT_MASK) = 0 then
   183 if ((y + dy) and LAND_HEIGHT_MASK) = 0 then
   184    for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do
   184    for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do
   185        if ((Land[y + dy, i] and lfBasic) <> 0) then
   185        if ((Land[y + dy, i] and lfBasic) <> 0) then
   186 {$IFDEF DOWNSCALE}
   186            if (cReducedQuality and rqBlurryLand) = 0 then
   187           LandPixels[(y + dy) div 2, i div 2]:= LandBackPixel(i, y + dy)
   187                LandPixels[y + dy, i]:= LandBackPixel(i, y + dy)
   188 {$ELSE}
   188            else
   189           LandPixels[y + dy, i]:= LandBackPixel(i, y + dy)
   189                LandPixels[(y + dy) div 2, i div 2]:= LandBackPixel(i, y + dy)
   190 {$ENDIF}
       
   191        else
   190        else
   192 {$IFDEF DOWNSCALE}
   191            if ((Land[y + dy, i] and lfObject) <> 0) then
   193           if ((Land[y + dy, i] and lfObject) <> 0) then LandPixels[(y + dy) div 2, i div 2]:= 0;
   192                if (cReducedQuality and rqBlurryLand) = 0 then
   194 {$ELSE}
   193                    LandPixels[y + dy, i]:= 0
   195           if ((Land[y + dy, i] and lfObject) <> 0) then LandPixels[y + dy, i]:= 0;
   194                else
   196 {$ENDIF}
   195                    LandPixels[(y + dy) div 2, i div 2]:= 0;
       
   196 
   197 if ((y - dy) and LAND_HEIGHT_MASK) = 0 then
   197 if ((y - dy) and LAND_HEIGHT_MASK) = 0 then
   198    for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do
   198    for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do
   199        if ((Land[y - dy, i] and lfBasic) <> 0) then
   199        if ((Land[y - dy, i] and lfBasic) <> 0) then
   200 {$IFDEF DOWNSCALE}
   200            if (cReducedQuality and rqBlurryLand) = 0 then
   201           LandPixels[(y - dy) div 2, i div 2]:= LandBackPixel(i, y - dy)
   201                LandPixels[y - dy, i]:= LandBackPixel(i, y - dy)
   202 {$ELSE}
   202            else
   203           LandPixels[y - dy, i]:= LandBackPixel(i, y - dy)
   203                LandPixels[(y - dy) div 2, i div 2]:= LandBackPixel(i, y - dy)
   204 {$ENDIF}
       
   205        else
   204        else
   206 {$IFDEF DOWNSCALE}
   205            if ((Land[y - dy, i] and lfObject) <> 0) then
   207           if ((Land[y - dy, i] and lfObject) <> 0) then LandPixels[(y - dy) div 2, i div 2]:= 0;
   206                if (cReducedQuality and rqBlurryLand) = 0 then
   208 {$ELSE}
   207                    LandPixels[y - dy, i]:= 0
   209           if ((Land[y - dy, i] and lfObject) <> 0) then LandPixels[y - dy, i]:= 0;
   208                else
   210 {$ENDIF}
   209                    LandPixels[(y - dy) div 2, i div 2]:= 0;
       
   210 
   211 if ((y + dx) and LAND_HEIGHT_MASK) = 0 then
   211 if ((y + dx) and LAND_HEIGHT_MASK) = 0 then
   212    for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do
   212    for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do
   213        if ((Land[y + dx, i] and lfBasic) <> 0) then
   213        if ((Land[y + dx, i] and lfBasic) <> 0) then
   214 {$IFDEF DOWNSCALE}
   214            if (cReducedQuality and rqBlurryLand) = 0 then
       
   215            LandPixels[y + dx, i]:= LandBackPixel(i, y + dx)
       
   216             else 
   215            LandPixels[(y + dx) div 2, i div 2]:= LandBackPixel(i, y + dx)
   217            LandPixels[(y + dx) div 2, i div 2]:= LandBackPixel(i, y + dx)
   216 {$ELSE}
       
   217            LandPixels[y + dx, i]:= LandBackPixel(i, y + dx)
       
   218 {$ENDIF}
       
   219        else
   218        else
   220 {$IFDEF DOWNSCALE}
   219             if ((Land[y + dx, i] and lfObject) <> 0) then
   221           if ((Land[y + dx, i] and lfObject) <> 0) then LandPixels[(y + dx) div 2, i div 2]:= 0;
   220             if (cReducedQuality and rqBlurryLand) = 0 then
   222 {$ELSE}
   221           LandPixels[y + dx, i]:= 0
   223           if ((Land[y + dx, i] and lfObject) <> 0) then LandPixels[y + dx, i]:= 0;
   222             else
   224 {$ENDIF}
   223            LandPixels[(y + dx) div 2, i div 2]:= 0;
       
   224 
   225 if ((y - dx) and LAND_HEIGHT_MASK) = 0 then
   225 if ((y - dx) and LAND_HEIGHT_MASK) = 0 then
   226    for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do
   226    for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do
   227        if ((Land[y - dx, i] and lfBasic) <> 0) then
   227        if ((Land[y - dx, i] and lfBasic) <> 0) then
   228 {$IFDEF DOWNSCALE}
   228             if (cReducedQuality and rqBlurryLand) = 0 then
   229           LandPixels[(y - dx) div 2, i div 2]:= LandBackPixel(i, y - dx)
       
   230 {$ELSE}
       
   231           LandPixels[y - dx, i]:= LandBackPixel(i, y - dx)
   229           LandPixels[y - dx, i]:= LandBackPixel(i, y - dx)
   232 {$ENDIF}
   230         else 
       
   231          LandPixels[(y - dx) div 2, i div 2]:= LandBackPixel(i, y - dx)
       
   232 
   233        else
   233        else
   234 {$IFDEF DOWNSCALE}
   234           if ((Land[y - dx, i] and lfObject) <> 0) then
   235           if ((Land[y - dx, i] and lfObject) <> 0) then LandPixels[(y - dx) div 2, i div 2]:= 0;
   235               if (cReducedQuality and rqBlurryLand) = 0 then
   236 {$ELSE}
   236                 LandPixels[y - dx, i]:= 0
   237           if ((Land[y - dx, i] and lfObject) <> 0) then LandPixels[y - dx, i]:= 0;
   237               else
   238 {$ENDIF}
   238                 LandPixels[(y - dx) div 2, i div 2]:= 0;
       
   239 
   239 end;
   240 end;
   240 
   241 
   241 procedure FillLandCircleLinesEBC(x, y, dx, dy: LongInt);
   242 procedure FillLandCircleLinesEBC(x, y, dx, dy: LongInt);
   242 var i: LongInt;
   243 var i: LongInt;
   243 begin
   244 begin
   244 if ((y + dy) and LAND_HEIGHT_MASK) = 0 then
   245 if ((y + dy) and LAND_HEIGHT_MASK) = 0 then
   245    for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do
   246    for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do
   246        if ((Land[y + dy, i] and lfBasic) <> 0) or ((Land[y + dy, i] and lfObject) <> 0) then
   247        if ((Land[y + dy, i] and lfBasic) <> 0) or ((Land[y + dy, i] and lfObject) <> 0) then
   247           begin
   248           begin
   248 {$IFDEF DOWNSCALE}
   249            if (cReducedQuality and rqBlurryLand) = 0 then
   249           LandPixels[(y + dy) div 2, i div 2]:= cExplosionBorderColor;
   250             LandPixels[y + dy, i]:= cExplosionBorderColor
   250 {$ELSE}
   251           else
   251           LandPixels[y + dy, i]:= cExplosionBorderColor;
   252             LandPixels[(y + dy) div 2, i div 2]:= cExplosionBorderColor;
   252 {$ENDIF}
   253 
   253           Land[y + dy, i]:= Land[y + dy, i] or lfDamaged;
   254           Land[y + dy, i]:= Land[y + dy, i] or lfDamaged;
   254           Despeckle(i, y + dy);
   255           Despeckle(i, y + dy);
   255           LandDirty[(y + dy) div 32, i div 32]:= 1;
   256           LandDirty[(y + dy) div 32, i div 32]:= 1;
   256           end;
   257           end;
   257 if ((y - dy) and LAND_HEIGHT_MASK) = 0 then
   258 if ((y - dy) and LAND_HEIGHT_MASK) = 0 then
   258    for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do
   259    for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do
   259        if ((Land[y - dy, i] and lfBasic) <> 0) or ((Land[y - dy, i] and lfObject) <> 0) then
   260        if ((Land[y - dy, i] and lfBasic) <> 0) or ((Land[y - dy, i] and lfObject) <> 0) then
   260           begin
   261           begin
   261 {$IFDEF DOWNSCALE}
   262            if (cReducedQuality and rqBlurryLand) = 0 then
   262           LandPixels[(y - dy) div 2, i div 2]:= cExplosionBorderColor;
   263               LandPixels[y - dy, i]:= cExplosionBorderColor 
   263 {$ELSE}
   264             else
   264           LandPixels[y - dy, i]:= cExplosionBorderColor;
   265               LandPixels[(y - dy) div 2, i div 2]:= cExplosionBorderColor;
   265 {$ENDIF}
       
   266           Land[y - dy, i]:= Land[y - dy, i] or lfDamaged;
   266           Land[y - dy, i]:= Land[y - dy, i] or lfDamaged;
   267           Despeckle(i, y - dy);
   267           Despeckle(i, y - dy);
   268           LandDirty[(y - dy) div 32, i div 32]:= 1;
   268           LandDirty[(y - dy) div 32, i div 32]:= 1;
   269           end;
   269           end;
   270 if ((y + dx) and LAND_HEIGHT_MASK) = 0 then
   270 if ((y + dx) and LAND_HEIGHT_MASK) = 0 then
   271    for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do
   271    for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do
   272        if ((Land[y + dx, i] and lfBasic) <> 0) or ((Land[y + dx, i] and lfObject) <> 0) then
   272        if ((Land[y + dx, i] and lfBasic) <> 0) or ((Land[y + dx, i] and lfObject) <> 0) then
   273            begin
   273            begin
   274 {$IFDEF DOWNSCALE}
   274            if (cReducedQuality and rqBlurryLand) = 0 then
       
   275            LandPixels[y + dx, i]:= cExplosionBorderColor
       
   276             else
   275            LandPixels[(y + dx) div 2, i div 2]:= cExplosionBorderColor;
   277            LandPixels[(y + dx) div 2, i div 2]:= cExplosionBorderColor;
   276 {$ELSE}
   278 
   277            LandPixels[y + dx, i]:= cExplosionBorderColor;
       
   278 {$ENDIF}
       
   279            Land[y + dx, i]:= Land[y + dx, i] or lfDamaged;
   279            Land[y + dx, i]:= Land[y + dx, i] or lfDamaged;
   280            Despeckle(i, y + dx);
   280            Despeckle(i, y + dx);
   281            LandDirty[(y + dx) div 32, i div 32]:= 1;
   281            LandDirty[(y + dx) div 32, i div 32]:= 1;
   282            end;
   282            end;
   283 if ((y - dx) and LAND_HEIGHT_MASK) = 0 then
   283 if ((y - dx) and LAND_HEIGHT_MASK) = 0 then
   284    for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do
   284    for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do
   285        if ((Land[y - dx, i] and lfBasic) <> 0) or ((Land[y - dx, i] and lfObject) <> 0) then
   285        if ((Land[y - dx, i] and lfBasic) <> 0) or ((Land[y - dx, i] and lfObject) <> 0) then
   286           begin
   286           begin
   287 {$IFDEF DOWNSCALE}
   287            if (cReducedQuality and rqBlurryLand) = 0 then
       
   288           LandPixels[y - dx, i]:= cExplosionBorderColor 
       
   289             else
   288           LandPixels[(y - dx) div 2, i div 2]:= cExplosionBorderColor;
   290           LandPixels[(y - dx) div 2, i div 2]:= cExplosionBorderColor;
   289 {$ELSE}
   291 
   290           LandPixels[y - dx, i]:= cExplosionBorderColor;
       
   291 {$ENDIF}
       
   292           Land[y - dx, i]:= Land[y - dx, i] or lfDamaged;
   292           Land[y - dx, i]:= Land[y - dx, i] or lfDamaged;
   293           Despeckle(i, y - dy);
   293           Despeckle(i, y - dy);
   294           LandDirty[(y - dx) div 32, i div 32]:= 1;
   294           LandDirty[(y - dx) div 32, i div 32]:= 1;
   295           end;
   295           end;
   296 end;
   296 end;
   376 for i:= 0 to Pred(Count) do
   376 for i:= 0 to Pred(Count) do
   377     begin
   377     begin
   378     for ty:= max(y - Radius, 0) to min(y + Radius, LAND_HEIGHT) do
   378     for ty:= max(y - Radius, 0) to min(y + Radius, LAND_HEIGHT) do
   379         for tx:= max(0, ar^[i].Left - Radius) to min(LAND_WIDTH, ar^[i].Right + Radius) do
   379         for tx:= max(0, ar^[i].Left - Radius) to min(LAND_WIDTH, ar^[i].Right + Radius) do
   380             if (Land[ty, tx] and lfBasic) <> 0 then
   380             if (Land[ty, tx] and lfBasic) <> 0 then
   381 {$IFDEF DOWNSCALE}
   381                 if (cReducedQuality and rqBlurryLand) = 0 then
   382                 LandPixels[ty div 2, tx div 2]:= LandBackPixel(tx, ty)
   382                     LandPixels[ty, tx]:= LandBackPixel(tx, ty)
   383 {$ELSE}
   383                 else
   384                 LandPixels[ty, tx]:= LandBackPixel(tx, ty)
   384                     LandPixels[ty div 2, tx div 2]:= LandBackPixel(tx, ty)
   385 {$ENDIF}
   385             else 
   386             else if (Land[ty, tx] and lfObject) <> 0 then
   386                 if (Land[ty, tx] and lfObject) <> 0 then
   387 {$IFDEF DOWNSCALE}
   387                     if (cReducedQuality and rqBlurryLand) = 0 then
   388                 LandPixels[ty div 2, tx div 2]:= 0;
   388                         LandPixels[ty, tx]:= 0
   389 {$ELSE}
   389                     else
   390                 LandPixels[ty, tx]:= 0;
   390                         LandPixels[ty div 2, tx div 2]:= 0;
   391 {$ENDIF}
       
   392     inc(y, dY)
   391     inc(y, dY)
   393     end;
   392     end;
   394 
   393 
   395 inc(Radius, 4);
   394 inc(Radius, 4);
   396 dec(y, Count * dY);
   395 dec(y, Count * dY);
   399     begin
   398     begin
   400     for ty:= max(y - Radius, 0) to min(y + Radius, LAND_HEIGHT) do
   399     for ty:= max(y - Radius, 0) to min(y + Radius, LAND_HEIGHT) do
   401         for tx:= max(0, ar^[i].Left - Radius) to min(LAND_WIDTH, ar^[i].Right + Radius) do
   400         for tx:= max(0, ar^[i].Left - Radius) to min(LAND_WIDTH, ar^[i].Right + Radius) do
   402             if ((Land[ty, tx] and lfBasic) <> 0) or ((Land[ty, tx] and lfObject) <> 0) then
   401             if ((Land[ty, tx] and lfBasic) <> 0) or ((Land[ty, tx] and lfObject) <> 0) then
   403                 begin
   402                 begin
   404 {$IFDEF DOWNSCALE}
   403                     if (cReducedQuality and rqBlurryLand) = 0 then
   405                 LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor;
   404                         LandPixels[ty, tx]:= cExplosionBorderColor
   406 {$ELSE}
   405                     else
   407                 LandPixels[ty, tx]:= cExplosionBorderColor;
   406                         LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor;
   408 {$ENDIF}
   407 
   409                 Land[ty, tx]:= Land[ty, tx] or lfDamaged;
   408                 Land[ty, tx]:= Land[ty, tx] or lfDamaged;
   410                 LandDirty[(y + dy) shr 5, i shr 5]:= 1;
   409                 LandDirty[(y + dy) shr 5, i shr 5]:= 1;
   411                 end;
   410                 end;
   412     inc(y, dY)
   411     inc(y, dY)
   413     end;
   412     end;
   445        ((tx and LAND_WIDTH_MASK) = 0) and
   444        ((tx and LAND_WIDTH_MASK) = 0) and
   446        (((Land[ty, tx] and lfBasic) <> 0) or 
   445        (((Land[ty, tx] and lfBasic) <> 0) or 
   447        ((Land[ty, tx] and lfObject) <> 0)) then
   446        ((Land[ty, tx] and lfObject) <> 0)) then
   448         begin
   447         begin
   449         Land[ty, tx]:= Land[ty, tx] or lfDamaged;
   448         Land[ty, tx]:= Land[ty, tx] or lfDamaged;
   450 {$IFDEF DOWNSCALE}
   449             if (cReducedQuality and rqBlurryLand) = 0 then
   451         LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor
   450             LandPixels[ty, tx]:= cExplosionBorderColor
   452 {$ELSE}
   451             else
   453         LandPixels[ty, tx]:= cExplosionBorderColor
   452             LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor
   454 {$ENDIF}
       
   455         end
   453         end
   456     end;
   454     end;
   457     nx:= nx - dY;
   455     nx:= nx - dY;
   458     ny:= ny + dX;
   456     ny:= ny + dX;
   459     end;
   457     end;
   472        ((tx and LAND_WIDTH_MASK) = 0) and
   470        ((tx and LAND_WIDTH_MASK) = 0) and
   473        (((Land[ty, tx] and lfBasic) <> 0) or 
   471        (((Land[ty, tx] and lfBasic) <> 0) or 
   474        ((Land[ty, tx] and lfObject) <> 0)) then
   472        ((Land[ty, tx] and lfObject) <> 0)) then
   475         begin
   473         begin
   476         Land[ty, tx]:= Land[ty, tx] or lfDamaged;
   474         Land[ty, tx]:= Land[ty, tx] or lfDamaged;
   477 {$IFDEF DOWNSCALE}
   475             if (cReducedQuality and rqBlurryLand) = 0 then
       
   476         LandPixels[ty, tx]:= cExplosionBorderColor
       
   477             else
   478         LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor
   478         LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor
   479 {$ELSE}
   479 
   480         LandPixels[ty, tx]:= cExplosionBorderColor
       
   481 {$ENDIF}
       
   482         end
   480         end
   483     end;
   481     end;
   484     X:= nx;
   482     X:= nx;
   485     Y:= ny;
   483     Y:= ny;
   486     for t:= 0 to ticks do
   484     for t:= 0 to ticks do
   490         tx:= hwRound(X);
   488         tx:= hwRound(X);
   491         ty:= hwRound(Y);
   489         ty:= hwRound(Y);
   492         if ((ty and LAND_HEIGHT_MASK) = 0) and ((tx and LAND_WIDTH_MASK) = 0) and ((Land[ty, tx] and lfIndestructible) = 0) then
   490         if ((ty and LAND_HEIGHT_MASK) = 0) and ((tx and LAND_WIDTH_MASK) = 0) and ((Land[ty, tx] and lfIndestructible) = 0) then
   493             begin
   491             begin
   494             if (Land[ty, tx] and lfBasic) <> 0 then
   492             if (Land[ty, tx] and lfBasic) <> 0 then
   495 {$IFDEF DOWNSCALE}
   493                 if (cReducedQuality and rqBlurryLand) = 0 then
   496                 LandPixels[ty div 2, tx div 2]:= LandBackPixel(tx, ty)
   494                     LandPixels[ty, tx]:= LandBackPixel(tx, ty)
   497 {$ELSE}
   495                 else
   498                 LandPixels[ty, tx]:= LandBackPixel(tx, ty)
   496                     LandPixels[ty div 2, tx div 2]:= LandBackPixel(tx, ty)
   499 {$ENDIF}
   497             else 
   500             else if (Land[ty, tx] and lfObject) <> 0 then
   498               if (Land[ty, tx] and lfObject) <> 0 then
   501 {$IFDEF DOWNSCALE}
   499                 if (cReducedQuality and rqBlurryLand) = 0 then
       
   500                 LandPixels[ty, tx]:= 0
       
   501                 else
   502                 LandPixels[ty div 2, tx div 2]:= 0;
   502                 LandPixels[ty div 2, tx div 2]:= 0;
   503 {$ELSE}
   503 
   504                 LandPixels[ty, tx]:= 0;
       
   505 {$ENDIF}
       
   506             Land[ty, tx]:= 0;
   504             Land[ty, tx]:= 0;
   507             end
   505             end
   508         end;
   506         end;
   509     for t:= 0 to 7 do
   507     for t:= 0 to 7 do
   510     begin
   508     begin
   516        ((tx and LAND_WIDTH_MASK) = 0) and
   514        ((tx and LAND_WIDTH_MASK) = 0) and
   517        (((Land[ty, tx] and lfBasic) <> 0) or 
   515        (((Land[ty, tx] and lfBasic) <> 0) or 
   518        ((Land[ty, tx] and lfObject) <> 0)) then
   516        ((Land[ty, tx] and lfObject) <> 0)) then
   519         begin
   517         begin
   520         Land[ty, tx]:= Land[ty, tx] or lfDamaged;
   518         Land[ty, tx]:= Land[ty, tx] or lfDamaged;
   521 {$IFDEF DOWNSCALE}
   519         if (cReducedQuality and rqBlurryLand) = 0 then
       
   520         LandPixels[ty, tx]:= cExplosionBorderColor
       
   521         else
   522         LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor
   522         LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor
   523 {$ELSE}
   523 
   524         LandPixels[ty, tx]:= cExplosionBorderColor
       
   525 {$ENDIF}
       
   526         end
   524         end
   527     end;
   525     end;
   528     nx:= nx - dY;
   526     nx:= nx - dY;
   529     ny:= ny + dX;
   527     ny:= ny + dX;
   530     end;
   528     end;
   543        ((tx and LAND_WIDTH_MASK) = 0) and
   541        ((tx and LAND_WIDTH_MASK) = 0) and
   544        (((Land[ty, tx] and lfBasic) <> 0) or 
   542        (((Land[ty, tx] and lfBasic) <> 0) or 
   545        ((Land[ty, tx] and lfObject) <> 0)) then
   543        ((Land[ty, tx] and lfObject) <> 0)) then
   546         begin
   544         begin
   547         Land[ty, tx]:= Land[ty, tx] or lfDamaged;
   545         Land[ty, tx]:= Land[ty, tx] or lfDamaged;
   548 {$IFDEF DOWNSCALE}
   546         if (cReducedQuality and rqBlurryLand) = 0 then
       
   547         LandPixels[ty, tx]:= cExplosionBorderColor
       
   548         else
   549         LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor
   549         LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor
   550 {$ELSE}
       
   551         LandPixels[ty, tx]:= cExplosionBorderColor
       
   552 {$ENDIF}
       
   553         end
   550         end
   554     end;
   551     end;
   555     nx:= nx - dY;
   552     nx:= nx - dY;
   556     ny:= ny + dX;
   553     ny:= ny + dX;
   557     end;
   554     end;
   619             begin
   616             begin
   620             for x:= 0 to Pred(w) do
   617             for x:= 0 to Pred(w) do
   621                 if PLongword(@(p^[x * 4]))^ <> 0 then
   618                 if PLongword(@(p^[x * 4]))^ <> 0 then
   622                    begin
   619                    begin
   623                    Land[cpY + y, cpX + x]:= lfObject;
   620                    Land[cpY + y, cpX + x]:= lfObject;
   624 {$IFDEF DOWNSCALE}
   621                     if (cReducedQuality and rqBlurryLand) = 0 then
       
   622                    LandPixels[cpY + y, cpX + x]:= PLongword(@(p^[x * 4]))^
       
   623                     else
   625                    LandPixels[(cpY + y) div 2, (cpX + x) div 2]:= PLongword(@(p^[x * 4]))^
   624                    LandPixels[(cpY + y) div 2, (cpX + x) div 2]:= PLongword(@(p^[x * 4]))^
   626 {$ELSE}
       
   627                    LandPixels[cpY + y, cpX + x]:= PLongword(@(p^[x * 4]))^
       
   628 {$ENDIF}
       
   629                    end;
   625                    end;
   630             p:= @(p^[Image^.pitch]);
   626             p:= @(p^[Image^.pitch]);
   631             end;
   627             end;
   632      end;
   628      end;
   633 if SDL_MustLock(Image) then
   629 if SDL_MustLock(Image) then
   658                         inc(c);
   654                         inc(c);
   659                 end;
   655                 end;
   660 
   656 
   661     if c < 4 then // 0-3 neighbours
   657     if c < 4 then // 0-3 neighbours
   662         begin
   658         begin
   663 {$IFDEF DOWNSCALE}
   659         if (cReducedQuality and rqBlurryLand) = 0 then
   664         if (Land[Y, X] and lfBasic) <> 0 then LandPixels[Y div 2, X div 2]:= LandBackPixel(X, Y) else LandPixels[Y div 2, X div 2]:= 0;
   660             if (Land[Y, X] and lfBasic) <> 0 then 
   665 {$ELSE}
   661                 LandPixels[Y, X]:= LandBackPixel(X, Y) 
   666         if (Land[Y, X] and lfBasic) <> 0 then LandPixels[Y, X]:= LandBackPixel(X, Y) else LandPixels[Y, X]:= 0;
   662             else
   667 {$ENDIF}
   663                 LandPixels[Y, X]:= 0
       
   664         else
       
   665             if (Land[Y, X] and lfBasic) <> 0 then 
       
   666                 LandPixels[Y div 2, X div 2]:= LandBackPixel(X, Y) 
       
   667             else
       
   668                 LandPixels[Y div 2, X div 2]:= 0;
       
   669 
   668         Land[Y, X]:= 0;
   670         Land[Y, X]:= 0;
   669         exit(true);
   671         exit(true);
   670         end;
   672         end;
   671     end;
   673     end;
   672 Despeckle:= false
   674 Despeckle:= false