aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/tools/map_extractor/System.cpp53
-rw-r--r--src/tools/map_extractor/adt.h30
2 files changed, 60 insertions, 23 deletions
diff --git a/src/tools/map_extractor/System.cpp b/src/tools/map_extractor/System.cpp
index 98644181e9a..493bb90a587 100644
--- a/src/tools/map_extractor/System.cpp
+++ b/src/tools/map_extractor/System.cpp
@@ -87,7 +87,7 @@ int CONF_extract = EXTRACT_ALL;
// This option allow limit minimum height to some value (Allow save some memory)
bool CONF_allow_height_limit = true;
-float CONF_use_minHeight = -500.0f;
+float CONF_use_minHeight = -2000.0f;
// This option allow use float to int conversion
bool CONF_allow_float_to_int = true;
@@ -495,7 +495,7 @@ bool TransformToHighRes(uint16 lowResHoles, uint8 hiResHoles[8])
return *((uint64*)hiResHoles) != 0;
}
-bool ConvertADT(std::string const& inputPath, std::string const& outputPath, int /*cell_y*/, int /*cell_x*/, uint32 build)
+bool ConvertADT(std::string const& inputPath, std::string const& outputPath, int /*cell_y*/, int /*cell_x*/, uint32 build, bool ignoreDeepWater)
{
ChunkedFile adt;
@@ -609,7 +609,7 @@ bool ConvertADT(std::string const& inputPath, std::string const& outputPath, int
if (liquid->flags[y][x] != 0x0F)
{
liquid_show[cy][cx] = true;
- if (liquid->flags[y][x] & (1 << 7))
+ if (!ignoreDeepWater && liquid->flags[y][x] & (1 << 7))
liquid_flags[mcnk->iy][mcnk->ix] |= MAP_LIQUID_TYPE_DARK_WATER;
++count;
}
@@ -675,14 +675,16 @@ bool ConvertADT(std::string const& inputPath, std::string const& outputPath, int
if (!h)
continue;
+ adt_liquid_attributes attrs = h2o->GetLiquidAttributes(i, j);
+
int32 count = 0;
uint64 existsMask = h2o->GetLiquidExistsBitmap(h);
- for (int32 y = 0; y < h->Height; y++)
+ for (int32 y = 0; y < h->GetHeight(); y++)
{
- int32 cy = i * ADT_CELL_SIZE + y + h->OffsetY;
- for (int32 x = 0; x < h->Width; x++)
+ int32 cy = i * ADT_CELL_SIZE + y + h->GetOffsetY();
+ for (int32 x = 0; x < h->GetWidth(); x++)
{
- int32 cx = j * ADT_CELL_SIZE + x + h->OffsetX;
+ int32 cx = j * ADT_CELL_SIZE + x + h->GetOffsetX();
if (existsMask & 1)
{
liquid_show[cy][cx] = true;
@@ -696,7 +698,7 @@ bool ConvertADT(std::string const& inputPath, std::string const& outputPath, int
switch (LiquidTypes.at(h->LiquidType).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; 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;
case LIQUID_TYPE_MAGMA: liquid_flags[i][j] |= MAP_LIQUID_TYPE_MAGMA; break;
case LIQUID_TYPE_SLIME: liquid_flags[i][j] |= MAP_LIQUID_TYPE_SLIME; break;
default:
@@ -708,19 +710,13 @@ bool ConvertADT(std::string const& inputPath, std::string const& outputPath, int
printf("Wrong liquid detect in MH2O chunk");
int32 pos = 0;
- for (int32 y = 0; y <= h->Height; y++)
+ for (int32 y = 0; y <= h->GetHeight(); y++)
{
- int32 cy = i * ADT_CELL_SIZE + y + h->OffsetY;
- for (int32 x = 0; x <= h->Width; x++)
+ int32 cy = i * ADT_CELL_SIZE + y + h->GetOffsetY();
+ for (int32 x = 0; x <= h->GetWidth(); x++)
{
- int32 cx = j * ADT_CELL_SIZE + x + h->OffsetX;
-
+ int32 cx = j * ADT_CELL_SIZE + x + h->GetOffsetX();
liquid_height[cy][cx] = h2o->GetLiquidHeight(h, pos);
-
- // Dark water detect
- if (liquid_flags[i][j] & MAP_LIQUID_TYPE_OCEAN && h2o->GetLiquidDepth(h, pos) == -1)
- liquid_flags[i][j] |= MAP_LIQUID_TYPE_DARK_WATER;
-
pos++;
}
}
@@ -1036,6 +1032,24 @@ bool ConvertADT(std::string const& inputPath, std::string const& outputPath, int
return true;
}
+bool IsDeepWaterIgnored(uint32 mapId, uint32 x, uint32 y)
+{
+ if (mapId != 0)
+ return false;
+
+ // 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);
+}
+
void ExtractMaps(uint32 build)
{
std::string storagePath;
@@ -1071,7 +1085,8 @@ void ExtractMaps(uint32 build)
storagePath = Trinity::StringFormat("World\\Maps\\%s\\%s_%u_%u.adt", map_ids[z].name, map_ids[z].name, x, y);
outputFileName = Trinity::StringFormat("%s/maps/%04u_%02u_%02u.map", output_path.string().c_str(), map_ids[z].id, y, x);
- ConvertADT(storagePath, outputFileName, y, x, build);
+ bool ignoreDeepWater = IsDeepWaterIgnored(map_ids[z].id, y, x);
+ ConvertADT(storagePath, outputFileName, y, x, build, ignoreDeepWater);
}
// draw progress bar
diff --git a/src/tools/map_extractor/adt.h b/src/tools/map_extractor/adt.h
index ca0082349d4..4a5ae2f7263 100644
--- a/src/tools/map_extractor/adt.h
+++ b/src/tools/map_extractor/adt.h
@@ -158,6 +158,17 @@ struct adt_liquid_instance
uint8 Height;
uint32 OffsetExistsBitmap;
uint32 OffsetVertexData;
+
+ uint8 GetOffsetX() const { return LiquidVertexFormat < 42 ? OffsetX : 0; }
+ uint8 GetOffsetY() const { return LiquidVertexFormat < 42 ? OffsetY : 0; }
+ uint8 GetWidth() const { return LiquidVertexFormat < 42 ? Width : 8; }
+ uint8 GetHeight() const { return LiquidVertexFormat < 42 ? Height : 8; }
+};
+
+struct adt_liquid_attributes
+{
+ uint64 Fishable;
+ uint64 Deep;
};
//
@@ -184,6 +195,17 @@ struct adt_MH2O
return nullptr;
}
+ adt_liquid_attributes GetLiquidAttributes(int32 x, int32 y) const
+ {
+ if (liquid[x][y].used)
+ {
+ if (liquid[x][y].OffsetAttributes)
+ return *((adt_liquid_attributes *)((uint8*)this + 8 + liquid[x][y].OffsetAttributes));
+ return { 0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF };
+ }
+ return { 0, 0 };
+ }
+
float GetLiquidHeight(adt_liquid_instance const* h, int32 pos) const
{
if (!h->OffsetVertexData)
@@ -217,13 +239,13 @@ struct adt_MH2O
switch (GetLiquidVertexFormat(h))
{
case LiquidVertexFormatType::HeightDepth:
- return ((int8 const*)((int8 const*)this + 8 + h->OffsetVertexData + (h->Width + 1) * (h->Height + 1) * 4))[pos];
+ return ((int8 const*)((int8 const*)this + 8 + h->OffsetVertexData + (h->GetWidth() + 1) * (h->GetHeight() + 1) * 4))[pos];
case LiquidVertexFormatType::HeightTextureCoord:
return 0;
case LiquidVertexFormatType::Depth:
return ((int8 const*)((uint8*)this + 8 + h->OffsetVertexData))[pos];
case LiquidVertexFormatType::HeightDepthTextureCoord:
- return ((int8 const*)((int8 const*)this + 8 + h->OffsetVertexData + (h->Width + 1) * (h->Height + 1) * 8))[pos];
+ return ((int8 const*)((int8 const*)this + 8 + h->OffsetVertexData + (h->GetWidth() + 1) * (h->GetHeight() + 1) * 8))[pos];
case LiquidVertexFormatType::Unk4:
return ((int8 const*)((uint8*)this + 8 + h->OffsetVertexData))[pos * 8];
case LiquidVertexFormatType::Unk5:
@@ -247,9 +269,9 @@ struct adt_MH2O
return nullptr;
case LiquidVertexFormatType::HeightTextureCoord:
case LiquidVertexFormatType::HeightDepthTextureCoord:
- return (uint16 const*)((uint8 const*)this + 8 + h->OffsetVertexData + 4 * ((h->Width + 1) * (h->Height + 1) + pos));
+ return (uint16 const*)((uint8 const*)this + 8 + h->OffsetVertexData + 4 * ((h->GetWidth() + 1) * (h->GetHeight() + 1) + pos));
case LiquidVertexFormatType::Unk5:
- return (uint16 const*)((uint8 const*)this + 8 + h->OffsetVertexData + 8 * ((h->Width + 1) * (h->Height + 1) + pos));
+ return (uint16 const*)((uint8 const*)this + 8 + h->OffsetVertexData + 8 * ((h->GetWidth() + 1) * (h->GetHeight() + 1) + pos));
default:
break;
}