hedgewars/uLandGenTemplateBased.pas
changeset 10499 0d8016085108
parent 10495 6d61b44a5652
child 10502 a888e649bea2
equal deleted inserted replaced
10498:bcd1d7ad2f3e 10499:0d8016085108
     4 uses uLandTemplates, uLandOutline;
     4 uses uLandTemplates, uLandOutline;
     5 
     5 
     6 procedure GenTemplated(var Template: TEdgeTemplate);
     6 procedure GenTemplated(var Template: TEdgeTemplate);
     7 procedure DivideEdges(fillPointsCount: LongWord; var pa: TPixAr);
     7 procedure DivideEdges(fillPointsCount: LongWord; var pa: TPixAr);
     8 
     8 
     9 var minDistance: LongInt; // different details size
     9 var minDistance, dabDiv: LongInt; // different details size
    10 
    10 
    11 implementation
    11 implementation
    12 uses uVariables, uConsts, uFloat, uLandUtils, uRandom, SDLh, math;
    12 uses uVariables, uConsts, uFloat, uLandUtils, uRandom, SDLh, math;
    13 
    13 
    14 
    14 
   259             end;
   259             end;
   260         end;
   260         end;
   261 
   261 
   262     // don't move new point for more than length of initial segment
   262     // don't move new point for more than length of initial segment
   263     // adjust/parametrize for more flat surfaces (try values 3/4, 1/2 of dab, or even 1/4)
   263     // adjust/parametrize for more flat surfaces (try values 3/4, 1/2 of dab, or even 1/4)
   264     d:= dab;
   264     d:= dab * 100 div dabDiv;
   265     //d:= dab * (1 + abs(cFeatureSize - 8)) div 6;
   265     //d:= dab * (1 + abs(cFeatureSize - 8)) div 6;
   266     //d:= dab * (14 + cFeatureSize) div 20;
   266     //d:= dab * (14 + cFeatureSize) div 20;
   267     if distL > d then distL:= d;
   267     if distL > d then distL:= d;
   268     if distR > d then distR:= d;
   268     if distR > d then distR:= d;
   269 
   269 
   343     for y:= 0 to LAND_HEIGHT - 1 do
   343     for y:= 0 to LAND_HEIGHT - 1 do
   344         for x:= 0 to LAND_WIDTH - 1 do
   344         for x:= 0 to LAND_WIDTH - 1 do
   345             Land[y, x]:= lfBasic;
   345             Land[y, x]:= lfBasic;
   346     
   346     
   347     minDistance:= sqr(cFeatureSize) div 8 + 10;
   347     minDistance:= sqr(cFeatureSize) div 8 + 10;
       
   348     //dabDiv:= getRandom(41)+60;
       
   349     //dabDiv:= getRandom(31)+70;
       
   350     dabDiv:= getRandom(21)+100;
   348     MaxHedgehogs:= Template.MaxHedgehogs;
   351     MaxHedgehogs:= Template.MaxHedgehogs;
   349     hasGirders:= Template.hasGirders;
   352     hasGirders:= Template.hasGirders;
   350     playHeight:= Template.TemplateHeight;
   353     playHeight:= Template.TemplateHeight;
   351     playWidth:= Template.TemplateWidth;
   354     playWidth:= Template.TemplateWidth;
   352     leftX:= (LAND_WIDTH - playWidth) div 2;
   355     leftX:= (LAND_WIDTH - playWidth) div 2;