Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gameobject refactoring #4968

Closed
wants to merge 12 commits into from
9 changes: 9 additions & 0 deletions sql/updates/world/2012_01_15_01_world_gameobject_addon.sql
@@ -0,0 +1,9 @@
DROP TABLE IF EXISTS `gameobject_addon`;
CREATE TABLE `gameobject_addon` (
`guid` int(10) unsigned NOT NULL default '0',
`path_rotation0` float NOT NULL default '0',
`path_rotation1` float NOT NULL default '0',
`path_rotation2` float NOT NULL default '0',
`path_rotation3` float NOT NULL default '1',
PRIMARY KEY (`guid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Gameobject System';
2 changes: 1 addition & 1 deletion src/server/game/Battlegrounds/Battleground.cpp
Expand Up @@ -1420,7 +1420,7 @@ bool Battleground::AddObject(uint32 type, uint32 entry, float x, float y, float
// So we must create it specific for this instance // So we must create it specific for this instance
GameObject* go = new GameObject; GameObject* go = new GameObject;
if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, GetBgMap(), if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, GetBgMap(),
PHASEMASK_NORMAL, x, y, z, o, rotation0, rotation1, rotation2, rotation3, 100, GO_STATE_READY)) PHASEMASK_NORMAL, x, y, z, o, QuaternionData(rotation0, rotation1, rotation2, rotation3)))
{ {
sLog->outErrorDb("Battleground::AddObject: cannot create gameobject (entry: %u) for BG (map: %u, instance id: %u)!", sLog->outErrorDb("Battleground::AddObject: cannot create gameobject (entry: %u) for BG (map: %u, instance id: %u)!",
entry, m_MapId, m_InstanceID); entry, m_MapId, m_InstanceID);
Expand Down
4 changes: 2 additions & 2 deletions src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
Expand Up @@ -114,8 +114,8 @@ bool BattlegroundSA::ResetObjs()
} }


// MAD props for Kiper for discovering those values - 4 hours of his work. // MAD props for Kiper for discovering those values - 4 hours of his work.
GetBGObject(BG_SA_BOAT_ONE)->UpdateRotationFields(1.0f, 0.0002f); GetBGObject(BG_SA_BOAT_ONE)->SetWorldRotationAngles(1.0f, 0.0002f, 0.0f);
GetBGObject(BG_SA_BOAT_TWO)->UpdateRotationFields(1.0f, 0.00001f); GetBGObject(BG_SA_BOAT_TWO)->SetWorldRotationAngles(1.0f, 0.00001f, 0.0f);
SpawnBGObject(BG_SA_BOAT_ONE, RESPAWN_IMMEDIATELY); SpawnBGObject(BG_SA_BOAT_ONE, RESPAWN_IMMEDIATELY);
SpawnBGObject(BG_SA_BOAT_TWO, RESPAWN_IMMEDIATELY); SpawnBGObject(BG_SA_BOAT_TWO, RESPAWN_IMMEDIATELY);


Expand Down
121 changes: 79 additions & 42 deletions src/server/game/Entities/GameObject/GameObject.cpp
Expand Up @@ -16,6 +16,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>. * with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */


#include <G3D/Quat.h>

#include "GameObjectAI.h" #include "GameObjectAI.h"
#include "ObjectMgr.h" #include "ObjectMgr.h"
#include "GroupMgr.h" #include "GroupMgr.h"
Expand Down Expand Up @@ -50,7 +52,7 @@ GameObject::GameObject() : WorldObject(false), m_goValue(new GameObjectValue), m
m_goData = NULL; m_goData = NULL;


m_DBTableGuid = 0; m_DBTableGuid = 0;
m_rotation = 0; m_packedRotation = 0;


m_groupLootTimer = 0; m_groupLootTimer = 0;
lootingGroupLowGUID = 0; lootingGroupLowGUID = 0;
Expand Down Expand Up @@ -145,7 +147,7 @@ void GameObject::RemoveFromWorld()
} }
} }


bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMask, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, GOState go_state, uint32 artKit) bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMask, float x, float y, float z, float ang, QuaternionData rotation, uint8 animprogress, GOState go_state, uint32 artKit)
{ {
ASSERT(map); ASSERT(map);
SetMap(map); SetMap(map);
Expand Down Expand Up @@ -184,16 +186,21 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa
return false; return false;
} }


SetFloatValue(GAMEOBJECT_PARENTROTATION+0, rotation0); SetWorldRotation(rotation.x, rotation.y, rotation.z, rotation.w);
SetFloatValue(GAMEOBJECT_PARENTROTATION+1, rotation1); // For most of gameobjects is (0, 0, 0, 1) quaternion, only some transports has not standart rotation

if (GameObjectDataAddon const* addon = sObjectMgr->GetGameObjectAddonTemplate(guidlow))
UpdateRotationFields(rotation2, rotation3); // GAMEOBJECT_FACING, GAMEOBJECT_ROTATION, GAMEOBJECT_PARENTROTATION+2/3 SetTransportPathRotation(addon->path_rotation);
else
SetTransportPathRotation(QuaternionData(0,0,0,1));


SetFloatValue(OBJECT_FIELD_SCALE_X, goinfo->size); SetFloatValue(OBJECT_FIELD_SCALE_X, goinfo->size);


SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction); SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction);
SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags); SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags);


if (goinfo->type == GAMEOBJECT_TYPE_TRANSPORT)
SetFlag(GAMEOBJECT_FLAGS, (GO_FLAG_TRANSPORT | GO_FLAG_NODESPAWN));

SetEntry(goinfo->entry); SetEntry(goinfo->entry);


// set name for logs usage, doesn't affect anything ingame // set name for logs usage, doesn't affect anything ingame
Expand Down Expand Up @@ -294,7 +301,6 @@ void GameObject::Update(uint32 diff)
if (caster && caster->GetTypeId() == TYPEID_PLAYER) if (caster && caster->GetTypeId() == TYPEID_PLAYER)
{ {
SetGoState(GO_STATE_ACTIVE); SetGoState(GO_STATE_ACTIVE);
SetUInt32Value(GAMEOBJECT_FLAGS, GO_FLAG_NODESPAWN);


UpdateData udata; UpdateData udata;
WorldPacket packet; WorldPacket packet;
Expand Down Expand Up @@ -659,10 +665,10 @@ void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
data.posY = GetPositionY(); data.posY = GetPositionY();
data.posZ = GetPositionZ(); data.posZ = GetPositionZ();
data.orientation = GetOrientation(); data.orientation = GetOrientation();
data.rotation0 = GetFloatValue(GAMEOBJECT_PARENTROTATION+0); data.rotation.x = m_worldRotation.x;
data.rotation1 = GetFloatValue(GAMEOBJECT_PARENTROTATION+1); data.rotation.y = m_worldRotation.y;
data.rotation2 = GetFloatValue(GAMEOBJECT_PARENTROTATION+2); data.rotation.z = m_worldRotation.z;
data.rotation3 = GetFloatValue(GAMEOBJECT_PARENTROTATION+3); data.rotation.w = m_worldRotation.w;
data.spawntimesecs = m_spawnedByDefault ? m_respawnDelayTime : -(int32)m_respawnDelayTime; data.spawntimesecs = m_spawnedByDefault ? m_respawnDelayTime : -(int32)m_respawnDelayTime;
data.animprogress = GetGoAnimProgress(); data.animprogress = GetGoAnimProgress();
data.go_state = GetGoState(); data.go_state = GetGoState();
Expand All @@ -681,10 +687,10 @@ void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
<< GetPositionY() << ',' << GetPositionY() << ','
<< GetPositionZ() << ',' << GetPositionZ() << ','
<< GetOrientation() << ',' << GetOrientation() << ','
<< GetFloatValue(GAMEOBJECT_PARENTROTATION) << ',' << m_worldRotation.x << ','
<< GetFloatValue(GAMEOBJECT_PARENTROTATION+1) << ',' << m_worldRotation.y << ','
<< GetFloatValue(GAMEOBJECT_PARENTROTATION+2) << ',' << m_worldRotation.z << ','
<< GetFloatValue(GAMEOBJECT_PARENTROTATION+3) << ',' << m_worldRotation.w << ','
<< m_respawnDelayTime << ',' << m_respawnDelayTime << ','
<< uint32(GetGoAnimProgress()) << ',' << uint32(GetGoAnimProgress()) << ','
<< uint32(GetGoState()) << ')'; << uint32(GetGoState()) << ')';
Expand Down Expand Up @@ -713,19 +719,14 @@ bool GameObject::LoadGameObjectFromDB(uint32 guid, Map* map, bool addToMap)
float z = data->posZ; float z = data->posZ;
float ang = data->orientation; float ang = data->orientation;


float rotation0 = data->rotation0; uint8 animprogress = data->animprogress;
float rotation1 = data->rotation1;
float rotation2 = data->rotation2;
float rotation3 = data->rotation3;

uint32 animprogress = data->animprogress;
GOState go_state = data->go_state; GOState go_state = data->go_state;
uint32 artKit = data->artKit; uint32 artKit = data->artKit;


m_DBTableGuid = guid; m_DBTableGuid = guid;
if (map->GetInstanceId() != 0) guid = sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT); if (map->GetInstanceId() != 0) guid = sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT);


if (!Create(guid, entry, map, phaseMask, x, y, z, ang, rotation0, rotation1, rotation2, rotation3, animprogress, go_state, artKit)) if (!Create(guid, entry, map, phaseMask, x, y, z, ang, data->rotation, animprogress, go_state, artKit))
return false; return false;


if (data->spawntimesecs >= 0) if (data->spawntimesecs >= 0)
Expand Down Expand Up @@ -1691,34 +1692,70 @@ const char* GameObject::GetNameForLocaleIdx(LocaleConstant loc_idx) const
return GetName(); return GetName();
} }


void GameObject::UpdateRotationFields(float rotation2 /*=0.0f*/, float rotation3 /*=0.0f*/) using G3D::Quat;
struct QuaternionCompressed
{ {
static double const atan_pow = atan(pow(2.0f, -20.0f)); QuaternionCompressed() : m_raw(0) {}
QuaternionCompressed(int64 val) : m_raw(val) {}
QuaternionCompressed(const Quat& quat) { Set(quat); }


double f_rot1 = sin(GetOrientation() / 2.0f); enum
double f_rot2 = cos(GetOrientation() / 2.0f); {
PACK_COEFF_YZ = 1 << 20,
PACK_COEFF_X = 1 << 21,
};


int64 i_rot1 = int64(f_rot1 / atan_pow *(f_rot2 >= 0 ? 1.0f : -1.0f)); void Set(const Quat& quat)
int64 rotation = (i_rot1 << 43 >> 43) & 0x00000000001FFFFF; {
int8 w_sign = (quat.w >= 0 ? 1 : -1);
int64 X = int32(quat.x * PACK_COEFF_X) * w_sign & ((1 << 22) - 1);
int64 Y = int32(quat.y * PACK_COEFF_YZ) * w_sign & ((1 << 21) - 1);
int64 Z = int32(quat.z * PACK_COEFF_YZ) * w_sign & ((1 << 21) - 1);
m_raw = Z | (Y << 21) | (X << 42);
}


//float f_rot2 = sin(0.0f / 2.0f); Quat Unpack() const
//int64 i_rot2 = f_rot2 / atan(pow(2.0f, -20.0f)); {
//rotation |= (((i_rot2 << 22) >> 32) >> 11) & 0x000003FFFFE00000; double x = (double)(m_raw >> 42) / (double)PACK_COEFF_X;
double y = (double)(m_raw << 22 >> 43) / (double)PACK_COEFF_YZ;
double z = (double)(m_raw << 43 >> 43) / (double)PACK_COEFF_YZ;
double w = 1 - (x * x + y * y + z * z);
ASSERT(w >= 0);
w = sqrt(w);

return Quat(x,y,z,w);
}


//float f_rot3 = sin(0.0f / 2.0f); int64 m_raw;
//int64 i_rot3 = f_rot3 / atan(pow(2.0f, -21.0f)); };
//rotation |= (i_rot3 >> 42) & 0x7FFFFC0000000000;


m_rotation = rotation; void GameObject::SetWorldRotation(float qx, float qy, float qz, float qw)
{
Quat rotation(qx, qy, qz, qw);
// Temporary solution for gameobjects that has no rotation data in DB:
if (qz == 0.f && qw == 0.f)
rotation = Quat::fromAxisAngleRotation(G3D::Vector3::unitZ(), GetOrientation());

rotation.unitize();
m_packedRotation = QuaternionCompressed(rotation).m_raw;
m_worldRotation.x = rotation.x;
m_worldRotation.y = rotation.y;
m_worldRotation.z = rotation.z;
m_worldRotation.w = rotation.w;
}


if (rotation2 == 0.0f && rotation3 == 0.0f) void GameObject::SetTransportPathRotation(QuaternionData rotation)
{ {
rotation2 = (float)f_rot1; SetFloatValue(GAMEOBJECT_PARENTROTATION + 0, rotation.x);
rotation3 = (float)f_rot2; SetFloatValue(GAMEOBJECT_PARENTROTATION + 1, rotation.y);
} SetFloatValue(GAMEOBJECT_PARENTROTATION + 2, rotation.z);
SetFloatValue(GAMEOBJECT_PARENTROTATION + 3, rotation.w);
}


SetFloatValue(GAMEOBJECT_PARENTROTATION+2, rotation2); void GameObject::SetWorldRotationAngles(float z_rot, float y_rot, float x_rot)
SetFloatValue(GAMEOBJECT_PARENTROTATION+3, rotation3); {
Quat quat( G3D::Matrix3::fromEulerAnglesZYX(z_rot, y_rot, x_rot) );
SetWorldRotation(quat.x, quat.y, quat.z, quat.w);
} }


void GameObject::ModifyHealth(int32 change, Unit* attackerOrHealer /*= NULL*/, uint32 spellId /*= 0*/) void GameObject::ModifyHealth(int32 change, Unit* attackerOrHealer /*= NULL*/, uint32 spellId /*= 0*/)
Expand Down
39 changes: 31 additions & 8 deletions src/server/game/Entities/GameObject/GameObject.h
Expand Up @@ -573,6 +573,16 @@ enum GOState


#define MAX_GO_STATE 3 #define MAX_GO_STATE 3


struct QuaternionData
{
float x, y, z, w;

QuaternionData() : x(0.f), y(0.f), z(0.f), w(0.f) {}
QuaternionData(float X, float Y, float Z, float W) : x(X), y(Y), z(Z), w(W) {}

bool isUnit() const { return fabs(x*x + y*y + z*z + w*w - 1.f) < 1e-5;}
};

// from `gameobject` // from `gameobject`
struct GameObjectData struct GameObjectData
{ {
Expand All @@ -584,10 +594,7 @@ struct GameObjectData
float posY; float posY;
float posZ; float posZ;
float orientation; float orientation;
float rotation0; QuaternionData rotation;
float rotation1;
float rotation2;
float rotation3;
int32 spawntimesecs; int32 spawntimesecs;
uint32 animprogress; uint32 animprogress;
GOState go_state; GOState go_state;
Expand All @@ -596,6 +603,15 @@ struct GameObjectData
bool dbData; bool dbData;
}; };


// from `gameobject_addon`
struct GameObjectDataAddon
{
uint32 guid;
QuaternionData path_rotation;
};

typedef UNORDERED_MAP<uint32, GameObjectDataAddon> GameObjectAddonContainer;

// For containers: [GO_NOT_READY]->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED->GO_READY -> ... // For containers: [GO_NOT_READY]->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED->GO_READY -> ...
// For bobber: GO_NOT_READY ->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED-><deleted> // For bobber: GO_NOT_READY ->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED-><deleted>
// For door(closed):[GO_NOT_READY]->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED->GO_READY(close) -> ... // For door(closed):[GO_NOT_READY]->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED->GO_READY(close) -> ...
Expand All @@ -613,6 +629,8 @@ class Unit;
// 5 sec for bobber catch // 5 sec for bobber catch
#define FISHING_BOBBER_READY_TIME 5 #define FISHING_BOBBER_READY_TIME 5


#define GO_ANIMPROGRESS_DEFAULT 0xFF

class GameObject : public WorldObject, public GridObject<GameObject> class GameObject : public WorldObject, public GridObject<GameObject>
{ {
public: public:
Expand All @@ -623,7 +641,8 @@ class GameObject : public WorldObject, public GridObject<GameObject>
void RemoveFromWorld(); void RemoveFromWorld();
void CleanupsBeforeDelete(bool finalCleanup = true); void CleanupsBeforeDelete(bool finalCleanup = true);


bool Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMask, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, GOState go_state, uint32 artKit = 0); bool Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMask, float x, float y, float z, float ang,
QuaternionData rotation = QuaternionData(), uint8 animprogress = GO_ANIMPROGRESS_DEFAULT, GOState go_state = GO_STATE_READY, uint32 artKit = 0);
void Update(uint32 p_time); void Update(uint32 p_time);
static GameObject* GetGameObject(WorldObject& object, uint64 guid); static GameObject* GetGameObject(WorldObject& object, uint64 guid);
GameObjectTemplate const* GetGOInfo() const { return m_goInfo; } GameObjectTemplate const* GetGOInfo() const { return m_goInfo; }
Expand All @@ -635,7 +654,11 @@ class GameObject : public WorldObject, public GridObject<GameObject>


uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; } uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; }


void UpdateRotationFields(float rotation2 = 0.0f, float rotation3 = 0.0f); // z_rot, y_rot, x_rot - rotation angles around z, y and x axes
void SetWorldRotationAngles(float z_rot, float y_rot, float x_rot);
void SetWorldRotation(float qx, float qy, float qz, float qw);
void SetTransportPathRotation(QuaternionData rotation); // transforms(rotates) transport's path
int64 GetPackedWorldRotation() const { return m_packedRotation; }


void Say(int32 textId, uint32 language, uint64 TargetGuid) { MonsterSay(textId, language, TargetGuid); } void Say(int32 textId, uint32 language, uint64 TargetGuid) { MonsterSay(textId, language, TargetGuid); }
void Yell(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYell(textId, language, TargetGuid); } void Yell(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYell(textId, language, TargetGuid); }
Expand Down Expand Up @@ -784,7 +807,6 @@ class GameObject : public WorldObject, public GridObject<GameObject>


void EventInform(uint32 eventId); void EventInform(uint32 eventId);


uint64 GetRotation() const { return m_rotation; }
virtual uint32 GetScriptId() const { return GetGOInfo()->ScriptId; } virtual uint32 GetScriptId() const { return GetGOInfo()->ScriptId; }
GameObjectAI* AI() const { return m_AI; } GameObjectAI* AI() const { return m_AI; }


Expand Down Expand Up @@ -812,7 +834,8 @@ class GameObject : public WorldObject, public GridObject<GameObject>
GameObjectData const* m_goData; GameObjectData const* m_goData;
GameObjectValue * const m_goValue; GameObjectValue * const m_goValue;


uint64 m_rotation; int64 m_packedRotation;
QuaternionData m_worldRotation;


uint16 m_LootMode; // bitmask, default LOOT_MODE_DEFAULT, determines what loot will be lootable uint16 m_LootMode; // bitmask, default LOOT_MODE_DEFAULT, determines what loot will be lootable
private: private:
Expand Down
4 changes: 2 additions & 2 deletions src/server/game/Entities/Object/Object.cpp
Expand Up @@ -427,7 +427,7 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags) const
// 0x200 // 0x200
if (flags & UPDATEFLAG_ROTATION) if (flags & UPDATEFLAG_ROTATION)
{ {
*data << int64(((GameObject*)this)->GetRotation()); *data << int64(((GameObject*)this)->GetPackedWorldRotation());
} }
} }


Expand Down Expand Up @@ -2360,7 +2360,7 @@ GameObject* WorldObject::SummonGameObject(uint32 entry, float x, float y, float
} }
Map* map = GetMap(); Map* map = GetMap();
GameObject* go = new GameObject(); GameObject* go = new GameObject();
if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, map, GetPhaseMask(), x, y, z, ang, rotation0, rotation1, rotation2, rotation3, 100, GO_STATE_READY)) if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, map, GetPhaseMask(), x, y, z, ang, QuaternionData(rotation0, rotation1, rotation2, rotation3)))
{ {
delete go; delete go;
return NULL; return NULL;
Expand Down
13 changes: 7 additions & 6 deletions src/server/game/Entities/Transport/Transport.cpp
Expand Up @@ -190,7 +190,7 @@ Transport::~Transport()
m_passengers.clear(); m_passengers.clear();
} }


bool Transport::Create(uint32 guidlow, uint32 entry, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress, uint32 dynflags) bool Transport::Create(uint32 guidlow, uint32 entry, uint32 mapid, float x, float y, float z, float ang, uint8 animprogress, uint16 dynamicHighValue)
{ {
Relocate(x, y, z, ang); Relocate(x, y, z, ang);
// instance id and phaseMask isn't set to values different from std. // instance id and phaseMask isn't set to values different from std.
Expand All @@ -217,19 +217,20 @@ bool Transport::Create(uint32 guidlow, uint32 entry, uint32 mapid, float x, floa
SetFloatValue(OBJECT_FIELD_SCALE_X, goinfo->size); SetFloatValue(OBJECT_FIELD_SCALE_X, goinfo->size);


SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction); SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction);
//SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags); SetUInt32Value(GAMEOBJECT_FLAGS, (GO_FLAG_TRANSPORT | GO_FLAG_NODESPAWN));
SetUInt32Value(GAMEOBJECT_FLAGS, MAKE_PAIR32(0x28, 0x64));
SetUInt32Value(GAMEOBJECT_LEVEL, m_period); SetUInt32Value(GAMEOBJECT_LEVEL, m_period);
SetEntry(goinfo->entry); SetEntry(goinfo->entry);


SetUInt32Value(GAMEOBJECT_DISPLAYID, goinfo->displayId); SetUInt32Value(GAMEOBJECT_DISPLAYID, goinfo->displayId);


SetGoState(GO_STATE_READY); SetGoState(GO_STATE_READY);
SetGoType(GameobjectTypes(goinfo->type)); SetGoType(GameobjectTypes(goinfo->type));

SetGoArtKit(0);
SetGoAnimProgress(animprogress); SetGoAnimProgress(animprogress);
if (dynflags)
SetUInt32Value(GAMEOBJECT_DYNAMIC, MAKE_PAIR32(0, dynflags)); // low part always 0, dynamicHighValue is some kind of progression (not implemented)
SetUInt16Value(GAMEOBJECT_DYNAMIC, 0, 0);
SetUInt16Value(GAMEOBJECT_DYNAMIC, 1, dynamicHighValue);


SetName(goinfo->name); SetName(goinfo->name);


Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Entities/Transport/Transport.h
Expand Up @@ -31,7 +31,7 @@ class Transport : public GameObject
Transport(uint32 period, uint32 script); Transport(uint32 period, uint32 script);
~Transport(); ~Transport();


bool Create(uint32 guidlow, uint32 entry, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress, uint32 dynflags); bool Create(uint32 guidlow, uint32 entry, uint32 mapid, float x, float y, float z, float ang, uint8 animprogress, uint16 dynamicHighValue);
bool GenerateWaypoints(uint32 pathid, std::set<uint32> &mapids); bool GenerateWaypoints(uint32 pathid, std::set<uint32> &mapids);
void Update(uint32 p_time); void Update(uint32 p_time);
bool AddPassenger(Player* passenger); bool AddPassenger(Player* passenger);
Expand Down