Fiddling with slider, unbreak maze. Next to mess around w/ perlin params.
authornemo
Sun, 09 Nov 2014 14:58:43 -0500
changeset 10477 b219c5a2317f
parent 10476 e40021c61cfe
child 10478 12662c21e0e9
Fiddling with slider, unbreak maze. Next to mess around w/ perlin params.
QTfrontend/ui/widget/mapContainer.cpp
hedgewars/uLandGenMaze.pas
hedgewars/uLandGenTemplateBased.pas
--- a/QTfrontend/ui/widget/mapContainer.cpp	Sun Nov 09 14:33:31 2014 -0500
+++ b/QTfrontend/ui/widget/mapContainer.cpp	Sun Nov 09 14:58:43 2014 -0500
@@ -61,8 +61,8 @@
     m_missionsViewSetup = false;
     m_staticViewSetup = false;
     m_script = QString();
-    m_prevMapFeatureSize = 50;
-    m_mapFeatureSize = 50;
+    m_prevMapFeatureSize = 12;
+    m_mapFeatureSize = 12;
 
     hhSmall.load(":/res/hh_small.png");
     hhLimit = 18;
@@ -226,7 +226,7 @@
     mapFeatureSize = new QSlider(Qt::Horizontal, this);
     mapFeatureSize->setObjectName("mapFeatureSize");
     //mapFeatureSize->setTickPosition(QSlider::TicksBelow);
-    mapFeatureSize->setMaximum(100);
+    mapFeatureSize->setMaximum(25);
     mapFeatureSize->setMinimum(1);
     //mapFeatureSize->setFixedWidth(259);
     mapFeatureSize->setValue(m_mapFeatureSize);
@@ -325,7 +325,7 @@
                    getMazeSize(),
                    getDrawnMapData(),
                    m_script,
-		   m_mapFeatureSize
+		           m_mapFeatureSize
                   );
 
     setHHLimit(0);
@@ -802,7 +802,7 @@
     }
 
     // Update theme button size
-    // updateThemeButtonSize();
+    updateThemeButtonSize();
 
     // Update cType combobox
     for (int i = 0; i < cType->count(); i++)
@@ -821,19 +821,20 @@
 
 void HWMapContainer::mapFeatureSizeChanged(int val)
 {
+    m_mapFeatureSize = val;
     // needs to be per map type, scales will be different
-    m_mapFeatureSize = val;
-    if (qAbs(m_prevMapFeatureSize-m_mapFeatureSize) > 8)
+    //m_mapFeatureSize = val>>2<<2;
+    //if (qAbs(m_prevMapFeatureSize-m_mapFeatureSize) > 4)
     {
-	m_prevMapFeatureSize = m_mapFeatureSize;
-	updatePreview();
+        m_prevMapFeatureSize = m_mapFeatureSize;
+        updatePreview();
     }
 }
 
 // unused because I needed the space for the slider
 void HWMapContainer::updateThemeButtonSize()
 {
-    if (m_mapInfo.type == MapModel::MissionMap)
+    if (m_mapInfo.type != MapModel::StaticMap)
     {
         btnTheme->setIconSize(QSize(30, 30));
         btnTheme->setFixedHeight(30);
@@ -869,7 +870,7 @@
     //btnTheme->setIconSize(iconSize);
     btnTheme->setIcon(icon);
     btnTheme->setText(tr("Theme: %1").arg(current.data(Qt::DisplayRole).toString()));
-    // updateThemeButtonSize();
+    updateThemeButtonSize();
 }
 
 void HWMapContainer::staticMapChanged(const QModelIndex & map, const QModelIndex & old)
--- a/hedgewars/uLandGenMaze.pas	Sun Nov 09 14:33:31 2014 -0500
+++ b/hedgewars/uLandGenMaze.pas	Sun Nov 09 14:58:43 2014 -0500
@@ -8,7 +8,7 @@
 
 implementation
 
-uses uRandom, uLandOutline, uLandTemplates, uVariables, uFloat, uConsts, uLandGenTemplateBased;
+uses uRandom, uLandOutline, uLandTemplates, uVariables, uFloat, uConsts, uLandGenTemplateBased, uUtils;
 
 type direction = record x, y: LongInt; end;
 const DIR_N: direction = (x: 0; y: -1);
@@ -317,25 +317,31 @@
     0: begin
         cellsize := small_cell_size;
         maze_inverted := false;
+        minDistance:= max(cFeatureSize*8,32);
     end;
     1: begin
         cellsize := medium_cell_size;
+        minDistance:= max(cFeatureSize*6,20);
         maze_inverted := false;
     end;
     2: begin
         cellsize := large_cell_size;
+        minDistance:= max(cFeatureSize*5,12);
         maze_inverted := false;
     end;
     3: begin
         cellsize := small_cell_size;
+        minDistance:= max(cFeatureSize*8,32);
         maze_inverted := true;
     end;
     4: begin
         cellsize := medium_cell_size;
+        minDistance:= max(cFeatureSize*6,20);
         maze_inverted := true;
     end;
     5: begin
         cellsize := large_cell_size;
+        minDistance:= max(cFeatureSize*5,12);
         maze_inverted := true;
     end;
 end;
--- a/hedgewars/uLandGenTemplateBased.pas	Sun Nov 09 14:33:31 2014 -0500
+++ b/hedgewars/uLandGenTemplateBased.pas	Sun Nov 09 14:58:43 2014 -0500
@@ -6,10 +6,11 @@
 procedure GenTemplated(var Template: TEdgeTemplate);
 procedure DivideEdges(fillPointsCount: LongWord; var pa: TPixAr);
 
+var minDistance: LongInt; // different details size
+
 implementation
 uses uVariables, uConsts, uFloat, uLandUtils, uRandom, SDLh, math;
 
-var minDistance: LongInt; // different details size
 
 procedure SetPoints(var Template: TEdgeTemplate; var pa: TPixAr; fps: PPointArray);
 var i: LongInt;
@@ -337,7 +338,7 @@
         for x:= 0 to LAND_WIDTH - 1 do
             Land[y, x]:= lfBasic;
     
-    minDistance:= max(cFeatureSize,12);
+    minDistance:= max(cFeatureSize*5,12);
     MaxHedgehogs:= Template.MaxHedgehogs;
     hasGirders:= Template.hasGirders;
     playHeight:= Template.TemplateHeight;