54 procedure AmmoShoveLine(Ammo: PGear; Damage, Power: LongInt; oX, oY, tX, tY: hwFloat); |
54 procedure AmmoShoveLine(Ammo: PGear; Damage, Power: LongInt; oX, oY, tX, tY: hwFloat); |
55 function GearsNear(X, Y: hwFloat; Kind: TGearType; r: LongInt): PGearArrayS; |
55 function GearsNear(X, Y: hwFloat; Kind: TGearType; r: LongInt): PGearArrayS; |
56 function SpawnBoxOfSmth: PGear; |
56 function SpawnBoxOfSmth: PGear; |
57 procedure PlayBoxSpawnTaunt(Gear: PGear); |
57 procedure PlayBoxSpawnTaunt(Gear: PGear); |
58 procedure ShotgunShot(Gear: PGear); |
58 procedure ShotgunShot(Gear: PGear); |
|
59 function CountHogsInTeam(HHGear: PGear; countHidden: boolean): LongInt; |
59 function CanUseTardis(HHGear: PGear): boolean; |
60 function CanUseTardis(HHGear: PGear): boolean; |
60 |
61 |
61 procedure SetAllToActive; |
62 procedure SetAllToActive; |
62 procedure SetAllHHToActive(Ice: boolean); |
63 procedure SetAllHHToActive(Ice: boolean); |
63 procedure SetAllHHToActive(); inline; |
64 procedure SetAllHHToActive(); inline; |
1320 end; |
1321 end; |
1321 if (GameFlags and gfSolidLand) = 0 then |
1322 if (GameFlags and gfSolidLand) = 0 then |
1322 DrawExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), cShotgunRadius) |
1323 DrawExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), cShotgunRadius) |
1323 end; |
1324 end; |
1324 |
1325 |
|
1326 // Return number of living hogs in HHGear's team |
|
1327 // * HHGear: hog gear for which to count team hogs |
|
1328 // * countHidden: if true, also count hidden hogs (e.g. time-travel) |
|
1329 function CountHogsInTeam(HHGear: PGear; countHidden: boolean): LongInt; |
|
1330 var i, j, cnt: LongInt; |
|
1331 HH: PHedgehog; |
|
1332 begin |
|
1333 if HHGear = nil then |
|
1334 exit(0); |
|
1335 HH:= HHGear^.Hedgehog; |
|
1336 cnt:= 0; |
|
1337 for j:= 0 to Pred(HH^.Team^.Clan^.TeamsNumber) do |
|
1338 for i:= 0 to Pred(HH^.Team^.Clan^.Teams[j]^.HedgehogsNumber) do |
|
1339 if (HH^.Team^.Clan^.Teams[j]^.Hedgehogs[i].Gear <> nil) |
|
1340 and ((HH^.Team^.Clan^.Teams[j]^.Hedgehogs[i].Gear^.State and gstDrowning) = 0) |
|
1341 and (HH^.Team^.Clan^.Teams[j]^.Hedgehogs[i].Gear^.Health > HH^.Team^.Clan^.Teams[j]^.Hedgehogs[i].Gear^.Damage) then |
|
1342 inc(cnt) |
|
1343 else if countHidden and (HH^.Team^.Clan^.Teams[j]^.Hedgehogs[i].GearHidden <> nil) then |
|
1344 inc(cnt); |
|
1345 CountHogsInTeam:= cnt; |
|
1346 end; |
|
1347 |
|
1348 |
1325 // Returns true if the given hog gear can use the tardis |
1349 // Returns true if the given hog gear can use the tardis |
1326 function CanUseTardis(HHGear: PGear): boolean; |
1350 function CanUseTardis(HHGear: PGear): boolean; |
1327 var usable: boolean; |
1351 var usable: boolean; |
1328 i, j, cnt: LongInt; |
1352 cnt: LongInt; |
1329 HH: PHedgehog; |
1353 HH: PHedgehog; |
1330 begin |
1354 begin |
1331 (* |
1355 (* |
1332 Conditions for not activating. |
1356 Conditions for not activating. |
1333 1. Hog is last of his clan |
1357 1. Hog is last of his clan |
1337 usable:= true; |
1361 usable:= true; |
1338 HH:= HHGear^.Hedgehog; |
1362 HH:= HHGear^.Hedgehog; |
1339 if HHGear <> nil then |
1363 if HHGear <> nil then |
1340 if (HHGear = nil) or (HH^.King) or (SuddenDeathActive) then |
1364 if (HHGear = nil) or (HH^.King) or (SuddenDeathActive) then |
1341 usable:= false; |
1365 usable:= false; |
1342 cnt:= 0; |
1366 cnt:= CountHogsInTeam(HHGear, false); |
1343 for j:= 0 to Pred(HH^.Team^.Clan^.TeamsNumber) do |
|
1344 for i:= 0 to Pred(HH^.Team^.Clan^.Teams[j]^.HedgehogsNumber) do |
|
1345 if (HH^.Team^.Clan^.Teams[j]^.Hedgehogs[i].Gear <> nil) |
|
1346 and ((HH^.Team^.Clan^.Teams[j]^.Hedgehogs[i].Gear^.State and gstDrowning) = 0) |
|
1347 and (HH^.Team^.Clan^.Teams[j]^.Hedgehogs[i].Gear^.Health > HH^.Team^.Clan^.Teams[j]^.Hedgehogs[i].Gear^.Damage) then |
|
1348 inc(cnt); |
|
1349 if (cnt < 2) then |
1367 if (cnt < 2) then |
1350 usable:= false; |
1368 usable:= false; |
1351 CanUseTardis:= usable; |
1369 CanUseTardis:= usable; |
1352 end; |
1370 end; |
1353 |
1371 |