mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 08:55:32 +01:00
Core/VMap: Add outdoor state to Map::GetFullTerrainStatusForPosition. Add WorldObject::IsOutdoors, basic member access.
Ref #21479.
This commit is contained in:
@@ -2457,10 +2457,8 @@ float Map::GetVMapFloor(float x, float y, float z, float maxSearchDist, float co
|
||||
return VMAP::VMapFactory::createOrGetVMapManager()->getHeight(GetId(), x, y, z + collisionHeight, maxSearchDist);
|
||||
}
|
||||
|
||||
inline bool IsOutdoorWMO(uint32 mogpFlags, int32 /*adtId*/, int32 /*rootId*/, int32 /*groupId*/, WMOAreaTableEntry const* wmoEntry, AreaTableEntry const* atEntry)
|
||||
inline bool IsOutdoorWMO(uint32 mogpFlags, WMOAreaTableEntry const* wmoEntry, AreaTableEntry const* atEntry)
|
||||
{
|
||||
bool outdoor = true;
|
||||
|
||||
if (wmoEntry && atEntry)
|
||||
{
|
||||
if (atEntry->flags & AREA_FLAG_OUTSIDE)
|
||||
@@ -2469,16 +2467,15 @@ inline bool IsOutdoorWMO(uint32 mogpFlags, int32 /*adtId*/, int32 /*rootId*/, in
|
||||
return false;
|
||||
}
|
||||
|
||||
outdoor = (mogpFlags & 0x8) != 0;
|
||||
|
||||
if (wmoEntry)
|
||||
{
|
||||
if (wmoEntry->Flags & 4)
|
||||
return true;
|
||||
if (wmoEntry->Flags & 2)
|
||||
outdoor = false;
|
||||
return false;
|
||||
}
|
||||
return outdoor;
|
||||
|
||||
return (mogpFlags & 0x8);
|
||||
}
|
||||
|
||||
bool Map::IsOutdoors(float x, float y, float z) const
|
||||
@@ -2491,13 +2488,13 @@ bool Map::IsOutdoors(float x, float y, float z) const
|
||||
return true;
|
||||
|
||||
AreaTableEntry const* atEntry = nullptr;
|
||||
WMOAreaTableEntry const* wmoEntry= GetWMOAreaTableEntryByTripple(rootId, adtId, groupId);
|
||||
WMOAreaTableEntry const* wmoEntry = GetWMOAreaTableEntryByTripple(rootId, adtId, groupId);
|
||||
if (wmoEntry)
|
||||
{
|
||||
TC_LOG_DEBUG("maps", "Got WMOAreaTableEntry! flag %u, areaid %u", wmoEntry->Flags, wmoEntry->areaId);
|
||||
atEntry = sAreaTableStore.LookupEntry(wmoEntry->areaId);
|
||||
}
|
||||
return IsOutdoorWMO(mogpFlags, adtId, rootId, groupId, wmoEntry, atEntry);
|
||||
return IsOutdoorWMO(mogpFlags, wmoEntry, atEntry);
|
||||
}
|
||||
|
||||
bool Map::GetAreaInfo(float x, float y, float z, uint32 &flags, int32 &adtId, int32 &rootId, int32 &groupId) const
|
||||
@@ -2551,7 +2548,7 @@ uint32 Map::GetAreaId(float x, float y, float z, bool *isOutdoors) const
|
||||
if (isOutdoors)
|
||||
{
|
||||
if (haveAreaInfo)
|
||||
*isOutdoors = IsOutdoorWMO(mogpFlags, adtId, rootId, groupId, wmoEntry, atEntry);
|
||||
*isOutdoors = IsOutdoorWMO(mogpFlags, wmoEntry, atEntry);
|
||||
else
|
||||
*isOutdoors = true;
|
||||
}
|
||||
@@ -2684,20 +2681,21 @@ void Map::GetFullTerrainStatusForPosition(float x, float y, float z, PositionFul
|
||||
|
||||
// area lookup
|
||||
AreaTableEntry const* areaEntry = nullptr;
|
||||
WMOAreaTableEntry const* wmoEntry = nullptr;
|
||||
if (vmapData.areaInfo && (z <= mapHeight || mapHeight <= vmapData.floorZ))
|
||||
if (WMOAreaTableEntry const* wmoEntry = GetWMOAreaTableEntryByTripple(vmapData.areaInfo->rootId, vmapData.areaInfo->adtId, vmapData.areaInfo->groupId))
|
||||
if ((wmoEntry = GetWMOAreaTableEntryByTripple(vmapData.areaInfo->rootId, vmapData.areaInfo->adtId, vmapData.areaInfo->groupId)))
|
||||
areaEntry = sAreaTableStore.LookupEntry(wmoEntry->areaId);
|
||||
|
||||
data.areaId = 0;
|
||||
|
||||
if (areaEntry)
|
||||
{
|
||||
data.floorZ = vmapData.floorZ;
|
||||
data.areaId = areaEntry->ID;
|
||||
data.floorZ = vmapData.floorZ;
|
||||
data.outdoors = IsOutdoorWMO(vmapData.areaInfo->mogpFlags, wmoEntry, areaEntry);
|
||||
}
|
||||
else
|
||||
{
|
||||
data.floorZ = mapHeight;
|
||||
if (gmap)
|
||||
data.areaId = gmap->getArea(x, y);
|
||||
|
||||
@@ -2706,6 +2704,9 @@ void Map::GetFullTerrainStatusForPosition(float x, float y, float z, PositionFul
|
||||
|
||||
if (data.areaId)
|
||||
areaEntry = sAreaTableStore.LookupEntry(data.areaId);
|
||||
|
||||
data.floorZ = mapHeight;
|
||||
data.outdoors = true; // @todo default true taken from old GetAreaId check, maybe review
|
||||
}
|
||||
|
||||
// liquid processing
|
||||
|
||||
Reference in New Issue
Block a user