merge...
authornemo
Sun, 09 Nov 2014 14:33:31 -0500
changeset 10476 e40021c61cfe
parent 10475 575937948928 (current diff)
parent 10472 8d04cebedb16 (diff)
child 10477 b219c5a2317f
merge...
--- a/QTfrontend/net/hwmap.cpp	Sat Nov 08 15:20:54 2014 +0100
+++ b/QTfrontend/net/hwmap.cpp	Sun Nov 09 14:33:31 2014 -0500
@@ -30,6 +30,7 @@
     templateFilter = 0;
     m_mapgen = MAPGEN_REGULAR;
     m_maze_size = 0;
+    m_feature_size = 50;
 }
 
 HWMap::~HWMap()
@@ -41,13 +42,14 @@
     return !m_hasStarted;
 }
 
-void HWMap::getImage(const QString & seed, int filter, MapGenerator mapgen, int maze_size, const QByteArray & drawMapData, QString & script)
+void HWMap::getImage(const QString & seed, int filter, MapGenerator mapgen, int maze_size, const QByteArray & drawMapData, QString & script, int feature_size)
 {
     m_seed = seed;
     m_script = script;
     templateFilter = filter;
     m_mapgen = mapgen;
-    m_maze_size = maze_size;
+    m_maze_size = maze_size; // TODO replace with feature_size
+    m_feature_size = feature_size;
     if(mapgen == MAPGEN_DRAWN) m_drawMapData = drawMapData;
     Start(true);
 }
@@ -119,6 +121,7 @@
     SendIPC(QString("eseed %1").arg(m_seed).toUtf8());
     SendIPC(QString("e$template_filter %1").arg(templateFilter).toUtf8());
     SendIPC(QString("e$mapgen %1").arg(m_mapgen).toUtf8());
+    SendIPC(QString("e$feature_size %1").arg(m_feature_size).toUtf8());
     if (!m_script.isEmpty())
     {
         SendIPC(QString("escript Scripts/Multiplayer/%1.lua").arg(m_script).toUtf8());
--- a/QTfrontend/net/hwmap.h	Sat Nov 08 15:20:54 2014 +0100
+++ b/QTfrontend/net/hwmap.h	Sun Nov 09 14:33:31 2014 -0500
@@ -42,7 +42,7 @@
     public:
         HWMap(QObject *parent = 0);
         virtual ~HWMap();
-        void getImage(const QString & seed, int templateFilter, MapGenerator mapgen, int maze_size, const QByteArray & drawMapData, QString & script);
+        void getImage(const QString & seed, int templateFilter, MapGenerator mapgen, int maze_size, const QByteArray & drawMapData, QString & script, int feature_size);
         bool couldBeRemoved();
 
     protected:
@@ -59,7 +59,8 @@
         QString m_script;
         int templateFilter;
         MapGenerator m_mapgen;
-        int m_maze_size;
+        int m_maze_size;  // going to try and deprecate this one
+        int m_feature_size;
         QByteArray m_drawMapData;
 
     private slots:
--- a/QTfrontend/res/css/qt.css	Sat Nov 08 15:20:54 2014 +0100
+++ b/QTfrontend/res/css/qt.css	Sun Nov 09 14:33:31 2014 -0500
@@ -275,21 +275,27 @@
 height: 6px;
 border-radius: 3px;
 }
+/*
 #mapFeatureSize {
 margin-left: 3px;
 }
+*/
 
 #mapFeatureSize::groove::horizontal {
 /* background-color: #141250; 
 background-color: rgba(20, 18, 80, 50%);
 */
+/*
 background-color: rgba(0, 0, 0, 60%);
 }
 #mapFeatureSize::handle {
+*/
 /* background-color: #141250; */
