[11910] Implement loading for MMap Generator

This commit is contained in:
faramir118 2012-01-29 23:34:58 +01:00 committed by Schmoozerd
parent d3606fb4ee
commit df3a5f2808
8 changed files with 48 additions and 1 deletions

View file

@ -25,6 +25,7 @@
#include "DBCStores.h"
#include "GridMap.h"
#include "VMapFactory.h"
#include "MoveMap.h"
#include "World.h"
#include "Policies/SingletonImp.h"
#include "Util.h"
@ -645,6 +646,7 @@ TerrainInfo::~TerrainInfo()
delete m_GridMaps[i][k];
VMAP::VMapFactory::createOrGetVMapManager()->unloadMap(m_mapId);
MMAP::MMapFactory::createOrGetMMapManager()->unloadMap(m_mapId);
}
GridMap * TerrainInfo::Load(const uint32 x, const uint32 y)
@ -705,6 +707,9 @@ void TerrainInfo::CleanUpGrids(const uint32 diff)
//unload VMAPS...
VMAP::VMapFactory::createOrGetVMapManager()->unloadMap(m_mapId, x, y);
//unload mmap...
MMAP::MMapFactory::createOrGetMMapManager()->unloadMap(m_mapId, x, y);
}
}
}
@ -1088,6 +1093,9 @@ GridMap * TerrainInfo::LoadMapAndVMap( const uint32 x, const uint32 y )
DEBUG_LOG("Ignored VMAP name:%s, id:%d, x:%d, y:%d (vmap rep.: x:%d, y:%d)", mapName, m_mapId, x,y,x,y);
break;
}
// load navmesh
MMAP::MMapFactory::createOrGetMMapManager()->loadMap(m_mapId, x, y);
}
}

View file

@ -35,6 +35,7 @@
#include "DBCEnums.h"
#include "MapPersistentStateMgr.h"
#include "VMapFactory.h"
#include "MoveMap.h"
#include "BattleGroundMgr.h"
Map::~Map()
@ -53,6 +54,9 @@ Map::~Map()
i_data = NULL;
}
// unload instance specific navigation data
MMAP::MMapFactory::createOrGetMMapManager()->unloadMapInstance(m_TerrainData->GetMapId(), GetInstanceId());
//release reference count
if(m_TerrainData->Release())
sTerrainMgr.UnloadTerrain(m_TerrainData->GetMapId());

View file

@ -80,6 +80,11 @@ namespace VMAP
void UnloadMapTile(uint32 tileX, uint32 tileY, VMapManager2 *vm);
bool isTiled() const { return iIsTiled; }
uint32 numLoadedTiles() const { return iLoadedTiles.size(); }
#ifdef MMAP_GENERATOR
public:
void getModelInstances(ModelInstance* &models, uint32 &count);
#endif
};
struct AreaInfo

View file

@ -75,6 +75,11 @@ namespace VMAP
G3D::Matrix3 iInvRot;
float iInvScale;
WorldModel *iModel;
#ifdef MMAP_GENERATOR
public:
WorldModel* const getWorldModel();
#endif
};
} // namespace VMAP

View file

@ -35,6 +35,12 @@ namespace VMAP
#include "Errors.h"
#include "Log.h"
#define ERROR_LOG(...) sLog.outError(__VA_ARGS__);
#elif defined MMAP_GENERATOR
#include <assert.h>
#define MANGOS_ASSERT(x) assert(x)
#define DEBUG_LOG(...) 0
#define DETAIL_LOG(...) 0
#define ERROR_LOG(...) do{ printf("ERROR:"); printf(__VA_ARGS__); printf("\n"); } while(0)
#else
#include <assert.h>
#define MANGOS_ASSERT(x) assert(x)

View file

@ -106,6 +106,11 @@ namespace VMAP
return getMapFileName(pMapId);
}
virtual bool existsMap(const char* pBasePath, unsigned int pMapId, int x, int y);
#ifdef MMAP_GENERATOR
public:
void getInstanceMapTree(InstanceTreeMap &instanceMapTree);
#endif
};
}
#endif

View file

@ -66,6 +66,10 @@ namespace VMAP
uint32 iType; //!< liquid type
float *iHeight; //!< (tilesX + 1)*(tilesY + 1) height values
uint8 *iFlags; //!< info if liquid tile is used
#ifdef MMAP_GENERATOR
public:
void getPosInfo(uint32 &tilesX, uint32 &tilesY, Vector3 &corner) const;
#endif
};
/*! holding additional info for WMO group files */
@ -98,6 +102,11 @@ namespace VMAP
std::vector<MeshTriangle> triangles;
BIH meshTree;
WmoLiquid *iLiquid;
#ifdef MMAP_GENERATOR
public:
void getMeshData(std::vector<Vector3> &vertices, std::vector<MeshTriangle> &triangles, WmoLiquid* &liquid);
#endif
};
/*! Holds a model (converted M2 or WMO) in its original coordinate space */
class WorldModel
@ -117,6 +126,11 @@ namespace VMAP
uint32 RootWMOID;
std::vector<GroupModel> groupModels;
BIH groupTree;
#ifdef MMAP_GENERATOR
public:
void getGroupModels(std::vector<GroupModel> &groupModels);
#endif
};
} // namespace VMAP

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11909"
#define REVISION_NR "11910"
#endif // __REVISION_NR_H__