[10145] Use better (but still hack) way for gameobject size calculation

* This is also hack because some float with unknown exactly value used as 'size'
* Another not resolved problem: go size used in creature target autoselection, so for large 'virtual' go
  creature can seelct strange points near in attempt select 'free' place near target.
This commit is contained in:
VladimirMangos 2010-07-03 23:08:32 +04:00
parent 35bf2a56dd
commit ebf27938fb
8 changed files with 25 additions and 9 deletions

View file

@ -867,7 +867,8 @@ struct GameObjectDisplayInfoEntry
uint32 Displayid; // 0 m_ID uint32 Displayid; // 0 m_ID
// char* filename; // 1 // char* filename; // 1
// uint32 unknown2[10]; // 2-11 unknown data // uint32 unknown2[10]; // 2-11 unknown data
// float unknown12[6]; // 12-17 unknown data float unknown12; // 12-17 unknown size data, use first value as interact dist, mostly in hacks way
// float unknown13[5]; // 12-17 unknown size data
// uint32 unknown18; // 18 unknown data // uint32 unknown18; // 18 unknown data
}; };

View file

@ -46,7 +46,7 @@ const char EmotesEntryfmt[]="nxxiiix";
const char EmotesTextEntryfmt[]="nxixxxxxxxxxxxxxxxx"; const char EmotesTextEntryfmt[]="nxixxxxxxxxxxxxxxxx";
const char FactionEntryfmt[]="niiiiiiiiiiiiiiiiiixxxxssssssssssssssssxxxxxxxxxxxxxxxxxx"; const char FactionEntryfmt[]="niiiiiiiiiiiiiiiiiixxxxssssssssssssssssxxxxxxxxxxxxxxxxxx";
const char FactionTemplateEntryfmt[]="niiiiiiiiiiiii"; const char FactionTemplateEntryfmt[]="niiiiiiiiiiiii";
const char GameObjectDisplayInfofmt[]="nxxxxxxxxxxxxxxxxxx"; const char GameObjectDisplayInfofmt[]="nxxxxxxxxxxxfxxxxxx";
const char GemPropertiesEntryfmt[]="nixxi"; const char GemPropertiesEntryfmt[]="nixxi";
const char GlyphPropertiesfmt[]="niii"; const char GlyphPropertiesfmt[]="niii";
const char GlyphSlotfmt[]="nii"; const char GlyphSlotfmt[]="nii";

View file

@ -1515,3 +1515,14 @@ bool GameObject::IsFriendlyTo(Unit const* unit) const
// common faction based case (GvC,GvP) // common faction based case (GvC,GvP)
return tester_faction->IsFriendlyTo(*target_faction); return tester_faction->IsFriendlyTo(*target_faction);
} }
float GameObject::GetObjectBoundingRadius() const
{
//FIXME:
// 1. This is clearly hack way because GameObjectDisplayInfoEntry have 6 floats related to GO sizes, but better that use DEFAULT_WORLD_OBJECT_SIZE
// 2. In some cases this must be only interactive size, not GO size, current way can affect creature target point auto-selection in strange ways for big underground/virtual GOs
if (GameObjectDisplayInfoEntry const* dispEntry = sGameObjectDisplayInfoStore.LookupEntry(GetGOInfo()->displayId))
return fabs(dispEntry->unknown12) * GetObjectScale();
return DEFAULT_WORLD_OBJECT_SIZE;
}

View file

@ -660,6 +660,8 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject
uint8 GetGoAnimProgress() const { return GetByteValue(GAMEOBJECT_BYTES_1, 3); } uint8 GetGoAnimProgress() const { return GetByteValue(GAMEOBJECT_BYTES_1, 3); }
void SetGoAnimProgress(uint8 animprogress) { SetByteValue(GAMEOBJECT_BYTES_1, 3, animprogress); } void SetGoAnimProgress(uint8 animprogress) { SetByteValue(GAMEOBJECT_BYTES_1, 3, animprogress); }
float GetObjectBoundingRadius() const; // overwrite WorldObject version
void Use(Unit* user); void Use(Unit* user);
LootState getLootState() const { return m_lootState; } LootState getLootState() const { return m_lootState; }

View file

@ -371,10 +371,7 @@ class MANGOS_DLL_SPEC WorldObject : public Object
GetNearPoint(obj, x, y, z, obj->GetObjectBoundingRadius(), distance2d, GetAngle(obj)); GetNearPoint(obj, x, y, z, obj->GetObjectBoundingRadius(), distance2d, GetAngle(obj));
} }
float GetObjectBoundingRadius() const virtual float GetObjectBoundingRadius() const { return DEFAULT_WORLD_OBJECT_SIZE; }
{
return ( m_valuesCount > UNIT_FIELD_BOUNDINGRADIUS ) ? m_floatValues[UNIT_FIELD_BOUNDINGRADIUS] : DEFAULT_WORLD_OBJECT_SIZE;
}
bool IsPositionValid() const; bool IsPositionValid() const;
void UpdateGroundPositionZ(float x, float y, float &z) const; void UpdateGroundPositionZ(float x, float y, float &z) const;

View file

@ -2312,8 +2312,8 @@ GameObject* Player::GetGameObjectIfCanInteractWith(ObjectGuid guid, uint32 gameo
if (go->IsWithinDistInMap(this, maxdist) && go->isSpawned()) if (go->IsWithinDistInMap(this, maxdist) && go->isSpawned())
return go; return go;
sLog.outError("GetGameObjectIfCanInteractWith: GameObject '%s' [GUID: %u] is too far away from player %s [GUID: %u] to be used by him (distance=%f, maximal 10 is allowed)", go->GetGOInfo()->name, sLog.outError("GetGameObjectIfCanInteractWith: GameObject '%s' [GUID: %u] is too far away from player %s [GUID: %u] to be used by him (distance=%f, maximal %f is allowed)",
go->GetGUIDLow(), GetName(), GetGUIDLow(), go->GetDistance(this)); go->GetGOInfo()->name, go->GetGUIDLow(), GetName(), GetGUIDLow(), go->GetDistance(this), maxdist);
} }
} }
return NULL; return NULL;

View file

@ -1110,6 +1110,11 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
void CleanupsBeforeDelete(); // used in ~Creature/~Player (or before mass creature delete to remove cross-references to already deleted units) void CleanupsBeforeDelete(); // used in ~Creature/~Player (or before mass creature delete to remove cross-references to already deleted units)
float GetObjectBoundingRadius() const // overwrite WorldObject version
{
return m_floatValues[UNIT_FIELD_BOUNDINGRADIUS];
}
DiminishingLevels GetDiminishing(DiminishingGroup group); DiminishingLevels GetDiminishing(DiminishingGroup group);
void IncrDiminishing(DiminishingGroup group); void IncrDiminishing(DiminishingGroup group);
void ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration,Unit* caster, DiminishingLevels Level, int32 limitduration); void ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration,Unit* caster, DiminishingLevels Level, int32 limitduration);

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 "10144" #define REVISION_NR "10145"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__