hedgewars/uGearsHandlersRope.pas
changeset 7612 047c6692a2e7
parent 7611 5013e11e13e5
child 7647 e496587db93e
equal deleted inserted replaced
7611:5013e11e13e5 7612:047c6692a2e7
    84             begin
    84             begin
    85             inc(i);
    85             inc(i);
    86             stuck:= TestCollisionYwithGear(HHGear, 1) <> 0;
    86             stuck:= TestCollisionYwithGear(HHGear, 1) <> 0;
    87             if stuck then HHGear^.Y:= HHGear^.Y-_1
    87             if stuck then HHGear^.Y:= HHGear^.Y-_1
    88             end
    88             end
    89         until (i = 8) or not stuck;
    89         until (i = 8) or (not stuck);
    90         HHGear^.Y:= HHGear^.Y+_1;
    90         HHGear^.Y:= HHGear^.Y+_1;
    91         // experiment in simulating something the shoppa players apparently expect
    91         // experiment in simulating something the shoppa players apparently expect
    92         if Gear^.Message and gmDown <> 0 then
    92         if Gear^.Message and gmDown <> 0 then
    93             begin
    93             begin
    94             //HHGear^.dY:= HHGear^.dY / 16;
    94             //HHGear^.dY:= HHGear^.dY / 16;
   108             begin
   108             begin
   109             inc(i);
   109             inc(i);
   110             stuck:= TestCollisionYwithGear(HHGear, -1) <> 0;
   110             stuck:= TestCollisionYwithGear(HHGear, -1) <> 0;
   111             if stuck then HHGear^.Y:= HHGear^.Y+_1
   111             if stuck then HHGear^.Y:= HHGear^.Y+_1
   112             end
   112             end
   113         until (i = 8) or not stuck;
   113         until (i = 8) or (not stuck);
   114         HHGear^.Y:= HHGear^.Y-_1;
   114         HHGear^.Y:= HHGear^.Y-_1;
   115         if Gear^.Message and gmDown <> 0 then
   115         if Gear^.Message and gmDown <> 0 then
   116             begin
   116             begin
   117             //HHGear^.dY:= HHGear^.dY / 16;
   117             //HHGear^.dY:= HHGear^.dY / 16;
   118             //HHGear^.dY.QWordValue:= 0;
   118             //HHGear^.dY.QWordValue:= 0;
   122         if Gear^.Message and gmRight <> 0 then
   122         if Gear^.Message and gmRight <> 0 then
   123             HHGear^.dX.isNegative:= true
   123             HHGear^.dX.isNegative:= true
   124         else if Gear^.Message and gmLeft <> 0 then
   124         else if Gear^.Message and gmLeft <> 0 then
   125             HHGear^.dX.isNegative:= false
   125             HHGear^.dX.isNegative:= false
   126         end;
   126         end;
   127     if TestCollisionXwithGear(HHGear, 1) and not TestCollisionXwithGear(HHGear, -1) then
   127     if TestCollisionXwithGear(HHGear, 1) and (not TestCollisionXwithGear(HHGear, -1)) then
   128         begin
   128         begin
   129         i:= 1;
   129         i:= 1;
   130         repeat
   130         repeat
   131             begin
   131             begin
   132             inc(i);
   132             inc(i);
   133             stuck:= TestCollisionXwithGear(HHGear, 1);
   133             stuck:= TestCollisionXwithGear(HHGear, 1);
   134             if stuck then HHGear^.X:= HHGear^.X-_1
   134             if stuck then HHGear^.X:= HHGear^.X-_1
   135             end
   135             end
   136         until (i = 8) or not stuck;
   136         until (i = 8) or (not stuck);
   137         HHGear^.X:= HHGear^.X+_1;
   137         HHGear^.X:= HHGear^.X+_1;
   138         if Gear^.Message and gmDown <> 0 then
   138         if Gear^.Message and gmDown <> 0 then
   139             begin
   139             begin
   140             //HHGear^.dX:= HHGear^.dX / 16;
   140             //HHGear^.dX:= HHGear^.dX / 16;
   141             //HHGear^.dX.QWordValue:= 0;
   141             //HHGear^.dX.QWordValue:= 0;
   145         if Gear^.Message and gmRight <> 0 then
   145         if Gear^.Message and gmRight <> 0 then
   146             HHGear^.dY.isNegative:= true
   146             HHGear^.dY.isNegative:= true
   147         else if Gear^.Message and gmLeft <> 0 then
   147         else if Gear^.Message and gmLeft <> 0 then
   148             HHGear^.dY.isNegative:= false
   148             HHGear^.dY.isNegative:= false
   149         end
   149         end
   150     else if TestCollisionXwithGear(HHGear, -1) and not TestCollisionXwithGear(HHGear, 1) then
   150     else if TestCollisionXwithGear(HHGear, -1) and (not TestCollisionXwithGear(HHGear, 1)) then
   151         begin
   151         begin
   152         i:= 1;
   152         i:= 1;
   153         repeat
   153         repeat
   154             begin
   154             begin
   155             inc(i);
   155             inc(i);
   156             stuck:= TestCollisionXwithGear(HHGear, -1);
   156             stuck:= TestCollisionXwithGear(HHGear, -1);
   157             if stuck then HHGear^.X:= HHGear^.X+_1
   157             if stuck then HHGear^.X:= HHGear^.X+_1
   158             end
   158             end
   159         until (i = 8) or not stuck;
   159         until (i = 8) or (not stuck);
   160         HHGear^.X:= HHGear^.X-_1;
   160         HHGear^.X:= HHGear^.X-_1;
   161         if Gear^.Message and gmDown <> 0 then
   161         if Gear^.Message and gmDown <> 0 then
   162             begin
   162             begin
   163             //HHGear^.dX:= HHGear^.dX / 16;
   163             //HHGear^.dX:= HHGear^.dX / 16;
   164             //HHGear^.dX.QWordValue:= 0;
   164             //HHGear^.dX.QWordValue:= 0;