hedgewars/uLandGenTemplateBased.pas
changeset 10510 9329dab04490
parent 10502 a888e649bea2
child 10562 3388822b3914
equal deleted inserted replaced
10509:d62d3c706947 10510:9329dab04490
   126     mp.x:= (p1.x + p2.x) div 2;
   126     mp.x:= (p1.x + p2.x) div 2;
   127     mp.y:= (p1.y + p2.y) div 2;
   127     mp.y:= (p1.y + p2.y) div 2;
   128 
   128 
   129     // don't process too short segments or those which are too close to map borders
   129     // don't process too short segments or those which are too close to map borders
   130     if (p1.x = NTPX)
   130     if (p1.x = NTPX)
   131             or (dab < minDistance * 3) 
   131             or (dab < minDistance * 3)
   132             or (mp.x < LongInt(leftX) + mapBorderMargin)
   132             or (mp.x < LongInt(leftX) + mapBorderMargin)
   133             or (mp.x > LongInt(rightX) - mapBorderMargin)
   133             or (mp.x > LongInt(rightX) - mapBorderMargin)
   134             or (mp.y < LongInt(topY) + mapBorderMargin)
   134             or (mp.y < LongInt(topY) + mapBorderMargin)
   135             or (mp.y > LongInt(LAND_HEIGHT) - mapBorderMargin)
   135             or (mp.y > LongInt(LAND_HEIGHT) - mapBorderMargin)
   136     then
   136     then
   341     fps:=Template.FillPoints^;
   341     fps:=Template.FillPoints^;
   342     ResizeLand(Template.TemplateWidth, Template.TemplateHeight);
   342     ResizeLand(Template.TemplateWidth, Template.TemplateHeight);
   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;
   348     //dabDiv:= getRandom(41)+60;
   349     //dabDiv:= getRandom(31)+70;
   349     //dabDiv:= getRandom(31)+70;
   350     dabDiv:= getRandom(21)+100;
   350     dabDiv:= getRandom(21)+100;
   351     MaxHedgehogs:= Template.MaxHedgehogs;
   351     MaxHedgehogs:= Template.MaxHedgehogs;
   353     playHeight:= Template.TemplateHeight;
   353     playHeight:= Template.TemplateHeight;
   354     playWidth:= Template.TemplateWidth;
   354     playWidth:= Template.TemplateWidth;
   355     leftX:= (LAND_WIDTH - playWidth) div 2;
   355     leftX:= (LAND_WIDTH - playWidth) div 2;
   356     rightX:= Pred(leftX + playWidth);
   356     rightX:= Pred(leftX + playWidth);
   357     topY:= LAND_HEIGHT - playHeight;
   357     topY:= LAND_HEIGHT - playHeight;
   358     
   358 
   359     {$HINTS OFF}
   359     {$HINTS OFF}
   360     SetPoints(Template, pa, @fps);
   360     SetPoints(Template, pa, @fps);
   361     {$HINTS ON}
   361     {$HINTS ON}
   362 
   362 
   363     Distort2(Template, @fps, pa);
   363     Distort2(Template, @fps, pa);