hedgewars/GSHandlers.inc
changeset 8370 0c79946e96f8
parent 8204 9a6030d96273
child 8413 454191defee6
equal deleted inserted replaced
8369:31033e521653 8370:0c79946e96f8
  5172         exit
  5172         exit
  5173         end;
  5173         end;
  5174 if (Gear^.State and gstTmpFlag <> 0) or (GameTicks and $7 = 0) then
  5174 if (Gear^.State and gstTmpFlag <> 0) or (GameTicks and $7 = 0) then
  5175     begin
  5175     begin
  5176     doStepFallingGear(Gear);
  5176     doStepFallingGear(Gear);
  5177     if (Gear^.State and gstInvisible <> 0) and (GameTicks and $FF = 0) and ((hwRound(Gear^.X) < leftX) or (hwRound(Gear^.X) > rightX) or (hwRound(Gear^.Y) < topY)) then
  5177     if (Gear^.State and gstInvisible <> 0) and (GameTicks and $FF = 0) and (hwRound(Gear^.X) < LongInt(leftX)) or (hwRound(Gear^.X) > LongInt(rightX)) or (hwRound(Gear^.Y) < LongInt(topY)) then
  5178         begin
  5178         begin
  5179         Gear^.X:= int2hwFloat(GetRandom(rightX-leftX)+leftX);
  5179         Gear^.X:= int2hwFloat(GetRandom(rightX-leftX)+leftX);
  5180         Gear^.Y:= int2hwFloat(GetRandom(LAND_HEIGHT-topY)+topY);
  5180         Gear^.Y:= int2hwFloat(GetRandom(LAND_HEIGHT-topY)+topY);
  5181         Gear^.dX:= _90-(GetRandomf*_360);
  5181         Gear^.dX:= _90-(GetRandomf*_360);
  5182         Gear^.dY:= _90-(GetRandomf*_360)
  5182         Gear^.dY:= _90-(GetRandomf*_360)
  5265     end;
  5265     end;
  5266 end;
  5266 end;
  5267 
  5267 
  5268 ////////////////////////////////////////////////////////////////////////////////
  5268 ////////////////////////////////////////////////////////////////////////////////
  5269 procedure doStepKnife(Gear: PGear);
  5269 procedure doStepKnife(Gear: PGear);
  5270 var ox, oy: LongInt;
  5270 //var ox, oy: LongInt;
  5271     la: hwFloat;
  5271 //    la: hwFloat;
  5272     a: real;
  5272 var   a: real;
  5273 begin
  5273 begin
  5274     // Gear is shrunk so it can actually escape the hog without carving into the terrain
  5274     // Gear is shrunk so it can actually escape the hog without carving into the terrain
  5275     if (Gear^.Radius = 6) and (Gear^.CollisionMask = $FFFF) then Gear^.Radius:= 16;
  5275     if (Gear^.Radius = 6) and (Gear^.CollisionMask = $FFFF) then Gear^.Radius:= 16;
  5276     if Gear^.Damage > 100 then Gear^.CollisionMask:= 0
  5276     if Gear^.Damage > 100 then Gear^.CollisionMask:= 0
  5277     else if Gear^.Damage > 30 then
  5277     else if Gear^.Damage > 30 then
  5289         CalcRotationDirAngle(Gear);
  5289         CalcRotationDirAngle(Gear);
  5290         Gear^.DirAngle:= a+(Gear^.DirAngle-a)*2*hwSign(Gear^.dX) // double rotation
  5290         Gear^.DirAngle:= a+(Gear^.DirAngle-a)*2*hwSign(Gear^.dX) // double rotation
  5291         end
  5291         end
  5292     else if (Gear^.CollisionIndex = -1) and (Gear^.Timer = 0) then
  5292     else if (Gear^.CollisionIndex = -1) and (Gear^.Timer = 0) then
  5293         begin
  5293         begin
  5294         ox:= 0; oy:= 0;
  5294         (*ox:= 0; oy:= 0;
  5295         if TestCollisionYwithGear(Gear, -1) <> 0 then oy:= -1;
  5295         if TestCollisionYwithGear(Gear, -1) <> 0 then oy:= -1;
  5296         if TestCollisionXwithGear(Gear, 1)       then ox:=  1;
  5296         if TestCollisionXwithGear(Gear, 1)       then ox:=  1;
  5297         if TestCollisionXwithGear(Gear, -1)      then ox:= -1;
  5297         if TestCollisionXwithGear(Gear, -1)      then ox:= -1;
  5298         if TestCollisionYwithGear(Gear, 1) <> 0  then oy:=  1;
  5298         if TestCollisionYwithGear(Gear, 1) <> 0  then oy:=  1;
  5299         if Gear^.Health > 0 then
  5299         if Gear^.Health > 0 then
  5300             PlaySound(sndRopeAttach);
  5300             PlaySound(sndRopeAttach);
  5301 (*
  5301 
  5302         la:= _10000;
  5302         la:= _10000;
  5303         if (ox <> 0) or (oy <> 0) then
  5303         if (ox <> 0) or (oy <> 0) then
  5304             la:= CalcSlopeNearGear(Gear, ox, oy);
  5304             la:= CalcSlopeNearGear(Gear, ox, oy);
  5305         if la = _10000 then
  5305         if la = _10000 then
  5306             begin
  5306             begin