85 procedure drawPixelEBC(landX, landY, pixelX, pixelY: Longint); inline; |
85 procedure drawPixelEBC(landX, landY, pixelX, pixelY: Longint); inline; |
86 begin |
86 begin |
87 if ((Land[landY, landX] and lfBasic) <> 0) or ((Land[landY, landX] and lfObject) <> 0) then |
87 if ((Land[landY, landX] and lfBasic) <> 0) or ((Land[landY, landX] and lfObject) <> 0) then |
88 begin |
88 begin |
89 LandPixels[pixelY, pixelX]:= ExplosionBorderColor; |
89 LandPixels[pixelY, pixelX]:= ExplosionBorderColor; |
90 Land[landY, landX]:= (Land[landY, landX] or lfDamaged) and not lfIce; |
90 Land[landY, landX]:= (Land[landY, landX] or lfDamaged) and (not lfIce); |
91 LandDirty[landY div 32, landX div 32]:= 1; |
91 LandDirty[landY div 32, landX div 32]:= 1; |
92 end; |
92 end; |
93 end; |
93 end; |
94 |
94 |
95 function isLandscapeEdge(weight:Longint):boolean; inline; |
95 function isLandscapeEdge(weight:Longint):boolean; inline; |
140 LandPixels[pixelY, pixelX]:= addBgColor(w, IceColor); |
140 LandPixels[pixelY, pixelX]:= addBgColor(w, IceColor); |
141 LandPixels[pixelY, pixelX]:= addBgColor(LandPixels[pixelY, pixelX], icePixels^[iceSurface^.w * (pixelY mod iceSurface^.h) + (pixelX mod iceSurface^.w)]) |
141 LandPixels[pixelY, pixelX]:= addBgColor(LandPixels[pixelY, pixelX], icePixels^[iceSurface^.w * (pixelY mod iceSurface^.h) + (pixelX mod iceSurface^.w)]) |
142 end |
142 end |
143 else |
143 else |
144 begin |
144 begin |
145 LandPixels[pixelY, pixelX]:= IceColor and not AMask or $E8 shl AShift; |
145 LandPixels[pixelY, pixelX]:= IceColor and (not AMask) or $E8 shl AShift; |
146 LandPixels[pixelY, pixelX]:= addBgColor(LandPixels[pixelY, pixelX], icePixels^[iceSurface^.w * (pixelY mod iceSurface^.h) + (pixelX mod iceSurface^.w)]); |
146 LandPixels[pixelY, pixelX]:= addBgColor(LandPixels[pixelY, pixelX], icePixels^[iceSurface^.w * (pixelY mod iceSurface^.h) + (pixelX mod iceSurface^.w)]); |
147 // silly workaround to avoid having to make background erasure a tadb it smarter about sea ice |
147 // silly workaround to avoid having to make background erasure a tadb it smarter about sea ice |
148 if LandPixels[pixelY, pixelX] and AMask shr AShift = 255 then |
148 if LandPixels[pixelY, pixelX] and AMask shr AShift = 255 then |
149 LandPixels[pixelY, pixelX]:= LandPixels[pixelY, pixelX] and not AMask or 254 shl AShift; |
149 LandPixels[pixelY, pixelX]:= LandPixels[pixelY, pixelX] and (not AMask) or 254 shl AShift; |
150 end; |
150 end; |
151 end; |
151 end; |
152 |
152 |
153 |
153 |
154 procedure DrawPixelIce(landX, landY, pixelX, pixelY: Longint); inline; |
154 procedure DrawPixelIce(landX, landY, pixelX, pixelY: Longint); inline; |
155 begin |
155 begin |
156 if ((Land[landY, landX] and lfIce) <> 0) then exit; |
156 if ((Land[landY, landX] and lfIce) <> 0) then exit; |
157 if isLandscapeEdge(getPixelWeight(landX, landY)) then |
157 if isLandscapeEdge(getPixelWeight(landX, landY)) then |
158 begin |
158 begin |
159 if (LandPixels[pixelY, pixelX] and AMask < 255) and (LandPixels[pixelY, pixelX] and AMask > 0) then |
159 if (LandPixels[pixelY, pixelX] and AMask < 255) and (LandPixels[pixelY, pixelX] and AMask > 0) then |
160 LandPixels[pixelY, pixelX] := (IceEdgeColor and not AMask) or (LandPixels[pixelY, pixelX] and AMask) |
160 LandPixels[pixelY, pixelX] := (IceEdgeColor and (not AMask)) or (LandPixels[pixelY, pixelX] and AMask) |
161 else if (LandPixels[pixelY, pixelX] and AMask < 255) or (Land[landY, landX] > 255) then |
161 else if (LandPixels[pixelY, pixelX] and AMask < 255) or (Land[landY, landX] > 255) then |
162 LandPixels[pixelY, pixelX] := IceEdgeColor |
162 LandPixels[pixelY, pixelX] := IceEdgeColor |
163 end |
163 end |
164 else if Land[landY, landX] > 255 then |
164 else if Land[landY, landX] > 255 then |
165 begin |
165 begin |
166 fillPixelFromIceSprite(pixelX, pixelY); |
166 fillPixelFromIceSprite(pixelX, pixelY); |
167 end; |
167 end; |
168 if Land[landY, landX] > 255 then Land[landY, landX] := Land[landY, landX] or lfIce and not lfDamaged; |
168 if Land[landY, landX] > 255 then Land[landY, landX] := Land[landY, landX] or lfIce and (not lfDamaged); |
169 end; |
169 end; |
170 |
170 |
171 |
171 |
172 function FillLandCircleLine(y, fromPix, toPix: LongInt; fill : fillType): Longword; |
172 function FillLandCircleLine(y, fromPix, toPix: LongInt; fill : fillType): Longword; |
173 var px, py, i: LongInt; |
173 var px, py, i: LongInt; |
340 |
340 |
341 procedure ChangeRoundInLand(X, Y, Radius: LongInt; doSet, isCurrent: boolean); |
341 procedure ChangeRoundInLand(X, Y, Radius: LongInt; doSet, isCurrent: boolean); |
342 begin |
342 begin |
343 if not doSet and isCurrent then |
343 if not doSet and isCurrent then |
344 FillRoundInLand(X, Y, Radius, setNotCurrentMask) |
344 FillRoundInLand(X, Y, Radius, setNotCurrentMask) |
345 else if not doSet and not IsCurrent then |
345 else if not doSet and (not IsCurrent) then |
346 FillRoundInLand(X, Y, Radius, changePixelSetNotCurrent) |
346 FillRoundInLand(X, Y, Radius, changePixelSetNotCurrent) |
347 else if doSet and IsCurrent then |
347 else if doSet and IsCurrent then |
348 FillRoundInLand(X, Y, Radius, setCurrentHog) |
348 FillRoundInLand(X, Y, Radius, setCurrentHog) |
349 else if doSet and not IsCurrent then |
349 else if doSet and (not IsCurrent) then |
350 FillRoundInLand(X, Y, Radius, changePixelNotSetNotCurrent); |
350 FillRoundInLand(X, Y, Radius, changePixelNotSetNotCurrent); |
351 end; |
351 end; |
352 |
352 |
353 procedure DrawIceBreak(x, y, iceRadius, iceHeight: Longint); |
353 procedure DrawIceBreak(x, y, iceRadius, iceHeight: Longint); |
354 var |
354 var |
453 tx:= hwRound(X); |
453 tx:= hwRound(X); |
454 ty:= hwRound(Y); |
454 ty:= hwRound(Y); |
455 if ((ty and LAND_HEIGHT_MASK) = 0) and ((tx and LAND_WIDTH_MASK) = 0) and (((Land[ty, tx] and lfBasic) <> 0) |
455 if ((ty and LAND_HEIGHT_MASK) = 0) and ((tx and LAND_WIDTH_MASK) = 0) and (((Land[ty, tx] and lfBasic) <> 0) |
456 or ((Land[ty, tx] and lfObject) <> 0)) then |
456 or ((Land[ty, tx] and lfObject) <> 0)) then |
457 begin |
457 begin |
458 Land[ty, tx]:= (Land[ty, tx] or lfDamaged) and not lfIce; |
458 Land[ty, tx]:= (Land[ty, tx] or lfDamaged) and (not lfIce); |
459 if despeckle then |
459 if despeckle then |
460 LandDirty[ty div 32, tx div 32]:= 1; |
460 LandDirty[ty div 32, tx div 32]:= 1; |
461 if (cReducedQuality and rqBlurryLand) = 0 then |
461 if (cReducedQuality and rqBlurryLand) = 0 then |
462 LandPixels[ty, tx]:= ExplosionBorderColor |
462 LandPixels[ty, tx]:= ExplosionBorderColor |
463 else |
463 else |
497 ty:= hwRound(Y); |
497 ty:= hwRound(Y); |
498 if ((ty and LAND_HEIGHT_MASK) = 0) |
498 if ((ty and LAND_HEIGHT_MASK) = 0) |
499 and ((tx and LAND_WIDTH_MASK) = 0) |
499 and ((tx and LAND_WIDTH_MASK) = 0) |
500 and (((Land[ty, tx] and lfBasic) <> 0) or ((Land[ty, tx] and lfObject) <> 0)) then |
500 and (((Land[ty, tx] and lfBasic) <> 0) or ((Land[ty, tx] and lfObject) <> 0)) then |
501 begin |
501 begin |
502 Land[ty, tx]:= Land[ty, tx] and not lfIce; |
502 Land[ty, tx]:= Land[ty, tx] and (not lfIce); |
503 if despeckle then |
503 if despeckle then |
504 begin |
504 begin |
505 Land[ty, tx]:= Land[ty, tx] or lfDamaged; |
505 Land[ty, tx]:= Land[ty, tx] or lfDamaged; |
506 LandDirty[ty div 32, tx div 32]:= 1 |
506 LandDirty[ty div 32, tx div 32]:= 1 |
507 end; |
507 end; |
561 tx:= hwRound(X); |
561 tx:= hwRound(X); |
562 ty:= hwRound(Y); |
562 ty:= hwRound(Y); |
563 if ((ty and LAND_HEIGHT_MASK) = 0) and ((tx and LAND_WIDTH_MASK) = 0) and (((Land[ty, tx] and lfBasic) <> 0) |
563 if ((ty and LAND_HEIGHT_MASK) = 0) and ((tx and LAND_WIDTH_MASK) = 0) and (((Land[ty, tx] and lfBasic) <> 0) |
564 or ((Land[ty, tx] and lfObject) <> 0)) then |
564 or ((Land[ty, tx] and lfObject) <> 0)) then |
565 begin |
565 begin |
566 Land[ty, tx]:= (Land[ty, tx] or lfDamaged) and not lfIce; |
566 Land[ty, tx]:= (Land[ty, tx] or lfDamaged) and (not lfIce); |
567 if despeckle then |
567 if despeckle then |
568 LandDirty[ty div 32, tx div 32]:= 1; |
568 LandDirty[ty div 32, tx div 32]:= 1; |
569 if (cReducedQuality and rqBlurryLand) = 0 then |
569 if (cReducedQuality and rqBlurryLand) = 0 then |
570 LandPixels[ty, tx]:= ExplosionBorderColor |
570 LandPixels[ty, tx]:= ExplosionBorderColor |
571 else |
571 else |