hedgewars/uGears.pas
changeset 15241 ceb289e8a582
parent 15221 0879fba70510
child 15381 c117e17b90bc
equal deleted inserted replaced
15240:b71bae455926 15241:ceb289e8a582
   678             RenderHealth(t^.Hedgehog^);
   678             RenderHealth(t^.Hedgehog^);
   679             end;
   679             end;
   680         t:= t^.NextGear
   680         t:= t^.NextGear
   681         end;
   681         end;
   682 
   682 
   683     if ((GameFlags and gfResetWeps) <> 0) and (not PlacingHogs) then
   683     if ((GameFlags and gfResetWeps) <> 0) and (not PlacingHogs) and (not PlacingKings) then
   684         ResetWeapons;
   684         ResetWeapons;
   685 
   685 
   686     if (GameFlags and gfResetHealth) <> 0 then
   686     if (GameFlags and gfResetHealth) <> 0 then
   687         for i:= 0 to Pred(TeamsCount) do
   687         for i:= 0 to Pred(TeamsCount) do
   688             RecountTeamHealth(TeamsArray[i])
   688             RecountTeamHealth(TeamsArray[i])
   966     ar: array[0..Pred(cMaxHHs)] of PHedgehog;
   966     ar: array[0..Pred(cMaxHHs)] of PHedgehog;
   967     Count: Longword;
   967     Count: Longword;
   968     divide, sectionDivide: boolean;
   968     divide, sectionDivide: boolean;
   969 begin
   969 begin
   970 if (GameFlags and gfPlaceHog) <> 0 then
   970 if (GameFlags and gfPlaceHog) <> 0 then
   971     PlacingHogs:= true;
   971     PlacingHogs:= true
       
   972 else if (GameFlags and gfKing) <> 0 then
       
   973     PlacingKings:= true;
   972 
   974 
   973 divide:= ((GameFlags and gfDivideTeams) <> 0);
   975 divide:= ((GameFlags and gfDivideTeams) <> 0);
   974 
   976 
   975 (* sectionDivide will determine the mode of hog distribution
   977 (* sectionDivide will determine the mode of hog distribution
   976  *
   978  *
  1003                                 begin
  1005                                 begin
  1004                                 if PlacingHogs then
  1006                                 if PlacingHogs then
  1005                                     Unplaced:= true
  1007                                     Unplaced:= true
  1006                                 else
  1008                                 else
  1007                                     FindPlace(Gear, false, t, t + playWidth div ClansCount, true);// could make Gear == nil;
  1009                                     FindPlace(Gear, false, t, t + playWidth div ClansCount, true);// could make Gear == nil;
       
  1010                                 if PlacingKings and King then
       
  1011                                     UnplacedKing:= true;
  1008                                 if Gear <> nil then
  1012                                 if Gear <> nil then
  1009                                     begin
  1013                                     begin
  1010                                     Gear^.Pos:= GetRandom(49);
  1014                                     Gear^.Pos:= GetRandom(49);
  1011                                     // unless the world is wrapping, make outter teams face to map center
  1015                                     // unless the world is wrapping, make outter teams face to map center
  1012                                     if (WorldEdge <> weWrap) and ((p = 0) or (p = ClansCount - 1)) then
  1016                                     if (WorldEdge <> weWrap) and ((p = 0) or (p = ClansCount - 1)) then
  1037         i:= GetRandom(Count);
  1041         i:= GetRandom(Count);
  1038         if PlacingHogs then
  1042         if PlacingHogs then
  1039             ar[i]^.Unplaced:= true
  1043             ar[i]^.Unplaced:= true
  1040         else
  1044         else
  1041             FindPlace(ar[i]^.Gear, false, leftX, rightX, true);
  1045             FindPlace(ar[i]^.Gear, false, leftX, rightX, true);
       
  1046         if PlacingKings and ar[i]^.King then
       
  1047             ar[i]^.UnplacedKing:= true;
  1042         if ar[i]^.Gear <> nil then
  1048         if ar[i]^.Gear <> nil then
  1043             begin
  1049             begin
  1044             ar[i]^.Gear^.dX.isNegative:= hwRound(ar[i]^.Gear^.X) > leftX + playWidth div 2;
  1050             ar[i]^.Gear^.dX.isNegative:= hwRound(ar[i]^.Gear^.X) > leftX + playWidth div 2;
  1045             end;
  1051             end;
  1046         ar[i]:= ar[Count - 1];
  1052         ar[i]:= ar[Count - 1];