hedgewars/GSHandlers.inc
changeset 8494 53b91a602955
parent 8413 454191defee6
child 8501 9f70e6f7fb63
equal deleted inserted replaced
8493:1a84f8b08ca7 8494:53b91a602955
  5274 //var ox, oy: LongInt;
  5274 //var ox, oy: LongInt;
  5275 //    la: hwFloat;
  5275 //    la: hwFloat;
  5276 var   a: real;
  5276 var   a: real;
  5277 begin
  5277 begin
  5278     // Gear is shrunk so it can actually escape the hog without carving into the terrain
  5278     // Gear is shrunk so it can actually escape the hog without carving into the terrain
  5279     if (Gear^.Radius = 6) and (Gear^.CollisionMask = $FFFF) then Gear^.Radius:= 16;
  5279     if (Gear^.Radius = 4) and (Gear^.CollisionMask = $FFFF) then Gear^.Radius:= 7;
  5280     if Gear^.Damage > 100 then Gear^.CollisionMask:= 0
  5280     if Gear^.Damage > 100 then Gear^.CollisionMask:= 0
  5281     else if Gear^.Damage > 30 then
  5281     else if Gear^.Damage > 30 then
  5282         if GetRandom(max(4,18-Gear^.Damage div 10)) < 3 then Gear^.CollisionMask:= 0;
  5282         if GetRandom(max(4,18-Gear^.Damage div 10)) < 3 then Gear^.CollisionMask:= 0;
  5283     Gear^.Damage:= 0;
  5283     Gear^.Damage:= 0;
  5284     if Gear^.Timer > 0 then dec(Gear^.Timer);
  5284     if Gear^.Timer > 0 then dec(Gear^.Timer);
  5285     if (Gear^.State and gstMoving <> 0) and (Gear^.State and gstCollision = 0) then
  5285     if (Gear^.State and gstMoving <> 0) and (Gear^.State and gstCollision = 0) then
  5286         begin
  5286         begin
  5287         DeleteCI(Gear);
  5287         DeleteCI(Gear);
       
  5288         Gear^.Radius:= 7;
  5288         // used for damage and impact calc. needs balancing I think
  5289         // used for damage and impact calc. needs balancing I think
  5289         Gear^.Health:= hwRound(hwSqr((hwAbs(Gear^.dY)+hwAbs(Gear^.dX))*_4));
  5290         Gear^.Health:= hwRound(hwSqr((hwAbs(Gear^.dY)+hwAbs(Gear^.dX))*_3_2));
  5290         doStepFallingGear(Gear);
  5291         doStepFallingGear(Gear);
  5291         AllInactive := false;
  5292         AllInactive := false;
  5292         a:= Gear^.DirAngle;
  5293         a:= Gear^.DirAngle;
  5293         CalcRotationDirAngle(Gear);
  5294         CalcRotationDirAngle(Gear);
  5294         Gear^.DirAngle:= a+(Gear^.DirAngle-a)*2*hwSign(Gear^.dX) // double rotation
  5295         Gear^.DirAngle:= a+(Gear^.DirAngle-a)*2*hwSign(Gear^.dX) // double rotation
  5318  //       else Gear^.DirAngle:= hwFloat2Float(la)*90; // sheepluva's comment claims 45deg = 0.5 - yet orientation doesn't seem consistent?
  5319  //       else Gear^.DirAngle:= hwFloat2Float(la)*90; // sheepluva's comment claims 45deg = 0.5 - yet orientation doesn't seem consistent?
  5319  //       AddFileLog('la: '+floattostr(la)+' DirAngle: '+inttostr(round(Gear^.DirAngle)));
  5320  //       AddFileLog('la: '+floattostr(la)+' DirAngle: '+inttostr(round(Gear^.DirAngle)));
  5320         Gear^.dX:= _0;
  5321         Gear^.dX:= _0;
  5321         Gear^.dY:= _0;
  5322         Gear^.dY:= _0;
  5322         Gear^.State:= Gear^.State and (not gstMoving) or gstCollision;
  5323         Gear^.State:= Gear^.State and (not gstMoving) or gstCollision;
  5323         Gear^.Radius:= 20;
  5324         Gear^.Radius:= 16;
  5324         if Gear^.Health > 0 then AmmoShove(Gear, Gear^.Health, 0);
  5325         if Gear^.Health > 0 then AmmoShove(Gear, Gear^.Health, 0);
  5325         Gear^.Radius:= 16;
       
  5326         Gear^.Health:= 0;
  5326         Gear^.Health:= 0;
  5327         Gear^.Timer:= 500;
  5327         Gear^.Timer:= 500;
  5328         AddGearCI(Gear)
  5328         AddGearCI(Gear)
  5329         end
  5329         end
  5330     else if GameTicks and $3F = 0 then
  5330     else if GameTicks and $3F = 0 then