347 |
347 |
348 AddProgress(); |
348 AddProgress(); |
349 end; |
349 end; |
350 |
350 |
351 procedure MakeFortsPreview; |
351 procedure MakeFortsPreview; |
352 var gap, offset, h1, h2, w1, w2, x, y: LongInt; |
352 var gap: LongInt; |
|
353 h1, h2, w1, w2, x, y, lastX, wbm, bmref: LongWord; |
353 const fortHeight = 960; |
354 const fortHeight = 960; |
354 fortWidth = 720; |
355 fortWidth = 704; |
|
356 bmHeight = 53; |
|
357 bmWidth = 64; |
355 begin |
358 begin |
356 ResizeLand(4096,2048); |
359 ResizeLand(4096,2048); |
357 |
360 |
|
361 lastX:= LAND_WIDTH-1; |
|
362 |
358 gap:= (1024 - fortWidth) + 60 + 20 * cFeatureSize; |
363 gap:= (1024 - fortWidth) + 60 + 20 * cFeatureSize; |
359 offset:= fortWidth + gap; |
|
360 |
364 |
361 h2:= LAND_HEIGHT-1; |
365 h2:= LAND_HEIGHT-1; |
362 h1:= h2 - fortHeight; |
366 h1:= h2 - fortHeight; |
363 w2:= (LAND_WIDTH - gap) div 2; |
367 w2:= (LAND_WIDTH - gap) div 2; |
364 w1:= w2 - fortWidth; |
368 w1:= w2 - fortWidth; |
|
369 wbm:= h1 + bmHeight; |
365 |
370 |
366 // generate 2 forts in center |
371 // generate 2 forts in center |
367 for y:= h1 to h2 do |
372 for y:= h1 to h2 do |
368 for x:= w1 to w2 do |
373 for x:= w1 to w2 do |
369 begin |
374 begin |
|
375 if (y <= wbm) and ((x - w1) mod (bmWidth * 2) >= bmWidth) then |
|
376 continue; |
370 Land[y,x]:= lfBasic; |
377 Land[y,x]:= lfBasic; |
371 Land[y,x+offset]:= lfBasic; |
378 Land[y,lastX-x]:= lfBasic; |
372 end; |
379 end; |
373 |
380 |
374 w2:= w1 - gap; |
381 w2:= w1 - gap; |
375 w1:= w2 - fortWidth; |
382 w1:= max(0, w2 - fortWidth); |
376 offset:= offset + 2 * (fortWidth + gap); |
383 wbm:= h1 + bmHeight; |
377 if w1 < 0 then |
384 bmref:= w2 + bmWidth; |
378 begin |
|
379 offset:= LAND_WIDTH - 1 - (fortWidth+w1); |
|
380 w1:= 0; |
|
381 end; |
|
382 |
385 |
383 for y:= h1 to h2 do |
386 for y:= h1 to h2 do |
384 for x:= w1 to w2 do |
387 for x:= w1 to w2 do |
|
388 begin |
385 if ((x - y) mod 2) = 0 then |
389 if ((x - y) mod 2) = 0 then |
386 begin |
390 begin |
|
391 // align battlement on inner edge, because real outer edge could be offscreen |
|
392 if (y <= wbm) and ((LAND_WIDTH + x - bmref) mod (bmWidth * 2) >= bmWidth) then |
|
393 continue; |
387 Land[y,x]:= lfBasic; |
394 Land[y,x]:= lfBasic; |
388 Land[y,x+offset]:= lfBasic; |
395 Land[y,lastX-x]:= lfBasic; |
389 end; |
396 end; |
|
397 end; |
390 end; |
398 end; |
391 |
399 |
392 procedure MakeFortsMap; |
400 procedure MakeFortsMap; |
393 var tmpsurf: PSDL_Surface; |
401 var tmpsurf: PSDL_Surface; |
394 sectionWidth, i, t, p: integer; |
402 sectionWidth, i, t, p: integer; |