hedgewars/uGearsUtils.pas
changeset 13403 9c9d29be9e00
parent 13399 3d6aae2ae698
child 13407 06792533ef91
equal deleted inserted replaced
13402:13be6de7860f 13403:9c9d29be9e00
  1289     Ammo^.Health:= 0;
  1289     Ammo^.Health:= 0;
  1290 while i > 0 do
  1290 while i > 0 do
  1291     begin
  1291     begin
  1292     dec(i);
  1292     dec(i);
  1293     Gear:= t^.ar[i];
  1293     Gear:= t^.ar[i];
  1294     if (Ammo^.Data <> nil) and (Ammo^.Kind in [gtDEagleShot, gtSniperRifleShot, gtMinigunBullet]) and (PGear(Ammo^.Data) = Gear)
  1294     if (Ammo^.Kind in [gtDEagleShot, gtSniperRifleShot, gtMinigunBullet])
  1295     or ((Ammo^.Kind = gtMinigunBullet) and (not UpdateHitOrder(Gear, Ammo^.WDTimer))) then
  1295         and (((Ammo^.Data <> nil) and (PGear(Ammo^.Data) = Gear))
       
  1296              or (not UpdateHitOrder(Gear, Ammo^.WDTimer))) then
  1296         continue;
  1297         continue;
  1297 
  1298 
  1298     if ((Ammo^.Kind = gtFlame) or (Ammo^.Kind = gtBlowTorch)) and
  1299     if ((Ammo^.Kind = gtFlame) or (Ammo^.Kind = gtBlowTorch)) and
  1299     (Gear^.Kind = gtHedgehog) and (Gear^.Hedgehog^.Effects[heFrozen] > 255) then
  1300     (Gear^.Kind = gtHedgehog) and (Gear^.Hedgehog^.Effects[heFrozen] > 255) then
  1300         Gear^.Hedgehog^.Effects[heFrozen]:= max(255,Gear^.Hedgehog^.Effects[heFrozen]-10000);
  1301         Gear^.Hedgehog^.Effects[heFrozen]:= max(255,Gear^.Hedgehog^.Effects[heFrozen]-10000);
  1301     tmpDmg:= ModifyDamage(Damage, Gear);
  1302     tmpDmg:= ModifyDamage(Damage, Gear);
  1302     if (Gear^.State and gstNoDamage) = 0 then
  1303     if (Gear^.State and gstNoDamage) = 0 then
  1303         begin
  1304         begin
  1304 
  1305 
  1305         if (not (Gear^.Kind in [gtMinigun, gtPortal])) and
  1306         if (not (Gear^.Kind in [gtMinigun, gtPortal])) and
  1306             ((Ammo^.Kind = gtDEagleShot)
  1307             (Ammo^.Kind in [gtDEagleShot, gtSniperRifleShot, gtMinigunBullet]) then
  1307                 or (Ammo^.Kind = gtSniperRifleShot)
       
  1308                 or (Ammo^.Kind = gtMinigunBullet)) then
       
  1309             begin
  1308             begin
  1310             VGear := AddVisualGear(t^.cX[i], t^.cY[i], vgtBulletHit);
  1309             VGear := AddVisualGear(t^.cX[i], t^.cY[i], vgtBulletHit);
  1311             if VGear <> nil then
  1310             if VGear <> nil then
  1312                 VGear^.Angle := DxDy2Angle(-Ammo^.dX, Ammo^.dY);
  1311                 VGear^.Angle := DxDy2Angle(-Ammo^.dX, Ammo^.dY);
  1313             end;
  1312             end;
  1411 end;
  1410 end;
  1412 
  1411 
  1413 procedure AmmoShoveLine(Ammo: PGear; Damage, Power: LongInt; oX, oY, tX, tY: hwFloat);
  1412 procedure AmmoShoveLine(Ammo: PGear; Damage, Power: LongInt; oX, oY, tX, tY: hwFloat);
  1414 var t: PGearArray;
  1413 var t: PGearArray;
  1415 begin
  1414 begin
  1416     if Ammo^.Kind = gtMinigunBullet then
  1415     t:= CheckAllGearsLineCollision(Ammo, oX, oY, tX, tY);
  1417         t:= CheckAllGearsLineCollision(Ammo, oX, oY, tX, tY)
       
  1418     else
       
  1419         t:= CheckGearsLineCollision(Ammo, oX, oY, tX, tY);
       
  1420     AmmoShoveImpl(Ammo, Damage, Power, t);
  1416     AmmoShoveImpl(Ammo, Damage, Power, t);
  1421 end;
  1417 end;
  1422 
  1418 
  1423 procedure AmmoShove(Ammo: PGear; Damage, Power: LongInt);
  1419 procedure AmmoShove(Ammo: PGear; Damage, Power: LongInt);
  1424 begin
  1420 begin