hedgewars/uLand.pas
changeset 1797 fedd8649fdd9
parent 1795 2457fcc0dcd9
child 1805 dd9fb4b13fd8
equal deleted inserted replaced
1796:4bcdf0bf58b8 1797:fedd8649fdd9
   513 playWidth:= Template.TemplateWidth;
   513 playWidth:= Template.TemplateWidth;
   514 leftX:= ((LAND_WIDTH - playWidth) div 2);
   514 leftX:= ((LAND_WIDTH - playWidth) div 2);
   515 rightX:= (playWidth + ((LAND_WIDTH - playWidth) div 2)) - 1;
   515 rightX:= (playWidth + ((LAND_WIDTH - playWidth) div 2)) - 1;
   516 topY:= LAND_HEIGHT - playHeight;
   516 topY:= LAND_HEIGHT - playHeight;
   517 
   517 
       
   518 // force to only cavern even if a cavern map is invertable if cTemplateFilter = 4 ?
   518 if (Template.canInvert and (getrandom(2) = 0)) or
   519 if (Template.canInvert and (getrandom(2) = 0)) or
   519     (not Template.canInvert and Template.isNegative) then 
   520     (not Template.canInvert and Template.isNegative) then 
   520     begin
   521     begin
   521     hasBorder:= true;
   522     hasBorder:= true;
   522     for y:= 0 to LAND_HEIGHT - 1 do
   523     for y:= 0 to LAND_HEIGHT - 1 do
   533     end;
   534     end;
   534 end;
   535 end;
   535 
   536 
   536 function SelectTemplate: LongInt;
   537 function SelectTemplate: LongInt;
   537 begin
   538 begin
   538 SelectTemplate:= getrandom(Succ(High(EdgeTemplates)));
   539 case cTemplateFilter of
   539 WriteLnToConsole('Selected template #'+inttostr(SelectTemplate));
   540      0: begin
       
   541      SelectTemplate:= getrandom(Succ(High(EdgeTemplates)));
       
   542      end;
       
   543      1: begin
       
   544      SelectTemplate:= SmallTemplates[getrandom(Succ(High(SmallTemplates)))];
       
   545      end;
       
   546      2: begin
       
   547      SelectTemplate:= MediumTemplates[getrandom(Succ(High(MediumTemplates)))];
       
   548      end;
       
   549      3: begin
       
   550      SelectTemplate:= LargeTemplates[getrandom(Succ(High(LargeTemplates)))];
       
   551      end;
       
   552      4: begin
       
   553      SelectTemplate:= CavernTemplates[getrandom(Succ(High(CavernTemplates)))];
       
   554      end;
       
   555      5: begin
       
   556      SelectTemplate:= WackyTemplates[getrandom(Succ(High(WackyTemplates)))];
       
   557      end;
       
   558 end;
       
   559 WriteLnToConsole('Selected template #'+inttostr(SelectTemplate)+' using filter #'+inttostr(cTemplateFilter));
   540 end;
   560 end;
   541 
   561 
   542 procedure LandSurface2LandPixels(Surface: PSDL_Surface);
   562 procedure LandSurface2LandPixels(Surface: PSDL_Surface);
   543 var x, y: LongInt;
   563 var x, y: LongInt;
   544 	p: PLongwordArray;
   564 	p: PLongwordArray;