hedgewars/uGearsUtils.pas
changeset 10417 8f66bb4dbf80
parent 10363 fc3aa563ab01
child 10419 e19a864e2fab
equal deleted inserted replaced
10415:fb80f6b1327f 10417:8f66bb4dbf80
   362 var x, y, i, distL, distR, distB, minDist, maxDrops: LongInt;
   362 var x, y, i, distL, distR, distB, minDist, maxDrops: LongInt;
   363     splash, particle: PVisualGear;
   363     splash, particle: PVisualGear;
   364     speed, hwTmp: hwFloat;
   364     speed, hwTmp: hwFloat;
   365     vi, vs, tmp: real; // impact speed and sideways speed
   365     vi, vs, tmp: real; // impact speed and sideways speed
   366     isImpactH, isImpactRight: boolean;
   366     isImpactH, isImpactRight: boolean;
       
   367 const dist2surf = 6;
   367 begin
   368 begin
   368 x:= hwRound(Gear^.X);
   369 x:= hwRound(Gear^.X);
   369 y:= hwRound(Gear^.Y);
   370 y:= hwRound(Gear^.Y);
   370 
   371 
   371 splash:= AddVisualGear(x, y, vgtSplash);
   372 splash:= AddVisualGear(x, y, vgtSplash);
   387 
   388 
   388 isImpactH:= (minDist <> distB);
   389 isImpactH:= (minDist <> distB);
   389 
   390 
   390 if not isImpactH then
   391 if not isImpactH then
   391     begin
   392     begin
   392     dec(y, distB);
   393     y:= cWaterline - dist2surf;
   393     splash^.Y:= y;
   394     splash^.Y:= y;
   394     speed:= hwAbs(Gear^.dY);
   395     speed:= hwAbs(Gear^.dY);
   395     vs:= abs(hwFloat2Float(Gear^.dX));
   396     vs:= abs(hwFloat2Float(Gear^.dX));
   396     end
   397     end
   397 else
   398 else
   398     begin
   399     begin
   399     isImpactRight := minDist = distR;
   400     isImpactRight := minDist = distR;
   400     if isImpactRight then
   401     if isImpactRight then
   401         begin
   402         begin
   402         inc(x, distR);
   403         x := rightX - dist2surf;;
   403         splash^.Angle:= -90;
   404         splash^.Angle:= -90;
   404         end
   405         end
   405     else
   406     else
   406         begin
   407         begin
   407         dec(x, distL);
   408         x := leftX + dist2surf;;
   408         splash^.Angle:=  90;
   409         splash^.Angle:=  90;
   409         end;
   410         end;
   410     splash^.X:= x;
   411     splash^.X:= x;
   411     speed:= hwAbs(Gear^.dX);
   412     speed:= hwAbs(Gear^.dX);
   412     vs:= abs(hwFloat2Float(Gear^.dY));
   413     vs:= abs(hwFloat2Float(Gear^.dY));