Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Immersive.SharedQuestMoneyPercent (All your alts get a percent of max… #82

Open
wants to merge 187 commits into
base: ike3-bots
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
187 commits
Select commit Hold shift + click to select a range
22aa8e0
Ike3 playerbots module
celguar Jan 21, 2022
9454336
Additional ike3 bots mods
celguar May 22, 2021
2ce7df9
LFG Patch (from vmangos) + bots mod + talents check
celguar Mar 25, 2021
95e9e78
BG fixes
celguar Jun 22, 2021
d0cf7a6
Crashfixes
celguar Oct 18, 2021
4d7c1b0
Custom stuff
celguar Feb 1, 2022
ad34a4d
WIP anti crash & instances speed up
celguar May 10, 2022
9f83ced
Only show ful lwho list with gm on
celguar Jun 8, 2022
4c3464e
Update ChatHandler.cpp
celguar Jun 8, 2022
5649f1f
Fix who list
celguar Jul 10, 2022
2a5ef6b
Save zones with real players
celguar Jul 10, 2022
4d27436
Fix bots wallclimb
celguar Jul 27, 2022
584549c
Transmog Mod (Thx Ace)
celguar Jul 28, 2022
1c0d9df
City Protector rank port from vmangos
celguar Aug 11, 2022
66711c7
Add flying from vmangos
celguar Aug 15, 2022
800c7f7
Restore Collectors Edition
celguar Aug 15, 2022
ef210fc
anti crash tweak
celguar Aug 15, 2022
2a186c3
Less strict performance check
celguar Aug 16, 2022
2f65ba6
Fix solocraft
celguar Sep 3, 2022
66da345
Fix bots mods
celguar Sep 3, 2022
12d2c2e
Learn all my level command
celguar Sep 3, 2022
c553af8
Fix learn spells command
celguar Sep 5, 2022
d501f1c
Hackfix: cut long addon messages from new client
celguar Nov 2, 2022
f927918
Add dynamic object searcher
celguar Nov 2, 2022
59a3efa
Fix bots mods
celguar Nov 2, 2022
87bd2f4
Do not disband group on logout if bots enabled
celguar Nov 2, 2022
4f30cbe
Do not logout bots on shutdown
celguar Nov 2, 2022
afeff68
Update bots mod
celguar Nov 2, 2022
7dd5c10
Less often far distance update
celguar Nov 2, 2022
6ec651f
Update zones check
celguar Nov 2, 2022
de2a2d3
-Crash fix: Stops bots from logging in multiple times.
mostlikely4r Sep 29, 2022
c7c4ac1
-Changed diff calculations: Avg diff is now a 60 second rolling avera…
mostlikely4r Nov 8, 2022
c496a9e
Change maxDiff skips to AvgDiff
mostlikely4r Nov 8, 2022
38316dc
-fix missing lines
mostlikely4r Nov 8, 2022
3d788dd
Pass language to HandleCommand for adding filtering
mostlikely4r Nov 8, 2022
da1a8e6
Lower the amount of packets/work being done for bots
celguar Nov 25, 2022
57d2bba
Add missing sql mods
celguar Dec 4, 2022
c048db6
Anti crash disabled by default
celguar Dec 5, 2022
6c8c0f3
Tweak far object visibility check
celguar Dec 5, 2022
3bd340e
Fix learn my level command
celguar Dec 5, 2022
896f2d1
kick and save on shutdown
celguar Dec 5, 2022
fd04cd2
Player bots should not cut the path with the offset/distance requested
celguar Jan 24, 2023
1542217
Fix issue with mage blizzard using invalid spell id
celguar Jan 24, 2023
c1c17a7
remove achievements files
celguar Jan 25, 2023
a36cd60
-Visibiltiy fix: Fix bots getting default visbility
celguar Jan 29, 2023
86a35d9
-Internal: Fixes for Linux compilation.
mostlikely4r Dec 31, 2022
b724a5c
-Linux fixes
mostlikely4r Jan 2, 2023
b17782a
-Revert unneeded includes
mostlikely4r Jan 2, 2023
b7a7b8e
-Compilation warning fix.
mostlikely4r Jan 2, 2023
6ead892
Internal: Linux compile fix.
mostlikely4r Feb 1, 2023
0d3a999
-Internal: Linux compile fix.
mostlikely4r Feb 1, 2023
6af610d
-Add say/yell commands
mostlikely4r Feb 14, 2023
a14315a
-Hiding of whispers support
mostlikely4r Feb 14, 2023
b164dbe
-Add guild commands
mostlikely4r Feb 14, 2023
e105a16
-Remove addon filtering (now in bot code)
mostlikely4r Feb 14, 2023
39b0199
Create hardcore module
davidonete Feb 17, 2023
79da15a
Enhance the system to keep gear enchants and durability, and there is…
davidonete Feb 19, 2023
3a77b08
Fixed level down not applying and items not saving after reload
davidonete Feb 19, 2023
adb38ee
Don't spawn loot in battlegrounds
davidonete Feb 19, 2023
264224b
Don't drop quest items or hearthstone
davidonete Feb 19, 2023
4f3825e
Update HardcoreMgr.cpp
celguar Feb 21, 2023
f5870b4
Fix bots not allowed to revive when hardcore is enabled
davidonete Feb 21, 2023
0b75656
Allow the player to specify how many loot to spawn in the world befor…
davidonete Feb 21, 2023
5be5c7a
Allow bots to drop money, items or gear
davidonete Feb 21, 2023
3d283f8
Add failsafe for null m_session
davidonete Feb 21, 2023
e5746ec
Fix hardcore module crash when bot gets killed by a creature
davidonete Feb 23, 2023
8eb6bef
Fix fix of SoR
celguar Feb 25, 2023
acb1b57
fix aq event update
celguar Feb 25, 2023
709ecd8
Fix LFG stuff build
celguar Feb 25, 2023
3e5dcff
fix hardcoremgr
celguar Feb 25, 2023
71577e8
Threat API
celguar Mar 3, 2023
f38ebdc
Fix recastDemo tool
celguar Mar 12, 2023
faa7c2b
-Fixed COMBAT_MISC_INFO id.
mostlikely4r Mar 17, 2023
c9540b7
-Added support for name/level threat api
mostlikely4r Mar 17, 2023
fe30e06
-Visibility fix: Bots now properly send visibility packets to players…
mostlikely4r Mar 17, 2023
79d6f1f
add chat command to start recast app
celguar Mar 19, 2023
a136158
Allow move path to specify if the path is cyclical or not
davidonete Mar 22, 2023
e7ddc12
Add bot spell immune config params
davidonete Mar 22, 2023
5340fcd
-Follow fix: Bots no longer match speed while following without boost.
mostlikely4r Mar 22, 2023
3151b83
disable sending threat to hermes proxy
celguar Mar 23, 2023
34ff198
Fix compilation
davidonete Mar 23, 2023
96d7ea4
Fix immune bot spell config
davidonete Mar 23, 2023
f7ec404
Added achievements
davidonete Mar 29, 2023
3ce4c86
Fix saving bots on shutdown
celguar Mar 30, 2023
cc447dc
Fix for hardcore loot
davidonete Mar 30, 2023
3746e12
enable achievement for bots
celguar Mar 31, 2023
c83d7a8
Add sql for achievements
celguar Mar 31, 2023
4c397d2
Add add and remove achievement commands
davidonete Mar 30, 2023
14a0fe8
Fixed some achievements for classic version, added hardcore achieveme…
davidonete Mar 31, 2023
f7e45a5
Fix books not opening the page windos
davidonete Apr 1, 2023
2eb8c8f
Fix BG flag icons
celguar Apr 3, 2023
2499ea8
Achievements: WSG stuff
celguar Apr 3, 2023
ec34192
Achievements: fix HK count
celguar Apr 3, 2023
f762ce8
Achievements: fix spell code
celguar Apr 3, 2023
232f66b
Updated achievements
davidonete Apr 3, 2023
35b8349
Fix double loot issue
davidonete Apr 4, 2023
8740597
Updated superior and epic achievement versions and fixed loremaster i…
davidonete Apr 4, 2023
5458dd1
Fix achievement death count
davidonete Apr 5, 2023
1227ec3
Fix hardcore module active on battlegrounds and add ignore drop loot
davidonete Apr 12, 2023
70f16be
Fix hardcore mgr crash
davidonete Apr 13, 2023
419df4d
Added missing check
davidonete Apr 13, 2023
b759cb5
add not obtainable flag to item proto
celguar Apr 23, 2023
b1c4e9f
fix achievement crash
celguar Apr 23, 2023
d1facfe
Add dual spec and target dummy
celguar Apr 25, 2023
7c0a0d9
Fix error message when join BG as group
celguar Apr 25, 2023
7ec87dd
Add achievements config
celguar Apr 25, 2023
f183d2f
Fix typo (bots mod)
celguar May 4, 2023
12e6d89
Fix linux compile error
davidonete May 11, 2023
65516dc
Fix linux compile error
davidonete May 11, 2023
fa0cd3b
fix
davidonete May 11, 2023
2cc0edf
Include achievements to character pdump
davidonete May 15, 2023
aa8c705
Disable hardcore mode on max level and only drop loot if killed in fa…
davidonete May 17, 2023
7be9806
Fix linux warning
davidonete May 20, 2023
1156b33
Fix indoor check if slightly undermap
celguar May 20, 2023
6926d19
Fix hardcore module not disabled on bgs and failing on initialize som…
davidonete May 30, 2023
8e9c57a
Fix generating grave messages out of bounds
davidonete May 31, 2023
fff1092
Fix null killer for hardcore manager
davidonete Jun 1, 2023
31a40d0
Add login optimization for slow speed drives
davidonete Jun 5, 2023
898c079
-Fix minor memory leaks in Achievement system.
mostlikely4r Jun 7, 2023
bd988db
-Various memory leak fixes.
mostlikely4r Jun 7, 2023
6c4a088
-Pathfinder memory leak fix
mostlikely4r Jun 7, 2023
76aad0e
-Honor memory leak
mostlikely4r Jun 7, 2023
0d63497
-Mapworker memoryleak
mostlikely4r Jun 7, 2023
4aa4523
Prevent unneeded db updates of item_instance on player login.
mostlikely4r Jun 7, 2023
a3558b0
Fix collectors edition item spam for dwarves
celguar Jun 7, 2023
05aa85c
Movemap gen update
celguar Jun 7, 2023
481fa75
disable shortcuts for players if target is higher
celguar May 10, 2023
817e4c9
port gm spells script from vmangos
celguar Jun 7, 2023
ec6f1f4
fix merge
celguar Jun 8, 2023
448cf2f
Fix custom sql to work with latest core db changes
davidonete Jun 9, 2023
a0a6c69
Add option to sync all account character's achievements
davidonete Jul 16, 2023
3dabd2a
Revert "Add login optimization for slow speed drives"
celguar Jul 24, 2023
5560855
add collector's edition minipet auras
celguar Jul 24, 2023
343e0c3
Integrate immersive system
davidonete Sep 1, 2023
d25aae4
Minor fix
davidonete Sep 1, 2023
6f40b16
Fix error
davidonete Sep 2, 2023
eee89b7
Add attribute points override option and fix some minor issues
davidonete Sep 2, 2023
7e620b3
More improvements for Immersive system
davidonete Sep 3, 2023
5b3c4f9
Add locale support to immersive system
davidonete Sep 4, 2023
5285498
Don't lose stats on bg or arena
davidonete Sep 4, 2023
8bdc496
Fix linux compile error and text formatting
davidonete Sep 5, 2023
d272070
Hardcore manager fix: Don't level down if unfair kill, also fix pet d…
davidonete Sep 25, 2023
ecaf18f
Hardcore crash fix
davidonete Sep 30, 2023
2f8d521
Add hardcore check
davidonete Sep 30, 2023
f84b3d3
Update halloween achievements for vanilla
davidonete Oct 26, 2023
1c28f50
Fix for vanilla halloween achievements
davidonete Oct 29, 2023
44cfa59
Missing call to sImmersive.OnModifyMoney fixed (preventing alts to ga…
Nov 7, 2023
c05bb9f
Don't apply extra fall damage on battlegrounds
davidonete Nov 7, 2023
ee2f3a6
Don't drop ankh when dying with hardcore enabled
davidonete Nov 7, 2023
a3c5b19
Add a temporary immune when reviving at graveyard
davidonete Nov 15, 2023
a96236a
use session get player when loggin in bots
celguar Nov 15, 2023
33637ee
Prevent reviving if hardcore option enabled
davidonete Nov 18, 2023
b54d9fb
update achievements
celguar Nov 26, 2023
62c04b3
update transmog
celguar Nov 26, 2023
d55f0b9
update dual spec
celguar Nov 26, 2023
28de0ff
update bots mod
celguar Nov 26, 2023
8b0439a
update anti crash
celguar Nov 26, 2023
d6af90c
update city title mod
celguar Nov 26, 2023
11dd02a
update hardcore
celguar Nov 26, 2023
5f90131
update immersive
celguar Nov 26, 2023
b4c63df
update lfg
celguar Nov 26, 2023
ff56aac
update solocraft
celguar Nov 26, 2023
a6a5ad9
Update Bots
celguar Nov 26, 2023
6183d18
Threat API add support for new client
celguar Nov 26, 2023
f5d321a
Update Bots
celguar Nov 26, 2023
c8f41db
Fix graves and chests spawning in invalid heights (mid air or under g…
davidonete Nov 24, 2023
730a5e3
Modify threat update to support locale unit names
davidonete Nov 28, 2023
351f1ff
Revert core change as it affects bots line of sight check with GOs
davidonete Dec 1, 2023
1284e60
Fix dirty movement flags after facing something
celguar Dec 9, 2023
5b9b4a5
fix AV graveyards not working
surraymb Dec 5, 2023
a73e220
fix aoe channeled spells aborting
surraymb Dec 5, 2023
43df081
Immersive.DisableOfflineRespawn (respawn/reset time will not tick if …
Dec 7, 2023
b36df06
Fix mulgore loremaster achievement
davidonete Dec 12, 2023
b39f18f
Update Bots
celguar Dec 19, 2023
b8005f2
Fix crash when bots use portals
celguar Dec 19, 2023
f8030b2
Fix lfg teleport after group is made
celguar Dec 19, 2023
e33258c
SpawnManager: Defer insertion of spawns during SpawnManager::Update
celguar Nov 30, 2023
5fc4152
SpawnManager: Fix previous commit through move insertion
celguar Nov 30, 2023
0fc50cd
Port crashfix from tbc
celguar Dec 19, 2023
4fbaa66
Port facing fix from tbc
celguar Dec 19, 2023
e623b18
Update Bots
celguar Dec 20, 2023
dfcf302
Winter veil achievement fix
davidonete Dec 22, 2023
a45c84e
Don't generate pet number twice on tame.
celguar Dec 24, 2023
5d95f52
Fix aura flags that are based on effect index
celguar Dec 25, 2023
42d997a
Fix petition query packet
celguar Jan 6, 2024
76c5766
Load RandomProperties name
celguar Jan 8, 2024
0fa4960
Immersive.SharedQuestMoneyPercent (All your alts get a percent of max…
Jan 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "src/modules/Bots"]
path = src/modules/Bots
url = https://github.com/celguar/mangosbot-bots.git
15 changes: 15 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,21 @@ if(NOT BUILD_GAME_SERVER AND BUILD_PLAYERBOT)
message(STATUS "BUILD_PLAYERBOT forced to OFF due to BUILD_GAME_SERVER is not set")
endif()

if(NOT BUILD_GAME_SERVER AND BUILD_IKE3_BOTS)
set(BUILD_IKE3_BOTS OFF)
message(STATUS "BUILD_PLAYERBOTS forced to OFF due to BUILD_GAME_SERVER is not set")
endif()

if(BUILD_IKE3_BOTS)
set(BUILD_PLAYERBOT OFF)
message(STATUS "CMaNGOS bots DISABLED because Ike3 bots enabled")
endif()

if(BUILD_PLAYERBOT)
set(BUILD_IKE3_BOTS OFF)
message(STATUS "Ike3 bots DISABLED because CMaNGOS bots enabled")
endif()

if(PCH)
if(${CMAKE_VERSION} VERSION_LESS "3.16")
message("PCH is not supported by your CMake version")
Expand Down
4 changes: 4 additions & 0 deletions cmake/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ option(BUILD_LOGIN_SERVER "Build login server" ON)
option(BUILD_EXTRACTORS "Build map/dbc/vmap/mmap extractors" OFF)
option(BUILD_SCRIPTDEV "Build ScriptDev. (OFF Speedup build)" ON)
option(BUILD_PLAYERBOT "Build Playerbot mod" OFF)
option(BUILD_IKE3_BOTS "Build ike3 Playerbots" OFF)
option(BUILD_ACHIEVEMENTS "Build Achievements" OFF)
option(BUILD_AHBOT "Build Auction House Bot mod" OFF)
option(BUILD_METRICS "Build Metrics, generate data for Grafana" OFF)
option(BUILD_RECASTDEMOMOD "Build map/vmap/mmap viewer" OFF)
Expand Down Expand Up @@ -35,6 +37,8 @@ message(STATUS
BUILD_EXTRACTORS Build map/dbc/vmap/mmap extractor
BUILD_SCRIPTDEV Build scriptdev. (Disable it to speedup build in dev mode by not including scripts)
BUILD_PLAYERBOT Build Playerbot mod
BUILD_IKE3_BOTS Build Ike3 Playerbot mod
BUILD_ACHIEVEMENTS Build Achievements System
BUILD_AHBOT Build Auction House Bot mod
BUILD_METRICS Build Metrics, generate data for Grafana
BUILD_RECASTDEMOMOD Build map/vmap/mmap viewer
Expand Down
6 changes: 6 additions & 0 deletions cmake/showoptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ else()
message(STATUS "Build Playerbot : No (default)")
endif()

if(BUILD_IKE3_BOTS)
message(STATUS "Build ike3 Playerbots : Yes")
else()
message(STATUS "Build ike3 Playerbots : No (default)")
endif()

if(BUILD_EXTRACTORS)
message(STATUS "Build extractors : Yes")
else()
Expand Down
158 changes: 145 additions & 13 deletions contrib/mmap/src/MapBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ namespace MMAP
rcCalcGridSize(config.bmin, config.bmax, config.cs, &config.width, &config.height);

Tile tile;
buildCommonTile(modelName.data(), tile, config, tVerts, tVertCount, tTris, tTriCount, nullptr, 0, nullptr, 0, 0);
buildCommonTile(modelName.data(), tile, config, tVerts, tVertCount, tTris, tTriCount, nullptr, 0, nullptr, 0, 0, meshData);

IntermediateValues iv;
iv.polyMesh = tile.pmesh;
Expand Down Expand Up @@ -484,8 +484,16 @@ namespace MMAP

// make sure we process maps which don't have tiles
// initialize the static tree, which loads WDT models
if (!m_terrainBuilder->loadVMap(mapID, 64, 64, meshData))
IVMapManager* vmapManager = new VMapManager2();
if (!m_terrainBuilder->loadVMap(mapID, 64, 64, meshData, vmapManager))
{
vmapManager->unloadMap(mapID, 64, 64);
delete vmapManager;
return;
}

vmapManager->unloadMap(mapID, 64, 64);
delete vmapManager;

// get the coord bounds of the model data
if (meshData.solidVerts.size() + meshData.liquidVerts.size() == 0)
Expand Down Expand Up @@ -601,6 +609,92 @@ namespace MMAP
dtFreeNavMesh(navMesh);
}

static void calcTriNormal(const float* v0, const float* v1, const float* v2, float* norm)
{
float e0[3], e1[3];
rcVsub(e0, v1, v0);
rcVsub(e1, v2, v0);
rcVcross(norm, e0, e1);
rcVnormalize(norm);
}

void filterSteepSlopeTriangles(rcContext* ctx,
const float* verts, int nv,
const int* tris, int nt,
unsigned char* areas, MeshData& meshData, TerrainBuilder* m_terrainBuilder, VMAP::IVMapManager* vmapManager)
{
rcIgnoreUnused(ctx);
rcIgnoreUnused(nv);

float norm[3];

const float playerClimbLimit = cosf(50.0f / 180.0f * RC_PI);
const float maxClimbLimitTerrain = cosf(75.0f / 180.0f * RC_PI);
const float maxClimbLimitVmaps = cosf(61.0f / 180.0f * RC_PI);

uint32 terrainPolysSlope = 0;
uint32 terrainPolysNull = 0;
uint32 nonTerrainPolysSlope = 0;
uint32 nonTerrainPolysNull = 0;
uint32 undermapPolys = 0;

for (int i = 0; i < nt; ++i)
{
if (areas[i] & RC_WALKABLE_AREA)
{
const int* tri = &tris[i * 3];
calcTriNormal(&verts[tri[0] * 3], &verts[tri[1] * 3], &verts[tri[2] * 3], norm);

bool terrain = meshData.IsTerrainTriangle(i);
// Check if the face is walkable: different angle for different type of triangle
// NPCs, charges, ... can climb up to the HardLimit
// blinks, randomPosGenerator ... can climb up to playerClimbLimit
// With playerClimbLimit < HardLimit
float climbHardLimit = terrain ? maxClimbLimitTerrain : maxClimbLimitVmaps;

if (norm[1] <= playerClimbLimit)
{
areas[i] = NAV_AREA_GROUND_STEEP;
if (terrain)
terrainPolysSlope++;
else
nonTerrainPolysSlope++;
}
if (norm[1] <= climbHardLimit)
{
areas[i] = RC_NULL_AREA;
if (terrain)
terrainPolysNull++;
else
nonTerrainPolysNull++;
}

// Now we remove underterrain triangles (actually set flags to 0)
// This prevents selecting wrong poly for a player in the server later.
if (vmapManager && !terrain && areas[i])
{
// Get triangle corners (as usual, yzx positions)
// (actually we push these corners towards the center a bit to prevent collision with border models etc...)
float cVerts[9];
for (int c = 0; c < 3; ++c) // Corner
for (int v = 0; v < 3; ++v) // Coordinate
cVerts[3 * c + v] = (5 * verts[tri[c] * 3 + v] + verts[tri[(c + 1) % 3] * 3 + v] + verts[tri[(c + 2) % 3] * 3 + v]) / 7;

// A triangle is undermap if all corners are undermap
if (m_terrainBuilder->IsUnderMap(&cVerts[0], vmapManager) && m_terrainBuilder->IsUnderMap(&cVerts[3], vmapManager) && m_terrainBuilder->IsUnderMap(&cVerts[6], vmapManager))
{
areas[i] = RC_NULL_AREA;
undermapPolys++;
continue;
}
}
}
}
//printf("Slopes filtered: terrain: %u vmaps: %u \n", terrainPolysSlope, nonTerrainPolysSlope);
//printf("Unwalkable filtered: terrain: %u vmaps: %u \n", terrainPolysNull, nonTerrainPolysNull);
//printf("Undermap polygons filtered: %u \n", undermapPolys);
}

/**************************************************************************/
void MapBuilder::buildTile(uint32 mapID, uint32 tileX, uint32 tileY, dtNavMesh* navMesh, uint32 curTile, uint32 tileCount)
{
Expand All @@ -612,11 +706,16 @@ namespace MMAP
m_terrainBuilder->loadMap(mapID, tileX, tileY, meshData);

// get model data
m_terrainBuilder->loadVMap(mapID, tileY, tileX, meshData);
IVMapManager* vmapManager = new VMapManager2();
m_terrainBuilder->loadVMap(mapID, tileY, tileX, meshData, vmapManager);

// if there is no data, give up now
if (!meshData.solidVerts.size() && !meshData.liquidVerts.size())
{
vmapManager->unloadMap(mapID, tileX, tileY);
delete vmapManager;
return;
}

// remove unused vertices
TerrainBuilder::cleanVertices(meshData.solidVerts, meshData.solidTris);
Expand All @@ -637,7 +736,11 @@ namespace MMAP
m_terrainBuilder->loadOffMeshConnections(mapID, tileX, tileY, meshData, m_offMeshFilePath);

// build navmesh tile
buildMoveMapTile(mapID, tileX, tileY, meshData, bmin, bmax, navMesh);
buildMoveMapTile(mapID, tileX, tileY, meshData, bmin, bmax, navMesh, vmapManager);

// clean up
vmapManager->unloadMap(mapID, tileX, tileY);
delete vmapManager;
}

/**************************************************************************/
Expand Down Expand Up @@ -720,7 +823,7 @@ namespace MMAP
/**************************************************************************/
void MapBuilder::buildMoveMapTile(uint32 mapID, uint32 tileX, uint32 tileY,
MeshData& meshData, float bmin[3], float bmax[3],
dtNavMesh* navMesh)
dtNavMesh* navMesh, IVMapManager* vmapManager)
{
// console output
char tileString[20];
Expand All @@ -747,6 +850,18 @@ namespace MMAP
rcVcopy(config.bmin, bmin);
rcVcopy(config.bmax, bmax);

/*printf("Parameters: \n");
printf("ch: %f \n", config.ch);
printf("cs: %f \n", config.cs);
printf("walkableHeight: %u \n", config.walkableHeight);
printf("walkableClimb: %u \n", config.walkableClimb);
printf("walkableRadius: %u \n", config.walkableRadius);
printf("walkableSlopeAngle: %f \n", config.walkableSlopeAngle);
printf("maxEdgeLen: %u \n", config.maxEdgeLen);
printf("borderSize: %u \n", config.borderSize);
printf("detailSampleDist: %f \n", config.detailSampleDist);
printf("detailSampleMaxError: %f \n", config.detailSampleMaxError);*/

// this sets the dimensions of the heightfield - should maybe happen before border padding
rcCalcGridSize(config.bmin, config.bmax, config.cs, &config.width, &config.height);

Expand Down Expand Up @@ -777,7 +892,7 @@ namespace MMAP
tileCfg.bmax[0] += tileCfg.borderSize * tileCfg.cs;
tileCfg.bmax[2] += tileCfg.borderSize * tileCfg.cs;

buildCommonTile(tileString, tile, tileCfg, tVerts, tVertCount, tTris, tTriCount, lVerts, lVertCount, lTris, lTriCount, lTriFlags);
buildCommonTile(tileString, tile, tileCfg, tVerts, tVertCount, tTris, tTriCount, lVerts, lVertCount, lTris, lTriCount, lTriFlags, meshData, vmapManager);
}
}

Expand Down Expand Up @@ -833,10 +948,26 @@ namespace MMAP
{
if (uint8 area = iv.polyMesh->areas[i] & NAV_AREA_ALL_MASK)
{
if (area >= NAV_AREA_MIN_VALUE)
iv.polyMesh->flags[i] = 1 << (NAV_AREA_MAX_VALUE - area);
else
iv.polyMesh->flags[i] = NAV_GROUND; // TODO: these will be dynamic in future
switch (area)
{
case NAV_AREA_EMPTY:
break;
case NAV_AREA_GROUND:
iv.polyMesh->flags[i] |= NAV_GROUND;
break;
case NAV_AREA_GROUND_STEEP:
iv.polyMesh->flags[i] |= (NAV_GROUND | NAV_GROUND_STEEP);
break;
case NAV_AREA_WATER:
iv.polyMesh->flags[i] |= NAV_WATER;
break;
case NAV_AREA_MAGMA_SLIME:
iv.polyMesh->flags[i] |= NAV_MAGMA_SLIME;
break;
default:
iv.polyMesh->flags[i] |= NAV_GROUND; // TODO: these will be dynamic in future
break;
}
}
}

Expand Down Expand Up @@ -950,7 +1081,7 @@ namespace MMAP
continue;
}

printf("%s Writing to file... \r", tileString);
printf("%s Writing to file... \n", tileString);

// write header
MmapTileHeader header;
Expand Down Expand Up @@ -983,7 +1114,7 @@ namespace MMAP
}

