More cleanups of custom classes in favor of .NET runtime types.
This commit is contained in:
@@ -18,7 +18,6 @@
|
||||
using Framework.Constants;
|
||||
using Game.Entities;
|
||||
using Game.Spells;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Game.AI
|
||||
{
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.GameMath;
|
||||
using Game.Chat;
|
||||
using Game.DataStorage;
|
||||
using Game.Entities;
|
||||
@@ -27,6 +26,7 @@ using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.AI
|
||||
{
|
||||
@@ -1195,20 +1195,20 @@ namespace Game.AI
|
||||
if (!summoner)
|
||||
break;
|
||||
|
||||
foreach (var target in targets)
|
||||
{
|
||||
Position pos = target.GetPositionWithOffset(new Position(e.Target.x, e.Target.y, e.Target.z, e.Target.o));
|
||||
Quaternion rot = Quaternion.fromEulerAnglesZYX(pos.GetOrientation(), 0f, 0f);
|
||||
summoner.SummonGameObject(e.Action.summonGO.entry, pos, rot, e.Action.summonGO.despawnTime, (GameObjectSummonType)e.Action.summonGO.summonType);
|
||||
}
|
||||
foreach (var target in targets)
|
||||
{
|
||||
Position pos = target.GetPositionWithOffset(new Position(e.Target.x, e.Target.y, e.Target.z, e.Target.o));
|
||||
Quaternion rot = Quaternion.CreateFromRotationMatrix(Extensions.fromEulerAnglesZYX(pos.GetOrientation(), 0f, 0f));
|
||||
summoner.SummonGameObject(e.Action.summonGO.entry, pos, rot, e.Action.summonGO.despawnTime, (GameObjectSummonType)e.Action.summonGO.summonType);
|
||||
}
|
||||
|
||||
if (e.GetTargetType() != SmartTargets.Position)
|
||||
if (e.GetTargetType() != SmartTargets.Position)
|
||||
break;
|
||||
|
||||
Quaternion _rot = Quaternion.CreateFromRotationMatrix(Extensions.fromEulerAnglesZYX(e.Target.o, 0f, 0f));
|
||||
summoner.SummonGameObject(e.Action.summonGO.entry, new Position(e.Target.x, e.Target.y, e.Target.z, e.Target.o), _rot, e.Action.summonGO.despawnTime, (GameObjectSummonType)e.Action.summonGO.summonType);
|
||||
break;
|
||||
|
||||
Quaternion _rot = Quaternion.fromEulerAnglesZYX(e.Target.o, 0f, 0f);
|
||||
summoner.SummonGameObject(e.Action.summonGO.entry, new Position(e.Target.x, e.Target.y, e.Target.z, e.Target.o), _rot, e.Action.summonGO.despawnTime, (GameObjectSummonType)e.Action.summonGO.summonType);
|
||||
break;
|
||||
}
|
||||
}
|
||||
case SmartActions.KillUnit:
|
||||
{
|
||||
foreach (var target in targets)
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
using Framework.Constants;
|
||||
using Framework.Database;
|
||||
using Game.Arenas;
|
||||
using Game.BattleFields;
|
||||
using Game.BattleGrounds;
|
||||
using Game.DataStorage;
|
||||
using Game.Entities;
|
||||
|
||||
@@ -24,9 +24,7 @@ using Game.Mails;
|
||||
using Game.Networking.Packets;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Linq;
|
||||
using Framework.Networking;
|
||||
using Framework.IO;
|
||||
using System.Collections;
|
||||
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.GameMath;
|
||||
using Game.DataStorage;
|
||||
using Game.Entities;
|
||||
using Game.Groups;
|
||||
using Game.Maps;
|
||||
@@ -25,6 +23,7 @@ using Game.Networking;
|
||||
using Game.Networking.Packets;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.BattleFields
|
||||
{
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.GameMath;
|
||||
using Game.Entities;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.BattleFields
|
||||
{
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.Database;
|
||||
using Framework.GameMath;
|
||||
using Game.Chat;
|
||||
using Game.DataStorage;
|
||||
using Game.Entities;
|
||||
@@ -30,6 +29,7 @@ using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.BattleGrounds
|
||||
{
|
||||
@@ -1353,7 +1353,7 @@ namespace Game.BattleGrounds
|
||||
Log.outDebug(LogFilter.Battleground, $"Battleground.AddObject: gameoobject [entry: {entry}, object type: {type}] for BG (map: {GetMapId()}) has zeroed rotation fields, " +
|
||||
"orientation used temporally, but please fix the spawn");
|
||||
|
||||
rotation = Quaternion.fromEulerAnglesZYX(o, 0.0f, 0.0f);
|
||||
rotation = Quaternion.CreateFromRotationMatrix(Extensions.fromEulerAnglesZYX(o, 0.0f, 0.0f));
|
||||
}
|
||||
|
||||
// Must be created this way, adding to godatamap would add it to the base map of the instance
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Game.DataStorage;
|
||||
using Game.Entities;
|
||||
using Game.Networking.Packets;
|
||||
using System;
|
||||
|
||||
@@ -20,7 +20,6 @@ using Framework.Constants;
|
||||
using System.Collections.Generic;
|
||||
using Game.Networking.Packets;
|
||||
using Game.DataStorage;
|
||||
using Game.BattleGrounds;
|
||||
|
||||
namespace Game.BattleGrounds.Zones
|
||||
{
|
||||
|
||||
@@ -16,11 +16,10 @@
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Game.DataStorage;
|
||||
using Game.Entities;
|
||||
using Game.Networking.Packets;
|
||||
using System.Collections.Generic;
|
||||
using Framework.GameMath;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.BattleGrounds.Zones
|
||||
{
|
||||
|
||||
@@ -16,10 +16,8 @@
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Game.DataStorage;
|
||||
using Game.Entities;
|
||||
using Game.Networking.Packets;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Game.BattleGrounds.Zones
|
||||
{
|
||||
|
||||
@@ -19,7 +19,6 @@ using Framework.Constants;
|
||||
using Game.Cache;
|
||||
using Game.Entities;
|
||||
using Game.Maps;
|
||||
using Game.Networking;
|
||||
using Game.Networking.Packets;
|
||||
|
||||
namespace Game.Chat
|
||||
|
||||
@@ -19,7 +19,6 @@ using Framework.Constants;
|
||||
using Framework.Database;
|
||||
using Framework.IO;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace Game.Chat.Commands
|
||||
{
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.Database;
|
||||
using Framework.GameMath;
|
||||
using Framework.IO;
|
||||
using Game.DataStorage;
|
||||
using Game.Entities;
|
||||
using Game.Maps;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using System.Text;
|
||||
|
||||
namespace Game.Chat
|
||||
@@ -614,7 +614,7 @@ namespace Game.Chat
|
||||
Player player = handler.GetPlayer();
|
||||
Map map = player.GetMap();
|
||||
|
||||
GameObject obj = GameObject.CreateGameObject(objectInfo.entry, map, player, Quaternion.fromEulerAnglesZYX(player.GetOrientation(), 0.0f, 0.0f), 255, GameObjectState.Ready);
|
||||
GameObject obj = GameObject.CreateGameObject(objectInfo.entry, map, player, Quaternion.CreateFromRotationMatrix(Extensions.fromEulerAnglesZYX(player.GetOrientation(), 0.0f, 0.0f)), 255, GameObjectState.Ready);
|
||||
if (!obj)
|
||||
return false;
|
||||
|
||||
@@ -658,7 +658,7 @@ namespace Game.Chat
|
||||
if (spawntime != 0)
|
||||
spawntm = spawntime;
|
||||
|
||||
Quaternion rotation = Quaternion.fromEulerAnglesZYX(player.GetOrientation(), 0.0f, 0.0f);
|
||||
Quaternion rotation = Quaternion.CreateFromRotationMatrix(Extensions.fromEulerAnglesZYX(player.GetOrientation(), 0.0f, 0.0f));
|
||||
|
||||
if (Global.ObjectMgr.GetGameObjectTemplate(id) == null)
|
||||
{
|
||||
|
||||
@@ -19,12 +19,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Game.DataStorage;
|
||||
using Framework.Constants;
|
||||
using Game.Spells;
|
||||
using Framework.Dynamic;
|
||||
using Framework.Collections;
|
||||
|
||||
namespace Game.Chat
|
||||
|
||||
@@ -19,6 +19,7 @@ using Framework.GameMath;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Numerics;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Game.Collision
|
||||
@@ -76,12 +77,12 @@ namespace Game.Collision
|
||||
Vector3 d = gridBox.hi - gridBox.lo;
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
if (nodeBox.hi[i] < gridBox.lo[i] || nodeBox.lo[i] > gridBox.hi[i])
|
||||
if (nodeBox.hi.GetAt(i) < gridBox.lo.GetAt(i) || nodeBox.lo.GetAt(i) > gridBox.hi.GetAt(i))
|
||||
Log.outError(LogFilter.Server, "Reached tree area in error - discarding node with: {0} objects", right - left + 1);
|
||||
}
|
||||
// find longest axis
|
||||
axis = (int)d.primaryAxis();
|
||||
split = 0.5f * (gridBox.lo[axis] + gridBox.hi[axis]);
|
||||
split = 0.5f * (gridBox.lo.GetAt(axis) + gridBox.hi.GetAt(axis));
|
||||
// partition L/R subsets
|
||||
clipL = float.NegativeInfinity;
|
||||
clipR = float.PositiveInfinity;
|
||||
@@ -91,8 +92,8 @@ namespace Game.Collision
|
||||
for (int i = left; i <= right; )
|
||||
{
|
||||
int obj = (int)dat.indices[i];
|
||||
float minb = dat.primBound[obj].Lo[axis];
|
||||
float maxb = dat.primBound[obj].Hi[axis];
|
||||
float minb = dat.primBound[obj].Lo.GetAt(axis);
|
||||
float maxb = dat.primBound[obj].Hi.GetAt(axis);
|
||||
float center = (minb + maxb) * 0.5f;
|
||||
if (center <= split)
|
||||
{
|
||||
@@ -115,9 +116,9 @@ namespace Game.Collision
|
||||
nodeR = Math.Max(nodeR, maxb);
|
||||
}
|
||||
// check for empty space
|
||||
if (nodeL > nodeBox.lo[axis] && nodeR < nodeBox.hi[axis])
|
||||
if (nodeL > nodeBox.lo.GetAt(axis) && nodeR < nodeBox.hi.GetAt(axis))
|
||||
{
|
||||
float nodeBoxW = nodeBox.hi[axis] - nodeBox.lo[axis];
|
||||
float nodeBoxW = nodeBox.hi.GetAt(axis) - nodeBox.lo.GetAt(axis);
|
||||
float nodeNewW = nodeR - nodeL;
|
||||
// node box is too big compare to space occupied by primitives?
|
||||
if (1.3f * nodeNewW < nodeBoxW)
|
||||
@@ -134,8 +135,8 @@ namespace Game.Collision
|
||||
tempTree[nodeIndex + 1] = FloatToRawIntBits(nodeL);
|
||||
tempTree[nodeIndex + 2] = FloatToRawIntBits(nodeR);
|
||||
// update nodebox and recurse
|
||||
nodeBox.lo[axis] = nodeL;
|
||||
nodeBox.hi[axis] = nodeR;
|
||||
nodeBox.lo.SetAt(nodeL, axis);
|
||||
nodeBox.hi.SetAt(nodeR, axis);
|
||||
Subdivide(left, rightOrig, tempTree, dat, gridBox, nodeBox, nextIndex1, depth + 1, stats);
|
||||
return;
|
||||
}
|
||||
@@ -154,12 +155,12 @@ namespace Game.Collision
|
||||
if (clipL <= split)
|
||||
{
|
||||
// keep looping on left half
|
||||
gridBox.hi[axis] = split;
|
||||
gridBox.hi.SetAt(split, axis);
|
||||
prevClip = clipL;
|
||||
wasLeft = true;
|
||||
continue;
|
||||
}
|
||||
gridBox.hi[axis] = split;
|
||||
gridBox.hi.SetAt(split, axis);
|
||||
prevClip = float.NaN;
|
||||
}
|
||||
else if (left > right)
|
||||
@@ -177,12 +178,12 @@ namespace Game.Collision
|
||||
if (clipR >= split)
|
||||
{
|
||||
// keep looping on right half
|
||||
gridBox.lo[axis] = split;
|
||||
gridBox.lo.SetAt(split, axis);
|
||||
prevClip = clipR;
|
||||
wasLeft = false;
|
||||
continue;
|
||||
}
|
||||
gridBox.lo[axis] = split;
|
||||
gridBox.lo.SetAt(split, axis);
|
||||
prevClip = float.NaN;
|
||||
}
|
||||
else
|
||||
@@ -254,9 +255,12 @@ namespace Game.Collision
|
||||
AABound gridBoxR = gridBox;
|
||||
AABound nodeBoxL = nodeBox;
|
||||
AABound nodeBoxR = nodeBox;
|
||||
gridBoxL.hi[axis] = gridBoxR.lo[axis] = split;
|
||||
nodeBoxL.hi[axis] = clipL;
|
||||
nodeBoxR.lo[axis] = clipR;
|
||||
|
||||
gridBoxR.lo.SetAt(split, axis);
|
||||
gridBoxL.hi.SetAt(split, axis);
|
||||
nodeBoxL.hi.SetAt(clipL, axis);
|
||||
nodeBoxR.lo.SetAt(clipR, axis);
|
||||
|
||||
// recurse
|
||||
if (nl > 0)
|
||||
Subdivide(left, right, tempTree, dat, gridBoxL, nodeBoxL, nextIndex, depth + 1, stats);
|
||||
@@ -325,11 +329,11 @@ namespace Game.Collision
|
||||
Vector3 invDir = new();
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
invDir[i] = 1.0f / dir[i];
|
||||
if (MathFunctions.fuzzyNe(dir[i], 0.0f))
|
||||
invDir.SetAt(1.0f / dir.GetAt(i), i);
|
||||
if (MathFunctions.fuzzyNe(dir.GetAt(i), 0.0f))
|
||||
{
|
||||
float t1 = (bounds.Lo[i] - org[i]) * invDir[i];
|
||||
float t2 = (bounds.Hi[i] - org[i]) * invDir[i];
|
||||
float t1 = (bounds.Lo.GetAt(i) - org.GetAt(i)) * invDir.GetAt(i);
|
||||
float t2 = (bounds.Hi.GetAt(i) - org.GetAt(i)) * invDir.GetAt(i);
|
||||
if (t1 > t2)
|
||||
MathFunctions.Swap<float>(ref t1, ref t2);
|
||||
if (t1 > intervalMin)
|
||||
@@ -356,7 +360,7 @@ namespace Game.Collision
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
offsetFront[i] = FloatToRawIntBits(dir[i]) >> 31;
|
||||
offsetFront[i] = FloatToRawIntBits(dir.GetAt(i)) >> 31;
|
||||
offsetBack[i] = offsetFront[i] ^ 1;
|
||||
offsetFront3[i] = offsetFront[i] * 3;
|
||||
offsetBack3[i] = offsetBack[i] * 3;
|
||||
@@ -383,8 +387,8 @@ namespace Game.Collision
|
||||
if (axis < 3)
|
||||
{
|
||||
// "normal" interior node
|
||||
float tf = (IntBitsToFloat(tree[(int)(node + offsetFront[axis])]) - org[axis]) * invDir[axis];
|
||||
float tb = (IntBitsToFloat(tree[(int)(node + offsetBack[axis])]) - org[axis]) * invDir[axis];
|
||||
float tf = (IntBitsToFloat(tree[(int)(node + offsetFront[axis])]) - org.GetAt(axis)) * invDir.GetAt(axis);
|
||||
float tb = (IntBitsToFloat(tree[(int)(node + offsetBack[axis])]) - org.GetAt(axis)) * invDir.GetAt(axis);
|
||||
// ray passes between clip zones
|
||||
if (tf < intervalMin && tb > intervalMax)
|
||||
break;
|
||||
@@ -432,8 +436,8 @@ namespace Game.Collision
|
||||
{
|
||||
if (axis > 2)
|
||||
return; // should not happen
|
||||
float tf = (IntBitsToFloat(tree[(int)(node + offsetFront[axis])]) - org[axis]) * invDir[axis];
|
||||
float tb = (IntBitsToFloat(tree[(int)(node + offsetBack[axis])]) - org[axis]) * invDir[axis];
|
||||
float tf = (IntBitsToFloat(tree[(int)(node + offsetFront[axis])]) - org.GetAt(axis)) * invDir.GetAt(axis);
|
||||
float tb = (IntBitsToFloat(tree[(int)(node + offsetBack[axis])]) - org.GetAt(axis)) * invDir.GetAt(axis);
|
||||
node = offset;
|
||||
intervalMin = (tf >= intervalMin) ? tf : intervalMin;
|
||||
intervalMax = (tb <= intervalMax) ? tb : intervalMax;
|
||||
@@ -484,18 +488,18 @@ namespace Game.Collision
|
||||
float tl = IntBitsToFloat(tree[node + 1]);
|
||||
float tr = IntBitsToFloat(tree[node + 2]);
|
||||
// point is between clip zones
|
||||
if (tl < p[(int)axis] && tr > p[axis])
|
||||
if (tl < p.GetAt(axis) && tr > p.GetAt(axis))
|
||||
break;
|
||||
int right = offset + 3;
|
||||
node = right;
|
||||
// point is in right node only
|
||||
if (tl < p[(int)axis])
|
||||
if (tl < p.GetAt(axis))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
node = offset; // left
|
||||
// point is in left node only
|
||||
if (tr > p[axis])
|
||||
if (tr > p.GetAt(axis))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -525,7 +529,7 @@ namespace Game.Collision
|
||||
float tl = IntBitsToFloat(tree[node + 1]);
|
||||
float tr = IntBitsToFloat(tree[node + 2]);
|
||||
node = offset;
|
||||
if (tl > p[axis] || tr < p[axis])
|
||||
if (tl > p.GetAt(axis) || tr < p.GetAt(axis))
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
using Framework.GameMath;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.Collision
|
||||
{
|
||||
|
||||
@@ -19,6 +19,7 @@ using Framework.Constants;
|
||||
using Framework.GameMath;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.Collision
|
||||
{
|
||||
@@ -43,8 +44,8 @@ namespace Game.Collision
|
||||
Vector3 lo = vertices[(int)tri.idx0];
|
||||
Vector3 hi = lo;
|
||||
|
||||
lo = (lo.Min(vertices[(int)tri.idx1])).Min(vertices[(int)tri.idx2]);
|
||||
hi = (hi.Max(vertices[(int)tri.idx1])).Max(vertices[(int)tri.idx2]);
|
||||
lo = Vector3.Min(Vector3.Min(lo, vertices[(int)tri.idx1]), vertices[(int)tri.idx2]);
|
||||
hi = Vector3.Max(Vector3.Max(hi, vertices[(int)tri.idx1]), vertices[(int)tri.idx2]);
|
||||
|
||||
value = new AxisAlignedBox(lo, hi);
|
||||
}
|
||||
@@ -119,8 +120,8 @@ namespace Game.Collision
|
||||
|
||||
Vector3 e1 = points[(int)tri.idx1] - points[(int)tri.idx0];
|
||||
Vector3 e2 = points[(int)tri.idx2] - points[(int)tri.idx0];
|
||||
Vector3 p = new(ray.Direction.cross(e2));
|
||||
float a = e1.dot(p);
|
||||
Vector3 p = Vector3.Cross(ray.Direction, e2);
|
||||
float a = Vector3.Dot(e1, p);
|
||||
|
||||
if (Math.Abs(a) < EPS)
|
||||
{
|
||||
@@ -129,8 +130,8 @@ namespace Game.Collision
|
||||
}
|
||||
|
||||
float f = 1.0f / a;
|
||||
Vector3 s = new(ray.Origin - points[(int)tri.idx0]);
|
||||
float u = f * s.dot(p);
|
||||
Vector3 s = ray.Origin - points[(int)tri.idx0];
|
||||
float u = f * Vector3.Dot(s, p);
|
||||
|
||||
if ((u < 0.0f) || (u > 1.0f))
|
||||
{
|
||||
@@ -138,8 +139,8 @@ namespace Game.Collision
|
||||
return false;
|
||||
}
|
||||
|
||||
Vector3 q = new(s.cross(e1));
|
||||
float v = f * ray.Direction.dot(q);
|
||||
Vector3 q = Vector3.Cross(s, e1);
|
||||
float v = f * Vector3.Dot(ray.Direction, q);
|
||||
|
||||
if ((v < 0.0f) || ((u + v) > 1.0f))
|
||||
{
|
||||
@@ -147,7 +148,7 @@ namespace Game.Collision
|
||||
return false;
|
||||
}
|
||||
|
||||
float t = f * e2.dot(q);
|
||||
float t = f * Vector3.Dot(e2, q);
|
||||
|
||||
if ((t > 0.0f) && (t < distance))
|
||||
{
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
using Framework.GameMath;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.Collision
|
||||
{
|
||||
@@ -64,7 +65,7 @@ namespace Game.Collision
|
||||
public bool GetObjectHitPos(Vector3 startPos, Vector3 endPos, ref Vector3 resultHitPos, float modifyDist, PhaseShift phaseShift)
|
||||
{
|
||||
bool result;
|
||||
float maxDist = (endPos - startPos).magnitude();
|
||||
float maxDist = (endPos - startPos).Length();
|
||||
// valid map coords should *never ever* produce float overflow, but this would produce NaNs too
|
||||
Cypher.Assert(maxDist < float.MaxValue);
|
||||
// prevent NaN values which can cause BIH intersection to enter infinite loop
|
||||
@@ -81,7 +82,7 @@ namespace Game.Collision
|
||||
resultHitPos = startPos + dir * dist;
|
||||
if (modifyDist < 0)
|
||||
{
|
||||
if ((resultHitPos - startPos).magnitude() > -modifyDist)
|
||||
if ((resultHitPos - startPos).Length() > -modifyDist)
|
||||
resultHitPos += dir * modifyDist;
|
||||
else
|
||||
resultHitPos = startPos;
|
||||
@@ -101,7 +102,7 @@ namespace Game.Collision
|
||||
|
||||
public bool IsInLineOfSight(Vector3 startPos, Vector3 endPos, PhaseShift phaseShift)
|
||||
{
|
||||
float maxDist = (endPos - startPos).magnitude();
|
||||
float maxDist = (endPos - startPos).Length();
|
||||
|
||||
if (!MathFunctions.fuzzyGt(maxDist, 0))
|
||||
return true;
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.GameMath;
|
||||
using Framework.Dynamic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Framework.Dynamic;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.Collision
|
||||
{
|
||||
|
||||
@@ -20,6 +20,7 @@ using Framework.GameMath;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.Collision
|
||||
{
|
||||
@@ -346,7 +347,7 @@ namespace Game.Collision
|
||||
public bool GetObjectHitPos(Vector3 pPos1, Vector3 pPos2, out Vector3 pResultHitPos, float pModifyDist)
|
||||
{
|
||||
bool result;
|
||||
float maxDist = (pPos2 - pPos1).magnitude();
|
||||
float maxDist = (pPos2 - pPos1).Length();
|
||||
// valid map coords should *never ever* produce float overflow, but this would produce NaNs too
|
||||
Cypher.Assert(maxDist < float.MaxValue);
|
||||
// prevent NaN values which can cause BIH intersection to enter infinite loop
|
||||
@@ -363,7 +364,7 @@ namespace Game.Collision
|
||||
pResultHitPos = pPos1 + dir * dist;
|
||||
if (pModifyDist < 0)
|
||||
{
|
||||
if ((pResultHitPos - pPos1).magnitude() > -pModifyDist)
|
||||
if ((pResultHitPos - pPos1).Length() > -pModifyDist)
|
||||
{
|
||||
pResultHitPos += dir * pModifyDist;
|
||||
}
|
||||
@@ -388,7 +389,7 @@ namespace Game.Collision
|
||||
|
||||
public bool IsInLineOfSight(Vector3 pos1, Vector3 pos2, ModelIgnoreFlags ignoreFlags)
|
||||
{
|
||||
float maxDist = (pos2 - pos1).magnitude();
|
||||
float maxDist = (pos2 - pos1).Length();
|
||||
// return false if distance is over max float, in case of cheater teleporting to the end of the universe
|
||||
if (maxDist == float.MaxValue ||
|
||||
maxDist == float.PositiveInfinity)
|
||||
|
||||
@@ -15,11 +15,12 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.GameMath;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Framework.Constants;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.Collision
|
||||
{
|
||||
@@ -64,13 +65,13 @@ namespace Game.Collision
|
||||
iScale = modelOwner.GetScale();
|
||||
iInvScale = 1.0f / iScale;
|
||||
|
||||
Matrix3 iRotation = Matrix3.fromEulerAnglesZYX(modelOwner.GetOrientation(), 0, 0);
|
||||
iInvRot = iRotation.inverse();
|
||||
Matrix4x4 iRotation = Extensions.fromEulerAnglesZYX(modelOwner.GetOrientation(), 0, 0);
|
||||
Matrix4x4.Invert(iRotation, out iInvRot);
|
||||
// transform bounding box:
|
||||
mdl_box = new AxisAlignedBox(mdl_box.Lo * iScale, mdl_box.Hi * iScale);
|
||||
AxisAlignedBox rotated_bounds = new();
|
||||
for (int i = 0; i < 8; ++i)
|
||||
rotated_bounds.merge(iRotation * mdl_box.corner(i));
|
||||
rotated_bounds.merge(Vector3.Transform(mdl_box.corner(i), iRotation));
|
||||
|
||||
iBound = rotated_bounds + iPos;
|
||||
owner = modelOwner;
|
||||
@@ -100,8 +101,8 @@ namespace Game.Collision
|
||||
return false;
|
||||
|
||||
// child bounds are defined in object space:
|
||||
Vector3 p = iInvRot * (ray.Origin - iPos) * iInvScale;
|
||||
Ray modRay = new(p, iInvRot * ray.Direction);
|
||||
Vector3 p = Vector3.Transform((ray.Origin - iPos) * iInvScale, iInvRot);
|
||||
Ray modRay = new Ray(p, Vector3.Transform(ray.Direction, iInvRot));
|
||||
float distance = maxDist * iInvScale;
|
||||
bool hit = iModel.IntersectRay(modRay, ref distance, stopAtFirstHit, ignoreFlags);
|
||||
if (hit)
|
||||
@@ -124,13 +125,13 @@ namespace Game.Collision
|
||||
return;
|
||||
|
||||
// child bounds are defined in object space:
|
||||
Vector3 pModel = iInvRot * (point - iPos) * iInvScale;
|
||||
Vector3 zDirModel = iInvRot * new Vector3(0.0f, 0.0f, -1.0f);
|
||||
Vector3 pModel = Vector3.Transform((point - iPos) * iInvScale, iInvRot);
|
||||
Vector3 zDirModel = Vector3.Transform(new Vector3(0.0f, 0.0f, -1.0f), iInvRot);
|
||||
float zDist;
|
||||
if (iModel.IntersectPoint(pModel, zDirModel, out zDist, info))
|
||||
{
|
||||
Vector3 modelGround = pModel + zDist * zDirModel;
|
||||
float world_Z = ((modelGround * iInvRot) * iScale + iPos).Z;
|
||||
float world_Z = (Vector3.Transform(modelGround, iInvRot) * iScale + iPos).Z;
|
||||
if (info.ground_Z < world_Z)
|
||||
{
|
||||
info.ground_Z = world_Z;
|
||||
@@ -151,13 +152,13 @@ namespace Game.Collision
|
||||
return false;
|
||||
|
||||
// child bounds are defined in object space:
|
||||
Vector3 pModel = iInvRot * (point - iPos) * iInvScale;
|
||||
Vector3 zDirModel = iInvRot * new Vector3(0.0f, 0.0f, -1.0f);
|
||||
Vector3 pModel = Vector3.Transform((point - iPos) * iInvScale, iInvRot);
|
||||
Vector3 zDirModel = Vector3.Transform(new Vector3(0.0f, 0.0f, -1.0f), iInvRot);
|
||||
float zDist;
|
||||
if (iModel.GetLocationInfo(pModel, zDirModel, out zDist, info))
|
||||
{
|
||||
Vector3 modelGround = pModel + zDist * zDirModel;
|
||||
float world_Z = ((modelGround * iInvRot) * iScale + iPos).Z;
|
||||
float world_Z = (Vector3.Transform(modelGround, iInvRot) * iScale + iPos).Z;
|
||||
if (info.ground_Z < world_Z)
|
||||
{
|
||||
info.ground_Z = world_Z;
|
||||
@@ -171,7 +172,7 @@ namespace Game.Collision
|
||||
public bool GetLiquidLevel(Vector3 point, LocationInfo info, ref float liqHeight)
|
||||
{
|
||||
// child bounds are defined in object space:
|
||||
Vector3 pModel = iInvRot * (point - iPos) * iInvScale;
|
||||
Vector3 pModel = Vector3.Transform((point - iPos) * iInvScale, iInvRot);
|
||||
//Vector3 zDirModel = iInvRot * Vector3(0.f, 0.f, -1.f);
|
||||
float zDist;
|
||||
if (info.hitModel.GetLiquidLevel(pModel, out zDist))
|
||||
@@ -203,13 +204,13 @@ namespace Game.Collision
|
||||
|
||||
iPos = owner.GetPosition();
|
||||
|
||||
Matrix3 iRotation = Matrix3.fromEulerAnglesZYX(owner.GetOrientation(), 0, 0);
|
||||
iInvRot = iRotation.inverse();
|
||||
Matrix4x4 iRotation = Extensions.fromEulerAnglesZYX(owner.GetOrientation(), 0, 0);
|
||||
Matrix4x4.Invert(iRotation, out iInvRot);
|
||||
// transform bounding box:
|
||||
mdl_box = new AxisAlignedBox(mdl_box.Lo * iScale, mdl_box.Hi * iScale);
|
||||
AxisAlignedBox rotated_bounds = new();
|
||||
for (int i = 0; i < 8; ++i)
|
||||
rotated_bounds.merge(iRotation * mdl_box.corner(i));
|
||||
rotated_bounds.merge(Vector3.Transform(mdl_box.corner(i), iRotation));
|
||||
|
||||
iBound = rotated_bounds + iPos;
|
||||
|
||||
@@ -269,7 +270,7 @@ namespace Game.Collision
|
||||
|
||||
bool _collisionEnabled;
|
||||
AxisAlignedBox iBound;
|
||||
Matrix3 iInvRot;
|
||||
Matrix4x4 iInvRot;
|
||||
Vector3 iPos;
|
||||
float iInvScale;
|
||||
float iScale;
|
||||
|
||||
@@ -15,8 +15,9 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using Framework.GameMath;
|
||||
using Framework.Constants;
|
||||
using Framework.GameMath;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.Collision
|
||||
{
|
||||
|
||||
@@ -19,6 +19,7 @@ using Framework.Constants;
|
||||
using Framework.GameMath;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.Collision
|
||||
{
|
||||
@@ -85,7 +86,7 @@ namespace Game.Collision
|
||||
|
||||
public class ModelInstance : ModelMinimalData
|
||||
{
|
||||
Matrix3 iInvRot;
|
||||
Matrix4x4 iInvRot;
|
||||
float iInvScale;
|
||||
WorldModel iModel;
|
||||
|
||||
@@ -107,7 +108,8 @@ namespace Game.Collision
|
||||
|
||||
iModel = model;
|
||||
|
||||
iInvRot = Matrix3.fromEulerAnglesZYX(MathFunctions.PI * spawn.iRot.Y / 180.0f, MathFunctions.PI * spawn.iRot.X / 180.0f, MathFunctions.PI * spawn.iRot.Z / 180.0f).inverse();
|
||||
Matrix4x4.Invert(Extensions.fromEulerAnglesZYX(MathFunctions.PI * spawn.iRot.Y / 180.0f, MathFunctions.PI * spawn.iRot.X / 180.0f, MathFunctions.PI * spawn.iRot.Z / 180.0f), out iInvRot);
|
||||
|
||||
iInvScale = 1.0f / iScale;
|
||||
}
|
||||
|
||||
@@ -121,8 +123,8 @@ namespace Game.Collision
|
||||
return false;
|
||||
|
||||
// child bounds are defined in object space:
|
||||
Vector3 p = iInvRot * (pRay.Origin - iPos) * iInvScale;
|
||||
Ray modRay = new(p, iInvRot * pRay.Direction);
|
||||
Vector3 p = Vector3.Transform((pRay.Origin - iPos) * iInvScale, iInvRot);
|
||||
Ray modRay = new Ray(p, Vector3.Transform(pRay.Direction, iInvRot));
|
||||
float distance = pMaxDist * iInvScale;
|
||||
bool hit = iModel.IntersectRay(modRay, ref distance, pStopAtFirstHit, ignoreFlags);
|
||||
if (hit)
|
||||
@@ -144,8 +146,8 @@ namespace Game.Collision
|
||||
if (!iBound.contains(p))
|
||||
return;
|
||||
// child bounds are defined in object space:
|
||||
Vector3 pModel = iInvRot * (p - iPos) * iInvScale;
|
||||
Vector3 zDirModel = iInvRot * new Vector3(0.0f, 0.0f, -1.0f);
|
||||
Vector3 pModel = Vector3.Transform((p - iPos) * iInvScale, iInvRot);
|
||||
Vector3 zDirModel = Vector3.Transform(new Vector3(0.0f, 0.0f, -1.0f), iInvRot);
|
||||
float zDist;
|
||||
if (iModel.IntersectPoint(pModel, zDirModel, out zDist, info))
|
||||
{
|
||||
@@ -153,7 +155,7 @@ namespace Game.Collision
|
||||
// Transform back to world space. Note that:
|
||||
// Mat * vec == vec * Mat.transpose()
|
||||
// and for rotation matrices: Mat.inverse() == Mat.transpose()
|
||||
float world_Z = ((modelGround * iInvRot) * iScale + iPos).Z;
|
||||
float world_Z = ((Vector3.Transform(modelGround, iInvRot)) * iScale + iPos).Z;
|
||||
if (info.ground_Z < world_Z)
|
||||
{
|
||||
info.ground_Z = world_Z;
|
||||
@@ -165,7 +167,7 @@ namespace Game.Collision
|
||||
public bool GetLiquidLevel(Vector3 p, LocationInfo info, ref float liqHeight)
|
||||
{
|
||||
// child bounds are defined in object space:
|
||||
Vector3 pModel = iInvRot * (p - iPos) * iInvScale;
|
||||
Vector3 pModel = Vector3.Transform((p - iPos) * iInvScale, iInvRot);
|
||||
//Vector3 zDirModel = iInvRot * Vector3(0.f, 0.f, -1.f);
|
||||
float zDist;
|
||||
if (info.hitModel.GetLiquidLevel(pModel, out zDist))
|
||||
@@ -189,8 +191,8 @@ namespace Game.Collision
|
||||
if (!iBound.contains(p))
|
||||
return false;
|
||||
// child bounds are defined in object space:
|
||||
Vector3 pModel = iInvRot * (p - iPos) * iInvScale;
|
||||
Vector3 zDirModel = iInvRot * new Vector3(0.0f, 0.0f, -1.0f);
|
||||
Vector3 pModel = Vector3.Transform((p - iPos) * iInvScale, iInvRot);
|
||||
Vector3 zDirModel = Vector3.Transform(new Vector3(0.0f, 0.0f, -1.0f), iInvRot);
|
||||
float zDist;
|
||||
if (iModel.GetLocationInfo(pModel, zDirModel, out zDist, info))
|
||||
{
|
||||
@@ -198,7 +200,7 @@ namespace Game.Collision
|
||||
// Transform back to world space. Note that:
|
||||
// Mat * vec == vec * Mat.transpose()
|
||||
// and for rotation matrices: Mat.inverse() == Mat.transpose()
|
||||
float world_Z = ((modelGround * iInvRot) * iScale + iPos).Z;
|
||||
float world_Z = (Vector3.Transform(modelGround, iInvRot) * iScale + iPos).Z;
|
||||
if (info.ground_Z < world_Z) // hm...could it be handled automatically with zDist at intersection?
|
||||
{
|
||||
info.ground_Z = world_Z;
|
||||
|
||||
@@ -20,6 +20,7 @@ using Framework.GameMath;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.Collision
|
||||
{
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
using Framework.GameMath;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.Collision
|
||||
{
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.Database;
|
||||
using Framework.GameMath;
|
||||
using Game.Entities;
|
||||
using Game.Maps;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.DataStorage
|
||||
{
|
||||
|
||||
@@ -18,12 +18,12 @@
|
||||
using Framework.Constants;
|
||||
using Framework.Database;
|
||||
using Framework.Dynamic;
|
||||
using Framework.GameMath;
|
||||
using Framework.IO;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Game.DataStorage
|
||||
{
|
||||
|
||||
@@ -19,15 +19,15 @@ using Framework.Collections;
|
||||
using Framework.Constants;
|
||||
using Framework.Database;
|
||||
using Framework.Dynamic;
|
||||
using Framework.GameMath;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
|
||||
namespace Game.DataStorage
|
||||
{
|
||||
|
||||
@@ -17,13 +17,12 @@
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.Database;
|
||||
using Framework.GameMath;
|
||||
using Game.Networking;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Collections;
|
||||
using Framework.Dynamic;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.DataStorage
|
||||
{
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using Framework.GameMath;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.DataStorage
|
||||
{
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.GameMath;
|
||||
using System;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.DataStorage
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.GameMath;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.DataStorage
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.GameMath;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.DataStorage
|
||||
{
|
||||
|
||||
@@ -15,8 +15,7 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.GameMath;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.DataStorage
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.GameMath;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.DataStorage
|
||||
{
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
using Framework.GameMath;
|
||||
using System.IO;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.DataStorage
|
||||
{
|
||||
|
||||
@@ -14,8 +14,9 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.GameMath;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.DataStorage
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.GameMath;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.DataStorage
|
||||
{
|
||||
|
||||
@@ -14,8 +14,9 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
using Framework.GameMath;
|
||||
|
||||
using Framework.Constants;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.DataStorage
|
||||
{
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.GameMath;
|
||||
using System;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.DataStorage
|
||||
{
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.GameMath;
|
||||
|
||||
namespace Game.DataStorage
|
||||
{
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.Dynamic;
|
||||
using Framework.GameMath;
|
||||
using Game.AI;
|
||||
using Game.Maps;
|
||||
using Game.Movement;
|
||||
@@ -26,6 +25,7 @@ using Game.Networking.Packets;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.Entities
|
||||
{
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.Dynamic;
|
||||
using Framework.GameMath;
|
||||
using Game.Networking;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Game.Entities
|
||||
|
||||
@@ -19,7 +19,6 @@ using Framework.Constants;
|
||||
using Framework.Database;
|
||||
using Framework.Dynamic;
|
||||
using Game.AI;
|
||||
using Game.Combat;
|
||||
using Game.DataStorage;
|
||||
using Game.Groups;
|
||||
using Game.Loots;
|
||||
|
||||
@@ -19,7 +19,6 @@ using Framework.Collections;
|
||||
using Framework.Constants;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Framework.Dynamic;
|
||||
using Game.Networking.Packets;
|
||||
using Game.Maps;
|
||||
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
|
||||
using Framework.Collections;
|
||||
using Framework.Constants;
|
||||
using Framework.GameMath;
|
||||
using Game.Conditions;
|
||||
using Game.DataStorage;
|
||||
using Game.Entities;
|
||||
using Game.Networking.Packets;
|
||||
using Game.Spells;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.Misc
|
||||
{
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
using Framework.Constants;
|
||||
using Game.Spells;
|
||||
using Game.Networking;
|
||||
using Game.Networking.Packets;
|
||||
|
||||
namespace Game.Entities
|
||||
{
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.Database;
|
||||
using Framework.GameMath;
|
||||
using Game.AI;
|
||||
using Game.BattleGrounds;
|
||||
using Game.Collision;
|
||||
@@ -25,12 +24,13 @@ using Game.DataStorage;
|
||||
using Game.Groups;
|
||||
using Game.Loots;
|
||||
using Game.Maps;
|
||||
using Game.Networking;
|
||||
using Game.Networking.Packets;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Game.Networking;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.Entities
|
||||
{
|
||||
@@ -246,7 +246,7 @@ namespace Game.Entities
|
||||
GameObjectAddon gameObjectAddon = Global.ObjectMgr.GetGameObjectAddon(GetSpawnId());
|
||||
|
||||
// For most of gameobjects is (0, 0, 0, 1) quaternion, there are only some transports with not standard rotation
|
||||
Quaternion parentRotation = Quaternion.WAxis;
|
||||
Quaternion parentRotation = Quaternion.Identity;
|
||||
if (gameObjectAddon != null)
|
||||
parentRotation = gameObjectAddon.ParentRotation;
|
||||
|
||||
@@ -2191,8 +2191,9 @@ namespace Game.Entities
|
||||
|
||||
public void SetWorldRotation(float qx, float qy, float qz, float qw)
|
||||
{
|
||||
Quaternion rotation = new(qx, qy, qz, qw);
|
||||
rotation.unitize();
|
||||
Quaternion rotation = new Quaternion(qx, qy, qz, qw);
|
||||
rotation = Quaternion.Multiply(rotation, 1.0f / MathF.Sqrt(Quaternion.Dot(rotation, rotation)));
|
||||
|
||||
m_worldRotation.X = rotation.X;
|
||||
m_worldRotation.Y = rotation.Y;
|
||||
m_worldRotation.Z = rotation.Z;
|
||||
@@ -2207,7 +2208,7 @@ namespace Game.Entities
|
||||
|
||||
public void SetWorldRotationAngles(float z_rot, float y_rot, float x_rot)
|
||||
{
|
||||
Quaternion quat = Quaternion.fromEulerAnglesZYX(z_rot, y_rot, x_rot);
|
||||
Quaternion quat = Quaternion.CreateFromRotationMatrix(Extensions.fromEulerAnglesZYX(z_rot, y_rot, x_rot));
|
||||
SetWorldRotation(quat.X, quat.Y, quat.Z, quat.W);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,11 +17,10 @@
|
||||
|
||||
using Framework.Collections;
|
||||
using Framework.Constants;
|
||||
using Framework.GameMath;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using Game.Networking.Packets;
|
||||
using Game.Maps;
|
||||
using Game.Networking.Packets;
|
||||
using System.Numerics;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Game.Entities
|
||||
{
|
||||
|
||||
@@ -15,13 +15,10 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Game.Networking;
|
||||
using Framework.Constants;
|
||||
using Framework.Database;
|
||||
using Game.Networking.Packets;
|
||||
using Game.DataStorage;
|
||||
using System.Linq;
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Game.Networking;
|
||||
using Framework.Constants;
|
||||
using Framework.Database;
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using Framework.GameMath;
|
||||
using Game.Maps;
|
||||
using System;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.Entities
|
||||
{
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.Dynamic;
|
||||
using Framework.GameMath;
|
||||
using Game.DataStorage;
|
||||
using Game.Networking;
|
||||
using Game.Networking.Packets;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.Entities
|
||||
{
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.Dynamic;
|
||||
using Framework.GameMath;
|
||||
using Game.AI;
|
||||
using Game.BattleFields;
|
||||
using Game.DataStorage;
|
||||
@@ -28,6 +27,7 @@ using Game.Scenarios;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.Entities
|
||||
{
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.Database;
|
||||
using Game.Arenas;
|
||||
using Game.BattleGrounds;
|
||||
using Game.DataStorage;
|
||||
using Game.Groups;
|
||||
@@ -32,7 +31,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Game.BattleFields;
|
||||
using Framework.Dynamic;
|
||||
|
||||
namespace Game.Entities
|
||||
{
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.Dynamic;
|
||||
using Game.BattlePets;
|
||||
using Game.DataStorage;
|
||||
using Game.Networking.Packets;
|
||||
using Game.Spells;
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
using Framework.Algorithms;
|
||||
using Framework.Collections;
|
||||
using Framework.Constants;
|
||||
using Framework.GameMath;
|
||||
using Game.DataStorage;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.Entities
|
||||
{
|
||||
|
||||
@@ -16,12 +16,12 @@
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.GameMath;
|
||||
using Game.DataStorage;
|
||||
using Game.Maps;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.Entities
|
||||
{
|
||||
@@ -132,7 +132,7 @@ namespace Game.Entities
|
||||
SetGoAnimProgress(animprogress);
|
||||
SetName(goinfo.name);
|
||||
SetWorldRotation(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
SetParentRotation(Quaternion.WAxis);
|
||||
SetParentRotation(Quaternion.Identity);
|
||||
|
||||
CreateModel();
|
||||
return true;
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
|
||||
using Framework.Collections;
|
||||
using Framework.Constants;
|
||||
using Framework.GameMath;
|
||||
using Game.Networking;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.Entities
|
||||
{
|
||||
|
||||
@@ -17,13 +17,10 @@
|
||||
|
||||
using Framework.Collections;
|
||||
using Framework.Constants;
|
||||
using Framework.Dynamic;
|
||||
using Game.AI;
|
||||
using Game.Combat;
|
||||
using Game.DataStorage;
|
||||
using Game.Maps;
|
||||
using Game.Movement;
|
||||
using Game.Networking;
|
||||
using Game.Networking.Packets;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.Dynamic;
|
||||
using Framework.GameMath;
|
||||
using Game.BattleGrounds;
|
||||
using Game.DataStorage;
|
||||
using Game.Maps;
|
||||
@@ -26,6 +25,7 @@ using Game.Networking.Packets;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.Entities
|
||||
{
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
using Framework.Constants;
|
||||
using Game.AI;
|
||||
using Game.Movement;
|
||||
using Game.Networking.Packets;
|
||||
using Game.Spells;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.Dynamic;
|
||||
using Framework.GameMath;
|
||||
using Game.AI;
|
||||
using Game.BattleGrounds;
|
||||
using Game.Chat;
|
||||
@@ -32,6 +30,7 @@ using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.Entities
|
||||
{
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
using Framework.Constants;
|
||||
using Framework.Database;
|
||||
using Framework.Dynamic;
|
||||
using Framework.GameMath;
|
||||
using Game.DataStorage;
|
||||
using Game.Entities;
|
||||
using Game.Maps;
|
||||
@@ -26,6 +25,7 @@ using Game.Networking.Packets;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.Garrisons
|
||||
{
|
||||
@@ -735,7 +735,7 @@ namespace Game.Garrisons
|
||||
if (finalizeInfo != null)
|
||||
{
|
||||
Position pos2 = finalizeInfo.factionInfo[faction].Pos;
|
||||
GameObject finalizer = GameObject.CreateGameObject(finalizeInfo.factionInfo[faction].GameObjectId, map, pos2, Quaternion.fromEulerAnglesZYX(pos2.GetOrientation(), 0.0f, 0.0f), 255, GameObjectState.Ready);
|
||||
GameObject finalizer = GameObject.CreateGameObject(finalizeInfo.factionInfo[faction].GameObjectId, map, pos2, Quaternion.CreateFromRotationMatrix(Extensions.fromEulerAnglesZYX(pos2.GetOrientation(), 0.0f, 0.0f)), 255, GameObjectState.Ready);
|
||||
if (finalizer)
|
||||
{
|
||||
// set some spell id to make the object delete itself after use
|
||||
|
||||
@@ -19,7 +19,6 @@ using Framework.Collections;
|
||||
using Framework.Constants;
|
||||
using Framework.Database;
|
||||
using Framework.Dynamic;
|
||||
using Framework.GameMath;
|
||||
using Framework.IO;
|
||||
using Game.Conditions;
|
||||
using Game.DataStorage;
|
||||
@@ -32,6 +31,7 @@ using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Game
|
||||
@@ -4257,10 +4257,10 @@ namespace Game
|
||||
gameObjectAddon.invisibilityValue = 1;
|
||||
}
|
||||
|
||||
if (!gameObjectAddon.ParentRotation.isUnit())
|
||||
if (!(Math.Abs(Quaternion.Dot(gameObjectAddon.ParentRotation, gameObjectAddon.ParentRotation) - 1) < 1e-5))
|
||||
{
|
||||
Log.outError(LogFilter.Sql, $"GameObject (GUID: {guid}) has invalid parent rotation in `gameobject_addon`, set to default");
|
||||
gameObjectAddon.ParentRotation = Quaternion.WAxis;
|
||||
gameObjectAddon.ParentRotation = Quaternion.Identity;
|
||||
}
|
||||
|
||||
if (gameObjectAddon.WorldEffectID != 0 && !CliDB.WorldEffectStorage.ContainsKey(gameObjectAddon.WorldEffectID))
|
||||
|
||||
@@ -16,20 +16,10 @@
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.IO;
|
||||
using Game.BattleGrounds;
|
||||
using Game.DataStorage;
|
||||
using Game.Entities;
|
||||
using Game.Groups;
|
||||
using Game.Guilds;
|
||||
using Game.Maps;
|
||||
using Game.Misc;
|
||||
using Game.Networking;
|
||||
using Game.Networking.Packets;
|
||||
using Game.PvP;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Game
|
||||
{
|
||||
|
||||
@@ -16,20 +16,9 @@
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.IO;
|
||||
using Game.BattleGrounds;
|
||||
using Game.DataStorage;
|
||||
using Game.Entities;
|
||||
using Game.Groups;
|
||||
using Game.Guilds;
|
||||
using Game.Maps;
|
||||
using Game.Misc;
|
||||
using Game.Networking;
|
||||
using Game.Networking.Packets;
|
||||
using Game.PvP;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Linq;
|
||||
|
||||
namespace Game
|
||||
|
||||
@@ -20,7 +20,6 @@ using Game.DataStorage;
|
||||
using Game.Entities;
|
||||
using Game.Networking;
|
||||
using Game.Networking.Packets;
|
||||
using System;
|
||||
|
||||
namespace Game
|
||||
{
|
||||
|
||||
@@ -19,7 +19,6 @@ using Framework.Constants;
|
||||
using Game.DataStorage;
|
||||
using Game.Networking;
|
||||
using Game.Networking.Packets;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Game
|
||||
{
|
||||
|
||||
@@ -22,7 +22,6 @@ using Game.Guilds;
|
||||
using Game.Networking;
|
||||
using Game.Networking.Packets;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Game
|
||||
{
|
||||
|
||||
@@ -15,11 +15,6 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Game.Entities;
|
||||
using Game.Networking;
|
||||
using Game.Networking.Packets;
|
||||
|
||||
namespace Game
|
||||
{
|
||||
public partial class WorldSession
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.Database;
|
||||
using Framework.Dynamic;
|
||||
using Game.Conditions;
|
||||
using Game.Entities;
|
||||
|
||||
@@ -17,11 +17,12 @@
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.GameMath;
|
||||
using Game.Collision;
|
||||
using Game.DataStorage;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Game.Collision;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.Maps
|
||||
{
|
||||
@@ -175,7 +176,7 @@ namespace Game.Maps
|
||||
|
||||
_minHeightPlanes = new Plane[8];
|
||||
for (uint quarterIndex = 0; quarterIndex < 8; ++quarterIndex)
|
||||
_minHeightPlanes[quarterIndex] = new Plane(
|
||||
_minHeightPlanes[quarterIndex] = Plane.CreateFromVertices(
|
||||
new Vector3(boundGridCoords[indices[quarterIndex][0]][0], boundGridCoords[indices[quarterIndex][0]][1], minHeights[indices[quarterIndex][0]]),
|
||||
new Vector3(boundGridCoords[indices[quarterIndex][1]][0], boundGridCoords[indices[quarterIndex][1]][1], minHeights[indices[quarterIndex][1]]),
|
||||
new Vector3(boundGridCoords[indices[quarterIndex][2]][0], boundGridCoords[indices[quarterIndex][2]][1], minHeights[indices[quarterIndex][2]])
|
||||
@@ -500,8 +501,7 @@ namespace Game.Maps
|
||||
else
|
||||
quarterIndex = gx > gy ? 1u : 0;
|
||||
|
||||
|
||||
Ray ray = new(new Vector3(gx, gy, 0.0f), Vector3.ZAxis);
|
||||
Ray ray = new(new Vector3(gx, gy, 0.0f), Vector3.UnitZ);
|
||||
return ray.intersection(_minHeightPlanes[quarterIndex]).Z;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
using Framework.Constants;
|
||||
using Framework.Database;
|
||||
using Framework.Dynamic;
|
||||
using Framework.GameMath;
|
||||
using Game.BattleGrounds;
|
||||
using Game.Collision;
|
||||
using Game.DataStorage;
|
||||
@@ -32,6 +31,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.Maps
|
||||
{
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.Database;
|
||||
using Framework.GameMath;
|
||||
using Game.DataStorage;
|
||||
using Game.Entities;
|
||||
using Game.Movement;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.Maps
|
||||
{
|
||||
@@ -186,9 +186,9 @@ namespace Game.Maps
|
||||
allPoints.Add(new Vector3(path[i].Loc.X, path[i].Loc.Y, path[i].Loc.Z));
|
||||
|
||||
// Add extra points to allow derivative calculations for all path nodes
|
||||
allPoints.Insert(0, allPoints.First().lerp(allPoints[1], -0.2f));
|
||||
allPoints.Add(allPoints.Last().lerp(allPoints[^2], -0.2f));
|
||||
allPoints.Add(allPoints.Last().lerp(allPoints[^2], -1.0f));
|
||||
allPoints.Insert(0, Vector3.Lerp(allPoints.First(), allPoints[1], -0.2f));
|
||||
allPoints.Add(Vector3.Lerp(allPoints.Last(), allPoints[^2], -0.2f));
|
||||
allPoints.Add(Vector3.Lerp(allPoints.Last(), allPoints[^2], -1.0f));
|
||||
|
||||
SplineRawInitializer initer = new(allPoints);
|
||||
Spline orientationSpline = new();
|
||||
|
||||
@@ -15,11 +15,6 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Game.Entities;
|
||||
|
||||
namespace Game.Movement
|
||||
|
||||
@@ -16,13 +16,13 @@
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.GameMath;
|
||||
using Game.DataStorage;
|
||||
using Game.Entities;
|
||||
using Game.Maps;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.Movement
|
||||
{
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
using Framework.Constants;
|
||||
using Game.Entities;
|
||||
using System;
|
||||
|
||||
namespace Game.Movement
|
||||
{
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.GameMath;
|
||||
using Game.Entities;
|
||||
using Game.Maps;
|
||||
using System;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.Movement
|
||||
{
|
||||
@@ -481,7 +481,7 @@ namespace Game.Movement
|
||||
Vector3 endVec = new(endPoint[0], endPoint[1], endPoint[2]);
|
||||
Vector3 diffVec = (endVec - startVec);
|
||||
Vector3 prevVec = startVec;
|
||||
float len = diffVec.GetLength();
|
||||
float len = diffVec.Length();
|
||||
diffVec *= 4.0f / len;
|
||||
while (len > 4.0f)
|
||||
{
|
||||
@@ -861,7 +861,7 @@ namespace Game.Movement
|
||||
|
||||
float Dist3DSqr(Vector3 p1, Vector3 p2)
|
||||
{
|
||||
return (p1 - p2).GetLengthSquared();
|
||||
return (p1 - p2).LengthSquared();
|
||||
}
|
||||
|
||||
public void ShortenPathUntilDist(Position pos, float dist) { ShortenPathUntilDist(new Vector3(pos.posX, pos.posY, pos.posZ), dist); }
|
||||
@@ -878,11 +878,11 @@ namespace Game.Movement
|
||||
|
||||
// the first point of the path must be outside the specified range
|
||||
// (this should have really been checked by the caller...)
|
||||
if ((_pathPoints[0] - target).GetLengthSquared() < distSq)
|
||||
if ((_pathPoints[0] - target).LengthSquared() < distSq)
|
||||
return;
|
||||
|
||||
// check if we even need to do anything
|
||||
if ((_pathPoints[0] - target).GetLengthSquared() >= distSq)
|
||||
if ((_pathPoints[0] - target).LengthSquared() >= distSq)
|
||||
return;
|
||||
|
||||
int i = _pathPoints.Length - 1;
|
||||
@@ -893,7 +893,7 @@ namespace Game.Movement
|
||||
while (true)
|
||||
{
|
||||
// we know that pathPoints[i] is too close already (from the previous iteration)
|
||||
if ((_pathPoints[i - 1] - target).GetLengthSquared() >= distSq)
|
||||
if ((_pathPoints[i - 1] - target).LengthSquared() >= distSq)
|
||||
break; // bingo!
|
||||
|
||||
if (--i == 0)
|
||||
@@ -908,7 +908,7 @@ namespace Game.Movement
|
||||
// ok, _pathPoints[i] is too close, _pathPoints[i-1] is not, so our target point is somewhere between the two...
|
||||
// ... settle for a guesstimate since i'm not confident in doing trig on every chase motion tick...
|
||||
// (@todo review this)
|
||||
_pathPoints[i] += (_pathPoints[i - 1] - _pathPoints[i]).directionOrZero() * (dist - (_pathPoints[i] - target).GetLength());
|
||||
_pathPoints[i] += (_pathPoints[i - 1] - _pathPoints[i]).directionOrZero() * (dist - (_pathPoints[i] - target).Length());
|
||||
Array.Resize(ref _pathPoints, i + 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
using Framework.Constants;
|
||||
using Game.Entities;
|
||||
using Game.Maps;
|
||||
using System;
|
||||
|
||||
namespace Game.Movement
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.GameMath;
|
||||
using Game.AI;
|
||||
using Game.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.Movement
|
||||
{
|
||||
|
||||
@@ -16,13 +16,13 @@
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.GameMath;
|
||||
using Game.AI;
|
||||
using Game.DataStorage;
|
||||
using Game.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.Movement
|
||||
{
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.Dynamic;
|
||||
using Framework.GameMath;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.Movement
|
||||
{
|
||||
@@ -52,7 +52,7 @@ namespace Game.Movement
|
||||
effect_start_time = 0;
|
||||
spell_effect_extra = args.spellEffectExtra;
|
||||
anim_tier = args.animTier;
|
||||
splineIsFacingOnly = args.path.Length == 2 && args.facing.type != MonsterMoveType.Normal && ((args.path[1] - args.path[0]).GetLength() < 0.1f);
|
||||
splineIsFacingOnly = args.path.Length == 2 && args.facing.type != MonsterMoveType.Normal && ((args.path[1] - args.path[0]).Length() < 0.1f);
|
||||
|
||||
// Check if its a stop spline
|
||||
if (args.flags.HasFlag(SplineFlag.Done))
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.GameMath;
|
||||
using Game.Entities;
|
||||
using Game.Networking.Packets;
|
||||
using System;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.Movement
|
||||
{
|
||||
|
||||
@@ -16,9 +16,8 @@
|
||||
*/
|
||||
|
||||
using Framework.Dynamic;
|
||||
using Framework.GameMath;
|
||||
using Game.Entities;
|
||||
using System;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.Movement
|
||||
{
|
||||
@@ -80,7 +79,7 @@ namespace Game.Movement
|
||||
{
|
||||
if (path.Length > 2 || facing.type == Framework.Constants.MonsterMoveType.Normal)
|
||||
for (uint i = 0; i < path.Length - 1; ++i)
|
||||
if ((path[i + 1] - path[i]).GetLength() < 0.1f)
|
||||
if ((path[i + 1] - path[i]).Length() < 0.1f)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.GameMath;
|
||||
using Game.Entities;
|
||||
using Game.Maps;
|
||||
using System;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.Movement
|
||||
{
|
||||
@@ -139,14 +139,14 @@ namespace Game.Movement
|
||||
if (cyclic_point == 0)
|
||||
points[0] = controls[count - 1];
|
||||
else
|
||||
points[0] = controls[0].lerp(controls[1], -1);
|
||||
points[0] = Vector3.Lerp(controls[0], controls[1], -1);
|
||||
|
||||
points[high_index + 1] = controls[cyclic_point];
|
||||
points[high_index + 2] = controls[cyclic_point + 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
points[0] = controls[0].lerp(controls[1], -1);
|
||||
points[0] = Vector3.Lerp(controls[0], controls[1], -1);
|
||||
points[high_index + 1] = controls[count - 1];
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ namespace Game.Movement
|
||||
}
|
||||
float SegLengthLinear(int index)
|
||||
{
|
||||
return (points[index] - points[index + 1]).GetLength();
|
||||
return (points[index] - points[index + 1]).Length();
|
||||
}
|
||||
float SegLengthCatmullRom(int index)
|
||||
{
|
||||
@@ -232,7 +232,7 @@ namespace Game.Movement
|
||||
while (i <= 3)
|
||||
{
|
||||
C_Evaluate(p, i / (float)3, s_catmullRomCoeffs, out nextPos);
|
||||
length += (nextPos - curPos).GetLength();
|
||||
length += (nextPos - curPos).Length();
|
||||
curPos = nextPos;
|
||||
++i;
|
||||
}
|
||||
@@ -253,7 +253,7 @@ namespace Game.Movement
|
||||
while (i <= 3)
|
||||
{
|
||||
C_Evaluate(p, i / (float)3, s_Bezier3Coeffs, out nextPos);
|
||||
length += (nextPos - curPos).GetLength();
|
||||
length += (nextPos - curPos).Length();
|
||||
curPos = nextPos;
|
||||
++i;
|
||||
}
|
||||
@@ -296,25 +296,25 @@ namespace Game.Movement
|
||||
|
||||
return i;
|
||||
}
|
||||
private static readonly Matrix4 s_catmullRomCoeffs = new(-0.5f, 1.5f, -1.5f, 0.5f, 1.0f, -2.5f, 2.0f, -0.5f, -0.5f, 0.0f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f);
|
||||
private static readonly Matrix4x4 s_catmullRomCoeffs = new(-0.5f, 1.5f, -1.5f, 0.5f, 1.0f, -2.5f, 2.0f, -0.5f, -0.5f, 0.0f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f);
|
||||
|
||||
private static readonly Matrix4 s_Bezier3Coeffs = new(-1.0f, 3.0f, -3.0f, 1.0f, 3.0f, -6.0f, 3.0f, 0.0f, -3.0f, 3.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f);
|
||||
private static readonly Matrix4x4 s_Bezier3Coeffs = new(-1.0f, 3.0f, -3.0f, 1.0f, 3.0f, -6.0f, 3.0f, 0.0f, -3.0f, 3.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
void C_Evaluate(Span<Vector3> vertice, float t, Matrix4 matr, out Vector3 result)
|
||||
void C_Evaluate(Span<Vector3> vertice, float t, Matrix4x4 matr, out Vector3 result)
|
||||
{
|
||||
Vector4 tvec = new(t * t * t, t * t, t, 1.0f);
|
||||
Vector4 weights = (tvec * matr);
|
||||
Vector4 weights = Vector4.Transform(tvec, matr);
|
||||
|
||||
result = vertice[0] * weights[0] + vertice[1] * weights[1]
|
||||
+ vertice[2] * weights[2] + vertice[3] * weights[3];
|
||||
result = vertice[0] * weights.X + vertice[1] * weights.Y
|
||||
+ vertice[2] * weights.Z + vertice[3] * weights.W;
|
||||
}
|
||||
void C_Evaluate_Derivative(Span<Vector3> vertice, float t, Matrix4 matr, out Vector3 result)
|
||||
void C_Evaluate_Derivative(Span<Vector3> vertice, float t, Matrix4x4 matr, out Vector3 result)
|
||||
{
|
||||
Vector4 tvec = new(3.0f * t * t, 2.0f * t, 1.0f, 0.0f);
|
||||
Vector4 weights = (tvec * matr);
|
||||
Vector4 weights = Vector4.Transform(tvec, matr);
|
||||
|
||||
result = vertice[0] * weights[0] + vertice[1] * weights[1]
|
||||
+ vertice[2] * weights[2] + vertice[3] * weights[3];
|
||||
result = vertice[0] * weights.X + vertice[1] * weights.Y
|
||||
+ vertice[2] * weights.Z + vertice[3] * weights.W;
|
||||
}
|
||||
|
||||
public int Length() { return lengths[index_hi];}
|
||||
|
||||
@@ -15,12 +15,6 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Game.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Framework.Dynamic;
|
||||
|
||||
namespace Game.Networking.Packets
|
||||
{
|
||||
public struct AddOnInfo
|
||||
|
||||
@@ -16,10 +16,6 @@
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.Dynamic;
|
||||
using Framework.GameMath;
|
||||
using Game.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Game.Networking.Packets
|
||||
|
||||
@@ -15,13 +15,6 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.Dynamic;
|
||||
using Framework.GameMath;
|
||||
using Game.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Game.Networking.Packets
|
||||
{
|
||||
class AdventureMapStartQuest : ClientPacket
|
||||
|
||||
@@ -17,10 +17,9 @@
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.Dynamic;
|
||||
using Framework.GameMath;
|
||||
using Game.Entities;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.Networking.Packets
|
||||
{
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
using Framework.Constants;
|
||||
using Game.Entities;
|
||||
using Framework.Dynamic;
|
||||
|
||||
namespace Game.Networking.Packets
|
||||
{
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.Dynamic;
|
||||
using Framework.GameMath;
|
||||
using Game.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.Networking.Packets
|
||||
{
|
||||
|
||||
@@ -18,11 +18,11 @@
|
||||
using Framework.Constants;
|
||||
using Framework.Database;
|
||||
using Framework.Dynamic;
|
||||
using Framework.GameMath;
|
||||
using Framework.IO;
|
||||
using Game.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.Networking.Packets
|
||||
{
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
using Framework.Constants;
|
||||
using Framework.IO;
|
||||
using Game.Entities;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Game.Networking.Packets
|
||||
{
|
||||
|
||||
@@ -16,11 +16,8 @@
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.Dynamic;
|
||||
using Framework.IO;
|
||||
using Game.Entities;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using Game.DataStorage;
|
||||
|
||||
namespace Game.Networking.Packets
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.Dynamic;
|
||||
using Framework.GameMath;
|
||||
using Game.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.Networking.Packets
|
||||
{
|
||||
|
||||
@@ -17,11 +17,11 @@
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.Dynamic;
|
||||
using Framework.GameMath;
|
||||
using Game.Entities;
|
||||
using Game.Movement;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.Networking.Packets
|
||||
{
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.GameMath;
|
||||
using Framework.Dynamic;
|
||||
using Game.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Framework.Dynamic;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.Networking.Packets
|
||||
{
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
*/
|
||||
|
||||
using Framework.Constants;
|
||||
using Framework.GameMath;
|
||||
using Game.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Game.Networking.Packets
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user