hedgewars/uLandGraphics.pas
changeset 772 e8d530ca77be
parent 769 788efc1d649f
child 818 635e58295079
equal deleted inserted replaced
771:86fbe8753a7c 772:e8d530ca77be
   185           end;
   185           end;
   186      inc(dx)
   186      inc(dx)
   187      end;
   187      end;
   188   if (dx = dy) then FillLandCircleLinesEBC(x, y, dx, dy);
   188   if (dx = dy) then FillLandCircleLinesEBC(x, y, dx, dy);
   189 
   189 
   190 d:= max(Y - Radius, 0);
   190 d:= max(Y - Radius - 1, 0);
   191 dy:= min(Y + Radius, 1023) - d;
   191 dy:= min(Y + Radius + 1, 1023) - d;
   192 UpdateLandTexture(d, dy)
   192 UpdateLandTexture(d, dy)
   193 end;
   193 end;
   194 
   194 
   195 procedure DrawHLinesExplosions(ar: PRangeArray; Radius: LongInt; y, dY: LongInt; Count: Byte);
   195 procedure DrawHLinesExplosions(ar: PRangeArray; Radius: LongInt; y, dY: LongInt; Count: Byte);
   196 var tx, ty, i: LongInt;
   196 var tx, ty, i: LongInt;
   221 //
   221 //
   222 //  - (dX, dY) - direction, vector of length = 0.5
   222 //  - (dX, dY) - direction, vector of length = 0.5
   223 //
   223 //
   224 procedure DrawTunnel(X, Y, dX, dY: hwFloat; ticks, HalfWidth: LongInt);
   224 procedure DrawTunnel(X, Y, dX, dY: hwFloat; ticks, HalfWidth: LongInt);
   225 var nx, ny, dX8, dY8: hwFloat;
   225 var nx, ny, dX8, dY8: hwFloat;
   226     i, t, tx, ty: Longint;
   226     i, t, tx, ty, stY: Longint;
   227 begin  // (-dY, dX) is (dX, dY) rotated by PI/2
   227 begin  // (-dY, dX) is (dX, dY) rotated by PI/2
       
   228 stY:= hwRound(Y);
       
   229 
   228 nx:= X + dY * (HalfWidth + 8);
   230 nx:= X + dY * (HalfWidth + 8);
   229 ny:= Y - dX * (HalfWidth + 8);
   231 ny:= Y - dX * (HalfWidth + 8);
   230 
   232 
   231 dX8:= dX * 8;
   233 dX8:= dX * 8;
   232 dY8:= dY * 8;
   234 dY8:= dY * 8;
   275         {$include tunsetborder.inc}
   277         {$include tunsetborder.inc}
   276     nx:= nx - dY;
   278     nx:= nx - dY;
   277     ny:= ny + dX;
   279     ny:= ny + dX;
   278     end;
   280     end;
   279 
   281 
   280 UpdateLandTexture(0, 1024)
   282 t:= max(stY - HalfWidth * 3 div 2 - 4, 0);
       
   283 ty:= min(stY + HalfWidth * 3 div 2 + 4, 1023) - t;
       
   284 UpdateLandTexture(t, ty)
   281 end;
   285 end;
   282 
   286 
   283 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace: boolean): boolean;
   287 function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace: boolean): boolean;
   284 var X, Y, bpp, h, w: LongInt;
   288 var X, Y, bpp, h, w: LongInt;
   285     p: PByteArray;
   289     p: PByteArray;
   340 if SDL_MustLock(Image) then
   344 if SDL_MustLock(Image) then
   341    SDL_UnlockSurface(Image);
   345    SDL_UnlockSurface(Image);
   342 
   346 
   343 y:= max(cpY, 0);
   347 y:= max(cpY, 0);
   344 h:= min(cpY + Image^.h, 1023) - y;
   348 h:= min(cpY + Image^.h, 1023) - y;
   345 addfilelog(inttostr(y) + ' <<<<<<<<>>>>>>>> '+inttostr(h));
       
   346 UpdateLandTexture(y, h)
   349 UpdateLandTexture(y, h)
   347 end;
   350 end;
   348 
   351 
   349 
   352 
   350 end.
   353 end.