hedgewars/GSHandlers.inc
changeset 7758 a225cc45513e
parent 7754 e81dc9bef8b8
child 7759 b64afd109cf7
equal deleted inserted replaced
7757:c20e6c80e249 7758:a225cc45513e
  5257         CalcRotationDirAngle(Gear)
  5257         CalcRotationDirAngle(Gear)
  5258         end
  5258         end
  5259     else if Gear^.CollisionIndex = -1 then
  5259     else if Gear^.CollisionIndex = -1 then
  5260         begin
  5260         begin
  5261         ox:= 0; oy:= 0;
  5261         ox:= 0; oy:= 0;
  5262         if      TestCollisionYwithGear(Gear, -1) <> 0 then oy:= -1
  5262         if TestCollisionYwithGear(Gear, -1) <> 0 then oy:= -1;
  5263         else if TestCollisionXwithGear(Gear, 1)       then ox:=  1
  5263         if TestCollisionXwithGear(Gear, 1)       then ox:=  1;
  5264         else if TestCollisionXwithGear(Gear, -1)      then ox:= -1
  5264         if TestCollisionXwithGear(Gear, -1)      then ox:= -1;
  5265         else if TestCollisionYwithGear(Gear, 1) <> 0  then oy:=  1;
  5265         if TestCollisionYwithGear(Gear, 1) <> 0  then oy:=  1;
  5266         if Gear^.Health > 0 then
  5266         if Gear^.Health > 0 then
  5267             PlaySound(sndRopeAttach);
  5267             PlaySound(sndRopeAttach);
  5268         la:= _0;
  5268 (*
       
  5269         la:= _10000;
  5269         if (ox <> 0) or (oy <> 0) then
  5270         if (ox <> 0) or (oy <> 0) then
  5270             la:= CalcSlopeNearGear(Gear, ox, oy);
  5271             la:= CalcSlopeNearGear(Gear, ox, oy);
  5271         if la = _0 then
  5272         if la = _10000 then
  5272             begin
  5273             begin
  5273             // debug for when we couldn't get an angle
  5274             // debug for when we couldn't get an angle
  5274             //AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeWhite);
  5275             //AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeWhite);
  5275             Gear^.DirAngle:= DxDy2Angle(Gear^.dX, Gear^.dY)*hwSign(Gear^.dX) + (random(20)-10)
  5276 *)
  5276             end
  5277             Gear^.DirAngle:= DxDy2Angle(Gear^.dX, Gear^.dY) + (random(20)-10);
  5277         else Gear^.DirAngle:= hwFloat2Float(la)*90; // sheepluva's comment claims 45deg = 0.5 - yet orientation doesn't seem consistent?
  5278             if (Gear^.dX.isNegative and Gear^.dY.isNegative) or
       
  5279              ((not Gear^.dX.isNegative) and (not Gear^.dY.isNegative)) then Gear^.DirAngle:= Gear^.DirAngle-90;
       
  5280  //           end
       
  5281  //       else Gear^.DirAngle:= hwFloat2Float(la)*90; // sheepluva's comment claims 45deg = 0.5 - yet orientation doesn't seem consistent?
       
  5282  //       AddFileLog('la: '+floattostr(la)+' DirAngle: '+inttostr(round(Gear^.DirAngle)));
  5278         Gear^.dX:= _0;
  5283         Gear^.dX:= _0;
  5279         Gear^.dY:= _0;
  5284         Gear^.dY:= _0;
  5280         Gear^.State:= Gear^.State and (not gstMoving) or gstCollision;
  5285         Gear^.State:= Gear^.State and (not gstMoving) or gstCollision;
  5281         Gear^.Radius:= 20;
  5286         Gear^.Radius:= 20;
  5282         if Gear^.Health > 0 then AmmoShove(Gear, Gear^.Health, 0);
  5287         if Gear^.Health > 0 then AmmoShove(Gear, Gear^.Health, 0);