hedgewars/uGears.pas
changeset 12447 ac710bb12fbb
parent 12322 9aa483762025
child 12450 8e32d540dab5
equal deleted inserted replaced
12446:48ee3777e42e 12447:ac710bb12fbb
   648     FindPlace(Gear, false, 0, LAND_WIDTH);
   648     FindPlace(Gear, false, 0, LAND_WIDTH);
   649 
   649 
   650     if Gear = nil then
   650     if Gear = nil then
   651         inc(unplaced)
   651         inc(unplaced)
   652     else
   652     else
       
   653         begin
   653         unplaced:= 0;
   654         unplaced:= 0;
       
   655         AddCI(Gear)
       
   656         end;
   654 
   657 
   655     inc(i)
   658     inc(i)
   656     end;
   659     end;
   657 
   660 
   658 i:= 0;
   661 i:= 0;
   880                                     Unplaced:= true
   883                                     Unplaced:= true
   881                                 else
   884                                 else
   882                                     FindPlace(Gear, false, t, t + playWidth div ClansCount, true);// could make Gear == nil;
   885                                     FindPlace(Gear, false, t, t + playWidth div ClansCount, true);// could make Gear == nil;
   883                                 if Gear <> nil then
   886                                 if Gear <> nil then
   884                                     begin
   887                                     begin
       
   888                                     AddCI(Gear);
   885                                     Gear^.Pos:= GetRandom(49);
   889                                     Gear^.Pos:= GetRandom(49);
   886                                     // unless the world is wrapping, make outter teams face to map center
   890                                     // unless the world is wrapping, make outter teams face to map center
   887                                     if (WorldEdge <> weWrap) and ((p = 0) or (p = ClansCount - 1)) then
   891                                     if (WorldEdge <> weWrap) and ((p = 0) or (p = ClansCount - 1)) then
   888                                         Gear^.dX.isNegative:= (p <> 0)
   892                                         Gear^.dX.isNegative:= (p <> 0)
   889                                     else
   893                                     else
   914             ar[i]^.Unplaced:= true
   918             ar[i]^.Unplaced:= true
   915         else
   919         else
   916             FindPlace(ar[i]^.Gear, false, leftX, rightX, true);
   920             FindPlace(ar[i]^.Gear, false, leftX, rightX, true);
   917         if ar[i]^.Gear <> nil then
   921         if ar[i]^.Gear <> nil then
   918             begin
   922             begin
       
   923             AddCI(ar[i]^.Gear);
   919             ar[i]^.Gear^.dX.isNegative:= hwRound(ar[i]^.Gear^.X) > leftX + playWidth div 2;
   924             ar[i]^.Gear^.dX.isNegative:= hwRound(ar[i]^.Gear^.X) > leftX + playWidth div 2;
   920             ar[i]^.Gear^.Pos:= GetRandom(19)
   925             ar[i]^.Gear^.Pos:= GetRandom(19)
   921             end;
   926             end;
   922         ar[i]:= ar[Count - 1];
   927         ar[i]:= ar[Count - 1];
   923         dec(Count)
   928         dec(Count)
   941                     begin
   946                     begin
   942                     ForcePlaceOnLand(hwRound(Gear^.X) - SpritesData[sprTargetBee].Width div 2, 
   947                     ForcePlaceOnLand(hwRound(Gear^.X) - SpritesData[sprTargetBee].Width div 2, 
   943                                      hwRound(Gear^.Y) - SpritesData[sprTargetBee].Height div 2, 
   948                                      hwRound(Gear^.Y) - SpritesData[sprTargetBee].Height div 2, 
   944                                      sprTargetBee, 0, lfBasic, $FFFFFFFF, false, false, false);
   949                                      sprTargetBee, 0, lfBasic, $FFFFFFFF, false, false, false);
   945                     Gear^.Y:= int2hwFloat(hwRound(Gear^.Y) - 16 - Gear^.Radius);
   950                     Gear^.Y:= int2hwFloat(hwRound(Gear^.Y) - 16 - Gear^.Radius);
       
   951                     AddCI(Gear);
   946                     Gear^.State:= Gear^.State and (not gsttmpFlag);
   952                     Gear^.State:= Gear^.State and (not gsttmpFlag);
   947                     AddFileLog('Placed flower for hog at coordinates (' + inttostr(hwRound(Gear^.X)) + ',' + inttostr(hwRound(Gear^.Y)) + ')')
   953                     AddFileLog('Placed flower for hog at coordinates (' + inttostr(hwRound(Gear^.X)) + ',' + inttostr(hwRound(Gear^.Y)) + ')')
   948                     end;
   954                     end;
   949 
   955 
   950 
   956