Templates filter by nemo
authorunc0rr
Sun, 15 Feb 2009 14:38:02 +0000
changeset 1797 fedd8649fdd9
parent 1796 4bcdf0bf58b8
child 1798 029fcab94700
Templates filter by nemo
QTfrontend/gamecfgwidget.cpp
QTfrontend/gamecfgwidget.h
QTfrontend/hwform.cpp
QTfrontend/hwmap.cpp
QTfrontend/hwmap.h
QTfrontend/mapContainer.cpp
QTfrontend/mapContainer.h
QTfrontend/newnetclient.cpp
QTfrontend/newnetclient.h
hedgewars/uConsole.pas
hedgewars/uGears.pas
hedgewars/uLand.pas
hedgewars/uLandTemplates.pas
hedgewars/uMisc.pas
--- a/QTfrontend/gamecfgwidget.cpp	Sat Feb 14 21:04:51 2009 +0000
+++ b/QTfrontend/gamecfgwidget.cpp	Sun Feb 15 14:38:02 2009 +0000
@@ -62,12 +62,13 @@
 	L_TurnTime = new QLabel(QLabel::tr("Turn time"), GBoxOptions);
 	L_InitHealth = new QLabel(QLabel::tr("Initial health"), GBoxOptions);
 	L_SuddenDeath = new QLabel(QLabel::tr("Turns before SD"), GBoxOptions);
-	L_CaseProb = new QLabel(QLabel::tr("Bonus factor"), GBoxOptions);
+	L_CaseProb = new QLabel(QLabel::tr("Crate drops"), GBoxOptions);
 	GBoxOptionsLayout->addWidget(L_TurnTime, 4, 0);
 	GBoxOptionsLayout->addWidget(L_InitHealth, 5, 0);
 	GBoxOptionsLayout->addWidget(L_SuddenDeath, 6, 0);
 	GBoxOptionsLayout->addWidget(L_CaseProb, 7, 0);
 	GBoxOptionsLayout->addWidget(new QLabel(QLabel::tr("Weapons"), GBoxOptions), 8, 0);
+	GBoxOptionsLayout->addWidget(new QLabel(QLabel::tr("Generated Map Filter"), GBoxOptions), 9, 0);
 
 	SB_TurnTime = new QSpinBox(GBoxOptions);
 	SB_TurnTime->setRange(1, 99);
@@ -96,6 +97,15 @@
 	WeaponsName = new QComboBox(GBoxOptions);
 	GBoxOptionsLayout->addWidget(WeaponsName, 8, 1);
 
+	CB_TemplateFilter = new QComboBox(GBoxOptions);
+    CB_TemplateFilter->addItem(tr("All"), 0);
+    CB_TemplateFilter->addItem(tr("Small"), 1);
+    CB_TemplateFilter->addItem(tr("Medium"), 2);
+    CB_TemplateFilter->addItem(tr("Large"), 3);
+    CB_TemplateFilter->addItem(tr("Cavern"), 4);
+    CB_TemplateFilter->addItem(tr("Wacky"), 5);
+	GBoxOptionsLayout->addWidget(CB_TemplateFilter, 9, 1);
+
 	connect(SB_InitHealth, SIGNAL(valueChanged(int)), this, SIGNAL(initHealthChanged(int)));
 	connect(SB_TurnTime, SIGNAL(valueChanged(int)), this, SIGNAL(turnTimeChanged(int)));
 	connect(SB_SuddenDeath, SIGNAL(valueChanged(int)), this, SIGNAL(suddenDeathTurnsChanged(int)));
@@ -105,6 +115,8 @@
 	connect(CB_solid, SIGNAL(toggled(bool)), this, SIGNAL(solidChanged(bool)));
 	connect(CB_border, SIGNAL(toggled(bool)), this, SIGNAL(borderChanged(bool)));
 	connect(WeaponsName, SIGNAL(currentIndexChanged(int)), this, SLOT(ammoChanged(int)));
+	connect(CB_TemplateFilter, SIGNAL(currentIndexChanged(int)), this, SLOT(templateFilterChanged(int)));
+	connect(CB_TemplateFilter, SIGNAL(currentIndexChanged(int)), this, SLOT(templateFilterChanged(int)));
 
 	connect(pMapContainer, SIGNAL(seedChanged(const QString &)), this, SIGNAL(seedChanged(const QString &)));
 	connect(pMapContainer, SIGNAL(mapChanged(const QString &)), this, SIGNAL(mapChanged(const QString &)));
@@ -162,6 +174,11 @@
 	return SB_CaseProb->value();
 }
 
+quint32 GameCFGWidget::getTemplateFilter() const
+{
+	return CB_TemplateFilter->itemData(CB_TemplateFilter->currentIndex()).toInt();
+}
+
 QStringList GameCFGWidget::getFullConfig() const
 {
 	QStringList sl;
@@ -170,6 +187,7 @@
 	sl.append(QString("e$turntime %1").arg(getTurnTime() * 1000));
 	sl.append(QString("e$sd_turns %1").arg(getSuddenDeathTurns()));
 	sl.append(QString("e$casefreq %1").arg(getCaseProbability()));
+	sl.append(QString("e$template_filter %1").arg(getTemplateFilter()));
 
 	QString currentMap = getCurrentMap();
 	if (currentMap.size() > 0)
@@ -248,6 +266,17 @@
 	}
 }
 
+void GameCFGWidget::setTemplateFilter(int filter)
+{
+	CB_TemplateFilter->setCurrentIndex(filter);
+}
+
+void GameCFGWidget::templateFilterChanged(int filter)
+{
+	pMapContainer->setTemplateFilter(filter);
+	emit newTemplateFilter(filter);
+}
+
 void GameCFGWidget::ammoChanged(int index)
 {
 	if (index >= 0)
--- a/QTfrontend/gamecfgwidget.h	Sat Feb 14 21:04:51 2009 +0000
+++ b/QTfrontend/gamecfgwidget.h	Sun Feb 15 14:38:02 2009 +0000
@@ -66,6 +66,7 @@
 	quint32 getTurnTime() const;
 	quint32 getSuddenDeathTurns() const;
 	quint32 getCaseProbability() const;
+	quint32 getTemplateFilter() const;
 	QStringList getFullConfig() const;
 
 	QComboBox* WeaponsName;
@@ -83,6 +84,7 @@
 	void setSolid(bool value);
 	void setBorder(bool value);
 	void setNetAmmo(const QString& name, const QString& ammo);
+    void setTemplateFilter(int filter);
 
 signals:
 	void seedChanged(const QString & seed);
@@ -97,9 +99,11 @@
 	void solidChanged(bool value);
 	void borderChanged(bool value);
 	void newWeaponScheme(const QString & name, const QString & ammo);
+	void newTemplateFilter(int filter);
 
 private slots:
 	void ammoChanged(int index);
+	void templateFilterChanged(int filter);
 
 private:
 	QCheckBox * CB_mode_Forts;
@@ -111,6 +115,7 @@
 	QSpinBox * SB_TurnTime;
 	QSpinBox * SB_InitHealth;
 	QSpinBox * SB_SuddenDeath;
+	QComboBox* CB_TemplateFilter;
 	FreqSpinBox * SB_CaseProb;
 	QLabel * L_TurnTime;
 	QLabel * L_InitHealth;
--- a/QTfrontend/hwform.cpp	Sat Feb 14 21:04:51 2009 +0000
+++ b/QTfrontend/hwform.cpp	Sun Feb 15 14:38:02 2009 +0000
@@ -531,6 +531,7 @@
 	connect(ui.pageNetGame->pGameCFG, SIGNAL(borderChanged(bool)), hwnet, SLOT(onBorderChanged(bool)));
 	connect(ui.pageNetGame->pGameCFG, SIGNAL(newWeaponScheme(const QString &, const QString &)),
 			hwnet, SLOT(onWeaponsNameChanged(const QString &, const QString &)));
+	connect(ui.pageNetGame->pGameCFG, SIGNAL(newTemplateFilter(int)), hwnet, SLOT(onTemplateFilterChanged(int)));
 
 	connect(hwnet, SIGNAL(Disconnected()), this, SLOT(ForcedDisconnect()));
 	connect(hwnet, SIGNAL(seedChanged(const QString &)), ui.pageNetGame->pGameCFG, SLOT(setSeed(const QString &)));
@@ -549,6 +550,7 @@
 	connect(hwnet, SIGNAL(teamColorChanged(const HWTeam&)),
 		ui.pageNetGame->pNetTeamsWidget, SLOT(changeTeamColor(const HWTeam&)));
 	connect(hwnet, SIGNAL(ammoChanged(const QString&, const QString&)), ui.pageNetGame->pGameCFG, SLOT(setNetAmmo(const QString&, const QString&)));
+	connect(hwnet, SIGNAL(templateFilterChanged(int)), ui.pageNetGame->pGameCFG, SLOT(setTemplateFilter(int)));
 
 	hwnet->Connect(hostName, port, nick);
 }
