- New Land Generator
authorunc0rr
Tue, 23 Jan 2007 16:59:05 +0000
changeset 358 236bbd12d4d9
parent 357 165a040e4cfa
child 359 59fbfc65fbda
- New Land Generator - Some perfomance tricks - Some typo fixes
hedgewars/CCHandlers.inc
hedgewars/CMakeLists.txt
hedgewars/GSHandlers.inc
hedgewars/SDLh.pas
hedgewars/tunsetborder.inc
hedgewars/uFloat.pas
hedgewars/uGame.pas
hedgewars/uLand.pas
hedgewars/uLandGraphics.pas
hedgewars/uLandTemplates.pas
--- a/hedgewars/CCHandlers.inc	Mon Jan 22 18:32:00 2007 +0000
+++ b/hedgewars/CCHandlers.inc	Tue Jan 23 16:59:05 2007 +0000
@@ -414,7 +414,7 @@
 if Length(s) = 0 then cFullScreen:= not cFullScreen
                  else cFullScreen:= s = '1';
 
-flags:= SDL_HWSURFACE or SDL_hwFloatBUF or SDL_HWACCEL;
+flags:= SDL_HWSURFACE or SDL_DOUBLEBUF or SDL_HWACCEL;
 if cFullScreen then flags:= flags or SDL_FULLSCREEN
                else SDL_WM_SetCaption('Hedgewars', nil);
 SDL_FreeSurface(SDLPrimSurface);
--- a/hedgewars/CMakeLists.txt	Mon Jan 22 18:32:00 2007 +0000
+++ b/hedgewars/CMakeLists.txt	Tue Jan 23 16:59:05 2007 +0000
@@ -56,7 +56,7 @@
 string(REGEX MATCH "[0-9]+\\.[0-9]+" dcc32version "${dcc32_output}")
 if (dcc32version)
 	set(pascal_compiler ${dcc32_executable})
-	set(pascal_compiler_flags "-B" "-W" "-E${EXECUTABLE_OUTPUT_PATH}" ${hwengine_project})
+	set(pascal_compiler_flags "-B" "-va" "-W" "-E${EXECUTABLE_OUTPUT_PATH}" ${hwengine_project})
 else (dcc32version)
 	string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" fpc_version "${fpc_output}")
 	if (fpc_version)
@@ -68,7 +68,7 @@
 			message("Minimum required version of FreePascal is 1.9.4")
 		else (fpc_ver LESS "010904")
 			set(pascal_compiler ${fpc_executable})
-			set(pascal_compiler_flags "-FE../bin" "-Cs2000000" "-O2" ${hwengine_project})
+			set(pascal_compiler_flags "-B" "-FE../bin" "-Cs2000000" "-O2" ${hwengine_project})
 		endif (fpc_ver LESS "010904")
 	endif (fpc_version)
 endif (dcc32version)
--- a/hedgewars/GSHandlers.inc	Mon Jan 22 18:32:00 2007 +0000
+++ b/hedgewars/GSHandlers.inc	Tue Jan 23 16:59:05 2007 +0000
@@ -426,7 +426,7 @@
 end;
 
 ////////////////////////////////////////////////////////////////////////////////
-var BTPrevAngle, BTSteps: Longword;
+var BTPrevAngle, BTSteps: integer;
 
 procedure doStepBlowTorchWork(Gear: PGear);
 var HHGear: PGear;
@@ -440,12 +440,12 @@
 
 b:= false;
 
-if (HHGear^.Angle <> BTPrevAngle) then
+if abs(integer(HHGear^.Angle) - BTPrevAngle) > 7  then
    begin
    Gear^.dX:= hwSign(HHGear^.dX) * AngleSin(HHGear^.Angle) * _0_5;
    Gear^.dY:= AngleCos(HHGear^.Angle) * ( - _0_5);
    BTPrevAngle:= HHGear^.Angle;
-//   b:= true
+   b:= true
    end;
 
 if Gear^.Timer mod cHHStepTicks = 0 then
@@ -488,7 +488,7 @@
 procedure doStepBlowTorch(Gear: PGear);
 var HHGear: PGear;
 begin
-BTPrevAngle:= High(Longword);
+BTPrevAngle:= High(integer);
 BTSteps:= 0;
 HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear;
 HHGear^.Message:= 0;
--- a/hedgewars/SDLh.pas	Mon Jan 22 18:32:00 2007 +0000
+++ b/hedgewars/SDLh.pas	Tue Jan 23 16:59:05 2007 +0000
@@ -47,7 +47,7 @@
       SDL_ASYNCBLIT   = $00000004;
       SDL_ANYFORMAT   = $10000000;
       SDL_HWPALETTE   = $20000000;
-      SDL_hwFloatBUF   = $40000000;
+      SDL_DOUBLEBUF   = $40000000;
       SDL_FULLSCREEN  = $80000000;
       SDL_NOFRAME     = $00000020;
       SDL_HWACCEL     = $00000100;
--- a/hedgewars/tunsetborder.inc	Mon Jan 22 18:32:00 2007 +0000
+++ b/hedgewars/tunsetborder.inc	Tue Jan 23 16:59:05 2007 +0000
@@ -3,6 +3,7 @@
         Y:= Y + dY;
         tx:= hwRound(X);
         ty:= hwRound(Y);
-        if ((ty and $FFFFFC00) = 0) and ((tx and $FFFFF800) = 0)and (Land[ty, tx] = $FFFFFF) then
-           SetLandPixel(ty, tx)
+        if ((ty and $FFFFFC00) = 0) and
+           ((tx and $FFFFF800) = 0) and
+           (Land[ty, tx] = $FFFFFF) then SetLandPixel(ty, tx)
 	end;
