Core/VMaps: Fixes getting no area/zone info, which caused you to be dismounted.

This commit is contained in:
hondacrx
2022-06-23 15:55:45 -04:00
parent 9f77e39899
commit 0f655d09ca
7 changed files with 16 additions and 17 deletions
+1 -1
View File
@@ -292,7 +292,7 @@ namespace System
public static Matrix4x4 fromEulerAnglesZYX(float fYAngle, float fPAngle, float fRAngle)
{
return Matrix4x4.CreateFromYawPitchRoll(fPAngle, fRAngle, fYAngle);
return Matrix4x4.CreateFromYawPitchRoll(fYAngle, fPAngle, fRAngle);
}
#region Strings
+2 -2
View File
@@ -85,9 +85,9 @@ public static class MathFunctions
{
float aa = Math.Abs(a) + 1.0f;
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)
@@ -104,7 +104,7 @@ namespace Game.Collision
T obj = objects[idx];
if (obj != null)
_callback.Invoke(p, obj);
_callback.Invoke(p, obj as GameObjectModel);
}
}
}
+1 -2
View File
@@ -26,7 +26,6 @@ namespace Game.Collision
public class WorkerCallback
{
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 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; }
@@ -255,7 +254,7 @@ namespace Game.Collision
_areaInfo = new AreaInfo();
}
public override void Invoke(Vector3 p, IModel obj)
public override void Invoke(Vector3 p, GameObjectModel obj)
{
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)
{
if (!IsLineOfSightCalcEnabled() || Global.DisableMgr.IsDisabledFor(DisableType.VMAP, mapId, null, (byte)DisableFlags.VmapLOS))
if (!IsLineOfSightCalcEnabled() || Global.DisableMgr.IsVMAPDisabledFor(mapId, (byte)DisableFlags.VmapLOS))
return true;
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)
{
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);
if (instanceTree != null)
@@ -186,7 +186,7 @@ namespace Game.Collision
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);
if (instanceTree != null)
@@ -209,7 +209,7 @@ namespace Game.Collision
adtId = 0;
rootId = 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);
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)
{
if (!Global.DisableMgr.IsDisabledFor(DisableType.VMAP, mapId, null, (byte)DisableFlags.VmapLiquidStatus))
if (!Global.DisableMgr.IsVMAPDisabledFor(mapId, (byte)DisableFlags.VmapLiquidStatus))
{
var instanceTree = iInstanceMapTrees.LookupByKey(mapId);
if (instanceTree != null)
@@ -254,7 +254,7 @@ namespace Game.Collision
{
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;
int adtId, rootId, groupId;
@@ -277,7 +277,7 @@ namespace Game.Collision
if (info.hitInstance.GetLiquidLevel(pos, info, ref 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());
}
}
+2 -2
View File
@@ -8333,7 +8333,7 @@ namespace Game
TerrainSwapInfo terrainSwapInfo = _terrainSwapInfoById[terrainSwap];
terrainSwapInfo.Id = terrainSwap;
_terrainSwapInfoByMap[mapId].Add(terrainSwapInfo);
_terrainSwapInfoByMap.Add(mapId, terrainSwapInfo);
++count;
} while (result.NextRow());
@@ -8379,7 +8379,7 @@ namespace Game
PhaseInfoStruct phase = getOrCreatePhaseIfMissing(phaseId);
phase.Areas.Add(area);
_phaseInfoByArea[area].Add(new PhaseAreaInfo(phase));
_phaseInfoByArea.Add(area, new PhaseAreaInfo(phase));
++count;
} while (result.NextRow());
+2 -2
View File
@@ -391,8 +391,8 @@ namespace Game.Maps
if (m_uint16_V8 == null || m_uint16_V9 == null)
return _gridHeight;
x = MapConst.MapResolution * (32 - x / MapConst.SizeofGrids);
y = MapConst.MapResolution * (32 - y / MapConst.SizeofGrids);
x = MapConst.MapResolution * (MapConst.CenterGridId - x / MapConst.SizeofGrids);
y = MapConst.MapResolution * (MapConst.CenterGridId - y / MapConst.SizeofGrids);
int x_int = (int)x;
int y_int = (int)y;