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 not isMap or ((Land[t, i] and lfObject) <> 0) then |
201 else |
202 begin |
202 if ((Land[t, i] and lfObject) <> 0) then |
203 if (cReducedQuality and rqBlurryLand) = 0 then |
203 if (cReducedQuality and rqBlurryLand) = 0 then |
204 LandPixels[t, i]:= 0 |
204 LandPixels[t, i]:= 0 |
205 else |
205 else |
206 LandPixels[t div 2, i div 2]:= 0 |
206 LandPixels[t div 2, i div 2]:= 0; |
207 end; |
|
208 |
207 |
209 t:= y - dy; |
208 t:= y - dy; |
210 if (t and LAND_HEIGHT_MASK) = 0 then |
209 if (t and LAND_HEIGHT_MASK) = 0 then |
211 for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do |
210 for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do |
212 if ((Land[t, i] and lfBasic) <> 0) then |
211 if ((Land[t, i] and lfBasic) <> 0) then |
215 if (cReducedQuality and rqBlurryLand) = 0 then |
214 if (cReducedQuality and rqBlurryLand) = 0 then |
216 LandPixels[t, i]:= LandBackPixel(i, t) |
215 LandPixels[t, i]:= LandBackPixel(i, t) |
217 else |
216 else |
218 LandPixels[t div 2, i div 2]:= LandBackPixel(i, t) |
217 LandPixels[t div 2, i div 2]:= LandBackPixel(i, t) |
219 end |
218 end |
220 else if not isMap or ((Land[t, i] and lfObject) <> 0) then |
219 else |
|
220 if ((Land[t, i] and lfObject) <> 0) then |
|
221 if (cReducedQuality and rqBlurryLand) = 0 then |
|
222 LandPixels[t, i]:= 0 |
|
223 else |
|
224 LandPixels[t div 2, i div 2]:= 0; |
|
225 |
|
226 t:= y + dx; |
|
227 if (t and LAND_HEIGHT_MASK) = 0 then |
|
228 for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do |
|
229 if ((Land[t, i] and lfBasic) <> 0) then |
221 begin |
230 begin |
|
231 inc(cnt); |
222 if (cReducedQuality and rqBlurryLand) = 0 then |
232 if (cReducedQuality and rqBlurryLand) = 0 then |
223 LandPixels[t, i]:= 0 |
233 LandPixels[t, i]:= LandBackPixel(i, t) |
224 else |
234 else |
225 LandPixels[t div 2, i div 2]:= 0 |
235 LandPixels[t div 2, i div 2]:= LandBackPixel(i, t) |
226 end; |
236 end |
227 |
237 else |
228 t:= y + dx; |
238 if ((Land[t, i] and lfObject) <> 0) then |
|
239 if (cReducedQuality and rqBlurryLand) = 0 then |
|
240 LandPixels[t, i]:= 0 |
|
241 else |
|
242 LandPixels[t div 2, i div 2]:= 0; |
|
243 |
|
244 t:= y - dx; |
229 if (t and LAND_HEIGHT_MASK) = 0 then |
245 if (t and LAND_HEIGHT_MASK) = 0 then |
230 for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do |
246 for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do |
231 if ((Land[t, i] and lfBasic) <> 0) then |
247 if ((Land[t, i] and lfBasic) <> 0) then |
232 begin |
248 begin |
233 inc(cnt); |
249 inc(cnt); |
234 if (cReducedQuality and rqBlurryLand) = 0 then |
250 if (cReducedQuality and rqBlurryLand) = 0 then |
235 LandPixels[t, i]:= LandBackPixel(i, t) |
251 LandPixels[t, i]:= LandBackPixel(i, t) |
236 else |
252 else |
237 LandPixels[t div 2, i div 2]:= LandBackPixel(i, t) |
253 LandPixels[t div 2, i div 2]:= LandBackPixel(i, t) |
238 end |
254 end |
239 else if not isMap or ((Land[t, i] and lfObject) <> 0) then |
255 else |
240 begin |
256 if ((Land[t, i] and lfObject) <> 0) then |
241 if (cReducedQuality and rqBlurryLand) = 0 then |
257 if (cReducedQuality and rqBlurryLand) = 0 then |
242 LandPixels[t, i]:= 0 |
258 LandPixels[t, i]:= 0 |
243 else |
259 else |
244 LandPixels[t div 2, i div 2]:= 0 |
260 LandPixels[t div 2, i div 2]:= 0; |
245 end; |
|
246 |
|
247 t:= y - dx; |
|
248 if (t and LAND_HEIGHT_MASK) = 0 then |
|
249 for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do |
|
250 if ((Land[t, i] and lfBasic) <> 0) then |
|
251 begin |
|
252 inc(cnt); |
|
253 if (cReducedQuality and rqBlurryLand) = 0 then |
|
254 LandPixels[t, i]:= LandBackPixel(i, t) |
|
255 else |
|
256 LandPixels[t div 2, i div 2]:= LandBackPixel(i, t) |
|
257 end |
|
258 else if not isMap or ((Land[t, i] and lfObject) <> 0) then |
|
259 begin |
|
260 if (cReducedQuality and rqBlurryLand) = 0 then |
|
261 LandPixels[t, i]:= 0 |
|
262 else |
|
263 LandPixels[t div 2, i div 2]:= 0 |
|
264 end; |
|
265 FillLandCircleLinesBG:= cnt; |
261 FillLandCircleLinesBG:= cnt; |
266 end; |
262 end; |
267 |
263 |
268 procedure FillLandCircleLinesEBC(x, y, dx, dy: LongInt); |
264 procedure FillLandCircleLinesEBC(x, y, dx, dy: LongInt); |
269 var i, t: LongInt; |
265 var i, t: LongInt; |
270 begin |
266 begin |
271 t:= y + dy; |
267 t:= y + dy; |
272 if (t and LAND_HEIGHT_MASK) = 0 then |
268 if (t and LAND_HEIGHT_MASK) = 0 then |
273 for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do |
269 for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do |
274 if (Land[t, i] and (lfBasic or lfObject)) <> 0 then |
270 if ((Land[t, i] and lfBasic) <> 0) or ((Land[t, i] and lfObject) <> 0) then |
275 begin |
271 begin |
276 if (cReducedQuality and rqBlurryLand) = 0 then |
272 if (cReducedQuality and rqBlurryLand) = 0 then |
277 LandPixels[t, i]:= cExplosionBorderColor |
273 LandPixels[t, i]:= cExplosionBorderColor |
278 else |
274 else |
279 LandPixels[t div 2, i div 2]:= cExplosionBorderColor; |
275 LandPixels[t div 2, i div 2]:= cExplosionBorderColor; |
416 if (Land[ty, tx] and lfBasic) <> 0 then |
412 if (Land[ty, tx] and lfBasic) <> 0 then |
417 if (cReducedQuality and rqBlurryLand) = 0 then |
413 if (cReducedQuality and rqBlurryLand) = 0 then |
418 LandPixels[ty, tx]:= LandBackPixel(tx, ty) |
414 LandPixels[ty, tx]:= LandBackPixel(tx, ty) |
419 else |
415 else |
420 LandPixels[ty div 2, tx div 2]:= LandBackPixel(tx, ty) |
416 LandPixels[ty div 2, tx div 2]:= LandBackPixel(tx, ty) |
421 else if not isMap then |
417 else |
422 begin |
418 if (Land[ty, tx] and lfObject) <> 0 then |
423 if (cReducedQuality and rqBlurryLand) = 0 then |
419 if (cReducedQuality and rqBlurryLand) = 0 then |
424 LandPixels[ty, tx]:= 0 |
420 LandPixels[ty, tx]:= 0 |
425 else |
421 else |
426 LandPixels[ty div 2, tx div 2]:= 0 |
422 LandPixels[ty div 2, tx div 2]:= 0; |
427 end; |
|
428 inc(y, dY) |
423 inc(y, dY) |
429 end; |
424 end; |
430 |
425 |
431 inc(Radius, 4); |
426 inc(Radius, 4); |
432 dec(y, Count * dY); |
427 dec(y, Count * dY); |
433 |
428 |
434 for i:= 0 to Pred(Count) do |
429 for i:= 0 to Pred(Count) do |
435 begin |
430 begin |
436 for ty:= Max(y - Radius, 0) to Min(y + Radius, LAND_HEIGHT) do |
431 for ty:= Max(y - Radius, 0) to Min(y + Radius, LAND_HEIGHT) do |
437 for tx:= Max(0, ar^[i].Left - Radius) to Min(LAND_WIDTH, ar^[i].Right + Radius) do |
432 for tx:= Max(0, ar^[i].Left - Radius) to Min(LAND_WIDTH, ar^[i].Right + Radius) do |
438 if (Land[ty, tx] and (lfBasic or lfObject)) <> 0 then |
433 if ((Land[ty, tx] and lfBasic) <> 0) or ((Land[ty, tx] and lfObject) <> 0) then |
439 begin |
434 begin |
440 if (cReducedQuality and rqBlurryLand) = 0 then |
435 if (cReducedQuality and rqBlurryLand) = 0 then |
441 LandPixels[ty, tx]:= cExplosionBorderColor |
436 LandPixels[ty, tx]:= cExplosionBorderColor |
442 else |
437 else |
443 LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor; |
438 LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor; |
477 Y:= Y + dY; |
472 Y:= Y + dY; |
478 tx:= hwRound(X); |
473 tx:= hwRound(X); |
479 ty:= hwRound(Y); |
474 ty:= hwRound(Y); |
480 if ((ty and LAND_HEIGHT_MASK) = 0) and |
475 if ((ty and LAND_HEIGHT_MASK) = 0) and |
481 ((tx and LAND_WIDTH_MASK) = 0) and |
476 ((tx and LAND_WIDTH_MASK) = 0) and |
482 ((Land[ty, tx] and (lfBasic or lfObject)) <> 0) then |
477 (((Land[ty, tx] and lfBasic) <> 0) or |
|
478 ((Land[ty, tx] and lfObject) <> 0)) then |
483 begin |
479 begin |
484 Land[ty, tx]:= Land[ty, tx] or lfDamaged; |
480 Land[ty, tx]:= Land[ty, tx] or lfDamaged; |
485 if (cReducedQuality and rqBlurryLand) = 0 then |
481 if (cReducedQuality and rqBlurryLand) = 0 then |
486 LandPixels[ty, tx]:= cExplosionBorderColor |
482 LandPixels[ty, tx]:= cExplosionBorderColor |
487 else |
483 else |
488 LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor |
484 LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor |
489 end |
485 end |
490 end; |
486 end; |
491 nx:= nx - dY; |
487 nx:= nx - dY; |
492 ny:= ny + dX; |
488 ny:= ny + dX; |
502 Y:= Y + dY; |
498 Y:= Y + dY; |
503 tx:= hwRound(X); |
499 tx:= hwRound(X); |
504 ty:= hwRound(Y); |
500 ty:= hwRound(Y); |
505 if ((ty and LAND_HEIGHT_MASK) = 0) and |
501 if ((ty and LAND_HEIGHT_MASK) = 0) and |
506 ((tx and LAND_WIDTH_MASK) = 0) and |
502 ((tx and LAND_WIDTH_MASK) = 0) and |
507 ((Land[ty, tx] and (lfBasic or lfObject)) <> 0) then |
503 (((Land[ty, tx] and lfBasic) <> 0) or |
|
504 ((Land[ty, tx] and lfObject) <> 0)) then |
508 begin |
505 begin |
509 Land[ty, tx]:= Land[ty, tx] or lfDamaged; |
506 Land[ty, tx]:= Land[ty, tx] or lfDamaged; |
510 if (cReducedQuality and rqBlurryLand) = 0 then |
507 if (cReducedQuality and rqBlurryLand) = 0 then |
511 LandPixels[ty, tx]:= cExplosionBorderColor |
508 LandPixels[ty, tx]:= cExplosionBorderColor |
512 else |
509 else |
513 LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor |
510 LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor |
|
511 |
514 end |
512 end |
515 end; |
513 end; |
516 X:= nx; |
514 X:= nx; |
517 Y:= ny; |
515 Y:= ny; |
518 for t:= 0 to ticks do |
516 for t:= 0 to ticks do |
526 if (Land[ty, tx] and lfBasic) <> 0 then |
524 if (Land[ty, tx] and lfBasic) <> 0 then |
527 if (cReducedQuality and rqBlurryLand) = 0 then |
525 if (cReducedQuality and rqBlurryLand) = 0 then |
528 LandPixels[ty, tx]:= LandBackPixel(tx, ty) |
526 LandPixels[ty, tx]:= LandBackPixel(tx, ty) |
529 else |
527 else |
530 LandPixels[ty div 2, tx div 2]:= LandBackPixel(tx, ty) |
528 LandPixels[ty div 2, tx div 2]:= LandBackPixel(tx, ty) |
531 else if not isMap or ((Land[ty, tx] and lfObject) <> 0) then |
529 else |
532 begin |
530 if (Land[ty, tx] and lfObject) <> 0 then |
533 if (cReducedQuality and rqBlurryLand) = 0 then |
531 if (cReducedQuality and rqBlurryLand) = 0 then |
534 LandPixels[ty, tx]:= 0 |
532 LandPixels[ty, tx]:= 0 |
535 else |
533 else |
536 LandPixels[ty div 2, tx div 2]:= 0 |
534 LandPixels[ty div 2, tx div 2]:= 0; |
537 end; |
|
538 |
535 |
539 Land[ty, tx]:= 0; |
536 Land[ty, tx]:= 0; |
540 end |
537 end |
541 end; |
538 end; |
542 for t:= 0 to 7 do |
539 for t:= 0 to 7 do |
545 Y:= Y + dY; |
542 Y:= Y + dY; |
546 tx:= hwRound(X); |
543 tx:= hwRound(X); |
547 ty:= hwRound(Y); |
544 ty:= hwRound(Y); |
548 if ((ty and LAND_HEIGHT_MASK) = 0) and |
545 if ((ty and LAND_HEIGHT_MASK) = 0) and |
549 ((tx and LAND_WIDTH_MASK) = 0) and |
546 ((tx and LAND_WIDTH_MASK) = 0) and |
550 ((Land[ty, tx] and (lfBasic or lfObject)) <> 0) then |
547 (((Land[ty, tx] and lfBasic) <> 0) or |
|
548 ((Land[ty, tx] and lfObject) <> 0)) then |
551 begin |
549 begin |
552 Land[ty, tx]:= Land[ty, tx] or lfDamaged; |
550 Land[ty, tx]:= Land[ty, tx] or lfDamaged; |
553 if (cReducedQuality and rqBlurryLand) = 0 then |
551 if (cReducedQuality and rqBlurryLand) = 0 then |
554 LandPixels[ty, tx]:= cExplosionBorderColor |
552 LandPixels[ty, tx]:= cExplosionBorderColor |
555 else |
553 else |
556 LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor |
554 LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor |
|
555 |
557 end |
556 end |
558 end; |
557 end; |
559 nx:= nx - dY; |
558 nx:= nx - dY; |
560 ny:= ny + dX; |
559 ny:= ny + dX; |
561 end; |
560 end; |
570 Y:= Y + dY; |
569 Y:= Y + dY; |
571 tx:= hwRound(X); |
570 tx:= hwRound(X); |
572 ty:= hwRound(Y); |
571 ty:= hwRound(Y); |
573 if ((ty and LAND_HEIGHT_MASK) = 0) and |
572 if ((ty and LAND_HEIGHT_MASK) = 0) and |
574 ((tx and LAND_WIDTH_MASK) = 0) and |
573 ((tx and LAND_WIDTH_MASK) = 0) and |
575 ((Land[ty, tx] and (lfBasic or lfObject)) <> 0) then |
574 (((Land[ty, tx] and lfBasic) <> 0) or |
|
575 ((Land[ty, tx] and lfObject) <> 0)) then |
576 begin |
576 begin |
577 Land[ty, tx]:= Land[ty, tx] or lfDamaged; |
577 Land[ty, tx]:= Land[ty, tx] or lfDamaged; |
578 if (cReducedQuality and rqBlurryLand) = 0 then |
578 if (cReducedQuality and rqBlurryLand) = 0 then |
579 LandPixels[ty, tx]:= cExplosionBorderColor |
579 LandPixels[ty, tx]:= cExplosionBorderColor |
580 else |
580 else |
581 LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor |
581 LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor |
582 end |
582 end |
583 end; |
583 end; |
584 nx:= nx - dY; |
584 nx:= nx - dY; |
585 ny:= ny + dX; |
585 ny:= ny + dX; |
586 end; |
586 end; |
668 UpdateLandTexture(x, w, y, h) |
668 UpdateLandTexture(x, w, y, h) |
669 end; |
669 end; |
670 |
670 |
671 // was experimenting with applying as damage occurred. |
671 // was experimenting with applying as damage occurred. |
672 function Despeckle(X, Y: LongInt): boolean; |
672 function Despeckle(X, Y: LongInt): boolean; |
673 var nx, ny, i, j, c, xx, yy: LongInt; |
673 var nx, ny, i, j, c: LongInt; |
674 pixelsweep: boolean; |
674 begin |
675 begin |
675 if ((Land[Y, X] and lfDamaged) <> 0) and ((Land[Y, X] and lfIndestructible) = 0) then // check neighbours |
676 if (cReducedQuality and rqBlurryLand) = 0 then |
|
677 begin |
|
678 xx:= X; |
|
679 yy:= Y; |
|
680 end |
|
681 else |
|
682 begin |
|
683 xx:= X div 2; |
|
684 yy:= Y div 2; |
|
685 end; |
|
686 pixelsweep:= not isMap and ((Land[Y, X] and $FF00) = 0) and (LandPixels[yy, xx] <> 0); |
|
687 if (((Land[Y, X] and lfDamaged) <> 0) and ((Land[Y, X] and lfIndestructible) = 0)) or pixelsweep then |
|
688 begin |
676 begin |
689 c:= 0; |
677 c:= 0; |
690 for i:= -1 to 1 do |
678 for i:= -1 to 1 do |
691 for j:= -1 to 1 do |
679 for j:= -1 to 1 do |
692 if (i <> 0) or (j <> 0) then |
680 if (i <> 0) or (j <> 0) then |
693 begin |
681 begin |
694 ny:= Y + i; |
682 ny:= Y + i; |
695 nx:= X + j; |
683 nx:= X + j; |
696 if ((ny and LAND_HEIGHT_MASK) = 0) and ((nx and LAND_WIDTH_MASK) = 0) then |
684 if ((ny and LAND_HEIGHT_MASK) = 0) and ((nx and LAND_WIDTH_MASK) = 0) then |
697 begin |
685 if Land[ny, nx] > 255 then |
698 if pixelsweep then |
686 inc(c); |
699 begin |
|
700 if ((cReducedQuality and rqBlurryLand) <> 0) then |
|
701 begin |
|
702 nx:= nx div 2; |
|
703 ny:= ny div 2 |
|
704 end; |
|
705 if LandPixels[ny, nx] <> 0 then inc(c); |
|
706 end |
|
707 else if Land[ny, nx] > 255 then inc(c); |
|
708 end |
|
709 end; |
687 end; |
710 |
688 |
711 if c < 4 then // 0-3 neighbours |
689 if c < 4 then // 0-3 neighbours |
712 begin |
690 begin |
|
691 if (cReducedQuality and rqBlurryLand) = 0 then |
713 if (Land[Y, X] and lfBasic) <> 0 then |
692 if (Land[Y, X] and lfBasic) <> 0 then |
714 LandPixels[yy, xx]:= LandBackPixel(X, Y) |
693 LandPixels[Y, X]:= LandBackPixel(X, Y) |
715 else LandPixels[yy, xx]:= 0; |
694 else |
|
695 LandPixels[Y, X]:= 0 |
|
696 else |
|
697 if (Land[Y, X] and lfBasic) <> 0 then |
|
698 LandPixels[Y div 2, X div 2]:= LandBackPixel(X, Y) |
|
699 else |
|
700 LandPixels[Y div 2, X div 2]:= 0; |
716 |
701 |
717 Land[Y, X]:= 0; |
702 Land[Y, X]:= 0; |
718 exit(true); |
703 exit(true); |
719 end; |
704 end; |
720 end; |
705 end; |