--- a/hedgewars/uFloat.pas	Mon Jan 22 18:32:00 2007 +0000
+++ b/hedgewars/uFloat.pas	Tue Jan 23 16:59:05 2007 +0000
@@ -85,6 +85,7 @@
             _0_5: hwFloat = (isNegative: false; QWordValue:  2147483648);
            _0_55: hwFloat = (isNegative: false; QWordValue:  2362232012);
             _0_6: hwFloat = (isNegative: false; QWordValue:  2576980377);
+            _0_7: hwFloat = (isNegative: false; QWordValue:  3006477107);
             _0_8: hwFloat = (isNegative: false; QWordValue:  3435973837);
            _0_84: hwFloat = (isNegative: false; QWordValue:  3607772528);
            _0_87: hwFloat = (isNegative: false; QWordValue:  3736621547);
--- a/hedgewars/uGame.pas	Mon Jan 22 18:32:00 2007 +0000
+++ b/hedgewars/uGame.pas	Tue Jan 23 16:59:05 2007 +0000
@@ -35,7 +35,7 @@
 if isPaused then exit;
 if not CurrentTeam^.ExtDriven then
    begin
-   NetGetNextCmd; // its for the case when receiving "/say" message
+   NetGetNextCmd; // its for the case of receiving "/say" message
    isInLag:= false;
    inc(SendEmptyPacketTicks, Lag);
    if SendEmptyPacketTicks >= cSendEmptyPacketTime then
--- a/hedgewars/uLand.pas	Mon Jan 22 18:32:00 2007 +0000
+++ b/hedgewars/uLand.pas	Tue Jan 23 16:59:05 2007 +0000
@@ -55,8 +55,61 @@
 SendIPC('M' + s)
 end;
 
+procedure DrawLine(X1, Y1, X2, Y2: integer; Color: Longword);
+var
+  eX, eY, dX, dY: integer;
+  i, sX, sY, x, y, d: integer;
+begin
+eX:= 0;
+eY:= 0;
+dX:= X2 - X1;
+dY:= Y2 - Y1;
+
+if (dX > 0) then sX:= 1
+else
+  if (dX < 0) then
+     begin
+     sX:= -1;
+     dX:= -dX
+     end else sX:= dX;
+
+if (dY > 0) then sY:= 1
+  else
+  if (dY < 0) then
+     begin
+     sY:= -1;
+     dY:= -dY
+     end else sY:= dY;
+
+if (dX > dY) then d:= dX
+             else d:= dY;
+
+x:= X1;
+y:= Y1;
+ 
+for i:= 0 to d do
+    begin
+    inc(eX, dX);
+    inc(eY, dY);
+    if (eX > d) then
+       begin
+       dec(eX, d);
+       inc(x, sX);
+       end;
+    if (eY > d) then
+       begin
+       dec(eY, d);
+       inc(y, sY);
+       end;
+       
+    if ((x and $FFFFF800) = 0) and ((y and $FFFFFC00) = 0) then
+       Land[y, x]:= Color;
+    end
+end;
+
 procedure DrawBezierEdge(var pa: TPixAr; Color: Longword);
-var x, y, i: integer;
+const dT: hwFloat = (isNegative: false; QWordValue: 85899346);
+var x, y, i, px, py: integer;
     tx, ty, vx, vy, vlen, t: hwFloat;
     r1, r2, r3, r4: hwFloat;
     x1, y1, x2, y2, cx1, cy1, cx2, cy2, tsq, tcb: hwFloat;
@@ -96,7 +149,9 @@
     cy2:= ar[i+1].y + hwRound(ty);
     vx:= -tx;
     vy:= -ty;
-    t:= 0;
+    px:= hwRound(x1);
+    py:= hwRound(y1);
+    t:= dT;
     while t.Round = 0 do
           begin
           tsq:= t * t;
@@ -111,79 +166,10 @@
           r3:= (          3*tsq - 3*tcb) * cy2;
           r4:= (                    tcb) * y2;
           Y:= hwRound(r1 + r2 + r3 + r4);
