hedgewars/uGearsHandlersRope.pas
changeset 11258 6d5505bff3f3
parent 11046 47a8c19ecb60
child 11266 31e0e38e703c
equal deleted inserted replaced
11251:66796cd627d8 11258:6d5505bff3f3
    40     if HHGear = nil then
    40     if HHGear = nil then
    41         begin
    41         begin
    42         OutError('ERROR: doStepRopeAfterAttack called while HHGear = nil', IsNilHHFatal);
    42         OutError('ERROR: doStepRopeAfterAttack called while HHGear = nil', IsNilHHFatal);
    43         DeleteGear(Gear);
    43         DeleteGear(Gear);
    44         exit()
    44         exit()
    45         end;
    45         end
       
    46     else if not CurrentTeam^.ExtDriven then FollowGear := HHGear;
    46 
    47 
    47     tX:= HHGear^.X;
    48     tX:= HHGear^.X;
    48     if WorldWrap(HHGear) and (WorldEdge = weWrap) and
    49     if WorldWrap(HHGear) and (WorldEdge = weWrap) and
    49        ((TestCollisionXwithGear(HHGear, 1) <> 0) or (TestCollisionXwithGear(HHGear, -1) <> 0))  then
    50        ((TestCollisionXwithGear(HHGear, 1) <> 0) or (TestCollisionXwithGear(HHGear, -1) <> 0))  then
    50         begin
    51         begin
   135     if HHGear = nil then
   136     if HHGear = nil then
   136         begin
   137         begin
   137         OutError('ERROR: doStepRopeWork called while HHGear = nil', IsNilHHFatal);
   138         OutError('ERROR: doStepRopeWork called while HHGear = nil', IsNilHHFatal);
   138         DeleteGear(Gear);
   139         DeleteGear(Gear);
   139         exit()
   140         exit()
   140         end;
   141         end
       
   142     else if not CurrentTeam^.ExtDriven then FollowGear := HHGear;
   141 
   143 
   142     if ((HHGear^.State and gstHHDriven) = 0) or
   144     if ((HHGear^.State and gstHHDriven) = 0) or
   143         (CheckGearDrowning(HHGear)) or (Gear^.PortalCounter <> 0) then
   145         (CheckGearDrowning(HHGear)) or (Gear^.PortalCounter <> 0) then
   144         begin
   146         begin
   145         PlaySound(sndRopeRelease);
   147         PlaySound(sndRopeRelease);
   423 procedure doStepRopeAttach(Gear: PGear);
   425 procedure doStepRopeAttach(Gear: PGear);
   424 var
   426 var
   425     HHGear: PGear;
   427     HHGear: PGear;
   426     tx, ty, tt: hwFloat;
   428     tx, ty, tt: hwFloat;
   427 begin
   429 begin
       
   430     
   428     Gear^.X := Gear^.X - Gear^.dX;
   431     Gear^.X := Gear^.X - Gear^.dX;
   429     Gear^.Y := Gear^.Y - Gear^.dY;
   432     Gear^.Y := Gear^.Y - Gear^.dY;
   430     Gear^.Elasticity := Gear^.Elasticity + _1;
   433     Gear^.Elasticity := Gear^.Elasticity + _1;
   431 
   434 
   432     HHGear := Gear^.Hedgehog^.Gear;
   435     HHGear := Gear^.Hedgehog^.Gear;
   433     if HHGear = nil then
   436     if HHGear = nil then
   434         begin
   437         begin
   435         OutError('ERROR: doStepRopeAttach called while HHGear = nil', IsNilHHFatal);
   438         OutError('ERROR: doStepRopeAttach called while HHGear = nil', IsNilHHFatal);
   436         DeleteGear(Gear);
   439         DeleteGear(Gear);
   437         exit()
   440         exit()
   438         end;
   441         end
       
   442     else if not CurrentTeam^.ExtDriven then FollowGear := HHGear;
   439 
   443 
   440     DeleteCI(HHGear);
   444     DeleteCI(HHGear);
   441 
   445 
   442     if (HHGear^.State and gstMoving) <> 0 then
   446     if (HHGear^.State and gstMoving) <> 0 then
   443         begin
   447         begin