equal
deleted
inserted
replaced
1 (* |
1 (* |
2 * Hedgewars, a worms-like game |
2 * Hedgewars, a worms-like game |
3 * Copyright (c) 2004, 2005 Andrey Korotaev <unC0Rr@gmail.com> |
3 * Copyright (c) 2004, 2005, 2006 Andrey Korotaev <unC0Rr@gmail.com> |
4 * |
4 * |
5 * Distributed under the terms of the BSD-modified licence: |
5 * Distributed under the terms of the BSD-modified licence: |
6 * |
6 * |
7 * Permission is hereby granted, free of charge, to any person obtaining a copy |
7 * Permission is hereby granted, free of charge, to any person obtaining a copy |
8 * of this software and associated documentation files (the "Software"), to deal |
8 * of this software and associated documentation files (the "Software"), to deal |
136 case Gear.Kind of |
136 case Gear.Kind of |
137 gtAmmo_Bomb: doMakeExplosion(round(Gear.X), round(Gear.Y), 50, EXPLAutoSound); |
137 gtAmmo_Bomb: doMakeExplosion(round(Gear.X), round(Gear.Y), 50, EXPLAutoSound); |
138 gtClusterBomb: begin |
138 gtClusterBomb: begin |
139 doMakeExplosion(round(Gear.X), round(Gear.Y), 30, EXPLAutoSound); |
139 doMakeExplosion(round(Gear.X), round(Gear.Y), 30, EXPLAutoSound); |
140 for i:= 0 to 4 do |
140 for i:= 0 to 4 do |
141 AddGear(round(Gear.X), round(Gear.Y), gtCluster, 0, (getrandom - 0.5)*0.2, (getrandom - 2) * 0.2); |
141 AddGear(round(Gear.X), round(Gear.Y), gtCluster, 0, (getrandom - 0.5)*0.2, (getrandom - 3) * 0.08); |
142 end |
142 end |
143 end; |
143 end; |
144 DeleteGear(Gear); |
144 DeleteGear(Gear); |
145 exit |
145 exit |
146 end; |
146 end; |
668 dec(Gear.Timer); |
668 dec(Gear.Timer); |
669 end; |
669 end; |
670 |
670 |
671 //////////////////////////////////////////////////////////////////////////////// |
671 //////////////////////////////////////////////////////////////////////////////// |
672 procedure doStepCase(Gear: PGear); |
672 procedure doStepCase(Gear: PGear); |
|
673 var i: integer; |
673 begin |
674 begin |
674 if (Gear.Message and gm_Destroy) > 0 then |
675 if (Gear.Message and gm_Destroy) > 0 then |
675 begin |
676 begin |
676 DeleteGear(Gear); |
677 DeleteGear(Gear); |
|
678 exit |
|
679 end; |
|
680 |
|
681 if Gear.Damage > 0 then |
|
682 begin |
|
683 DeleteGear(Gear); |
|
684 doMakeExplosion(round(Gear.X), round(Gear.Y), 25, EXPLAutoSound); |
|
685 for i:= 0 to 63 do |
|
686 AddGear(round(Gear.X), round(Gear.Y), gtFlame, 0); |
677 exit |
687 exit |
678 end; |
688 end; |
679 |
689 |
680 if (Gear.dY <> 0) or (not TestCollisionYwithGear(Gear, 1)) then |
690 if (Gear.dY <> 0) or (not TestCollisionYwithGear(Gear, 1)) then |
681 begin |
691 begin |
692 CheckGearDrowning(Gear); |
702 CheckGearDrowning(Gear); |
693 end; |
703 end; |
694 |
704 |
695 if (Gear.CollIndex = High(Longword)) and (Gear.dY = 0) then AddGearCI(Gear) |
705 if (Gear.CollIndex = High(Longword)) and (Gear.dY = 0) then AddGearCI(Gear) |
696 else if (Gear.CollIndex < High(Longword)) and (Gear.dY <> 0) then DeleteCI(Gear); |
706 else if (Gear.CollIndex < High(Longword)) and (Gear.dY <> 0) then DeleteCI(Gear); |
697 |
|
698 if Gear.Damage > 0 then |
|
699 begin |
|
700 DeleteGear(Gear); |
|
701 doMakeExplosion(round(Gear.X), round(Gear.Y), 20, EXPLAutoSound) |
|
702 end |
|
703 end; |
707 end; |
704 |
708 |
705 //////////////////////////////////////////////////////////////////////////////// |
709 //////////////////////////////////////////////////////////////////////////////// |
706 var thexchar: array[0..5] of record |
710 var thexchar: array[0..5] of record |
707 oy, ny: integer; |
711 oy, ny: integer; |
756 end; |
760 end; |
757 Gear.Timer:= 640; |
761 Gear.Timer:= 640; |
758 Gear.doStep:= doStepTeamHealthSorterWork |
762 Gear.doStep:= doStepTeamHealthSorterWork |
759 end; |
763 end; |
760 |
764 |
|
765 //////////////////////////////////////////////////////////////////////////////// |
|
766 procedure doStepShover(Gear: PGear); |
|
767 var HHGear: PGear; |
|
768 begin |
|
769 HHGear:= PHedgehog(Gear.Hedgehog)^.Gear; |
|
770 HHGear.State:= HHGear.State or gstNoDamage; |
|
771 AmmoShove(Gear, 30, 115); |
|
772 HHGear.State:= HHGear.State and not gstNoDamage; |
|
773 DeleteGear(Gear) |
|
774 end; |
|
775 |
|
776 //////////////////////////////////////////////////////////////////////////////// |
|
777 procedure doStepFlame(Gear: PGear); |
|
778 begin |
|
779 AllInactive:= false; |
|
780 if not TestCollisionYwithGear(Gear, 1) then |
|
781 begin |
|
782 Gear.dX:= Gear.dX + cWindSpeed; |
|
783 Gear.dY:= Gear.dY + cGravity; |
|
784 if abs(Gear.dX) > 0.12 then Gear.dX:= Gear.dX * 0.5; |
|
785 if Gear.dY > 0.12 then Gear.dY:= Gear.dY * 0.995; |
|
786 Gear.X:= Gear.X + Gear.dX; |
|
787 Gear.Y:= Gear.Y + Gear.dY; |
|
788 if Gear.Y > 1023 then |
|
789 begin |
|
790 DeleteGear(Gear); |
|
791 exit |
|
792 end |
|
793 end else begin |
|
794 if Gear.Timer > 0 then dec(Gear.Timer) |
|
795 else begin |
|
796 doMakeExplosion(round(Gear.X), round(Gear.Y), 2, 0); |
|
797 dec(Gear.Health); |
|
798 Gear.Timer:= 1250 - Gear.Angle * 12 |
|
799 end |
|
800 end; |
|
801 |
|
802 if (((GameTicks div 8) mod 64) = Gear.Angle) then |
|
803 AmmoFlameWork(Gear); |
|
804 |
|
805 if Gear.Health = 0 then |
|
806 DeleteGear(Gear) |
|
807 end; |