-          t:= t + _1div1024;
-          if ((x and $FFFFF800) = 0) and ((y and $FFFFFC00) = 0) then
-                Land[y, x]:= Color;
-          end;
-    end;
-end;
-
-procedure BezierizeEdge(var pa: TPixAr; Delta: hwFloat);
-var x, y, i: integer;
-    tx, ty, vx, vy, vlen, t: hwFloat;
-    r1, r2, r3, r4: hwFloat;
-    x1, y1, x2, y2, cx1, cy1, cx2, cy2, tsq, tcb: hwFloat;
-    opa: TPixAr;
-begin
-opa:= pa;
-pa.Count:= 0;
-vx:= 0;
-vy:= 0;
-with opa do
-for i:= 0 to Count-2 do
-    begin
-addfilelog('50');
-    vlen:= Distance(ar[i + 1].x - ar[i].X, ar[i + 1].y - ar[i].y);
-    t:=    Distance(ar[i + 1].x - ar[i + 2].X,ar[i + 1].y - ar[i + 2].y);
-addfilelog('51');
-    if t<vlen then vlen:= t;
-    vlen:= vlen * _1div3;
-    tx:= ar[i+2].X - ar[i].X;
-    ty:= ar[i+2].y - ar[i].y;
-    t:= Distance(tx, ty);
-    if t.QWordValue = 0 then
-       begin
-       tx:= -tx * 100000;
-       ty:= -ty * 100000;
-       end else
-       begin
-       t:= 1/t;
-       tx:= -tx * t;
-       ty:= -ty * t;
-       end;
-    t:= vlen;
-    tx:= tx*t;
-    ty:= ty*t;
-    x1:= ar[i].x;
-    y1:= ar[i].y;
-    x2:= ar[i + 1].x;
-    y2:= ar[i + 1].y;
-    cx1:= ar[i].X   + hwRound(vx);
-    cy1:= ar[i].y   + hwRound(vy);
-    cx2:= ar[i+1].X + hwRound(tx);
-    cy2:= ar[i+1].y + hwRound(ty);
-    vx:= -tx;
-    vy:= -ty;
-    t:= 0;
-    while t.Round = 0 do
-          begin
-          tsq:= t * t;
-          tcb:= tsq * t;
-          r1:= (1 - 3*t + 3*tsq -   tcb) * x1;
-          r2:= (    3*t - 6*tsq + 3*tcb) * cx1;
-          r3:= (          3*tsq - 3*tcb) * cx2;
-          r4:= (                    tcb) * x2;
-          X:= hwRound(r1 + r2 + r3 + r4);
-          r1:= (1 - 3*t + 3*tsq -   tcb) * y1;
-          r2:= (    3*t - 6*tsq + 3*tcb) * cy1;
-          r3:= (          3*tsq - 3*tcb) * cy2;
-          r4:= (                    tcb) * y2;
-          Y:= hwRound(r1 + r2 + r3 + r4);
-          t:= t + Delta;
-          pa.ar[pa.Count].x:= X;
-          pa.ar[pa.Count].y:= Y;
-          inc(pa.Count);
-          TryDo(pa.Count <= cMaxEdgePoints, 'Edge points overflow', true)
+          t:= t + dT;
+          DrawLine(px, py, x, y, Color);
+          px:= x;
+          py:= y
           end;
     end;
 end;
@@ -320,52 +306,36 @@
     end;
 end;
 
-procedure PointWave(var Template: TEdgeTemplate; var pa: TPixAr);
-const MAXPASSES = 32;
-var ar: array[0..MAXPASSES, 0..9] of hwFloat;
-    i, k: integer;
-    rx, ry, ox, oy: hwFloat;
-    PassesNum: Longword;
+procedure SetPoints(var Template: TEdgeTemplate; var pa: TPixAr);
+var i: integer;
 begin
 with Template do
      begin
-     PassesNum:= PassMin + getrandom(PassDelta);
-     TryDo(PassesNum < MAXPASSES, 'Passes number too big', true);
-     ar[0, 1]:= WaveFreqMin * _1div10000;
-     ar[0, 4]:= WaveFreqMin * _1div10000;
-     for i:= 1 to PassesNum do  // initialize random parameters
+     pa.Count:= BasePointsCount;
+     for i:= 0 to pred(pa.Count) do
          begin
-         ar[i, 0]:= WaveAmplMin + getrandom * WaveAmplDelta;
-//         ar[i, 1]:= ar[i - 1, 1] + (getrandom * 0.7 + 0.3) * WaveFreqDelta;
-         ar[i, 1]:= ar[i - 1, 1] + (getrandom) * WaveFreqDelta;
-         ar[i, 2]:= getrandom * hwPi * 2;
-         ar[i, 3]:= WaveAmplMin + getrandom * WaveAmplDelta;
-//         ar[i, 4]:= ar[i - 1, 4] + (getrandom * 0.7 + 0.3) * WaveFreqDelta;
-         ar[i, 4]:= ar[i - 1, 4] + (getrandom) * WaveFreqDelta;
-         ar[i, 5]:= getrandom * hwPi * 2;
-         ar[i, 6]:= ar[i, 1] * (getrandom * 2 - 1);
-//         ar[i, 7]:= ar[i, 1] * rndSign(sqrt(1 - sqr(ar[i, 6])));
-         ar[i, 7]:= ar[i, 1] * rndSign((1 - (ar[i, 6])));
-         ar[i, 8]:= ar[i, 4] * (getrandom * 2 - 1);
-//         ar[i, 9]:= ar[i, 4] * rndSign(sqrt(1 - sqr(ar[i, 8])));
-           ar[i, 9]:= ar[i, 4] * rndSign((1 - (ar[i, 8])));
+         pa.ar[i].x:= BasePoints^[i].x + integer(GetRandom(BasePoints^[i].w));
+         pa.ar[i].y:= BasePoints^[i].y + integer(GetRandom(BasePoints^[i].h))
          end;
-     end;
+         
+     if canMirror then
+        if getrandom(16) < 8 then
+           begin
+           for i:= 0 to pred(BasePointsCount) do
+               BasePoints^[i].x:= 2047 - BasePoints^[i].x;
+           for i:= 0 to pred(FillPointsCount) do
+               FillPoints^[i].x:= 2047 - FillPoints^[i].x;
+           end;
 
-for k:= 0 to Pred(pa.Count) do  // apply transformation
-    begin
-    rx:= pa.ar[k].x;
-    ry:= pa.ar[k].y;
-    for i:= 1 to PassesNum do
-        begin
-        ox:= rx;
-        oy:= ry;
-//        ry:= ry; + ar[i, 0] * sin(ox * ar[i, 6] + oy * ar[i, 7] + ar[i, 2]);
-//        rx:= rx + ar[i, 3] * sin(ox * ar[i, 8] + oy * ar[i, 9] + ar[i, 5]);
-        end;
-    pa.ar[k].x:= hwRound(rx);
-    pa.ar[k].y:= hwRound(ry);
-    end;
+     if canFlip then
+        if getrandom(16) < 8 then
+           begin
+           for i:= 0 to pred(BasePointsCount) do
+               BasePoints^[i].y:= 1023 - BasePoints^[i].y;
+           for i:= 0 to pred(FillPointsCount) do
+               FillPoints^[i].y:= 1023 - FillPoints^[i].y;
+           end;
+     end
 end;
 
 procedure NormalizePoints(var pa: TPixAr);
