hedgewars/uGearsHandlersMess.pas
changeset 14941 d6a8ef85cf53
parent 14883 4e3d81af71bf
child 14942 896707084562
equal deleted inserted replaced
14940:4accf3e18dbc 14941:d6a8ef85cf53
  2927 ////////////////////////////////////////////////////////////////////////////////
  2927 ////////////////////////////////////////////////////////////////////////////////
  2928 
  2928 
  2929 procedure doStepParachuteWork(Gear: PGear);
  2929 procedure doStepParachuteWork(Gear: PGear);
  2930 var
  2930 var
  2931     HHGear: PGear;
  2931     HHGear: PGear;
       
  2932     deltaX: hwFloat;
  2932 begin
  2933 begin
  2933     HHGear := Gear^.Hedgehog^.Gear;
  2934     HHGear := Gear^.Hedgehog^.Gear;
  2934 
  2935 
  2935     inc(Gear^.Timer);
  2936     inc(Gear^.Timer);
  2936 
  2937 
  2952         ApplyAmmoChanges(HHGear^.Hedgehog^);
  2953         ApplyAmmoChanges(HHGear^.Hedgehog^);
  2953         DeleteGear(Gear);
  2954         DeleteGear(Gear);
  2954         exit
  2955         exit
  2955         end;
  2956         end;
  2956 
  2957 
  2957     HHGear^.X := HHGear^.X + cWindSpeed * 200;
  2958     deltaX:= _0;
       
  2959     deltaX:= deltaX + cWindSpeed * 200;
  2958 
  2960 
  2959     if (Gear^.Message and gmLeft) <> 0 then
  2961     if (Gear^.Message and gmLeft) <> 0 then
  2960         HHGear^.X := HHGear^.X - cMaxWindSpeed * 80
  2962         deltaX := deltaX - cMaxWindSpeed * 80
  2961 
  2963 
  2962     else if (Gear^.Message and gmRight) <> 0 then
  2964     else if (Gear^.Message and gmRight) <> 0 then
  2963         HHGear^.X := HHGear^.X + cMaxWindSpeed * 80;
  2965         deltaX := deltaX + cMaxWindSpeed * 80;
  2964 
  2966 
  2965     if (Gear^.Message and gmUp) <> 0 then
  2967     if (Gear^.Message and gmUp) <> 0 then
  2966         HHGear^.Y := HHGear^.Y - cGravity * 40
  2968         HHGear^.Y := HHGear^.Y - cGravity * 40
  2967 
  2969 
  2968     else if (Gear^.Message and gmDown) <> 0 then
  2970     else if (Gear^.Message and gmDown) <> 0 then
  2969         HHGear^.Y := HHGear^.Y + cGravity * 40;
  2971         HHGear^.Y := HHGear^.Y + cGravity * 40;
  2970 
  2972 
       
  2973     HHGear^.X := HHGear^.X + deltaX;
  2971     // don't drift into obstacles
  2974     // don't drift into obstacles
  2972     if TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) <> 0 then
  2975     if TestCollisionXwithGear(HHGear, hwSign(deltaX)) <> 0 then
  2973         HHGear^.X := HHGear^.X - int2hwFloat(hwSign(HHGear^.dX));
  2976         HHGear^.X := HHGear^.X - int2hwFloat(hwSign(deltaX));
  2974     HHGear^.Y := HHGear^.Y + cGravity * 100;
  2977     HHGear^.Y := HHGear^.Y + cGravity * 100;
  2975     Gear^.X := HHGear^.X;
  2978     Gear^.X := HHGear^.X;
  2976     Gear^.Y := HHGear^.Y
  2979     Gear^.Y := HHGear^.Y
  2977 end;
  2980 end;
  2978 
  2981