1178 |
1178 |
1179 if (GameFlags and gfForts) = 0 then |
1179 if (GameFlags and gfForts) = 0 then |
1180 for i:= 0 to Pred(cLandAdditions) do |
1180 for i:= 0 to Pred(cLandAdditions) do |
1181 begin |
1181 begin |
1182 Gear:= AddGear(0, 0, gtMine, 0, _0, _0, 0); |
1182 Gear:= AddGear(0, 0, gtMine, 0, _0, _0, 0); |
1183 FindPlace(Gear, false, 0, LAND_WIDTH+1) |
1183 FindPlace(Gear, false, 0, LAND_WIDTH) |
1184 end |
1184 end |
1185 end; |
1185 end; |
1186 |
1186 |
1187 procedure doMakeExplosion(X, Y, Radius: LongInt; Mask: LongWord); |
1187 procedure doMakeExplosion(X, Y, Radius: LongInt; Mask: LongWord); |
1188 var Gear: PGear; |
1188 var Gear: PGear; |
1326 SetAllToActive |
1326 SetAllToActive |
1327 end; |
1327 end; |
1328 |
1328 |
1329 procedure AssignHHCoords; |
1329 procedure AssignHHCoords; |
1330 var i, t, p, j: LongInt; |
1330 var i, t, p, j: LongInt; |
1331 ar: array[0..Pred(cMaxHHs)] of PHedgehog; |
1331 ar: array[0..Pred(cMaxHHs)] of PHedgehog; |
1332 Count: Longword; |
1332 Count: Longword; |
1333 begin |
1333 begin |
1334 if (GameFlags and (gfForts or gfDivideTeams)) <> 0 then |
1334 if (GameFlags and (gfForts or gfDivideTeams)) <> 0 then |
1335 begin |
1335 begin |
1336 t:= 0; |
1336 t:= 0; |
1337 TryDo(ClansCount = 2, 'More or less than 2 clans on map in divided teams mode!', true); |
1337 TryDo(ClansCount = 2, 'More or less than 2 clans on map in divided teams mode!', true); |
1342 with Teams[j]^ do |
1342 with Teams[j]^ do |
1343 for i:= 0 to cMaxHHIndex do |
1343 for i:= 0 to cMaxHHIndex do |
1344 with Hedgehogs[i] do |
1344 with Hedgehogs[i] do |
1345 if (Gear <> nil) and (Gear^.X.QWordValue = 0) then |
1345 if (Gear <> nil) and (Gear^.X.QWordValue = 0) then |
1346 begin |
1346 begin |
1347 FindPlace(Gear, false, t, t + 1024);// could make Gear == nil |
1347 FindPlace(Gear, false, t, t + LAND_WIDTH div 2);// could make Gear == nil |
1348 if Gear <> nil then |
1348 if Gear <> nil then |
1349 begin |
1349 begin |
1350 Gear^.Pos:= GetRandom(19); |
1350 Gear^.Pos:= GetRandom(19); |
1351 Gear^.dX.isNegative:= p = 1; |
1351 Gear^.dX.isNegative:= p = 1; |
1352 end |
1352 end |
1353 end; |
1353 end; |
1354 inc(t, 1024) |
1354 t:= LAND_WIDTH div 2 |
1355 end |
1355 end |
1356 end else // mix hedgehogs |
1356 end else // mix hedgehogs |
1357 begin |
1357 begin |
1358 Count:= 0; |
1358 Count:= 0; |
1359 for p:= 0 to Pred(TeamsCount) do |
1359 for p:= 0 to Pred(TeamsCount) do |
1369 end; |
1369 end; |
1370 |
1370 |
1371 while (Count > 0) do |
1371 while (Count > 0) do |
1372 begin |
1372 begin |
1373 i:= GetRandom(Count); |
1373 i:= GetRandom(Count); |
1374 FindPlace(ar[i]^.Gear, false, 0, LAND_WIDTH+1); |
1374 FindPlace(ar[i]^.Gear, false, 0, LAND_WIDTH); |
1375 if ar[i]^.Gear <> nil then |
1375 if ar[i]^.Gear <> nil then |
1376 begin |
1376 begin |
1377 ar[i]^.Gear^.dX.isNegative:= ar[i]^.Gear^.X > _4096; // LAND_WIDTH |
1377 ar[i]^.Gear^.dX.isNegative:= hwRound(ar[i]^.Gear^.X) > LAND_WIDTH div 2; |
1378 ar[i]^.Gear^.Pos:= GetRandom(19); |
1378 ar[i]^.Gear^.Pos:= GetRandom(19); |
1379 ar[i]:= ar[Count - 1] |
1379 ar[i]:= ar[Count - 1] |
1380 end; |
1380 end; |
1381 dec(Count) |
1381 dec(Count) |
1382 end |
1382 end |
1480 PlaySound(sndReinforce, false, CurrentTeam^.voicepack); |
1480 PlaySound(sndReinforce, false, CurrentTeam^.voicepack); |
1481 FollowGear^.Pos:= posCaseAmmo; |
1481 FollowGear^.Pos:= posCaseAmmo; |
1482 FollowGear^.State:= Longword(i) |
1482 FollowGear^.State:= Longword(i) |
1483 end; |
1483 end; |
1484 end; |
1484 end; |
1485 FindPlace(FollowGear, true, 0, 4096) |
1485 |
|
1486 FindPlace(FollowGear, true, 0, LAND_WIDTH) |
1486 end; |
1487 end; |
1487 |
1488 |
1488 procedure FindPlace(var Gear: PGear; withFall: boolean; Left, Right: LongInt); |
1489 procedure FindPlace(var Gear: PGear; withFall: boolean; Left, Right: LongInt); |
1489 |
1490 |
1490 function CountNonZeroz(x, y, r: LongInt): LongInt; |
1491 function CountNonZeroz(x, y, r: LongInt): LongInt; |
1491 var i: LongInt; |
1492 var i: LongInt; |
1492 Result: LongInt; |
1493 Result: LongInt; |
1493 begin |
1494 begin |
1494 Result:= 0; |
1495 Result:= 0; |
1495 if (y and LAND_HEIGHT_MASK) = 0 then |
1496 if (y and LAND_HEIGHT_MASK) = 0 then |
1496 for i:= max(x - r, 0) to min(x + r, LAND_WIDTH-4) do |
1497 for i:= max(x - r, 0) to min(x + r, LAND_WIDTH - 4) do |
1497 if Land[y, i] <> 0 then inc(Result); |
1498 if Land[y, i] <> 0 then inc(Result); |
1498 CountNonZeroz:= Result |
1499 CountNonZeroz:= Result |
1499 end; |
1500 end; |
1500 |
1501 |
1501 var x: LongInt; |
1502 var x: LongInt; |
1515 y:= -Gear^.Radius * 2; |
1516 y:= -Gear^.Radius * 2; |
1516 while y < LAND_HEIGHT do |
1517 while y < LAND_HEIGHT do |
1517 begin |
1518 begin |
1518 repeat |
1519 repeat |
1519 inc(y, 2); |
1520 inc(y, 2); |
1520 until (y > LAND_HEIGHT) or (CountNonZeroz(x, y, Gear^.Radius - 1) = 0); |
1521 until (y >= LAND_HEIGHT) or (CountNonZeroz(x, y, Gear^.Radius - 1) = 0); |
1521 |
1522 |
1522 sy:= y; |
1523 sy:= y; |
1523 |
1524 |
1524 repeat |
1525 repeat |
1525 inc(y); |
1526 inc(y); |
1526 until (y > LAND_HEIGHT) or (CountNonZeroz(x, y, Gear^.Radius - 1) <> 0); |
1527 until (y >= LAND_HEIGHT) or (CountNonZeroz(x, y, Gear^.Radius - 1) <> 0); |
1527 |
1528 |
1528 if (y - sy > Gear^.Radius * 2) |
1529 if (y - sy > Gear^.Radius * 2) |
1529 and (y < LAND_HEIGHT) |
1530 and (y < LAND_HEIGHT) |
1530 and (CheckGearsNear(x, y - Gear^.Radius, [gtHedgehog, gtMine, gtCase], 110, 110) = nil) then |
1531 and (CheckGearsNear(x, y - Gear^.Radius, [gtHedgehog, gtMine, gtCase], 110, 110) = nil) then |
1531 begin |
1532 begin |