hedgewars/uGearsHandlersMess.pas
changeset 9291 15f7bb217b66
parent 9289 6bc1df062f04
child 9305 8e5140875ab5
equal deleted inserted replaced
9289:6bc1df062f04 9291:15f7bb217b66
  1541         begin
  1541         begin
  1542         DeleteCI(Gear);
  1542         DeleteCI(Gear);
  1543         doStepFallingGear(Gear);
  1543         doStepFallingGear(Gear);
  1544         if (Gear^.State and gstMoving) = 0 then
  1544         if (Gear^.State and gstMoving) = 0 then
  1545             begin
  1545             begin
  1546             AddGearCI(Gear);
  1546             AddCI(Gear);
  1547             Gear^.dX := _0;
  1547             Gear^.dX := _0;
  1548             Gear^.dY := _0
  1548             Gear^.dY := _0
  1549             end;
  1549             end;
  1550         CalcRotationDirAngle(Gear);
  1550         CalcRotationDirAngle(Gear);
  1551         AllInactive := false
  1551         AllInactive := false
  1626         if (not isZero(Gear^.dX)) or (not isZero(Gear^.dY)) then
  1626         if (not isZero(Gear^.dX)) or (not isZero(Gear^.dY)) then
  1627             begin
  1627             begin
  1628             PlaySound(sndRopeAttach);
  1628             PlaySound(sndRopeAttach);
  1629             Gear^.dX:= _0;
  1629             Gear^.dX:= _0;
  1630             Gear^.dY:= _0;
  1630             Gear^.dY:= _0;
  1631             AddGearCI(Gear);
  1631             AddCI(Gear);
  1632             end;
  1632             end;
  1633         end
  1633         end
  1634     else
  1634     else
  1635         begin
  1635         begin
  1636         DeleteCI(Gear);
  1636         DeleteCI(Gear);
  1725         //CheckGearDrowning(Gear)
  1725         //CheckGearDrowning(Gear)
  1726         end
  1726         end
  1727     else
  1727     else
  1728         begin
  1728         begin
  1729         Gear^.State := Gear^.State or gsttmpFlag;
  1729         Gear^.State := Gear^.State or gsttmpFlag;
  1730         AddGearCI(Gear)
  1730         AddCI(Gear)
  1731         end;
  1731         end;
  1732 
  1732 
  1733 (*
  1733 (*
  1734 Attempt to make a barrel knock itself over an edge.  Would need more checks to avoid issues like burn damage
  1734 Attempt to make a barrel knock itself over an edge.  Would need more checks to avoid issues like burn damage
  1735     begin
  1735     begin
  1741             if (((y+1) and LAND_HEIGHT_MASK) = 0) and (((x+Gear^.Radius-2) and LAND_WIDTH_MASK) = 0) and (Land[y+1, x+Gear^.Radius-2] = 0) then
  1741             if (((y+1) and LAND_HEIGHT_MASK) = 0) and (((x+Gear^.Radius-2) and LAND_WIDTH_MASK) = 0) and (Land[y+1, x+Gear^.Radius-2] = 0) then
  1742                 Gear^.dX:= -_0_08
  1742                 Gear^.dX:= -_0_08
  1743             else if (((y+1 and LAND_HEIGHT_MASK)) = 0) and (((x-(Gear^.Radius-2)) and LAND_WIDTH_MASK) = 0) and (Land[y+1, x-(Gear^.Radius-2)] = 0) then
  1743             else if (((y+1 and LAND_HEIGHT_MASK)) = 0) and (((x-(Gear^.Radius-2)) and LAND_WIDTH_MASK) = 0) and (Land[y+1, x-(Gear^.Radius-2)] = 0) then
  1744                 Gear^.dX:= _0_08;
  1744                 Gear^.dX:= _0_08;
  1745             end;
  1745             end;
  1746     if Gear^.dX.QWordValue = 0 then AddGearCI(Gear)
  1746     if Gear^.dX.QWordValue = 0 then AddCI(Gear)
  1747     end; *)
  1747     end; *)
  1748 
  1748 
  1749     if not Gear^.dY.isNegative and (Gear^.dY < _0_001) and (TestCollisionYwithGear(Gear, 1) <> 0) then
  1749     if not Gear^.dY.isNegative and (Gear^.dY < _0_001) and (TestCollisionYwithGear(Gear, 1) <> 0) then
  1750         Gear^.dY := _0;
  1750         Gear^.dY := _0;
  1751     if hwAbs(Gear^.dX) < _0_001 then
  1751     if hwAbs(Gear^.dX) < _0_001 then
  1917         //if Gear^.dY > - _0_001 then Gear^.dY:= _0
  1917         //if Gear^.dY > - _0_001 then Gear^.dY:= _0
  1918         CheckGearDrowning(Gear);
  1918         CheckGearDrowning(Gear);
  1919         end;
  1919         end;
  1920 
  1920 
  1921     if (Gear^.dY.QWordValue = 0) then
  1921     if (Gear^.dY.QWordValue = 0) then
  1922         AddGearCI(Gear)
  1922         AddCI(Gear)
  1923     else if (Gear^.dY.QWordValue <> 0) then
  1923     else if (Gear^.dY.QWordValue <> 0) then
  1924         DeleteCI(Gear)
  1924         DeleteCI(Gear)
  1925 end;
  1925 end;
  1926 
  1926 
  1927 ////////////////////////////////////////////////////////////////////////////////
  1927 ////////////////////////////////////////////////////////////////////////////////
  4930 begin
  4930 begin
  4931     HH:= Gear^.Hedgehog;
  4931     HH:= Gear^.Hedgehog;
  4932 
  4932 
  4933     if (Gear^.State and gstMoving) <> 0 then
  4933     if (Gear^.State and gstMoving) <> 0 then
  4934         begin
  4934         begin
  4935         AddGearCI(Gear);
  4935         AddCI(Gear);
  4936         Gear^.dX:= _0;
  4936         Gear^.dX:= _0;
  4937         Gear^.dY:= _0;
  4937         Gear^.dY:= _0;
  4938         Gear^.State:= Gear^.State and (not gstMoving);
  4938         Gear^.State:= Gear^.State and (not gstMoving);
  4939         end;
  4939         end;
  4940 
  4940 
  4941     dec(Gear^.Health, Gear^.Damage);
  4941     dec(Gear^.Health, Gear^.Damage);
  4942     Gear^.Damage:= 0;
  4942     Gear^.Damage:= 0;
  4943 
  4943 
  4944     if Gear^.Pos = 1 then
  4944     if Gear^.Pos = 1 then
  4945         begin
  4945         begin
  4946         AddGearCI(Gear);
  4946         AddCI(Gear);
  4947         AfterAttack;
  4947         AfterAttack;
  4948         if Gear = CurAmmoGear then
  4948         if Gear = CurAmmoGear then
  4949             CurAmmoGear:= nil;
  4949             CurAmmoGear:= nil;
  4950         if HH^.Gear <> nil then
  4950         if HH^.Gear <> nil then
  4951             HideHog(HH);
  4951             HideHog(HH);
  4958             begin
  4958             begin
  4959             if (Gear^.Timer mod 10) = 0 then
  4959             if (Gear^.Timer mod 10) = 0 then
  4960                 begin
  4960                 begin
  4961                 DeleteCI(Gear);
  4961                 DeleteCI(Gear);
  4962                 Gear^.Y:= Gear^.Y - _0_5;
  4962                 Gear^.Y:= Gear^.Y - _0_5;
  4963                 AddGearCI(Gear);
  4963                 AddCI(Gear);
  4964                 end;
  4964                 end;
  4965             inc(Gear^.Timer);
  4965             inc(Gear^.Timer);
  4966             end;
  4966             end;
  4967         if Gear^.Tag <= TotalRounds then
  4967         if Gear^.Tag <= TotalRounds then
  4968             Gear^.Pos:= 3;
  4968             Gear^.Pos:= 3;
  4973             begin
  4973             begin
  4974             if (Gear^.Timer mod 10) = 0 then
  4974             if (Gear^.Timer mod 10) = 0 then
  4975                 begin
  4975                 begin
  4976                 DeleteCI(Gear);
  4976                 DeleteCI(Gear);
  4977                 Gear^.Y:= Gear^.Y - _0_5;
  4977                 Gear^.Y:= Gear^.Y - _0_5;
  4978                 AddGearCI(Gear);
  4978                 AddCI(Gear);
  4979                 end;
  4979                 end;
  4980             inc(Gear^.Timer);
  4980             inc(Gear^.Timer);
  4981             end
  4981             end
  4982         else
  4982         else
  4983             begin
  4983             begin
  5347                                 end
  5347                                 end
  5348                             else if iter^.Kind = gtCase then
  5348                             else if iter^.Kind = gtCase then
  5349                                 begin
  5349                                 begin
  5350                                 DeleteCI(iter);
  5350                                 DeleteCI(iter);
  5351                                 iter^.State:= iter^.State or gstFrozen;
  5351                                 iter^.State:= iter^.State or gstFrozen;
  5352                                 AddGearCI(iter)
  5352                                 AddCI(iter)
  5353                                 end
  5353                                 end
  5354                             else // gtExplosives
  5354                             else // gtExplosives
  5355                                 begin
  5355                                 begin
  5356                                 iter^.State:= iter^.State or gstFrozen;
  5356                                 iter^.State:= iter^.State or gstFrozen;
  5357                                 iter^.Health:= iter^.Health + cBarrelHealth
  5357                                 iter^.Health:= iter^.Health + cBarrelHealth
  5612         Gear^.State:= Gear^.State and (not gstMoving) or gstCollision;
  5612         Gear^.State:= Gear^.State and (not gstMoving) or gstCollision;
  5613         Gear^.Radius:= 16;
  5613         Gear^.Radius:= 16;
  5614         if Gear^.Health > 0 then AmmoShove(Gear, Gear^.Health, 0);
  5614         if Gear^.Health > 0 then AmmoShove(Gear, Gear^.Health, 0);
  5615         Gear^.Health:= 0;
  5615         Gear^.Health:= 0;
  5616         Gear^.Timer:= 500;
  5616         Gear^.Timer:= 500;
  5617         AddGearCI(Gear)
  5617         AddCI(Gear)
  5618         end
  5618         end
  5619     else if GameTicks and $3F = 0 then
  5619     else if GameTicks and $3F = 0 then
  5620         begin
  5620         begin
  5621         if  (TestCollisionYwithGear(Gear, -1) = 0)
  5621         if  (TestCollisionYwithGear(Gear, -1) = 0)
  5622         and (not TestCollisionXwithGear(Gear, 1))
  5622         and (not TestCollisionXwithGear(Gear, 1))