hedgewars/uLandGraphics.pas
changeset 4367 f4a0ec067601
parent 4359 83ef50815535
child 4374 bcefeeabaa33
equal deleted inserted replaced
4365:4f2b1a152979 4367:f4a0ec067601
    33 function DrawExplosion(X, Y, Radius: LongInt): Longword;
    33 function DrawExplosion(X, Y, Radius: LongInt): Longword;
    34 procedure DrawHLinesExplosions(ar: PRangeArray; Radius: LongInt; y, dY: LongInt; Count: Byte);
    34 procedure DrawHLinesExplosions(ar: PRangeArray; Radius: LongInt; y, dY: LongInt; Count: Byte);
    35 procedure DrawTunnel(X, Y, dX, dY: hwFloat; ticks, HalfWidth: LongInt);
    35 procedure DrawTunnel(X, Y, dX, dY: hwFloat; ticks, HalfWidth: LongInt);
    36 procedure FillRoundInLand(X, Y, Radius: LongInt; Value: Longword);
    36 procedure FillRoundInLand(X, Y, Radius: LongInt; Value: Longword);
    37 procedure ChangeRoundInLand(X, Y, Radius: LongInt; doSet: boolean);
    37 procedure ChangeRoundInLand(X, Y, Radius: LongInt; doSet: boolean);
       
    38 function  LandBackPixel(x, y: LongInt): LongWord;
    38 
    39 
    39 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace: boolean): boolean;
    40 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace: boolean): boolean;
    40 
    41 
    41 implementation
    42 implementation
    42 uses SDLh, uMisc, uLand, uLandTexture, uVariables;
    43 uses SDLh, uMisc, uLandTexture, uVariables;
    43 
    44 
    44 procedure FillCircleLines(x, y, dx, dy: LongInt; Value: Longword);
    45 procedure FillCircleLines(x, y, dx, dy: LongInt; Value: Longword);
    45 var i: LongInt;
    46 var i: LongInt;
    46 begin
    47 begin
    47 if ((y + dy) and LAND_HEIGHT_MASK) = 0 then
    48 if ((y + dy) and LAND_HEIGHT_MASK) = 0 then
   770 // Return true if outside of land or not the value tested, used right now for some X/Y movement that does not use normal hedgehog movement in GSHandlers.inc
   771 // Return true if outside of land or not the value tested, used right now for some X/Y movement that does not use normal hedgehog movement in GSHandlers.inc
   771 function CheckLandValue(X, Y: LongInt; LandFlag: Word): boolean;
   772 function CheckLandValue(X, Y: LongInt; LandFlag: Word): boolean;
   772 begin
   773 begin
   773      CheckLandValue:= ((X and LAND_WIDTH_MASK <> 0) or (Y and LAND_HEIGHT_MASK <> 0)) or ((Land[Y, X] and LandFlag) = 0)
   774      CheckLandValue:= ((X and LAND_WIDTH_MASK <> 0) or (Y and LAND_HEIGHT_MASK <> 0)) or ((Land[Y, X] and LandFlag) = 0)
   774 end;
   775 end;
       
   776 
       
   777 function LandBackPixel(x, y: LongInt): LongWord;
       
   778 var p: PLongWordArray;
       
   779 begin
       
   780     if LandBackSurface = nil then LandBackPixel:= 0
       
   781     else
       
   782     begin
       
   783         p:= LandBackSurface^.pixels;
       
   784         LandBackPixel:= p^[LandBackSurface^.w * (y mod LandBackSurface^.h) + (x mod LandBackSurface^.w)];// or $FF000000;
       
   785     end
       
   786 end;
       
   787 
       
   788 
   775 end.
   789 end.