--- a/QTfrontend/hwmap.cpp	Sat Feb 14 21:04:51 2009 +0000
+++ b/QTfrontend/hwmap.cpp	Sun Feb 15 14:38:02 2009 +0000
@@ -17,7 +17,7 @@
 
 #include "hwconsts.h"
 #include "hwmap.h"
-										#include <QDebug>
+
 HWMap::HWMap() :
   TCPBase(false)
 {
@@ -27,19 +27,20 @@
 {
 }
 
-void HWMap::getImage(std::string seed)
+void HWMap::getImage(std::string seed, int filter)
 {
-  m_seed=seed;
-  Start();
+	m_seed = seed;
+	templateFilter = filter;
+	Start();
 }
 
 QStringList HWMap::setArguments()
 {
-  QStringList arguments;
-  arguments << cfgdir->absolutePath();
-  arguments << QString("%1").arg(ipc_port);
-  arguments << "landpreview";
-  return arguments;
+	QStringList arguments;
+	arguments << cfgdir->absolutePath();
+	arguments << QString("%1").arg(ipc_port);
+	arguments << "landpreview";
+	return arguments;
 }
 
 void HWMap::onClientDisconnect()
@@ -56,7 +57,7 @@
 
 void HWMap::SendToClientFirst()
 {
-  std::string toSend=std::string("eseed ")+m_seed;
-  SendIPC(toSend.c_str());
-  SendIPC("!");
+	SendIPC(QString("eseed %1").arg(m_seed.c_str()).toLatin1());
+	SendIPC(QString("e$template_filter %1").arg(templateFilter).toLatin1());
+	SendIPC("!");
 }
--- a/QTfrontend/hwmap.h	Sat Feb 14 21:04:51 2009 +0000
+++ b/QTfrontend/hwmap.h	Sun Feb 15 14:38:02 2009 +0000
@@ -34,7 +34,7 @@
  public:
   HWMap();
   virtual ~HWMap();
-  void getImage(std::string seed);
+  void getImage(std::string seed, int templateFilter);
 
  protected:
   virtual QStringList setArguments();
@@ -47,6 +47,7 @@
 
  private:
   std::string m_seed;
+  int templateFilter;
 
  private slots:
 };
--- a/QTfrontend/mapContainer.cpp	Sat Feb 14 21:04:51 2009 +0000
+++ b/QTfrontend/mapContainer.cpp	Sun Feb 15 14:38:02 2009 +0000
@@ -41,6 +41,7 @@
 {
 	hhSmall.load(":/res/hh_small.png");
 	hhLimit = 18;
+    templateFilter = 0;
 	
 	mainLayout.setContentsMargins(QApplication::style()->pixelMetric(QStyle::PM_LayoutLeftMargin),
 		1,
@@ -198,7 +199,7 @@
 	pMap = new HWMap();
 	connect(pMap, SIGNAL(ImageReceived(const QImage)), this, SLOT(setImage(const QImage)));
 	connect(pMap, SIGNAL(HHLimitReceived(int)), this, SLOT(setHHLimit(int)));
-	pMap->getImage(m_seed.toStdString());
+	pMap->getImage(m_seed.toStdString(), templateFilter);
 }
 
 void HWMapContainer::themeSelected(int currentRow)
@@ -284,3 +285,8 @@
 	quint32 themeNum = rand() % Themes->size();
 	lwThemes->setCurrentRow(themeNum);
 }
+
+void HWMapContainer::setTemplateFilter(int filter)
+{
+   templateFilter = filter;   
+}
--- a/QTfrontend/mapContainer.h	Sat Feb 14 21:04:51 2009 +0000
+++ b/QTfrontend/mapContainer.h	Sun Feb 15 14:38:02 2009 +0000
@@ -49,6 +49,7 @@
   void setSeed(const QString & seed);
   void setMap(const QString & map);
   void setTheme(const QString & theme);
+  void setTemplateFilter(int);
 
  signals:
   void seedChanged(const QString & seed);
@@ -77,6 +78,7 @@
   HWMap* pMap;
   QString m_seed;
   int hhLimit;
+  int templateFilter;
   QPixmap hhSmall;
 
   void loadMap(int index);
--- a/QTfrontend/newnetclient.cpp	Sat Feb 14 21:04:51 2009 +0000
+++ b/QTfrontend/newnetclient.cpp	Sun Feb 15 14:38:02 2009 +0000
@@ -497,6 +497,10 @@
 			emit ammoChanged(lst[3], lst[2]);
 			return;
 		}
+		if (lst[1] == "TEMPLATE_FILTER") {
+			emit templateFilterChanged(lst[2].toUInt());
+			return;
+		}
 		qWarning() << "Net: Unknown 'CONFIG_PARAM' message:" << lst;
 		return;
 	}
@@ -575,6 +579,7 @@
 			m_pGameCFGWidget->WeaponsName->currentIndex()
 			).toString();
 	onWeaponsNameChanged(name, ammo);
+	onTemplateFilterChanged(m_pGameCFGWidget->getTemplateFilter());
 }
 
 void HWNewNet::RunGame()
@@ -660,6 +665,11 @@
 	if (isChief) RawSendNet(QString("CONFIG_PARAM%1AMMO%1%2%1%3").arg(delimeter).arg(ammo).arg(name));
 }
 
