1838 DeleteGear(Gear) |
1838 DeleteGear(Gear) |
1839 end; |
1839 end; |
1840 |
1840 |
1841 //////////////////////////////////////////////////////////////////////////////// |
1841 //////////////////////////////////////////////////////////////////////////////// |
1842 procedure doStepDrillDrilling(Gear: PGear); |
1842 procedure doStepDrillDrilling(Gear: PGear); |
1843 var ox,oy: hwFloat; |
1843 var t: PGearArray; |
1844 begin |
1844 ox, oy: hwFloat; |
1845 AllInactive:= false; |
1845 begin |
1846 |
1846 AllInactive:= false; |
1847 if (Gear^.Timer > 0) and ((Gear^.Timer mod 20) = 0) then |
1847 |
|
1848 if (Gear^.Timer > 0) and ((Gear^.Timer mod 10) = 0) then |
1848 begin |
1849 begin |
1849 ox:= Gear^.X; |
1850 ox:= Gear^.X; |
1850 oy:= Gear^.Y; |
1851 oy:= Gear^.Y; |
1851 Gear^.X:= Gear^.X + Gear^.dX; |
1852 Gear^.X:= Gear^.X + Gear^.dX; |
1852 Gear^.Y:= Gear^.Y + Gear^.dY; |
1853 Gear^.Y:= Gear^.Y + Gear^.dY; |
1853 DrawTunnel(oX, oY, Gear^.dX, Gear^.dY, 2, 6); |
1854 DrawTunnel(oX, oY, Gear^.dX, Gear^.dY, 2, 6); |
1854 CheckGearDrowning(Gear); |
1855 CheckGearDrowning(Gear); |
1855 end; |
1856 end; |
1856 |
1857 |
|
1858 t:= CheckGearsCollision(Gear); //fixes drill not exploding when touching HH bug |
1857 if (Gear^.Timer = 0) |
1859 if (Gear^.Timer = 0) |
|
1860 or (t^.Count <> 0) |
1858 or (not TestCollisionYWithGear(Gear, hwSign(Gear^.dY)) |
1861 or (not TestCollisionYWithGear(Gear, hwSign(Gear^.dY)) |
1859 and not TestCollisionXWithGear(Gear, hwSign(Gear^.dX))) then |
1862 and not TestCollisionXWithGear(Gear, hwSign(Gear^.dX))) then |
1860 begin //out of time or exited ground |
1863 begin //out of time or exited ground |
1861 doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound); |
1864 doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound); |
1862 DeleteGear(Gear); |
1865 DeleteGear(Gear); |
1879 doStepFallingGear(Gear); |
1883 doStepFallingGear(Gear); |
1880 |
1884 |
1881 if (GameTicks and $3F) = 0 then |
1885 if (GameTicks and $3F) = 0 then |
1882 AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtSmokeTrace, 0, _0, _0, 0); |
1886 AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtSmokeTrace, 0, _0, _0, 0); |
1883 |
1887 |
1884 if ((Gear^.State and gstCollision) <> 0) then |
1888 if ((Gear^.State and gstCollision) <> 0) then begin //hit |
1885 begin //hit |
|
1886 Gear^.dX:= oldDx; |
1889 Gear^.dX:= oldDx; |
1887 Gear^.dY:= oldDy; |
1890 Gear^.dY:= oldDy; |
|
1891 |
1888 t:= CheckGearsCollision(Gear); |
1892 t:= CheckGearsCollision(Gear); |
|
1893 if (t^.Count = 0) then begin //hit the ground not the HH |
|
1894 t2 := _0_5 / Distance(Gear^.dX, Gear^.dY); |
|
1895 Gear^.dX:= Gear^.dX * t2; |
|
1896 Gear^.dY:= Gear^.dY * t2; |
|
1897 end else begin //explode right on contact with HH |
|
1898 doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 50, EXPLAutoSound); |
|
1899 DeleteGear(Gear); |
|
1900 exit; |
|
1901 end; |
|
1902 |
1889 Gear^.doStep:= @doStepDrillDrilling; |
1903 Gear^.doStep:= @doStepDrillDrilling; |
1890 if (t^.Count = 0) then |
1904 dec(Gear^.Timer) |
1891 begin //hit the ground not the hedgehog |
|
1892 newy:= hwSqrt((_0_5 * Gear^.dY * Gear^.dY) / Distance(Gear^.dX, Gear^.dY)); |
|
1893 if (Gear^.dY < _0) then newY := -newY; |
|
1894 newx:= newy * Gear^.dX / Gear^.dY; |
|
1895 Gear^.dX := newx; |
|
1896 Gear^.dY := newy; |
|
1897 dec(Gear^.Timer) |
|
1898 end |
|
1899 else |
|
1900 Gear^.Timer:= 0 |
|
1901 end |
1905 end |
1902 end; |
1906 end; |
1903 |
1907 |
|
1908 //////////////////////////////////////////////////////////////////////////////// |
1904 procedure doStepBallgunWork(Gear: PGear); |
1909 procedure doStepBallgunWork(Gear: PGear); |
1905 var HHGear: PGear; |
1910 var HHGear: PGear; |
1906 rx, ry: hwFloat; |
1911 rx, ry: hwFloat; |
1907 begin |
1912 begin |
1908 AllInactive:= false; |
1913 AllInactive:= false; |