hedgewars/uGearsUtils.pas
changeset 14196 ab5e710d353d
parent 14041 44f20c9e6861
child 14200 1bdce164eb72
equal deleted inserted replaced
14195:43ca01d4fb46 14196:ab5e710d353d
   151                 gtAirMine,
   151                 gtAirMine,
   152                 gtCase,
   152                 gtCase,
   153                 gtTarget,
   153                 gtTarget,
   154                 gtFlame,
   154                 gtFlame,
   155                 gtKnife,
   155                 gtKnife,
   156                 gtExplosives: begin //,
   156                 gtExplosives: begin
   157                 //gtStructure: begin
       
   158 // Run the calcs only once we know we have a type that will need damage
   157 // Run the calcs only once we know we have a type that will need damage
   159                         tdX:= Gear^.X-fX;
   158                         tdX:= Gear^.X-fX;
   160                         tdY:= Gear^.Y-fY;
   159                         tdY:= Gear^.Y-fY;
   161                         if LongInt(tdX.Round + tdY.Round + 2) < dmgBase then
   160                         if LongInt(tdX.Round + tdY.Round + 2) < dmgBase then
   162                             dmg:= dmgBase - hwRound(Distance(tdX, tdY));
   161                             dmg:= dmgBase - hwRound(Distance(tdX, tdY));
   328 			//Tint:= $bd2f03ff
   327 			//Tint:= $bd2f03ff
   329 			Tint:= $ff0000ff
   328 			Tint:= $ff0000ff
   330 			end
   329 			end
   331 	end
   330 	end
   332     end else
   331     end else
   333     //else if Gear^.Kind <> gtStructure then // not gtHedgehog nor gtStructure
       
   334         Gear^.Hedgehog:= AttackerHog;
   332         Gear^.Hedgehog:= AttackerHog;
   335     inc(Gear^.Damage, Damage);
   333     inc(Gear^.Damage, Damage);
   336 
   334 
   337     ScriptCall('onGearDamage', Gear^.UID, Damage);
   335     ScriptCall('onGearDamage', Gear^.UID, Damage);
   338 end;
   336 end;
  1216             gtSMine,
  1214             gtSMine,
  1217             gtAirMine,
  1215             gtAirMine,
  1218             gtKnife,
  1216             gtKnife,
  1219             gtCase,
  1217             gtCase,
  1220             gtTarget,
  1218             gtTarget,
  1221             gtExplosives: begin//,
  1219             gtExplosives: begin
  1222 //            gtStructure: begin
       
  1223 //addFileLog('ShotgunShot radius: ' + inttostr(Gear^.Radius) + ', t^.Radius = ' + inttostr(t^.Radius) + ', distance = ' + inttostr(dist) + ', dmg = ' + inttostr(dmg));
  1220 //addFileLog('ShotgunShot radius: ' + inttostr(Gear^.Radius) + ', t^.Radius = ' + inttostr(t^.Radius) + ', distance = ' + inttostr(dist) + ', dmg = ' + inttostr(dmg));
  1224                     dmg:= 0;
  1221                     dmg:= 0;
  1225                     r:= Gear^.Radius + t^.Radius;
  1222                     r:= Gear^.Radius + t^.Radius;
  1226                     dx:= Gear^.X-t^.X;
  1223                     dx:= Gear^.X-t^.X;
  1227                     dx.isNegative:= false;
  1224                     dx.isNegative:= false;
  1349             gtAirMine,
  1346             gtAirMine,
  1350             gtSMine,
  1347             gtSMine,
  1351             gtKnife,
  1348             gtKnife,
  1352             gtTarget,
  1349             gtTarget,
  1353             gtCase,
  1350             gtCase,
  1354             gtExplosives: //,
  1351             gtExplosives:
  1355             //gtStructure:
       
  1356             begin
  1352             begin
  1357             if (Ammo^.Kind in [gtFirePunch, gtKamikaze]) and (Gear^.Kind <> gtSMine) then
  1353             if (Ammo^.Kind in [gtFirePunch, gtKamikaze]) and (Gear^.Kind <> gtSMine) then
  1358                 PlaySound(sndFirePunchHit);
  1354                 PlaySound(sndFirePunchHit);
  1359 
  1355 
  1360             if Ammo^.Kind in [gtDEagleShot, gtSniperRifleShot, gtMinigunBullet] then
  1356             if Ammo^.Kind in [gtDEagleShot, gtSniperRifleShot, gtMinigunBullet] then