+/*
 background-color: rgba(0, 0, 0, 60%);
 border-radius: 5px;
 }
+*/
 
 HatButton, ThemeButton {
 text-align: left;
--- a/QTfrontend/ui/widget/gamecfgwidget.cpp	Sat Nov 08 15:20:54 2014 +0100
+++ b/QTfrontend/ui/widget/gamecfgwidget.cpp	Sun Nov 09 14:33:31 2014 -0500
@@ -323,6 +323,7 @@
     bcfg << QString("e$getawaytime %1").arg(schemeData(40).toInt()).toUtf8();
     bcfg << QString("e$worldedge %1").arg(schemeData(41).toInt()).toUtf8();
     bcfg << QString("e$template_filter %1").arg(pMapContainer->getTemplateFilter()).toUtf8();
+    bcfg << QString("e$feature_size %1").arg(pMapContainer->getFeatureSize()).toUtf8();
     bcfg << QString("e$mapgen %1").arg(mapgen).toUtf8();
     if(!schemeData(42).isNull())
         bcfg << QString("e$scriptparam %1").arg(schemeData(42).toString()).toUtf8();
--- a/QTfrontend/ui/widget/mapContainer.cpp	Sat Nov 08 15:20:54 2014 +0100
+++ b/QTfrontend/ui/widget/mapContainer.cpp	Sun Nov 09 14:33:31 2014 -0500
@@ -61,6 +61,8 @@
     m_missionsViewSetup = false;
     m_staticViewSetup = false;
     m_script = QString();
+    m_prevMapFeatureSize = 50;
+    m_mapFeatureSize = 50;
 
     hhSmall.load(":/res/hh_small.png");
     hhLimit = 18;
@@ -153,15 +155,6 @@
     leftLayout->addWidget(mapPreview, 0);
     connect(mapPreview, SIGNAL(clicked()), this, SLOT(previewClicked()));
 
-    mapFeatureSize = new QSlider(Qt::Horizontal, this);
-    mapFeatureSize->setObjectName("mapFeatureSize");
-    //mapFeatureSize->setTickPosition(QSlider::TicksBelow);
-    mapFeatureSize->setMaximum(100);
-    mapFeatureSize->setMinimum(1);
-    mapFeatureSize->setFixedWidth(259);
-    mapFeatureSize->setValue(50);
-    leftLayout->addWidget(mapFeatureSize, 0);
-
     /* Bottom-Left layout */
 
     QVBoxLayout * bottomLeftLayout = new QVBoxLayout();
@@ -230,6 +223,17 @@
     m_childWidgets << mazeStyles;
     rightLayout->addWidget(mazeStyles, 1);
 
+    mapFeatureSize = new QSlider(Qt::Horizontal, this);
+    mapFeatureSize->setObjectName("mapFeatureSize");
+    //mapFeatureSize->setTickPosition(QSlider::TicksBelow);
+    mapFeatureSize->setMaximum(100);
+    mapFeatureSize->setMinimum(1);
+    //mapFeatureSize->setFixedWidth(259);
+    mapFeatureSize->setValue(m_mapFeatureSize);
+    mapFeatureSize->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+    bottomLeftLayout->addWidget(mapFeatureSize, 0);
+    connect(mapFeatureSize, SIGNAL(valueChanged(int)), this, SLOT(mapFeatureSizeChanged(int)));
+
     /* Mission description */
 
     lblDesc = new QLabel();
@@ -247,6 +251,8 @@
 
     btnTheme = new QPushButton(this);
     btnTheme->setFlat(true);
+    btnTheme->setIconSize(QSize(30, 30));
+    btnTheme->setFixedHeight(30);
     connect(btnTheme, SIGNAL(clicked()), this, SLOT(showThemePrompt()));
     m_childWidgets << btnTheme;
     bottomLeftLayout->addWidget(btnTheme, 0);
@@ -318,7 +324,8 @@
                    get_mapgen(),
                    getMazeSize(),
                    getDrawnMapData(),
-                   m_script
+                   m_script,
+		   m_mapFeatureSize
                   );
 
     setHHLimit(0);
@@ -399,6 +406,11 @@
     return generationStyles->currentRow();
 }
 
+quint32 HWMapContainer::getFeatureSize() const
+{
+    return m_mapFeatureSize;
+}
+
 void HWMapContainer::resizeEvent ( QResizeEvent * event )
 {
     Q_UNUSED(event);
@@ -733,6 +745,7 @@
     lblDesc->hide();
     btnLoadMap->hide();
     btnEditMap->hide();
+    mapFeatureSize->show();
 
     switch (type)
     {
@@ -770,6 +783,7 @@
             lblMapList->setText(tr("Mission:"));
             lblMapList->show();
             missionMapList->show();
+	    mapFeatureSize->hide();
             lblDesc->setText(m_mapInfo.desc);
             lblDesc->show();
             emit mapChanged(m_curMap);
@@ -788,7 +802,7 @@
     }
 
     // Update theme button size
-    updateThemeButtonSize();
+    // updateThemeButtonSize();
 
     // Update cType combobox
     for (int i = 0; i < cType->count(); i++)
@@ -805,6 +819,18 @@
     emit mapgenChanged(mapgen);
 }
 
