hedgewars/uGearsHedgehog.pas
changeset 8947 e906ebd59612
parent 8818 8f317ba10675
child 8987 47cf32305d99
equal deleted inserted replaced
8946:3e07b8ff2ae1 8947:e906ebd59612
   959 if (not isFalling)
   959 if (not isFalling)
   960   and (hwAbs(Gear^.dX) + hwAbs(Gear^.dY) < _0_03) then
   960   and (hwAbs(Gear^.dX) + hwAbs(Gear^.dY) < _0_03) then
   961     begin
   961     begin
   962     Gear^.State:= Gear^.State and (not gstWinner);
   962     Gear^.State:= Gear^.State and (not gstWinner);
   963     Gear^.State:= Gear^.State and (not gstMoving);
   963     Gear^.State:= Gear^.State and (not gstMoving);
   964     while (TestCollisionYWithGear(Gear,1) = 0) and (not CheckGearDrowning(Gear)) do
   964     while (TestCollisionYWithGear(Gear,1) = 0) and (not CheckGearDrowning(Gear)) and (Gear <> nil) do
   965         Gear^.Y:= Gear^.Y+_1;
   965         Gear^.Y:= Gear^.Y + _1;
       
   966 
       
   967     // could become nil in CheckGearDrowning if ai's hog fails to respawn in ai survival
       
   968     if Gear = nil then exit;
   966     SetLittle(Gear^.dX);
   969     SetLittle(Gear^.dX);
   967     Gear^.dY:= _0
   970     Gear^.dY:= _0
   968     end
   971     end
   969 else
   972 else
   970     Gear^.State:= Gear^.State or gstMoving;
   973     Gear^.State:= Gear^.State or gstMoving;
   980         begin
   983         begin
   981         CheckHHDamage(Gear);
   984         CheckHHDamage(Gear);
   982         Gear^.dY:= _0;
   985         Gear^.dY:= _0;
   983         Gear^.Y:= Gear^.Y + _1
   986         Gear^.Y:= Gear^.Y + _1
   984         end;
   987         end;
       
   988 
   985     CheckGearDrowning(Gear);
   989     CheckGearDrowning(Gear);
       
   990     // could become nil if ai's hog fails to respawn in ai survival
       
   991     if Gear = nil then exit;
   986     // hide target cursor if current hog is drowning
   992     // hide target cursor if current hog is drowning
   987     if (Gear^.State and gstDrowning) <> 0 then
   993     if (Gear^.State and gstDrowning) <> 0 then
   988         if (CurrentHedgehog^.Gear = Gear) then
   994         if (CurrentHedgehog^.Gear = Gear) then
   989             isCursorVisible:= false
   995             isCursorVisible:= false
   990     end;
   996     end;