aboutsummaryrefslogtreecommitdiff
path: root/src/tools/map_extractor
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/map_extractor')
-rw-r--r--src/tools/map_extractor/System.cpp73
-rw-r--r--src/tools/map_extractor/adt.h8
2 files changed, 53 insertions, 28 deletions
diff --git a/src/tools/map_extractor/System.cpp b/src/tools/map_extractor/System.cpp
index 493bb90a587..3de2f1908fa 100644
--- a/src/tools/map_extractor/System.cpp
+++ b/src/tools/map_extractor/System.cpp
@@ -366,7 +366,7 @@ bool ReadCinematicCameraDBC()
// Map file format data
static char const* MAP_MAGIC = "MAPS";
-static char const* MAP_VERSION_MAGIC = "v1.8";
+static char const* MAP_VERSION_MAGIC = "v1.9";
static char const* MAP_AREA_MAGIC = "AREA";
static char const* MAP_HEIGHT_MAGIC = "MHGT";
static char const* MAP_LIQUID_MAGIC = "MLIQ";
@@ -415,8 +415,6 @@ struct map_heightHeader
#define MAP_LIQUID_TYPE_SLIME 0x08
#define MAP_LIQUID_TYPE_DARK_WATER 0x10
-#define MAP_LIQUID_TYPE_WMO_WATER 0x20
-
#define MAP_LIQUID_NO_TYPE 0x0001
#define MAP_LIQUID_NO_HEIGHT 0x0002
@@ -424,7 +422,8 @@ struct map_heightHeader
struct map_liquidHeader
{
uint32 fourcc;
- uint16 flags;
+ uint8 flags;
+ uint8 liquidFlags;
uint16 liquidType;
uint8 offsetX;
uint8 offsetY;
@@ -694,8 +693,8 @@ bool ConvertADT(std::string const& inputPath, std::string const& outputPath, int
}
}
- liquid_entry[i][j] = h->LiquidType;
- switch (LiquidTypes.at(h->LiquidType).SoundBank)
+ liquid_entry[i][j] = h2o->GetLiquidType(h);
+ switch (LiquidTypes.at(liquid_entry[i][j]).SoundBank)
{
case LIQUID_TYPE_WATER: liquid_flags[i][j] |= MAP_LIQUID_TYPE_WATER; break;
case LIQUID_TYPE_OCEAN: liquid_flags[i][j] |= MAP_LIQUID_TYPE_OCEAN; if (!ignoreDeepWater && attrs.Deep) liquid_flags[i][j] |= MAP_LIQUID_TYPE_DARK_WATER; break;
@@ -877,13 +876,14 @@ bool ConvertADT(std::string const& inputPath, std::string const& outputPath, int
//============================================
// Pack liquid data
//============================================
- uint8 type = liquid_flags[0][0];
+ uint16 firstLiquidType = liquid_entry[0][0];
+ uint8 firstLiquidFlag = liquid_flags[0][0];
bool fullType = false;
for (int y = 0; y < ADT_CELLS_PER_GRID; y++)
{
for (int x = 0; x < ADT_CELLS_PER_GRID; x++)
{
- if (liquid_flags[y][x] != type)
+ if (liquid_entry[y][x] != firstLiquidType || liquid_flags[y][x] != firstLiquidFlag)
{
fullType = true;
y = ADT_CELLS_PER_GRID;
@@ -895,7 +895,7 @@ bool ConvertADT(std::string const& inputPath, std::string const& outputPath, int
map_liquidHeader liquidHeader;
// no water data (if all grid have 0 liquid type)
- if (type == 0 && !fullType)
+ if (firstLiquidFlag == 0 && !fullType)
{
// No liquid data
map.liquidMapOffset = 0;
@@ -947,7 +947,10 @@ bool ConvertADT(std::string const& inputPath, std::string const& outputPath, int
liquidHeader.flags |= MAP_LIQUID_NO_TYPE;
if (liquidHeader.flags & MAP_LIQUID_NO_TYPE)
- liquidHeader.liquidType = type;
+ {
+ liquidHeader.liquidFlags = firstLiquidFlag;
+ liquidHeader.liquidType = firstLiquidType;
+ }
else
map.liquidMapSize += sizeof(liquid_entry) + sizeof(liquid_flags);
@@ -955,15 +958,20 @@ bool ConvertADT(std::string const& inputPath, std::string const& outputPath, int
map.liquidMapSize += sizeof(float)*liquidHeader.width*liquidHeader.height;
}
- if (map.liquidMapOffset)
- map.holesOffset = map.liquidMapOffset + map.liquidMapSize;
- else
- map.holesOffset = map.heightMapOffset + map.heightMapSize;
-
if (hasHoles)
+ {
+ if (map.liquidMapOffset)
+ map.holesOffset = map.liquidMapOffset + map.liquidMapSize;
+ else
+ map.holesOffset = map.heightMapOffset + map.heightMapSize;
+
map.holesSize = sizeof(holes);
+ }
else
+ {
+ map.holesOffset = 0;
map.holesSize = 0;
+ }
// Ok all data prepared - store it
std::ofstream outFile(outputPath, std::ofstream::out | std::ofstream::binary);
@@ -1034,20 +1042,29 @@ bool ConvertADT(std::string const& inputPath, std::string const& outputPath, int
bool IsDeepWaterIgnored(uint32 mapId, uint32 x, uint32 y)
{
- if (mapId != 0)
- return false;
+ if (mapId == 0)
+ {
+ // GRID(39, 24) || GRID(39, 25) || GRID(39, 26) ||
+ // GRID(40, 24) || GRID(40, 25) || GRID(40, 26) ||
+ //GRID(41, 18) || GRID(41, 19) || GRID(41, 20) || GRID(41, 21) || GRID(41, 22) || GRID(41, 23) || GRID(41, 24) || GRID(41, 25) || GRID(41, 26) ||
+ //GRID(42, 18) || GRID(42, 19) || GRID(42, 20) || GRID(42, 21) || GRID(42, 22) || GRID(42, 23) || GRID(42, 24) || GRID(42, 25) || GRID(42, 26) ||
+ //GRID(43, 18) || GRID(43, 19) || GRID(43, 20) || GRID(43, 21) || GRID(43, 22) || GRID(43, 23) || GRID(43, 24) || GRID(43, 25) || GRID(43, 26) ||
+ //GRID(44, 18) || GRID(44, 19) || GRID(44, 20) || GRID(44, 21) || GRID(44, 22) || GRID(44, 23) || GRID(44, 24) || GRID(44, 25) || GRID(44, 26) ||
+ //GRID(45, 18) || GRID(45, 19) || GRID(45, 20) || GRID(45, 21) || GRID(45, 22) || GRID(45, 23) || GRID(45, 24) || GRID(45, 25) || GRID(45, 26) ||
+ //GRID(46, 18) || GRID(46, 19) || GRID(46, 20) || GRID(46, 21) || GRID(46, 22) || GRID(46, 23) || GRID(46, 24) || GRID(46, 25) || GRID(46, 26)
+
+ // Vashj'ir grids completely ignore fatigue
+ return (x >= 39 && x <= 40 && y >= 24 && y <= 26) || (x >= 41 && x <= 46 && y >= 18 && y <= 26);
+ }
+
+ if (mapId == 1)
+ {
+ // GRID(43, 39) || GRID(43, 40)
+ // Thousand Needles
+ return x == 43 && (y == 39 || y == 40);
+ }
- // GRID(39, 24) || GRID(39, 25) || GRID(39, 26) ||
- // GRID(40, 24) || GRID(40, 25) || GRID(40, 26) ||
- //GRID(41, 18) || GRID(41, 19) || GRID(41, 20) || GRID(41, 21) || GRID(41, 22) || GRID(41, 23) || GRID(41, 24) || GRID(41, 25) || GRID(41, 26) ||
- //GRID(42, 18) || GRID(42, 19) || GRID(42, 20) || GRID(42, 21) || GRID(42, 22) || GRID(42, 23) || GRID(42, 24) || GRID(42, 25) || GRID(42, 26) ||
- //GRID(43, 18) || GRID(43, 19) || GRID(43, 20) || GRID(43, 21) || GRID(43, 22) || GRID(43, 23) || GRID(43, 24) || GRID(43, 25) || GRID(43, 26) ||
- //GRID(44, 18) || GRID(44, 19) || GRID(44, 20) || GRID(44, 21) || GRID(44, 22) || GRID(44, 23) || GRID(44, 24) || GRID(44, 25) || GRID(44, 26) ||
- //GRID(45, 18) || GRID(45, 19) || GRID(45, 20) || GRID(45, 21) || GRID(45, 22) || GRID(45, 23) || GRID(45, 24) || GRID(45, 25) || GRID(45, 26) ||
- //GRID(46, 18) || GRID(46, 19) || GRID(46, 20) || GRID(46, 21) || GRID(46, 22) || GRID(46, 23) || GRID(46, 24) || GRID(46, 25) || GRID(46, 26)
-
- // Vashj'ir grids completely ignore fatigue
- return (x >= 39 && x <= 40 && y >= 24 && y <= 26) || (x >= 41 && x <= 46 && y >= 18 && y <= 26);
+ return false;
}
void ExtractMaps(uint32 build)
diff --git a/src/tools/map_extractor/adt.h b/src/tools/map_extractor/adt.h
index 4a5ae2f7263..f576db1b2cc 100644
--- a/src/tools/map_extractor/adt.h
+++ b/src/tools/map_extractor/adt.h
@@ -206,6 +206,14 @@ struct adt_MH2O
return { 0, 0 };
}
+ uint16 GetLiquidType(adt_liquid_instance const* h) const
+ {
+ if (GetLiquidVertexFormat(h) == LiquidVertexFormatType::Depth)
+ return 2;
+
+ return h->LiquidType;
+ }
+
float GetLiquidHeight(adt_liquid_instance const* h, int32 pos) const
{
if (!h->OffsetVertexData)