hedgewars/GSHandlers.inc
changeset 8962 9780e79619ed
parent 8958 3818b38d72c0
child 8971 fcb29a13b1b1
equal deleted inserted replaced
8961:b157302674cf 8962:9780e79619ed
  1425     else if (GameTicks and $3F) = 25 then
  1425     else if (GameTicks and $3F) = 25 then
  1426         doStepFallingGear(Gear);
  1426         doStepFallingGear(Gear);
  1427     if (Gear^.Health = 0) then
  1427     if (Gear^.Health = 0) then
  1428         begin
  1428         begin
  1429         dxdy:= hwAbs(Gear^.dX)+hwAbs(Gear^.dY);
  1429         dxdy:= hwAbs(Gear^.dX)+hwAbs(Gear^.dY);
  1430         if (dxdy > _0_3) and 
  1430         if (dxdy > _0_35) and 
  1431            ((TestCollisionYwithGear(Gear, 1) <> 0) or
  1431            ((TestCollisionYwithGear(Gear, 1) <> 0) or
  1432              TestCollisionXwithGear(Gear, 1) or
  1432              TestCollisionXwithGear(Gear, 1) or
  1433             (TestCollisionYwithGear(Gear, -1) <> 0) or
  1433             (TestCollisionYwithGear(Gear, -1) <> 0) or
  1434              TestCollisionXwithGear(Gear, -1)) then
  1434              TestCollisionXwithGear(Gear, -1)) then
  1435             inc(Gear^.Damage, hwRound(dxdy * _25));
  1435             inc(Gear^.Damage, hwRound(dxdy * _25));
  1564     dec(Gear^.Timer);
  1564     dec(Gear^.Timer);
  1565 end;
  1565 end;
  1566 
  1566 
  1567 ///////////////////////////////////////////////////////////////////////////////
  1567 ///////////////////////////////////////////////////////////////////////////////
  1568 
  1568 
  1569 (*
       
  1570 TODO
       
  1571 Increase damage as barrel smokes?
       
  1572 Try tweaking friction some more
       
  1573 *)
       
  1574 procedure doStepRollingBarrel(Gear: PGear);
  1569 procedure doStepRollingBarrel(Gear: PGear);
  1575 var
  1570 var
  1576     i: LongInt;
  1571     i: LongInt;
  1577     particle: PVisualGear;
  1572     particle: PVisualGear;
  1578     dxdy: hwFloat;
  1573     dxdy: hwFloat;
  1585     or (Gear^.dY.QWordValue <> 0))  then
  1580     or (Gear^.dY.QWordValue <> 0))  then
  1586         begin
  1581         begin
  1587         DeleteCI(Gear);
  1582         DeleteCI(Gear);
  1588         AllInactive := false;
  1583         AllInactive := false;
  1589         dxdy:= hwAbs(Gear^.dX)+hwAbs(Gear^.dY);
  1584         dxdy:= hwAbs(Gear^.dX)+hwAbs(Gear^.dY);
  1590         if (dxdy > _0_3) then
  1585         if (dxdy > _0_35) then
  1591             begin
  1586             begin
  1592             if (TestCollisionYwithGear(Gear, 1) <> 0) then
  1587             if (TestCollisionYwithGear(Gear, 1) <> 0) then
  1593                 begin
  1588                 begin
  1594                 Gear^.State := Gear^.State or gsttmpFlag;
  1589                 Gear^.State := Gear^.State or gsttmpFlag;
  1595                 inc(Gear^.Damage, hwRound(dxdy * _25));
  1590                 inc(Gear^.Damage, hwRound(dxdy * _25));
  1674 
  1669 
  1675     if k = gtExplosives then
  1670     if k = gtExplosives then
  1676         begin
  1671         begin
  1677         //if V > _0_03 then Gear^.State:= Gear^.State or gstAnimation;
  1672         //if V > _0_03 then Gear^.State:= Gear^.State or gstAnimation;
  1678         if (hwAbs(Gear^.dX) > _0_15) or ((hwAbs(Gear^.dY) > _0_15) and (hwAbs(Gear^.dX) > _0_02)) then
  1673         if (hwAbs(Gear^.dX) > _0_15) or ((hwAbs(Gear^.dY) > _0_15) and (hwAbs(Gear^.dX) > _0_02)) then
  1679             Gear^.doStep := @doStepRollingBarrel
  1674             begin
       
  1675             Gear^.doStep := @doStepRollingBarrel;
       
  1676             exit;
       
  1677             end
  1680         else Gear^.dX:= _0;
  1678         else Gear^.dX:= _0;
  1681 
  1679 
  1682         if (Gear^.Health > 0) and ((Gear^.Health * 100 div cBarrelHealth) < random(90)) and ((GameTicks and $FF) = 0) then
  1680         if (Gear^.Health > 0) and ((Gear^.Health * 100 div cBarrelHealth) < random(90)) and ((GameTicks and $FF) = 0) then
  1683             if (cBarrelHealth div Gear^.Health) > 2 then
  1681             if (cBarrelHealth div Gear^.Health) > 2 then
  1684                 AddVisualGear(hwRound(Gear^.X) - 16 + Random(32), hwRound(Gear^.Y) - 2, vgtSmoke)
  1682                 AddVisualGear(hwRound(Gear^.X) - 16 + Random(32), hwRound(Gear^.Y) - 2, vgtSmoke)