@@ -426,43 +396,17 @@
     for x:= 0 to 2047 do
         Land[y, x]:= COLOR_LAND;
 
-with Template do
-     begin
-     if canMirror then
-        if getrandom(16) < 8 then
-           begin
-           for i:= 0 to pred(BasePointsCount) do
-               BasePoints^[i].x:= 2047 - BasePoints^[i].x;
-           for i:= 0 to pred(FillPointsCount) do
-               FillPoints^[i].x:= 2047 - FillPoints^[i].x;
-           end;
+SetPoints(Template, pa);
+NormalizePoints(pa);
 
-     if canFlip then
-        if getrandom(16) < 8 then
-           begin
-           for i:= 0 to pred(BasePointsCount) do
-               BasePoints^[i].y:= 1023 - BasePoints^[i].y;
-           for i:= 0 to pred(FillPointsCount) do
-               FillPoints^[i].y:= 1023 - FillPoints^[i].y;
-           end;
+DrawBezierEdge(pa, 0);
 
-     pa.Count:= BasePointsCount;
-     for i:= 0 to pred(pa.Count) do
-         pa.ar[i]:= BasePoints^[i];
-
-//     for i:= 1 to BezPassCnt do
-         BezierizeEdge(pa, _1div3);
-
-     PointWave(Template, pa);
-     NormalizePoints(pa);
-     DrawBezierEdge(pa, 0);
-
+with Template do
      for i:= 0 to pred(FillPointsCount) do
          with FillPoints^[i] do
               FillLand(x, y);
 
-     DrawBezierEdge(pa, COLOR_LAND);
-     end;
+DrawBezierEdge(pa, COLOR_LAND)
 end;
 
 function SelectTemplate: integer;
--- a/hedgewars/uLandGraphics.pas	Mon Jan 22 18:32:00 2007 +0000
+++ b/hedgewars/uLandGraphics.pas	Tue Jan 23 16:59:05 2007 +0000
@@ -189,7 +189,7 @@
 //  - (dX, dY) - direction, vector of length = 0.5
 //
 procedure DrawTunnel(X, Y, dX, dY: hwFloat; ticks, HalfWidth: integer);
-var nx, ny: hwFloat;
+var nx, ny, dX8, dY8: hwFloat;
     i, t, tx, ty: Longint;
 begin  // (-dY, dX) is (dX, dY) rotated by PI/2
 if SDL_MustLock(LandSurface) then
@@ -198,10 +198,12 @@
 nx:= X + dY * (HalfWidth + 8);
 ny:= Y - dX * (HalfWidth + 8);
 
+dX8:= dX * 8;
+dY8:= dY * 8;
 for i:= 0 to 7 do
     begin
-    X:= nx - 8 * dX;
-    Y:= ny - 8 * dY;
+    X:= nx - dX8;
+    Y:= ny - dY8;
     for t:= -8 to ticks + 8 do
         {$include tunsetborder.inc}
     nx:= nx - dY;
@@ -210,8 +212,8 @@
 
 for i:= -HalfWidth to HalfWidth do
     begin
-    X:= nx - dX * 8;
-    Y:= ny - dY * 8;
+    X:= nx - dX8;
+    Y:= ny - dY8;
     for t:= 0 to 7 do
         {$include tunsetborder.inc}
     X:= nx;
@@ -236,8 +238,8 @@
 
 for i:= 0 to 7 do
     begin
-    X:= nx - 8 * dX;
-    Y:= ny - 8 * dY;
+    X:= nx - dX8;
+    Y:= ny - dY8;
     for t:= -8 to ticks + 8 do
         {$include tunsetborder.inc}
     nx:= nx - dY;
--- a/hedgewars/uLandTemplates.pas	Mon Jan 22 18:32:00 2007 +0000
+++ b/hedgewars/uLandTemplates.pas	Tue Jan 23 16:59:05 2007 +0000
@@ -22,625 +22,36 @@
 {$INCLUDE options.inc}
 
 type PPointArray = ^TPointArray;
-     TPointArray = array[0..64] of TPoint;
+     TPointArray = array[0..64] of TSDL_Rect;
      TEdgeTemplate = record
                      BasePoints: PPointArray;
                      BasePointsCount: Longword;
-                     BezPassCnt: Longword; 
-                     PassMin, PassDelta: Longword;
-                     WaveAmplMin, WaveAmplDelta: Longword;
-                     WaveFreqMin, WaveFreqDelta: Longword;
                      FillPoints: PPointArray;
                      FillPointsCount: Longword;
                      canMirror, canFlip: boolean;
                      end;
 
-const Template0Points: array[0..4] of TPoint =
+const Template0Points: array[0..4] of TSDL_Rect =
       (
-       (x:  500; y: 1500),
-       (x:  350; y:  400),
-       (x: 1023; y:  820),
-       (x: 1700; y:  400),
-       (x: 1550; y: 1500)
+       (x:  400; y: 1100; w: 1; h: 1),
+       (x:  250; y:  400; w: 200; h: 200),
+       (x:  923; y:  620; w: 200; h: 400),
+       (x: 1600; y:  400; w: 200; h: 200),
+       (x: 1450; y: 1100; w: 1; h: 1)
       );
       Template0FPoints: array[0..0] of TPoint =
       (
        (x: 1023; y:    0)
       );
 
