hedgewars/GSHandlers.inc
changeset 5839 7ea0745912f7
parent 5835 812be8a96927
child 5841 ef0a76e154cb
equal deleted inserted replaced
5838:180ffae2c039 5839:7ea0745912f7
  1033             if VGear <> nil then
  1033             if VGear <> nil then
  1034                 begin
  1034                 begin
  1035                 // http://mantis.freepascal.org/view.php?id=17714 hits again
  1035                 // http://mantis.freepascal.org/view.php?id=17714 hits again
  1036                 VGear^.dX := Gear^.X.QWordValue / SignAs(_1,_1).QWordValue;
  1036                 VGear^.dX := Gear^.X.QWordValue / SignAs(_1,_1).QWordValue;
  1037                 VGear^.dY := Gear^.Y.QWordValue / SignAs(_1,_1).QWordValue;
  1037                 VGear^.dY := Gear^.Y.QWordValue / SignAs(_1,_1).QWordValue;
       
  1038 
       
  1039                 if (Gear^.X.isNegative) then VGear^.dX:= -VGear^.dX;
       
  1040                 if (Gear^.Y.isNegative) then VGear^.dY:= -VGear^.dY;
  1038                 
  1041                 
  1039                 // reached edge of land. assume infinite beam. Extend it way out past camera
  1042                 // reached edge of land. assume infinite beam. Extend it way out past camera
  1040                 if (hwRound(Gear^.X) and LAND_WIDTH_MASK <> 0) 
  1043                 if (hwRound(Gear^.X) and LAND_WIDTH_MASK <> 0) 
  1041                     or (hwRound(Gear^.Y) and LAND_HEIGHT_MASK <> 0) then
  1044                     or (hwRound(Gear^.Y) and LAND_HEIGHT_MASK <> 0) then
  1042                     begin
  1045                         // only extend if not under water
  1043                     VGear^.dX := VGear^.dX + (CurrentHedgehog^.Gear^.dX * LAND_WIDTH).QWordValue / SignAs(_1,_1).QWordValue;
  1046                         if hwRound(Gear^.Y) < cWaterLine then
  1044                     VGear^.dY := VGear^.dY + (CurrentHedgehog^.Gear^.dY * LAND_WIDTH).QWordValue / SignAs(_1,_1).QWordValue;
  1047                             begin
  1045                     end;
  1048                             VGear^.dX := VGear^.dX + LAND_WIDTH * (VGear^.dX - VGear^.X);
       
  1049                             VGear^.dY := VGear^.dY + LAND_WIDTH * (VGear^.dY - VGear^.Y);
       
  1050                             end;
  1046                 
  1051                 
  1047                 VGear^.Timer := 200;
  1052                 VGear^.Timer := 200;
  1048                 end
  1053                 end
  1049             end;
  1054             end;
  1050         Gear^.doStep := @doStepShotIdle
  1055         Gear^.doStep := @doStepShotIdle