bool MapBuilder::buildCommonTile(const char* tileString, Tile& tile, rcConfig& tileCfg, float* tVerts, int tVertCount, int* tTris, int tTriCount, float* lVerts, int lVertCount,
int* lTris, int lTriCount, uint8* lTriFlags)
int* lTris, int lTriCount, uint8* lTriFlags, MeshData& meshData, IVMapManager* vmapManager)
{
// Build heightfield for walkable area
tile.solid = rcAllocHeightfield();
Expand All @@ -997,6 +1128,7 @@ namespace MMAP
unsigned char* triFlags = new unsigned char[tTriCount];
memset(triFlags, NAV_AREA_GROUND, tTriCount * sizeof(unsigned char));
rcClearUnwalkableTriangles(m_rcContext, tileCfg.walkableSlopeAngle, tVerts, tVertCount, tTris, tTriCount, triFlags);
filterSteepSlopeTriangles(m_rcContext, tVerts, tVertCount, tTris, tTriCount, triFlags, meshData, m_terrainBuilder, vmapManager);
rcRasterizeTriangles(m_rcContext, tVerts, tVertCount, tTris, triFlags, tTriCount, *tile.solid, tileCfg.walkableClimb);
delete[] triFlags;

Expand Down Expand Up @@ -1185,7 +1317,7 @@ namespace MMAP
{"walkableClimb", 4},
{"walkableHeight", 6},
{"walkableRadius", 2},
{"walkableSlopeAngle", 60.0f},
{"walkableSlopeAngle", 75.0f},
{"liquidFlagMergeThreshold", 0.0f},
};
}
Expand Down
4 changes: 2 additions & 2 deletions contrib/mmap/src/MapBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ namespace MMAP

void buildTile(uint32 mapID, uint32 tileX, uint32 tileY, dtNavMesh* navMesh, uint32 curTile, uint32 tileCount);
bool buildCommonTile(const char* tileString, Tile& tile, rcConfig& tileCfg, float* tVerts, int tVertCount, int* tTris, int tTriCount, float* lVerts, int lVertCount,
int* lTris, int lTriCount, uint8* lTriFlags);
int* lTris, int lTriCount, uint8* lTriFlags, MeshData& meshData, IVMapManager* vmapManager = nullptr);

// move map building
void buildMoveMapTile(uint32 mapID, uint32 tileX, uint32 tileY, MeshData& meshData, float bmin[3], float bmax[3], dtNavMesh* navMesh);
void buildMoveMapTile(uint32 mapID, uint32 tileX, uint32 tileY, MeshData& meshData, float bmin[3], float bmax[3], dtNavMesh* navMesh, IVMapManager* vmapManager);
void getTileBounds(uint32 tileX, uint32 tileY, float* verts, int vertCount, float* bmin, float* bmax);
void getGridBounds(uint32 mapID, uint32& minX, uint32& minY, uint32& maxX, uint32& maxY);

Expand Down
Loading