equal
deleted
inserted
replaced
335 procedure AddGirders(Surface: PSDL_Surface); |
335 procedure AddGirders(Surface: PSDL_Surface); |
336 var tmpsurf: PSDL_Surface; |
336 var tmpsurf: PSDL_Surface; |
337 x1, x2, y, k, i: integer; |
337 x1, x2, y, k, i: integer; |
338 r, rr: TSDL_Rect; |
338 r, rr: TSDL_Rect; |
339 |
339 |
340 function CountZeroz(x, y: integer): Longword; |
340 function CountNonZeroz(x, y: integer): Longword; |
341 var i: integer; |
341 var i: integer; |
342 begin |
342 begin |
343 Result:= 0; |
343 Result:= 0; |
344 for i:= y to y + 15 do |
344 for i:= y to y + 15 do |
345 if Land[i, x] <> 0 then inc(Result) |
345 if Land[i, x] <> 0 then inc(Result) |
349 y:= 256; |
349 y:= 256; |
350 repeat |
350 repeat |
351 inc(y, 24); |
351 inc(y, 24); |
352 x1:= 1024; |
352 x1:= 1024; |
353 x2:= 1024; |
353 x2:= 1024; |
354 while (x1 > 100) and (CountZeroz(x1, y) = 0) do dec(x1, 2); |
354 while (x1 > 100) and (CountNonZeroz(x1, y) = 0) do dec(x1, 2); |
355 i:= x1 - 12; |
355 i:= x1 - 12; |
356 repeat |
356 repeat |
357 k:= CountZeroz(x1, y); |
357 k:= CountNonZeroz(x1, y); |
358 dec(x1, 2) |
358 dec(x1, 2) |
359 until (x1 < 100) or (k = 0) or (k = 16) or (x1 < i); |
359 until (x1 < 100) or (k = 0) or (k = 16) or (x1 < i); |
360 inc(x1, 2); |
360 inc(x1, 2); |
361 if k = 16 then |
361 if k = 16 then |
362 begin |
362 begin |
363 while (x2 < 1900) and (CountZeroz(x2, y) = 0) do inc(x2, 2); |
363 while (x2 < 1900) and (CountNonZeroz(x2, y) = 0) do inc(x2, 2); |
364 i:= x2 + 12; |
364 i:= x2 + 12; |
365 repeat |
365 repeat |
366 k:= CountZeroz(x2, y); |
366 k:= CountNonZeroz(x2, y); |
367 inc(x2, 2) |
367 inc(x2, 2) |
368 until (x2 > 1900) or (k = 0) or (k = 16) or (x2 > i); |
368 until (x2 > 1900) or (k = 0) or (k = 16) or (x2 > i); |
369 if (x2 < 1900) and (k = 16) and (x2 - x1 > 250) then break; |
369 if (x2 < 1900) and (k = 16) and (x2 - x1 > 250) then break; |
370 end; |
370 end; |
371 x1:= 0; |
371 x1:= 0; |
390 for i:= x1 to x2 do Land[k, i]:= $FFFFFF |
390 for i:= x1 to x2 do Land[k, i]:= $FFFFFF |
391 end |
391 end |
392 end; |
392 end; |
393 |
393 |
394 procedure AddHHPoints; |
394 procedure AddHHPoints; |
395 var i, x, y: integer; |
395 var i, x, y, t: integer; |
|
396 |
|
397 function CountNonZeroz(x, y: integer): integer; |
|
398 var i: integer; |
|
399 begin |
|
400 Result:= 0; |
|
401 if (y and $FFFFFC00) <> 0 then exit; |
|
402 for i:= max(x - 6, 0) to min(x + 6, 2043) do |
|
403 if Land[y, i] <> 0 then inc(Result) |
|
404 end; |
|
405 |
396 begin |
406 begin |
397 for i:= 0 to 9 do |
407 for i:= 0 to 9 do |
398 begin |
408 begin |
399 y:= 0; |
409 y:= -24; |
400 x:= i * 160 + 300; |
410 x:= i * 160 + 300; |
401 repeat |
411 while y < 1023 do |
402 inc(y, 2); |
412 begin |
403 until (y > 1023) or (Land[y, x - 6] <> 0) or (Land[y, x - 3] <> 0) or (Land[y, x] <> 0) |
413 repeat |
404 or (Land[y, x + 3] <> 0) or (Land[y, x + 6] <> 0); |
414 inc(y, 2); |
405 AddHHPoint(x, y - 12) |
415 until (y > 1023) or (CountNonZeroz(x, y) = 0); |
|
416 t:= 0; |
|
417 repeat |
|
418 inc(y, 2); |
|
419 inc(t, 2) |
|
420 until (y > 1023) or (CountNonZeroz(x, y) <> 0); |
|
421 if (t > 22) and (y < 1023) then AddHHPoint(x, y - 12); |
|
422 inc(y, 100) |
|
423 end; |
406 end; |
424 end; |
407 end; |
425 end; |
408 |
426 |
409 procedure GenLandSurface; |
427 procedure GenLandSurface; |
410 var pa: TPixAr; |
428 var pa: TPixAr; |