38 procedure initModule; |
38 procedure initModule; |
39 procedure freeModule; |
39 procedure freeModule; |
40 function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear; |
40 function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear; |
41 function SpawnCustomCrateAt(x, y: LongInt; crate: TCrateType; content: Longword ): PGear; |
41 function SpawnCustomCrateAt(x, y: LongInt; crate: TCrateType; content: Longword ): PGear; |
42 function SpawnFakeCrateAt(x, y: LongInt; crate: TCrateType; explode: boolean; poison: boolean ): PGear; |
42 function SpawnFakeCrateAt(x, y: LongInt; crate: TCrateType; explode: boolean; poison: boolean ): PGear; |
|
43 function GetAmmo: TAmmoType; |
|
44 function GetUtility: TAmmoType; |
43 procedure ResurrectHedgehog(gear: PGear); |
45 procedure ResurrectHedgehog(gear: PGear); |
44 procedure ProcessGears; |
46 procedure ProcessGears; |
45 procedure EndTurnCleanup; |
47 procedure EndTurnCleanup; |
46 procedure ApplyDamage(Gear: PGear; AttackerHog: PHedgehog; Damage: Longword; Source: TDamageSource); |
48 procedure ApplyDamage(Gear: PGear; AttackerHog: PHedgehog; Damage: Longword; Source: TDamageSource); |
47 procedure SetAllToActive; |
49 procedure SetAllToActive; |
1691 if ( (x = 0) and (y = 0) ) then FindPlace(FollowGear, true, 0, LAND_WIDTH); |
1693 if ( (x = 0) and (y = 0) ) then FindPlace(FollowGear, true, 0, LAND_WIDTH); |
1692 |
1694 |
1693 SpawnFakeCrateAt := FollowGear; |
1695 SpawnFakeCrateAt := FollowGear; |
1694 end; |
1696 end; |
1695 |
1697 |
|
1698 function GetAmmo: TAmmoType; |
|
1699 var t, aTot: LongInt; |
|
1700 i: TAmmoType; |
|
1701 begin |
|
1702 |
|
1703 aTot:= 0; |
|
1704 for i:= Low(TAmmoType) to High(TAmmoType) do |
|
1705 if (Ammoz[i].Ammo.Propz and ammoprop_Utility) = 0 then |
|
1706 inc(aTot, Ammoz[i].Probability); |
|
1707 |
|
1708 t:= aTot; |
|
1709 i:= Low(TAmmoType); |
|
1710 if (t > 0) then |
|
1711 begin |
|
1712 t:= GetRandom(t); |
|
1713 AddFileLog(inttostr(t)+' --------------'); |
|
1714 while t >= 0 do |
|
1715 begin |
|
1716 inc(i); |
|
1717 if (Ammoz[i].Ammo.Propz and ammoprop_Utility) = 0 then |
|
1718 dec(t, Ammoz[i].Probability) |
|
1719 end |
|
1720 end; |
|
1721 GetAmmo:= i |
|
1722 end; |
|
1723 |
|
1724 function GetUtility: TAmmoType; |
|
1725 var t, uTot: LongInt; |
|
1726 i: TAmmoType; |
|
1727 begin |
|
1728 |
|
1729 uTot:= 0; |
|
1730 for i:= Low(TAmmoType) to High(TAmmoType) do |
|
1731 if (Ammoz[i].Ammo.Propz and ammoprop_Utility) <> 0 then |
|
1732 inc(uTot, Ammoz[i].Probability); |
|
1733 |
|
1734 t:= uTot; |
|
1735 i:= Low(TAmmoType); |
|
1736 if (t > 0) then |
|
1737 begin |
|
1738 t:= GetRandom(t); |
|
1739 while t >= 0 do |
|
1740 begin |
|
1741 inc(i); |
|
1742 if (Ammoz[i].Ammo.Propz and ammoprop_Utility) <> 0 then |
|
1743 dec(t, Ammoz[i].Probability) |
|
1744 end |
|
1745 end; |
|
1746 GetUtility:= i |
|
1747 end; |
|
1748 |
|
1749 |
|
1750 |
1696 procedure SpawnBoxOfSmth; |
1751 procedure SpawnBoxOfSmth; |
1697 var t, aTot, uTot, a, h: LongInt; |
1752 var t, aTot, uTot, a, h: LongInt; |
1698 i: TAmmoType; |
1753 i: TAmmoType; |
1699 begin |
1754 begin |
1700 if (PlacingHogs) or |
1755 if (PlacingHogs) or |
1742 if (t > 0) then |
1797 if (t > 0) then |
1743 begin |
1798 begin |
1744 FollowGear:= AddGear(0, 0, gtCase, 0, _0, _0, 0); |
1799 FollowGear:= AddGear(0, 0, gtCase, 0, _0, _0, 0); |
1745 t:= GetRandom(t); |
1800 t:= GetRandom(t); |
1746 i:= Low(TAmmoType); |
1801 i:= Low(TAmmoType); |
1747 while t >= 0 do |
|
1748 begin |
|
1749 inc(i); |
|
1750 if (Ammoz[i].Ammo.Propz and ammoprop_Utility) = 0 then |
|
1751 dec(t, Ammoz[i].Probability) |
|
1752 end; |
|
1753 FollowGear^.Pos:= posCaseAmmo; |
1802 FollowGear^.Pos:= posCaseAmmo; |
1754 FollowGear^.AmmoType:= i; |
1803 FollowGear^.AmmoType:= i; |
1755 AddCaption(GetEventString(eidNewAmmoPack), cWhiteColor, capgrpAmmoInfo); |
1804 AddCaption(GetEventString(eidNewAmmoPack), cWhiteColor, capgrpAmmoInfo); |
1756 end |
1805 end |
1757 end |
1806 end |
1761 if (t > 0) then |
1810 if (t > 0) then |
1762 begin |
1811 begin |
1763 FollowGear:= AddGear(0, 0, gtCase, 0, _0, _0, 0); |
1812 FollowGear:= AddGear(0, 0, gtCase, 0, _0, _0, 0); |
1764 t:= GetRandom(t); |
1813 t:= GetRandom(t); |
1765 i:= Low(TAmmoType); |
1814 i:= Low(TAmmoType); |
1766 while t >= 0 do |
|
1767 begin |
|
1768 inc(i); |
|
1769 if (Ammoz[i].Ammo.Propz and ammoprop_Utility) <> 0 then |
|
1770 dec(t, Ammoz[i].Probability) |
|
1771 end; |
|
1772 FollowGear^.Pos:= posCaseUtility; |
1815 FollowGear^.Pos:= posCaseUtility; |
1773 FollowGear^.AmmoType:= i; |
1816 FollowGear^.AmmoType:= i; |
1774 AddCaption(GetEventString(eidNewUtilityPack), cWhiteColor, capgrpAmmoInfo); |
1817 AddCaption(GetEventString(eidNewUtilityPack), cWhiteColor, capgrpAmmoInfo); |
1775 end |
1818 end |
1776 end; |
1819 end; |