hedgewars/uGears.pas
changeset 5590 efd92458c75c
parent 5588 cf643996c1ee
child 5594 3ab68a93434b
equal deleted inserted replaced
5588:cf643996c1ee 5590:efd92458c75c
  1349             gtCase,
  1349             gtCase,
  1350             gtTarget,
  1350             gtTarget,
  1351             gtExplosives,
  1351             gtExplosives,
  1352             gtStructure: begin
  1352             gtStructure: begin
  1353 //addFileLog('ShotgunShot radius: ' + inttostr(Gear^.Radius) + ', t^.Radius = ' + inttostr(t^.Radius) + ', distance = ' + inttostr(dist) + ', dmg = ' + inttostr(dmg));
  1353 //addFileLog('ShotgunShot radius: ' + inttostr(Gear^.Radius) + ', t^.Radius = ' + inttostr(t^.Radius) + ', distance = ' + inttostr(dist) + ', dmg = ' + inttostr(dmg));
       
  1354                     dmg:= 0;
  1354                     r:= Gear^.Radius + t^.Radius;
  1355                     r:= Gear^.Radius + t^.Radius;
  1355                     dx:= Gear^.X-t^.X;
  1356                     dx:= Gear^.X-t^.X;
  1356                     dx.isNegative:= false;
  1357                     dx.isNegative:= false;
  1357                     dy:= Gear^.Y-t^.Y;
  1358                     dy:= Gear^.Y-t^.Y;
  1358                     dy.isNegative:= false;
  1359                     dy.isNegative:= false;
  1359                     if hwRound(dx+dy) < 25+r then
  1360                     if r-hwRound(dx+dy) > 0 then
  1360                         begin
  1361                         begin
  1361                         dist:= hwRound(Distance(dx, dy));
  1362                         dist:= hwRound(Distance(dx, dy));
  1362                         dmg:= ModifyDamage(min(r - dist, 25), t);
  1363                         dmg:= ModifyDamage(min(r - dist, 25), t);
  1363                         end;
  1364                         end;
  1364                     if dmg > 0 then
  1365                     if dmg > 0 then
  1375                         t^.Active:= true;
  1376                         t^.Active:= true;
  1376                         FollowGear:= t
  1377                         FollowGear:= t
  1377                         end
  1378                         end
  1378                     end;
  1379                     end;
  1379             gtGrave: begin
  1380             gtGrave: begin
       
  1381                     dmg:= 0;
  1380                     r:= Gear^.Radius + t^.Radius;
  1382                     r:= Gear^.Radius + t^.Radius;
  1381                     dx:= Gear^.X-t^.X;
  1383                     dx:= Gear^.X-t^.X;
  1382                     dx.isNegative:= false;
  1384                     dx.isNegative:= false;
  1383                     dy:= Gear^.Y-t^.Y;
  1385                     dy:= Gear^.Y-t^.Y;
  1384                     dy.isNegative:= false;
  1386                     dy.isNegative:= false;
  1385                     if hwRound(dx+dy) < 25+r then
  1387                     if r-hwRound(dx+dy) > 0 then
  1386                         begin
  1388                         begin
  1387                         dist:= hwRound(Distance(dx, dy));
  1389                         dist:= hwRound(Distance(dx, dy));
  1388                         dmg:= ModifyDamage(min(r - dist, 25), t);
  1390                         dmg:= ModifyDamage(min(r - dist, 25), t);
  1389                         end;
  1391                         end;
  1390                     if dmg > 0 then
  1392                     if dmg > 0 then