Skip to content

Commit

Permalink
Merge pull request #29 from vmangos/development
Browse files Browse the repository at this point in the history
Repack 23
  • Loading branch information
ratkosrb authored Dec 31, 2023
2 parents 4d4d624 + b65896d commit e30f046
Show file tree
Hide file tree
Showing 499 changed files with 67,240 additions and 7,231 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/dev-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
unzip tbb-$TBB_VERSION-win.zip
rm tbb-$TBB_VERSION-win.zip
#openssl
choco install -y openssl --version=1.1.1.500
#choco install -y openssl --version=1.1.1.500
#git bash shell
shell: bash

Expand Down Expand Up @@ -82,9 +82,9 @@ jobs:
copy ${{github.workspace}}/tbb/bin/intel64/vc14/tbbmalloc_proxy_debug.dll ${{github.workspace}}/bin/Release/tbbmalloc_proxy_debug.dll
copy ${{github.workspace}}/ACE_wrappers/lib/ACE.dll ${{github.workspace}}/bin/Release/ACE.dll
copy c:/mysql/lib/libmysql.dll ${{github.workspace}}/bin/Release/libmysql.dll
copy "c:/Program Files/OpenSSL/bin/libssl-1_1-x64.dll" ${{github.workspace}}/bin/Release/libssl-1_1-x64.dll
copy "c:/Program Files/OpenSSL/bin/libcrypto-1_1-x64.dll" ${{github.workspace}}/bin/Release/libcrypto-1_1-x64.dll
copy ${{github.workspace}}/dep/windows/lib/x64_release/libmySQL.dll ${{github.workspace}}/bin/Release/libmySQL.dll
# copy "c:/Program Files/OpenSSL-Win64/bin/libssl-1_1-x64.dll" ${{github.workspace}}/bin/Release/libssl-1_1-x64.dll
# copy "c:/Program Files/OpenSSL-Win64/bin/libcrypto-1_1-x64.dll" ${{github.workspace}}/bin/Release/libcrypto-1_1-x64.dll
copy ${{github.workspace}}/dep/windows/lib/x64_release/libeay32.dll ${{github.workspace}}/bin/Release/libeay32.dll
7z a -tzip ${{env.ARCHIVE_FILENAME}} Release
Expand Down Expand Up @@ -125,9 +125,9 @@ jobs:
copy ${{github.workspace}}/tbb/bin/intel64/vc14/tbbmalloc_proxy_debug.dll ${{github.workspace}}/bin/Release/tbbmalloc_proxy_debug.dll
copy ${{github.workspace}}/ACE_wrappers/lib/ACE.dll ${{github.workspace}}/bin/Release/ACE.dll
copy c:/mysql/lib/libmysql.dll ${{github.workspace}}/bin/Release/libmysql.dll
copy "c:/Program Files/OpenSSL/bin/libssl-1_1-x64.dll" ${{github.workspace}}/bin/Release/libssl-1_1-x64.dll
copy "c:/Program Files/OpenSSL/bin/libcrypto-1_1-x64.dll" ${{github.workspace}}/bin/Release/libcrypto-1_1-x64.dll
copy ${{github.workspace}}/dep/windows/lib/x64_release/libmySQL.dll ${{github.workspace}}/bin/Release/libmySQL.dll
# copy "c:/Program Files/OpenSSL-Win64/bin/libssl-1_1-x64.dll" ${{github.workspace}}/bin/Release/libssl-1_1-x64.dll
# copy "c:/Program Files/OpenSSL-Win64/bin/libcrypto-1_1-x64.dll" ${{github.workspace}}/bin/Release/libcrypto-1_1-x64.dll
copy ${{github.workspace}}/dep/windows/lib/x64_release/libeay32.dll ${{github.workspace}}/bin/Release/libeay32.dll
7z a -tzip ${{env.ARCHIVE_FILENAME}} Release
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ CMakeSettings.json
/out/

# CLion files
cmake-build-debug
cmake-build-release
cmake-build-*

