diff options
author | Shauren <shauren.trinity@gmail.com> | 2024-03-06 00:04:19 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2024-03-06 00:04:19 +0100 |
commit | a70e758ba5eef1e8aa966cbabaee020630d2c872 (patch) | |
tree | f323c8ac0f4bb31d75c3570b838de066190983ba /src/common/Collision/Models/GameObjectModel.cpp | |
parent | 382e76f02df5a41c2ba1d964ac6d9258e68265e6 (diff) |
Tools/vmap_extractor: Move information about model type from spawns in vmap tiles to model file itself
Diffstat (limited to 'src/common/Collision/Models/GameObjectModel.cpp')
-rw-r--r-- | src/common/Collision/Models/GameObjectModel.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/common/Collision/Models/GameObjectModel.cpp b/src/common/Collision/Models/GameObjectModel.cpp index 946fe5b3e8b..363863f5759 100644 --- a/src/common/Collision/Models/GameObjectModel.cpp +++ b/src/common/Collision/Models/GameObjectModel.cpp @@ -32,12 +32,11 @@ using G3D::AABox; struct GameobjectModelData { - GameobjectModelData(char const* name_, uint32 nameLength, Vector3 const& lowBound, Vector3 const& highBound, bool isWmo_) : - bound(lowBound, highBound), name(name_, nameLength), isWmo(isWmo_) { } + GameobjectModelData(char const* name_, uint32 nameLength, Vector3 const& lowBound, Vector3 const& highBound) : + bound(lowBound, highBound), name(name_, nameLength) { } AABox bound; std::string name; - bool isWmo; }; typedef std::unordered_map<uint32, GameobjectModelData> ModelList; @@ -63,7 +62,6 @@ bool LoadGameObjectModelList(std::string const& dataPath) } uint32 name_length, displayId; - uint8 isWmo; char buff[500]; while (true) { @@ -72,8 +70,7 @@ bool LoadGameObjectModelList(std::string const& dataPath) if (feof(model_list_file.get())) // EOF flag is only set after failed reading attempt break; - if (fread(&isWmo, sizeof(uint8), 1, model_list_file.get()) != 1 - || fread(&name_length, sizeof(uint32), 1, model_list_file.get()) != 1 + if (fread(&name_length, sizeof(uint32), 1, model_list_file.get()) != 1 || name_length >= sizeof(buff) || fread(&buff, sizeof(char), name_length, model_list_file.get()) != name_length || fread(&v1, sizeof(Vector3), 1, model_list_file.get()) != 1 @@ -89,7 +86,7 @@ bool LoadGameObjectModelList(std::string const& dataPath) continue; } - model_list.emplace(std::piecewise_construct, std::forward_as_tuple(displayId), std::forward_as_tuple(&buff[0], name_length, v1, v2, isWmo != 0)); + model_list.emplace(std::piecewise_construct, std::forward_as_tuple(displayId), std::forward_as_tuple(&buff[0], name_length, v1, v2)); } TC_LOG_INFO("server.loading", ">> Loaded {} GameObject models in {} ms", uint32(model_list.size()), GetMSTimeDiffToNow(oldMSTime)); @@ -144,7 +141,6 @@ bool GameObjectModel::initialize(std::unique_ptr<GameObjectModelOwnerBase> model #endif owner = std::move(modelOwner); - isWmo = it->second.isWmo; return true; } @@ -160,6 +156,11 @@ GameObjectModel* GameObjectModel::Create(std::unique_ptr<GameObjectModelOwnerBas return mdl; } +bool GameObjectModel::isMapObject() const +{ + return !iModel->IsM2(); +} + bool GameObjectModel::intersectRay(G3D::Ray const& ray, float& maxDist, bool stopAtFirstHit, PhaseShift const& phaseShift, VMAP::ModelIgnoreFlags ignoreFlags) const { if (!isCollisionEnabled() || !owner->IsSpawned()) |