hedgewars/uGearsHandlersRope.pas
changeset 7658 70a874a26414
parent 7657 347e18494fb9
child 7660 8398faa1e628
equal deleted inserted replaced
7657:347e18494fb9 7658:70a874a26414
   109     HHGear := Gear^.Hedgehog^.Gear;
   109     HHGear := Gear^.Hedgehog^.Gear;
   110 
   110 
   111     if ((HHGear^.State and gstHHDriven) = 0)
   111     if ((HHGear^.State and gstHHDriven) = 0)
   112        or (CheckGearDrowning(HHGear)) or (Gear^.PortalCounter <> 0) then
   112        or (CheckGearDrowning(HHGear)) or (Gear^.PortalCounter <> 0) then
   113         begin
   113         begin
   114         HHGear^.dX.QWordValue:= HHGear^.dX.QWordValue shr 2;
       
   115         HHGear^.dY.QWordValue:= HHGear^.dY.QWordValue shr 2;
       
   116         PlaySound(sndRopeRelease);
   114         PlaySound(sndRopeRelease);
   117         RopeDeleteMe(Gear, HHGear);
   115         RopeDeleteMe(Gear, HHGear);
   118         exit
   116         exit
   119         end;
   117         end;
   120 
   118 
       
   119     HHGear^.dX.QWordValue:= HHGear^.dX.QWordValue shl 2;
       
   120     HHGear^.dY.QWordValue:= HHGear^.dY.QWordValue shl 2;
   121     if (Gear^.Message and gmLeft  <> 0) and (not TestCollisionXwithGear(HHGear, -1)) then
   121     if (Gear^.Message and gmLeft  <> 0) and (not TestCollisionXwithGear(HHGear, -1)) then
   122         HHGear^.dX := HHGear^.dX - _0_0032;
   122         HHGear^.dX := HHGear^.dX - _0_0032;
   123 
   123 
   124     if (Gear^.Message and gmRight <> 0) and (not TestCollisionXwithGear(HHGear,  1)) then
   124     if (Gear^.Message and gmRight <> 0) and (not TestCollisionXwithGear(HHGear,  1)) then
   125         HHGear^.dX := HHGear^.dX + _0_0032;
   125         HHGear^.dX := HHGear^.dX + _0_0032;
   319 
   319 
   320     // if the attack key is pressed, lose rope contact as well
   320     // if the attack key is pressed, lose rope contact as well
   321     if (Gear^.Message and gmAttack) <> 0 then
   321     if (Gear^.Message and gmAttack) <> 0 then
   322         haveCollision:= false;
   322         haveCollision:= false;
   323 
   323 
       
   324     HHGear^.dX.QWordValue:= HHGear^.dX.QWordValue shr 2;
       
   325     HHGear^.dY.QWordValue:= HHGear^.dY.QWordValue shr 2;
   324     if not haveCollision then
   326     if not haveCollision then
   325         begin
   327         begin
   326         if (Gear^.State and gsttmpFlag) <> 0 then
   328         if (Gear^.State and gsttmpFlag) <> 0 then
   327             begin
   329             begin
   328             HHGear^.dX.QWordValue:= HHGear^.dX.QWordValue shr 2;
       
   329             HHGear^.dY.QWordValue:= HHGear^.dY.QWordValue shr 2;
       
   330             
       
   331             PlaySound(sndRopeRelease);
   330             PlaySound(sndRopeRelease);
   332             if Gear^.Hedgehog^.CurAmmoType <> amParachute then
   331             if Gear^.Hedgehog^.CurAmmoType <> amParachute then
   333                 RopeWaitCollision(Gear, HHGear)
   332                 RopeWaitCollision(Gear, HHGear)
   334             else
   333             else
   335                 RopeDeleteMe(Gear, HHGear)
   334                 RopeDeleteMe(Gear, HHGear)
   399                 Gear^.Elasticity := tt;
   398                 Gear^.Elasticity := tt;
   400                 Gear^.doStep := @doStepRopeWork;
   399                 Gear^.doStep := @doStepRopeWork;
   401                 PlaySound(sndRopeAttach);
   400                 PlaySound(sndRopeAttach);
   402                 with HHGear^ do
   401                 with HHGear^ do
   403                     begin
   402                     begin
   404                     dX.QWordValue:= dX.QWordValue shl 2;
       
   405                     dY.QWordValue:= dY.QWordValue shl 2;
       
   406                     State := State and (not (gstAttacking or gstHHJumping or gstHHHJump));
   403                     State := State and (not (gstAttacking or gstHHJumping or gstHHHJump));
   407                     Message := Message and (not gmAttack)
   404                     Message := Message and (not gmAttack)
   408                     end;
   405                     end;
   409 
   406 
   410                 RopeRemoveFromAmmo(Gear, HHGear);
   407                 RopeRemoveFromAmmo(Gear, HHGear);
   427         begin
   424         begin
   428         Gear^.doStep := @doStepRopeWork;
   425         Gear^.doStep := @doStepRopeWork;
   429         PlaySound(sndRopeAttach);
   426         PlaySound(sndRopeAttach);
   430         with HHGear^ do
   427         with HHGear^ do
   431             begin
   428             begin
   432             dX.QWordValue:= dX.QWordValue shl 2;
       
   433             dY.QWordValue:= dY.QWordValue shl 2;
       
   434             State := State and (not (gstAttacking or gstHHJumping or gstHHHJump));
   429             State := State and (not (gstAttacking or gstHHJumping or gstHHHJump));
   435             Message := Message and (not gmAttack)
   430             Message := Message and (not gmAttack)
   436             end;
   431             end;
   437 
   432 
   438         RopeRemoveFromAmmo(Gear, HHGear);
   433         RopeRemoveFromAmmo(Gear, HHGear);