#
# Top-level generic files
Expand Down
26 changes: 18 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ set(CMAKE_MODULE_PATH

set(SUPPORTED_CLIENT_BUILD "CLIENT_BUILD_1_12_1" CACHE STRING "Client version the core will support")
option(USE_STD_MALLOC "Use standard malloc instead of TBB" OFF)
option(BUILD_FOR_HOST_CPU "Build specifically for the host CPU via `-march=native` (might not run on different machines)" ON)
option(TBB_DEBUG "Use TBB debug librairies" OFF)
option(USE_ANTICHEAT "Use anticheat" OFF)
option(USE_SCRIPTS "Compile scripts" ON)
Expand Down Expand Up @@ -78,7 +79,7 @@ if(WIN32)
message(FATAL_ERROR "Only Visual Studio 2015 or newer is supported")
endif()
endif()

# Added by Giperion, in WIN32 output all compiled files in one directory
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin )
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib )
Expand Down Expand Up @@ -196,13 +197,13 @@ if(NOT USE_STD_MALLOC)
${TBB_LIBRARIES}
)
endif()

if (WIN32)
list (GET TBB_LIBRARIES 1 TBB_SINGLE_FILEDIRECTORY)
get_filename_component(TBB_LIB_DIRECTORY "${TBB_SINGLE_FILEDIRECTORY}" DIRECTORY)
link_directories(${TBB_LIB_DIRECTORY})
endif()

endif()

# Win32 delifered packages
Expand Down Expand Up @@ -254,7 +255,7 @@ else()
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)

if(NOT rev_hash)
# No valid ways available to find/set the revision/hash, so let's force some defaults
message(STATUS "
Expand All @@ -263,7 +264,7 @@ else()
set(rev_date "1970-01-01 00:00:00 +0000")
set(rev_hash "unknown")
endif()

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/revision.h.cmake ${CMAKE_CURRENT_SOURCE_DIR}/src/shared/revision.h)
endif()

Expand Down Expand Up @@ -316,6 +317,12 @@ endif()
message(STATUS "Memory allocation : ${ALLOC_LIB_INFO_STRING} ${TBB_LIBRARIES}")
message(STATUS "Detected compiler : ${CMAKE_CXX_COMPILER_ID}")

if(BUILD_FOR_HOST_CPU)
message(STATUS "Build for host CPU : Yes (default)")
else()
message(STATUS "Build for host CPU : No")
endif()

message(STATUS "Build type : ${CMAKE_BUILD_TYPE}")

if(USE_ANTICHEAT)
Expand All @@ -338,7 +345,7 @@ if(UNIX)
else()
message(STATUS "Debug symbols : Disabled")
endif()

if(GCC_SANITIZE)
set(BUILD_ADDITIONAL_FLAGS "${BUILD_ADDITIONAL_FLAGS} -fno-omit-frame-pointer -fno-optimize-sibling-calls")
set(BUILD_ADDITIONAL_FLAGS "${BUILD_ADDITIONAL_FLAGS} -fsanitize=address")
Expand All @@ -353,7 +360,10 @@ if(UNIX)
#set(BUILD_ADDITIONAL_FLAGS "${BUILD_ADDITIONAL_FLAGS} -fsanitize=unsigned-integer-overflow")
endif()

set(BUILD_ADDITIONAL_FLAGS "${BUILD_ADDITIONAL_FLAGS} --no-warnings -fexceptions -fnon-call-exceptions -march=native -pipe ")
set(BUILD_ADDITIONAL_FLAGS "${BUILD_ADDITIONAL_FLAGS} --no-warnings -fexceptions -fnon-call-exceptions -pipe")
if(BUILD_FOR_HOST_CPU)
set(BUILD_ADDITIONAL_FLAGS "${BUILD_ADDITIONAL_FLAGS} -march=native")
endif()
set(CMAKE_CXX_STANDARD 14)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(PROFILE_GENERATE)
Expand Down Expand Up @@ -392,7 +402,7 @@ if(MSVC)
#if(PLATFORM MATCHES X86)
# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE")
#endif()

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")
endif()

Expand Down
3 changes: 2 additions & 1 deletion contrib/mmap/offmesh.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
30 32,33 (-759.16 -350.45 68.96) (-758.2 -348.56 67.56) 2.5 // AV
30 32,33 (-761.69 -349.45 69.0) (-761 -347.83 67.61) 2.5
30 32,33 (-765?1 -348 69) (-764.53 -346.58 67.66) 2.5
30 32,33 (-765.1 -348 69) (-764.53 -346.58 67.66) 2.5
189 29,28 (1827.839478 1315.610962 17.235508) (1830.25244 1315.189697 19.016930) 2.5
91 changes: 46 additions & 45 deletions contrib/mmap/src/MapBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

