hedgewars/uGearsHandlersRope.pas
changeset 7602 a620319d377e
parent 7601 c96ff1a053d0
child 7604 c143c942b5fe
equal deleted inserted replaced
7601:c96ff1a053d0 7602:a620319d377e
    74 end;
    74 end;
    75 
    75 
    76 procedure RopeDeleteMe(Gear, HHGear: PGear);
    76 procedure RopeDeleteMe(Gear, HHGear: PGear);
    77 begin
    77 begin
    78     PlaySound(sndRopeRelease);
    78     PlaySound(sndRopeRelease);
    79     HHGear^.dX.QWordValue:= HHGear^.dX.QWordValue shr 3;
    79     HHGear^.dX.QWordValue:= HHGear^.dX.QWordValue div Gear^.stepFreq;
    80     HHGear^.dY.QWordValue:= HHGear^.dY.QWordValue shr 3;
    80     HHGear^.dY.QWordValue:= HHGear^.dY.QWordValue div Gear^.stepFreq;
    81     with HHGear^ do
    81     with HHGear^ do
    82         begin
    82         begin
    83         Message := Message and (not gmAttack);
    83         Message := Message and (not gmAttack);
    84         State := (State or gstMoving) and (not gstWinner);
    84         State := (State or gstMoving) and (not gstWinner);
    85         end;
    85         end;
    87 end;
    87 end;
    88 
    88 
    89 procedure RopeWaitCollision(Gear, HHGear: PGear);
    89 procedure RopeWaitCollision(Gear, HHGear: PGear);
    90 begin
    90 begin
    91     PlaySound(sndRopeRelease);
    91     PlaySound(sndRopeRelease);
    92     HHGear^.dX.QWordValue:= HHGear^.dX.QWordValue shr 3;
       
    93     HHGear^.dY.QWordValue:= HHGear^.dY.QWordValue shr 3;
       
    94     with HHGear^ do
    92     with HHGear^ do
    95         begin
    93         begin
    96         Message := Message and (not gmAttack);
    94         Message := Message and (not gmAttack);
    97         State := State or gstMoving;
    95         State := State or gstMoving;
    98         end;
    96         end;
    99     RopePoints.Count := 0;
    97     RopePoints.Count := 0;
   100     Gear^.Elasticity := _0;
    98     Gear^.Elasticity := _0;
   101     Gear^.doStep := @doStepRopeAfterAttack
    99     Gear^.doStep := @doStepRopeAfterAttack;
       
   100     HHGear^.dX.QWordValue:= HHGear^.dX.QWordValue div Gear^.stepFreq;
       
   101     HHGear^.dY.QWordValue:= HHGear^.dY.QWordValue div Gear^.stepFreq;
       
   102     Gear^.stepFreq := 1
   102 end;
   103 end;
   103 
   104 
   104 procedure doStepRopeWork(Gear: PGear);
   105 procedure doStepRopeWork(Gear: PGear);
   105 var 
   106 var 
   106     HHGear: PGear;
   107     HHGear: PGear;
   409                 begin
   410                 begin
   410                 Gear^.X := Gear^.X + tx;
   411                 Gear^.X := Gear^.X + tx;
   411                 Gear^.Y := Gear^.Y + ty;
   412                 Gear^.Y := Gear^.Y + ty;
   412                 Gear^.Elasticity := tt;
   413                 Gear^.Elasticity := tt;
   413                 Gear^.doStep := @doStepRopeWork;
   414                 Gear^.doStep := @doStepRopeWork;
       
   415                 Gear^.stepFreq:= 8;
   414                 PlaySound(sndRopeAttach);
   416                 PlaySound(sndRopeAttach);
   415                 with HHGear^ do
   417                 with HHGear^ do
   416                     begin
   418                     begin
   417                     dX.QWordValue:= dX.QWordValue shl 3;
   419                     dX.QWordValue:= dX.QWordValue shl 3;
   418                     dY.QWordValue:= dY.QWordValue shl 3;
   420                     dY.QWordValue:= dY.QWordValue shl 3;
   439         if Gear^.Elasticity < _10 then
   441         if Gear^.Elasticity < _10 then
   440             Gear^.Elasticity := _10000
   442             Gear^.Elasticity := _10000
   441     else
   443     else
   442         begin
   444         begin
   443         Gear^.doStep := @doStepRopeWork;
   445         Gear^.doStep := @doStepRopeWork;
       
   446         Gear^.stepFreq:= 8;
   444         PlaySound(sndRopeAttach);
   447         PlaySound(sndRopeAttach);
   445         with HHGear^ do
   448         with HHGear^ do
   446             begin
   449             begin
   447             dX.QWordValue:= dX.QWordValue shl 3;
   450             dX.QWordValue:= dX.QWordValue shl 3;
   448             dY.QWordValue:= dY.QWordValue shl 3;
   451             dY.QWordValue:= dY.QWordValue shl 3;