diff options
author | Shauren <shauren.trinity@gmail.com> | 2018-04-07 21:56:19 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2018-04-07 21:56:19 +0200 |
commit | 2c64bb97e6fddcbd15ef39fde3d0828bbf600ec6 (patch) | |
tree | 27f9cf5bbfa3693a33b2289da36e5f6307001ce0 /src/server/game/Maps/Map.cpp | |
parent | 5c7a5ddcf4735a38c76ae16b416abff2dc94fb62 (diff) |
Tools:
* mapextractor - fixed fatigue in Thousand Needles
* mapextractor - fixed compressing liquid data
* vmapextractor - fixed extracting liquids inside WMOs
* vmapextractor - implemented new WMO flags
* vmapextractor - store model type for gameobject models
* mmap_generator - fixed processing liquids broken in e5d23103f37c40d2e946fa0e2db66d2f527ad9af
Diffstat (limited to 'src/server/game/Maps/Map.cpp')
-rw-r--r-- | src/server/game/Maps/Map.cpp | 52 |
1 files changed, 25 insertions, 27 deletions
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index fb36f4c1e4d..9588a69f932 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -52,7 +52,7 @@ #include "WorldSession.h" u_map_magic MapMagic = { {'M','A','P','S'} }; -u_map_magic MapVersionMagic = { {'v','1','.','8'} }; +u_map_magic MapVersionMagic = { {'v','1','.','9'} }; u_map_magic MapAreaMagic = { {'A','R','E','A'} }; u_map_magic MapHeightMagic = { {'M','H','G','T'} }; u_map_magic MapLiquidMagic = { {'M','L','I','Q'} }; @@ -1914,7 +1914,8 @@ GridMap::GridMap() m_V8 = nullptr; _minHeightPlanes = nullptr; // Liquid data - _liquidType = 0; + _liquidGlobalEntry = 0; + _liquidGlobalFlags = 0; _liquidOffX = 0; _liquidOffY = 0; _liquidWidth = 0; @@ -2117,7 +2118,8 @@ bool GridMap::loadLiquidData(FILE* in, uint32 offset, uint32 /*size*/) if (fread(&header, sizeof(header), 1, in) != 1 || header.fourcc != MapLiquidMagic.asUInt) return false; - _liquidType = header.liquidType; + _liquidGlobalEntry = header.liquidType; + _liquidGlobalFlags = header.liquidFlags; _liquidOffX = header.offsetX; _liquidOffY = header.offsetY; _liquidWidth = header.width; @@ -2442,7 +2444,7 @@ uint8 GridMap::getTerrainType(float x, float y) const inline ZLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData* data) { // Check water type (if no water return) - if (!_liquidType && !_liquidFlags) + if (!_liquidGlobalFlags && !_liquidFlags) return LIQUID_MAP_NO_WATER; // Get cell @@ -2454,37 +2456,33 @@ inline ZLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 R // Check water type in cell int idx=(x_int>>3)*16 + (y_int>>3); - uint8 type = _liquidFlags ? _liquidFlags[idx] : _liquidType; - uint32 entry = 0; - if (_liquidEntry) + uint8 type = _liquidFlags ? _liquidFlags[idx] : _liquidGlobalFlags; + uint32 entry = _liquidEntry ? _liquidEntry[idx] : _liquidGlobalEntry; + if (LiquidTypeEntry const* liquidEntry = sLiquidTypeStore.LookupEntry(entry)) { - if (LiquidTypeEntry const* liquidEntry = sLiquidTypeStore.LookupEntry(_liquidEntry[idx])) + type &= MAP_LIQUID_TYPE_DARK_WATER; + uint32 liqTypeIdx = liquidEntry->SoundBank; + if (entry < 21) { - entry = liquidEntry->ID; - type &= MAP_LIQUID_TYPE_DARK_WATER; - uint32 liqTypeIdx = liquidEntry->SoundBank; - if (entry < 21) + if (AreaTableEntry const* area = sAreaTableStore.LookupEntry(getArea(x, y))) { - if (AreaTableEntry const* area = sAreaTableStore.LookupEntry(getArea(x, y))) + uint32 overrideLiquid = area->LiquidTypeID[liquidEntry->SoundBank]; + if (!overrideLiquid && area->ParentAreaID) { - uint32 overrideLiquid = area->LiquidTypeID[liquidEntry->SoundBank]; - if (!overrideLiquid && area->ParentAreaID) - { - area = sAreaTableStore.LookupEntry(area->ParentAreaID); - if (area) - overrideLiquid = area->LiquidTypeID[liquidEntry->SoundBank]; - } + area = sAreaTableStore.LookupEntry(area->ParentAreaID); + if (area) + overrideLiquid = area->LiquidTypeID[liquidEntry->SoundBank]; + } - if (LiquidTypeEntry const* liq = sLiquidTypeStore.LookupEntry(overrideLiquid)) - { - entry = overrideLiquid; - liqTypeIdx = liq->SoundBank; - } + if (LiquidTypeEntry const* liq = sLiquidTypeStore.LookupEntry(overrideLiquid)) + { + entry = overrideLiquid; + liqTypeIdx = liq->SoundBank; } } - - type |= 1 << liqTypeIdx; } + + type |= 1 << liqTypeIdx; } if (type == 0) |