#include <list>
#include <fstream>
#include "MMapCommon.h"
#include "MapBuilder.h"
Expand Down Expand Up @@ -120,33 +119,31 @@ bool IsModelArea(int area)
}

void filterLedgeSpans(const int walkableHeight, const int walkableClimbTransition, const int walkableClimbTerrain,
rcHeightfield& solid)
rcHeightfield& heightfield)
{
const int w = solid.width;
const int h = solid.height;
const int w = heightfield.width;
const int h = heightfield.height;
const int MAX_HEIGHT = 0xffff;
std::list<rcSpan*> nullSpans;
std::list<rcSpan*> steepSlopes;

for (int y = 0; y < h; ++y)
{
for (int x = 0; x < w; ++x)
{
for (rcSpan* s = solid.spans[x + y*w]; s; s = s->next)
for (rcSpan* span = heightfield.spans[x + y*w]; span; span = span->next)
{
// Skip non walkable spans.
if (s->area == RC_NULL_AREA)
if (span->area == RC_NULL_AREA)
continue;

const int bot = (int)(s->smax);
const int top = s->next ? (int)(s->next->smin) : MAX_HEIGHT;
const int bot = (int)(span->smax);
const int top = span->next ? (int)(span->next->smin) : MAX_HEIGHT;

// Find neighbours minimum height.
int minh = MAX_HEIGHT;
int minNeighborHeight = MAX_HEIGHT;

// Min and max height of accessible neighbours.
int asmin = s->smax;
int asmax = s->smax;
int accessibleNeighborMinHeight = span->smax;
int accessibleNeighborMaxHeight = span->smax;
bool hasAllNbTerrain = true;
bool hasAllNbModel = true;

Expand All @@ -157,35 +154,36 @@ void filterLedgeSpans(const int walkableHeight, const int walkableClimbTransitio
// Skip neighbours which are out of bounds.
if (dx < 0 || dy < 0 || dx >= w || dy >= h)
{
//minh = rcMin(minh, -walkableClimbTerrain - bot);
//TODO: Figure out why this is commented out.
//minNeighborHeight = rcMin(minNeighborHeight , -walkableClimbTerrain - bot);
continue;
}

// From minus infinity to the first span.
rcSpan* ns = solid.spans[dx + dy*w];
rcSpan* neighborSpan = heightfield.spans[dx + dy*w];
int nbot = -walkableClimbTerrain;
int ntop = ns ? (int)ns->smin : MAX_HEIGHT;
int ntop = neighborSpan ? (int)neighborSpan->smin : MAX_HEIGHT;
// Skip neighbour if the gap between the spans is too small.
if (rcMin(top,ntop) - rcMax(bot,nbot) > walkableHeight)
minh = rcMin(minh, nbot - bot);
minNeighborHeight = rcMin(minNeighborHeight, nbot - bot);

// Rest of the spans.
for (ns = solid.spans[dx + dy*w]; ns; ns = ns->next)
for (neighborSpan = heightfield.spans[dx + dy*w]; neighborSpan; neighborSpan = neighborSpan->next)
{
if (ns->area == RC_NULL_AREA)
if (neighborSpan->area == RC_NULL_AREA)
continue;
nbot = (int)ns->smax;
ntop = ns->next ? (int)ns->next->smin : MAX_HEIGHT;
nbot = (int)neighborSpan->smax;
ntop = neighborSpan->next ? (int)neighborSpan->next->smin : MAX_HEIGHT;
// Skip neightbour if the gap between the spans is too small.
if (rcMin(top,ntop) - rcMax(bot,nbot) > walkableHeight)
{
minh = rcMin(minh, nbot - bot);
minNeighborHeight = rcMin(minNeighborHeight, nbot - bot);
// Find min/max accessible neighbour height.
if (rcAbs(nbot - bot) <= walkableClimbTerrain)
{
if (nbot < asmin) asmin = nbot;
if (nbot > asmax) asmax = nbot;
if (!IsModelArea(ns->area))
if (nbot < accessibleNeighborMinHeight) accessibleNeighborMinHeight = nbot;
if (nbot > accessibleNeighborMaxHeight) accessibleNeighborMaxHeight = nbot;
if (!IsModelArea(neighborSpan->area))
hasAllNbModel = false;
else
hasAllNbTerrain = false;
Expand All @@ -196,31 +194,27 @@ void filterLedgeSpans(const int walkableHeight, const int walkableClimbTransitio

// The current span is close to a ledge if the drop to any
// neighbour span is less than the walkableClimb.
bool modelToTerrainTransition = (IsModelArea(s->area) && !hasAllNbModel) || (!IsModelArea(s->area) && !hasAllNbTerrain);
bool modelToTerrainTransition = (IsModelArea(span->area) && !hasAllNbModel) || (!IsModelArea(span->area) && !hasAllNbTerrain);
int currentMaxClimb = walkableClimbTerrain;
// Model -> Terrain or Terrain -> Model
if (modelToTerrainTransition)
currentMaxClimb = walkableClimbTransition;
if (minh < -currentMaxClimb)
nullSpans.push_front(s);
if (minNeighborHeight < -currentMaxClimb)
span->area = RC_NULL_AREA;


// If the difference between all neighbours is too large,
// we are at steep slope, mark the span as it
else if ((asmax - asmin) > currentMaxClimb)
else if ((accessibleNeighborMaxHeight - accessibleNeighborMinHeight) > currentMaxClimb)
{
if (modelToTerrainTransition)
nullSpans.push_front(s);
span->area = RC_NULL_AREA;
else
steepSlopes.push_front(s);
span->area = AREA_STEEP_SLOPE;
}
}
}
}
for (std::list<rcSpan*>::iterator it = nullSpans.begin(); it != nullSpans.end(); ++it)
(*it)->area = RC_NULL_AREA;
for (std::list<rcSpan*>::iterator it = steepSlopes.begin(); it != steepSlopes.end(); ++it)
(*it)->area = AREA_STEEP_SLOPE;
}

void from_json(const json& j, rcConfig& config)
Expand Down Expand Up @@ -373,8 +367,7 @@ namespace MMAP

float bmin[3] = { 0, 0, 0 };
float bmax[3] = { 0, 0, 0 };
float lmin[3] = { 0, 0, 0 };
float lmax[3] = { 0, 0, 0 };

MeshData meshData;

// make sure we process maps which don't have tiles
Expand All @@ -389,6 +382,9 @@ namespace MMAP
// get the coord bounds of the model data
if (meshData.solidVerts.size() && meshData.liquidVerts.size())
{
float lmin[3] = { 0, 0, 0 };
float lmax[3] = { 0, 0, 0 };

rcCalcBounds(meshData.solidVerts.getCArray(), meshData.solidVerts.size() / 3, bmin, bmax);
rcCalcBounds(meshData.liquidVerts.getCArray(), meshData.liquidVerts.size() / 3, lmin, lmax);
rcVmin(bmin, lmin);
Expand All @@ -397,7 +393,7 @@ namespace MMAP
else if (meshData.solidVerts.size())
rcCalcBounds(meshData.solidVerts.getCArray(), meshData.solidVerts.size() / 3, bmin, bmax);
else
rcCalcBounds(meshData.liquidVerts.getCArray(), meshData.liquidVerts.size() / 3, lmin, lmax);
rcCalcBounds(meshData.liquidVerts.getCArray(), meshData.liquidVerts.size() / 3, bmin, bmax);

// convert coord bounds to grid bounds
maxX = 32 - bmin[0] / GRID_SIZE;
Expand Down Expand Up @@ -680,10 +676,15 @@ namespace MMAP
Tile liquidsTile;

// Calculate the per tile bounding box.
tileCfg.bmin[0] = config.bmin[0] + float(x * config.tileSize - config.borderSize) * config.cs;
tileCfg.bmin[2] = config.bmin[2] + float(y * config.tileSize - config.borderSize) * config.cs;
tileCfg.bmax[0] = config.bmin[0] + float((x + 1) * config.tileSize + config.borderSize) * config.cs;
tileCfg.bmax[2] = config.bmin[2] + float((y + 1) * config.tileSize + config.borderSize) * config.cs;
tileCfg.bmin[0] = config.bmin[0] + x * float(config.tileSize * config.cs);
tileCfg.bmin[2] = config.bmin[2] + y * float(config.tileSize * config.cs);
tileCfg.bmax[0] = config.bmin[0] + (x + 1) * float(config.tileSize * config.cs);
tileCfg.bmax[2] = config.bmin[2] + (y + 1) * float(config.tileSize * config.cs);

tileCfg.bmin[0] -= tileCfg.borderSize * tileCfg.cs;
tileCfg.bmin[2] -= tileCfg.borderSize * tileCfg.cs;
tileCfg.bmax[0] += tileCfg.borderSize * tileCfg.cs;
tileCfg.bmax[2] += tileCfg.borderSize * tileCfg.cs;

// NOSTALRIUS - MMAPS TILE GENERATION
/// 1. Alloc heightfield for walkable areas
Expand Down Expand Up @@ -711,7 +712,7 @@ namespace MMAP
// - We are on a model (WMO...)
// - Also we want to remove under-terrain triangles
unsigned char* areas = new unsigned char[tTriCount];
memset(areas, 0, tTriCount * sizeof(unsigned char));
memset(areas, AREA_NONE, tTriCount * sizeof(unsigned char));
float norm[3];
const float playerClimbLimit = cosf(52.0f/180.0f*RC_PI);
const float maxClimbLimitTerrain = cosf(75.0f/180.0f*RC_PI);
Expand Down Expand Up @@ -756,7 +757,7 @@ namespace MMAP

if (m_terrainBuilder->IsUnderMap(&verts[0]) && m_terrainBuilder->IsUnderMap(&verts[3]) && m_terrainBuilder->IsUnderMap(&verts[6]))
{
areas[i] = 0;
areas[i] = AREA_NONE;
continue;
}
}
Expand Down Expand Up @@ -1275,7 +1276,7 @@ namespace MMAP
return;
}
unsigned char* m_triareas = new unsigned char[tTriCount];
memset(m_triareas, 0, tTriCount*sizeof(unsigned char));
memset(m_triareas, AREA_NONE, tTriCount*sizeof(unsigned char));
rcMarkWalkableTriangles(m_rcContext, config.walkableSlopeAngle, tVerts, tVertCount, tTris, tTriCount, m_triareas);
rcRasterizeTriangles(m_rcContext, tVerts, tVertCount, tTris, m_triareas, tTriCount, *tile.solid, config.walkableClimb);
rcFilterLowHangingWalkableObstacles(m_rcContext, config.walkableClimb, *tile.solid);
Expand Down
7 changes: 5 additions & 2 deletions contrib/mmap/src/TerrainBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -766,9 +766,12 @@ namespace MMAP
float inDist = -1.0f;
if (it->IsUnderObject(v, up, isM2, &outDist, &inDist)) // inDist < outDist
{
//if there are less than 1.5y between terrain and model then mark the terrain as unwalkable
if (inDist < 1.5f)
// If terrain is under wmo, mark terrain as unwalkable
// If there are less than 1.5y between terrain and m2 then mark the terrain as unwalkable
if (!isM2 || inDist < 1.5f)
{
terrainInsideModelsVerts[t] = inDist;
}
}
}
}
Expand Down
10 changes: 8 additions & 2 deletions contrib/vmap_extractor/vmapextract/gameobject_extract.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,14 @@ bool ExtractSingleModel(std::string& origPath, std::string& fixedName, StringSet
}
// >= 3.1.0 ADT MMDX section store filename.m2 filenames for corresponded .m2 file
// nothing do

fixedName = GetPlainName(origPath.c_str());

// Fix a few models with spaces instead of underscores in their filenames (razorfen leanto03)
std::string s = GetPlainName(origPath.c_str());
std::transform(s.begin(), s.end(), s.begin(), [](char ch) {
return ch == ' ' ? '_' : ch;
});

fixedName = s;

std::string output(szWorkDirWmo); // Stores output filename (possible changed)
output += "/";
Expand Down
Loading

0 comments on commit e30f046

Please sign in to comment.