149 if Land[i, x] <> 0 then inc(Result); |
149 if Land[i, x] <> 0 then inc(Result); |
150 CountNonZeroz:= Result |
150 CountNonZeroz:= Result |
151 end; |
151 end; |
152 |
152 |
153 begin |
153 begin |
154 y:= 150; |
154 y:= topY+150; |
155 repeat |
155 repeat |
156 inc(y, 24); |
156 inc(y, 24); |
157 x1:= gX; |
157 x1:= gX; |
158 x2:= gX; |
158 x2:= gX; |
159 |
159 |
160 while (x1 > 100) and (CountNonZeroz(x1, y) = 0) do dec(x1, 2); |
160 while (x1 > Longint(leftX)+150) and (CountNonZeroz(x1, y) = 0) do dec(x1, 2); |
161 |
161 |
162 i:= x1 - 12; |
162 i:= x1 - 12; |
163 repeat |
163 repeat |
164 dec(x1, 2); |
164 dec(x1, 2); |
165 k:= CountNonZeroz(x1, y) |
165 k:= CountNonZeroz(x1, y) |
166 until (x1 < 100) or (k = 0) or (k = 16) or (x1 < i); |
166 until (x1 < Longint(leftX)+150) or (k = 0) or (k = 16) or (x1 < i); |
167 |
167 |
168 inc(x1, 2); |
168 inc(x1, 2); |
169 if k = 16 then |
169 if k = 16 then |
170 begin |
170 begin |
171 while (x2 < (LAND_WIDTH-150)) and (CountNonZeroz(x2, y) = 0) do inc(x2, 2); |
171 while (x2 < (rightX-150)) and (CountNonZeroz(x2, y) = 0) do inc(x2, 2); |
172 i:= x2 + 12; |
172 i:= x2 + 12; |
173 repeat |
173 repeat |
174 inc(x2, 2); |
174 inc(x2, 2); |
175 k:= CountNonZeroz(x2, y) |
175 k:= CountNonZeroz(x2, y) |
176 until (x2 > (LAND_WIDTH-150)) or (k = 0) or (k = 16) or (x2 > i); |
176 until (x2 > (rightX-150)) or (k = 0) or (k = 16) or (x2 > i); |
177 if (x2 < (LAND_WIDTH-150)) and (k = 16) and (x2 - x1 > 250) |
177 if (x2 < (rightX-150)) and (k = 16) and (x2 - x1 > 250) |
178 and not CheckIntersect(x1 - 32, y - 64, x2 - x1 + 64, 144) then break; |
178 and not CheckIntersect(x1 - 32, y - 64, x2 - x1 + 64, 144) then break; |
179 end; |
179 end; |
180 x1:= 0; |
180 x1:= 0; |
181 until y > (LAND_HEIGHT-125); |
181 until y > (LAND_HEIGHT-125); |
182 |
182 |
467 inc(i) |
467 inc(i) |
468 until (i > MaxCount) or not b; |
468 until (i > MaxCount) or not b; |
469 end; |
469 end; |
470 |
470 |
471 procedure AddObjects(); |
471 procedure AddObjects(); |
|
472 var i, int: Longword; |
472 begin |
473 begin |
473 InitRects; |
474 InitRects; |
474 if hasGirders then |
475 if hasGirders then |
475 begin |
476 begin |
476 AddGirder(256); |
477 int:= max(playWidth div 8, 256); |
477 AddGirder(512); |
478 i:=leftX+int; |
478 AddGirder(768); |
479 repeat |
479 AddGirder(1024); |
480 AddGirder(i); |
480 AddGirder(1280); |
481 i:=i+int; |
481 AddGirder(1536); |
482 until (i>rightX-int); |
482 AddGirder(1792); |
|
483 end; |
483 end; |
484 AddThemeObjects(ThemeObjects, 8); |
484 AddThemeObjects(ThemeObjects, MaxHedgehogs div 2); // MaxHedgehogs should roughly correspond to available surface area. Was also thinking maybe using playHeight * playWidth div constant :) |
485 AddProgress; |
485 AddProgress; |
486 FreeRects |
486 FreeRects |
487 end; |
487 end; |
488 |
488 |
489 procedure AddOnLandObjects(Surface: PSDL_Surface); |
489 procedure AddOnLandObjects(Surface: PSDL_Surface); |