[10600] Correct size of animprogress for GO Create()

Add a default define and use it instead of hard coded value.
Some additional minor corrections for transport GO's

Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
NoFantasy 2010-10-10 13:26:48 +02:00
parent 0205adfde1
commit 2fe45365c0
9 changed files with 28 additions and 21 deletions

View file

@ -1386,7 +1386,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,rotation0,rotation1,rotation2,rotation3,GO_ANIMPROGRESS_DEFAULT,GO_STATE_READY))
{ {
sLog.outErrorDb("Gameobject template %u not found in database! BattleGround not created!", entry); sLog.outErrorDb("Gameobject template %u not found in database! BattleGround not created!", entry);
sLog.outError("Cannot create gameobject template %u! BattleGround not created!", entry); sLog.outError("Cannot create gameobject template %u! BattleGround not created!", entry);

View file

@ -95,7 +95,7 @@ void GameObject::RemoveFromWorld()
Object::RemoveFromWorld(); Object::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) 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, uint8 animprogress, GOState go_state)
{ {
MANGOS_ASSERT(map); MANGOS_ASSERT(map);
Relocate(x,y,z,ang); Relocate(x,y,z,ang);
@ -135,6 +135,9 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMa
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->id); SetEntry(goinfo->id);
SetUInt32Value(GAMEOBJECT_DISPLAYID, goinfo->displayId); SetUInt32Value(GAMEOBJECT_DISPLAYID, goinfo->displayId);
@ -189,7 +192,7 @@ void GameObject::Update(uint32 /*p_time*/)
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); // SetUInt32Value(GAMEOBJECT_FLAGS, GO_FLAG_NODESPAWN);
UpdateData udata; UpdateData udata;
WorldPacket packet; WorldPacket packet;
@ -570,7 +573,7 @@ bool GameObject::LoadFromDB(uint32 guid, Map *map)
float rotation2 = data->rotation2; float rotation2 = data->rotation2;
float rotation3 = data->rotation3; float rotation3 = data->rotation3;
uint32 animprogress = data->animprogress; uint8 animprogress = data->animprogress;
GOState go_state = data->go_state; GOState go_state = data->go_state;
m_DBTableGuid = guid; m_DBTableGuid = guid;
@ -803,7 +806,7 @@ void GameObject::SummonLinkedTrapIfAny()
GameObject* linkedGO = new GameObject; GameObject* linkedGO = new GameObject;
if (!linkedGO->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), linkedEntry, GetMap(), if (!linkedGO->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), linkedEntry, GetMap(),
GetPhaseMask(), GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY)) GetPhaseMask(), GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, GO_ANIMPROGRESS_DEFAULT, GO_STATE_READY))
{ {
delete linkedGO; delete linkedGO;
linkedGO = NULL; linkedGO = NULL;

View file

@ -577,6 +577,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 MANGOS_DLL_SPEC GameObject : public WorldObject class MANGOS_DLL_SPEC GameObject : public WorldObject
{ {
public: public:
@ -586,7 +588,7 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject
void AddToWorld(); void AddToWorld();
void RemoveFromWorld(); void RemoveFromWorld();
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); 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, uint8 animprogress, GOState go_state);
void Update(uint32 p_time); void Update(uint32 p_time);
GameObjectInfo const* GetGOInfo() const; GameObjectInfo const* GetGOInfo() const;

View file

@ -1088,7 +1088,7 @@ bool ChatHandler::HandleGameObjectAddCommand(char* args)
GameObject* pGameObj = new GameObject; GameObject* pGameObj = new GameObject;
uint32 db_lowGUID = sObjectMgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT); uint32 db_lowGUID = sObjectMgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT);
if (!pGameObj->Create(db_lowGUID, gInfo->id, map, chr->GetPhaseMaskForSpawn(), x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY)) if (!pGameObj->Create(db_lowGUID, gInfo->id, map, chr->GetPhaseMaskForSpawn(), x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, GO_ANIMPROGRESS_DEFAULT, GO_STATE_READY))
{ {
delete pGameObj; delete pGameObj;
return false; return false;

View file

@ -3800,7 +3800,7 @@ void Aura::HandleAuraModStun(bool apply, bool Real)
{ {
GameObject* pObj = new GameObject; GameObject* pObj = new GameObject;
if(pObj->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), 185584, target->GetMap(), target->GetPhaseMask(), if(pObj->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), 185584, target->GetMap(), target->GetPhaseMask(),
target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY)) target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, GO_ANIMPROGRESS_DEFAULT, GO_STATE_READY))
{ {
pObj->SetRespawnTime(GetAuraDuration()/IN_MILLISECONDS); pObj->SetRespawnTime(GetAuraDuration()/IN_MILLISECONDS);
pObj->SetSpellId(GetId()); pObj->SetSpellId(GetId());

View file

@ -952,7 +952,7 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx)
// create before death for get proper coordinates // create before death for get proper coordinates
if (!pGameObj->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), 179644, map, m_caster->GetPhaseMask(), if (!pGameObj->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), 179644, map, m_caster->GetPhaseMask(),
creatureTarget->GetPositionX(), creatureTarget->GetPositionY(), creatureTarget->GetPositionZ(), creatureTarget->GetPositionX(), creatureTarget->GetPositionY(), creatureTarget->GetPositionZ(),
creatureTarget->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY) ) creatureTarget->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, GO_ANIMPROGRESS_DEFAULT, GO_STATE_READY) )
{ {
delete pGameObj; delete pGameObj;
return; return;
@ -5491,7 +5491,7 @@ void Spell::EffectSummonObjectWild(SpellEffectIndex eff_idx)
Map *map = target->GetMap(); Map *map = target->GetMap();
if(!pGameObj->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), gameobject_id, map, if(!pGameObj->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), gameobject_id, map,
m_caster->GetPhaseMask(), x, y, z, target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY)) m_caster->GetPhaseMask(), x, y, z, target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, GO_ANIMPROGRESS_DEFAULT, GO_STATE_READY))
{ {
delete pGameObj; delete pGameObj;
return; return;
@ -6745,7 +6745,7 @@ void Spell::EffectDuel(SpellEffectIndex eff_idx)
m_caster->GetPositionX()+(unitTarget->GetPositionX()-m_caster->GetPositionX())/2 , m_caster->GetPositionX()+(unitTarget->GetPositionX()-m_caster->GetPositionX())/2 ,
m_caster->GetPositionY()+(unitTarget->GetPositionY()-m_caster->GetPositionY())/2 , m_caster->GetPositionY()+(unitTarget->GetPositionY()-m_caster->GetPositionY())/2 ,
m_caster->GetPositionZ(), m_caster->GetPositionZ(),
m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY)) m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, GO_ANIMPROGRESS_DEFAULT, GO_STATE_READY))
{ {
delete pGameObj; delete pGameObj;
return; return;
@ -7120,7 +7120,7 @@ void Spell::EffectSummonObject(SpellEffectIndex eff_idx)
Map *map = m_caster->GetMap(); Map *map = m_caster->GetMap();
if(!pGameObj->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), go_id, map, if(!pGameObj->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), go_id, map,
m_caster->GetPhaseMask(), x, y, z, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY)) m_caster->GetPhaseMask(), x, y, z, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, GO_ANIMPROGRESS_DEFAULT, GO_STATE_READY))
{ {
delete pGameObj; delete pGameObj;
return; return;
@ -7704,7 +7704,7 @@ void Spell::EffectTransmitted(SpellEffectIndex eff_idx)
GameObject* pGameObj = new GameObject; GameObject* pGameObj = new GameObject;
if(!pGameObj->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), name_id, cMap, if(!pGameObj->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), name_id, cMap,
m_caster->GetPhaseMask(), fx, fy, fz, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY)) m_caster->GetPhaseMask(), fx, fy, fz, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, GO_ANIMPROGRESS_DEFAULT, GO_STATE_READY))
{ {
delete pGameObj; delete pGameObj;
return; return;

View file

@ -92,7 +92,7 @@ void MapManager::LoadTransports()
x = t->m_WayPoints[0].x; y = t->m_WayPoints[0].y; z = t->m_WayPoints[0].z; mapid = t->m_WayPoints[0].mapid; o = 1; x = t->m_WayPoints[0].x; y = t->m_WayPoints[0].y; z = t->m_WayPoints[0].z; mapid = t->m_WayPoints[0].mapid; o = 1;
// creates the Gameobject // creates the Gameobject
if(!t->Create(entry, mapid, x, y, z, o, 100, 0)) if (!t->Create(entry, mapid, x, y, z, o, GO_ANIMPROGRESS_DEFAULT, 0))
{ {
delete t; delete t;
continue; continue;
@ -138,7 +138,7 @@ Transport::Transport() : GameObject()
m_updateFlag = (UPDATEFLAG_TRANSPORT | UPDATEFLAG_HIGHGUID | UPDATEFLAG_HAS_POSITION | UPDATEFLAG_ROTATION); m_updateFlag = (UPDATEFLAG_TRANSPORT | UPDATEFLAG_HIGHGUID | UPDATEFLAG_HAS_POSITION | UPDATEFLAG_ROTATION);
} }
bool Transport::Create(uint32 guidlow, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress, uint32 dynflags) bool Transport::Create(uint32 guidlow, 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.
@ -166,7 +166,7 @@ bool Transport::Create(uint32 guidlow, uint32 mapid, float x, float y, float z,
SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction); SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction);
//SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags); //SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags);
SetUInt32Value(GAMEOBJECT_FLAGS, MAKE_PAIR32(0x28, 0x64)); SetUInt32Value(GAMEOBJECT_FLAGS, (GO_FLAG_TRANSPORT | GO_FLAG_NODESPAWN));
SetUInt32Value(GAMEOBJECT_LEVEL, m_period); SetUInt32Value(GAMEOBJECT_LEVEL, m_period);
SetEntry(goinfo->id); SetEntry(goinfo->id);
@ -174,10 +174,12 @@ bool Transport::Create(uint32 guidlow, uint32 mapid, float x, float y, float z,
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);

View file

@ -30,7 +30,7 @@ class Transport : public GameObject
public: public:
explicit Transport(); explicit Transport();
bool Create(uint32 guidlow, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress, uint32 dynflags); bool Create(uint32 guidlow, 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);

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "10599" #define REVISION_NR "10600"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__