52 function ForcePlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; LandFlags: Word): boolean; inline; |
52 function ForcePlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; LandFlags: Word): boolean; inline; |
53 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace, outOfMap, force: boolean; LandFlags: Word): boolean; |
53 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace, outOfMap, force: boolean; LandFlags: Word): boolean; |
54 function GetPlaceCollisionTex(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt): PTexture; |
54 function GetPlaceCollisionTex(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt): PTexture; |
55 |
55 |
56 implementation |
56 implementation |
57 uses SDLh, uLandTexture, uTextures, uVariables, uUtils, uDebug; |
57 uses SDLh, uLandTexture, uTextures, uVariables, uUtils, uDebug, uScript; |
58 |
58 |
59 |
59 |
60 procedure calculatePixelsCoordinates(landX, landY: Longint; var pixelX, pixelY: Longint); inline; |
60 procedure calculatePixelsCoordinates(landX, landY: Longint; var pixelX, pixelY: Longint); inline; |
61 begin |
61 begin |
62 if (cReducedQuality and rqBlurryLand) = 0 then |
62 if (cReducedQuality and rqBlurryLand) = 0 then |
720 |
720 |
721 x:= Max(cpX, leftX); |
721 x:= Max(cpX, leftX); |
722 w:= Min(cpX + Image^.w, LAND_WIDTH) - x; |
722 w:= Min(cpX + Image^.w, LAND_WIDTH) - x; |
723 y:= Max(cpY, topY); |
723 y:= Max(cpY, topY); |
724 h:= Min(cpY + Image^.h, LAND_HEIGHT) - y; |
724 h:= Min(cpY + Image^.h, LAND_HEIGHT) - y; |
725 UpdateLandTexture(x, w, y, h, true) |
725 UpdateLandTexture(x, w, y, h, true); |
|
726 |
|
727 ScriptCall('onSpritePlacement', ord(Obj), cpX + w div 2, cpY + h div 2); |
|
728 if Obj = sprAmGirder then |
|
729 ScriptCall('onGirderPlacement', frame, cpX + w div 2, cpY + h div 2) |
|
730 else if Obj = sprAmRubber then |
|
731 ScriptCall('onRubberPlacement', frame, cpX + w div 2, cpY + h div 2); |
|
732 |
726 end; |
733 end; |
727 |
734 |
728 function GetPlaceCollisionTex(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt): PTexture; |
735 function GetPlaceCollisionTex(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt): PTexture; |
729 var X, Y, bpp, h, w, row, col, numFramesFirstCol: LongInt; |
736 var X, Y, bpp, h, w, row, col, numFramesFirstCol: LongInt; |
730 p, pt: PByteArray; |
737 p, pt: PByteArray; |