37 |
37 |
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; trap: boolean ): PGear; |
42 procedure ResurrectHedgehog(gear: PGear); |
43 procedure ResurrectHedgehog(gear: PGear); |
43 procedure ProcessGears; |
44 procedure ProcessGears; |
44 procedure EndTurnCleanup; |
45 procedure EndTurnCleanup; |
45 procedure ApplyDamage(Gear: PGear; AttackerHog: PHedgehog; Damage: Longword; Source: TDamageSource); |
46 procedure ApplyDamage(Gear: PGear; AttackerHog: PHedgehog; Damage: Longword; Source: TDamageSource); |
46 procedure SetAllToActive; |
47 procedure SetAllToActive; |
1605 function SpawnCustomCrateAt(x, y: LongInt; crate: TCrateType; content: Longword): PGear; |
1606 function SpawnCustomCrateAt(x, y: LongInt; crate: TCrateType; content: Longword): PGear; |
1606 begin |
1607 begin |
1607 FollowGear := AddGear(x, y, gtCase, 0, _0, _0, 0); |
1608 FollowGear := AddGear(x, y, gtCase, 0, _0, _0, 0); |
1608 cCaseFactor := 0; |
1609 cCaseFactor := 0; |
1609 |
1610 |
1610 if (content > ord(High(TAmmoType))) then content := ord(High(TAmmoType)); |
1611 if (crate <> HealthCrate) and (content > ord(High(TAmmoType))) then content := ord(High(TAmmoType)); |
1611 |
1612 |
1612 case crate of |
1613 case crate of |
1613 HealthCrate: begin |
1614 HealthCrate: begin |
1614 FollowGear^.Health := cHealthCaseAmount; |
|
1615 FollowGear^.Pos := posCaseHealth; |
1615 FollowGear^.Pos := posCaseHealth; |
|
1616 FollowGear^.Health := content; |
1616 AddCaption(GetEventString(eidNewHealthPack), cWhiteColor, capgrpAmmoInfo); |
1617 AddCaption(GetEventString(eidNewHealthPack), cWhiteColor, capgrpAmmoInfo); |
1617 end; |
1618 end; |
1618 AmmoCrate: begin |
1619 AmmoCrate: begin |
1619 FollowGear^.Pos := posCaseAmmo; |
1620 FollowGear^.Pos := posCaseAmmo; |
1620 FollowGear^.AmmoType := TAmmoType(content); |
1621 FollowGear^.AmmoType := TAmmoType(content); |
1628 end; |
1629 end; |
1629 |
1630 |
1630 if ( (x = 0) and (y = 0) ) then FindPlace(FollowGear, true, 0, LAND_WIDTH); |
1631 if ( (x = 0) and (y = 0) ) then FindPlace(FollowGear, true, 0, LAND_WIDTH); |
1631 |
1632 |
1632 SpawnCustomCrateAt := FollowGear; |
1633 SpawnCustomCrateAt := FollowGear; |
|
1634 end; |
|
1635 |
|
1636 function SpawnFakeCrateAt(x, y: LongInt; crate: TCrateType; trap: boolean): PGear; |
|
1637 begin |
|
1638 FollowGear := AddGear(x, y, gtCase, 0, _0, _0, 0); |
|
1639 cCaseFactor := 0; |
|
1640 |
|
1641 if trap then FollowGear^.Pos := posCaseTrap |
|
1642 else FollowGear^.Pos := posCaseDummy; |
|
1643 |
|
1644 case crate of |
|
1645 HealthCrate: begin |
|
1646 FollowGear^.Pos := FollowGear^.Pos + posCaseHealth; |
|
1647 AddCaption(GetEventString(eidNewHealthPack), cWhiteColor, capgrpAmmoInfo); |
|
1648 end; |
|
1649 AmmoCrate: begin |
|
1650 FollowGear^.Pos := FollowGear^.Pos + posCaseAmmo; |
|
1651 AddCaption(GetEventString(eidNewAmmoPack), cWhiteColor, capgrpAmmoInfo); |
|
1652 end; |
|
1653 UtilityCrate: begin |
|
1654 FollowGear^.Pos := FollowGear^.Pos + posCaseUtility; |
|
1655 AddCaption(GetEventString(eidNewUtilityPack), cWhiteColor, capgrpAmmoInfo); |
|
1656 end; |
|
1657 end; |
|
1658 |
|
1659 if ( (x = 0) and (y = 0) ) then FindPlace(FollowGear, true, 0, LAND_WIDTH); |
|
1660 |
|
1661 SpawnFakeCrateAt := FollowGear; |
1633 end; |
1662 end; |
1634 |
1663 |
1635 procedure SpawnBoxOfSmth; |
1664 procedure SpawnBoxOfSmth; |
1636 var t, aTot, uTot, a, h: LongInt; |
1665 var t, aTot, uTot, a, h: LongInt; |
1637 i: TAmmoType; |
1666 i: TAmmoType; |