hedgewars/uLandGraphics.pas
changeset 4635 62d0873459e5
parent 4634 784e2df9e79a
child 4640 bc30434ae156
equal deleted inserted replaced
4634:784e2df9e79a 4635:62d0873459e5
   196            if (cReducedQuality and rqBlurryLand) = 0 then
   196            if (cReducedQuality and rqBlurryLand) = 0 then
   197                LandPixels[t, i]:= LandBackPixel(i, t)
   197                LandPixels[t, i]:= LandBackPixel(i, t)
   198            else
   198            else
   199                LandPixels[t div 2, i div 2]:= LandBackPixel(i, t)
   199                LandPixels[t div 2, i div 2]:= LandBackPixel(i, t)
   200            end
   200            end
   201        else if (cReducedQuality and rqBlurryLand) = 0 then
   201        else if not isMap then
   202                    LandPixels[t, i]:= 0
   202            begin
   203                else
   203            if (cReducedQuality and rqBlurryLand) = 0 then
   204                    LandPixels[t div 2, i div 2]:= 0;
   204                LandPixels[t, i]:= 0
       
   205            else
       
   206                LandPixels[t div 2, i div 2]:= 0
       
   207            end;
   205 
   208 
   206 t:= y - dy;
   209 t:= y - dy;
   207 if (t and LAND_HEIGHT_MASK) = 0 then
   210 if (t and LAND_HEIGHT_MASK) = 0 then
   208    for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do
   211    for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do
   209        if ((Land[t, i] and lfBasic) <> 0) then
   212        if ((Land[t, i] and lfBasic) <> 0) then
   212            if (cReducedQuality and rqBlurryLand) = 0 then
   215            if (cReducedQuality and rqBlurryLand) = 0 then
   213                LandPixels[t, i]:= LandBackPixel(i, t)
   216                LandPixels[t, i]:= LandBackPixel(i, t)
   214            else
   217            else
   215                LandPixels[t div 2, i div 2]:= LandBackPixel(i, t)
   218                LandPixels[t div 2, i div 2]:= LandBackPixel(i, t)
   216            end
   219            end
   217        else if (cReducedQuality and rqBlurryLand) = 0 then
   220        else if not isMap then
   218                    LandPixels[t, i]:= 0
   221            begin
   219                else
   222            if (cReducedQuality and rqBlurryLand) = 0 then
   220                    LandPixels[t div 2, i div 2]:= 0;
   223                LandPixels[t, i]:= 0
       
   224            else
       
   225                LandPixels[t div 2, i div 2]:= 0
       
   226            end;
   221 
   227 
   222 t:= y + dx;
   228 t:= y + dx;
   223 if (t and LAND_HEIGHT_MASK) = 0 then
   229 if (t and LAND_HEIGHT_MASK) = 0 then
   224    for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do
   230    for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do
   225        if ((Land[t, i] and lfBasic) <> 0) then
   231        if ((Land[t, i] and lfBasic) <> 0) then
   226            begin
   232            begin
   227            inc(cnt);
   233            inc(cnt);
   228            if (cReducedQuality and rqBlurryLand) = 0 then
   234            if (cReducedQuality and rqBlurryLand) = 0 then
   229            LandPixels[t, i]:= LandBackPixel(i, t)
   235                LandPixels[t, i]:= LandBackPixel(i, t)
   230             else
   236            else
   231            LandPixels[t div 2, i div 2]:= LandBackPixel(i, t)
   237                LandPixels[t div 2, i div 2]:= LandBackPixel(i, t)
   232            end
   238            end
   233        else if (cReducedQuality and rqBlurryLand) = 0 then
   239        else if not isMap then
       
   240             begin
       
   241             if (cReducedQuality and rqBlurryLand) = 0 then
   234           	LandPixels[t, i]:= 0
   242           	LandPixels[t, i]:= 0
   235             else
   243             else
   236            	LandPixels[t div 2, i div 2]:= 0;
   244            	LandPixels[t div 2, i div 2]:= 0
       
   245             end;
   237 
   246 
   238 t:= y - dx;
   247 t:= y - dx;
   239 if (t and LAND_HEIGHT_MASK) = 0 then
   248 if (t and LAND_HEIGHT_MASK) = 0 then
   240    for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do
   249    for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do
   241        if ((Land[t, i] and lfBasic) <> 0) then
   250        if ((Land[t, i] and lfBasic) <> 0) then
   244            if (cReducedQuality and rqBlurryLand) = 0 then
   253            if (cReducedQuality and rqBlurryLand) = 0 then
   245                LandPixels[t, i]:= LandBackPixel(i, t)
   254                LandPixels[t, i]:= LandBackPixel(i, t)
   246            else
   255            else
   247                LandPixels[t div 2, i div 2]:= LandBackPixel(i, t)
   256                LandPixels[t div 2, i div 2]:= LandBackPixel(i, t)
   248            end
   257            end
   249        else if (cReducedQuality and rqBlurryLand) = 0 then
   258        else if not isMap then
   250                 LandPixels[t, i]:= 0
   259            begin
   251               else
   260            if (cReducedQuality and rqBlurryLand) = 0 then
   252                 LandPixels[t div 2, i div 2]:= 0;
   261                LandPixels[t, i]:= 0
       
   262            else
       
   263                LandPixels[t div 2, i div 2]:= 0
       
   264            end;
   253 FillLandCircleLinesBG:= cnt;
   265 FillLandCircleLinesBG:= cnt;
   254 end;
   266 end;
   255 
   267 
   256 procedure FillLandCircleLinesEBC(x, y, dx, dy: LongInt);
   268 procedure FillLandCircleLinesEBC(x, y, dx, dy: LongInt);
   257 var i, t: LongInt;
   269 var i, t: LongInt;
   404             if (Land[ty, tx] and lfBasic) <> 0 then
   416             if (Land[ty, tx] and lfBasic) <> 0 then
   405                 if (cReducedQuality and rqBlurryLand) = 0 then
   417                 if (cReducedQuality and rqBlurryLand) = 0 then
   406                     LandPixels[ty, tx]:= LandBackPixel(tx, ty)
   418                     LandPixels[ty, tx]:= LandBackPixel(tx, ty)
   407                 else
   419                 else
   408                     LandPixels[ty div 2, tx div 2]:= LandBackPixel(tx, ty)
   420                     LandPixels[ty div 2, tx div 2]:= LandBackPixel(tx, ty)
   409             else
   421             else if not isMap then
   410                 if (Land[ty, tx] and lfObject) <> 0 then
   422                 begin
   411                     if (cReducedQuality and rqBlurryLand) = 0 then
   423 	        if (cReducedQuality and rqBlurryLand) = 0 then
   412                         LandPixels[ty, tx]:= 0
   424 	     	    LandPixels[ty, tx]:= 0
   413                     else
   425 	        else
   414                         LandPixels[ty div 2, tx div 2]:= 0;
   426 		    LandPixels[ty div 2, tx div 2]:= 0
       
   427                 end;
   415     inc(y, dY)
   428     inc(y, dY)
   416     end;
   429     end;
   417 
   430 
   418 inc(Radius, 4);
   431 inc(Radius, 4);
   419 dec(y, Count * dY);
   432 dec(y, Count * dY);
   464     Y:= Y + dY;
   477     Y:= Y + dY;
   465     tx:= hwRound(X);
   478     tx:= hwRound(X);
   466     ty:= hwRound(Y);
   479     ty:= hwRound(Y);
   467     if ((ty and LAND_HEIGHT_MASK) = 0) and
   480     if ((ty and LAND_HEIGHT_MASK) = 0) and
   468        ((tx and LAND_WIDTH_MASK) = 0) and
   481        ((tx and LAND_WIDTH_MASK) = 0) and
   469        (((Land[ty, tx] and lfBasic) <> 0) or
   482        ((Land[ty, tx] and (lfBasic or lfObject)) <> 0) then
   470        ((Land[ty, tx] and lfObject) <> 0)) then
       
   471         begin
   483         begin
   472         Land[ty, tx]:= Land[ty, tx] or lfDamaged;
   484         Land[ty, tx]:= Land[ty, tx] or lfDamaged;
   473             if (cReducedQuality and rqBlurryLand) = 0 then
   485         if (cReducedQuality and rqBlurryLand) = 0 then
   474             LandPixels[ty, tx]:= cExplosionBorderColor
   486             LandPixels[ty, tx]:= cExplosionBorderColor
   475             else
   487         else
   476             LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor
   488             LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor
   477         end
   489         end
   478     end;
   490     end;
   479     nx:= nx - dY;
   491     nx:= nx - dY;
   480     ny:= ny + dX;
   492     ny:= ny + dX;
   490     Y:= Y + dY;
   502     Y:= Y + dY;
   491     tx:= hwRound(X);
   503     tx:= hwRound(X);
   492     ty:= hwRound(Y);
   504     ty:= hwRound(Y);
   493     if ((ty and LAND_HEIGHT_MASK) = 0) and
   505     if ((ty and LAND_HEIGHT_MASK) = 0) and
   494        ((tx and LAND_WIDTH_MASK) = 0) and
   506        ((tx and LAND_WIDTH_MASK) = 0) and
   495        (((Land[ty, tx] and lfBasic) <> 0) or
   507        ((Land[ty, tx] and (lfBasic or lfObject)) <> 0) then
   496        ((Land[ty, tx] and lfObject) <> 0)) then
       
   497         begin
   508         begin
   498         Land[ty, tx]:= Land[ty, tx] or lfDamaged;
   509         Land[ty, tx]:= Land[ty, tx] or lfDamaged;
   499             if (cReducedQuality and rqBlurryLand) = 0 then
   510         if (cReducedQuality and rqBlurryLand) = 0 then
   500         LandPixels[ty, tx]:= cExplosionBorderColor
   511 	    LandPixels[ty, tx]:= cExplosionBorderColor
   501             else
   512 	else
   502         LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor
   513             LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor
   503 
   514 
   504         end
   515         end
   505     end;
   516     end;
   506     X:= nx;
   517     X:= nx;
   507     Y:= ny;
   518     Y:= ny;
   516             if (Land[ty, tx] and lfBasic) <> 0 then
   527             if (Land[ty, tx] and lfBasic) <> 0 then
   517                 if (cReducedQuality and rqBlurryLand) = 0 then
   528                 if (cReducedQuality and rqBlurryLand) = 0 then
   518                     LandPixels[ty, tx]:= LandBackPixel(tx, ty)
   529                     LandPixels[ty, tx]:= LandBackPixel(tx, ty)
   519                 else
   530                 else
   520                     LandPixels[ty div 2, tx div 2]:= LandBackPixel(tx, ty)
   531                     LandPixels[ty div 2, tx div 2]:= LandBackPixel(tx, ty)
   521             else
   532             else if not isMap then
   522               if (Land[ty, tx] and lfObject) <> 0 then
   533                 begin
   523                 if (cReducedQuality and rqBlurryLand) = 0 then
   534 		if (cReducedQuality and rqBlurryLand) = 0 then
   524                 LandPixels[ty, tx]:= 0
   535                      LandPixels[ty, tx]:= 0
   525                 else
   536                 else
   526                 LandPixels[ty div 2, tx div 2]:= 0;
   537                      LandPixels[ty div 2, tx div 2]:= 0
       
   538                 end;
   527 
   539 
   528             Land[ty, tx]:= 0;
   540             Land[ty, tx]:= 0;
   529             end
   541             end
   530         end;
   542         end;
   531     for t:= 0 to 7 do
   543     for t:= 0 to 7 do
   534     Y:= Y + dY;
   546     Y:= Y + dY;
   535     tx:= hwRound(X);
   547     tx:= hwRound(X);
   536     ty:= hwRound(Y);
   548     ty:= hwRound(Y);
   537     if ((ty and LAND_HEIGHT_MASK) = 0) and
   549     if ((ty and LAND_HEIGHT_MASK) = 0) and
   538        ((tx and LAND_WIDTH_MASK) = 0) and
   550        ((tx and LAND_WIDTH_MASK) = 0) and
   539        (((Land[ty, tx] and lfBasic) <> 0) or
   551        ((Land[ty, tx] and (lfBasic or lfObject)) <> 0) then
   540        ((Land[ty, tx] and lfObject) <> 0)) then
       
   541         begin
   552         begin
   542         Land[ty, tx]:= Land[ty, tx] or lfDamaged;
   553         Land[ty, tx]:= Land[ty, tx] or lfDamaged;
   543         if (cReducedQuality and rqBlurryLand) = 0 then
   554         if (cReducedQuality and rqBlurryLand) = 0 then
   544         LandPixels[ty, tx]:= cExplosionBorderColor
   555             LandPixels[ty, tx]:= cExplosionBorderColor
   545         else
   556         else
   546         LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor
   557             LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor
   547 
       
   548         end
   558         end
   549     end;
   559     end;
   550     nx:= nx - dY;
   560     nx:= nx - dY;
   551     ny:= ny + dX;
   561     ny:= ny + dX;
   552     end;
   562     end;
   561     Y:= Y + dY;
   571     Y:= Y + dY;
   562     tx:= hwRound(X);
   572     tx:= hwRound(X);
   563     ty:= hwRound(Y);
   573     ty:= hwRound(Y);
   564     if ((ty and LAND_HEIGHT_MASK) = 0) and
   574     if ((ty and LAND_HEIGHT_MASK) = 0) and
   565        ((tx and LAND_WIDTH_MASK) = 0) and
   575        ((tx and LAND_WIDTH_MASK) = 0) and
   566        (((Land[ty, tx] and lfBasic) <> 0) or
   576        ((Land[ty, tx] and (lfBasic or lfObject)) <> 0) then
   567        ((Land[ty, tx] and lfObject) <> 0)) then
       
   568         begin
   577         begin
   569         Land[ty, tx]:= Land[ty, tx] or lfDamaged;
   578         Land[ty, tx]:= Land[ty, tx] or lfDamaged;
   570         if (cReducedQuality and rqBlurryLand) = 0 then
   579         if (cReducedQuality and rqBlurryLand) = 0 then
   571         LandPixels[ty, tx]:= cExplosionBorderColor
   580             LandPixels[ty, tx]:= cExplosionBorderColor
   572         else
   581         else
   573         LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor
   582             LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor
   574         end
   583         end
   575     end;
   584     end;
   576     nx:= nx - dY;
   585     nx:= nx - dY;
   577     ny:= ny + dX;
   586     ny:= ny + dX;
   578     end;
   587     end;
   679                 end;
   688                 end;
   680 
   689 
   681     if c < 4 then // 0-3 neighbours
   690     if c < 4 then // 0-3 neighbours
   682         begin
   691         begin
   683         if (cReducedQuality and rqBlurryLand) = 0 then
   692         if (cReducedQuality and rqBlurryLand) = 0 then
       
   693             begin
   684             if (Land[Y, X] and lfBasic) <> 0 then
   694             if (Land[Y, X] and lfBasic) <> 0 then
   685                 LandPixels[Y, X]:= LandBackPixel(X, Y)
   695                 LandPixels[Y, X]:= LandBackPixel(X, Y)
   686             else
   696             else if not isMap then
   687                 LandPixels[Y, X]:= 0
   697                 LandPixels[Y, X]:= 0
       
   698             end
   688         else
   699         else
   689             if (Land[Y, X] and lfBasic) <> 0 then
   700             if (Land[Y, X] and lfBasic) <> 0 then
   690                 LandPixels[Y div 2, X div 2]:= LandBackPixel(X, Y)
   701                 LandPixels[Y div 2, X div 2]:= LandBackPixel(X, Y)
   691             else
   702             else if not isMap then
   692                 LandPixels[Y div 2, X div 2]:= 0;
   703                 LandPixels[Y div 2, X div 2]:= 0;
   693 
   704 
   694         Land[Y, X]:= 0;
   705         Land[Y, X]:= 0;
   695         exit(true);
   706         exit(true);
   696         end;
   707         end;