Tools/vmap_extractor: Move information about model type from spawns in vmap tiles to model file itself

Port From (https://github.com/TrinityCore/TrinityCore/commit/a70e758ba5eef1e8aa966cbabaee020630d2c872)
This commit is contained in:
hondacrx
2024-03-12 22:12:00 -04:00
parent 6b25d4b9b6
commit 5f0608739d
6 changed files with 36 additions and 25 deletions
+11 -11
View File
@@ -61,7 +61,6 @@ namespace Game.Collision
iBound = rotated_bounds + iPos;
owner = modelOwner;
isWmo = modelData.isWmo;
return true;
}
@@ -74,6 +73,12 @@ namespace Game.Collision
return mdl;
}
public bool IsMapObject()
{
return !iModel.IsM2();
}
public override bool IntersectRay(Ray ray, ref float maxDist, bool stopAtFirstHit, PhaseShift phaseShift, ModelIgnoreFlags ignoreFlags)
{
if (!IsCollisionEnabled() || !owner.IsSpawned())
@@ -172,7 +177,7 @@ namespace Game.Collision
}
return false;
}
public bool UpdatePosition()
{
if (iModel == null)
@@ -210,9 +215,8 @@ namespace Game.Collision
public void EnableCollision(bool enable) { _collisionEnabled = enable; }
bool IsCollisionEnabled() { return _collisionEnabled; }
public bool IsMapObject() { return isWmo; }
public byte GetNameSetId() { return owner.GetNameSetId(); }
public static bool LoadGameObjectModelList()
{
uint oldMSTime = Time.GetMSTime();
@@ -239,13 +243,12 @@ namespace Game.Collision
break;
uint displayId = reader.ReadUInt32();
bool isWmo = reader.ReadBoolean();
int name_length = reader.ReadInt32();
string name = reader.ReadString(name_length);
Vector3 v1 = reader.Read<Vector3>();
Vector3 v2 = reader.Read<Vector3>();
StaticModelList.models.Add(displayId, new GameobjectModelData(name, v1, v2, isWmo));
StaticModelList.models.Add(displayId, new GameobjectModelData(name, v1, v2));
}
}
catch (EndOfStreamException ex)
@@ -265,20 +268,17 @@ namespace Game.Collision
float iScale;
WorldModel iModel;
GameObjectModelOwnerBase owner;
bool isWmo;
}
public class GameobjectModelData
{
public GameobjectModelData(string name_, Vector3 lowBound, Vector3 highBound, bool isWmo_)
public GameobjectModelData(string name_, Vector3 lowBound, Vector3 highBound)
{
bound = new AxisAlignedBox(lowBound, highBound);
name = name_;
isWmo = isWmo_;
}
public AxisAlignedBox bound;
public string name;
public bool isWmo;
}
}