hedgewars/uGearsUtils.pas
changeset 7721 2b1ad418ba39
parent 7719 eeae1cb6b6bf
child 7754 e81dc9bef8b8
equal deleted inserted replaced
7720:8e6b79a020f8 7721:2b1ad418ba39
   108                 gtExplosives,
   108                 gtExplosives,
   109                 gtStructure: begin
   109                 gtStructure: begin
   110 // Run the calcs only once we know we have a type that will need damage
   110 // Run the calcs only once we know we have a type that will need damage
   111                         tdX:= Gear^.X-fX;
   111                         tdX:= Gear^.X-fX;
   112                         tdY:= Gear^.Y-fY;
   112                         tdY:= Gear^.Y-fY;
   113                         if (tdX.Round + tdY.Round + 2) < dmgBase then
   113                         if LongInt(tdX.Round + tdY.Round + 2) < dmgBase then
   114                             dmg:= dmgBase - hwRound(Distance(tdX, tdY));
   114                             dmg:= dmgBase - hwRound(Distance(tdX, tdY));
   115                         if dmg > 1 then
   115                         if dmg > 1 then
   116                             begin
   116                             begin
   117                             dmg:= ModifyDamage(min(dmg div 2, Radius), Gear);
   117                             dmg:= ModifyDamage(min(dmg div 2, Radius), Gear);
   118                             //AddFileLog('Damage: ' + inttostr(dmg));
   118                             //AddFileLog('Damage: ' + inttostr(dmg));
   142                         end;
   142                         end;
   143                 gtGrave: begin
   143                 gtGrave: begin
   144 // Run the calcs only once we know we have a type that will need damage
   144 // Run the calcs only once we know we have a type that will need damage
   145                         tdX:= Gear^.X-fX;
   145                         tdX:= Gear^.X-fX;
   146                         tdY:= Gear^.Y-fY;
   146                         tdY:= Gear^.Y-fY;
   147                         if (tdX.Round + tdY.Round + 2) < dmgBase then
   147                         if LongInt(tdX.Round + tdY.Round + 2) < dmgBase then
   148                             dmg:= dmgBase - hwRound(Distance(tdX, tdY));
   148                             dmg:= dmgBase - hwRound(Distance(tdX, tdY));
   149                         if dmg > 1 then
   149                         if dmg > 1 then
   150                             begin
   150                             begin
   151                             dmg:= ModifyDamage(min(dmg div 2, Radius), Gear);
   151                             dmg:= ModifyDamage(min(dmg div 2, Radius), Gear);
   152                             Gear^.dY:= - _0_004 * dmg;
   152                             Gear^.dY:= - _0_004 * dmg;