diff --git a/src/game/vmap/MapTree.cpp b/src/game/vmap/MapTree.cpp index a65982bd..52f1b687 100644 --- a/src/game/vmap/MapTree.cpp +++ b/src/game/vmap/MapTree.cpp @@ -313,7 +313,7 @@ namespace VMAP #endif if (!iIsTiled && ModelSpawn::readFromFile(rf, spawn)) { - WorldModel* model = vm->acquireModelInstance(iBasePath, spawn.name); + WorldModel* model = vm->acquireModelInstance(iBasePath, spawn.name, spawn.flags); DEBUG_FILTER_LOG(LOG_FILTER_MAP_LOADING, "StaticMapTree::InitMap(): loading %s", spawn.name.c_str()); if (model) { @@ -383,7 +383,7 @@ namespace VMAP if (result) { // acquire model instance - WorldModel* model = vm->acquireModelInstance(iBasePath, spawn.name); + WorldModel* model = vm->acquireModelInstance(iBasePath, spawn.name, spawn.flags); if (!model) { ERROR_LOG("StaticMapTree::LoadMapTile() could not acquire WorldModel pointer for '%s'!", spawn.name.c_str()); } diff --git a/src/game/vmap/VMapManager2.cpp b/src/game/vmap/VMapManager2.cpp index 7c13e875..45b5a0fe 100644 --- a/src/game/vmap/VMapManager2.cpp +++ b/src/game/vmap/VMapManager2.cpp @@ -251,7 +251,7 @@ namespace VMAP //========================================================= - WorldModel* VMapManager2::acquireModelInstance(const std::string& basepath, const std::string& filename) + WorldModel* VMapManager2::acquireModelInstance(const std::string& basepath, const std::string& filename, uint32 flags/* Only used when creating the model */) { ModelFileMap::iterator model = iLoadedModelFiles.find(filename); if (model == iLoadedModelFiles.end()) @@ -264,6 +264,7 @@ namespace VMAP return NULL; } DEBUG_FILTER_LOG(LOG_FILTER_MAP_LOADING, "VMapManager2: loading file '%s%s'.", basepath.c_str(), filename.c_str()); + worldmodel->Flags = flags; model = iLoadedModelFiles.insert(std::pair(filename, ManagedModel())).first; model->second.setModel(worldmodel); } diff --git a/src/game/vmap/VMapManager2.h b/src/game/vmap/VMapManager2.h index da2d1449..7c6a7080 100644 --- a/src/game/vmap/VMapManager2.h +++ b/src/game/vmap/VMapManager2.h @@ -270,7 +270,7 @@ namespace VMAP * @param filename * @return WorldModel */ - WorldModel* acquireModelInstance(const std::string& basepath, const std::string& filename); + WorldModel* acquireModelInstance(const std::string& basepath, const std::string& filename, uint32 flags = 0); /** * @brief * diff --git a/src/game/vmap/WorldModel.cpp b/src/game/vmap/WorldModel.cpp index b10bbaf9..3283e1f9 100644 --- a/src/game/vmap/WorldModel.cpp +++ b/src/game/vmap/WorldModel.cpp @@ -29,6 +29,11 @@ using G3D::Vector3; using G3D::Ray; +enum ModelFlags +{ + MOD_M2 = 1 +}; + template<> struct BoundsTrait { static void getBounds(const VMAP::GroupModel& obj, G3D::AABox& out) { out = obj.GetBound(); } @@ -433,6 +438,9 @@ namespace VMAP bool WorldModel::IntersectRay(const G3D::Ray& ray, float& distance, bool stopAtFirstHit) const { + // M2 models are not taken into account for LoS calculation + if (Flags & MOD_M2) + return false; // small M2 workaround, maybe better make separate class with virtual intersection funcs // in any case, there's no need to use a bound tree if we only have one submodel if (groupModels.size() == 1) diff --git a/src/game/vmap/WorldModel.h b/src/game/vmap/WorldModel.h index 196c4d91..5b0c5e0f 100644 --- a/src/game/vmap/WorldModel.h +++ b/src/game/vmap/WorldModel.h @@ -356,6 +356,7 @@ namespace VMAP * @return bool */ bool readFile(const std::string& filename); + uint32 Flags; protected: uint32 RootWMOID; /**< TODO */ std::vector groupModels; /**< TODO */