hedgewars/uLandGraphics.pas
changeset 6453 11c578d30bd3
parent 6355 734fed7aefd3
child 6490 531bf083e8db
equal deleted inserted replaced
6452:7c6f9b6672dc 6453:11c578d30bd3
   296                end
   296                end
   297            else
   297            else
   298                begin
   298                begin
   299                by:= t div 2; bx:= i div 2;
   299                by:= t div 2; bx:= i div 2;
   300                end;
   300                end;
   301            if ((Land[t, i] and lfBasic) <> 0) and (((LandPixels[by,bx] and AMask) shr AShift) = 255) and not (disableLandBack) then
   301            if ((Land[t, i] and lfBasic) <> 0) and (((LandPixels[by,bx] and AMask) shr AShift) = 255) and (not disableLandBack) then
   302                begin
   302                begin
   303                inc(cnt);
   303                inc(cnt);
   304                LandPixels[by, bx]:= LandBackPixel(i, t)
   304                LandPixels[by, bx]:= LandBackPixel(i, t)
   305                end
   305                end
   306            else if ((Land[t, i] and lfObject) <> 0) or (((LandPixels[by,bx] and AMask) shr AShift) < 255) then 
   306            else if ((Land[t, i] and lfObject) <> 0) or (((LandPixels[by,bx] and AMask) shr AShift) < 255) then 
   674 p:= @(PByteArray(Image^.pixels)^[ Image^.pitch * row * h + col * w * 4 ]);
   674 p:= @(PByteArray(Image^.pixels)^[ Image^.pitch * row * h + col * w * 4 ]);
   675 case bpp of
   675 case bpp of
   676      4: for y:= 0 to Pred(h) do
   676      4: for y:= 0 to Pred(h) do
   677             begin
   677             begin
   678             for x:= 0 to Pred(w) do
   678             for x:= 0 to Pred(w) do
   679                 if PLongword(@(p^[x * 4]))^ <> 0 then
   679                 if (PLongword(@(p^[x * 4]))^) <> 0 then
   680                    if ((cpY + y) <= Longint(topY)) or
   680                    if ((cpY + y) <= Longint(topY)) or
   681                       ((cpY + y) >= LAND_HEIGHT) or
   681                       ((cpY + y) >= LAND_HEIGHT) or
   682                       ((cpX + x) <= Longint(leftX)) or
   682                       ((cpX + x) <= Longint(leftX)) or
   683                       ((cpX + x) >= Longint(rightX)) or
   683                       ((cpX + x) >= Longint(rightX)) or
   684                       (Land[cpY + y, cpX + x] <> 0) then
   684                       (Land[cpY + y, cpX + x] <> 0) then
   703 p:= @(PByteArray(Image^.pixels)^[ Image^.pitch * row * h + col * w * 4 ]);
   703 p:= @(PByteArray(Image^.pixels)^[ Image^.pitch * row * h + col * w * 4 ]);
   704 case bpp of
   704 case bpp of
   705      4: for y:= 0 to Pred(h) do
   705      4: for y:= 0 to Pred(h) do
   706             begin
   706             begin
   707             for x:= 0 to Pred(w) do
   707             for x:= 0 to Pred(w) do
   708                 if PLongword(@(p^[x * 4]))^ <> 0 then
   708                 if (PLongword(@(p^[x * 4]))^) <> 0 then
   709                    begin
   709                    begin
   710                    if (cReducedQuality and rqBlurryLand) = 0 then
   710                    if (cReducedQuality and rqBlurryLand) = 0 then
   711                        begin
   711                        begin
   712                        gX:= cpX + x;
   712                        gX:= cpX + x;
   713                        gY:= cpY + y;
   713                        gY:= cpY + y;
   779                     end
   779                     end
   780                 end;
   780                 end;
   781 
   781 
   782     if c < 4 then // 0-3 neighbours
   782     if c < 4 then // 0-3 neighbours
   783         begin
   783         begin
   784         if ((Land[Y, X] and lfBasic) <> 0) and not disableLandBack then
   784         if ((Land[Y, X] and lfBasic) <> 0) and (not disableLandBack) then
   785             LandPixels[yy, xx]:= LandBackPixel(X, Y)
   785             LandPixels[yy, xx]:= LandBackPixel(X, Y)
   786         else
   786         else
   787             LandPixels[yy, xx]:= 0;
   787             LandPixels[yy, xx]:= 0;
   788 
   788 
   789         Land[Y, X]:= 0;
   789         Land[Y, X]:= 0;
   802     if ((((Land[y, x-1] and lfDamaged) <> 0) and (((Land[y+1,x] and lfDamaged) <> 0)) or ((Land[y-1,x] and lfDamaged) <> 0)) or
   802     if ((((Land[y, x-1] and lfDamaged) <> 0) and (((Land[y+1,x] and lfDamaged) <> 0)) or ((Land[y-1,x] and lfDamaged) <> 0)) or
   803        (((Land[y, x+1] and lfDamaged) <> 0) and (((Land[y-1,x] and lfDamaged) <> 0) or ((Land[y+1,x] and lfDamaged) <> 0)))) then
   803        (((Land[y, x+1] and lfDamaged) <> 0) and (((Land[y-1,x] and lfDamaged) <> 0) or ((Land[y+1,x] and lfDamaged) <> 0)))) then
   804         begin
   804         begin
   805         if (cReducedQuality and rqBlurryLand) = 0 then
   805         if (cReducedQuality and rqBlurryLand) = 0 then
   806             begin
   806             begin
   807             if ((LandPixels[y,x] and AMask) shr AShift) < 10 then LandPixels[y,x]:= (cExplosionBorderColor and not AMask) or (128 shl AShift)
   807             if ((LandPixels[y,x] and AMask) shr AShift) < 10 then LandPixels[y,x]:= (cExplosionBorderColor and (not AMask)) or (128 shl AShift)
   808             else
   808             else
   809                 LandPixels[y,x]:=
   809                 LandPixels[y,x]:=
   810                                 (((((LandPixels[y,x] and RMask shr RShift) div 2)+((cExplosionBorderColor and RMask) shr RShift) div 2) and $FF) shl RShift) or
   810                                 (((((LandPixels[y,x] and RMask shr RShift) div 2)+((cExplosionBorderColor and RMask) shr RShift) div 2) and $FF) shl RShift) or
   811                                 (((((LandPixels[y,x] and GMask shr GShift) div 2)+((cExplosionBorderColor and GMask) shr GShift) div 2) and $FF) shl GShift) or
   811                                 (((((LandPixels[y,x] and GMask shr GShift) div 2)+((cExplosionBorderColor and GMask) shr GShift) div 2) and $FF) shl GShift) or
   812                                 (((((LandPixels[y,x] and BMask shr BShift) div 2)+((cExplosionBorderColor and BMask) shr BShift) div 2) and $FF) shl BShift) or ($FF shl AShift)
   812                                 (((((LandPixels[y,x] and BMask shr BShift) div 2)+((cExplosionBorderColor and BMask) shr BShift) div 2) and $FF) shl BShift) or ($FF shl AShift)
   824             (((Land[y+1, x] and lfDamaged) <> 0) and ((Land[y+1,x-1] and lfDamaged) <> 0) and ((Land[y,x-2] and lfDamaged) <> 0)) or
   824             (((Land[y+1, x] and lfDamaged) <> 0) and ((Land[y+1,x-1] and lfDamaged) <> 0) and ((Land[y,x-2] and lfDamaged) <> 0)) or
   825             (((Land[y-1, x] and lfDamaged) <> 0) and ((Land[y-1,x-1] and lfDamaged) <> 0) and ((Land[y,x-2] and lfDamaged) <> 0))) then
   825             (((Land[y-1, x] and lfDamaged) <> 0) and ((Land[y-1,x-1] and lfDamaged) <> 0) and ((Land[y,x-2] and lfDamaged) <> 0))) then
   826         begin
   826         begin
   827         if (cReducedQuality and rqBlurryLand) = 0 then
   827         if (cReducedQuality and rqBlurryLand) = 0 then
   828             begin
   828             begin
   829             if ((LandPixels[y,x] and AMask) shr AShift) < 10 then LandPixels[y,x]:= (cExplosionBorderColor and not AMask) or (64 shl AShift)
   829             if ((LandPixels[y,x] and AMask) shr AShift) < 10 then LandPixels[y,x]:= (cExplosionBorderColor and (not AMask)) or (64 shl AShift)
   830             else
   830             else
   831                 LandPixels[y,x]:=
   831                 LandPixels[y,x]:=
   832                                 (((((LandPixels[y,x] and RMask shr RShift) * 3 div 4)+((cExplosionBorderColor and RMask) shr RShift) div 4) and $FF) shl RShift) or
   832                                 (((((LandPixels[y,x] and RMask shr RShift) * 3 div 4)+((cExplosionBorderColor and RMask) shr RShift) div 4) and $FF) shl RShift) or
   833                                 (((((LandPixels[y,x] and GMask shr GShift) * 3 div 4)+((cExplosionBorderColor and GMask) shr GShift) div 4) and $FF) shl GShift) or
   833                                 (((((LandPixels[y,x] and GMask shr GShift) * 3 div 4)+((cExplosionBorderColor and GMask) shr GShift) div 4) and $FF) shl GShift) or
   834                                 (((((LandPixels[y,x] and BMask shr BShift) * 3 div 4)+((cExplosionBorderColor and BMask) shr BShift) div 4) and $FF) shl BShift) or ($FF shl AShift)
   834                                 (((((LandPixels[y,x] and BMask shr BShift) * 3 div 4)+((cExplosionBorderColor and BMask) shr BShift) div 4) and $FF) shl BShift) or ($FF shl AShift)