+void HWNewNet::onTemplateFilterChanged(int filter)
+{
+	if (isChief) RawSendNet(QString("CONFIG_PARAM%1TEMPLATE_FILTER%1%2").arg(delimeter).arg(filter));
+}
+
 void HWNewNet::chatLineToNet(const QString& str)
 {
 	if(str != "") {
--- a/QTfrontend/newnetclient.h	Sat Feb 14 21:04:51 2009 +0000
+++ b/QTfrontend/newnetclient.h	Sun Feb 15 14:38:02 2009 +0000
@@ -119,6 +119,7 @@
   void chatStringFromMe(const QString&);
   void chatStringFromMeLobby(const QString&);
   void ammoChanged(const QString& name, const QString& ammo);
+  void templateFilterChanged(int filter);
 
   void roomsList(const QStringList&);
   void serverMessage(const QString &);
@@ -148,6 +149,7 @@
   void onHedgehogsNumChanged(const HWTeam& team);
   void onTeamColorChanged(const HWTeam& team);
   void onWeaponsNameChanged(const QString& name, const QString& ammo);
+  void onTemplateFilterChanged(int filter);
   void JoinRoom(const QString & room);
   void CreateRoom(const QString & room);
   void askRoomsList();
--- a/hedgewars/uConsole.pas	Sat Feb 14 21:04:51 2009 +0000
+++ b/hedgewars/uConsole.pas	Sun Feb 15 14:38:02 2009 +0000
@@ -238,6 +238,7 @@
 RegisterVariable('map'     , vtCommand, @chSetMap       , false);
 RegisterVariable('theme'   , vtCommand, @chSetTheme     , false);
 RegisterVariable('seed'    , vtCommand, @chSetSeed      , false);
+RegisterVariable('template_filter', vtLongInt, @cTemplateFilter, false);
 RegisterVariable('delay'   , vtLongInt, @cInactDelay    , false);
 RegisterVariable('casefreq', vtLongInt, @cCaseFactor    , false);
 RegisterVariable('sd_turns', vtLongInt, @cSuddenDTurns  , false);
--- a/hedgewars/uGears.pas	Sat Feb 14 21:04:51 2009 +0000
+++ b/hedgewars/uGears.pas	Sun Feb 15 14:38:02 2009 +0000
@@ -465,7 +465,7 @@
 
 procedure ProcessGears;
 const delay: LongWord = 0;
-	step: (stDelay, stChDmg, stTurnReact,
+	step: (stDelay, stChDmg, stSweep, stTurnReact,
 			stAfterDelay, stChWin, stWater, stChWin2, stHealth,
 			stSpawn, stNTurn) = stDelay;
 
@@ -493,14 +493,12 @@
 		if delay = 0 then
 			inc(step)
 		end;
-	stChDmg: begin
-			if CheckNoDamage then inc(step) else step:= stDelay;
-			if SweepDirty then
+	stChDmg: if CheckNoDamage then inc(step) else step:= stDelay;
+	stSweep: if SweepDirty then
 				begin
 				SetAllToActive;
 				step:= stChDmg
-				end;
-			end;
+				end else inc(step);
 	stTurnReact: begin
 		if (not bBetweenTurns) and (not isInMultiShoot) then
 			begin
--- a/hedgewars/uLand.pas	Sat Feb 14 21:04:51 2009 +0000
+++ b/hedgewars/uLand.pas	Sun Feb 15 14:38:02 2009 +0000
@@ -515,6 +515,7 @@
 rightX:= (playWidth + ((LAND_WIDTH - playWidth) div 2)) - 1;
 topY:= LAND_HEIGHT - playHeight;
 
+// force to only cavern even if a cavern map is invertable if cTemplateFilter = 4 ?
 if (Template.canInvert and (getrandom(2) = 0)) or
     (not Template.canInvert and Template.isNegative) then 
     begin
@@ -535,8 +536,27 @@
 
 function SelectTemplate: LongInt;
 begin
-SelectTemplate:= getrandom(Succ(High(EdgeTemplates)));
-WriteLnToConsole('Selected template #'+inttostr(SelectTemplate));
+case cTemplateFilter of
+     0: begin
+     SelectTemplate:= getrandom(Succ(High(EdgeTemplates)));
+     end;
+     1: begin
+     SelectTemplate:= SmallTemplates[getrandom(Succ(High(SmallTemplates)))];
+     end;
+     2: begin
+     SelectTemplate:= MediumTemplates[getrandom(Succ(High(MediumTemplates)))];
+     end;
+     3: begin
+     SelectTemplate:= LargeTemplates[getrandom(Succ(High(LargeTemplates)))];
+     end;
+     4: begin
+     SelectTemplate:= CavernTemplates[getrandom(Succ(High(CavernTemplates)))];
+     end;
+     5: begin
+     SelectTemplate:= WackyTemplates[getrandom(Succ(High(WackyTemplates)))];
+     end;
+end;
+WriteLnToConsole('Selected template #'+inttostr(SelectTemplate)+' using filter #'+inttostr(cTemplateFilter));
 end;
 
 procedure LandSurface2LandPixels(Surface: PSDL_Surface);
--- a/hedgewars/uLandTemplates.pas	Sat Feb 14 21:04:51 2009 +0000
+++ b/hedgewars/uLandTemplates.pas	Sun Feb 15 14:38:02 2009 +0000
@@ -1297,9 +1297,6 @@
       );
 
 ///////////////////////// CAVERNS ///////////////////////////////////
-//// DUE TO LACK OF OTHER CAVERNS, AND A FILTER OPTION IN GUI
-//// BELOW IS SAME CAVERN CLONED 18 TIMES TO KEEP UP RATIO 
-////////////////////////////////////////////////////////////////////
 const Template36Points: array[0..18] of TSDL_Rect =
       (
        (x:  324; y:  756; w:  196; h:  204),
@@ -1326,481 +1323,13 @@
       (
        (x: 2047; y:    0)
       );
-const Template37Points: array[0..18] of TSDL_Rect =
-      (
-       (x:  324; y:  756; w:  196; h:  204),
-       (x:  224; y:  596; w:  404; h:   60),
-       (x:  240; y:  268; w:  464; h:  152),
-       (x:  876; y:  236; w:  168; h:  348),
-       (x: 1204; y:   56; w:  148; h:  700),
-       (x: 1516; y:   52; w:  192; h:  664),
-       (x: 1808; y:   60; w:  328; h:  496),
-       (x: 2292; y:   92; w:  184; h:  492),
-       (x: 2664; y:  216; w:  196; h:  340),
-       (x: 3004; y:  108; w:  176; h:  480),
-       (x: 3260; y:  368; w:  120; h:  348),
-       (x: 3476; y:  460; w:  208; h:  448),
-       (x: 3268; y:  906; w:  192; h:   96),
-       (x: 2876; y:  664; w:  204; h:  310),
-       (x: 2240; y:  748; w:  344; h:  224),
-       (x: 1584; y:  796; w:  440; h:  250),
-       (x:  892; y:  852; w:  324; h:  184),
-       (x:  576; y:  976; w:   16; h:   28),
-       (x: NTPX; y:    0; w:    1; h:    1)
-      );
-      Template37FPoints: array[0..0] of TPoint =
-      (
-       (x: 2047; y:    0)
-      );
-const Template38Points: array[0..18] of TSDL_Rect =
-      (
-       (x:  324; y:  756; w:  196; h:  204),
-       (x:  224; y:  596; w:  404; h:   60),
-       (x:  240; y:  268; w:  464; h:  152),
-       (x:  876; y:  236; w:  168; h:  348),
-       (x: 1204; y:   56; w:  148; h:  700),
-       (x: 1516; y:   52; w:  192; h:  664),
-       (x: 1808; y:   60; w:  328; h:  496),
-       (x: 2292; y:   92; w:  184; h:  492),
-       (x: 2664; y:  216; w:  196; h:  340),
-       (x: 3004; y:  108; w:  176; h:  480),
-       (x: 3260; y:  368; w:  120; h:  348),
-       (x: 3476; y:  460; w:  208; h:  448),
-       (x: 3268; y:  906; w:  192; h:   96),
-       (x: 2876; y:  664; w:  204; h:  310),
-       (x: 2240; y:  748; w:  344; h:  224),
-       (x: 1584; y:  796; w:  440; h:  250),
-       (x:  892; y:  852; w:  324; h:  184),
-       (x:  576; y:  976; w:   16; h:   28),
-       (x: NTPX; y:    0; w:    1; h:    1)
-      );
-      Template38FPoints: array[0..0] of TPoint =
-      (
-       (x: 2047; y:    0)
-      );
-const Template39Points: array[0..18] of TSDL_Rect =
-      (
-       (x:  324; y:  756; w:  196; h:  204),
-       (x:  224; y:  596; w:  404; h:   60),
-       (x:  240; y:  268; w:  464; h:  152),
-       (x:  876; y:  236; w:  168; h:  348),
-       (x: 1204; y:   56; w:  148; h:  700),
-       (x: 1516; y:   52; w:  192; h:  664),
-       (x: 1808; y:   60; w:  328; h:  496),
-       (x: 2292; y:   92; w:  184; h:  492),
-       (x: 2664; y:  216; w:  196; h:  340),
-       (x: 3004; y:  108; w:  176; h:  480),
-       (x: 3260; y:  368; w:  120; h:  348),
-       (x: 3476; y:  460; w:  208; h:  448),
-       (x: 3268; y:  906; w:  192; h:   96),
-       (x: 2876; y:  664; w:  204; h:  310),
-       (x: 2240; y:  748; w:  344; h:  224),
-       (x: 1584; y:  796; w:  440; h:  250),
-       (x:  892; y:  852; w:  324; h:  184),
-       (x:  576; y:  976; w:   16; h:   28),
-       (x: NTPX; y:    0; w:    1; h:    1)
-      );
-      Template39FPoints: array[0..0] of TPoint =
-      (
-       (x: 2047; y:    0)
-      );
-const Template40Points: array[0..18] of TSDL_Rect =
-      (
-       (x:  324; y:  756; w:  196; h:  204),
-       (x:  224; y:  596; w:  404; h:   60),
-       (x:  240; y:  268; w:  464; h:  152),
-       (x:  876; y:  236; w:  168; h:  348),
-       (x: 1204; y:   56; w:  148; h:  700),
-       (x: 1516; y:   52; w:  192; h:  664),
-       (x: 1808; y:   60; w:  328; h:  496),
-       (x: 2292; y:   92; w:  184; h:  492),
-       (x: 2664; y:  216; w:  196; h:  340),
-       (x: 3004; y:  108; w:  176; h:  480),
-       (x: 3260; y:  368; w:  120; h:  348),
-       (x: 3476; y:  460; w:  208; h:  448),
-       (x: 3268; y:  906; w:  192; h:   96),
-       (x: 2876; y:  664; w:  204; h:  310),
-       (x: 2240; y:  748; w:  344; h:  224),
-       (x: 1584; y:  796; w:  440; h:  250),
-       (x:  892; y:  852; w:  324; h:  184),
-       (x:  576; y:  976; w:   16; h:   28),
-       (x: NTPX; y:    0; w:    1; h:    1)
-      );
-      Template40FPoints: array[0..0] of TPoint =
-      (
-       (x: 2047; y:    0)
-      );
-const Template41Points: array[0..18] of TSDL_Rect =
-      (
-       (x:  324; y:  756; w:  196; h:  204),
-       (x:  224; y:  596; w:  404; h:   60),
-       (x:  240; y:  268; w:  464; h:  152),
-       (x:  876; y:  236; w:  168; h:  348),
-       (x: 1204; y:   56; w:  148; h:  700),
-       (x: 1516; y:   52; w:  192; h:  664),
-       (x: 1808; y:   60; w:  328; h:  496),
-       (x: 2292; y:   92; w:  184; h:  492),
-       (x: 2664; y:  216; w:  196; h:  340),
-       (x: 3004; y:  108; w:  176; h:  480),
-       (x: 3260; y:  368; w:  120; h:  348),
-       (x: 3476; y:  460; w:  208; h:  448),
-       (x: 3268; y:  906; w:  192; h:   96),
-       (x: 2876; y:  664; w:  204; h:  310),
-       (x: 2240; y:  748; w:  344; h:  224),
-       (x: 1584; y:  796; w:  440; h:  250),
-       (x:  892; y:  852; w:  324; h:  184),
-       (x:  576; y:  976; w:   16; h:   28),
-       (x: NTPX; y:    0; w:    1; h:    1)
-      );
-      Template41FPoints: array[0..0] of TPoint =
-      (
-       (x: 2047; y:    0)
-      );
-const Template42Points: array[0..18] of TSDL_Rect =
-      (
-       (x:  324; y:  756; w:  196; h:  204),
-       (x:  224; y:  596; w:  404; h:   60),
-       (x:  240; y:  268; w:  464; h:  152),
-       (x:  876; y:  236; w:  168; h:  348),
-       (x: 1204; y:   56; w:  148; h:  700),
-       (x: 1516; y:   52; w:  192; h:  664),
-       (x: 1808; y:   60; w:  328; h:  496),
-       (x: 2292; y:   92; w:  184; h:  492),
-       (x: 2664; y:  216; w:  196; h:  340),
-       (x: 3004; y:  108; w:  176; h:  480),
-       (x: 3260; y:  368; w:  120; h:  348),
-       (x: 3476; y:  460; w:  208; h:  448),
-       (x: 3268; y:  906; w:  192; h:   96),
-       (x: 2876; y:  664; w:  204; h:  310),
-       (x: 2240; y:  748; w:  344; h:  224),
-       (x: 1584; y:  796; w:  440; h:  250),
-       (x:  892; y:  852; w:  324; h:  184),
-       (x:  576; y:  976; w:   16; h:   28),
-       (x: NTPX; y:    0; w:    1; h:    1)
-      );
-      Template42FPoints: array[0..0] of TPoint =
-      (
-       (x: 2047; y:    0)
-      );
-const Template43Points: array[0..18] of TSDL_Rect =
-      (
-       (x:  324; y:  756; w:  196; h:  204),
-       (x:  224; y:  596; w:  404; h:   60),
-       (x:  240; y:  268; w:  464; h:  152),
-       (x:  876; y:  236; w:  168; h:  348),
-       (x: 1204; y:   56; w:  148; h:  700),
-       (x: 1516; y:   52; w:  192; h:  664),
-       (x: 1808; y:   60; w:  328; h:  496),
-       (x: 2292; y:   92; w:  184; h:  492),
-       (x: 2664; y:  216; w:  196; h:  340),
-       (x: 3004; y:  108; w:  176; h:  480),
-       (x: 3260; y:  368; w:  120; h:  348),
-       (x: 3476; y:  460; w:  208; h:  448),
-       (x: 3268; y:  906; w:  192; h:   96),
-       (x: 2876; y:  664; w:  204; h:  310),
-       (x: 2240; y:  748; w:  344; h:  224),
-       (x: 1584; y:  796; w:  440; h:  250),
-       (x:  892; y:  852; w:  324; h:  184),
-       (x:  576; y:  976; w:   16; h:   28),
-       (x: NTPX; y:    0; w:    1; h:    1)
-      );
-      Template43FPoints: array[0..0] of TPoint =
-      (
-       (x: 2047; y:    0)
-      );
-const Template44Points: array[0..18] of TSDL_Rect =
-      (
-       (x:  324; y:  756; w:  196; h:  204),
-       (x:  224; y:  596; w:  404; h:   60),
-       (x:  240; y:  268; w:  464; h:  152),
-       (x:  876; y:  236; w:  168; h:  348),
-       (x: 1204; y:   56; w:  148; h:  700),
-       (x: 1516; y:   52; w:  192; h:  664),
-       (x: 1808; y:   60; w:  328; h:  496),
-       (x: 2292; y:   92; w:  184; h:  492),
-       (x: 2664; y:  216; w:  196; h:  340),
-       (x: 3004; y:  108; w:  176; h:  480),
-       (x: 3260; y:  368; w:  120; h:  348),
-       (x: 3476; y:  460; w:  208; h:  448),
-       (x: 3268; y:  906; w:  192; h:   96),
-       (x: 2876; y:  664; w:  204; h:  310),
-       (x: 2240; y:  748; w:  344; h:  224),
-       (x: 1584; y:  796; w:  440; h:  250),
-       (x:  892; y:  852; w:  324; h:  184),
-       (x:  576; y:  976; w:   16; h:   28),
-       (x: NTPX; y:    0; w:    1; h:    1)
-      );
-      Template44FPoints: array[0..0] of TPoint =
-      (
-       (x: 2047; y:    0)
-      );
-const Template45Points: array[0..18] of TSDL_Rect =
-      (
-       (x:  324; y:  756; w:  196; h:  204),
-       (x:  224; y:  596; w:  404; h:   60),
-       (x:  240; y:  268; w:  464; h:  152),
-       (x:  876; y:  236; w:  168; h:  348),
-       (x: 1204; y:   56; w:  148; h:  700),
-       (x: 1516; y:   52; w:  192; h:  664),
-       (x: 1808; y:   60; w:  328; h:  496),
-       (x: 2292; y:   92; w:  184; h:  492),
-       (x: 2664; y:  216; w:  196; h:  340),
-       (x: 3004; y:  108; w:  176; h:  480),
-       (x: 3260; y:  368; w:  120; h:  348),
-       (x: 3476; y:  460; w:  208; h:  448),
-       (x: 3268; y:  906; w:  192; h:   96),
-       (x: 2876; y:  664; w:  204; h:  310),
-       (x: 2240; y:  748; w:  344; h:  224),
-       (x: 1584; y:  796; w:  440; h:  250),
-       (x:  892; y:  852; w:  324; h:  184),
-       (x:  576; y:  976; w:   16; h:   28),
-       (x: NTPX; y:    0; w:    1; h:    1)
-      );
-      Template45FPoints: array[0..0] of TPoint =
-      (
-       (x: 2047; y:    0)
-      );
-const Template46Points: array[0..18] of TSDL_Rect =
-      (
-       (x:  324; y:  756; w:  196; h:  204),
-       (x:  224; y:  596; w:  404; h:   60),
-       (x:  240; y:  268; w:  464; h:  152),
-       (x:  876; y:  236; w:  168; h:  348),
-       (x: 1204; y:   56; w:  148; h:  700),
-       (x: 1516; y:   52; w:  192; h:  664),
-       (x: 1808; y:   60; w:  328; h:  496),
-       (x: 2292; y:   92; w:  184; h:  492),
-       (x: 2664; y:  216; w:  196; h:  340),
-       (x: 3004; y:  108; w:  176; h:  480),
-       (x: 3260; y:  368; w:  120; h:  348),
-       (x: 3476; y:  460; w:  208; h:  448),
-       (x: 3268; y:  906; w:  192; h:   96),
-       (x: 2876; y:  664; w:  204; h:  310),
-       (x: 2240; y:  748; w:  344; h:  224),
-       (x: 1584; y:  796; w:  440; h:  250),
-       (x:  892; y:  852; w:  324; h:  184),
-       (x:  576; y:  976; w:   16; h:   28),
-       (x: NTPX; y:    0; w:    1; h:    1)
-      );
-      Template46FPoints: array[0..0] of TPoint =
-      (
-       (x: 2047; y:    0)
-      );
-const Template47Points: array[0..18] of TSDL_Rect =
-      (
-       (x:  324; y:  756; w:  196; h:  204),
-       (x:  224; y:  596; w:  404; h:   60),
-       (x:  240; y:  268; w:  464; h:  152),
-       (x:  876; y:  236; w:  168; h:  348),
-       (x: 1204; y:   56; w:  148; h:  700),
-       (x: 1516; y:   52; w:  192; h:  664),
-       (x: 1808; y:   60; w:  328; h:  496),
-       (x: 2292; y:   92; w:  184; h:  492),
-       (x: 2664; y:  216; w:  196; h:  340),
-       (x: 3004; y:  108; w:  176; h:  480),
-       (x: 3260; y:  368; w:  120; h:  348),
-       (x: 3476; y:  460; w:  208; h:  448),
-       (x: 3268; y:  906; w:  192; h:   96),
-       (x: 2876; y:  664; w:  204; h:  310),
-       (x: 2240; y:  748; w:  344; h:  224),
-       (x: 1584; y:  796; w:  440; h:  250),
-       (x:  892; y:  852; w:  324; h:  184),
-       (x:  576; y:  976; w:   16; h:   28),
-       (x: NTPX; y:    0; w:    1; h:    1)
-      );
-      Template47FPoints: array[0..0] of TPoint =
-      (
-       (x: 2047; y:    0)
-      );
-const Template48Points: array[0..18] of TSDL_Rect =
-      (
-       (x:  324; y:  756; w:  196; h:  204),
-       (x:  224; y:  596; w:  404; h:   60),
-       (x:  240; y:  268; w:  464; h:  152),
-       (x:  876; y:  236; w:  168; h:  348),
-       (x: 1204; y:   56; w:  148; h:  700),
-       (x: 1516; y:   52; w:  192; h:  664),
-       (x: 1808; y:   60; w:  328; h:  496),
-       (x: 2292; y:   92; w:  184; h:  492),
-       (x: 2664; y:  216; w:  196; h:  340),
-       (x: 3004; y:  108; w:  176; h:  480),
-       (x: 3260; y:  368; w:  120; h:  348),
-       (x: 3476; y:  460; w:  208; h:  448),
-       (x: 3268; y:  906; w:  192; h:   96),
-       (x: 2876; y:  664; w:  204; h:  310),
-       (x: 2240; y:  748; w:  344; h:  224),
-       (x: 1584; y:  796; w:  440; h:  250),
-       (x:  892; y:  852; w:  324; h:  184),
-       (x:  576; y:  976; w:   16; h:   28),
-       (x: NTPX; y:    0; w:    1; h:    1)
-      );
-      Template48FPoints: array[0..0] of TPoint =
-      (
-       (x: 2047; y:    0)
-      );
-const Template49Points: array[0..18] of TSDL_Rect =
-      (
-       (x:  324; y:  756; w:  196; h:  204),
-       (x:  224; y:  596; w:  404; h:   60),
-       (x:  240; y:  268; w:  464; h:  152),
-       (x:  876; y:  236; w:  168; h:  348),
-       (x: 1204; y:   56; w:  148; h:  700),
-       (x: 1516; y:   52; w:  192; h:  664),
-       (x: 1808; y:   60; w:  328; h:  496),
-       (x: 2292; y:   92; w:  184; h:  492),
-       (x: 2664; y:  216; w:  196; h:  340),
-       (x: 3004; y:  108; w:  176; h:  480),
-       (x: 3260; y:  368; w:  120; h:  348),
-       (x: 3476; y:  460; w:  208; h:  448),
-       (x: 3268; y:  906; w:  192; h:   96),
-       (x: 2876; y:  664; w:  204; h:  310),
-       (x: 2240; y:  748; w:  344; h:  224),
-       (x: 1584; y:  796; w:  440; h:  250),
-       (x:  892; y:  852; w:  324; h:  184),
-       (x:  576; y:  976; w:   16; h:   28),
-       (x: NTPX; y:    0; w:    1; h:    1)
-      );
-      Template49FPoints: array[0..0] of TPoint =
-      (
-       (x: 2047; y:    0)
-      );
-const Template50Points: array[0..18] of TSDL_Rect =
-      (
-       (x:  324; y:  756; w:  196; h:  204),
-       (x:  224; y:  596; w:  404; h:   60),
-       (x:  240; y:  268; w:  464; h:  152),
-       (x:  876; y:  236; w:  168; h:  348),
-       (x: 1204; y:   56; w:  148; h:  700),
-       (x: 1516; y:   52; w:  192; h:  664),
-       (x: 1808; y:   60; w:  328; h:  496),
-       (x: 2292; y:   92; w:  184; h:  492),
-       (x: 2664; y:  216; w:  196; h:  340),
-       (x: 3004; y:  108; w:  176; h:  480),
-       (x: 3260; y:  368; w:  120; h:  348),
-       (x: 3476; y:  460; w:  208; h:  448),
-       (x: 3268; y:  906; w:  192; h:   96),
-       (x: 2876; y:  664; w:  204; h:  310),
-       (x: 2240; y:  748; w:  344; h:  224),
-       (x: 1584; y:  796; w:  440; h:  250),
-       (x:  892; y:  852; w:  324; h:  184),
-       (x:  576; y:  976; w:   16; h:   28),
-       (x: NTPX; y:    0; w:    1; h:    1)
-      );
-      Template50FPoints: array[0..0] of TPoint =
-      (
-       (x: 2047; y:    0)
-      );
-const Template51Points: array[0..18] of TSDL_Rect =
-      (
-       (x:  324; y:  756; w:  196; h:  204),
-       (x:  224; y:  596; w:  404; h:   60),
-       (x:  240; y:  268; w:  464; h:  152),
-       (x:  876; y:  236; w:  168; h:  348),
-       (x: 1204; y:   56; w:  148; h:  700),
-       (x: 1516; y:   52; w:  192; h:  664),
-       (x: 1808; y:   60; w:  328; h:  496),
-       (x: 2292; y:   92; w:  184; h:  492),
-       (x: 2664; y:  216; w:  196; h:  340),
-       (x: 3004; y:  108; w:  176; h:  480),
-       (x: 3260; y:  368; w:  120; h:  348),
-       (x: 3476; y:  460; w:  208; h:  448),
-       (x: 3268; y:  906; w:  192; h:   96),
-       (x: 2876; y:  664; w:  204; h:  310),
-       (x: 2240; y:  748; w:  344; h:  224),
-       (x: 1584; y:  796; w:  440; h:  250),
-       (x:  892; y:  852; w:  324; h:  184),
-       (x:  576; y:  976; w:   16; h:   28),
-       (x: NTPX; y:    0; w:    1; h:    1)
-      );
-      Template51FPoints: array[0..0] of TPoint =
-      (
-       (x: 2047; y:    0)
-      );
-const Template52Points: array[0..18] of TSDL_Rect =
-      (
-       (x:  324; y:  756; w:  196; h:  204),
-       (x:  224; y:  596; w:  404; h:   60),
-       (x:  240; y:  268; w:  464; h:  152),
-       (x:  876; y:  236; w:  168; h:  348),
-       (x: 1204; y:   56; w:  148; h:  700),
-       (x: 1516; y:   52; w:  192; h:  664),
-       (x: 1808; y:   60; w:  328; h:  496),
-       (x: 2292; y:   92; w:  184; h:  492),
-       (x: 2664; y:  216; w:  196; h:  340),
-       (x: 3004; y:  108; w:  176; h:  480),
-       (x: 3260; y:  368; w:  120; h:  348),
-       (x: 3476; y:  460; w:  208; h:  448),
-       (x: 3268; y:  906; w:  192; h:   96),
-       (x: 2876; y:  664; w:  204; h:  310),
-       (x: 2240; y:  748; w:  344; h:  224),
-       (x: 1584; y:  796; w:  440; h:  250),
-       (x:  892; y:  852; w:  324; h:  184),
-       (x:  576; y:  976; w:   16; h:   28),
-       (x: NTPX; y:    0; w:    1; h:    1)
-      );
-      Template52FPoints: array[0..0] of TPoint =
-      (
-       (x: 2047; y:    0)
-      );
-const Template53Points: array[0..18] of TSDL_Rect =
-      (
-       (x:  324; y:  756; w:  196; h:  204),
-       (x:  224; y:  596; w:  404; h:   60),
-       (x:  240; y:  268; w:  464; h:  152),
-       (x:  876; y:  236; w:  168; h:  348),
-       (x: 1204; y:   56; w:  148; h:  700),
-       (x: 1516; y:   52; w:  192; h:  664),
-       (x: 1808; y:   60; w:  328; h:  496),
-       (x: 2292; y:   92; w:  184; h:  492),
-       (x: 2664; y:  216; w:  196; h:  340),
-       (x: 3004; y:  108; w:  176; h:  480),
-       (x: 3260; y:  368; w:  120; h:  348),
-       (x: 3476; y:  460; w:  208; h:  448),
-       (x: 3268; y:  906; w:  192; h:   96),
-       (x: 2876; y:  664; w:  204; h:  310),
-       (x: 2240; y:  748; w:  344; h:  224),
-       (x: 1584; y:  796; w:  440; h:  250),
-       (x:  892; y:  852; w:  324; h:  184),
-       (x:  576; y:  976; w:   16; h:   28),
-       (x: NTPX; y:    0; w:    1; h:    1)
-      );
-      Template53FPoints: array[0..0] of TPoint =
-      (
-       (x: 2047; y:    0)
-      );
-const Template54Points: array[0..18] of TSDL_Rect =
-      (
-       (x:  324; y:  756; w:  196; h:  204),
-       (x:  224; y:  596; w:  404; h:   60),
-       (x:  240; y:  268; w:  464; h:  152),
-       (x:  876; y:  236; w:  168; h:  348),
-       (x: 1204; y:   56; w:  148; h:  700),
-       (x: 1516; y:   52; w:  192; h:  664),
-       (x: 1808; y:   60; w:  328; h:  496),
-       (x: 2292; y:   92; w:  184; h:  492),
-       (x: 2664; y:  216; w:  196; h:  340),
-       (x: 3004; y:  108; w:  176; h:  480),
-       (x: 3260; y:  368; w:  120; h:  348),
-       (x: 3476; y:  460; w:  208; h:  448),
-       (x: 3268; y:  906; w:  192; h:   96),
-       (x: 2876; y:  664; w:  204; h:  310),
-       (x: 2240; y:  748; w:  344; h:  224),
-       (x: 1584; y:  796; w:  440; h:  250),
-       (x:  892; y:  852; w:  324; h:  184),
-       (x:  576; y:  976; w:   16; h:   28),
-       (x: NTPX; y:    0; w:    1; h:    1)
-      );
-      Template54FPoints: array[0..0] of TPoint =
-      (
-       (x: 2047; y:    0)
-      );
 ////////////////////////////// ... Silly ...  ////////////////////////////////
 /// Ok. Tiy doesn't care for these.  Perhaps they could be saved.
 /// For now, just rare.
 //////////////////////////////////////////////////////////////////////////////
 
 // maybe Tiy would be ok with this if it was smoother/more climable and a bit shorter?
-const Template55Points: array[0..27] of TSDL_Rect =
+const Template37Points: array[0..27] of TSDL_Rect =
       (
        (x:  700; y: 2100; w: 20; h: 75),
        (x:  800; y: 1200; w: 20; h: 75),
@@ -1831,12 +1360,12 @@
        (x: 2250; y: 1200; w: 25; h: 25),
        (x: NTPX; y:    0; w:  1; h:  1)
       );
-      Template55FPoints: array[0..0] of TPoint =
+      Template37FPoints: array[0..0] of TPoint =
       (
        (x: 2047; y:    0)
       );
 // attempt to make a series of moderate hills/valleys - was before I really figured out the whole probabilities thing
-const Template56Points: array[0..16] of TSDL_Rect =
+const Template38Points: array[0..16] of TSDL_Rect =
       (
        (x:  100; y: 2100; w:   1; h:    1),
        (x:  100; y: 1600; w: 300; h:  500),
@@ -1856,13 +1385,13 @@
        (x: 3700; y: 2100; w:   1; h:    1),
        (x: NTPX; y:    0; w:   1; h:    1)
       );
-      Template56FPoints: array[0..0] of TPoint =
+      Template38FPoints: array[0..0] of TPoint =
       (
        (x: 2047; y:    0)
       );
 
 // 8 tiny islands
-const Template57Points: array[0..39] of TSDL_Rect =
+const Template39Points: array[0..39] of TSDL_Rect =
       (
        (x:   90; y: 520; w:   1; h:   1),
        (x:   90; y: 350; w:  10; h: 150),
@@ -1905,13 +1434,28 @@
        (x: 1430; y: 520; w:   1; h:   1),
        (x: NTPX; y:   0; w:   1; h:   1)
       );
-      Template57FPoints: array[0..0] of TPoint =
+      Template39FPoints: array[0..0] of TPoint =
+      (
+       (x: 512; y:    0)
+      );
+const Template40Points: array[0..7] of TSDL_Rect =
+      (
+       (x:   90; y: 1050; w:    1; h:   1),
+       (x:  100; y:  800; w:  100; h: 200),
+       (x:  300; y:  600; w:  100; h: 200),
+       (x:  500; y:  200; w:  100; h: 200),
+       (x:  700; y:  600; w:  100; h: 100),
+       (x:  900; y:  800; w:  100; h: 200),
+       (x:  900; y: 1050; w:    1; h:   1),
+       (x: NTPX; y:    0; w:    1; h:   1)
+      );
+      Template40FPoints: array[0..0] of TPoint =
       (
        (x: 512; y:    0)
       );
 
 ////////////////////////////////////////////////////////////////////////
-const EdgeTemplates: array[0..57] of TEdgeTemplate =
+const EdgeTemplates: array[0..40] of TEdgeTemplate =
       (
        (BasePoints: @Template0Points;
         BasePointsCount: Succ(High(Template0Points));
@@ -2316,7 +1860,7 @@
         BezierizeCount: 4;
         RandPassesCount: 12;
         TemplateHeight: 1024; TemplateWidth: 4096;
-        canMirror: true; canFlip: false; isNegative: true; canInvert: true;
+        canMirror: true; canFlip: false; isNegative: true; canInvert: false;
         hasGirders: false;
         MaxHedgehogs: 32;
        ),
@@ -2324,204 +1868,6 @@
         BasePointsCount: Succ(High(Template37Points));
         FillPoints: @Template37FPoints;
         FillPointsCount: Succ(High(Template37FPoints));
-        BezierizeCount: 4;
-        RandPassesCount: 12;
-        TemplateHeight: 1024; TemplateWidth: 4096;
-        canMirror: true; canFlip: false; isNegative: true; canInvert: true;
-        hasGirders: false;
-        MaxHedgehogs: 32;
-       ),
-       (BasePoints: @Template38Points;
-        BasePointsCount: Succ(High(Template38Points));
-        FillPoints: @Template38FPoints;
-        FillPointsCount: Succ(High(Template38FPoints));
-        BezierizeCount: 4;
-        RandPassesCount: 12;
-        TemplateHeight: 1024; TemplateWidth: 4096;
-        canMirror: true; canFlip: false; isNegative: true; canInvert: true;
-        hasGirders: false;
-        MaxHedgehogs: 32;
-       ),
-       (BasePoints: @Template39Points;
-        BasePointsCount: Succ(High(Template39Points));
-        FillPoints: @Template39FPoints;
-        FillPointsCount: Succ(High(Template39FPoints));
-        BezierizeCount: 4;
-        RandPassesCount: 12;
-        TemplateHeight: 1024; TemplateWidth: 4096;
-        canMirror: true; canFlip: false; isNegative: true; canInvert: true;
-        hasGirders: false;
-        MaxHedgehogs: 32;
-       ),
-       (BasePoints: @Template40Points;
-        BasePointsCount: Succ(High(Template40Points));
-        FillPoints: @Template40FPoints;
-        FillPointsCount: Succ(High(Template40FPoints));
-        BezierizeCount: 4;
-        RandPassesCount: 12;
-        TemplateHeight: 1024; TemplateWidth: 4096;
-        canMirror: true; canFlip: false; isNegative: true; canInvert: true;
-        hasGirders: false;
-        MaxHedgehogs: 32;
-       ),
-       (BasePoints: @Template41Points;
-        BasePointsCount: Succ(High(Template41Points));
-        FillPoints: @Template41FPoints;
-        FillPointsCount: Succ(High(Template41FPoints));
-        BezierizeCount: 4;
-        RandPassesCount: 12;
-        TemplateHeight: 1024; TemplateWidth: 4096;
-        canMirror: true; canFlip: false; isNegative: true; canInvert: false;
-        hasGirders: false;
-        MaxHedgehogs: 32;
-       ),
-       (BasePoints: @Template42Points;
-        BasePointsCount: Succ(High(Template42Points));
-        FillPoints: @Template42FPoints;
-        FillPointsCount: Succ(High(Template42FPoints));
-        BezierizeCount: 4;
-        RandPassesCount: 12;
-        TemplateHeight: 1024; TemplateWidth: 4096;
-        canMirror: true; canFlip: false; isNegative: true; canInvert: false;
-        hasGirders: false;
-        MaxHedgehogs: 32;
-       ),
-       (BasePoints: @Template43Points;
-        BasePointsCount: Succ(High(Template43Points));
-        FillPoints: @Template43FPoints;
-        FillPointsCount: Succ(High(Template43FPoints));
-        BezierizeCount: 4;
-        RandPassesCount: 12;
-        TemplateHeight: 1024; TemplateWidth: 4096;
-        canMirror: true; canFlip: false; isNegative: true; canInvert: false;
-        hasGirders: false;
-        MaxHedgehogs: 32;
-       ),
-       (BasePoints: @Template44Points;
-        BasePointsCount: Succ(High(Template44Points));
-        FillPoints: @Template44FPoints;
-        FillPointsCount: Succ(High(Template44FPoints));
-        BezierizeCount: 4;
-        RandPassesCount: 12;
-        TemplateHeight: 1024; TemplateWidth: 4096;
-        canMirror: true; canFlip: false; isNegative: true; canInvert: false;
-        hasGirders: false;
-        MaxHedgehogs: 32;
-       ),
-       (BasePoints: @Template45Points;
-        BasePointsCount: Succ(High(Template45Points));
-        FillPoints: @Template45FPoints;
-        FillPointsCount: Succ(High(Template45FPoints));
-        BezierizeCount: 4;
-        RandPassesCount: 12;
-        TemplateHeight: 1024; TemplateWidth: 4096;
-        canMirror: true; canFlip: false; isNegative: true; canInvert: false;
-        hasGirders: false;
-        MaxHedgehogs: 32;
-       ),
-       (BasePoints: @Template46Points;
-        BasePointsCount: Succ(High(Template46Points));
-        FillPoints: @Template46FPoints;
-        FillPointsCount: Succ(High(Template46FPoints));
-        BezierizeCount: 4;
-        RandPassesCount: 12;
-        TemplateHeight: 1024; TemplateWidth: 4096;
-        canMirror: true; canFlip: false; isNegative: true; canInvert: false;
-        hasGirders: false;
-        MaxHedgehogs: 32;
-       ),
-       (BasePoints: @Template47Points;
-        BasePointsCount: Succ(High(Template47Points));
-        FillPoints: @Template47FPoints;
-        FillPointsCount: Succ(High(Template47FPoints));
-        BezierizeCount: 4;
-        RandPassesCount: 12;
-        TemplateHeight: 1024; TemplateWidth: 4096;
-        canMirror: true; canFlip: false; isNegative: true; canInvert: false;
-        hasGirders: false;
-        MaxHedgehogs: 32;
-       ),
-       (BasePoints: @Template48Points;
-        BasePointsCount: Succ(High(Template48Points));
-        FillPoints: @Template48FPoints;
-        FillPointsCount: Succ(High(Template48FPoints));
-        BezierizeCount: 4;
-        RandPassesCount: 12;
-        TemplateHeight: 1024; TemplateWidth: 4096;
-        canMirror: true; canFlip: false; isNegative: true; canInvert: false;
-        hasGirders: false;
-        MaxHedgehogs: 32;
-       ),
-       (BasePoints: @Template49Points;
-        BasePointsCount: Succ(High(Template49Points));
-        FillPoints: @Template49FPoints;
-        FillPointsCount: Succ(High(Template49FPoints));
-        BezierizeCount: 4;
-        RandPassesCount: 12;
-        TemplateHeight: 1024; TemplateWidth: 4096;
-        canMirror: true; canFlip: false; isNegative: true; canInvert: false;
-        hasGirders: false;
-        MaxHedgehogs: 32;
-       ),
-       (BasePoints: @Template50Points;
-        BasePointsCount: Succ(High(Template50Points));
-        FillPoints: @Template50FPoints;
-        FillPointsCount: Succ(High(Template50FPoints));
-        BezierizeCount: 4;
-        RandPassesCount: 12;
-        TemplateHeight: 1024; TemplateWidth: 4096;
-        canMirror: true; canFlip: false; isNegative: true; canInvert: false;
-        hasGirders: false;
-        MaxHedgehogs: 32;
-       ),
-       (BasePoints: @Template51Points;
-        BasePointsCount: Succ(High(Template51Points));
-        FillPoints: @Template51FPoints;
-        FillPointsCount: Succ(High(Template51FPoints));
-        BezierizeCount: 4;
-        RandPassesCount: 12;
-        TemplateHeight: 1024; TemplateWidth: 4096;
-        canMirror: true; canFlip: false; isNegative: true; canInvert: false;
-        hasGirders: false;
-        MaxHedgehogs: 32;
-       ),
-       (BasePoints: @Template52Points;
-        BasePointsCount: Succ(High(Template52Points));
-        FillPoints: @Template52FPoints;
-        FillPointsCount: Succ(High(Template52FPoints));
-        BezierizeCount: 4;
-        RandPassesCount: 12;
-        TemplateHeight: 1024; TemplateWidth: 4096;
-        canMirror: true; canFlip: false; isNegative: true; canInvert: false;
-        hasGirders: false;
-        MaxHedgehogs: 32;
-        ),
-       (BasePoints: @Template53Points;
-        BasePointsCount: Succ(High(Template53Points));
-        FillPoints: @Template53FPoints;
-        FillPointsCount: Succ(High(Template53FPoints));
-        BezierizeCount: 4;
-        RandPassesCount: 12;
-        TemplateHeight: 1024; TemplateWidth: 4096;
-        canMirror: true; canFlip: false; isNegative: true; canInvert: false;
-        hasGirders: false;
-        MaxHedgehogs: 32;
-        ),
-       (BasePoints: @Template54Points;
-        BasePointsCount: Succ(High(Template54Points));
-        FillPoints: @Template54FPoints;
-        FillPointsCount: Succ(High(Template54FPoints));
-        BezierizeCount: 4;
-        RandPassesCount: 12;
-        TemplateHeight: 1024; TemplateWidth: 4096;
-        canMirror: true; canFlip: false; isNegative: true; canInvert: false;
-        hasGirders: false;
-        MaxHedgehogs: 32;
-        ),
-       (BasePoints: @Template55Points;
-        BasePointsCount: Succ(High(Template55Points));
-        FillPoints: @Template55FPoints;
-        FillPointsCount: Succ(High(Template55FPoints));
         BezierizeCount: 3;
         RandPassesCount: 3;
         TemplateHeight: 2048; TemplateWidth: 4096;
@@ -2529,31 +1875,50 @@
         hasGirders: true;
         MaxHedgehogs: 48;
        ),
-       (BasePoints: @Template56Points;
-        BasePointsCount: Succ(High(Template56Points));
-        FillPoints: @Template56FPoints;
-        FillPointsCount: Succ(High(Template56FPoints));
-        BezierizeCount: 6;
-        RandPassesCount: 6;
+       (BasePoints: @Template38Points;
+        BasePointsCount: Succ(High(Template38Points));
+        FillPoints: @Template38FPoints;
+        FillPointsCount: Succ(High(Template38FPoints));
+        BezierizeCount: 4;
+        RandPassesCount: 4;
         TemplateHeight: 2048; TemplateWidth: 4096;
         canMirror: true; canFlip: false; isNegative: false; canInvert: false;
         hasGirders: true;
         MaxHedgehogs: 48;
        ),
-       (BasePoints: @Template57Points;
-        BasePointsCount: Succ(High(Template57Points));
-        FillPoints: @Template57FPoints;
-        FillPointsCount: Succ(High(Template57FPoints));
+       (BasePoints: @Template39Points;
+        BasePointsCount: Succ(High(Template39Points));
+        FillPoints: @Template39FPoints;
+        FillPointsCount: Succ(High(Template39FPoints));
         BezierizeCount: 3;
         RandPassesCount: 3;
         TemplateHeight: 512; TemplateWidth: 1536;
         canMirror: true; canFlip: false; isNegative: false; canInvert: false;
         hasGirders: false;
         MaxHedgehogs: 8;
+       ),
+       (BasePoints: @Template40Points;
+        BasePointsCount: Succ(High(Template40Points));
+        FillPoints: @Template40FPoints;
+        FillPointsCount: Succ(High(Template40FPoints));
+        BezierizeCount: 3;
+        RandPassesCount: 3;
+        TemplateHeight: 1024; TemplateWidth: 1024;
+        canMirror: true; canFlip: false; isNegative: false; canInvert: false;
+        hasGirders: false;
+        MaxHedgehogs: 8;
        )
       );
-
-
+const SmallTemplates: array[0..1] of Longword = ( 39, 40 );
+const MediumTemplates: array[0..17] of Longword =
+      ( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 );
+const LargeTemplates: array[0..19] of Longword =
+      ( 
+        18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
+        28, 29, 30, 31, 32, 33, 34, 35, 37, 38
+      );
+const CavernTemplates: array[0..0] of Longword = (36);
+const WackyTemplates: array[0..3] of Longword = (37, 38, 39, 40);
 
 implementation
 
--- a/hedgewars/uMisc.pas	Sat Feb 14 21:04:51 2009 +0000
+++ b/hedgewars/uMisc.pas	Sun Feb 15 14:38:02 2009 +0000
@@ -38,6 +38,8 @@
 	GameFlags     : Longword = 0;
 	TurnTimeLeft  : Longword = 0;
 	cSuddenDTurns : LongInt = 15;
+	cTemplateFilter : LongInt = 0;
+    
 	cHedgehogTurnTime: Longword = 45000;
 	cMaxAIThinkTime  : Longword = 9000;