55 |
55 |
56 function GetAmmo(Hedgehog: PHedgehog): TAmmoType; |
56 function GetAmmo(Hedgehog: PHedgehog): TAmmoType; |
57 function GetUtility(Hedgehog: PHedgehog): TAmmoType; |
57 function GetUtility(Hedgehog: PHedgehog): TAmmoType; |
58 |
58 |
59 function WorldWrap(var Gear: PGear): boolean; |
59 function WorldWrap(var Gear: PGear): boolean; |
60 function CalcWorldWrap(X, radius: LongInt): LongInt; |
|
61 |
60 |
62 function IsHogLocal(HH: PHedgehog): boolean; |
61 function IsHogLocal(HH: PHedgehog): boolean; |
63 |
62 |
64 |
63 |
65 function MakeHedgehogsStep(Gear: PGear) : boolean; |
64 function MakeHedgehogsStep(Gear: PGear) : boolean; |
1627 *) |
1626 *) |
1628 WorldWrap:= true |
1627 WorldWrap:= true |
1629 end; |
1628 end; |
1630 end; |
1629 end; |
1631 |
1630 |
1632 // Takes an X coordinate and corrects if according to the world edge rules |
|
1633 // Wrap-around: X will be wrapped |
|
1634 // Bouncy: X will be kept inside the legal land (taking radius into account) |
|
1635 // Other world edges: Just returns X |
|
1636 // radius is a radius (gear radius) tolerance for an appropriate distance from bouncy world edges. |
|
1637 // Set radius to 0 if you don't care. |
|
1638 function CalcWorldWrap(X, radius: LongInt): LongInt; |
|
1639 begin |
|
1640 if WorldEdge = weWrap then |
|
1641 if X < LongInt(leftX) then |
|
1642 X:= X + (LongInt(rightX) - LongInt(leftX)) |
|
1643 else if X > LongInt(rightX) then |
|
1644 X:= X - (LongInt(rightX) - LongInt(leftX)) |
|
1645 else if WorldEdge = weBounce then |
|
1646 if X - radius < LongInt(leftX) then |
|
1647 X:= LongInt(leftX) + radius |
|
1648 else if X + radius > LongInt(rightX) then |
|
1649 X:= LongInt(rightX) - radius; |
|
1650 CalcWorldWrap:= X; |
|
1651 end; |
|
1652 |
|
1653 procedure AddBounceEffectForGear(Gear: PGear); |
1631 procedure AddBounceEffectForGear(Gear: PGear); |
1654 var boing: PVisualGear; |
1632 var boing: PVisualGear; |
1655 begin |
1633 begin |
1656 boing:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtStraightShot, 0, false, 1); |
1634 boing:= AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtStraightShot, 0, false, 1); |
1657 if boing <> nil then |
1635 if boing <> nil then |