hedgewars/uLandGraphics.pas
changeset 10295 ec6b68241575
parent 10287 e17fe8572478
child 10296 fbc5f217f291
equal deleted inserted replaced
10294:d98336fcd13d 10295:ec6b68241575
    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 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 TryPlaceOnLandSimple(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace, indestructible: boolean): boolean; inline;
    51 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace: boolean; LandFlags: Word): boolean;
    51 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace: boolean; LandFlags: Longword): boolean; inline;
    52 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace, outOfMap: boolean; LandFlags: Word): boolean;
    52 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace, outOfMap: boolean; LandFlags: Longword): 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 
   604 ddy:= Min(stY + HalfWidth * 2 + 4 + abs(hwRound(dY * ticks)), LAND_HEIGHT) - ty;
   604 ddy:= Min(stY + HalfWidth * 2 + 4 + abs(hwRound(dY * ticks)), LAND_HEIGHT) - ty;
   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 TryPlaceOnLandSimple(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace, indestructible: boolean): boolean; inline;
   610 var lf: LongWord;
   610 var lf: LongWord;
   611 begin
   611 begin
   612 if indestructible then
   612 if indestructible then
   613     lf:= lfIndestructible
   613     lf:= lfIndestructible
   614 else
   614 else
   615     lf:= 0;
   615     lf:= 0;
   616 TryPlaceOnLand:= TryPlaceOnLand(cpX, cpY, Obj, Frame, doPlace, false, lf);
   616 TryPlaceOnLandSimple:= 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: boolean; LandFlags: Word): boolean;
   619 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace: boolean; LandFlags: LongWord): boolean; inline;
   620 begin
   620 begin
   621 TryPlaceOnLand:= TryPlaceOnLand(cpX, cpY, Obj, Frame, doPlace, false, LandFlags);
   621 TryPlaceOnLand:= TryPlaceOnLand(cpX, cpY, Obj, Frame, doPlace, false, LandFlags);
   622 end;
   622 end;
   623 
   623 
   624 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace, outOfMap: boolean; LandFlags: Word): boolean;
   624 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace, outOfMap: boolean; LandFlags: LongWord): boolean;
   625 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;
   626     p: PByteArray;
   626     p: PByteArray;
   627     Image: PSDL_Surface;
   627     Image: PSDL_Surface;
   628     indestructible: boolean;
   628     indestructible: boolean;
   629 begin
   629 begin