hedgewars/GSHandlers.inc
changeset 7864 667b7583c389
parent 7829 c1dc7839d7b9
child 7872 ab6db9e07c4d
equal deleted inserted replaced
7863:34fc0644d231 7864:667b7583c389
  5247 
  5247 
  5248 ////////////////////////////////////////////////////////////////////////////////
  5248 ////////////////////////////////////////////////////////////////////////////////
  5249 procedure doStepKnife(Gear: PGear);
  5249 procedure doStepKnife(Gear: PGear);
  5250 var ox, oy: LongInt;
  5250 var ox, oy: LongInt;
  5251     la: hwFloat;
  5251     la: hwFloat;
       
  5252     a: real;
  5252 begin
  5253 begin
  5253     // Gear is shrunk so it can actually escape the hog without carving into the terrain
  5254     // Gear is shrunk so it can actually escape the hog without carving into the terrain
  5254     if (Gear^.Radius = 6) and (Gear^.CollisionMask = $FFFF) then Gear^.Radius:= 16;
  5255     if (Gear^.Radius = 6) and (Gear^.CollisionMask = $FFFF) then Gear^.Radius:= 16;
  5255     if Gear^.Timer > 0 then dec(Gear^.Timer);
  5256     if Gear^.Timer > 0 then dec(Gear^.Timer);
  5256     if (Gear^.State and gstMoving <> 0) and (Gear^.State and gstCollision = 0) then
  5257     if (Gear^.State and gstMoving <> 0) and (Gear^.State and gstCollision = 0) then
  5258         DeleteCI(Gear);
  5259         DeleteCI(Gear);
  5259         // used for damage and impact calc. needs balancing I think
  5260         // used for damage and impact calc. needs balancing I think
  5260         Gear^.Health:= hwRound(hwSqr((hwAbs(Gear^.dY)+hwAbs(Gear^.dX))*_4));
  5261         Gear^.Health:= hwRound(hwSqr((hwAbs(Gear^.dY)+hwAbs(Gear^.dX))*_4));
  5261         doStepFallingGear(Gear);
  5262         doStepFallingGear(Gear);
  5262         AllInactive := false;
  5263         AllInactive := false;
  5263         CalcRotationDirAngle(Gear)
  5264         a:= Gear^.DirAngle;
       
  5265         CalcRotationDirAngle(Gear);
       
  5266         Gear^.DirAngle:= a+(Gear^.DirAngle-a)*2*hwSign(Gear^.dX) // double rotation
  5264         end
  5267         end
  5265     else if (Gear^.CollisionIndex = -1) and (Gear^.Timer = 0) then
  5268     else if (Gear^.CollisionIndex = -1) and (Gear^.Timer = 0) then
  5266         begin
  5269         begin
  5267         ox:= 0; oy:= 0;
  5270         ox:= 0; oy:= 0;
  5268         if TestCollisionYwithGear(Gear, -1) <> 0 then oy:= -1;
  5271         if TestCollisionYwithGear(Gear, -1) <> 0 then oy:= -1;