hedgewars/uGearsUtils.pas
changeset 7372 fcc002658832
parent 7357 06454899d0d2
child 7389 15c3fb4882df
equal deleted inserted replaced
7370:d50b874e7ee8 7372:fcc002658832
   401         or (isSubmersible and (Y < cWaterLine + 2 + Gear^.Radius) and ((CurAmmoGear^.Pos = 0)
   401         or (isSubmersible and (Y < cWaterLine + 2 + Gear^.Radius) and ((CurAmmoGear^.Pos = 0)
   402         and (CurAmmoGear^.dY < _0_01)))) then
   402         and (CurAmmoGear^.dY < _0_01)))) then
   403             begin
   403             begin
   404             splash:= AddVisualGear(X, cWaterLine, vgtSplash);
   404             splash:= AddVisualGear(X, cWaterLine, vgtSplash);
   405             if splash <> nil then 
   405             if splash <> nil then 
       
   406                 with splash^ do
   406                 begin
   407                 begin
   407                 splash^.Scale:= hwFloat2Float(Gear^.Density / _3 * Gear^.dY);
   408                 Scale:= hwFloat2Float(Gear^.Density / _3 * Gear^.dY);
   408                 if splash^.Scale > 1 then splash^.Scale:= power(splash^.Scale,0.3333)
   409                 if Scale > 1 then Scale:= power(Scale,0.3333)
   409                 else splash^.Scale:= splash^.Scale + ((1-splash^.Scale) / 2);
   410                 else Scale:= Scale + ((1-Scale) / 2);
       
   411                 if Scale > 1 then Timer:= round(max(Scale,3))
       
   412                 else Timer:= 1;
       
   413                 // Low Gravity
       
   414                 Timer:=round(0.0005/cGravityf);
       
   415                 FrameTicks:= FrameTicks*Timer;
   410                 end;
   416                 end;
   411 
   417 
   412             maxDrops := (hwRound(Gear^.Density) * 3) div 2 + round(vdX * hwRound(Gear^.Density) * 6) + round(vdY * hwRound(Gear^.Density) * 6);
   418             maxDrops := (hwRound(Gear^.Density) * 3) div 2 + round(vdX * hwRound(Gear^.Density) * 6) + round(vdY * hwRound(Gear^.Density) * 6);
   413             for i:= max(maxDrops div 3, min(32, Random(maxDrops))) downto 0 do
   419             for i:= max(maxDrops div 3, min(32, Random(maxDrops))) downto 0 do
   414                 begin
   420                 begin
   415                 particle := AddVisualGear(X - 3 + Random(6), cWaterLine, vgtDroplet);
   421                 particle := AddVisualGear(X - 3 + Random(7), cWaterLine, vgtDroplet);
   416                 if particle <> nil then
   422                 if particle <> nil then
   417                     begin
   423                     with particle^ do
   418                     particle^.dX := particle^.dX - vdX / 10;
       
   419                     particle^.dY := particle^.dY - vdY / 5;
       
   420                     if splash <> nil then
       
   421                         begin
   424                         begin
   422                         if splash^.Scale > 1 then 
   425                         dX := dX - vdX / 10;
       
   426                         dY := dY - vdY / 5;
       
   427                         if splash <> nil then
   423                             begin
   428                             begin
   424                             particle^.dX:= particle^.dX * power(splash^.Scale,0.3333); // tone down the droplet height further
   429                             if splash^.Scale > 1 then 
   425                             particle^.dY:= particle^.dY * power(splash^.Scale, 0.3333)
   430                                 begin
   426                             end
   431                                 dX:= dX * power(splash^.Scale,0.3333); // tone down the droplet height further
   427                         else 
   432                                 dY:= dY * power(splash^.Scale, 0.3333)
   428                             begin
   433                                 end
   429                             particle^.dX:= particle^.dX * splash^.Scale;
   434                             else 
   430                             particle^.dY:= particle^.dY * splash^.Scale
   435                                 begin
       
   436                                 dX:= dX * splash^.Scale;
       
   437                                 dY:= dY * splash^.Scale
       
   438                                 end
   431                             end
   439                             end
   432                         end
   440                         end
   433                     end
       
   434                 end
   441                 end
   435             end;
   442             end;
   436         if isSubmersible and (CurAmmoGear^.Pos = 0) then
   443         if isSubmersible and (CurAmmoGear^.Pos = 0) then
   437             CurAmmoGear^.Pos := 1000
   444             CurAmmoGear^.Pos := 1000
   438         end
   445         end