Core/Mmaps:
* implemented loading part.
This commit is contained in:
@@ -34,7 +34,9 @@ set(collision_STAT_SRCS
|
||||
|
||||
include_directories(
|
||||
${CMAKE_SOURCE_DIR}/dep/g3dlite/include
|
||||
${CMAKE_SOURCE_DIR}/dep/recastnavigation/Detour
|
||||
${CMAKE_SOURCE_DIR}/src/server/shared
|
||||
${CMAKE_SOURCE_DIR}/src/server/shared/Configuration
|
||||
${CMAKE_SOURCE_DIR}/src/server/shared/Debugging
|
||||
${CMAKE_SOURCE_DIR}/src/server/shared/Database
|
||||
${CMAKE_SOURCE_DIR}/src/server/shared/Debugging
|
||||
|
||||
@@ -112,6 +112,8 @@ namespace VMAP
|
||||
return getMapFileName(mapId);
|
||||
}
|
||||
virtual bool existsMap(const char* basePath, unsigned int mapId, int x, int y);
|
||||
public:
|
||||
void getInstanceMapTree(InstanceTreeMap &instanceMapTree);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -80,6 +80,7 @@ namespace VMAP
|
||||
void UnloadMapTile(uint32 tileX, uint32 tileY, VMapManager2* vm);
|
||||
bool isTiled() const { return iIsTiled; }
|
||||
uint32 numLoadedTiles() const { return iLoadedTiles.size(); }
|
||||
void getModelInstances(ModelInstance* &models, uint32 &count);
|
||||
};
|
||||
|
||||
struct AreaInfo
|
||||
|
||||
@@ -74,6 +74,8 @@ namespace VMAP
|
||||
G3D::Matrix3 iInvRot;
|
||||
float iInvScale;
|
||||
WorldModel* iModel;
|
||||
public:
|
||||
WorldModel* const getWorldModel();
|
||||
};
|
||||
} // namespace VMAP
|
||||
|
||||
|
||||
@@ -66,6 +66,8 @@ namespace VMAP
|
||||
uint32 iType; //!< liquid type
|
||||
float *iHeight; //!< (tilesX + 1)*(tilesY + 1) height values
|
||||
uint8 *iFlags; //!< info if liquid tile is used
|
||||
public:
|
||||
void getPosInfo(uint32 &tilesX, uint32 &tilesY, Vector3 &corner) const;
|
||||
};
|
||||
|
||||
/*! holding additional info for WMO group files */
|
||||
@@ -98,6 +100,8 @@ namespace VMAP
|
||||
std::vector<MeshTriangle> triangles;
|
||||
BIH meshTree;
|
||||
WmoLiquid* iLiquid;
|
||||
public:
|
||||
void getMeshData(std::vector<Vector3> &vertices, std::vector<MeshTriangle> &triangles, WmoLiquid* &liquid);
|
||||
};
|
||||
/*! Holds a model (converted M2 or WMO) in its original coordinate space */
|
||||
class WorldModel
|
||||
@@ -117,6 +121,8 @@ namespace VMAP
|
||||
uint32 RootWMOID;
|
||||
std::vector<GroupModel> groupModels;
|
||||
BIH groupTree;
|
||||
public:
|
||||
void getGroupModels(std::vector<GroupModel> &groupModels);
|
||||
};
|
||||
} // namespace VMAP
|
||||
|
||||
|
||||
@@ -106,6 +106,8 @@ set(game_STAT_SRCS
|
||||
|
||||
include_directories(
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_SOURCE_DIR}/dep/recastnavigation/Detour
|
||||
${CMAKE_SOURCE_DIR}/dep/recastnavigation/Recast
|
||||
${CMAKE_SOURCE_DIR}/dep/g3dlite/include
|
||||
${CMAKE_SOURCE_DIR}/dep/mersennetwister
|
||||
${CMAKE_SOURCE_DIR}/dep/SFMT
|
||||
|
||||
@@ -498,6 +498,7 @@ enum UnitState
|
||||
UNIT_STATE_FLEEING_MOVE = 0x02000000,
|
||||
UNIT_STATE_CHASE_MOVE = 0x04000000,
|
||||
UNIT_STATE_FOLLOW_MOVE = 0x08000000,
|
||||
UNIT_STATE_IGNORE_PATHFINDING = 0x10000000, // do not use pathfinding in any MovementGenerator
|
||||
UNIT_STATE_UNATTACKABLE = (UNIT_STATE_IN_FLIGHT | UNIT_STATE_ONVEHICLE),
|
||||
// for real move using movegen check and stop (except unstoppable flight)
|
||||
UNIT_STATE_MOVING = UNIT_STATE_ROAMING_MOVE | UNIT_STATE_CONFUSED_MOVE | UNIT_STATE_FLEEING_MOVE | UNIT_STATE_CHASE_MOVE | UNIT_STATE_FOLLOW_MOVE ,
|
||||
@@ -1626,7 +1627,7 @@ class Unit : public WorldObject
|
||||
void JumpTo(float speedXY, float speedZ, bool forward = true);
|
||||
void JumpTo(WorldObject* obj, float speedZ);
|
||||
|
||||
void MonsterMoveWithSpeed(float x, float y, float z, float speed);
|
||||
void MonsterMoveWithSpeed(float x, float y, float z, float speed, bool generatePath = false, bool forceDestination = false);
|
||||
//void SetFacing(float ori, WorldObject* obj = NULL);
|
||||
void SendMonsterMoveExitVehicle(Position const* newPos);
|
||||
//void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, uint32 MovementFlags, uint32 Time, Player* player = NULL);
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "GridStates.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "VMapFactory.h"
|
||||
#include "MMapFactory.h"
|
||||
#include "MapInstanced.h"
|
||||
#include "CellImpl.h"
|
||||
#include "GridNotifiers.h"
|
||||
@@ -69,6 +70,9 @@ Map::~Map()
|
||||
|
||||
if (!m_scriptSchedule.empty())
|
||||
sScriptMgr->DecreaseScheduledScriptCount(m_scriptSchedule.size());
|
||||
|
||||
MMAP::MMapFactory::createOrGetMMapManager()->unloadMap(GetId());
|
||||
MMAP::MMapFactory::createOrGetMMapManager()->unloadMapInstance(GetId(), i_InstanceId);
|
||||
}
|
||||
|
||||
bool Map::ExistMap(uint32 mapid, int gx, int gy)
|
||||
@@ -117,6 +121,24 @@ bool Map::ExistVMap(uint32 mapid, int gx, int gy)
|
||||
return true;
|
||||
}
|
||||
|
||||
void Map::LoadMMap(int gx, int gy)
|
||||
{
|
||||
// DONT CHANGE "gy" and "gx" - Its necessary !
|
||||
int mmapLoadResult = MMAP::MMapFactory::createOrGetMMapManager()->loadMap(GetId(), gy, gx);
|
||||
switch (mmapLoadResult)
|
||||
{
|
||||
case MMAP::MMAP_LOAD_RESULT_OK:
|
||||
sLog->outDetail("MMAP loaded name:%s, id:%d, x:%d, y:%d (mmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy);
|
||||
break;
|
||||
case MMAP::MMAP_LOAD_RESULT_ERROR:
|
||||
sLog->outDetail("Could not load MMAP name:%s, id:%d, x:%d, y:%d (mmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy);
|
||||
break;
|
||||
case MMAP::MMAP_LOAD_RESULT_IGNORED:
|
||||
sLog->outStaticDebug("Ignored MMAP name:%s, id:%d, x:%d, y:%d (mmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Map::LoadVMap(int gx, int gy)
|
||||
{
|
||||
// x and y are swapped !!
|
||||
@@ -184,6 +206,7 @@ void Map::LoadMap(int gx, int gy, bool reload)
|
||||
void Map::LoadMapAndVMap(int gx, int gy)
|
||||
{
|
||||
LoadMap(gx, gy);
|
||||
LoadMMap(gx, gy);
|
||||
if (i_InstanceId == 0)
|
||||
LoadVMap(gx, gy); // Only load the data for the base map
|
||||
}
|
||||
@@ -996,6 +1019,7 @@ bool Map::UnloadGrid(NGridType& ngrid, bool unloadAll)
|
||||
}
|
||||
// x and y are swapped
|
||||
VMAP::VMapFactory::createOrGetVMapManager()->unloadMap(GetId(), gx, gy);
|
||||
MMAP::MMapFactory::createOrGetMMapManager()->unloadMap(GetId(), gx, gy);
|
||||
}
|
||||
else
|
||||
((MapInstanced*)m_parentMap)->RemoveGridMapReference(GridCoord(gx, gy));
|
||||
|
||||
@@ -76,6 +76,8 @@ struct map_fileheader
|
||||
uint32 heightMapSize;
|
||||
uint32 liquidMapOffset;
|
||||
uint32 liquidMapSize;
|
||||
uint32 holesOffset;
|
||||
uint32 holesSize;
|
||||
};
|
||||
|
||||
#define MAP_AREA_NO_AREA 0x0001
|
||||
@@ -447,6 +449,7 @@ class Map : public GridRefManager<NGridType>
|
||||
void LoadMapAndVMap(int gx, int gy);
|
||||
void LoadVMap(int gx, int gy);
|
||||
void LoadMap(int gx, int gy, bool reload = false);
|
||||
void LoadMMap(int gx, int gy);
|
||||
GridMap* GetGrid(float x, float y);
|
||||
|
||||
void SetTimer(uint32 t) { i_gridExpiry = t < MIN_GRID_DELAY ? MIN_GRID_DELAY : t; }
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "MapManager.h"
|
||||
#include "Battleground.h"
|
||||
#include "VMapFactory.h"
|
||||
#include "MMapFactory.h"
|
||||
#include "InstanceSaveMgr.h"
|
||||
#include "World.h"
|
||||
#include "Group.h"
|
||||
@@ -258,6 +259,7 @@ bool MapInstanced::DestroyInstance(InstancedMaps::iterator &itr)
|
||||
if (m_InstancedMaps.size() <= 1 && sWorld->getBoolConfig(CONFIG_GRID_UNLOAD))
|
||||
{
|
||||
VMAP::VMapFactory::createOrGetVMapManager()->unloadMap(itr->second->GetId());
|
||||
MMAP::MMapFactory::createOrGetMMapManager()->unloadMap(itr->second->GetId());
|
||||
// in that case, unload grids of the base map, too
|
||||
// so in the next map creation, (EnsureGridCreated actually) VMaps will be reloaded
|
||||
Map::UnloadAll();
|
||||
|
||||
@@ -43,6 +43,9 @@ class MovementGenerator
|
||||
virtual MovementGeneratorType GetMovementGeneratorType() = 0;
|
||||
|
||||
virtual void unitSpeedChanged() { }
|
||||
|
||||
// used by Evade code for select point to evade with expected restart default movement
|
||||
virtual bool GetResetPosition(Unit &, float& /*x*/, float& /*y*/, float& /*z*/) { return false; }
|
||||
};
|
||||
|
||||
template<class T, class D>
|
||||
|
||||
Reference in New Issue
Block a user