changeset 1551 | c747e69f98f3 |
parent 1548 | 682c0c968997 |
child 1552 | cd907418da91 |
1550:2331fe280aef | 1551:c747e69f98f3 |
---|---|
628 procedure doStepRopeWork(Gear: PGear); |
628 procedure doStepRopeWork(Gear: PGear); |
629 const flCheck: boolean = false; |
629 const flCheck: boolean = false; |
630 var HHGear: PGear; |
630 var HHGear: PGear; |
631 len, cs, cc, tx, ty, nx, ny, ropeDx, ropeDy: hwFloat; |
631 len, cs, cc, tx, ty, nx, ny, ropeDx, ropeDy: hwFloat; |
632 lx, ly: LongInt; |
632 lx, ly: LongInt; |
633 haveCollision: boolean; |
|
633 |
634 |
634 procedure DeleteMe; |
635 procedure DeleteMe; |
635 begin |
636 begin |
636 with HHGear^ do |
637 with HHGear^ do |
637 begin |
638 begin |
734 or TestCollisionYwithGear(HHGear, -hwSign(ropeDy))) then Gear^.Elasticity:= Gear^.Elasticity - _0_3; |
735 or TestCollisionYwithGear(HHGear, -hwSign(ropeDy))) then Gear^.Elasticity:= Gear^.Elasticity - _0_3; |
735 |
736 |
736 HHGear^.X:= Gear^.X + cc*Gear^.Elasticity; |
737 HHGear^.X:= Gear^.X + cc*Gear^.Elasticity; |
737 HHGear^.Y:= Gear^.Y + cs*Gear^.Elasticity; |
738 HHGear^.Y:= Gear^.Y + cs*Gear^.Elasticity; |
738 |
739 |
740 haveCollision:= false; |
|
739 if TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then |
741 if TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then |
742 begin |
|
740 HHGear^.dX:= -_0_6 * HHGear^.dX; |
743 HHGear^.dX:= -_0_6 * HHGear^.dX; |
744 haveCollision:= true |
|
745 end; |
|
741 if TestCollisionYwithGear(HHGear, hwSign(HHGear^.dY)) then |
746 if TestCollisionYwithGear(HHGear, hwSign(HHGear^.dY)) then |
747 begin |
|
742 HHGear^.dY:= -_0_6 * HHGear^.dY; |
748 HHGear^.dY:= -_0_6 * HHGear^.dY; |
749 haveCollision:= true |
|
750 end; |
|
751 |
|
752 if haveCollision and (Gear^.Message and (gm_Left or gm_Right) <> 0) then |
|
753 begin |
|
754 HHGear^.dX:= SignAs(hwAbs(HHGear^.dX) + _0_15, HHGear^.dX); |
|
755 HHGear^.dY:= SignAs(hwAbs(HHGear^.dY) + _0_15, HHGear^.dY) |
|
756 end; |
|
743 |
757 |
744 len:= Distance(HHGear^.dX, HHGear^.dY); |
758 len:= Distance(HHGear^.dX, HHGear^.dY); |
745 if len > _0_8 then |
759 if len > _0_8 then |
746 begin |
760 begin |
747 len:= _0_8 / len; |
761 len:= _0_8 / len; |