346 end; |
346 end; |
347 |
347 |
348 AddProgress(); |
348 AddProgress(); |
349 end; |
349 end; |
350 |
350 |
|
351 procedure MakeFortsPreview; |
|
352 var gap, offset, h1, h2, w1, w2, x, y: LongInt; |
|
353 const fortHeight = 960; |
|
354 fortWidth = 720; |
|
355 begin |
|
356 ResizeLand(4096,2048); |
|
357 |
|
358 gap:= (1024 - fortWidth) + 60 + 20 * cFeatureSize; |
|
359 offset:= fortWidth + gap; |
|
360 |
|
361 h2:= LAND_HEIGHT-1; |
|
362 h1:= h2 - fortHeight; |
|
363 w2:= (LAND_WIDTH - gap) div 2; |
|
364 w1:= w2 - fortWidth; |
|
365 |
|
366 // generate 2 forts in center |
|
367 for y:= h1 to h2 do |
|
368 for x:= w1 to w2 do |
|
369 begin |
|
370 Land[y,x]:= lfBasic; |
|
371 Land[y,x+offset]:= lfBasic; |
|
372 end; |
|
373 |
|
374 w2:= w1 - gap; |
|
375 w1:= w2 - fortWidth; |
|
376 offset:= offset + 2 * (fortWidth + gap); |
|
377 if w1 < 0 then |
|
378 begin |
|
379 offset:= LAND_WIDTH - 1 - (fortWidth+w1); |
|
380 w1:= 0; |
|
381 end; |
|
382 |
|
383 for y:= h1 to h2 do |
|
384 for x:= w1 to w2 do |
|
385 if ((x - y) mod 2) = 0 then |
|
386 begin |
|
387 Land[y,x]:= lfBasic; |
|
388 Land[y,x+offset]:= lfBasic; |
|
389 end; |
|
390 end; |
|
391 |
351 procedure MakeFortsMap; |
392 procedure MakeFortsMap; |
352 var tmpsurf: PSDL_Surface; |
393 var tmpsurf: PSDL_Surface; |
353 i, t, p: integer; |
394 sectionWidth, i, t, p: integer; |
354 mirror: boolean; |
395 mirror: boolean; |
355 pc: PClan; |
396 pc: PClan; |
356 const sectionWidth = 1024 + 300; |
397 begin |
357 begin |
398 |
|
399 // make the gaps between forts adjustable if fort map was selected |
|
400 if cMapGen = mgForts then |
|
401 sectionWidth:= 1024 + 60 + 20 * cFeatureSize |
|
402 else |
|
403 sectionWidth:= 1024 * 300; |
358 |
404 |
359 // mix up spawn/fort order of clans |
405 // mix up spawn/fort order of clans |
360 if ((GameFlags and gfForts) <> 0) then |
406 for i:= 0 to ClansCount - 1 do |
361 begin |
407 begin |
362 for i:= 0 to ClansCount - 1 do |
408 t:= GetRandom(ClansCount); |
363 begin |
409 p:= GetRandom(ClansCount); |
364 t:= GetRandom(ClansCount); |
410 if t <> p then |
365 p:= GetRandom(ClansCount); |
411 begin |
366 if t <> p then |
412 pc:= SpawnClansArray[t]; |
367 begin |
413 SpawnClansArray[t]:= SpawnClansArray[p]; |
368 pc:= SpawnClansArray[t]; |
414 SpawnClansArray[p]:= pc; |
369 SpawnClansArray[t]:= SpawnClansArray[p]; |
|
370 SpawnClansArray[p]:= pc; |
|
371 end; |
|
372 end; |
415 end; |
373 end; |
416 end; |
374 |
417 |
375 // figure out how much space we need |
418 // figure out how much space we need |
376 playWidth:= sectionWidth * ClansCount; |
419 playWidth:= sectionWidth * ClansCount; |
595 case cMapGen of |
638 case cMapGen of |
596 mgRandom: GenTemplated(EdgeTemplates[SelectTemplate]); |
639 mgRandom: GenTemplated(EdgeTemplates[SelectTemplate]); |
597 mgMaze : begin ResizeLand(4096,2048); GenMaze; end; |
640 mgMaze : begin ResizeLand(4096,2048); GenMaze; end; |
598 mgPerlin: begin ResizeLand(4096,2048); GenPerlin; end; |
641 mgPerlin: begin ResizeLand(4096,2048); GenPerlin; end; |
599 mgDrawn : GenDrawnMap; |
642 mgDrawn : GenDrawnMap; |
|
643 mgForts : begin GameFlags:= (GameFlags or gfForts or gfDivideTeams); MakeFortsMap(); end; |
600 else |
644 else |
601 OutError('Unknown mapgen', true); |
645 OutError('Unknown mapgen', true); |
602 end; |
646 end; |
603 GenLandSurface |
647 if cMapGen <> mgForts then |
|
648 GenLandSurface |
604 end |
649 end |
605 else |
650 else |
606 MakeFortsMap; |
651 MakeFortsMap; |
607 |
652 |
608 AddProgress; |
653 AddProgress; |
738 case cMapGen of |
783 case cMapGen of |
739 mgRandom: GenTemplated(EdgeTemplates[SelectTemplate]); |
784 mgRandom: GenTemplated(EdgeTemplates[SelectTemplate]); |
740 mgMaze: begin ResizeLand(4096,2048); GenMaze; end; |
785 mgMaze: begin ResizeLand(4096,2048); GenMaze; end; |
741 mgPerlin: begin ResizeLand(4096,2048); GenPerlin; end; |
786 mgPerlin: begin ResizeLand(4096,2048); GenPerlin; end; |
742 mgDrawn: GenDrawnMap; |
787 mgDrawn: GenDrawnMap; |
|
788 mgForts: MakeFortsPreview(); |
743 else |
789 else |
744 OutError('Unknown mapgen', true); |
790 OutError('Unknown mapgen', true); |
745 end; |
791 end; |
746 |
792 |
747 // strict scaling needed here since preview assumes a rectangle |
793 // strict scaling needed here since preview assumes a rectangle |
786 case cMapGen of |
832 case cMapGen of |
787 mgRandom: GenTemplated(EdgeTemplates[SelectTemplate]); |
833 mgRandom: GenTemplated(EdgeTemplates[SelectTemplate]); |
788 mgMaze: begin ResizeLand(4096,2048); GenMaze; end; |
834 mgMaze: begin ResizeLand(4096,2048); GenMaze; end; |
789 mgPerlin: begin ResizeLand(4096,2048); GenPerlin; end; |
835 mgPerlin: begin ResizeLand(4096,2048); GenPerlin; end; |
790 mgDrawn: GenDrawnMap; |
836 mgDrawn: GenDrawnMap; |
|
837 mgForts: MakeFortsPreview; |
791 else |
838 else |
792 OutError('Unknown mapgen', true); |
839 OutError('Unknown mapgen', true); |
793 end; |
840 end; |
794 |
841 |
795 // strict scaling needed here since preview assumes a rectangle |
842 // strict scaling needed here since preview assumes a rectangle |