-const Template1Points: array[0..12] of TPoint =
-      (
-       (x:  300; y: 1500),
-       (x:  300; y: 1000),
-       (x:  250; y:  750),
-       (x:  550; y:  480),
-       (x:  650; y:  780),
-       (x:  810; y:  780),
-       (x:  800; y:  500),
-       (x: 1200; y:  500),
-       (x: 1300; y:  800),
-       (x: 1500; y:  500),
-       (x: 1800; y:  750),
-       (x: 1750; y: 1000),
-       (x: 1750; y: 1500)
-      );
-      Template1FPoints: array[0..0] of TPoint =
-      (
-       (x: 1023; y:    0)
-      );
-
-const Template2Points: array[0..28] of TPoint =
-      (
-       (x:  350; y: 1500),
-       (x:  350; y: 1000),
-       (x:  190; y:  850),
-       (x:  500; y:  750),
-       (x:  520; y:  450),
-       (x:  190; y:  600),
-       (x:  210; y:  260),
-       (x:  800; y:  310),
-       (x: 1350; y:  220),
-       (x: 1250; y:  360),
-       (x: 1550; y:  520),
-       (x: 1100; y:  400),
-       (x:  900; y:  470),
-       (x:  650; y:  400),
-       (x:  900; y:  750),
-       (x:  600; y:  750),
-       (x:  600; y:  850),
-       (x: 1100; y:  900),
-       (x: 1200; y: 1000),
-       (x: 1200; y: 1300),
-       (x: 1400; y: 1300),
-       (x: 1400; y: 1000),
-       (x: 1280; y:  850),
-       (x: 1150; y:  630),
-       (x: 1600; y:  850),
-       (x: 1800; y:  600),
-       (x: 1900; y:  600),
-       (x: 1700; y: 1010),
-       (x: 1700; y: 1500)
-      );
-      Template2FPoints: array[0..0] of TPoint =
-      (
-       (x: 1023; y:    0)
-      );
-
-const Template3Points: array[0..23] of TPoint =
-      (
-       (x:  200; y: 1500),
-       (x:  200; y: 1000),
-       (x:  390; y:  650),
-       (x:  210; y:  260),
-       (x: 1000; y:  420),
-       (x: 1100; y:  200),
-       (x: 1250; y:  420),
-       (x: 1250; y:  620),
-       (x:  900; y:  610),
-       (x:  650; y:  450),
-       (x:  550; y:  500),
-       (x:  650; y:  700),
-       (x: 1200; y:  800),
-       (x: 1200; y: 1000),
-       (x: 1200; y: 1200),
-       (x: 1400; y: 1200),
-       (x: 1400; y: 1000),
-       (x: 1280; y:  750),
-       (x: 1500; y:  600),
-       (x: 1400; y:  200),
-       (x: 1800; y:  200),
-       (x: 1700; y:  600),
-       (x: 1900; y: 1010),
-       (x: 1800; y: 1500)
-      );
-      Template3FPoints: array[0..0] of TPoint =
-      (
-       (x: 1023; y:    0)
-      );
-
-const Template4Points: array[0..38] of TPoint =
-      (
-       (x:  200; y: 1500),
-       (x:  200; y: 1000),
-       (x:  210; y:  800),
-       (x:  480; y:  830),
-       (x:  460; y:  700),
-       (x:  150; y:  610),
-       (x:  150; y:  310),
-       (x:  220; y:  200),
-       (x:  340; y:  195),
-       (x:  410; y:  415),
-       (x:  420; y:  495),
-       (x:  535; y:  615),
-       (x:  705; y:  600),
-       (x:  760; y:  425),
-       (x:  815; y:  230),
-       (x:  970; y:  200),
-       (x: 1050; y:  360),
-       (x:  850; y:  590),
-       (x: 1070; y:  790),
-       (x: 1000; y: 1000),
-       (x: 1000; y: 1500),
-       (x: 1250; y: 1500),
-       (x: 1250; y: 1000),
-       (x: 1260; y:  830),
-       (x: 1290; y:  700),
-       (x: 1270; y:  450),
-       (x: 1180; y:  280),
-       (x: 1210; y:  160),
-       (x: 1370; y:  160),
-       (x: 1505; y:  205),
-       (x: 1630; y:  315),
-       (x: 1660; y:  450),
-       (x: 1580; y:  620),
-       (x: 1670; y:  725),
-       (x: 1800; y:  730),
-       (x: 1860; y:  680),
-       (x: 1925; y:  810),
-       (x: 1800; y: 1000),
-       (x: 1800; y: 1500)
-      );
-      Template4FPoints: array[0..0] of TPoint =
-      (
-       (x: 1023; y:    0)
-      );
-    
-const Template5Points: array[0..10] of TPoint =
-      (
-       (x:  225; y: 1500),
-       (x:  254; y:  226),
-       (x:  729; y:  238),
-       (x:  658; y:  441),
-       (x:  661; y:  651),
-       (x: 1023; y:  759),
-       (x: 1374; y:  648),
-       (x: 1473; y:  285),
-       (x: 1803; y:  207),
-       (x: 1839; y:  801),
-       (x: 1674; y: 1500)
-      );
-      Template5FPoints: array[0..0] of TPoint =
-      (
-       (x: 1023; y:    0)
-      );
-
-const Template6Points: array[0..20] of TPoint =
-      (
-       (x:  318; y: 1500),
-       (x:  270; y: 1023),
-       (x:  252; y:  921),
-       (x:  480; y:  888),
-       (x:  492; y:  753),
-       (x:  654; y:  756),
-       (x:  687; y:  630),
-       (x:  906; y:  627),
-       (x:  987; y:  813),
-       (x: 1125; y:  825),
-       (x: 1134; y:  645),
-       (x: 1236; y:  558),
-       (x: 1260; y:  438),
-       (x: 1467; y:  462),
-       (x: 1536; y:  348),
-       (x: 1680; y:  402),
-       (x: 1713; y:  594),
-       (x: 1593; y:  693),
-       (x: 1707; y:  774),
-       (x: 1728; y:  894),
-       (x: 1788; y: 1500)
-      );
-      Template6FPoints: array[0..0] of TPoint =
-      (
-       (x: 1023; y:    0)
-      );
-
-const Template7Points: array[0..43] of TPoint =
-      (
-       (x:  180; y: 1500),
-       (x:  411; y: 1020),
-       (x:  402; y:  912),
-       (x:  141; y:  897),
-       (x:  156; y:  729),
-       (x:  417; y:  813),
-       (x:  432; y:  585),
-       (x:  147; y:  570),
-       (x:  138; y:  435),
-       (x:  444; y:  417),
-       (x:  447; y:  207),
-       (x:  573; y:  261),
-       (x:  663; y:  201),
-       (x:  711; y:  375),
-       (x:  897; y:  411),
-       (x:  936; y:  498),
-       (x:  663; y:  558),
-       (x:  669; y:  762),
-       (x:  957; y:  723),
-       (x:  984; y:  864),
-       (x:  729; y:  879),
-       (x:  879; y: 1020),
-       (x:  981; y: 1449),
-       (x: 1242; y: 1449),
-       (x: 1476; y: 1020),
-       (x: 1470; y:  900),
-       (x: 1284; y:  897),
-       (x: 1218; y:  774),
-       (x: 1464; y:  765),
-       (x: 1464; y:  672),
-       (x: 1119; y:  630),
-       (x: 1116; y:  537),
-       (x: 1485; y:  501),
-       (x: 1167; y:  246),
-       (x: 1263; y:  180),
-       (x: 1572; y:  312),
-       (x: 1767; y:  162),
-       (x: 1827; y:  306),
-       (x: 1647; y:  465),
-       (x: 1875; y:  621),
-       (x: 1683; y:  747),
-       (x: 1665; y:  831),
-       (x: 1818; y:  951),
-       (x: 1893; y: 1500)
-      );
-      Template7FPoints: array[0..0] of TPoint =
-      (
-       (x: 1023; y:    0)
-      );
-
-const Template8Points: array[0..23] of TPoint =
-      (
-       (x:  222; y: 1500),
-       (x:  354; y: 1023),
-       (x:  249; y:  783),
-       (x:  240; y:  421),
-       (x:  411; y:  401),
-       (x:  432; y:  777),
-       (x:  573; y:  777),
-       (x:  567; y:  300),
-       (x:  696; y:  250),
-       (x:  744; y:  683),
-       (x:  897; y:  698),
-       (x:  885; y:  450),
-       (x: 1032; y:  479),
-       (x: 1065; y:  698),
-       (x: 1200; y:  690),
-       (x: 1200; y:  218),
-       (x: 1326; y:  252),
-       (x: 1359; y:  786),
-       (x: 1470; y:  810),
-       (x: 1485; y:  379),
-       (x: 1608; y:  342),
-       (x: 1641; y:  819),
-       (x: 1719; y:  864),
-       (x: 1746; y: 1500)
-      );
-      Template8FPoints: array[0..0] of TPoint =
-      (
-       (x: 1023; y:    0)
-      );
-
-const Template9Points: array[0..23] of TPoint =
-      (
-       (x:  384; y: 1500),
-       (x:  210; y: 1023),
-       (x:  213; y:  891),
-       (x:  501; y:  861),
-       (x:  228; y:  657),
-       (x:  558; y:  676),
-       (x:  561; y:  513),
-       (x:  246; y:  354),
-       (x:  609; y:  393),
-       (x:  876; y:  309),
-       (x:  759; y:  576),
-       (x:  759; y:  762),
-       (x: 1113; y:  750),
-       (x: 1128; y:  873),
-       (x: 1488; y:  870),
-       (x: 1473; y:  678),
-       (x: 1182; y:  501),
-       (x: 1515; y:  507),
-       (x: 1776; y:  393),
-       (x: 1668; y:  630),
-       (x: 1833; y:  714),
-       (x: 1674; y:  837),
-       (x: 1800; y: 1020),
-       (x: 1632; y: 1500)
-      );
-      Template9FPoints: array[0..0] of TPoint =
-      (
-       (x: 1023; y:    0)
-      );
-
-const Template10Points: array[0..13] of TPoint =
-      (
-       (x:  336; y: 1500),
-       (x:  303; y: 1026),
-       (x:  225; y:  921),
-       (x:  216; y:  741),
-       (x:  774; y:  810),
-       (x:  687; y:  336),
-       (x:  975; y:  192),
-       (x: 1350; y:  324),
-       (x: 1230; y:  681),
-       (x: 1257; y:  855),
-       (x: 1623; y:  846),
-       (x: 1821; y:  657),
-       (x: 1911; y:  897),
-       (x: 1704; y: 1500)
-      );
-      Template10FPoints: array[0..0] of TPoint =
-      (
-       (x: 1023; y:    0)
-      );
-
-const Template11Points: array[0..9] of TPoint =
-      (
-       (x:  270; y: 1500),
-       (x:  180; y:  795),
-       (x:  453; y:  753),
-       (x:  537; y:  900),
-       (x:  822; y:  729),
-       (x: 1128; y:  882),
-       (x: 1269; y:  657),
-       (x: 1560; y:  915),
-       (x: 1812; y:  867),
-       (x: 1854; y: 1500)
-      );
-      Template11FPoints: array[0..0] of TPoint =
-      (
-       (x: 1023; y:    0)
-      );
-
-const Template12Points: array[0..38] of TPoint =
-      (
-       (x:  201; y: 1500),
-       (x:  207; y:  920),
-       (x:  360; y:  901),
-       (x:  345; y:  822),
-       (x:  183; y:  810),
-       (x:  183; y:  632),
-       (x:  327; y:  628),
-       (x:  165; y:  402),
-       (x:  462; y:  443),
-       (x:  555; y:  272),
-       (x:  525; y:  556),
-       (x:  618; y:  647),
-       (x:  483; y:  712),
-       (x:  468; y:  860),
-       (x:  810; y:  884),
-       (x:  879; y:  796),
-       (x:  756; y:  764),
-       (x:  771; y:  620),
-       (x:  960; y:  625),
-       (x:  969; y:  517),
-       (x:  771; y:  503),
-       (x:  768; y:  395),
-       (x: 1092; y:  412),
-       (x: 1125; y:  616),
-       (x: 1029; y:  767),
-       (x: 1404; y:  858),
-       (x: 1440; y:  714),
-       (x: 1293; y:  688),
-       (x: 1344; y:  320),
-       (x: 1548; y:  342),
-       (x: 1494; y:  563),
-       (x: 1614; y:  570),
-       (x: 1710; y:  383),
-       (x: 1860; y:  448),
-       (x: 1683; y:  664),
-       (x: 1773; y:  726),
-       (x: 1578; y:  836),
-       (x: 1746; y:  918),
-       (x: 1662; y: 1500)
-      );
-      Template12FPoints: array[0..0] of TPoint =
-      (
-       (x: 1023; y:    0)
-      );
-
-const Template13Points: array[0..13] of TPoint =
-      (
-       (x:  645; y: 1500),
-       (x:  198; y:  732),
-       (x:  402; y:  648),
-       (x:  609; y:  763),
-       (x:  750; y:  590),
-       (x:  303; y:  376),
-       (x: 1023; y:  441),
-       (x: 1023; y:  316),
-       (x: 1719; y:  329),
-       (x: 1695; y:  457),
-       (x: 1038; y:  576),
-       (x: 1017; y:  756),
-       (x: 1803; y:  728),
-       (x: 1503; y: 1500)
-      );
-      Template13FPoints: array[0..0] of TPoint =
-      (
-       (x: 1023; y:    0)
-      );
-
-const Template14Points: array[0..22] of TPoint =
-      (
-       (x:  177; y: 1500),
-       (x:  262; y: 1026),
-       (x:  259; y:  303),
-       (x:  765; y:  162),
-       (x:  789; y:  357),
-       (x:  517; y:  420),
-       (x:  658; y:  690),
-       (x:  448; y:  762),
-       (x:  663; y: 1029),
-       (x:  765; y: 1440),
-       (x: 1446; y: 1431),
-       (x: 1439; y: 1026),
-       (x: 1416; y:  825),
-       (x: 1253; y:  840),
-       (x: 1253; y:  600),
-       (x: 1551; y:  573),
-       (x: 1506; y:  390),
-       (x: 1065; y:  366),
-       (x: 1077; y:  171),
-       (x: 1656; y:  156),
-       (x: 1821; y:  396),
-       (x: 1716; y:  768),
-       (x: 1926; y: 1500)
-      );
-      Template14FPoints: array[0..0] of TPoint =
-      (
-       (x: 1023; y:    0)
-      );
-
-const EdgeTemplates: array[0..14] of TEdgeTemplate =
+const EdgeTemplates: array[0..0] of TEdgeTemplate =
       (
        (BasePoints: @Template0Points;
         BasePointsCount: Succ(High(Template0Points));
-        BezPassCnt: 4;
-        PassMin: 10; PassDelta: 5;
-        WaveAmplMin:    17; WaveAmplDelta: 20;
-        WaveFreqMin: 0100; WaveFreqDelta: 0020;
         FillPoints: @Template0FPoints;
         FillPointsCount: Succ(High(Template0FPoints));
         canMirror: false; canFlip: false;
-       ),
-       (BasePoints: @Template1Points;
-        BasePointsCount: Succ(High(Template1Points));
-        BezPassCnt: 3;
-        PassMin: 10; PassDelta: 2;
-        WaveAmplMin:    25; WaveAmplDelta: 15;
-        WaveFreqMin:  0080; WaveFreqDelta: 0020;
-        FillPoints: @Template1FPoints;
-        FillPointsCount: Succ(High(Template1FPoints));
-        canMirror: false; canFlip: false;
-       ),
-       (BasePoints: @Template2Points;
-        BasePointsCount: Succ(High(Template2Points));
-        BezPassCnt: 3;
-        PassMin: 14; PassDelta: 3;
-        WaveAmplMin:    10; WaveAmplDelta: 10;
-        WaveFreqMin:  0100; WaveFreqDelta: 0020;
-        FillPoints: @Template2FPoints;
-        FillPointsCount: Succ(High(Template2FPoints));
-        canMirror: true; canFlip: false;
-       ),
-       (BasePoints: @Template3Points;
-        BasePointsCount: Succ(High(Template3Points));
-        BezPassCnt: 4;
-        PassMin: 15; PassDelta: 2;
-        WaveAmplMin:    8; WaveAmplDelta: 12;
-        WaveFreqMin: 0150; WaveFreqDelta: 0015;
-        FillPoints: @Template3FPoints;
-        FillPointsCount: Succ(High(Template3FPoints));
-        canMirror: true; canFlip: false;
-       ),
-       (BasePoints: @Template4Points;
-        BasePointsCount: Succ(High(Template4Points));
-        BezPassCnt: 3;
-        PassMin: 19; PassDelta: 5;
-        WaveAmplMin:    12; WaveAmplDelta: 14;
-        WaveFreqMin:  0080; WaveFreqDelta: 0010;
-        FillPoints: @Template4FPoints;
-        FillPointsCount: Succ(High(Template4FPoints));
-        canMirror: true; canFlip: false;
-       ),
-       (BasePoints: @Template5Points;
-        BasePointsCount: Succ(High(Template5Points));
-        BezPassCnt: 4;
-        PassMin: 15; PassDelta: 1;
-        WaveAmplMin:    15; WaveAmplDelta: 14;
-        WaveFreqMin:  0080; WaveFreqDelta: 0020;
-        FillPoints: @Template5FPoints;
-        FillPointsCount: Succ(High(Template5FPoints));
-        canMirror: true; canFlip: false;
-       ),
-      (BasePoints: @Template6Points;
-       BasePointsCount: Succ(High(Template6Points));
-       BezPassCnt: 3;
-       PassMin: 15; PassDelta: 1;
-       WaveAmplMin:    15; WaveAmplDelta: 10;
-       WaveFreqMin:  0100; WaveFreqDelta: 0015;
-       FillPoints: @Template6FPoints;
-       FillPointsCount: Succ(High(Template6FPoints));
-       canMirror: true; canFlip: false;
-      ),
-      (BasePoints: @Template7Points;
-       BasePointsCount: Succ(High(Template7Points));
-       BezPassCnt: 3;
-       PassMin: 12; PassDelta: 4;
-       WaveAmplMin:     5; WaveAmplDelta: 15;
-       WaveFreqMin:  0150; WaveFreqDelta: 0020;
-       FillPoints: @Template7FPoints;
-       FillPointsCount: Succ(High(Template7FPoints));
-       canMirror: true; canFlip: false;
-      ),
-      (BasePoints: @Template8Points;
-       BasePointsCount: Succ(High(Template8Points));
-       BezPassCnt: 4;
-       PassMin:  9; PassDelta: 3;
-       WaveAmplMin:    18; WaveAmplDelta: 18;
-       WaveFreqMin:  0100; WaveFreqDelta: 0020;
-       FillPoints: @Template8FPoints;
-       FillPointsCount: Succ(High(Template8FPoints));
-       canMirror: true; canFlip: false;
-      ),
-      (BasePoints: @Template9Points;
-       BasePointsCount: Succ(High(Template9Points));
-       BezPassCnt: 4;
-       PassMin: 17; PassDelta: 3;
-       WaveAmplMin:    10; WaveAmplDelta: 10;
-       WaveFreqMin:  0100; WaveFreqDelta: 0020;
-       FillPoints: @Template9FPoints;
-       FillPointsCount: Succ(High(Template9FPoints));
-       canMirror: true; canFlip: false;
-      ),
-      (BasePoints: @Template10Points;
-       BasePointsCount: Succ(High(Template10Points));
-       BezPassCnt: 4;
-       PassMin: 15; PassDelta: 2;
-       WaveAmplMin:    15; WaveAmplDelta: 10;
-       WaveFreqMin:  0080; WaveFreqDelta: 0020;
-       FillPoints: @Template10FPoints;
-       FillPointsCount: Succ(High(Template10FPoints));
-       canMirror: false; canFlip: false;
-      ),
-      (BasePoints: @Template11Points;
-       BasePointsCount: Succ(High(Template11Points));
-       BezPassCnt: 4;
-       PassMin: 15; PassDelta: 1;
-       WaveAmplMin:    10; WaveAmplDelta: 10;
-       WaveFreqMin:  0080; WaveFreqDelta: 0020;
-       FillPoints: @Template11FPoints;
-       FillPointsCount: Succ(High(Template11FPoints));
-       canMirror: true; canFlip: false;
-      ),
-      (BasePoints: @Template12Points;
-       BasePointsCount: Succ(High(Template12Points));
-       BezPassCnt: 3;
-       PassMin: 10; PassDelta: 1;
-       WaveAmplMin:    15; WaveAmplDelta: 15;
-       WaveFreqMin:  0050; WaveFreqDelta: 0030;
-       FillPoints: @Template12FPoints;
-       FillPointsCount: Succ(High(Template12FPoints));
-       canMirror: true; canFlip: false;
-      ),
-      (BasePoints: @Template13Points;
-       BasePointsCount: Succ(High(Template13Points));
-       BezPassCnt: 5;
-       PassMin: 15; PassDelta: 3;
-       WaveAmplMin:    18; WaveAmplDelta: 15;
-       WaveFreqMin:  0028; WaveFreqDelta: 0020;
-       FillPoints: @Template13FPoints;
-       FillPointsCount: Succ(High(Template13FPoints));
-       canMirror: true; canFlip: false;
-      ),
-      (BasePoints: @Template14Points;
-       BasePointsCount: Succ(High(Template14Points));
-       BezPassCnt: 4;
-       PassMin: 14; PassDelta: 3;
-       WaveAmplMin:    20; WaveAmplDelta: 15;
-       WaveFreqMin:  0030; WaveFreqDelta: 0020;
-       FillPoints: @Template14FPoints;
-       FillPointsCount: Succ(High(Template14FPoints));
-       canMirror: true; canFlip: false;
-      )
+       )
       );