6503 and ((Hedgehogs[i].Gear^.State and gstDrowning) = 0) |
6505 and ((Hedgehogs[i].Gear^.State and gstDrowning) = 0) |
6504 and (Hedgehogs[i].Gear^.Health > Hedgehogs[i].Gear^.Damage) then |
6506 and (Hedgehogs[i].Gear^.Health > Hedgehogs[i].Gear^.Damage) then |
6505 inc(cnt); |
6507 inc(cnt); |
6506 if (cnt = 0) or SuddenDeathDmg or (Gear^.Timer = 0) then |
6508 if (cnt = 0) or SuddenDeathDmg or (Gear^.Timer = 0) then |
6507 begin |
6509 begin |
|
6510 // Place tardis |
6508 if HH^.GearHidden <> nil then |
6511 if HH^.GearHidden <> nil then |
6509 FindPlace(HH^.GearHidden, false, 0, LAND_WIDTH, true, false); |
6512 begin |
|
6513 restoreBottomY:= cWaterLine; |
|
6514 // Place tardis at a random safe position |
|
6515 FindPlace(HH^.GearHidden, false, 0, LAND_WIDTH, restoreBottomY, true, false); |
|
6516 |
|
6517 // If in Sudden Death, rise the minimum possible spawn position to make |
|
6518 // it less likely for the hog to drown before its turn |
|
6519 if SuddenDeathActive and (cWaterRise > 0) then |
|
6520 begin |
|
6521 // Enough space to survive the water rise of 1 round. |
|
6522 // Also limit the highest spawn height to topY plus a small buffer zone |
|
6523 restoreBottomY:= max(topY + cHHRadius * 5, cWaterLine - cWaterRise * (TeamsCount + 1)); |
|
6524 // If gear is below the safe spawn height, place it again, |
|
6525 // but this time with the height limit in place |
|
6526 if (HH^.GearHidden <> nil) and (hwRound(HH^.GearHidden^.Y) > restoreBottomY) then |
|
6527 // Due to the reduced Y range, this one might fail for very aggressive SD water rise |
|
6528 begin |
|
6529 FindPlace(HH^.GearHidden, false, 0, LAND_WIDTH, restoreBottomY, true, false); |
|
6530 end; |
|
6531 // Still unsafe? Relax the height limit to a third of the map height above cWaterLine |
|
6532 if (HH^.GearHidden <> nil) and (hwRound(HH^.GearHidden^.Y) > restoreBottomY) then |
|
6533 begin |
|
6534 restoreBottomY:= cWaterLine - ((cWaterLine - topY) div 3); |
|
6535 // Even this might fail, but it's much less likely. If it fails, we still have the |
|
6536 // position of the first FindPlace as a fallback. |
|
6537 FindPlace(HH^.GearHidden, false, 0, LAND_WIDTH, restoreBottomY, true, false); |
|
6538 end; |
|
6539 end; |
|
6540 end; |
6510 |
6541 |
6511 if HH^.GearHidden <> nil then |
6542 if HH^.GearHidden <> nil then |
6512 begin |
6543 begin |
6513 Gear^.X:= HH^.GearHidden^.X; |
6544 Gear^.X:= HH^.GearHidden^.X; |
6514 Gear^.Y:= HH^.GearHidden^.Y; |
6545 Gear^.Y:= HH^.GearHidden^.Y; |