hedgewars/uLandGraphics.pas
changeset 7170 84ac6c6d2d8e
parent 7150 fba3b14ff746
child 7268 3a61c53346a8
equal deleted inserted replaced
7168:8defaabce92e 7170:84ac6c6d2d8e
   461 
   461 
   462 tx:= Max(X - Radius - 1, 0);
   462 tx:= Max(X - Radius - 1, 0);
   463 dx:= Min(X + Radius + 1, LAND_WIDTH) - tx;
   463 dx:= Min(X + Radius + 1, LAND_WIDTH) - tx;
   464 ty:= Max(Y - Radius - 1, 0);
   464 ty:= Max(Y - Radius - 1, 0);
   465 dy:= Min(Y + Radius + 1, LAND_HEIGHT) - ty;
   465 dy:= Min(Y + Radius + 1, LAND_HEIGHT) - ty;
   466 UpdateLandTexture(tx, dx, ty, dy);
   466 UpdateLandTexture(tx, dx, ty, dy, false);
   467 DrawExplosion:= cnt
   467 DrawExplosion:= cnt
   468 end;
   468 end;
   469 
   469 
   470 procedure DrawHLinesExplosions(ar: PRangeArray; Radius: LongInt; y, dY: LongInt; Count: Byte);
   470 procedure DrawHLinesExplosions(ar: PRangeArray; Radius: LongInt; y, dY: LongInt; Count: Byte);
   471 var tx, ty, by, bx,  i: LongInt;
   471 var tx, ty, by, bx,  i: LongInt;
   513                 end;
   513                 end;
   514     inc(y, dY)
   514     inc(y, dY)
   515     end;
   515     end;
   516 
   516 
   517 
   517 
   518 UpdateLandTexture(0, LAND_WIDTH, 0, LAND_HEIGHT)
   518 UpdateLandTexture(0, LAND_WIDTH, 0, LAND_HEIGHT, false)
   519 end;
   519 end;
   520 
   520 
   521 //
   521 //
   522 //  - (dX, dY) - direction, vector of length = 0.5
   522 //  - (dX, dY) - direction, vector of length = 0.5
   523 //
   523 //
   663 tx:= Max(stX - HalfWidth * 2 - 4 - abs(hwRound(dX * ticks)), 0);
   663 tx:= Max(stX - HalfWidth * 2 - 4 - abs(hwRound(dX * ticks)), 0);
   664 ty:= Max(stY - HalfWidth * 2 - 4 - abs(hwRound(dY * ticks)), 0);
   664 ty:= Max(stY - HalfWidth * 2 - 4 - abs(hwRound(dY * ticks)), 0);
   665 ddx:= Min(stX + HalfWidth * 2 + 4 + abs(hwRound(dX * ticks)), LAND_WIDTH) - tx;
   665 ddx:= Min(stX + HalfWidth * 2 + 4 + abs(hwRound(dX * ticks)), LAND_WIDTH) - tx;
   666 ddy:= Min(stY + HalfWidth * 2 + 4 + abs(hwRound(dY * ticks)), LAND_HEIGHT) - ty;
   666 ddy:= Min(stY + HalfWidth * 2 + 4 + abs(hwRound(dY * ticks)), LAND_HEIGHT) - ty;
   667 
   667 
   668 UpdateLandTexture(tx, ddx, ty, ddy)
   668 UpdateLandTexture(tx, ddx, ty, ddy, false)
   669 end;
   669 end;
   670 
   670 
   671 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace: boolean; indestructible: boolean): boolean;
   671 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace: boolean; indestructible: boolean): boolean;
   672 var X, Y, bpp, h, w, row, col, gx, gy, numFramesFirstCol: LongInt;
   672 var X, Y, bpp, h, w, row, col, gx, gy, numFramesFirstCol: LongInt;
   673     p: PByteArray;
   673     p: PByteArray;
   751 
   751 
   752 x:= Max(cpX, leftX);
   752 x:= Max(cpX, leftX);
   753 w:= Min(cpX + Image^.w, LAND_WIDTH) - x;
   753 w:= Min(cpX + Image^.w, LAND_WIDTH) - x;
   754 y:= Max(cpY, topY);
   754 y:= Max(cpY, topY);
   755 h:= Min(cpY + Image^.h, LAND_HEIGHT) - y;
   755 h:= Min(cpY + Image^.h, LAND_HEIGHT) - y;
   756 UpdateLandTexture(x, w, y, h)
   756 UpdateLandTexture(x, w, y, h, true)
   757 end;
   757 end;
   758 
   758 
   759 function Despeckle(X, Y: LongInt): boolean;
   759 function Despeckle(X, Y: LongInt): boolean;
   760 var nx, ny, i, j, c, xx, yy: LongInt;
   760 var nx, ny, i, j, c, xx, yy: LongInt;
   761     pixelsweep: boolean;
   761     pixelsweep: boolean;
   953                                     recheck:= true;
   953                                     recheck:= true;
   954                                     end
   954                                     end
   955                                 end;
   955                                 end;
   956                     end;
   956                     end;
   957                 if updateBlock then
   957                 if updateBlock then
   958                     UpdateLandTexture(tx, 32, ty, 32);
   958                     UpdateLandTexture(tx, 32, ty, 32, false);
   959                 LandDirty[y, x]:= 2;
   959                 LandDirty[y, x]:= 2;
   960                 end;
   960                 end;
   961             end;
   961             end;
   962         end;
   962         end;
   963      end;
   963      end;