956 until n = 0; |
956 until n = 0; |
957 |
957 |
958 end; |
958 end; |
959 |
959 |
960 procedure AssignHHCoords; |
960 procedure AssignHHCoords; |
961 var i, t, p, j: LongInt; |
961 var i, t, p, j, x, y: LongInt; |
962 ar: array[0..Pred(cMaxHHs)] of PHedgehog; |
962 ar: array[0..Pred(cMaxHHs)] of PHedgehog; |
963 Count: Longword; |
963 Count: Longword; |
964 divide, sectionDivide: boolean; |
964 divide, sectionDivide: boolean; |
965 begin |
965 begin |
966 if (GameFlags and gfPlaceHog) <> 0 then |
966 if (GameFlags and gfPlaceHog) <> 0 then |
1057 with TeamsArray[p]^ do |
1057 with TeamsArray[p]^ do |
1058 for i:= 0 to cMaxHHIndex do |
1058 for i:= 0 to cMaxHHIndex do |
1059 with Hedgehogs[i] do |
1059 with Hedgehogs[i] do |
1060 if (Gear <> nil) and (Gear^.State and gsttmpFlag <> 0) then |
1060 if (Gear <> nil) and (Gear^.State and gsttmpFlag <> 0) then |
1061 begin |
1061 begin |
1062 ForcePlaceOnLand(hwRound(Gear^.X) - SpritesData[sprTargetBee].Width div 2, |
1062 x:= hwRound(Gear^.X) - SpritesData[sprTargetBee].Width div 2; |
1063 hwRound(Gear^.Y) - SpritesData[sprTargetBee].Height div 2, |
1063 y:= hwRound(Gear^.Y) - SpritesData[sprTargetBee].Height div 2; |
1064 sprTargetBee, 0, lfBasic, $FFFFFFFF, false, false, false); |
1064 x:= max(min(x, RightX - SpritesData[sprTargetBee].Width), LeftX); |
1065 Gear^.Y:= int2hwFloat(hwRound(Gear^.Y) - 16 - Gear^.Radius); |
1065 y:= max(y, TopY); |
|
1066 ForcePlaceOnLand(x, y, sprTargetBee, 0, lfBasic, $FFFFFFFF, false, false, false); |
|
1067 Gear^.Y:= int2hwFloat(hwRound(Gear^.Y) - (SpritesData[sprTargetBee].Height div 2) - Gear^.Radius); |
1066 AddCI(Gear); |
1068 AddCI(Gear); |
1067 Gear^.State:= Gear^.State and (not gsttmpFlag); |
1069 Gear^.State:= Gear^.State and (not gsttmpFlag); |
1068 AddFileLog('Placed flower for hog at coordinates (' + inttostr(hwRound(Gear^.X)) + ',' + inttostr(hwRound(Gear^.Y)) + ')') |
1070 AddFileLog('Placed flower for hog at coordinates (' + inttostr(x) + ',' + inttostr(y) + ')') |
1069 end; |
1071 end; |
1070 |
1072 |
1071 |
1073 |
1072 // divided teams: sort the hedgehogs from left to right by clan and shuffle clan members |
1074 // divided teams: sort the hedgehogs from left to right by clan and shuffle clan members |
1073 if divide and (not sectionDivide) then |
1075 if divide and (not sectionDivide) then |