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 procedure DrawThickLine(X1, Y1, X2, Y2, radius: LongInt; color: Longword); |
47 procedure DrawThickLine(X1, Y1, X2, Y2, radius: LongInt; color: 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 TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace: boolean; indestructible: boolean): boolean; |
50 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace, indestructible: boolean): boolean; inline; |
|
51 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace, indestructible: boolean; LandFlags: Word): boolean; |
51 |
52 |
52 implementation |
53 implementation |
53 uses SDLh, uLandTexture, uVariables, uUtils, uDebug; |
54 uses SDLh, uLandTexture, uVariables, uUtils, uDebug; |
54 |
55 |
55 |
56 |
583 ddy:= Min(stY + HalfWidth * 2 + 4 + abs(hwRound(dY * ticks)), LAND_HEIGHT) - ty; |
584 ddy:= Min(stY + HalfWidth * 2 + 4 + abs(hwRound(dY * ticks)), LAND_HEIGHT) - ty; |
584 |
585 |
585 UpdateLandTexture(tx, ddx, ty, ddy, false) |
586 UpdateLandTexture(tx, ddx, ty, ddy, false) |
586 end; |
587 end; |
587 |
588 |
588 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace: boolean; indestructible: boolean): boolean; |
589 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace, indestructible: boolean): boolean; inline; |
|
590 begin |
|
591 TryPlaceOnLand:= TryPlaceOnLand(cpX, cpY, Obj, Frame, doPlace, indestructible, 0); |
|
592 end; |
|
593 |
|
594 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace, indestructible: boolean; LandFlags: Word): boolean; |
589 var X, Y, bpp, h, w, row, col, gx, gy, numFramesFirstCol: LongInt; |
595 var X, Y, bpp, h, w, row, col, gx, gy, numFramesFirstCol: LongInt; |
590 p: PByteArray; |
596 p: PByteArray; |
591 Image: PSDL_Surface; |
597 Image: PSDL_Surface; |
592 begin |
598 begin |
593 TryPlaceOnLand:= false; |
599 TryPlaceOnLand:= false; |
648 begin |
654 begin |
649 gX:= (cpX + x) div 2; |
655 gX:= (cpX + x) div 2; |
650 gY:= (cpY + y) div 2; |
656 gY:= (cpY + y) div 2; |
651 end; |
657 end; |
652 if indestructible then |
658 if indestructible then |
653 Land[cpY + y, cpX + x]:= lfIndestructible |
659 Land[cpY + y, cpX + x]:= lfIndestructible or LandFlags |
654 else if (LandPixels[gY, gX] and AMask) shr AShift = 255 then // This test assumes lfBasic and lfObject differ only graphically |
660 else if (LandPixels[gY, gX] and AMask) shr AShift = 255 then // This test assumes lfBasic and lfObject differ only graphically |
655 Land[cpY + y, cpX + x]:= lfBasic |
661 Land[cpY + y, cpX + x]:= lfBasic or LandFlags |
656 else |
662 else |
657 Land[cpY + y, cpX + x]:= lfObject; |
663 Land[cpY + y, cpX + x]:= lfObject or LandFlags; |
658 // For testing only. Intent is to flag this on objects with masks, or use it for an ice ray gun |
664 LandPixels[gY, gX]:= PLongword(@(p^[x * 4]))^ |
659 if (Theme = 'Snow') or (Theme = 'Christmas') then |
|
660 Land[cpY + y, cpX + x]:= Land[cpY + y, cpX + x] or lfIce; |
|
661 LandPixels[gY, gX]:= PLongword(@(p^[x * 4]))^ |
|
662 end; |
665 end; |
663 p:= @(p^[Image^.pitch]); |
666 p:= @(p^[Image^.pitch]); |
664 end; |
667 end; |
665 end; |
668 end; |
666 if SDL_MustLock(Image) then |
669 if SDL_MustLock(Image) then |