# HG changeset patch # User nemo # Date 1544673666 18000 # Node ID 96624a6cdb934fc276ff804b52303be32d4f2c4b # Parent 06672690d71b8ef831a6daf9bf7a752e2cab2c00 Allow scaling hand drawn maps diff -r 06672690d71b -r 96624a6cdb93 QTfrontend/ui/widget/mapContainer.cpp --- a/QTfrontend/ui/widget/mapContainer.cpp Mon Dec 10 22:44:46 2018 +0100 +++ b/QTfrontend/ui/widget/mapContainer.cpp Wed Dec 12 23:01:06 2018 -0500 @@ -921,6 +921,7 @@ QString randomNoMapPrev = tr("Click to randomize the theme and seed"); QString mfsComplex = QString(tr("Adjust the complexity of the generated map")); QString mfsFortsDistance = QString(tr("Adjust the distance between forts")); + QString mfsDrawnMap = QString(tr("Scale size of the drawn map")); switch (type) { case MapModel::GeneratedMap: @@ -938,6 +939,7 @@ case MapModel::HandDrawnMap: mapPreview->setWhatsThis(tr("Click to edit")); btnRandomize->setWhatsThis(randomSeed); + mapFeatureSize->setWhatsThis(mfsDrawnMap); break; case MapModel::FortsMap: mapPreview->setWhatsThis(randomNoMapPrev); @@ -990,7 +992,7 @@ mapgen = MAPGEN_DRAWN; setMapInfo(MapModel::MapInfoDrawn); btnLoadMap->show(); - mapFeatureSize->hide(); + //mapFeatureSize->hide(); btnEditMap->show(); break; case MapModel::MissionMap: @@ -1075,14 +1077,15 @@ //if (qAbs(m_prevMapFeatureSize-m_mapFeatureSize) > 4) { m_prevMapFeatureSize = m_mapFeatureSize; - updatePreview(); + if(m_mapInfo.type!= MapModel::HandDrawnMap) + updatePreview(); } } // unused because I needed the space for the slider void HWMapContainer::updateThemeButtonSize() { - if (m_mapInfo.type != MapModel::StaticMap && m_mapInfo.type != MapModel::HandDrawnMap) + if (m_mapInfo.type != MapModel::StaticMap) { btnTheme->setIconSize(QSize(30, 30)); btnTheme->setFixedHeight(30); diff -r 06672690d71b -r 96624a6cdb93 hedgewars/uLand.pas --- a/hedgewars/uLand.pas Mon Dec 10 22:44:46 2018 +0100 +++ b/hedgewars/uLand.pas Wed Dec 12 23:01:06 2018 -0500 @@ -285,13 +285,13 @@ procedure GenDrawnMap; begin - ResizeLand(4096, 2048); + ResizeLand((4096 * max(min(cFeatureSize,24),3)) div 12, (2048 * max(min(cFeatureSize,24),3)) div 12); uLandPainted.Draw; - MaxHedgehogs:= 48; + MaxHedgehogs:= 64; hasGirders:= true; - playHeight:= 2048; - playWidth:= 4096; + playHeight:= LAND_HEIGHT; + playWidth:= LAND_WIDTH; leftX:= ((LAND_WIDTH - playWidth) div 2); rightX:= (playWidth + ((LAND_WIDTH - playWidth) div 2)) - 1; topY:= LAND_HEIGHT - playHeight; @@ -886,7 +886,7 @@ mgRandom: GenTemplated(EdgeTemplates[SelectTemplate]); mgMaze: begin ResizeLand(4096,2048); GenMaze; end; mgPerlin: begin ResizeLand(4096,2048); GenPerlin; end; - mgDrawn: GenDrawnMap; + mgDrawn: begin cFeatureSize:= 12;GenDrawnMap; end; mgForts: MakeFortsPreview(); else OutError('Unknown mapgen', true); @@ -937,7 +937,7 @@ mgRandom: GenTemplated(EdgeTemplates[SelectTemplate]); mgMaze: begin ResizeLand(4096,2048); GenMaze; end; mgPerlin: begin ResizeLand(4096,2048); GenPerlin; end; - mgDrawn: GenDrawnMap; + mgDrawn: begin cFeatureSize:= 12;GenDrawnMap; end; mgForts: MakeFortsPreview; else OutError('Unknown mapgen', true); diff -r 06672690d71b -r 96624a6cdb93 hedgewars/uLandPainted.pas --- a/hedgewars/uLandPainted.pas Mon Dec 10 22:44:46 2018 +0100 +++ b/hedgewars/uLandPainted.pas Wed Dec 12 23:01:06 2018 -0500 @@ -58,6 +58,7 @@ rec:= prec^; rec.X:= SDLNet_Read16(@rec.X); rec.Y:= SDLNet_Read16(@rec.Y); + if rec.X < -318 then rec.X:= -318; if rec.X > 4096+318 then rec.X:= 4096+318; if rec.Y < -318 then rec.Y:= -318; @@ -81,7 +82,7 @@ var pe: PPointEntry; prevPoint: PointRec; radius: LongInt; - color: Longword; + color, Xoffset, Yoffset: Longword; lineNumber, linePoints: Longword; begin // shutup compiler @@ -89,6 +90,8 @@ prevPoint.Y:= 0; radius:= 0; linePoints:= 0; + Xoffset:= (LAND_WIDTH-(4096*max(min(cFeatureSize,24),3) div 12)) div 2; + Yoffset:= (LAND_HEIGHT-(2048*max(min(cFeatureSize,24),3) div 12)); pe:= pointsListHead; while (pe <> nil) and (pe^.point.flags and $80 = 0) do @@ -101,6 +104,8 @@ while(pe <> nil) do begin + pe^.point.X:= (LongInt(pe^.point.X) * max(min(cFeatureSize,24),3)) div 12 + Xoffset; + pe^.point.Y:= (LongInt(pe^.point.Y) * max(min(cFeatureSize,24),3)) div 12 + Yoffset; if (pe^.point.flags and $80 <> 0) then begin if (lineNumber > 0) and (linePoints = 0) and cAdvancedMapGenMode then @@ -113,9 +118,10 @@ else color:= lfBasic; radius:= (pe^.point.flags and $3F) * 5 + 3; + radius:= (radius * max(min(cFeatureSize,24),3)) div 12; linePoints:= FillRoundInLand(pe^.point.X, pe^.point.Y, radius, color); end - else + else begin inc(linePoints, DrawThickLine(prevPoint.X, prevPoint.Y, pe^.point.X, pe^.point.Y, radius, color)); end; diff -r 06672690d71b -r 96624a6cdb93 hedgewars/uVariables.pas --- a/hedgewars/uVariables.pas Mon Dec 10 22:44:46 2018 +0100 +++ b/hedgewars/uVariables.pas Wed Dec 12 23:01:06 2018 -0500 @@ -2808,7 +2808,7 @@ cGetAwayTime := 100; cMineDudPercent := 0; cTemplateFilter := 0; - cFeatureSize := 50; + cFeatureSize := 12; cMapGen := mgRandom; cHedgehogTurnTime := 45000; cMinesTime := 3000;