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 TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace, indestructible: boolean): boolean; inline; |
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 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace: boolean; LandFlags: Word): boolean; |
52 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace, indestructible, outOfMap: boolean; LandFlags: Word): boolean; |
52 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace, outOfMap: boolean; LandFlags: Word): boolean; |
53 function GetPlaceCollisionTex(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt): PTexture; |
53 function GetPlaceCollisionTex(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt): PTexture; |
54 |
54 |
55 implementation |
55 implementation |
56 uses SDLh, uLandTexture, uTextures, uVariables, uUtils, uDebug; |
56 uses SDLh, uLandTexture, uTextures, uVariables, uUtils, uDebug; |
57 |
57 |
605 |
605 |
606 UpdateLandTexture(tx, ddx, ty, ddy, false) |
606 UpdateLandTexture(tx, ddx, ty, ddy, false) |
607 end; |
607 end; |
608 |
608 |
609 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace, indestructible: boolean): boolean; inline; |
609 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace, indestructible: boolean): boolean; inline; |
610 begin |
610 var lf: LongWord; |
611 TryPlaceOnLand:= TryPlaceOnLand(cpX, cpY, Obj, Frame, doPlace, indestructible, false, 0); |
611 begin |
612 end; |
612 if indestructible then |
613 |
613 lf:= lfIndestructible |
614 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace, indestructible: boolean; LandFlags: Word): boolean; |
614 else |
615 begin |
615 lf:= 0; |
616 TryPlaceOnLand:= TryPlaceOnLand(cpX, cpY, Obj, Frame, doPlace, indestructible, false, LandFlags); |
616 TryPlaceOnLand:= TryPlaceOnLand(cpX, cpY, Obj, Frame, doPlace, false, lf); |
617 end; |
617 end; |
618 |
618 |
619 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace, indestructible, outOfMap: boolean; LandFlags: Word): boolean; |
619 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace: boolean; LandFlags: Word): boolean; |
|
620 begin |
|
621 TryPlaceOnLand:= TryPlaceOnLand(cpX, cpY, Obj, Frame, doPlace, false, LandFlags); |
|
622 end; |
|
623 |
|
624 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace, outOfMap: boolean; LandFlags: Word): boolean; |
620 var X, Y, bpp, h, w, row, col, gx, gy, numFramesFirstCol: LongInt; |
625 var X, Y, bpp, h, w, row, col, gx, gy, numFramesFirstCol: LongInt; |
621 p: PByteArray; |
626 p: PByteArray; |
622 Image: PSDL_Surface; |
627 Image: PSDL_Surface; |
|
628 indestructible: boolean; |
623 begin |
629 begin |
624 TryPlaceOnLand:= false; |
630 TryPlaceOnLand:= false; |
625 numFramesFirstCol:= SpritesData[Obj].imageHeight div SpritesData[Obj].Height; |
631 numFramesFirstCol:= SpritesData[Obj].imageHeight div SpritesData[Obj].Height; |
|
632 |
|
633 // make land indestructible if lfIndestructible is passed |
|
634 indestructible:= (LandFlags and lfIndestructible <> 0); |
626 |
635 |
627 if outOfMap then doPlace:= false; // just using for a check |
636 if outOfMap then doPlace:= false; // just using for a check |
628 |
637 |
629 TryDo(SpritesData[Obj].Surface <> nil, 'Assert SpritesData[Obj].Surface failed', true); |
638 TryDo(SpritesData[Obj].Surface <> nil, 'Assert SpritesData[Obj].Surface failed', true); |
630 Image:= SpritesData[Obj].Surface; |
639 Image:= SpritesData[Obj].Surface; |