45 function LandBackPixel(x, y: LongInt): LongWord; |
45 function LandBackPixel(x, y: LongInt): LongWord; |
46 procedure DrawLine(X1, Y1, X2, Y2: LongInt; Color: Longword); |
46 procedure DrawLine(X1, Y1, X2, Y2: LongInt; Color: Longword); |
47 function DrawThickLine(X1, Y1, X2, Y2, radius: LongInt; color: Longword): Longword; |
47 function DrawThickLine(X1, Y1, X2, Y2, radius: LongInt; color: Longword): Longword; |
48 procedure DumpLandToLog(x, y, r: LongInt); |
48 procedure DumpLandToLog(x, y, r: LongInt); |
49 procedure DrawIceBreak(x, y, iceRadius, iceHeight: Longint); |
49 procedure DrawIceBreak(x, y, iceRadius, iceHeight: Longint); |
50 function TryPlaceOnLandSimple(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace, indestructible: boolean): boolean; inline; |
50 function TryPlaceOnLandSimple(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace, indestructible: boolean): boolean; |
51 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace: boolean; LandFlags: Word): boolean; inline; |
51 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace: boolean; LandFlags: Word): boolean; |
52 function ForcePlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; LandFlags: Word; Tint: LongWord; Behind, flipHoriz, flipVert: boolean): boolean; inline; |
52 function ForcePlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; LandFlags: Word; Tint: LongWord; Behind, flipHoriz, flipVert: boolean): boolean; |
53 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace, outOfMap, force, behind, flipHoriz, flipVert: boolean; LandFlags: Word; Tint: LongWord): boolean; |
53 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace, outOfMap, force, behind, flipHoriz, flipVert: boolean; LandFlags: Word; Tint: LongWord): boolean; |
54 procedure EraseLandRectRaw(X, Y, width, height: LongWord); |
54 procedure EraseLandRectRaw(X, Y, width, height: LongWord); |
55 procedure EraseLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; LandFlags: Word; eraseOnLFMatch, onlyEraseLF, flipHoriz, flipVert: boolean); |
55 procedure EraseLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; LandFlags: Word; eraseOnLFMatch, onlyEraseLF, flipHoriz, flipVert: boolean); |
56 function GetPlaceCollisionTex(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt): PTexture; |
56 function GetPlaceCollisionTex(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt): PTexture; |
57 |
57 |
58 implementation |
58 implementation |
59 uses SDLh, uLandTexture, uTextures, uVariables, uUtils, uDebug, uScript; |
59 uses SDLh, uLandTexture, uTextures, uVariables, uUtils, uDebug, uScript, uLandUtils; |
60 |
60 |
61 |
61 |
62 procedure calculatePixelsCoordinates(landX, landY: Longint; var pixelX, pixelY: Longint); inline; |
62 procedure calculatePixelsCoordinates(landX, landY: Longint; var pixelX, pixelY: Longint); |
63 begin |
63 begin |
64 if (cReducedQuality and rqBlurryLand) = 0 then |
64 if (cReducedQuality and rqBlurryLand) = 0 then |
65 begin |
65 begin |
66 pixelX := landX; |
66 pixelX := landX; |
67 pixelY := landY; |
67 pixelY := landY; |
71 pixelX := LandX div 2; |
71 pixelX := LandX div 2; |
72 pixelY := LandY div 2; |
72 pixelY := LandY div 2; |
73 end; |
73 end; |
74 end; |
74 end; |
75 |
75 |
76 function drawPixelBG(landX, landY, pixelX, pixelY: Longint): Longword; inline; |
76 function drawPixelBG(landX, landY, pixelX, pixelY: Longint): Longword; |
77 begin |
77 begin |
78 drawPixelBG := 0; |
78 drawPixelBG := 0; |
79 if (Land[LandY, landX] and lfIndestructible) = 0 then |
79 if (LandGet(LandY, landX) and lfIndestructible) = 0 then |
80 begin |
80 begin |
81 if ((Land[landY, landX] and lfBasic) <> 0) and (((LandPixels[pixelY, pixelX] and AMask) shr AShift) = 255) and (not disableLandBack) then |
81 if ((LandGet(landY, landX) and lfBasic) <> 0) and (((LandPixels[pixelY, pixelX] and AMask) shr AShift) = 255) and (not disableLandBack) then |
82 begin |
82 begin |
83 LandPixels[pixelY, pixelX]:= LandBackPixel(landX, landY); |
83 LandPixels[pixelY, pixelX]:= LandBackPixel(landX, landY); |
84 inc(drawPixelBG); |
84 inc(drawPixelBG); |
85 end |
85 end |
86 else if ((Land[landY, landX] and lfObject) <> 0) or (((LandPixels[pixelY, pixelX] and AMask) shr AShift) < 255) then |
86 else if ((LandGet(landY, landX) and lfObject) <> 0) or (((LandPixels[pixelY, pixelX] and AMask) shr AShift) < 255) then |
87 LandPixels[pixelY, pixelX]:= ExplosionBorderColorNoA |
87 LandPixels[pixelY, pixelX]:= ExplosionBorderColorNoA |
88 end; |
88 end; |
89 end; |
89 end; |
90 |
90 |
91 procedure drawPixelEBC(landX, landY, pixelX, pixelY: Longint); inline; |
91 procedure drawPixelEBC(landX, landY, pixelX, pixelY: Longint); |
92 begin |
92 begin |
93 if (Land[landY, landX] and lfIndestructible = 0) and |
93 if (LandGet(landY, landX) and lfIndestructible = 0) and |
94 (((Land[landY, landX] and lfBasic) <> 0) or ((Land[landY, landX] and lfObject) <> 0)) then |
94 (((LandGet(landY, landX) and lfBasic) <> 0) or ((LandGet(landY, landX) and lfObject) <> 0)) then |
95 begin |
95 begin |
96 LandPixels[pixelY, pixelX]:= ExplosionBorderColor; |
96 LandPixels[pixelY, pixelX]:= ExplosionBorderColor; |
97 Land[landY, landX]:= (Land[landY, landX] or lfDamaged) and (not lfIce); |
97 LandSet(landY, landX, (LandGet(landY, landX) or lfDamaged) and (not lfIce)); |
98 LandDirty[landY div 32, landX div 32]:= 1; |
98 LandDirty[landY div 32, landX div 32]:= 1; |
99 end; |
99 end; |
100 end; |
100 end; |
101 |
101 |
102 function isLandscapeEdge(weight:Longint):boolean; inline; |
102 function isLandscapeEdge(weight:Longint):boolean; |
103 begin |
103 begin |
104 isLandscapeEdge := (weight < 8) and (weight >= 2); |
104 isLandscapeEdge := (weight < 8) and (weight >= 2); |
105 end; |
105 end; |
106 |
106 |
107 function getPixelWeight(x, y:Longint): Longint; |
107 function getPixelWeight(x, y:Longint): Longint; |
157 LandPixels[pixelY, pixelX]:= LandPixels[pixelY, pixelX] and (not AMask) or 254 shl AShift; |
157 LandPixels[pixelY, pixelX]:= LandPixels[pixelY, pixelX] and (not AMask) or 254 shl AShift; |
158 end; |
158 end; |
159 end; |
159 end; |
160 |
160 |
161 |
161 |
162 procedure DrawPixelIce(landX, landY, pixelX, pixelY: Longint); inline; |
162 procedure DrawPixelIce(landX, landY, pixelX, pixelY: Longint); |
163 begin |
163 begin |
164 if ((Land[landY, landX] and lfIce) <> 0) then exit; |
164 if ((LandGet(landY, landX) and lfIce) <> 0) then exit; |
165 if (pixelX < LeftX) or (pixelX > RightX) or (pixelY < TopY) then exit; |
165 if (pixelX < LeftX) or (pixelX > RightX) or (pixelY < TopY) then exit; |
166 if isLandscapeEdge(getPixelWeight(landX, landY)) then |
166 if isLandscapeEdge(getPixelWeight(landX, landY)) then |
167 begin |
167 begin |
168 if (LandPixels[pixelY, pixelX] and AMask < 255) and (LandPixels[pixelY, pixelX] and AMask > 0) then |
168 if (LandPixels[pixelY, pixelX] and AMask < 255) and (LandPixels[pixelY, pixelX] and AMask > 0) then |
169 LandPixels[pixelY, pixelX] := (IceEdgeColor and (not AMask)) or (LandPixels[pixelY, pixelX] and AMask) |
169 LandPixels[pixelY, pixelX] := (IceEdgeColor and (not AMask)) or (LandPixels[pixelY, pixelX] and AMask) |
170 else if (LandPixels[pixelY, pixelX] and AMask < 255) or (Land[landY, landX] > 255) then |
170 else if (LandPixels[pixelY, pixelX] and AMask < 255) or (LandGet(landY, landX) > 255) then |
171 LandPixels[pixelY, pixelX] := IceEdgeColor |
171 LandPixels[pixelY, pixelX] := IceEdgeColor |
172 end |
172 end |
173 else if Land[landY, landX] > 255 then |
173 else if LandGet(landY, landX) > 255 then |
174 begin |
174 begin |
175 fillPixelFromIceSprite(pixelX, pixelY); |
175 fillPixelFromIceSprite(pixelX, pixelY); |
176 end; |
176 end; |
177 if Land[landY, landX] > 255 then Land[landY, landX] := Land[landY, landX] or lfIce and (not lfDamaged); |
177 if LandGet(landY, landX) > 255 then LandSet(landY, landX, LandGet(landY, landX) or lfIce and (not lfDamaged)); |
178 end; |
178 end; |
179 |
179 |
180 |
180 |
181 function FillLandCircleLineFT(y, fromPix, toPix: LongInt; fill : fillType): Longword; |
181 function FillLandCircleLineFT(y, fromPix, toPix: LongInt; fill : fillType): Longword; |
182 var px, py, i: LongInt; |
182 var px, py, i: LongInt; |
212 DrawPixelIce(i, y, px, py); |
212 DrawPixelIce(i, y, px, py); |
213 end; |
213 end; |
214 addNotHHObj: |
214 addNotHHObj: |
215 for i:= fromPix to toPix do |
215 for i:= fromPix to toPix do |
216 begin |
216 begin |
217 if Land[y, i] and lfNotHHObjMask shr lfNotHHObjShift < lfNotHHObjSize then |
217 if LandGet(y, i) and lfNotHHObjMask shr lfNotHHObjShift < lfNotHHObjSize then |
218 Land[y, i]:= (Land[y, i] and (not lfNotHHObjMask)) or ((Land[y, i] and lfNotHHObjMask shr lfNotHHObjShift + 1) shl lfNotHHObjShift); |
218 LandSet(y, i, (LandGet(y, i) and (not lfNotHHObjMask)) or ((LandGet(y, i) and lfNotHHObjMask shr lfNotHHObjShift + 1) shl lfNotHHObjShift)); |
219 end; |
219 end; |
220 removeNotHHObj: |
220 removeNotHHObj: |
221 for i:= fromPix to toPix do |
221 for i:= fromPix to toPix do |
222 begin |
222 begin |
223 if Land[y, i] and lfNotHHObjMask <> 0 then |
223 if LandGet(y, i) and lfNotHHObjMask <> 0 then |
224 Land[y, i]:= (Land[y, i] and (not lfNotHHObjMask)) or ((Land[y, i] and lfNotHHObjMask shr lfNotHHObjShift - 1) shl lfNotHHObjShift); |
224 LandSet(y, i, (LandGet(y, i) and (not lfNotHHObjMask)) or ((LandGet(y, i) and lfNotHHObjMask shr lfNotHHObjShift - 1) shl lfNotHHObjShift)); |
225 end; |
225 end; |
226 addHH: |
226 addHH: |
227 for i:= fromPix to toPix do |
227 for i:= fromPix to toPix do |
228 begin |
228 begin |
229 if Land[y, i] and lfHHMask < lfHHMask then |
229 if LandGet(y, i) and lfHHMask < lfHHMask then |
230 Land[y, i]:= Land[y, i] + 1 |
230 LandSet(y, i, LandGet(y, i) + 1) |
231 end; |
231 end; |
232 removeHH: |
232 removeHH: |
233 for i:= fromPix to toPix do |
233 for i:= fromPix to toPix do |
234 begin |
234 begin |
235 if Land[y, i] and lfHHMask > 0 then |
235 if LandGet(y, i) and lfHHMask > 0 then |
236 Land[y, i]:= Land[y, i] - 1; |
236 LandSet(y, i, LandGet(y, i) - 1); |
237 end; |
237 end; |
238 setCurrentHog: |
238 setCurrentHog: |
239 for i:= fromPix to toPix do |
239 for i:= fromPix to toPix do |
240 begin |
240 begin |
241 Land[y, i]:= Land[y, i] or lfCurHogCrate |
241 LandSet(y, i, LandGet(y, i) or lfCurHogCrate) |
242 end; |
242 end; |
243 removeCurrentHog: |
243 removeCurrentHog: |
244 for i:= fromPix to toPix do |
244 for i:= fromPix to toPix do |
245 begin |
245 begin |
246 Land[y, i]:= Land[y, i] and lfNotCurHogCrate; |
246 LandSet(y, i, LandGet(y, i) and lfNotCurHogCrate); |
247 end; |
247 end; |
248 end; |
248 end; |
249 end; |
249 end; |
250 |
250 |
251 function FillLandCircleSegmentFT(x, y, dx, dy: LongInt; fill : fillType): Longword; inline; |
251 function FillLandCircleSegmentFT(x, y, dx, dy: LongInt; fill : fillType): Longword; |
252 begin |
252 begin |
253 FillLandCircleSegmentFT := 0; |
253 FillLandCircleSegmentFT := 0; |
254 if ((y + dy) and LAND_HEIGHT_MASK) = 0 then |
254 if ((y + dy) and LAND_HEIGHT_MASK) = 0 then |
255 inc(FillLandCircleSegmentFT, FillLandCircleLineFT(y + dy, Max(x - dx, 0), Min(x + dx, LAND_WIDTH - 1), fill)); |
255 inc(FillLandCircleSegmentFT, FillLandCircleLineFT(y + dy, Max(x - dx, 0), Min(x + dx, LAND_WIDTH - 1), fill)); |
256 if ((y - dy) and LAND_HEIGHT_MASK) = 0 then |
256 if ((y - dy) and LAND_HEIGHT_MASK) = 0 then |
259 inc(FillLandCircleSegmentFT, FillLandCircleLineFT(y + dx, Max(x - dy, 0), Min(x + dy, LAND_WIDTH - 1), fill)); |
259 inc(FillLandCircleSegmentFT, FillLandCircleLineFT(y + dx, Max(x - dy, 0), Min(x + dy, LAND_WIDTH - 1), fill)); |
260 if ((y - dx) and LAND_HEIGHT_MASK) = 0 then |
260 if ((y - dx) and LAND_HEIGHT_MASK) = 0 then |
261 inc(FillLandCircleSegmentFT, FillLandCircleLineFT(y - dx, Max(x - dy, 0), Min(x + dy, LAND_WIDTH - 1), fill)); |
261 inc(FillLandCircleSegmentFT, FillLandCircleLineFT(y - dx, Max(x - dy, 0), Min(x + dy, LAND_WIDTH - 1), fill)); |
262 end; |
262 end; |
263 |
263 |
264 function FillRoundInLandFT(X, Y, Radius: LongInt; fill: fillType): Longword; inline; |
264 function FillRoundInLandFT(X, Y, Radius: LongInt; fill: fillType): Longword; |
265 var dx, dy, d: LongInt; |
265 var dx, dy, d: LongInt; |
266 begin |
266 begin |
267 dx:= 0; |
267 dx:= 0; |
268 dy:= Radius; |
268 dy:= Radius; |
269 d:= 3 - 2 * Radius; |
269 d:= 3 - 2 * Radius; |
321 begin |
321 begin |
322 FillCircleLines:= 0; |
322 FillCircleLines:= 0; |
323 |
323 |
324 if ((y + dy) and LAND_HEIGHT_MASK) = 0 then |
324 if ((y + dy) and LAND_HEIGHT_MASK) = 0 then |
325 for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do |
325 for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do |
326 if (Land[y + dy, i] and lfIndestructible) = 0 then |
326 if (LandGet(y + dy, i) and lfIndestructible) = 0 then |
327 begin |
327 begin |
328 if Land[y + dy, i] <> Value then inc(FillCircleLines); |
328 if LandGet(y + dy, i) <> Value then inc(FillCircleLines); |
329 Land[y + dy, i]:= Value; |
329 LandSet(y + dy, i, Value); |
330 end; |
330 end; |
331 if ((y - dy) and LAND_HEIGHT_MASK) = 0 then |
331 if ((y - dy) and LAND_HEIGHT_MASK) = 0 then |
332 for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do |
332 for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do |
333 if (Land[y - dy, i] and lfIndestructible) = 0 then |
333 if (LandGet(y - dy, i) and lfIndestructible) = 0 then |
334 begin |
334 begin |
335 if Land[y - dy, i] <> Value then inc(FillCircleLines); |
335 if LandGet(y - dy, i) <> Value then inc(FillCircleLines); |
336 Land[y - dy, i]:= Value; |
336 LandSet(y - dy, i, Value); |
337 end; |
337 end; |
338 if ((y + dx) and LAND_HEIGHT_MASK) = 0 then |
338 if ((y + dx) and LAND_HEIGHT_MASK) = 0 then |
339 for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do |
339 for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do |
340 if (Land[y + dx, i] and lfIndestructible) = 0 then |
340 if (LandGet(y + dx, i) and lfIndestructible) = 0 then |
341 begin |
341 begin |
342 if Land[y + dx, i] <> Value then inc(FillCircleLines); |
342 if LandGet(y + dx, i) <> Value then inc(FillCircleLines); |
343 Land[y + dx, i]:= Value; |
343 LandSet(y + dx, i, Value); |
344 end; |
344 end; |
345 if ((y - dx) and LAND_HEIGHT_MASK) = 0 then |
345 if ((y - dx) and LAND_HEIGHT_MASK) = 0 then |
346 for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do |
346 for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do |
347 if (Land[y - dx, i] and lfIndestructible) = 0 then |
347 if (LandGet(y - dx, i) and lfIndestructible) = 0 then |
348 begin |
348 begin |
349 if Land[y - dx, i] <> Value then inc(FillCircleLines); |
349 if LandGet(y - dx, i) <> Value then inc(FillCircleLines); |
350 Land[y - dx, i]:= Value; |
350 LandSet(y - dx, i, Value); |
351 end; |
351 end; |
352 end; |
352 end; |
353 |
353 |
354 function FillRoundInLand(X, Y, Radius: LongInt; Value: Longword): Longword; |
354 function FillRoundInLand(X, Y, Radius: LongInt; Value: Longword): Longword; |
355 var dx, dy, d: LongInt; |
355 var dx, dy, d: LongInt; |
476 for i:= 0 to Pred(Count) do |
476 for i:= 0 to Pred(Count) do |
477 begin |
477 begin |
478 for ty:= Max(y - Radius, 0) to Min(y + Radius, TopY) do |
478 for ty:= Max(y - Radius, 0) to Min(y + Radius, TopY) do |
479 for tx:= Max(LeftX, ar^[i].Left - Radius) to Min(RightX, ar^[i].Right + Radius) do |
479 for tx:= Max(LeftX, ar^[i].Left - Radius) to Min(RightX, ar^[i].Right + Radius) do |
480 begin |
480 begin |
481 if (Land[ty, tx] and lfIndestructible) = 0 then |
481 if (LandGet(ty, tx) and lfIndestructible) = 0 then |
482 begin |
482 begin |
483 if (cReducedQuality and rqBlurryLand) = 0 then |
483 if (cReducedQuality and rqBlurryLand) = 0 then |
484 begin |
484 begin |
485 by:= ty; bx:= tx; |
485 by:= ty; bx:= tx; |
486 end |
486 end |
487 else |
487 else |
488 begin |
488 begin |
489 by:= ty div 2; bx:= tx div 2; |
489 by:= ty div 2; bx:= tx div 2; |
490 end; |
490 end; |
491 if ((Land[ty, tx] and lfBasic) <> 0) and (((LandPixels[by,bx] and AMask) shr AShift) = 255) and (not disableLandBack) then |
491 if ((LandGet(ty, tx) and lfBasic) <> 0) and (((LandPixels[by,bx] and AMask) shr AShift) = 255) and (not disableLandBack) then |
492 LandPixels[by, bx]:= LandBackPixel(tx, ty) |
492 LandPixels[by, bx]:= LandBackPixel(tx, ty) |
493 else if ((Land[ty, tx] and lfObject) <> 0) or (((LandPixels[by,bx] and AMask) shr AShift) < 255) then |
493 else if ((LandGet(ty, tx) and lfObject) <> 0) or (((LandPixels[by,bx] and AMask) shr AShift) < 255) then |
494 LandPixels[by, bx]:= LandPixels[by, bx] and (not AMASK) |
494 LandPixels[by, bx]:= LandPixels[by, bx] and (not AMASK) |
495 end |
495 end |
496 end; |
496 end; |
497 inc(y, dY) |
497 inc(y, dY) |
498 end; |
498 end; |
502 |
502 |
503 for i:= 0 to Pred(Count) do |
503 for i:= 0 to Pred(Count) do |
504 begin |
504 begin |
505 for ty:= Max(y - Radius, 0) to Min(y + Radius, TopY) do |
505 for ty:= Max(y - Radius, 0) to Min(y + Radius, TopY) do |
506 for tx:= Max(LeftX, ar^[i].Left - Radius) to Min(RightX, ar^[i].Right + Radius) do |
506 for tx:= Max(LeftX, ar^[i].Left - Radius) to Min(RightX, ar^[i].Right + Radius) do |
507 if ((Land[ty, tx] and lfBasic) <> 0) or ((Land[ty, tx] and lfObject) <> 0) then |
507 if ((LandGet(ty, tx) and lfBasic) <> 0) or ((LandGet(ty, tx) and lfObject) <> 0) then |
508 begin |
508 begin |
509 if (cReducedQuality and rqBlurryLand) = 0 then |
509 if (cReducedQuality and rqBlurryLand) = 0 then |
510 LandPixels[ty, tx]:= ExplosionBorderColor |
510 LandPixels[ty, tx]:= ExplosionBorderColor |
511 else |
511 else |
512 LandPixels[ty div 2, tx div 2]:= ExplosionBorderColor; |
512 LandPixels[ty div 2, tx div 2]:= ExplosionBorderColor; |
513 |
513 |
514 Land[ty, tx]:= (Land[ty, tx] or lfDamaged) and (not lfIce); |
514 LandSet(ty, tx, (LandGet(ty, tx) or lfDamaged) and (not lfIce)); |
515 LandDirty[ty div 32, tx div 32]:= 1; |
515 LandDirty[ty div 32, tx div 32]:= 1; |
516 end; |
516 end; |
517 inc(y, dY) |
517 inc(y, dY) |
518 end; |
518 end; |
519 |
519 |
610 begin |
610 begin |
611 X:= X + dX; |
611 X:= X + dX; |
612 Y:= Y + dY; |
612 Y:= Y + dY; |
613 tx:= hwRound(X); |
613 tx:= hwRound(X); |
614 ty:= hwRound(Y); |
614 ty:= hwRound(Y); |
615 if ((ty and LAND_HEIGHT_MASK) = 0) and ((tx and LAND_WIDTH_MASK) = 0) and ((Land[ty, tx] and lfIndestructible) = 0) then |
615 if ((ty and LAND_HEIGHT_MASK) = 0) and ((tx and LAND_WIDTH_MASK) = 0) and ((LandGet(ty, tx) and lfIndestructible) = 0) then |
616 begin |
616 begin |
617 if (cReducedQuality and rqBlurryLand) = 0 then |
617 if (cReducedQuality and rqBlurryLand) = 0 then |
618 begin |
618 begin |
619 by:= ty; bx:= tx; |
619 by:= ty; bx:= tx; |
620 end |
620 end |
621 else |
621 else |
622 begin |
622 begin |
623 by:= ty div 2; bx:= tx div 2; |
623 by:= ty div 2; bx:= tx div 2; |
624 end; |
624 end; |
625 if ((Land[ty, tx] and lfBasic) <> 0) and (((LandPixels[by,bx] and AMask) shr AShift) = 255) and (not disableLandBack) then |
625 if ((LandGet(ty, tx) and lfBasic) <> 0) and (((LandPixels[by,bx] and AMask) shr AShift) = 255) and (not disableLandBack) then |
626 LandPixels[by, bx]:= LandBackPixel(tx, ty) |
626 LandPixels[by, bx]:= LandBackPixel(tx, ty) |
627 else if ((Land[ty, tx] and lfObject) <> 0) or (((LandPixels[by,bx] and AMask) shr AShift) < 255) then |
627 else if ((LandGet(ty, tx) and lfObject) <> 0) or (((LandPixels[by,bx] and AMask) shr AShift) < 255) then |
628 LandPixels[by, bx]:= LandPixels[by, bx] and (not AMASK); |
628 LandPixels[by, bx]:= LandPixels[by, bx] and (not AMASK); |
629 Land[ty, tx]:= 0; |
629 LandSet(ty, tx, 0); |
630 end |
630 end |
631 end; |
631 end; |
632 DrawExplosionBorder(X, Y, dx, dy, despeckle); |
632 DrawExplosionBorder(X, Y, dx, dy, despeckle); |
633 nx:= nx - dY; |
633 nx:= nx - dY; |
634 ny:= ny + dX; |
634 ny:= ny + dX; |
690 else |
690 else |
691 DrawTunnel_real(X - int2hwFloat(playWidth), Y, dX, dY, ticks, HalfWidth); |
691 DrawTunnel_real(X - int2hwFloat(playWidth), Y, dX, dY, ticks, HalfWidth); |
692 end; |
692 end; |
693 end; |
693 end; |
694 |
694 |
695 function TryPlaceOnLandSimple(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace, indestructible: boolean): boolean; inline; |
695 function TryPlaceOnLandSimple(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace, indestructible: boolean): boolean; |
696 var lf: Word; |
696 var lf: Word; |
697 begin |
697 begin |
698 if indestructible then |
698 if indestructible then |
699 lf:= lfIndestructible |
699 lf:= lfIndestructible |
700 else |
700 else |
701 lf:= 0; |
701 lf:= 0; |
702 TryPlaceOnLandSimple:= TryPlaceOnLand(cpX, cpY, Obj, Frame, doPlace, false, false, false, false, false, lf, $FFFFFFFF); |
702 TryPlaceOnLandSimple:= TryPlaceOnLand(cpX, cpY, Obj, Frame, doPlace, false, false, false, false, false, lf, $FFFFFFFF); |
703 end; |
703 end; |
704 |
704 |
705 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace: boolean; LandFlags: Word): boolean; inline; |
705 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace: boolean; LandFlags: Word): boolean; |
706 begin |
706 begin |
707 TryPlaceOnLand:= TryPlaceOnLand(cpX, cpY, Obj, Frame, doPlace, false, false, false, false, false, LandFlags, $FFFFFFFF); |
707 TryPlaceOnLand:= TryPlaceOnLand(cpX, cpY, Obj, Frame, doPlace, false, false, false, false, false, LandFlags, $FFFFFFFF); |
708 end; |
708 end; |
709 |
709 |
710 function ForcePlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; LandFlags: Word; Tint: LongWord; Behind, flipHoriz, flipVert: boolean): boolean; inline; |
710 function ForcePlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; LandFlags: Word; Tint: LongWord; Behind, flipHoriz, flipVert: boolean): boolean; |
711 begin |
711 begin |
712 ForcePlaceOnLand:= TryPlaceOnLand(cpX, cpY, Obj, Frame, true, false, true, behind, flipHoriz, flipVert, LandFlags, Tint) |
712 ForcePlaceOnLand:= TryPlaceOnLand(cpX, cpY, Obj, Frame, true, false, true, behind, flipHoriz, flipVert, LandFlags, Tint) |
713 end; |
713 end; |
714 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace, outOfMap, force, behind, flipHoriz, flipVert: boolean; LandFlags: Word; Tint: LongWord): boolean; |
714 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace, outOfMap, force, behind, flipHoriz, flipVert: boolean; LandFlags: Word; Tint: LongWord): boolean; |
715 var X, Y, bpp, h, w, row, col, gx, gy, numFramesFirstCol: LongInt; |
715 var X, Y, bpp, h, w, row, col, gx, gy, numFramesFirstCol: LongInt; |
791 else |
791 else |
792 begin |
792 begin |
793 gX:= (cpX + x) div 2; |
793 gX:= (cpX + x) div 2; |
794 gY:= (cpY + y) div 2; |
794 gY:= (cpY + y) div 2; |
795 end; |
795 end; |
796 if (not behind) or (Land[cpY + y, cpX + x] and lfLandMask = 0) then |
796 if (not behind) or (LandGet(cpY + y, cpX + x) and lfLandMask = 0) then |
797 begin |
797 begin |
798 if (LandFlags and lfBasic <> 0) or |
798 if (LandFlags and lfBasic <> 0) or |
799 ((LandPixels[gY, gX] and AMask shr AShift > 128) and // This test assumes lfBasic and lfObject differ only graphically |
799 ((LandPixels[gY, gX] and AMask shr AShift > 128) and // This test assumes lfBasic and lfObject differ only graphically |
800 (LandFlags and (lfObject or lfIce) = 0)) then |
800 (LandFlags and (lfObject or lfIce) = 0)) then |
801 Land[cpY + y, cpX + x]:= lfBasic or LandFlags |
801 LandSet(cpY + y, cpX + x, lfBasic or LandFlags) |
802 else if (LandFlags and lfIce = 0) then |
802 else if (LandFlags and lfIce = 0) then |
803 Land[cpY + y, cpX + x]:= lfObject or LandFlags |
803 LandSet(cpY + y, cpX + x, lfObject or LandFlags) |
804 else Land[cpY + y, cpX + x]:= LandFlags |
804 else LandSet(cpY + y, cpX + x, LandFlags) |
805 end; |
805 end; |
806 if (not behind) or (LandPixels[gY, gX] = 0) then |
806 if (not behind) or (LandPixels[gY, gX] = 0) then |
807 begin |
807 begin |
808 if tint = $FFFFFFFF then |
808 if tint = $FFFFFFFF then |
809 LandPixels[gY, gX]:= PLongword(@(p^[x * 4]))^ |
809 LandPixels[gY, gX]:= PLongword(@(p^[x * 4]))^ |
810 else |
810 else |
811 begin |
811 begin |
812 pixel:= PLongword(@(p^[x * 4]))^; |
812 pixel:= PLongword(@(p^[x * 4]))^; |
813 LandPixels[gY, gX]:= |
813 LandPixels[gY, gX]:= |
814 ceil((pixel shr RShift and $FF) * ((tint shr 24) / 255)) shl RShift or |
814 ceil((pixel shr RShift and $FF) * ((tint shr 24) / 255)) shl RShift or |
815 ceil((pixel shr GShift and $FF) * ((tint shr 16 and $ff) / 255)) shl GShift or |
815 ceil((pixel shr GShift and $FF) * ((tint shr 16 and $ff) / 255)) shl GShift or |
816 ceil((pixel shr BShift and $FF) * ((tint shr 8 and $ff) / 255)) shl BShift or |
816 ceil((pixel shr BShift and $FF) * ((tint shr 8 and $ff) / 255)) shl BShift or |
817 ceil((pixel shr AShift and $FF) * ((tint and $ff) / 255)) shl AShift; |
817 ceil((pixel shr AShift and $FF) * ((tint and $ff) / 255)) shl AShift; |
818 end |
818 end |
846 begin |
846 begin |
847 for ty:= 0 to height - 1 do |
847 for ty:= 0 to height - 1 do |
848 for tx:= 0 to width - 1 do |
848 for tx:= 0 to width - 1 do |
849 begin |
849 begin |
850 LandPixels[ty, tx]:= 0; |
850 LandPixels[ty, tx]:= 0; |
851 Land[Y + ty, X + tx]:= 0; |
851 LandSet(Y + ty, X + tx, 0); |
852 end; |
852 end; |
853 end; |
853 end; |
854 |
854 |
855 procedure EraseLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; LandFlags: Word; eraseOnLFMatch, onlyEraseLF, flipHoriz, flipVert: boolean); |
855 procedure EraseLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; LandFlags: Word; eraseOnLFMatch, onlyEraseLF, flipHoriz, flipVert: boolean); |
856 var X, Y, bpp, h, w, row, col, gx, gy, numFramesFirstCol: LongInt; |
856 var X, Y, bpp, h, w, row, col, gx, gy, numFramesFirstCol: LongInt; |
1137 end; |
1137 end; |
1138 |
1138 |
1139 procedure Smooth_oldImpl(X, Y: LongInt); |
1139 procedure Smooth_oldImpl(X, Y: LongInt); |
1140 begin |
1140 begin |
1141 // a bit of AA for explosions |
1141 // a bit of AA for explosions |
1142 if (Land[Y, X] = 0) and (Y > topY + 1) and |
1142 if (LandGet(Y, X) = 0) and (Y > topY + 1) and |
1143 (Y < LAND_HEIGHT-2) and (X > leftX + 1) and (X < rightX - 1) then |
1143 (Y < LAND_HEIGHT-2) and (X > leftX + 1) and (X < rightX - 1) then |
1144 begin |
1144 begin |
1145 if ((((Land[y, x-1] and lfDamaged) <> 0) and (((Land[y+1,x] and lfDamaged) <> 0)) or ((Land[y-1,x] and lfDamaged) <> 0)) |
1145 if ((((LandGet(y, x-1) and lfDamaged) <> 0) and (((LandGet(y+1,x) and lfDamaged) <> 0)) or ((LandGet(y-1,x) and lfDamaged) <> 0)) |
1146 or (((Land[y, x+1] and lfDamaged) <> 0) and (((Land[y-1,x] and lfDamaged) <> 0) or ((Land[y+1,x] and lfDamaged) <> 0)))) then |
1146 or (((LandGet(y, x+1) and lfDamaged) <> 0) and (((LandGet(y-1,x) and lfDamaged) <> 0) or ((LandGet(y+1,x) and lfDamaged) <> 0)))) then |
1147 begin |
1147 begin |
1148 if (cReducedQuality and rqBlurryLand) = 0 then |
1148 if (cReducedQuality and rqBlurryLand) = 0 then |
1149 begin |
1149 begin |
1150 if ((LandPixels[y,x] and AMask) shr AShift) < 10 then |
1150 if ((LandPixels[y,x] and AMask) shr AShift) < 10 then |
1151 LandPixels[y,x]:= (ExplosionBorderColor and (not AMask)) or (128 shl AShift) |
1151 LandPixels[y,x]:= (ExplosionBorderColor and (not AMask)) or (128 shl AShift) |
1154 (((((LandPixels[y,x] and RMask shr RShift) div 2)+((ExplosionBorderColor and RMask) shr RShift) div 2) and $FF) shl RShift) or |
1154 (((((LandPixels[y,x] and RMask shr RShift) div 2)+((ExplosionBorderColor and RMask) shr RShift) div 2) and $FF) shl RShift) or |
1155 (((((LandPixels[y,x] and GMask shr GShift) div 2)+((ExplosionBorderColor and GMask) shr GShift) div 2) and $FF) shl GShift) or |
1155 (((((LandPixels[y,x] and GMask shr GShift) div 2)+((ExplosionBorderColor and GMask) shr GShift) div 2) and $FF) shl GShift) or |
1156 (((((LandPixels[y,x] and BMask shr BShift) div 2)+((ExplosionBorderColor and BMask) shr BShift) div 2) and $FF) shl BShift) or ($FF shl AShift) |
1156 (((((LandPixels[y,x] and BMask shr BShift) div 2)+((ExplosionBorderColor and BMask) shr BShift) div 2) and $FF) shl BShift) or ($FF shl AShift) |
1157 end; |
1157 end; |
1158 { |
1158 { |
1159 if (Land[y, x-1] = lfObject) then |
1159 if (LandGet(y, x-1) = lfObject) then |
1160 Land[y,x]:= lfObject |
1160 LandGet(y,x):= lfObject |
1161 else if (Land[y, x+1] = lfObject) then |
1161 else if (LandGet(y, x+1) = lfObject) then |
1162 Land[y,x]:= lfObject |
1162 LandGet(y,x):= lfObject |
1163 else |
1163 else |
1164 Land[y,x]:= lfBasic; |
1164 LandGet(y,x):= lfBasic; |
1165 } |
1165 } |
1166 end |
1166 end |
1167 else if ((((Land[y, x-1] and lfDamaged) <> 0) and ((Land[y+1,x-1] and lfDamaged) <> 0) and ((Land[y+2,x] and lfDamaged) <> 0)) |
1167 else if ((((LandGet(y, x-1) and lfDamaged) <> 0) and ((LandGet(y+1,x-1) and lfDamaged) <> 0) and ((LandGet(y+2,x) and lfDamaged) <> 0)) |
1168 or (((Land[y, x-1] and lfDamaged) <> 0) and ((Land[y-1,x-1] and lfDamaged) <> 0) and ((Land[y-2,x] and lfDamaged) <> 0)) |
1168 or (((LandGet(y, x-1) and lfDamaged) <> 0) and ((LandGet(y-1,x-1) and lfDamaged) <> 0) and ((LandGet(y-2,x) and lfDamaged) <> 0)) |
1169 or (((Land[y, x+1] and lfDamaged) <> 0) and ((Land[y+1,x+1] and lfDamaged) <> 0) and ((Land[y+2,x] and lfDamaged) <> 0)) |
1169 or (((LandGet(y, x+1) and lfDamaged) <> 0) and ((LandGet(y+1,x+1) and lfDamaged) <> 0) and ((LandGet(y+2,x) and lfDamaged) <> 0)) |
1170 or (((Land[y, x+1] and lfDamaged) <> 0) and ((Land[y-1,x+1] and lfDamaged) <> 0) and ((Land[y-2,x] and lfDamaged) <> 0)) |
1170 or (((LandGet(y, x+1) and lfDamaged) <> 0) and ((LandGet(y-1,x+1) and lfDamaged) <> 0) and ((LandGet(y-2,x) and lfDamaged) <> 0)) |
1171 or (((Land[y+1, x] and lfDamaged) <> 0) and ((Land[y+1,x+1] and lfDamaged) <> 0) and ((Land[y,x+2] and lfDamaged) <> 0)) |
1171 or (((LandGet(y+1, x) and lfDamaged) <> 0) and ((LandGet(y+1,x+1) and lfDamaged) <> 0) and ((LandGet(y,x+2) and lfDamaged) <> 0)) |
1172 or (((Land[y-1, x] and lfDamaged) <> 0) and ((Land[y-1,x+1] and lfDamaged) <> 0) and ((Land[y,x+2] and lfDamaged) <> 0)) |
1172 or (((LandGet(y-1, x) and lfDamaged) <> 0) and ((LandGet(y-1,x+1) and lfDamaged) <> 0) and ((LandGet(y,x+2) and lfDamaged) <> 0)) |
1173 or (((Land[y+1, x] and lfDamaged) <> 0) and ((Land[y+1,x-1] and lfDamaged) <> 0) and ((Land[y,x-2] and lfDamaged) <> 0)) |
1173 or (((LandGet(y+1, x) and lfDamaged) <> 0) and ((LandGet(y+1,x-1) and lfDamaged) <> 0) and ((LandGet(y,x-2) and lfDamaged) <> 0)) |
1174 or (((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 |
1174 or (((LandGet(y-1, x) and lfDamaged) <> 0) and ((LandGet(y-1,x-1) and lfDamaged) <> 0) and ((LandGet(y,x-2) and lfDamaged) <> 0))) then |
1175 begin |
1175 begin |
1176 if (cReducedQuality and rqBlurryLand) = 0 then |
1176 if (cReducedQuality and rqBlurryLand) = 0 then |
1177 begin |
1177 begin |
1178 if ((LandPixels[y,x] and AMask) shr AShift) < 10 then |
1178 if ((LandPixels[y,x] and AMask) shr AShift) < 10 then |
1179 LandPixels[y,x]:= (ExplosionBorderColor and (not AMask)) or (64 shl AShift) |
1179 LandPixels[y,x]:= (ExplosionBorderColor and (not AMask)) or (64 shl AShift) |
1182 (((((LandPixels[y,x] and RMask shr RShift) * 3 div 4)+((ExplosionBorderColor and RMask) shr RShift) div 4) and $FF) shl RShift) or |
1182 (((((LandPixels[y,x] and RMask shr RShift) * 3 div 4)+((ExplosionBorderColor and RMask) shr RShift) div 4) and $FF) shl RShift) or |
1183 (((((LandPixels[y,x] and GMask shr GShift) * 3 div 4)+((ExplosionBorderColor and GMask) shr GShift) div 4) and $FF) shl GShift) or |
1183 (((((LandPixels[y,x] and GMask shr GShift) * 3 div 4)+((ExplosionBorderColor and GMask) shr GShift) div 4) and $FF) shl GShift) or |
1184 (((((LandPixels[y,x] and BMask shr BShift) * 3 div 4)+((ExplosionBorderColor and BMask) shr BShift) div 4) and $FF) shl BShift) or ($FF shl AShift) |
1184 (((((LandPixels[y,x] and BMask shr BShift) * 3 div 4)+((ExplosionBorderColor and BMask) shr BShift) div 4) and $FF) shl BShift) or ($FF shl AShift) |
1185 end; |
1185 end; |
1186 { |
1186 { |
1187 if (Land[y, x-1] = lfObject) then |
1187 if (LandGet(y, x-1) = lfObject) then |
1188 Land[y, x]:= lfObject |
1188 LandGet(y, x):= lfObject |
1189 else if (Land[y, x+1] = lfObject) then |
1189 else if (LandGet(y, x+1) = lfObject) then |
1190 Land[y, x]:= lfObject |
1190 LandGet(y, x):= lfObject |
1191 else if (Land[y+1, x] = lfObject) then |
1191 else if (LandGet(y+1, x) = lfObject) then |
1192 Land[y, x]:= lfObject |
1192 LandGet(y, x):= lfObject |
1193 else if (Land[y-1, x] = lfObject) then |
1193 else if (LandGet(y-1, x) = lfObject) then |
1194 Land[y, x]:= lfObject |
1194 LandGet(y, x):= lfObject |
1195 else Land[y,x]:= lfBasic |
1195 else LandGet(y,x):= lfBasic |
1196 } |
1196 } |
1197 end |
1197 end |
1198 end |
1198 end |
1199 else if ((cReducedQuality and rqBlurryLand) = 0) and ((LandPixels[Y, X] and AMask) = AMask) |
1199 else if ((cReducedQuality and rqBlurryLand) = 0) and ((LandPixels[Y, X] and AMask) = AMask) |
1200 and (Land[Y, X] and (lfDamaged or lfBasic) = lfBasic) |
1200 and (LandGet(Y, X) and (lfDamaged or lfBasic) = lfBasic) |
1201 and (Y > topY + 1) and (Y < LAND_HEIGHT-2) and (X > leftX + 1) and (X < rightX - 1) then |
1201 and (Y > topY + 1) and (Y < LAND_HEIGHT-2) and (X > leftX + 1) and (X < rightX - 1) then |
1202 begin |
1202 begin |
1203 if ((((Land[y, x-1] and lfDamaged) <> 0) and (((Land[y+1,x] and lfDamaged) <> 0)) or ((Land[y-1,x] and lfDamaged) <> 0)) |
1203 if ((((LandGet(y, x-1) and lfDamaged) <> 0) and (((LandGet(y+1,x) and lfDamaged) <> 0)) or ((LandGet(y-1,x) and lfDamaged) <> 0)) |
1204 or (((Land[y, x+1] and lfDamaged) <> 0) and (((Land[y-1,x] and lfDamaged) <> 0) or ((Land[y+1,x] and lfDamaged) <> 0)))) then |
1204 or (((LandGet(y, x+1) and lfDamaged) <> 0) and (((LandGet(y-1,x) and lfDamaged) <> 0) or ((LandGet(y+1,x) and lfDamaged) <> 0)))) then |
1205 begin |
1205 begin |
1206 LandPixels[y,x]:= |
1206 LandPixels[y,x]:= |
1207 (((((LandPixels[y,x] and RMask shr RShift) div 2)+((ExplosionBorderColor and RMask) shr RShift) div 2) and $FF) shl RShift) or |
1207 (((((LandPixels[y,x] and RMask shr RShift) div 2)+((ExplosionBorderColor and RMask) shr RShift) div 2) and $FF) shl RShift) or |
1208 (((((LandPixels[y,x] and GMask shr GShift) div 2)+((ExplosionBorderColor and GMask) shr GShift) div 2) and $FF) shl GShift) or |
1208 (((((LandPixels[y,x] and GMask shr GShift) div 2)+((ExplosionBorderColor and GMask) shr GShift) div 2) and $FF) shl GShift) or |
1209 (((((LandPixels[y,x] and BMask shr BShift) div 2)+((ExplosionBorderColor and BMask) shr BShift) div 2) and $FF) shl BShift) or ($FF shl AShift) |
1209 (((((LandPixels[y,x] and BMask shr BShift) div 2)+((ExplosionBorderColor and BMask) shr BShift) div 2) and $FF) shl BShift) or ($FF shl AShift) |
1210 end |
1210 end |
1211 else if ((((Land[y, x-1] and lfDamaged) <> 0) and ((Land[y+1,x-1] and lfDamaged) <> 0) and ((Land[y+2,x] and lfDamaged) <> 0)) |
1211 else if ((((LandGet(y, x-1) and lfDamaged) <> 0) and ((LandGet(y+1,x-1) and lfDamaged) <> 0) and ((LandGet(y+2,x) and lfDamaged) <> 0)) |
1212 or (((Land[y, x-1] and lfDamaged) <> 0) and ((Land[y-1,x-1] and lfDamaged) <> 0) and ((Land[y-2,x] and lfDamaged) <> 0)) |
1212 or (((LandGet(y, x-1) and lfDamaged) <> 0) and ((LandGet(y-1,x-1) and lfDamaged) <> 0) and ((LandGet(y-2,x) and lfDamaged) <> 0)) |
1213 or (((Land[y, x+1] and lfDamaged) <> 0) and ((Land[y+1,x+1] and lfDamaged) <> 0) and ((Land[y+2,x] and lfDamaged) <> 0)) |
1213 or (((LandGet(y, x+1) and lfDamaged) <> 0) and ((LandGet(y+1,x+1) and lfDamaged) <> 0) and ((LandGet(y+2,x) and lfDamaged) <> 0)) |
1214 or (((Land[y, x+1] and lfDamaged) <> 0) and ((Land[y-1,x+1] and lfDamaged) <> 0) and ((Land[y-2,x] and lfDamaged) <> 0)) |
1214 or (((LandGet(y, x+1) and lfDamaged) <> 0) and ((LandGet(y-1,x+1) and lfDamaged) <> 0) and ((LandGet(y-2,x) and lfDamaged) <> 0)) |
1215 or (((Land[y+1, x] and lfDamaged) <> 0) and ((Land[y+1,x+1] and lfDamaged) <> 0) and ((Land[y,x+2] and lfDamaged) <> 0)) |
1215 or (((LandGet(y+1, x) and lfDamaged) <> 0) and ((LandGet(y+1,x+1) and lfDamaged) <> 0) and ((LandGet(y,x+2) and lfDamaged) <> 0)) |
1216 or (((Land[y-1, x] and lfDamaged) <> 0) and ((Land[y-1,x+1] and lfDamaged) <> 0) and ((Land[y,x+2] and lfDamaged) <> 0)) |
1216 or (((LandGet(y-1, x) and lfDamaged) <> 0) and ((LandGet(y-1,x+1) and lfDamaged) <> 0) and ((LandGet(y,x+2) and lfDamaged) <> 0)) |
1217 or (((Land[y+1, x] and lfDamaged) <> 0) and ((Land[y+1,x-1] and lfDamaged) <> 0) and ((Land[y,x-2] and lfDamaged) <> 0)) |
1217 or (((LandGet(y+1, x) and lfDamaged) <> 0) and ((LandGet(y+1,x-1) and lfDamaged) <> 0) and ((LandGet(y,x-2) and lfDamaged) <> 0)) |
1218 or (((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 |
1218 or (((LandGet(y-1, x) and lfDamaged) <> 0) and ((LandGet(y-1,x-1) and lfDamaged) <> 0) and ((LandGet(y,x-2) and lfDamaged) <> 0))) then |
1219 begin |
1219 begin |
1220 LandPixels[y,x]:= |
1220 LandPixels[y,x]:= |
1221 (((((LandPixels[y,x] and RMask shr RShift) * 3 div 4)+((ExplosionBorderColor and RMask) shr RShift) div 4) and $FF) shl RShift) or |
1221 (((((LandPixels[y,x] and RMask shr RShift) * 3 div 4)+((ExplosionBorderColor and RMask) shr RShift) div 4) and $FF) shl RShift) or |
1222 (((((LandPixels[y,x] and GMask shr GShift) * 3 div 4)+((ExplosionBorderColor and GMask) shr GShift) div 4) and $FF) shl GShift) or |
1222 (((((LandPixels[y,x] and GMask shr GShift) * 3 div 4)+((ExplosionBorderColor and GMask) shr GShift) div 4) and $FF) shl GShift) or |
1223 (((((LandPixels[y,x] and BMask shr BShift) * 3 div 4)+((ExplosionBorderColor and BMask) shr BShift) div 4) and $FF) shl BShift) or ($FF shl AShift) |
1223 (((((LandPixels[y,x] and BMask shr BShift) * 3 div 4)+((ExplosionBorderColor and BMask) shr BShift) div 4) and $FF) shl BShift) or ($FF shl AShift) |
1380 dec(eY, d); |
1380 dec(eY, d); |
1381 inc(y, sY); |
1381 inc(y, sY); |
1382 end; |
1382 end; |
1383 |
1383 |
1384 if ((x and LAND_WIDTH_MASK) = 0) and ((y and LAND_HEIGHT_MASK) = 0) then |
1384 if ((x and LAND_WIDTH_MASK) = 0) and ((y and LAND_HEIGHT_MASK) = 0) then |
1385 Land[y, x]:= Color; |
1385 LandSet(y, x, Color); |
1386 end |
1386 end |
1387 end; |
1387 end; |
1388 |
1388 |
1389 function DrawDots(x, y, xx, yy: Longint; Color: Longword): Longword; inline; |
1389 function DrawDots(x, y, xx, yy: Longint; Color: Longword): Longword; |
1390 begin |
1390 begin |
1391 DrawDots:= 0; |
1391 DrawDots:= 0; |
1392 |
1392 |
1393 if (((x + xx) and LAND_WIDTH_MASK) = 0) and (((y + yy) and LAND_HEIGHT_MASK) = 0) and (Land[y + yy, x + xx] <> Color) then |
1393 if (((x + xx) and LAND_WIDTH_MASK) = 0) and (((y + yy) and LAND_HEIGHT_MASK) = 0) and (LandGet(y + yy, x + xx) <> Color) then |
1394 begin inc(DrawDots); Land[y + yy, x + xx]:= Color; end; |
1394 begin inc(DrawDots); LandSet(y + yy, x + xx, Color); end; |
1395 if (((x + xx) and LAND_WIDTH_MASK) = 0) and (((y - yy) and LAND_HEIGHT_MASK) = 0) and (Land[y - yy, x + xx] <> Color) then |
1395 if (((x + xx) and LAND_WIDTH_MASK) = 0) and (((y - yy) and LAND_HEIGHT_MASK) = 0) and (LandGet(y - yy, x + xx) <> Color) then |
1396 begin inc(DrawDots); Land[y - yy, x + xx]:= Color; end; |
1396 begin inc(DrawDots); LandSet(y - yy, x + xx, Color); end; |
1397 if (((x - xx) and LAND_WIDTH_MASK) = 0) and (((y + yy) and LAND_HEIGHT_MASK) = 0) and (Land[y + yy, x - xx] <> Color) then |
1397 if (((x - xx) and LAND_WIDTH_MASK) = 0) and (((y + yy) and LAND_HEIGHT_MASK) = 0) and (LandGet(y + yy, x - xx) <> Color) then |
1398 begin inc(DrawDots); Land[y + yy, x - xx]:= Color; end; |
1398 begin inc(DrawDots); LandSet(y + yy, x - xx, Color); end; |
1399 if (((x - xx) and LAND_WIDTH_MASK) = 0) and (((y - yy) and LAND_HEIGHT_MASK) = 0) and (Land[y - yy, x - xx] <> Color) then |
1399 if (((x - xx) and LAND_WIDTH_MASK) = 0) and (((y - yy) and LAND_HEIGHT_MASK) = 0) and (LandGet(y - yy, x - xx) <> Color) then |
1400 begin inc(DrawDots); Land[y - yy, x - xx]:= Color; end; |
1400 begin inc(DrawDots); LandSet(y - yy, x - xx, Color); end; |
1401 if (((x + yy) and LAND_WIDTH_MASK) = 0) and (((y + xx) and LAND_HEIGHT_MASK) = 0) and (Land[y + xx, x + yy] <> Color) then |
1401 if (((x + yy) and LAND_WIDTH_MASK) = 0) and (((y + xx) and LAND_HEIGHT_MASK) = 0) and (LandGet(y + xx, x + yy) <> Color) then |
1402 begin inc(DrawDots); Land[y + xx, x + yy]:= Color; end; |
1402 begin inc(DrawDots); LandSet(y + xx, x + yy, Color); end; |
1403 if (((x + yy) and LAND_WIDTH_MASK) = 0) and (((y - xx) and LAND_HEIGHT_MASK) = 0) and (Land[y - xx, x + yy] <> Color) then |
1403 if (((x + yy) and LAND_WIDTH_MASK) = 0) and (((y - xx) and LAND_HEIGHT_MASK) = 0) and (LandGet(y - xx, x + yy) <> Color) then |
1404 begin inc(DrawDots); Land[y - xx, x + yy]:= Color; end; |
1404 begin inc(DrawDots); LandSet(y - xx, x + yy, Color); end; |
1405 if (((x - yy) and LAND_WIDTH_MASK) = 0) and (((y + xx) and LAND_HEIGHT_MASK) = 0) and (Land[y + xx, x - yy] <> Color) then |
1405 if (((x - yy) and LAND_WIDTH_MASK) = 0) and (((y + xx) and LAND_HEIGHT_MASK) = 0) and (LandGet(y + xx, x - yy) <> Color) then |
1406 begin inc(DrawDots); Land[y + xx, x - yy]:= Color; end; |
1406 begin inc(DrawDots); LandSet(y + xx, x - yy, Color); end; |
1407 if (((x - yy) and LAND_WIDTH_MASK) = 0) and (((y - xx) and LAND_HEIGHT_MASK) = 0) and (Land[y - xx, x - yy] <> Color) then |
1407 if (((x - yy) and LAND_WIDTH_MASK) = 0) and (((y - xx) and LAND_HEIGHT_MASK) = 0) and (LandGet(y - xx, x - yy) <> Color) then |
1408 begin inc(DrawDots); Land[y - xx, x - yy]:= Color; end; |
1408 begin inc(DrawDots); LandSet(y - xx, x - yy, Color); end; |
1409 end; |
1409 end; |
1410 |
1410 |
1411 function DrawLines(X1, Y1, X2, Y2, XX, YY: LongInt; color: Longword): Longword; |
1411 function DrawLines(X1, Y1, X2, Y2, XX, YY: LongInt; color: Longword): Longword; |
1412 var |
1412 var |
1413 eX, eY, dX, dY: LongInt; |
1413 eX, eY, dX, dY: LongInt; |