diff --git a/Generals/Code/Tools/WorldBuilder/include/WHeightMapEdit.h b/Generals/Code/Tools/WorldBuilder/include/WHeightMapEdit.h index e923b87c432..7f554481882 100644 --- a/Generals/Code/Tools/WorldBuilder/include/WHeightMapEdit.h +++ b/Generals/Code/Tools/WorldBuilder/include/WHeightMapEdit.h @@ -137,8 +137,8 @@ class WorldHeightMapEdit : public WorldHeightMap void showTileStatusInfo(); ///< pops up a dialog box with tile mem usage. - Bool selectDuplicates(); ///< Selects any dupicate map objects. - Bool selectSimilar(); ///< Selects any dupicate map objects. + Bool selectDuplicates(); ///< Selects any duplicate map objects. + Bool selectSimilar(); ///< Selects any duplicate map objects. Bool selectInvalidTeam(); ///< Selects any objects with invalid teams. Bool resize(Int newXSize, Int newYSize, Int newHeight, Int newBorder, Bool anchorTop, Bool anchorBottom, @@ -147,8 +147,6 @@ class WorldHeightMapEdit : public WorldHeightMap void reloadTextures(); ///< Reloads textures from disk. void resetResources(); ///< Releases textures in preparation for device reset. - Bool getRawTileData(Short tileNdx, Int width, UnsignedByte *buffer, Int bufLen); - void dbgVerifyAfterUndo(); ///< Verifies the structures are still consistent. Bool doCliffAdjustment(Int xIndex, Int yIndex); Bool removeCliffMapping(); diff --git a/Generals/Code/Tools/WorldBuilder/src/BorderTool.cpp b/Generals/Code/Tools/WorldBuilder/src/BorderTool.cpp index 73aa050139f..db1213e8e56 100644 --- a/Generals/Code/Tools/WorldBuilder/src/BorderTool.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/BorderTool.cpp @@ -124,7 +124,7 @@ void BorderTool::mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorld return; } - static Coord3D zero = {0.0f, 0.0f, 0.0f}; + //static Coord3D zero = {0.0f, 0.0f, 0.0f}; Coord3D groundPt; pView->viewToDocCoords(viewPt, &groundPt); @@ -138,10 +138,24 @@ void BorderTool::mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorld Int motion; pDoc->findBoundaryNear(&groundPt, BOUNDARY_PICK_DISTANCE, &m_modifyBorderNdx, &motion); - if (motion == 0) { + + // if bottom left boundary grabbed + if (motion == 0) + { // modifying the bottom left is not allowed. m_modifyBorderNdx = -1; - } else { + } + // else if no boundary is near + else if (motion == -1) + { + // add a boundary + m_addingNewBorder = true; + + ICoord2D initialBoundary = { 1, 1 }; + pDoc->addBoundary(&initialBoundary); + } + else + { m_modificationType = (ModificationType) motion; } } diff --git a/Generals/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp b/Generals/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp index dad0e9a3217..3951a78512a 100644 --- a/Generals/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp @@ -43,6 +43,7 @@ #include "Common/DataChunk.h" + int WorldHeightMapEdit::m_numGlobalTextureClasses=0; TGlobalTextureClass WorldHeightMapEdit::m_globalTextureClasses[NUM_TEXTURE_CLASSES]; /** Destructor -. @@ -120,7 +121,7 @@ WorldHeightMapEdit::WorldHeightMapEdit(Int width, Int height, UnsignedByte initi // Note - we have one less cell than the width & height. But for paranoia, allocate // extra row. jba. // - Int numBytesX = (m_width+1)/8; //how many bytes to fit all bitflags + Int numBytesX = (m_width+7)/8; //how many bytes to fit all bitflags Int numBytesY = m_height; m_flipStateWidth=numBytesX; @@ -209,7 +210,7 @@ m_warnTooManyBlend(false) // Note - we have one less cell than the width & height. But for paranoia, allocate // extra row. jba. // - Int numBytesX = (m_width+1)/8; //how many bytes to fit all bitflags + Int numBytesX = (m_width+7)/8; //how many bytes to fit all bitflags Int numBytesY = m_height; m_flipStateWidth=numBytesX; @@ -433,8 +434,7 @@ void WorldHeightMapEdit::loadDirectoryOfImages(const char *pFilePath) FilenameList::iterator it = filenameList.begin(); do { AsciiString filename = *it; - - snprintf(fileBuf, ARRAY_SIZE(fileBuf), "%s%s", dirBuf, filename.str()); + strlcpy(fileBuf, filename.str(), ARRAY_SIZE(fileBuf)); loadBitmap(fileBuf, filename.str()); ++it; @@ -506,39 +506,6 @@ void WorldHeightMapEdit::loadImagesFromTerrainType( TerrainType *terrain ) } - -Bool WorldHeightMapEdit::getRawTileData(Short tileNdx, Int width, - UnsignedByte *buffer, Int bufLen) -{ - TileData *pSrc = nullptr; - if (tileNdx/4 < NUM_SOURCE_TILES) { - pSrc = m_sourceTiles[tileNdx/4]; - } - if (bufLen < (width*width*TILE_BYTES_PER_PIXEL)) { - return(false); - } - if (pSrc && pSrc->hasRGBDataForWidth(2*width)) { - Int j; - UnsignedByte *pSrcData = pSrc->getRGBDataForWidth(2*width); - Int xOffset=0; - Int yOffset=0; - if (tileNdx & 1) xOffset = width; - if (tileNdx & 2) yOffset = width; - for (j=0; j