1840 BTPrevAngle, BTSteps: LongInt; |
1840 BTPrevAngle, BTSteps: LongInt; |
1841 |
1841 |
1842 procedure doStepBlowTorchWork(Gear: PGear); |
1842 procedure doStepBlowTorchWork(Gear: PGear); |
1843 var |
1843 var |
1844 HHGear: PGear; |
1844 HHGear: PGear; |
1845 dig: boolean; |
1845 dig, hit: boolean; |
1846 prevX: LongInt; |
1846 prevX: LongInt; |
1847 begin |
1847 begin |
1848 AllInactive := false; |
1848 AllInactive := false; |
1849 WorldWrap(Gear); |
1849 WorldWrap(Gear); |
1850 dec(Gear^.Timer); |
1850 dec(Gear^.Timer); |
1851 |
1851 |
1852 if Gear^.Hedgehog^.Gear = nil then |
1852 if Gear^.Hedgehog^.Gear = nil then |
1853 begin |
1853 begin |
|
1854 ClearProximityCache(); |
1854 StopSoundChan(Gear^.SoundChannel); |
1855 StopSoundChan(Gear^.SoundChannel); |
1855 DeleteGear(Gear); |
1856 DeleteGear(Gear); |
1856 AfterAttack; |
1857 AfterAttack; |
1857 exit |
1858 exit |
1858 end; |
1859 end; |
1860 HHGear := Gear^.Hedgehog^.Gear; |
1861 HHGear := Gear^.Hedgehog^.Gear; |
1861 |
1862 |
1862 HedgehogChAngle(HHGear); |
1863 HedgehogChAngle(HHGear); |
1863 |
1864 |
1864 dig := false; |
1865 dig := false; |
|
1866 hit := false; |
1865 |
1867 |
1866 if abs(LongInt(HHGear^.Angle) - BTPrevAngle) > 7 then |
1868 if abs(LongInt(HHGear^.Angle) - BTPrevAngle) > 7 then |
1867 begin |
1869 begin |
1868 Gear^.dX := SignAs(AngleSin(HHGear^.Angle) * _0_5, Gear^.dX); |
1870 Gear^.dX := SignAs(AngleSin(HHGear^.Angle) * _0_5, Gear^.dX); |
1869 Gear^.dY := AngleCos(HHGear^.Angle) * ( - _0_5); |
1871 Gear^.dY := AngleCos(HHGear^.Angle) * ( - _0_5); |
1875 begin |
1877 begin |
1876 doStepHedgehogMoving(HHGear); |
1878 doStepHedgehogMoving(HHGear); |
1877 if (HHGear^.State and gstHHDriven) = 0 then |
1879 if (HHGear^.State and gstHHDriven) = 0 then |
1878 Gear^.Timer := 0 |
1880 Gear^.Timer := 0 |
1879 end; |
1881 end; |
|
1882 |
|
1883 if Gear^.Timer mod 1500 = 0 then |
|
1884 RefillProximityCache(Gear, 200); |
1880 |
1885 |
1881 if Gear^.Timer mod cHHStepTicks = 0 then |
1886 if Gear^.Timer mod cHHStepTicks = 0 then |
1882 begin |
1887 begin |
1883 dig := true; |
1888 dig := true; |
1884 if Gear^.dX.isNegative then |
1889 if Gear^.dX.isNegative then |
1900 |
1905 |
1901 HHGear^.State := HHGear^.State or gstAttacking |
1906 HHGear^.State := HHGear^.State or gstAttacking |
1902 end; |
1907 end; |
1903 |
1908 |
1904 inc(BTSteps); |
1909 inc(BTSteps); |
1905 if BTSteps = 7 then |
1910 if BTSteps = 11 then |
1906 begin |
1911 begin |
1907 BTSteps := 0; |
1912 BTSteps := 0; |
1908 if CheckLandValue(hwRound(HHGear^.X + Gear^.dX * (cHHRadius + cBlowTorchC) + SignAs(_6,Gear^.dX)), hwRound(HHGear^.Y + Gear^.dY * (cHHRadius + cBlowTorchC)),lfIndestructible) then |
1913 if CheckLandValue(hwRound(HHGear^.X + Gear^.dX * (cHHRadius + cBlowTorchC) + SignAs(_6,Gear^.dX)), hwRound(HHGear^.Y + Gear^.dY * (cHHRadius + cBlowTorchC)),lfIndestructible) then |
1909 begin |
1914 begin |
1910 Gear^.X := HHGear^.X + Gear^.dX * (cHHRadius + cBlowTorchC); |
1915 Gear^.X := HHGear^.X + Gear^.dX * (cHHRadius + cBlowTorchC); |
1911 Gear^.Y := HHGear^.Y + Gear^.dY * (cHHRadius + cBlowTorchC); |
1916 Gear^.Y := HHGear^.Y + Gear^.dY * (cHHRadius + cBlowTorchC); |
1912 end; |
1917 end; |
1913 HHGear^.State := HHGear^.State or gstNoDamage; |
1918 hit := true |
1914 AmmoShove(Gear, Gear^.Boom, 15); |
|
1915 HHGear^.State := HHGear^.State and (not gstNoDamage) |
|
1916 end; |
1919 end; |
1917 end; |
1920 end; |
1918 |
1921 |
1919 if dig then |
1922 if dig then |
1920 begin |
1923 begin |
1921 DrawTunnel(HHGear^.X + Gear^.dX * cHHRadius, |
1924 DrawTunnel(HHGear^.X + Gear^.dX * cHHRadius, |
1922 HHGear^.Y + Gear^.dY * cHHRadius - _1 - |
1925 HHGear^.Y + Gear^.dY * cHHRadius - _1 - |
1923 ((hwAbs(Gear^.dX) / (hwAbs(Gear^.dX) + hwAbs(Gear^.dY))) * _0_5 * 7), |
1926 ((hwAbs(Gear^.dX) / (hwAbs(Gear^.dX) + hwAbs(Gear^.dY))) * _0_5 * 7), |
1924 Gear^.dX, Gear^.dY, |
1927 Gear^.dX, Gear^.dY, |
1925 cHHStepTicks, cHHRadius * 2 + 7); |
1928 cHHStepTicks, cHHRadius * 2 + 7); |
|
1929 |
|
1930 HHGear^.State := HHGear^.State or gstNoDamage; |
|
1931 if hit then |
|
1932 AmmoShoveCache(Gear, Gear^.Boom, 15) |
|
1933 else |
|
1934 AmmoShoveCache(Gear, 0, 15); |
|
1935 HHGear^.State := HHGear^.State and (not gstNoDamage); |
1926 end; |
1936 end; |
1927 |
1937 |
1928 if (TurnTimeLeft = 0) or (Gear^.Timer = 0) |
1938 if (TurnTimeLeft = 0) or (Gear^.Timer = 0) |
1929 or ((HHGear^.Message and gmAttack) <> 0) then |
1939 or ((HHGear^.Message and gmAttack) <> 0) then |
1930 begin |
1940 begin |
|
1941 ClearProximityCache(); |
1931 StopSoundChan(Gear^.SoundChannel); |
1942 StopSoundChan(Gear^.SoundChannel); |
1932 HHGear^.Message := 0; |
1943 HHGear^.Message := 0; |
1933 HHGear^.State := HHGear^.State and (not gstNotKickable); |
1944 HHGear^.State := HHGear^.State and (not gstNotKickable); |
1934 DeleteGear(Gear); |
1945 DeleteGear(Gear); |
1935 AfterAttack |
1946 AfterAttack |
1951 ((hwAbs(Gear^.dX) / (hwAbs(Gear^.dX) + hwAbs(Gear^.dY))) * _0_5 * 7), |
1962 ((hwAbs(Gear^.dX) / (hwAbs(Gear^.dX) + hwAbs(Gear^.dY))) * _0_5 * 7), |
1952 Gear^.dX, Gear^.dY, |
1963 Gear^.dX, Gear^.dY, |
1953 cHHStepTicks, cHHRadius * 2 + 7); |
1964 cHHStepTicks, cHHRadius * 2 + 7); |
1954 HHGear^.Message := 0; |
1965 HHGear^.Message := 0; |
1955 HHGear^.State := HHGear^.State or gstNotKickable; |
1966 HHGear^.State := HHGear^.State or gstNotKickable; |
|
1967 RefillProximityCache(Gear, 200); |
1956 Gear^.SoundChannel := LoopSound(sndBlowTorch); |
1968 Gear^.SoundChannel := LoopSound(sndBlowTorch); |
1957 Gear^.doStep := @doStepBlowTorchWork |
1969 Gear^.doStep := @doStepBlowTorchWork |
1958 end; |
1970 end; |
1959 |
1971 |
1960 |
1972 |