Core/VMaps: Fixes getting no area/zone info, which caused you to be dismounted.
This commit is contained in:
@@ -292,7 +292,7 @@ namespace System
|
|||||||
|
|
||||||
public static Matrix4x4 fromEulerAnglesZYX(float fYAngle, float fPAngle, float fRAngle)
|
public static Matrix4x4 fromEulerAnglesZYX(float fYAngle, float fPAngle, float fRAngle)
|
||||||
{
|
{
|
||||||
return Matrix4x4.CreateFromYawPitchRoll(fPAngle, fRAngle, fYAngle);
|
return Matrix4x4.CreateFromYawPitchRoll(fYAngle, fPAngle, fRAngle);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Strings
|
#region Strings
|
||||||
|
|||||||
@@ -85,9 +85,9 @@ public static class MathFunctions
|
|||||||
{
|
{
|
||||||
float aa = Math.Abs(a) + 1.0f;
|
float aa = Math.Abs(a) + 1.0f;
|
||||||
if (float.IsPositiveInfinity(aa))
|
if (float.IsPositiveInfinity(aa))
|
||||||
return 0.00001f;
|
return 0.0000005f;
|
||||||
|
|
||||||
return 0.00001f * aa;
|
return 0.0000005f * aa;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float lerp(float a, float b, float f)
|
public static float lerp(float a, float b, float f)
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ namespace Game.Collision
|
|||||||
|
|
||||||
T obj = objects[idx];
|
T obj = objects[idx];
|
||||||
if (obj != null)
|
if (obj != null)
|
||||||
_callback.Invoke(p, obj);
|
_callback.Invoke(p, obj as GameObjectModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ namespace Game.Collision
|
|||||||
public class WorkerCallback
|
public class WorkerCallback
|
||||||
{
|
{
|
||||||
public virtual void Invoke(Vector3 point, uint entry) { }
|
public virtual void Invoke(Vector3 point, uint entry) { }
|
||||||
public virtual void Invoke(Vector3 point, IModel entry) { }
|
|
||||||
public virtual void Invoke(Vector3 point, GameObjectModel obj) { }
|
public virtual void Invoke(Vector3 point, GameObjectModel obj) { }
|
||||||
public virtual bool Invoke(Ray ray, uint entry, ref float distance, bool pStopAtFirstHit) { return false; }
|
public virtual bool Invoke(Ray ray, uint entry, ref float distance, bool pStopAtFirstHit) { return false; }
|
||||||
public virtual bool Invoke(Ray r, IModel obj, ref float distance) { return false; }
|
public virtual bool Invoke(Ray r, IModel obj, ref float distance) { return false; }
|
||||||
@@ -255,7 +254,7 @@ namespace Game.Collision
|
|||||||
_areaInfo = new AreaInfo();
|
_areaInfo = new AreaInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Invoke(Vector3 p, IModel obj)
|
public override void Invoke(Vector3 p, GameObjectModel obj)
|
||||||
{
|
{
|
||||||
obj.IntersectPoint(p, _areaInfo, _phaseShift);
|
obj.IntersectPoint(p, _areaInfo, _phaseShift);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ namespace Game.Collision
|
|||||||
|
|
||||||
public bool IsInLineOfSight(uint mapId, float x1, float y1, float z1, float x2, float y2, float z2, ModelIgnoreFlags ignoreFlags)
|
public bool IsInLineOfSight(uint mapId, float x1, float y1, float z1, float x2, float y2, float z2, ModelIgnoreFlags ignoreFlags)
|
||||||
{
|
{
|
||||||
if (!IsLineOfSightCalcEnabled() || Global.DisableMgr.IsDisabledFor(DisableType.VMAP, mapId, null, (byte)DisableFlags.VmapLOS))
|
if (!IsLineOfSightCalcEnabled() || Global.DisableMgr.IsVMAPDisabledFor(mapId, (byte)DisableFlags.VmapLOS))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
var instanceTree = iInstanceMapTrees.LookupByKey(mapId);
|
var instanceTree = iInstanceMapTrees.LookupByKey(mapId);
|
||||||
@@ -160,7 +160,7 @@ namespace Game.Collision
|
|||||||
|
|
||||||
public bool GetObjectHitPos(uint mapId, float x1, float y1, float z1, float x2, float y2, float z2, out float rx, out float ry, out float rz, float modifyDist)
|
public bool GetObjectHitPos(uint mapId, float x1, float y1, float z1, float x2, float y2, float z2, out float rx, out float ry, out float rz, float modifyDist)
|
||||||
{
|
{
|
||||||
if (IsLineOfSightCalcEnabled() && !Global.DisableMgr.IsDisabledFor(DisableType.VMAP, mapId, null, (byte)DisableFlags.VmapLOS))
|
if (IsLineOfSightCalcEnabled() && !Global.DisableMgr.IsVMAPDisabledFor(mapId, (byte)DisableFlags.VmapLOS))
|
||||||
{
|
{
|
||||||
var instanceTree = iInstanceMapTrees.LookupByKey(mapId);
|
var instanceTree = iInstanceMapTrees.LookupByKey(mapId);
|
||||||
if (instanceTree != null)
|
if (instanceTree != null)
|
||||||
@@ -186,7 +186,7 @@ namespace Game.Collision
|
|||||||
|
|
||||||
public float GetHeight(uint mapId, float x, float y, float z, float maxSearchDist)
|
public float GetHeight(uint mapId, float x, float y, float z, float maxSearchDist)
|
||||||
{
|
{
|
||||||
if (IsHeightCalcEnabled() && !Global.DisableMgr.IsDisabledFor(DisableType.VMAP, mapId, null, (byte)DisableFlags.VmapHeight))
|
if (IsHeightCalcEnabled() && !Global.DisableMgr.IsVMAPDisabledFor(mapId, (byte)DisableFlags.VmapHeight))
|
||||||
{
|
{
|
||||||
var instanceTree = iInstanceMapTrees.LookupByKey(mapId);
|
var instanceTree = iInstanceMapTrees.LookupByKey(mapId);
|
||||||
if (instanceTree != null)
|
if (instanceTree != null)
|
||||||
@@ -209,7 +209,7 @@ namespace Game.Collision
|
|||||||
adtId = 0;
|
adtId = 0;
|
||||||
rootId = 0;
|
rootId = 0;
|
||||||
groupId = 0;
|
groupId = 0;
|
||||||
if (!Global.DisableMgr.IsDisabledFor(DisableType.VMAP, mapId, null, (byte)DisableFlags.VmapAreaFlag))
|
if (!Global.DisableMgr.IsVMAPDisabledFor(mapId, (byte)DisableFlags.VmapAreaFlag))
|
||||||
{
|
{
|
||||||
var instanceTree = iInstanceMapTrees.LookupByKey(mapId);
|
var instanceTree = iInstanceMapTrees.LookupByKey(mapId);
|
||||||
if (instanceTree != null)
|
if (instanceTree != null)
|
||||||
@@ -227,7 +227,7 @@ namespace Game.Collision
|
|||||||
|
|
||||||
public bool GetLiquidLevel(uint mapId, float x, float y, float z, uint reqLiquidType, ref float level, ref float floor, ref uint type, ref uint mogpFlags)
|
public bool GetLiquidLevel(uint mapId, float x, float y, float z, uint reqLiquidType, ref float level, ref float floor, ref uint type, ref uint mogpFlags)
|
||||||
{
|
{
|
||||||
if (!Global.DisableMgr.IsDisabledFor(DisableType.VMAP, mapId, null, (byte)DisableFlags.VmapLiquidStatus))
|
if (!Global.DisableMgr.IsVMAPDisabledFor(mapId, (byte)DisableFlags.VmapLiquidStatus))
|
||||||
{
|
{
|
||||||
var instanceTree = iInstanceMapTrees.LookupByKey(mapId);
|
var instanceTree = iInstanceMapTrees.LookupByKey(mapId);
|
||||||
if (instanceTree != null)
|
if (instanceTree != null)
|
||||||
@@ -254,7 +254,7 @@ namespace Game.Collision
|
|||||||
{
|
{
|
||||||
var data = new AreaAndLiquidData();
|
var data = new AreaAndLiquidData();
|
||||||
|
|
||||||
if (!Global.DisableMgr.IsDisabledFor(DisableType.VMAP, mapId, null, (byte)DisableFlags.VmapLiquidStatus))
|
if (Global.DisableMgr.IsVMAPDisabledFor(mapId, (byte)DisableFlags.VmapLiquidStatus))
|
||||||
{
|
{
|
||||||
data.floorZ = z;
|
data.floorZ = z;
|
||||||
int adtId, rootId, groupId;
|
int adtId, rootId, groupId;
|
||||||
@@ -277,7 +277,7 @@ namespace Game.Collision
|
|||||||
if (info.hitInstance.GetLiquidLevel(pos, info, ref liquidLevel))
|
if (info.hitInstance.GetLiquidLevel(pos, info, ref liquidLevel))
|
||||||
data.liquidInfo = new(liquidType, liquidLevel);
|
data.liquidInfo = new(liquidType, liquidLevel);
|
||||||
|
|
||||||
if (!Global.DisableMgr.IsDisabledFor(DisableType.VMAP, mapId, null, (byte)DisableFlags.VmapLiquidStatus))
|
if (!Global.DisableMgr.IsVMAPDisabledFor(mapId, (byte)DisableFlags.VmapLiquidStatus))
|
||||||
data.areaInfo = new(info.hitInstance.adtId, info.rootId, (int)info.hitModel.GetWmoID(), info.hitModel.GetMogpFlags());
|
data.areaInfo = new(info.hitInstance.adtId, info.rootId, (int)info.hitModel.GetWmoID(), info.hitModel.GetMogpFlags());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8333,7 +8333,7 @@ namespace Game
|
|||||||
|
|
||||||
TerrainSwapInfo terrainSwapInfo = _terrainSwapInfoById[terrainSwap];
|
TerrainSwapInfo terrainSwapInfo = _terrainSwapInfoById[terrainSwap];
|
||||||
terrainSwapInfo.Id = terrainSwap;
|
terrainSwapInfo.Id = terrainSwap;
|
||||||
_terrainSwapInfoByMap[mapId].Add(terrainSwapInfo);
|
_terrainSwapInfoByMap.Add(mapId, terrainSwapInfo);
|
||||||
|
|
||||||
++count;
|
++count;
|
||||||
} while (result.NextRow());
|
} while (result.NextRow());
|
||||||
@@ -8379,7 +8379,7 @@ namespace Game
|
|||||||
|
|
||||||
PhaseInfoStruct phase = getOrCreatePhaseIfMissing(phaseId);
|
PhaseInfoStruct phase = getOrCreatePhaseIfMissing(phaseId);
|
||||||
phase.Areas.Add(area);
|
phase.Areas.Add(area);
|
||||||
_phaseInfoByArea[area].Add(new PhaseAreaInfo(phase));
|
_phaseInfoByArea.Add(area, new PhaseAreaInfo(phase));
|
||||||
|
|
||||||
++count;
|
++count;
|
||||||
} while (result.NextRow());
|
} while (result.NextRow());
|
||||||
|
|||||||
@@ -391,8 +391,8 @@ namespace Game.Maps
|
|||||||
if (m_uint16_V8 == null || m_uint16_V9 == null)
|
if (m_uint16_V8 == null || m_uint16_V9 == null)
|
||||||
return _gridHeight;
|
return _gridHeight;
|
||||||
|
|
||||||
x = MapConst.MapResolution * (32 - x / MapConst.SizeofGrids);
|
x = MapConst.MapResolution * (MapConst.CenterGridId - x / MapConst.SizeofGrids);
|
||||||
y = MapConst.MapResolution * (32 - y / MapConst.SizeofGrids);
|
y = MapConst.MapResolution * (MapConst.CenterGridId - y / MapConst.SizeofGrids);
|
||||||
|
|
||||||
int x_int = (int)x;
|
int x_int = (int)x;
|
||||||
int y_int = (int)y;
|
int y_int = (int)y;
|
||||||
|
|||||||
Reference in New Issue
Block a user