+void HWMapContainer::mapFeatureSizeChanged(int val)
+{
+    // needs to be per map type, scales will be different
+    m_mapFeatureSize = val;
+    if (qAbs(m_prevMapFeatureSize-m_mapFeatureSize) > 8)
+    {
+	m_prevMapFeatureSize = m_mapFeatureSize;
+	updatePreview();
+    }
+}
+
+// unused because I needed the space for the slider
 void HWMapContainer::updateThemeButtonSize()
 {
     if (m_mapInfo.type == MapModel::MissionMap)
@@ -838,12 +864,12 @@
     m_theme = selectedTheme = current.data(ThemeModel::ActualNameRole).toString();
     m_themeID = current.row();
     QIcon icon = qVariantValue<QIcon>(current.data(Qt::DecorationRole));
-    QSize iconSize = icon.actualSize(QSize(65535, 65535));
-    btnTheme->setFixedHeight(64);
-    btnTheme->setIconSize(iconSize);
+    //QSize iconSize = icon.actualSize(QSize(65535, 65535));
+    //btnTheme->setFixedHeight(64);
+    //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/QTfrontend/ui/widget/mapContainer.h	Sat Nov 08 15:20:54 2014 +0100
+++ b/QTfrontend/ui/widget/mapContainer.h	Sun Nov 09 14:33:31 2014 -0500
@@ -60,6 +60,7 @@
         QString getCurrentScheme() const;
         QString getCurrentWeapons() const;
         quint32 getTemplateFilter() const;
+        quint32 getFeatureSize() const;
         MapGenerator get_mapgen(void) const;
         int getMazeSize(void) const;
         bool getCurrentIsMission() const;
@@ -103,6 +104,7 @@
         void addInfoToPreview(const QPixmap & image);
         void setNewSeed(const QString & newSeed);
         void mapTypeChanged(int);
+        void mapFeatureSizeChanged(int);
         void showThemePrompt();
         void updateTheme(const QModelIndex & current);
         void staticMapChanged(const QModelIndex & map, const QModelIndex & old = QModelIndex());
@@ -174,6 +176,8 @@
 
         MapModel::MapInfo m_mapInfo;
         int m_themeID;
+        int m_prevMapFeatureSize;
+        int m_mapFeatureSize;
         QString m_theme;
         QString m_curMap;
 
--- a/hedgewars/uCommandHandlers.pas	Sat Nov 08 15:20:54 2014 +0100
+++ b/hedgewars/uCommandHandlers.pas	Sun Nov 09 14:33:31 2014 -0500
@@ -674,6 +674,11 @@
 cTemplateFilter:= StrToInt(s)
 end;
 
+procedure chFeatureSize(var s: shortstring);
+begin
+cFeatureSize:= StrToInt(s)
+end;
+
 procedure chInactDelay(var s: shortstring);
 begin
 cInactDelay:= StrToInt(s)
@@ -814,6 +819,7 @@
     RegisterVariable('template_filter', @chTemplateFilter, false);
     RegisterVariable('mapgen'  , @chMapGen        , false);
     RegisterVariable('maze_size',@chTemplateFilter, false);
+    RegisterVariable('feature_size',@chFeatureSize, false);
     RegisterVariable('delay'   , @chInactDelay    , false);
     RegisterVariable('ready'   , @chReadyDelay    , false);
     RegisterVariable('casefreq', @chCaseFactor    , false);
--- a/hedgewars/uLandGenTemplateBased.pas	Sat Nov 08 15:20:54 2014 +0100
+++ b/hedgewars/uLandGenTemplateBased.pas	Sun Nov 09 14:33:31 2014 -0500
@@ -9,6 +9,7 @@
 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;
@@ -97,7 +98,6 @@
 
 procedure FindPoint(si: LongInt; fillPointsCount: LongWord; var newPoint: TPoint; var pa: TPixAr);
 const mapBorderMargin = 40;
-    minDistance = 32; // adjust/parametrize this for different details size
 var p1, p2, p4, fp, mp: TPoint;
     i, t1, t2, iy, ix, aqpb: LongInt;
     a, b, p, q: LongInt;
@@ -336,7 +336,8 @@
     for y:= 0 to LAND_HEIGHT - 1 do
         for x:= 0 to LAND_WIDTH - 1 do
             Land[y, x]:= lfBasic;
-            
+    
+    minDistance:= max(cFeatureSize,12);
     MaxHedgehogs:= Template.MaxHedgehogs;
     hasGirders:= Template.hasGirders;
     playHeight:= Template.TemplateHeight;
--- a/hedgewars/uVariables.pas	Sat Nov 08 15:20:54 2014 +0100
+++ b/hedgewars/uVariables.pas	Sun Nov 09 14:33:31 2014 -0500
@@ -97,6 +97,7 @@
     cDamagePercent  : LongInt;
     cMineDudPercent : LongWord;
     cTemplateFilter : LongInt;
+    cFeatureSize    : LongInt;
     cMapGen         : LongInt;
     cRopePercent    : LongWord;
     cGetAwayTime    : LongWord;
@@ -2559,6 +2560,7 @@
     cGetAwayTime        := 100;
     cMineDudPercent     := 0;
     cTemplateFilter     := 0;
+    cFeatureSize        := 50;
     cMapGen             := 0;   // MAPGEN_REGULAR
     cHedgehogTurnTime   := 45000;
     cMinesTime          := 3000;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/hedgewars/Data/Maps/ClimbHome/desc.txt	Sun Nov 09 14:33:31 2014 -0500
@@ -0,0 +1,1 @@
+en_US=You are far from home and the water is rising.  Climb as fast as you can.