852 HHGear^.State := HHGear^.State and not gstNoDamage |
852 HHGear^.State := HHGear^.State and not gstNoDamage |
853 end; |
853 end; |
854 |
854 |
855 if (Gear^.Timer mod 47) = 0 then |
855 if (Gear^.Timer mod 47) = 0 then |
856 begin |
856 begin |
|
857 for i:= 0 to 1 do |
|
858 AddVisualGear(hwRound(Gear^.X) - 5 + Random(10), hwRound(Gear^.Y) + 12, vgtDust); |
857 i := hwRound(Gear^.X) - Gear^.Radius - LongInt(GetRandom(2)); |
859 i := hwRound(Gear^.X) - Gear^.Radius - LongInt(GetRandom(2)); |
858 ei := hwRound(Gear^.X) + Gear^.Radius + LongInt(GetRandom(2)); |
860 ei := hwRound(Gear^.X) + Gear^.Radius + LongInt(GetRandom(2)); |
859 while i <= ei do |
861 while i <= ei do |
860 begin |
862 begin |
861 DrawExplosion(i, hwRound(Gear^.Y) + 3, 3); |
863 DrawExplosion(i, hwRound(Gear^.Y) + 3, 3); |
3880 AllInactive:= false; |
3882 AllInactive:= false; |
3881 end; |
3883 end; |
3882 |
3884 |
3883 //////////////////////////////////////////////////////////////////////////////// |
3885 //////////////////////////////////////////////////////////////////////////////// |
3884 procedure doStepHammer(Gear: PGear); |
3886 procedure doStepHammer(Gear: PGear); |
3885 var HHGear, tmp: PGear; |
3887 var HHGear, tmp, tmp2: PGear; |
3886 t: PGearArray; |
3888 t: PGearArray; |
3887 i: LongInt; |
3889 i: LongInt; |
3888 dust: PVisualGear; |
|
3889 begin |
3890 begin |
3890 HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
3891 HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear; |
3891 HHGear^.State:= HHGear^.State or gstNoDamage; |
3892 HHGear^.State:= HHGear^.State or gstNoDamage; |
3892 DeleteCI(HHGear); |
3893 DeleteCI(HHGear); |
3893 |
3894 |
3894 t:= CheckGearsCollision(Gear); |
3895 t:= CheckGearsCollision(Gear); |
|
3896 |
|
3897 for i:= 5 downto 0 do |
|
3898 AddVisualGear(hwRound(Gear^.X) - 5 + Random(10), hwRound(Gear^.Y) + 12, vgtDust); |
|
3899 |
3895 i:= t^.Count; |
3900 i:= t^.Count; |
3896 while i > 0 do |
3901 while i > 0 do |
3897 begin |
3902 begin |
3898 dec(i); |
3903 dec(i); |
3899 tmp:= t^.ar[i]; |
3904 tmp:= t^.ar[i]; |
3900 if (tmp^.State and gstNoDamage) = 0 then |
3905 if (tmp^.State and gstNoDamage) = 0 then |
3901 if (tmp^.Kind = gtHedgehog) then |
3906 if (tmp^.Kind = gtHedgehog) then |
3902 begin |
3907 begin |
3903 //tmp^.State:= tmp^.State or gstFlatened; |
3908 //tmp^.State:= tmp^.State or gstFlatened; |
3904 ApplyDamage(tmp, tmp^.Health div 2, dsUnknown); |
3909 ApplyDamage(tmp, tmp^.Health div 3, dsUnknown); |
3905 DrawTunnel(tmp^.X, tmp^.Y - _1, _0, _0_5, cHHRadius * 6, cHHRadius * 3); |
3910 //DrawTunnel(tmp^.X, tmp^.Y - _1, _0, _0_5, cHHRadius * 6, cHHRadius * 3); |
3906 for i:= 5 downto 0 do |
3911 tmp2:= AddGear(hwRound(tmp^.X), hwRound(tmp^.Y), gtHammerHit, 0, _0, _0, 0); |
3907 dust := AddVisualGear(hwRound(tmp^.X) - 5 + Random(10), hwRound(tmp^.Y) + 12, vgtDust); |
3912 tmp2^.Hedgehog:= tmp^.Hedgehog; |
3908 SetAllToActive |
3913 SetAllToActive |
3909 end |
3914 end |
3910 else |
3915 else |
3911 begin |
3916 begin |
3912 end |
3917 end |
3914 |
3919 |
3915 HHGear^.State:= HHGear^.State and not gstNoDamage; |
3920 HHGear^.State:= HHGear^.State and not gstNoDamage; |
3916 Gear^.Timer:= 250; |
3921 Gear^.Timer:= 250; |
3917 Gear^.doStep:= @doStepIdle |
3922 Gear^.doStep:= @doStepIdle |
3918 end; |
3923 end; |
|
3924 |
|
3925 //////////////////////////////////////////////////////////////////////////////// |
|
3926 procedure doStepHammerHitWork(Gear: PGear); |
|
3927 var |
|
3928 i, ei: LongInt; |
|
3929 HHGear: PGear; |
|
3930 begin |
|
3931 AllInactive := false; |
|
3932 HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; |
|
3933 dec(Gear^.Timer); |
|
3934 if (Gear^.Timer = 0)or((Gear^.Message and gm_Destroy) <> 0) then |
|
3935 begin |
|
3936 DeleteGear(Gear); |
|
3937 exit |
|
3938 end; |
|
3939 |
|
3940 if (Gear^.Timer mod 5) = 0 then |
|
3941 begin |
|
3942 AddVisualGear(hwRound(Gear^.X) - 5 + Random(10), hwRound(Gear^.Y) + 12, vgtDust); |
|
3943 |
|
3944 i := hwRound(Gear^.X) - Gear^.Radius - LongInt(GetRandom(2)); |
|
3945 ei := hwRound(Gear^.X) + Gear^.Radius + LongInt(GetRandom(2)); |
|
3946 while i <= ei do |
|
3947 begin |
|
3948 DrawExplosion(i, hwRound(Gear^.Y) + 3, 3); |
|
3949 inc(i, 1) |
|
3950 end; |
|
3951 |
|
3952 if CheckLandValue(hwRound(Gear^.X + Gear^.dX + SignAs(_6,Gear^.dX)), hwRound(Gear^.Y + _1_9) |
|
3953 , lfIndestructible) then |
|
3954 begin |
|
3955 Gear^.X := Gear^.X + Gear^.dX; |
|
3956 Gear^.Y := Gear^.Y + _1_9; |
|
3957 end; |
|
3958 SetAllHHToActive; |
|
3959 end; |
|
3960 if TestCollisionYwithGear(Gear, 1) then |
|
3961 begin |
|
3962 Gear^.dY := _0; |
|
3963 SetLittle(HHGear^.dX); |
|
3964 HHGear^.dY := _0; |
|
3965 end |
|
3966 else |
|
3967 begin |
|
3968 Gear^.dY := Gear^.dY + cGravity; |
|
3969 Gear^.Y := Gear^.Y + Gear^.dY; |
|
3970 if hwRound(Gear^.Y) > cWaterLine then Gear^.Timer := 1 |
|
3971 end; |
|
3972 |
|
3973 Gear^.X := Gear^.X + HHGear^.dX; |
|
3974 HHGear^.X := Gear^.X; |
|
3975 HHGear^.Y := Gear^.Y - int2hwFloat(cHHRadius); |
|
3976 |
|
3977 if (Gear^.Message and gm_Attack) <> 0 then |
|
3978 if (Gear^.State and gsttmpFlag) <> 0 then Gear^.Timer := 1 |
|
3979 else |
|
3980 else |
|
3981 if (Gear^.State and gsttmpFlag) = 0 then Gear^.State := Gear^.State or gsttmpFlag; |
|
3982 if ((Gear^.Message and gm_Left) <> 0) then Gear^.dX := - _0_3 |
|
3983 else |
|
3984 if ((Gear^.Message and gm_Right) <> 0) then Gear^.dX := _0_3 |
|
3985 else Gear^.dX := _0; |
|
3986 end; |
|
3987 |
|
3988 procedure doStepHammerHit(Gear: PGear); |
|
3989 var |
|
3990 i, y: LongInt; |
|
3991 ar: TRangeArray; |
|
3992 HHGear: PGear; |
|
3993 begin |
|
3994 i := 0; |
|
3995 HHGear := PHedgehog(Gear^.Hedgehog)^.Gear; |
|
3996 |
|
3997 y := hwRound(Gear^.Y) - cHHRadius * 2; |
|
3998 while y < hwRound(Gear^.Y) do |
|
3999 begin |
|
4000 ar[i].Left := hwRound(Gear^.X) - Gear^.Radius - LongInt(GetRandom(2)); |
|
4001 ar[i].Right := hwRound(Gear^.X) + Gear^.Radius + LongInt(GetRandom(2)); |
|
4002 inc(y, 2); |
|
4003 inc(i) |
|
4004 end; |
|
4005 |
|
4006 DrawHLinesExplosions(@ar, 3, hwRound(Gear^.Y) - cHHRadius * 2, 2, Pred(i)); |
|
4007 Gear^.dY := HHGear^.dY; |
|
4008 DeleteCI(HHGear); |
|
4009 |
|
4010 doStepHammerHitWork(Gear); |
|
4011 Gear^.doStep := @doStepHammerHit |
|
4012 end; |