*Update movement enums - thanks to Zor for info.
*Add functions for position data streaming. --HG-- branch : trunk
This commit is contained in:
@@ -117,44 +117,9 @@ class ZoneScript;
|
||||
class Unit;
|
||||
class Transport;
|
||||
|
||||
|
||||
typedef UNORDERED_MAP<Player*, UpdateData> UpdateDataMapType;
|
||||
|
||||
struct MovementInfo
|
||||
{
|
||||
// common
|
||||
uint64 guid;
|
||||
uint32 flags;
|
||||
uint16 unk1;
|
||||
uint32 time;
|
||||
float x, y, z, o;
|
||||
// transport
|
||||
uint64 t_guid;
|
||||
float t_x, t_y, t_z, t_o;
|
||||
uint32 t_time;
|
||||
int8 t_seat;
|
||||
// swimming and unknown
|
||||
float s_pitch;
|
||||
// last fall time
|
||||
uint32 fallTime;
|
||||
// jumping
|
||||
float j_zspeed, j_sinAngle, j_cosAngle, j_xyspeed;
|
||||
// spline
|
||||
float u_unk1;
|
||||
|
||||
MovementInfo()
|
||||
{
|
||||
flags = 0;
|
||||
time = t_time = fallTime = 0;
|
||||
unk1 = 0;
|
||||
x = y = z = o = t_x = t_y = t_z = t_o = s_pitch = j_zspeed = j_sinAngle = j_cosAngle = j_xyspeed = u_unk1 = 0.0f;
|
||||
t_guid = 0;
|
||||
}
|
||||
|
||||
uint32 GetMovementFlags() { return flags; }
|
||||
void AddMovementFlag(uint32 flag) { flags |= flag; }
|
||||
bool HasMovementFlag(uint32 flag) const { return flags & flag; }
|
||||
};
|
||||
|
||||
class Object
|
||||
{
|
||||
public:
|
||||
@@ -405,6 +370,18 @@ class Object
|
||||
|
||||
struct Position
|
||||
{
|
||||
struct PositionXYZStreamer
|
||||
{
|
||||
explicit PositionXYZStreamer(Position& pos) : m_pos(&pos) {}
|
||||
Position* m_pos;
|
||||
};
|
||||
|
||||
struct PositionXYZOStreamer
|
||||
{
|
||||
explicit PositionXYZOStreamer(Position& pos) : m_pos(&pos) {}
|
||||
Position* m_pos;
|
||||
};
|
||||
|
||||
float m_positionX;
|
||||
float m_positionY;
|
||||
float m_positionZ;
|
||||
@@ -440,6 +417,15 @@ struct Position
|
||||
pos->Relocate(m_positionX, m_positionY, m_positionZ, m_orientation);
|
||||
}
|
||||
|
||||
Position::PositionXYZStreamer PositionXYZStream()
|
||||
{
|
||||
return Position::PositionXYZStreamer(*this);
|
||||
}
|
||||
Position::PositionXYZOStreamer PositionXYZOStream()
|
||||
{
|
||||
return Position::PositionXYZOStreamer(*this);
|
||||
}
|
||||
|
||||
bool IsPositionValid() const;
|
||||
|
||||
float GetExactDist2dSq(float x, float y) const
|
||||
@@ -477,6 +463,50 @@ struct Position
|
||||
bool HasInArc(float arcangle, const Position *pos) const;
|
||||
bool HasInLine(const Unit *target, float distance, float width) const;
|
||||
};
|
||||
ByteBuffer &operator>>(ByteBuffer& buf, Position::PositionXYZOStreamer const & streamer);
|
||||
ByteBuffer & operator<<(ByteBuffer& buf, Position::PositionXYZStreamer const & streamer);
|
||||
ByteBuffer &operator>>(ByteBuffer& buf, Position::PositionXYZStreamer const & streamer);
|
||||
ByteBuffer & operator<<(ByteBuffer& buf, Position::PositionXYZOStreamer const & streamer);
|
||||
|
||||
struct MovementInfo
|
||||
{
|
||||
// common
|
||||
uint64 guid;
|
||||
uint32 flags;
|
||||
uint16 flags2;
|
||||
Position pos;
|
||||
uint32 time;
|
||||
// transport
|
||||
uint64 t_guid;
|
||||
Position t_pos;
|
||||
uint32 t_time;
|
||||
uint32 t_time2;
|
||||
int8 t_seat;
|
||||
// swimming/flying
|
||||
float pitch;
|
||||
// falling
|
||||
uint32 fallTime;
|
||||
// jumping
|
||||
float j_zspeed, j_sinAngle, j_cosAngle, j_xyspeed;
|
||||
// spline
|
||||
float splineElevation;
|
||||
|
||||
MovementInfo()
|
||||
{
|
||||
guid = 0;
|
||||
flags = 0;
|
||||
flags2 = 0;
|
||||
time = t_time = fallTime = 0;
|
||||
splineElevation = 0;
|
||||
pitch = j_zspeed = j_sinAngle = j_cosAngle = j_xyspeed = 0.0f;
|
||||
t_guid = 0;
|
||||
t_seat = -1;
|
||||
}
|
||||
|
||||
uint32 GetMovementFlags() { return flags; }
|
||||
void AddMovementFlag(uint32 flag) { flags |= flag; }
|
||||
bool HasMovementFlag(uint32 flag) const { return flags & flag; }
|
||||
};
|
||||
|
||||
#define MAPID_INVALID 0xFFFFFFFF
|
||||
|
||||
|
||||
Reference in New Issue
Block a user