hedgewars/GSHandlers.inc
changeset 3915 c05855146440
parent 3909 4ba25a3d15af
child 3953 fd7ced2071a1
equal deleted inserted replaced
3914:c5c903c6225b 3915:c05855146440
   251     isFalling: boolean;
   251     isFalling: boolean;
   252     //tmp: QWord;
   252     //tmp: QWord;
   253     tdX, tdY: hwFloat;
   253     tdX, tdY: hwFloat;
   254     collV, collH: LongInt;
   254     collV, collH: LongInt;
   255 begin
   255 begin
   256     if Gear^.dX > _0_995 then Gear^.dX := _0_995;
   256     // clip velocity at 1.9 - over 1 per pixel, but really shouldn't cause many actual problems.
   257     if Gear^.dY > _0_995 then Gear^.dY := _0_995;
   257     if Gear^.dX.QWordValue > 8160437862 then Gear^.dX.QWordValue:= 8160437862;
       
   258     if Gear^.dY.QWordValue > 8160437862 then Gear^.dY.QWordValue:= 8160437862;
   258     Gear^.State := Gear^.State and not gstCollision;
   259     Gear^.State := Gear^.State and not gstCollision;
   259     collV := 0;
   260     collV := 0;
   260     collH := 0;
   261     collH := 0;
   261     tdX := Gear^.dX;
   262     tdX := Gear^.dX;
   262     tdY := Gear^.dY;
   263     tdY := Gear^.dY;
  3123     fuel, i: LongInt;
  3124     fuel, i: LongInt;
  3124     move: hwFloat;
  3125     move: hwFloat;
  3125 begin
  3126 begin
  3126     HHGear := CurrentHedgehog^.Gear;
  3127     HHGear := CurrentHedgehog^.Gear;
  3127 
  3128 
  3128     move := _0_1;
  3129     move := _0_2;
  3129     fuel := 50;
  3130     fuel := 50;
  3130 
  3131 
  3131     if Gear^.Pos > 0 then
  3132     if Gear^.Pos > 0 then
  3132         dec(Gear^.Pos, 1)
  3133         dec(Gear^.Pos, 1)
  3133     else if (HHGear^.Message and (gmLeft or gmRight or gmUp)) <> 0 then
  3134     else if (HHGear^.Message and (gmLeft or gmRight or gmUp)) <> 0 then
  3140 
  3141 
  3141     if (HHGear^.Message and gmUp) <> 0 then
  3142     if (HHGear^.Message and gmUp) <> 0 then
  3142     begin
  3143     begin
  3143         if (not HHGear^.dY.isNegative) or (HHGear^.Y > -_256) then
  3144         if (not HHGear^.dY.isNegative) or (HHGear^.Y > -_256) then
  3144             HHGear^.dY := HHGear^.dY - move;
  3145             HHGear^.dY := HHGear^.dY - move;
  3145         HHGear^.dY := HHGear^.dY - move;
       
  3146         dec(Gear^.Health, fuel);
  3146         dec(Gear^.Health, fuel);
  3147         Gear^.MsgParam := Gear^.MsgParam or gmUp;
  3147         Gear^.MsgParam := Gear^.MsgParam or gmUp;
  3148     end;
  3148     end;
  3149     if (HHGear^.Message and gmLeft) <> 0 then move.isNegative := true;
  3149     if (HHGear^.Message and gmLeft) <> 0 then move.isNegative := true;
  3150     if (HHGear^.Message and (gmLeft or gmRight)) <> 0 then
  3150     if (HHGear^.Message and (gmLeft or gmRight)) <> 0 then
  3151     begin
  3151     begin
  3152         HHGear^.dX := HHGear^.dX + (move * _0_2);
  3152         HHGear^.dX := HHGear^.dX + (move * _0_1);
  3153         dec(Gear^.Health, fuel div 5);
  3153         dec(Gear^.Health, fuel div 5);
  3154         Gear^.MsgParam := Gear^.MsgParam or (HHGear^.Message and (gmLeft or gmRight));
  3154         Gear^.MsgParam := Gear^.MsgParam or (HHGear^.Message and (gmLeft or gmRight));
  3155     end;
  3155     end;
  3156 
  3156 
  3157     if Gear^.Health < 0 then Gear^.Health := 0;
  3157     if Gear^.Health < 0 then Gear^.Health := 0;