aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2014-10-10 20:17:30 +0200
committerShauren <shauren.trinity@gmail.com>2014-10-10 20:17:30 +0200
commit88ae3da6373dee1f04d03b823ee63d6f1db1502e (patch)
treef9ac27f0a743a57b70e90b37f5971e024992eb00 /src
parentbc97908822c4afa23740ce70151c2486c340e2c2 (diff)
Tools/Extractors: Updated map extractor
Diffstat (limited to 'src')
-rw-r--r--src/tools/map_extractor/CMakeLists.txt6
-rw-r--r--src/tools/map_extractor/System.cpp831
-rw-r--r--src/tools/map_extractor/adt.cpp178
-rw-r--r--src/tools/map_extractor/adt.h105
-rw-r--r--src/tools/map_extractor/dbcfile.cpp13
-rw-r--r--src/tools/map_extractor/dbcfile.h2
-rw-r--r--src/tools/map_extractor/loadlib.cpp132
-rw-r--r--src/tools/map_extractor/loadlib/DBFilesClientList.h531
-rw-r--r--src/tools/map_extractor/loadlib/loadlib.h44
-rw-r--r--src/tools/map_extractor/wdt.cpp84
-rw-r--r--src/tools/map_extractor/wdt.h54
-rw-r--r--src/tools/vmap4_assembler/CMakeLists.txt2
-rw-r--r--src/tools/vmap4_extractor/CMakeLists.txt6
13 files changed, 1014 insertions, 974 deletions
diff --git a/src/tools/map_extractor/CMakeLists.txt b/src/tools/map_extractor/CMakeLists.txt
index 664b80c292d..3d6849eee08 100644
--- a/src/tools/map_extractor/CMakeLists.txt
+++ b/src/tools/map_extractor/CMakeLists.txt
@@ -13,7 +13,7 @@ file(GLOB_RECURSE sources *.cpp *.h)
include_directories (
${CMAKE_SOURCE_DIR}/src/server/shared
- ${CMAKE_SOURCE_DIR}/dep/StormLib/src
+ ${CMAKE_SOURCE_DIR}/dep/CascLib/src
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/loadlib
)
@@ -27,10 +27,10 @@ add_executable(mapextractor
target_link_libraries(mapextractor
${BZIP2_LIBRARIES}
${ZLIB_LIBRARIES}
- storm
+ casc
)
-add_dependencies(mapextractor storm)
+add_dependencies(mapextractor casc)
if( UNIX )
install(TARGETS mapextractor DESTINATION bin)
diff --git a/src/tools/map_extractor/System.cpp b/src/tools/map_extractor/System.cpp
index ab3ebda584d..2bb05445744 100644
--- a/src/tools/map_extractor/System.cpp
+++ b/src/tools/map_extractor/System.cpp
@@ -32,7 +32,8 @@
#define ERROR_PATH_NOT_FOUND ERROR_FILE_NOT_FOUND
#endif
-#include "StormLib.h"
+#include "DBFilesClientList.h"
+#include "CascLib.h"
#include "dbcfile.h"
#include "adt.h"
@@ -55,8 +56,7 @@
#define OPEN_FLAGS (O_RDONLY | O_BINARY)
#endif
-HANDLE WorldMpq = NULL;
-HANDLE LocaleMpq = NULL;
+HANDLE CascStorage = NULL;
typedef struct
{
@@ -88,53 +88,27 @@ bool CONF_allow_height_limit = true;
float CONF_use_minHeight = -500.0f;
// This option allow use float to int conversion
-bool CONF_allow_float_to_int = true;
+bool CONF_allow_float_to_int = false;
float CONF_float_to_int8_limit = 2.0f; // Max accuracy = val/256
float CONF_float_to_int16_limit = 2048.0f; // Max accuracy = val/65536
float CONF_flat_height_delta_limit = 0.005f; // If max - min less this value - surface is flat
float CONF_flat_liquid_delta_limit = 0.001f; // If max - min less this value - liquid surface is flat
-uint32 CONF_TargetBuild = 15595; // 4.3.4.15595
+uint32 CONF_Locale = 0;
-// List MPQ for extract maps from
-char const* CONF_mpq_list[]=
-{
- "world.MPQ",
- "art.MPQ",
- "world2.MPQ",
- "expansion1.MPQ",
- "expansion2.MPQ",
- "expansion3.MPQ",
-};
-
-uint32 const Builds[] = {13164, 13205, 13287, 13329, 13596, 13623, 13914, 14007, 14333, 14480, 14545, 15005, 15050, 15211, 15354, 15595, 0};
-#define LAST_DBC_IN_DATA_BUILD 13623 // after this build mpqs with dbc are back to locale folder
-#define NEW_BASE_SET_BUILD 15211
-
-#define LOCALES_COUNT 15
+#define LOCALES_COUNT 18
char const* Locales[LOCALES_COUNT] =
{
- "enGB", "enUS",
- "deDE", "esES",
- "frFR", "koKR",
- "zhCN", "zhTW",
- "enCN", "enTW",
- "esMX", "ruRU",
- "ptBR", "ptPT",
- "itIT"
-};
-
-TCHAR const* LocalesT[LOCALES_COUNT] =
-{
- _T("enGB"), _T("enUS"),
- _T("deDE"), _T("esES"),
- _T("frFR"), _T("koKR"),
- _T("zhCN"), _T("zhTW"),
- _T("enCN"), _T("enTW"),
- _T("esMX"), _T("ruRU"),
- _T("ptBR"), _T("ptPT"),
- _T("itIT"),
+ "none", "unknown1",
+ "enUS", "koKR",
+ "unknown2", "frFR",
+ "deDE", "zhCN",
+ "esES", "zhTW",
+ "enGB", "enCN",
+ "enTW", "esMX",
+ "ruRU", "ptBR",
+ "itIT", "ptPT",
};
void CreateDir(std::string const& path)
@@ -173,8 +147,7 @@ void Usage(char const* prg)
"-o set output path\n"\
"-e extract only MAP(1)/DBC(2) - standard: both(3)\n"\
"-f height stored as int (less map size but lost some accuracy) 1 by default\n"\
- "-b target build (default %u)\n"\
- "Example: %s -f 0 -i \"c:\\games\\game\"", prg, CONF_TargetBuild, prg);
+ "Example: %s -f 0 -i \"c:\\games\\game\"", prg, prg);
exit(1);
}
@@ -221,9 +194,14 @@ void HandleArgs(int argc, char* arg[])
else
Usage(arg[0]);
break;
- case 'b':
+ case 'l':
if (c + 1 < argc) // all ok
- CONF_TargetBuild = atoi(arg[c++ + 1]);
+ {
+ for (uint32 i = 0; i < LOCALES_COUNT; ++i)
+ if (!strcmp(arg[c + 1], Locales[i]))
+ CONF_Locale = 1 << i;
+ ++c;
+ }
else
Usage(arg[0]);
break;
@@ -240,15 +218,15 @@ uint32 ReadBuild(int locale)
//printf("Read %s file... ", filename.c_str());
HANDLE dbcFile;
- if (!SFileOpenFileEx(LocaleMpq, filename.c_str(), SFILE_OPEN_PATCHED_FILE, &dbcFile))
+ if (!CascOpenFile(CascStorage, filename.c_str(), CASC_LOCALE_ALL, 0, &dbcFile))
{
- printf("Fatal error: Not found %s file!\n", filename.c_str());
- exit(1);
+ printf("Locale %s not installed.\n", Locales[locale]);
+ return 0;
}
char buff[512];
DWORD readBytes = 0;
- SFileReadFile(dbcFile, buff, 512, &readBytes, NULL);
+ CascReadFile(dbcFile, buff, 512, &readBytes);
if (!readBytes)
{
printf("Fatal error: Not found %s file!\n", filename.c_str());
@@ -256,7 +234,7 @@ uint32 ReadBuild(int locale)
}
std::string text = buff;
- SFileCloseFile(dbcFile);
+ CascCloseFile(dbcFile);
size_t pos = text.find("version=\"");
size_t pos1 = pos + strlen("version=\"");
@@ -284,7 +262,7 @@ uint32 ReadMapDBC()
printf("Read Map.dbc file... ");
HANDLE dbcFile;
- if (!SFileOpenFileEx(LocaleMpq, "DBFilesClient\\Map.dbc", SFILE_OPEN_PATCHED_FILE, &dbcFile))
+ if (!CascOpenFile(CascStorage, "DBFilesClient\\Map.dbc", CASC_LOCALE_ALL, 0, &dbcFile))
{
printf("Fatal error: Cannot find Map.dbc in archive!\n");
exit(1);
@@ -305,7 +283,7 @@ uint32 ReadMapDBC()
strcpy(map_ids[x].name, dbc.getRecord(x).getString(1));
}
- SFileCloseFile(dbcFile);
+ CascCloseFile(dbcFile);
printf("Done! (%u maps loaded)\n", uint32(map_count));
return map_count;
}
@@ -314,7 +292,7 @@ void ReadAreaTableDBC()
{
printf("Read AreaTable.dbc file...");
HANDLE dbcFile;
- if (!SFileOpenFileEx(LocaleMpq, "DBFilesClient\\AreaTable.dbc", SFILE_OPEN_PATCHED_FILE, &dbcFile))
+ if (!CascOpenFile(CascStorage, "DBFilesClient\\AreaTable.dbc", CASC_LOCALE_ALL, 0, &dbcFile))
{
printf("Fatal error: Cannot find AreaTable.dbc in archive!\n");
exit(1);
@@ -334,7 +312,7 @@ void ReadAreaTableDBC()
for (uint32 x = 0; x < area_count; ++x)
areas[dbc.getRecord(x).getUInt(0)] = dbc.getRecord(x).getUInt(3);
- SFileCloseFile(dbcFile);
+ CascCloseFile(dbcFile);
printf("Done! (%u areas loaded)\n", uint32(area_count));
}
@@ -342,7 +320,7 @@ void ReadLiquidTypeTableDBC()
{
printf("Read LiquidType.dbc file...");
HANDLE dbcFile;
- if (!SFileOpenFileEx(LocaleMpq, "DBFilesClient\\LiquidType.dbc", SFILE_OPEN_PATCHED_FILE, &dbcFile))
+ if (!CascOpenFile(CascStorage, "DBFilesClient\\LiquidType.dbc", CASC_LOCALE_ALL, 0, &dbcFile))
{
printf("Fatal error: Cannot find LiquidType.dbc in archive!\n");
exit(1);
@@ -363,7 +341,7 @@ void ReadLiquidTypeTableDBC()
for(uint32 x = 0; x < liqTypeCount; ++x)
LiqType[dbc.getRecord(x).getUInt(0)] = dbc.getRecord(x).getUInt(3);
- SFileCloseFile(dbcFile);
+ CascCloseFile(dbcFile);
printf("Done! (%u LiqTypes loaded)\n", (uint32)liqTypeCount);
}
@@ -462,18 +440,15 @@ uint16 liquid_entry[ADT_CELLS_PER_GRID][ADT_CELLS_PER_GRID];
uint8 liquid_flags[ADT_CELLS_PER_GRID][ADT_CELLS_PER_GRID];
bool liquid_show[ADT_GRID_SIZE][ADT_GRID_SIZE];
float liquid_height[ADT_GRID_SIZE+1][ADT_GRID_SIZE+1];
+uint16 holes[ADT_CELLS_PER_GRID][ADT_CELLS_PER_GRID];
bool ConvertADT(char *filename, char *filename2, int /*cell_y*/, int /*cell_x*/, uint32 build)
{
- ADT_file adt;
+ ChunkedFile adt;
- if (!adt.loadFile(WorldMpq, filename))
+ if (!adt.loadFile(CascStorage, filename))
return false;
- memset(liquid_show, 0, sizeof(liquid_show));
- memset(liquid_flags, 0, sizeof(liquid_flags));
- memset(liquid_entry, 0, sizeof(liquid_entry));
-
// Prepare map header
map_fileheader map;
map.mapMagic = *(uint32 const*)MAP_MAGIC;
@@ -481,24 +456,225 @@ bool ConvertADT(char *filename, char *filename2, int /*cell_y*/, int /*cell_x*/,
map.buildMagic = build;
// Get area flags data
- for (int i = 0; i < ADT_CELLS_PER_GRID; ++i)
+ memset(area_flags, 0xFF, sizeof(area_flags));
+ memset(V9, 0, sizeof(V9));
+ memset(V8, 0, sizeof(V8));
+
+ memset(liquid_show, 0, sizeof(liquid_show));
+ memset(liquid_flags, 0, sizeof(liquid_flags));
+ memset(liquid_entry, 0, sizeof(liquid_entry));
+
+ memset(holes, 0, sizeof(holes));
+
+ bool hasHoles = false;
+
+ for (std::multimap<std::string, FileChunk*>::const_iterator itr = adt.chunks.lower_bound("MCNK"); itr != adt.chunks.upper_bound("MCNK"); ++itr)
{
- for (int j = 0; j < ADT_CELLS_PER_GRID; ++j)
+ adt_MCNK* mcnk = itr->second->As<adt_MCNK>();
+
+ // Area data
+ if (mcnk->areaid <= maxAreaId && areas[mcnk->areaid] != 0xFFFF)
+ area_flags[mcnk->iy][mcnk->ix] = areas[mcnk->areaid];
+
+ // Height
+ // Height values for triangles stored in order:
+ // 1 2 3 4 5 6 7 8 9
+ // 10 11 12 13 14 15 16 17
+ // 18 19 20 21 22 23 24 25 26
+ // 27 28 29 30 31 32 33 34
+ // . . . . . . . .
+ // For better get height values merge it to V9 and V8 map
+ // V9 height map:
+ // 1 2 3 4 5 6 7 8 9
+ // 18 19 20 21 22 23 24 25 26
+ // . . . . . . . .
+ // V8 height map:
+ // 10 11 12 13 14 15 16 17
+ // 27 28 29 30 31 32 33 34
+ // . . . . . . . .
+
+ // Set map height as grid height
+ for (int y = 0; y <= ADT_CELL_SIZE; y++)
+ {
+ int cy = mcnk->iy * ADT_CELL_SIZE + y;
+ for (int x = 0; x <= ADT_CELL_SIZE; x++)
+ {
+ int cx = mcnk->ix * ADT_CELL_SIZE + x;
+ V9[cy][cx] = mcnk->ypos;
+ }
+ }
+
+ for (int y = 0; y < ADT_CELL_SIZE; y++)
{
- adt_MCNK* cell = adt.cells[i][j];
- uint32 areaid = cell->areaid;
- if (areaid && areaid <= maxAreaId)
+ int cy = mcnk->iy * ADT_CELL_SIZE + y;
+ for (int x = 0; x < ADT_CELL_SIZE; x++)
{
- if (areas[areaid] != 0xFFFF)
+ int cx = mcnk->ix * ADT_CELL_SIZE + x;
+ V8[cy][cx] = mcnk->ypos;
+ }
+ }
+
+ // Get custom height
+ if (FileChunk* chunk = itr->second->GetSubChunk("MCVT"))
+ {
+ adt_MCVT* mcvt = chunk->As<adt_MCVT>();
+ // get V9 height map
+ for (int y = 0; y <= ADT_CELL_SIZE; y++)
+ {
+ int cy = mcnk->iy * ADT_CELL_SIZE + y;
+ for (int x = 0; x <= ADT_CELL_SIZE; x++)
{
- area_flags[i][j] = areas[areaid];
- continue;
+ int cx = mcnk->ix * ADT_CELL_SIZE + x;
+ V9[cy][cx] += mcvt->height_map[y*(ADT_CELL_SIZE * 2 + 1) + x];
+ }
+ }
+ // get V8 height map
+ for (int y = 0; y < ADT_CELL_SIZE; y++)
+ {
+ int cy = mcnk->iy * ADT_CELL_SIZE + y;
+ for (int x = 0; x < ADT_CELL_SIZE; x++)
+ {
+ int cx = mcnk->ix * ADT_CELL_SIZE + x;
+ V8[cy][cx] += mcvt->height_map[y*(ADT_CELL_SIZE * 2 + 1) + ADT_CELL_SIZE + 1 + x];
+ }
+ }
+ }
+
+ // Liquid data
+ if (mcnk->sizeMCLQ > 8)
+ {
+ if (FileChunk* chunk = itr->second->GetSubChunk("MCLQ"))
+ {
+ adt_MCLQ* liquid = chunk->As<adt_MCLQ>();
+ int count = 0;
+ for (int y = 0; y < ADT_CELL_SIZE; ++y)
+ {
+ int cy = mcnk->iy * ADT_CELL_SIZE + y;
+ for (int x = 0; x < ADT_CELL_SIZE; ++x)
+ {
+ int cx = mcnk->ix * ADT_CELL_SIZE + x;
+ if (liquid->flags[y][x] != 0x0F)
+ {
+ liquid_show[cy][cx] = true;
+ if (liquid->flags[y][x] & (1 << 7))
+ liquid_flags[mcnk->iy][mcnk->ix] |= MAP_LIQUID_TYPE_DARK_WATER;
+ ++count;
+ }
+ }
+ }
+
+ uint32 c_flag = mcnk->flags;
+ if (c_flag & (1 << 2))
+ {
+ liquid_entry[mcnk->iy][mcnk->ix] = 1;
+ liquid_flags[mcnk->iy][mcnk->ix] |= MAP_LIQUID_TYPE_WATER; // water
+ }
+ if (c_flag & (1 << 3))
+ {
+ liquid_entry[mcnk->iy][mcnk->ix] = 2;
+ liquid_flags[mcnk->iy][mcnk->ix] |= MAP_LIQUID_TYPE_OCEAN; // ocean
}
+ if (c_flag & (1 << 4))
+ {
+ liquid_entry[mcnk->iy][mcnk->ix] = 3;
+ liquid_flags[mcnk->iy][mcnk->ix] |= MAP_LIQUID_TYPE_MAGMA; // magma/slime
+ }
+
+ if (!count && liquid_flags[mcnk->iy][mcnk->ix])
+ fprintf(stderr, "Wrong liquid detect in MCLQ chunk");
- printf("File: %s\nCan't find area flag for areaid %u [%d, %d].\n", filename, areaid, cell->ix, cell->iy);
+ for (int y = 0; y <= ADT_CELL_SIZE; ++y)
+ {
+ int cy = mcnk->iy * ADT_CELL_SIZE + y;
+ for (int x = 0; x <= ADT_CELL_SIZE; ++x)
+ {
+ int cx = mcnk->ix * ADT_CELL_SIZE + x;
+ liquid_height[cy][cx] = liquid->liquid[y][x].height;
+ }
+ }
+ }
+ }
+
+ // Hole data
+ if (!(mcnk->flags & 0x10000))
+ {
+ if (uint16 hole = mcnk->holes)
+ {
+ holes[mcnk->iy][mcnk->ix] = mcnk->holes;
+ hasHoles = true;
}
+ }
+ }
+
+ // Get liquid map for grid (in WOTLK used MH2O chunk)
+ if (FileChunk* chunk = adt.GetChunk("MH2O"))
+ {
+ adt_MH2O* h2o = chunk->As<adt_MH2O>();
+ for (int i = 0; i < ADT_CELLS_PER_GRID; i++)
+ {
+ for (int j = 0; j < ADT_CELLS_PER_GRID; j++)
+ {
+ adt_liquid_header *h = h2o->getLiquidData(i, j);
+ if (!h)
+ continue;
+
+ int count = 0;
+ uint64 show = h2o->getLiquidShowMap(h);
+ for (int y = 0; y < h->height; y++)
+ {
+ int cy = i * ADT_CELL_SIZE + y + h->yOffset;
+ for (int x = 0; x < h->width; x++)
+ {
+ int cx = j * ADT_CELL_SIZE + x + h->xOffset;
+ if (show & 1)
+ {
+ liquid_show[cy][cx] = true;
+ ++count;
+ }
+ show >>= 1;
+ }
+ }
+
+ liquid_entry[i][j] = h->liquidType;
+ switch (LiqType[h->liquidType])
+ {
+ 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_MAGMA: liquid_flags[i][j] |= MAP_LIQUID_TYPE_MAGMA; break;
+ case LIQUID_TYPE_SLIME: liquid_flags[i][j] |= MAP_LIQUID_TYPE_SLIME; break;
+ default:
+ printf("\nCan't find Liquid type %u for map %s\nchunk %d,%d\n", h->liquidType, filename, i, j);
+ break;
+ }
+ // Dark water detect
+ if (LiqType[h->liquidType] == LIQUID_TYPE_OCEAN)
+ {
+ uint8* lm = h2o->getLiquidLightMap(h);
+ if (!lm)
+ liquid_flags[i][j] |= MAP_LIQUID_TYPE_DARK_WATER;
+ }
+
+ if (!count && liquid_flags[i][j])
+ printf("Wrong liquid detect in MH2O chunk");
+
+ float* height = h2o->getLiquidHeightMap(h);
+ int pos = 0;
+ for (int y = 0; y <= h->height; y++)
+ {
+ int cy = i * ADT_CELL_SIZE + y + h->yOffset;
+ for (int x = 0; x <= h->width; x++)
+ {
+ int cx = j * ADT_CELL_SIZE + x + h->xOffset;
+
+ if (height)
+ liquid_height[cy][cx] = height[pos];
+ else
+ liquid_height[cy][cx] = h->heightLevel1;
- area_flags[i][j] = 0xffff;
+ pos++;
+ }
+ }
+ }
}
}
@@ -536,77 +712,6 @@ bool ConvertADT(char *filename, char *filename2, int /*cell_y*/, int /*cell_x*/,
areaHeader.gridArea = (uint16)areaflag;
}
- //
- // Get Height map from grid
- //
- for (int i=0;i<ADT_CELLS_PER_GRID;i++)
- {
- for(int j=0;j<ADT_CELLS_PER_GRID;j++)
- {
- adt_MCNK * cell = adt.cells[i][j];
- if (!cell)
- continue;
- // Height values for triangles stored in order:
- // 1 2 3 4 5 6 7 8 9
- // 10 11 12 13 14 15 16 17
- // 18 19 20 21 22 23 24 25 26
- // 27 28 29 30 31 32 33 34
- // . . . . . . . .
- // For better get height values merge it to V9 and V8 map
- // V9 height map:
- // 1 2 3 4 5 6 7 8 9
- // 18 19 20 21 22 23 24 25 26
- // . . . . . . . .
- // V8 height map:
- // 10 11 12 13 14 15 16 17
- // 27 28 29 30 31 32 33 34
- // . . . . . . . .
-
- // Set map height as grid height
- for (int y=0; y <= ADT_CELL_SIZE; y++)
- {
- int cy = i*ADT_CELL_SIZE + y;
- for (int x=0; x <= ADT_CELL_SIZE; x++)
- {
- int cx = j*ADT_CELL_SIZE + x;
- V9[cy][cx]=cell->ypos;
- }
- }
- for (int y=0; y < ADT_CELL_SIZE; y++)
- {
- int cy = i*ADT_CELL_SIZE + y;
- for (int x=0; x < ADT_CELL_SIZE; x++)
- {
- int cx = j*ADT_CELL_SIZE + x;
- V8[cy][cx]=cell->ypos;
- }
- }
- // Get custom height
- adt_MCVT *v = cell->getMCVT();
- if (!v)
- continue;
- // get V9 height map
- for (int y=0; y <= ADT_CELL_SIZE; y++)
- {
- int cy = i*ADT_CELL_SIZE + y;
- for (int x=0; x <= ADT_CELL_SIZE; x++)
- {
- int cx = j*ADT_CELL_SIZE + x;
- V9[cy][cx]+=v->height_map[y*(ADT_CELL_SIZE*2+1)+x];
- }
- }
- // get V8 height map
- for (int y=0; y < ADT_CELL_SIZE; y++)
- {
- int cy = i*ADT_CELL_SIZE + y;
- for (int x=0; x < ADT_CELL_SIZE; x++)
- {
- int cx = j*ADT_CELL_SIZE + x;
- V8[cy][cx]+=v->height_map[y*(ADT_CELL_SIZE*2+1)+ADT_CELL_SIZE+1+x];
- }
- }
- }
- }
//============================================
// Try pack height data
//============================================
@@ -709,140 +814,6 @@ bool ConvertADT(char *filename, char *filename2, int /*cell_y*/, int /*cell_x*/,
map.heightMapSize+= sizeof(V9) + sizeof(V8);
}
- // Get from MCLQ chunk (old)
- for (int i = 0; i < ADT_CELLS_PER_GRID; i++)
- {
- for(int j = 0; j < ADT_CELLS_PER_GRID; j++)
- {
- adt_MCNK *cell = adt.cells[i][j];
- if (!cell)
- continue;
-
- adt_MCLQ *liquid = cell->getMCLQ();
- int count = 0;
- if (!liquid || cell->sizeMCLQ <= 8)
- continue;
-
- for (int y = 0; y < ADT_CELL_SIZE; y++)
- {
- int cy = i * ADT_CELL_SIZE + y;
- for (int x = 0; x < ADT_CELL_SIZE; x++)
- {
- int cx = j * ADT_CELL_SIZE + x;
- if (liquid->flags[y][x] != 0x0F)
- {
- liquid_show[cy][cx] = true;
- if (liquid->flags[y][x] & (1<<7))
- liquid_flags[i][j] |= MAP_LIQUID_TYPE_DARK_WATER;
- ++count;
- }
- }
- }
-
- uint32 c_flag = cell->flags;
- if (c_flag & (1<<2))
- {
- liquid_entry[i][j] = 1;
- liquid_flags[i][j] |= MAP_LIQUID_TYPE_WATER; // water
- }
- if (c_flag & (1<<3))
- {
- liquid_entry[i][j] = 2;
- liquid_flags[i][j] |= MAP_LIQUID_TYPE_OCEAN; // ocean
- }
- if (c_flag & (1<<4))
- {
- liquid_entry[i][j] = 3;
- liquid_flags[i][j] |= MAP_LIQUID_TYPE_MAGMA; // magma/slime
- }
-
- if (!count && liquid_flags[i][j])
- fprintf(stderr, "Wrong liquid detect in MCLQ chunk");
-
- for (int y = 0; y <= ADT_CELL_SIZE; y++)
- {
- int cy = i * ADT_CELL_SIZE + y;
- for (int x = 0; x <= ADT_CELL_SIZE; x++)
- {
- int cx = j * ADT_CELL_SIZE + x;
- liquid_height[cy][cx] = liquid->liquid[y][x].height;
- }
- }
- }
- }
-
- // Get liquid map for grid (in WOTLK used MH2O chunk)
- adt_MH2O * h2o = adt.a_grid->getMH2O();
- if (h2o)
- {
- for (int i = 0; i < ADT_CELLS_PER_GRID; i++)
- {
- for(int j = 0; j < ADT_CELLS_PER_GRID; j++)
- {
- adt_liquid_header *h = h2o->getLiquidData(i,j);
- if (!h)
- continue;
-
- int count = 0;
- uint64 show = h2o->getLiquidShowMap(h);
- for (int y = 0; y < h->height; y++)
- {
- int cy = i * ADT_CELL_SIZE + y + h->yOffset;
- for (int x = 0; x < h->width; x++)
- {
- int cx = j * ADT_CELL_SIZE + x + h->xOffset;
- if (show & 1)
- {
- liquid_show[cy][cx] = true;
- ++count;
- }
- show >>= 1;
- }
- }
-
- liquid_entry[i][j] = h->liquidType;
- switch (LiqType[h->liquidType])
- {
- 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_MAGMA: liquid_flags[i][j] |= MAP_LIQUID_TYPE_MAGMA; break;
- case LIQUID_TYPE_SLIME: liquid_flags[i][j] |= MAP_LIQUID_TYPE_SLIME; break;
- default:
- printf("\nCan't find Liquid type %u for map %s\nchunk %d,%d\n", h->liquidType, filename, i, j);
- break;
- }
- // Dark water detect
- if (LiqType[h->liquidType] == LIQUID_TYPE_OCEAN)
- {
- uint8* lm = h2o->getLiquidLightMap(h);
- if (!lm)
- liquid_flags[i][j] |= MAP_LIQUID_TYPE_DARK_WATER;
- }
-
- if (!count && liquid_flags[i][j])
- printf("Wrong liquid detect in MH2O chunk");
-
- float* height = h2o->getLiquidHeightMap(h);
- int pos = 0;
- for (int y = 0; y <= h->height; y++)
- {
- int cy = i * ADT_CELL_SIZE + y + h->yOffset;
- for (int x = 0; x <= h->width; x++)
- {
- int cx = j * ADT_CELL_SIZE + x + h->xOffset;
-
- if (height)
- liquid_height[cy][cx] = height[pos];
- else
- liquid_height[cy][cx] = h->heightLevel1;
-
- pos++;
- }
- }
- }
- }
- }
-
//============================================
// Pack liquid data
//============================================
@@ -924,30 +895,11 @@ bool ConvertADT(char *filename, char *filename2, int /*cell_y*/, int /*cell_x*/,
map.liquidMapSize += sizeof(float)*liquidHeader.width*liquidHeader.height;
}
- // map hole info
- uint16 holes[ADT_CELLS_PER_GRID][ADT_CELLS_PER_GRID];
-
if (map.liquidMapOffset)
map.holesOffset = map.liquidMapOffset + map.liquidMapSize;
else
map.holesOffset = map.heightMapOffset + map.heightMapSize;
- memset(holes, 0, sizeof(holes));
- bool hasHoles = false;
-
- for (int i = 0; i < ADT_CELLS_PER_GRID; ++i)
- {
- for (int j = 0; j < ADT_CELLS_PER_GRID; ++j)
- {
- adt_MCNK * cell = adt.cells[i][j];
- if (!cell)
- continue;
- holes[i][j] = cell->holes;
- if (!hasHoles && cell->holes != 0)
- hasHoles = true;
- }
- }
-
if (hasHoles)
map.holesSize = sizeof(holes);
else
@@ -1013,11 +965,10 @@ bool ConvertADT(char *filename, char *filename2, int /*cell_y*/, int /*cell_x*/,
return true;
}
-void ExtractMapsFromMpq(uint32 build)
+void ExtractMaps(uint32 build)
{
- char mpq_filename[1024];
+ char storagePath[1024];
char output_filename[1024];
- char mpq_map_name[1024];
printf("Extracting maps...\n");
@@ -1035,21 +986,22 @@ void ExtractMapsFromMpq(uint32 build)
{
printf("Extract %s (%d/%u) \n", map_ids[z].name, z+1, map_count);
// Loadup map grid data
- sprintf(mpq_map_name, "World\\Maps\\%s\\%s.wdt", map_ids[z].name, map_ids[z].name);
- WDT_file wdt;
- if (!wdt.loadFile(WorldMpq, mpq_map_name, false))
+ sprintf(storagePath, "World\\Maps\\%s\\%s.wdt", map_ids[z].name, map_ids[z].name);
+ ChunkedFile wdt;
+ if (!wdt.loadFile(CascStorage, storagePath, false))
continue;
+ FileChunk* chunk = wdt.GetChunk("MAIN");
for (uint32 y = 0; y < WDT_MAP_SIZE; ++y)
{
for (uint32 x = 0; x < WDT_MAP_SIZE; ++x)
{
- if (!(wdt.main->adt_list[y][x].flag & 0x1))
+ if (!(chunk->As<wdt_MAIN>()->adt_list[y][x].flag & 0x1))
continue;
- sprintf(mpq_filename, "World\\Maps\\%s\\%s_%u_%u.adt", map_ids[z].name, map_ids[z].name, x, y);
+ sprintf(storagePath, "World\\Maps\\%s\\%s_%u_%u.adt", map_ids[z].name, map_ids[z].name, x, y);
sprintf(output_filename, "%s/maps/%03u%02u%02u.map", output_path, map_ids[z].id, y, x);
- ConvertADT(mpq_filename, output_filename, y, x, build);
+ ConvertADT(storagePath, output_filename, y, x, build);
}
// draw progress bar
@@ -1058,8 +1010,8 @@ void ExtractMapsFromMpq(uint32 build)
}
printf("\n");
- delete [] areas;
- delete [] map_ids;
+ delete[] areas;
+ delete[] map_ids;
}
bool ExtractFile(HANDLE fileInArchive, char const* filename)
@@ -1076,7 +1028,7 @@ bool ExtractFile(HANDLE fileInArchive, char const* filename)
while (readBytes > 0)
{
- SFileReadFile(fileInArchive, buffer, sizeof(buffer), &readBytes, NULL);
+ CascReadFile(fileInArchive, buffer, sizeof(buffer), &readBytes);
if (readBytes > 0)
fwrite(buffer, 1, readBytes, output);
}
@@ -1085,213 +1037,54 @@ bool ExtractFile(HANDLE fileInArchive, char const* filename)
return true;
}
-void ExtractDBCFiles(int l, bool basicLocale)
+void ExtractDBFilesClient(int l)
{
- printf("Extracting dbc files...\n");
-
- SFILE_FIND_DATA foundFile;
- memset(&foundFile, 0, sizeof(foundFile));
- HANDLE listFile = SFileFindFirstFile(LocaleMpq, "DBFilesClient\\*dbc", &foundFile, NULL);
- HANDLE dbcFile = NULL;
- uint32 count = 0;
- if (listFile)
- {
- std::string outputPath = output_path;
- outputPath += "/dbc/";
-
- CreateDir(outputPath);
- if (!basicLocale)
- {
- outputPath += Locales[l];
- outputPath += "/";
- CreateDir(outputPath);
- }
-
- std::string filename;
-
- do
- {
- if (!SFileOpenFileEx(LocaleMpq, foundFile.cFileName, SFILE_OPEN_PATCHED_FILE, &dbcFile))
- {
- printf("Unable to open file %s in the archive\n", foundFile.cFileName);
- continue;
- }
-
- filename = foundFile.cFileName;
- filename = outputPath + filename.substr(filename.rfind('\\') + 1);
+ printf("Extracting dbc/db2 files...\n");
- if (FileExists(filename.c_str()))
- continue;
-
- if (ExtractFile(dbcFile, filename.c_str()))
- ++count;
-
- SFileCloseFile(dbcFile);
- } while (SFileFindNextFile(listFile, &foundFile));
-
- SFileFindClose(listFile);
- }
-
- printf("Extracted %u DBC files\n\n", count);
-}
+ std::string outputPath = output_path;
+ outputPath += "/dbc/";
-void ExtractDB2Files(int l, bool basicLocale)
-{
- printf("Extracting db2 files...\n");
+ CreateDir(outputPath);
+ outputPath += Locales[l];
+ outputPath += "/";
+ CreateDir(outputPath);
- SFILE_FIND_DATA foundFile;
- memset(&foundFile, 0, sizeof(foundFile));
- HANDLE listFile = SFileFindFirstFile(LocaleMpq, "DBFilesClient\\*db2", &foundFile, NULL);
- HANDLE dbcFile = NULL;
+ uint32 index = 0;
uint32 count = 0;
- if (listFile)
+ char const* fileName = DBFilesClientList[index];
+ HANDLE dbcFile;
+ while (fileName)
{
- std::string outputPath = output_path;
- outputPath += "/dbc/";
- if (!basicLocale)
+ if (CascOpenFile(CascStorage, fileName, 1 << l, 0, &dbcFile))
{
- outputPath += Locales[l];
- outputPath += "/";
- }
-
- std::string filename;
-
- do
- {
- if (!SFileOpenFileEx(LocaleMpq, foundFile.cFileName, SFILE_OPEN_PATCHED_FILE, &dbcFile))
- {
- printf("Unable to open file %s in the archive\n", foundFile.cFileName);
- continue;
- }
-
- filename = foundFile.cFileName;
+ std::string filename = fileName;
filename = outputPath + filename.substr(filename.rfind('\\') + 1);
- if (ExtractFile(dbcFile, filename.c_str()))
- ++count;
-
- SFileCloseFile(dbcFile);
- } while (SFileFindNextFile(listFile, &foundFile));
- SFileFindClose(listFile);
- }
-
- printf("Extracted %u DB2 files\n\n", count);
-}
+ if (!FileExists(filename.c_str()))
+ if (ExtractFile(dbcFile, filename.c_str()))
+ ++count;
-bool LoadLocaleMPQFile(int locale)
-{
- TCHAR buff[512];
- memset(buff, 0, sizeof(buff));
- _stprintf(buff, _T("%s/Data/%s/locale-%s.MPQ"), input_path, LocalesT[locale], LocalesT[locale]);
- if (!SFileOpenArchive(buff, 0, MPQ_OPEN_READ_ONLY, &LocaleMpq))
- {
- if (GetLastError() != ERROR_PATH_NOT_FOUND)
- {
- _tprintf(_T("\nLoading %s locale MPQs\n"), LocalesT[locale]);
- _tprintf(_T("Cannot open archive %s\n"), buff);
- }
- return false;
- }
-
- _tprintf(_T("\nLoading %s locale MPQs\n"), LocalesT[locale]);
- char const* prefix = NULL;
- for (int i = 0; Builds[i] && Builds[i] <= CONF_TargetBuild; ++i)
- {
- // Do not attempt to read older MPQ patch archives past this build, they were merged with base
- // and trying to read them together with new base will not end well
- if (CONF_TargetBuild >= NEW_BASE_SET_BUILD && Builds[i] < NEW_BASE_SET_BUILD)
- continue;
-
- memset(buff, 0, sizeof(buff));
- if (Builds[i] > LAST_DBC_IN_DATA_BUILD)
- {
- prefix = "";
- _stprintf(buff, _T("%s/Data/%s/wow-update-%s-%u.MPQ"), input_path, LocalesT[locale], LocalesT[locale], Builds[i]);
+ CascCloseFile(dbcFile);
}
else
- {
- prefix = Locales[locale];
- _stprintf(buff, _T("%s/Data/wow-update-%u.MPQ"), input_path, Builds[i]);
- }
+ printf("Unable to open file %s in the archive for locale %s.\n", fileName, Locales[l]);
- if (!SFileOpenPatchArchive(LocaleMpq, buff, prefix, 0))
- {
- if (GetLastError() != ERROR_FILE_NOT_FOUND)
- _tprintf(_T("Cannot open patch archive %s\n"), buff);
- continue;
- }
- else
- _tprintf(_T("Loaded %s\n"), buff);
+ fileName = DBFilesClientList[++index];
}
- printf("\n");
- return true;
+ printf("Extracted %u files\n\n", count);
}
-void LoadCommonMPQFiles(uint32 build)
+bool OpenCascStorage()
{
- TCHAR filename[512];
- _stprintf(filename, _T("%s/Data/world.MPQ"), input_path);
- _tprintf(_T("Loading common MPQ files\n"));
- if (!SFileOpenArchive(filename, 0, MPQ_OPEN_READ_ONLY, &WorldMpq))
- {
- if (GetLastError() != ERROR_PATH_NOT_FOUND)
- _tprintf(_T("Cannot open archive %s\n"), filename);
- return;
- }
-
- int count = sizeof(CONF_mpq_list) / sizeof(char*);
- for (int i = 1; i < count; ++i)
- {
- if (build < NEW_BASE_SET_BUILD && !strcmp("world2.MPQ", CONF_mpq_list[i])) // 4.3.2 and higher MPQ
- continue;
-
- _stprintf(filename, _T("%s/Data/%s"), input_path, CONF_mpq_list[i]);
- if (!SFileOpenPatchArchive(WorldMpq, filename, "", 0))
- {
- if (GetLastError() != ERROR_PATH_NOT_FOUND)
- _tprintf(_T("Cannot open archive %s\n"), filename);
- else
- _tprintf(_T("Not found %s\n"), filename);
- }
- else
- _tprintf(_T("Loaded %s\n"), filename);
-
- }
-
- char const* prefix = NULL;
- for (int i = 0; Builds[i] && Builds[i] <= CONF_TargetBuild; ++i)
+ if (!CascOpenStorage(".\\Data", 0, &CascStorage))
{
- // Do not attempt to read older MPQ patch archives past this build, they were merged with base
- // and trying to read them together with new base will not end well
- if (CONF_TargetBuild >= NEW_BASE_SET_BUILD && Builds[i] < NEW_BASE_SET_BUILD)
- continue;
-
- memset(filename, 0, sizeof(filename));
- if (Builds[i] > LAST_DBC_IN_DATA_BUILD)
- {
- prefix = "";
- _stprintf(filename, _T("%s/Data/wow-update-base-%u.MPQ"), input_path, Builds[i]);
- }
- else
- {
- prefix = "base";
- _stprintf(filename, _T("%s/Data/wow-update-%u.MPQ"), input_path, Builds[i]);
- }
-
- if (!SFileOpenPatchArchive(WorldMpq, filename, prefix, 0))
- {
- if (GetLastError() != ERROR_PATH_NOT_FOUND)
- _tprintf(_T("Cannot open patch archive %s\n"), filename);
- else
- _tprintf(_T("Not found %s\n"), filename);
- continue;
- }
- else
- _tprintf(_T("Loaded %s\n"), filename);
+ printf("Error %d\n", GetLastError());
+ return false;
}
printf("\n");
+ return true;
}
int main(int argc, char * arg[])
@@ -1304,54 +1097,42 @@ int main(int argc, char * arg[])
int FirstLocale = -1;
uint32 build = 0;
+ if (!OpenCascStorage())
+ {
+ if (GetLastError() != ERROR_PATH_NOT_FOUND)
+ printf("Unable to open storage!\n");
+ return 1;
+ }
+
for (int i = 0; i < LOCALES_COUNT; ++i)
{
- //Open MPQs
- if (!LoadLocaleMPQFile(i))
- {
- if (GetLastError() != ERROR_PATH_NOT_FOUND)
- printf("Unable to load %s locale archives!\n", Locales[i]);
+ if (CONF_Locale && !(CONF_Locale & (1 << i)))
continue;
- }
- printf("Detected locale: %s\n", Locales[i]);
if ((CONF_extract & EXTRACT_DBC) == 0)
{
FirstLocale = i;
build = ReadBuild(i);
- if (build > CONF_TargetBuild)
- {
- printf("Base locale-%s.MPQ has build higher than target build (%u > %u), nothing extracted!\n", Locales[i], build, CONF_TargetBuild);
- return 0;
- }
+ if (!build)
+ continue;
- printf("Detected client build: %u\n", build);
- printf("\n");
+ printf("Detected client build: %u\n\n", build);
break;
}
//Extract DBC files
uint32 tempBuild = ReadBuild(i);
- printf("Detected client build %u for locale %s\n", tempBuild, Locales[i]);
- if (tempBuild > CONF_TargetBuild)
- {
- SFileCloseArchive(LocaleMpq);
- printf("Base locale-%s.MPQ has build higher than target build (%u > %u), nothing extracted!\n", Locales[i], tempBuild, CONF_TargetBuild);
+ if (!tempBuild)
continue;
- }
- printf("\n");
- ExtractDBCFiles(i, FirstLocale < 0);
- ExtractDB2Files(i, FirstLocale < 0);
+ printf("Detected client build %u for locale %s\n\n", tempBuild, Locales[i]);
+ ExtractDBFilesClient(i);
if (FirstLocale < 0)
{
FirstLocale = i;
build = tempBuild;
}
-
- //Close MPQs
- SFileCloseArchive(LocaleMpq);
}
if (FirstLocale < 0)
@@ -1364,17 +1145,9 @@ int main(int argc, char * arg[])
{
printf("Using locale: %s\n", Locales[FirstLocale]);
- // Open MPQs
- LoadLocaleMPQFile(FirstLocale);
- LoadCommonMPQFiles(build);
-
- // Extract maps
- ExtractMapsFromMpq(build);
-
- // Close MPQs
- SFileCloseArchive(WorldMpq);
- SFileCloseArchive(LocaleMpq);
+ ExtractMaps(build);
}
+ CascCloseStorage(CascStorage);
return 0;
}
diff --git a/src/tools/map_extractor/adt.cpp b/src/tools/map_extractor/adt.cpp
deleted file mode 100644
index 9260828fd41..00000000000
--- a/src/tools/map_extractor/adt.cpp
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
- * Copyright (C) 2005-2011 MaNGOS <http://getmangos.com/>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#define _CRT_SECURE_NO_DEPRECATE
-
-#include "adt.h"
-#include <cstring>
-
-// Helper
-int holetab_h[4] = {0x1111, 0x2222, 0x4444, 0x8888};
-int holetab_v[4] = {0x000F, 0x00F0, 0x0F00, 0xF000};
-
-u_map_fcc MHDRMagic = { {'R','D','H','M'} };
-u_map_fcc MCINMagic = { {'N','I','C','M'} };
-u_map_fcc MH2OMagic = { {'O','2','H','M'} };
-u_map_fcc MCNKMagic = { {'K','N','C','M'} };
-u_map_fcc MCVTMagic = { {'T','V','C','M'} };
-u_map_fcc MCLQMagic = { {'Q','L','C','M'} };
-
-bool isHole(int holes, int i, int j)
-{
- int testi = i / 2;
- int testj = j / 4;
- if(testi > 3) testi = 3;
- if(testj > 3) testj = 3;
- return (holes & holetab_h[testi] & holetab_v[testj]) != 0;
-}
-
-//
-// Adt file loader class
-//
-ADT_file::ADT_file()
-{
- a_grid = 0;
-}
-
-ADT_file::~ADT_file()
-{
- free();
-}
-
-void ADT_file::free()
-{
- a_grid = 0;
- FileLoader::free();
-}
-
-//
-// Adt file check function
-//
-bool ADT_file::prepareLoadedData()
-{
- // Check parent
- if (!FileLoader::prepareLoadedData())
- return false;
-
- // Check and prepare MHDR
- a_grid = (adt_MHDR*)(GetData()+8+version->size);
- if (!a_grid->prepareLoadedData())
- return false;
-
- // funny offsets calculations because there is no mapping for them and they have variable lengths
- uint8* ptr = (uint8*)a_grid + a_grid->size + 8;
- uint32 mcnk_count = 0;
- memset(cells, 0, ADT_CELLS_PER_GRID * ADT_CELLS_PER_GRID * sizeof(adt_MCNK*));
- while (ptr < GetData() + GetDataSize())
- {
- uint32 header = *(uint32*)ptr;
- uint32 size = *(uint32*)(ptr + 4);
- if (header == MCNKMagic.fcc)
- {
- cells[mcnk_count / ADT_CELLS_PER_GRID][mcnk_count % ADT_CELLS_PER_GRID] = (adt_MCNK*)ptr;
- ++mcnk_count;
- }
-
- // move to next chunk
- ptr += size + 8;
- }
-
- if (mcnk_count != ADT_CELLS_PER_GRID * ADT_CELLS_PER_GRID)
- return false;
-
- return true;
-}
-
-bool adt_MHDR::prepareLoadedData()
-{
- if (fcc != MHDRMagic.fcc)
- return false;
-
- if (size!=sizeof(adt_MHDR)-8)
- return false;
-
- // Check and prepare MCIN
- if (offsMCIN && !getMCIN()->prepareLoadedData())
- return false;
-
- // Check and prepare MH2O
- if (offsMH2O && !getMH2O()->prepareLoadedData())
- return false;
-
- return true;
-}
-
-bool adt_MCIN::prepareLoadedData()
-{
- if (fcc != MCINMagic.fcc)
- return false;
-
- // Check cells data
- for (int i=0; i<ADT_CELLS_PER_GRID;i++)
- for (int j=0; j<ADT_CELLS_PER_GRID;j++)
- if (cells[i][j].offsMCNK && !getMCNK(i,j)->prepareLoadedData())
- return false;
-
- return true;
-}
-
-bool adt_MH2O::prepareLoadedData()
-{
- if (fcc != MH2OMagic.fcc)
- return false;
-
- // Check liquid data
-// for (int i=0; i<ADT_CELLS_PER_GRID;i++)
-// for (int j=0; j<ADT_CELLS_PER_GRID;j++)
-
- return true;
-}
-
-bool adt_MCNK::prepareLoadedData()
-{
- if (fcc != MCNKMagic.fcc)
- return false;
-
- // Check height map
- if (offsMCVT && !getMCVT()->prepareLoadedData())
- return false;
- // Check liquid data
- if (offsMCLQ && !getMCLQ()->prepareLoadedData())
- return false;
-
- return true;
-}
-
-bool adt_MCVT::prepareLoadedData()
-{
- if (fcc != MCVTMagic.fcc)
- return false;
-
- if (size != sizeof(adt_MCVT)-8)
- return false;
-
- return true;
-}
-
-bool adt_MCLQ::prepareLoadedData()
-{
- if (fcc != MCLQMagic.fcc)
- return false;
-
- return true;
-}
diff --git a/src/tools/map_extractor/adt.h b/src/tools/map_extractor/adt.h
index 9f8ada77317..15145ccd5bf 100644
--- a/src/tools/map_extractor/adt.h
+++ b/src/tools/map_extractor/adt.h
@@ -54,8 +54,6 @@ class adt_MCVT
uint32 size;
public:
float height_map[(ADT_CELL_SIZE+1)*(ADT_CELL_SIZE+1)+ADT_CELL_SIZE*ADT_CELL_SIZE];
-
- bool prepareLoadedData();
};
//
@@ -84,7 +82,6 @@ public:
// == 0x0F - not show liquid
uint8 flags[ADT_CELL_SIZE][ADT_CELL_SIZE];
uint8 data[84];
- bool prepareLoadedData();
};
//
@@ -103,8 +100,15 @@ public:
uint32 iy;
uint32 nLayers;
uint32 nDoodadRefs;
- uint32 offsMCVT; // height map
- uint32 offsMCNR; // Normal vectors for each vertex
+ union
+ {
+ struct
+ {
+ uint32 offsMCVT; // height map
+ uint32 offsMCNR; // Normal vectors for each vertex
+ } offsets;
+ uint64 HighResHoles; // TODO: maybe use this?
+ } union_5_3_0;
uint32 offsMCLY; // Texture layer definitions
uint32 offsMCRF; // A list of indices into the parent file's MDDF chunk
uint32 offsMCAL; // Alpha maps for additional texture layers
@@ -130,48 +134,6 @@ public:
uint32 offsMCCV; // offsColorValues in WotLK
uint32 props;
uint32 effectId;
-
- bool prepareLoadedData();
- adt_MCVT *getMCVT()
- {
- if (offsMCVT)
- return (adt_MCVT *)((uint8 *)this + offsMCVT);
- return 0;
- }
- adt_MCLQ *getMCLQ()
- {
- if (offsMCLQ)
- return (adt_MCLQ *)((uint8 *)this + offsMCLQ);
- return 0;
- }
-};
-
-//
-// Adt file grid chunk
-//
-class adt_MCIN
-{
- union{
- uint32 fcc;
- char fcc_txt[4];
- };
- uint32 size;
-public:
- struct adt_CELLS{
- uint32 offsMCNK;
- uint32 size;
- uint32 flags;
- uint32 asyncId;
- } cells[ADT_CELLS_PER_GRID][ADT_CELLS_PER_GRID];
-
- bool prepareLoadedData();
- // offset from begin file (used this-84)
- adt_MCNK *getMCNK(int x, int y)
- {
- if (cells[x][y].offsMCNK)
- return (adt_MCNK *)((uint8 *)this + cells[x][y].offsMCNK - 84);
- return 0;
- }
};
#define ADT_LIQUID_HEADER_FULL_LIGHT 0x01
@@ -208,8 +170,6 @@ public:
uint32 offsData2;
} liquid[ADT_CELLS_PER_GRID][ADT_CELLS_PER_GRID];
- bool prepareLoadedData();
-
adt_liquid_header *getLiquidData(int x, int y)
{
if (liquid[x][y].used && liquid[x][y].offsData1)
@@ -262,53 +222,6 @@ public:
};
-//
-// Adt file header chunk
-//
-class ADT_file;
-class adt_MHDR
-{
- friend class ADT_file;
-
- union{
- uint32 fcc;
- char fcc_txt[4];
- };
- uint32 size;
-
- uint32 flags;
- uint32 offsMCIN; // MCIN
- uint32 offsTex; // MTEX
- uint32 offsModels; // MMDX
- uint32 offsModelsIds; // MMID
- uint32 offsMapObejcts; // MWMO
- uint32 offsMapObejctsIds; // MWID
- uint32 offsDoodsDef; // MDDF
- uint32 offsObjectsDef; // MODF
- uint32 offsMFBO; // MFBO
- uint32 offsMH2O; // MH2O
- uint32 data1;
- uint32 data2;
- uint32 data3;
- uint32 data4;
- uint32 data5;
-public:
- bool prepareLoadedData();
- adt_MCIN* getMCIN() { return offsMCIN ? (adt_MCIN *)((uint8 *)&flags+offsMCIN) : NULL; }
- adt_MH2O* getMH2O() { return offsMH2O ? (adt_MH2O *)((uint8 *)&flags+offsMH2O) : NULL; }
-};
-
-class ADT_file : public FileLoader{
-public:
- bool prepareLoadedData();
- ADT_file();
- ~ADT_file();
- void free();
-
- adt_MHDR* a_grid;
- adt_MCNK* cells[ADT_CELLS_PER_GRID][ADT_CELLS_PER_GRID];
-};
-
#pragma pack(pop)
#endif
diff --git a/src/tools/map_extractor/dbcfile.cpp b/src/tools/map_extractor/dbcfile.cpp
index fc7d8d25d05..069dcd5e78a 100644
--- a/src/tools/map_extractor/dbcfile.cpp
+++ b/src/tools/map_extractor/dbcfile.cpp
@@ -31,26 +31,26 @@ bool DBCFile::open()
unsigned int na, nb, es, ss;
DWORD readBytes = 0;
- SFileReadFile(_file, header, 4, &readBytes, NULL);
+ CascReadFile(_file, header, 4, &readBytes);
if (readBytes != 4) // Number of records
return false;
if (header[0] != 'W' || header[1] != 'D' || header[2] != 'B' || header[3] != 'C')
return false;
- SFileReadFile(_file, &na, 4, &readBytes, NULL);
+ CascReadFile(_file, &na, 4, &readBytes);
if (readBytes != 4) // Number of records
return false;
- SFileReadFile(_file, &nb, 4, &readBytes, NULL);
+ CascReadFile(_file, &nb, 4, &readBytes);
if (readBytes != 4) // Number of fields
return false;
- SFileReadFile(_file, &es, 4, &readBytes, NULL);
+ CascReadFile(_file, &es, 4, &readBytes);
if (readBytes != 4) // Size of a record
return false;
- SFileReadFile(_file, &ss, 4, &readBytes, NULL);
+ CascReadFile(_file, &ss, 4, &readBytes);
if (readBytes != 4) // String size
return false;
@@ -65,7 +65,7 @@ bool DBCFile::open()
_stringTable = _data + _recordSize*_recordCount;
size_t data_size = _recordSize * _recordCount + _stringSize;
- SFileReadFile(_file, _data, data_size, &readBytes, NULL);
+ CascReadFile(_file, _data, data_size, &readBytes);
if (readBytes != data_size)
return false;
@@ -106,4 +106,3 @@ DBCFile::Iterator DBCFile::end()
assert(_data);
return Iterator(*this, _stringTable);
}
-
diff --git a/src/tools/map_extractor/dbcfile.h b/src/tools/map_extractor/dbcfile.h
index 9602182fe79..17c773fcc42 100644
--- a/src/tools/map_extractor/dbcfile.h
+++ b/src/tools/map_extractor/dbcfile.h
@@ -20,7 +20,7 @@
#define DBCFILE_H
#include <cassert>
#include <string>
-#include "StormLib.h"
+#include "CascLib.h"
class DBCFile
{
diff --git a/src/tools/map_extractor/loadlib.cpp b/src/tools/map_extractor/loadlib.cpp
index 5d1742c224e..7af56d89a0c 100644
--- a/src/tools/map_extractor/loadlib.cpp
+++ b/src/tools/map_extractor/loadlib.cpp
@@ -23,49 +23,53 @@
u_map_fcc MverMagic = { {'R','E','V','M'} };
-FileLoader::FileLoader()
+ChunkedFile::ChunkedFile()
{
data = 0;
data_size = 0;
- version = 0;
}
-FileLoader::~FileLoader()
+ChunkedFile::~ChunkedFile()
{
free();
}
-bool FileLoader::loadFile(HANDLE mpq, char* filename, bool log)
+bool ChunkedFile::loadFile(HANDLE mpq, char* filename, bool log)
{
free();
HANDLE file;
- if (!SFileOpenFileEx(mpq, filename, SFILE_OPEN_PATCHED_FILE, &file))
+ if (!CascOpenFile(mpq, filename, CASC_LOCALE_ALL, 0, &file))
{
if (log)
printf("No such file %s\n", filename);
return false;
}
- data_size = SFileGetFileSize(file, NULL);
+ data_size = CascGetFileSize(file, NULL);
data = new uint8[data_size];
- SFileReadFile(file, data, data_size, NULL/*bytesRead*/, NULL);
+ CascReadFile(file, data, data_size, NULL/*bytesRead*/);
+ parseChunks();
if (prepareLoadedData())
{
- SFileCloseFile(file);
+ CascCloseFile(file);
return true;
}
printf("Error loading %s\n", filename);
- SFileCloseFile(file);
+ CascCloseFile(file);
free();
return false;
}
-bool FileLoader::prepareLoadedData()
+bool ChunkedFile::prepareLoadedData()
{
+ FileChunk* chunk = GetChunk("MVER");
+ if (!chunk)
+ return false;
+
// Check version
- version = (file_MVER *) data;
+ file_MVER* version = chunk->As<file_MVER>();
if (version->fcc != MverMagic.fcc)
return false;
if (version->ver != FILE_FORMAT_VERSION)
@@ -73,10 +77,110 @@ bool FileLoader::prepareLoadedData()
return true;
}
-void FileLoader::free()
+void ChunkedFile::free()
{
- if (data) delete[] data;
+ for (auto chunk : chunks)
+ delete chunk.second;
+
+ chunks.clear();
+
+ delete[] data;
data = 0;
data_size = 0;
- version = 0;
+}
+
+u_map_fcc InterestingChunks[] = {
+ { 'R', 'E', 'V', 'M' },
+ { 'N', 'I', 'A', 'M' },
+ { 'O', '2', 'H', 'M' },
+ { 'K', 'N', 'C', 'M' },
+ { 'T', 'V', 'C', 'M' },
+ { 'Q', 'L', 'C', 'M' }
+};
+
+bool IsInterestingChunk(u_map_fcc const& fcc)
+{
+ for (u_map_fcc const& f : InterestingChunks)
+ if (f.fcc == fcc.fcc)
+ return true;
+
+ return false;
+}
+
+void ChunkedFile::parseChunks()
+{
+ uint8* ptr = GetData();
+ while (ptr < GetData() + GetDataSize())
+ {
+ u_map_fcc header = *(u_map_fcc*)ptr;
+ uint32 size = 0;
+ if (IsInterestingChunk(header))
+ {
+ size = *(uint32*)(ptr + 4);
+ if (size <= data_size)
+ {
+ std::swap(header.fcc_txt[0], header.fcc_txt[3]);
+ std::swap(header.fcc_txt[1], header.fcc_txt[2]);
+
+ FileChunk* chunk = new FileChunk{ ptr, size };
+ chunk->parseSubChunks();
+ chunks.insert({ std::string(header.fcc_txt, 4), chunk });
+ }
+ }
+
+ // move to next chunk
+ ptr += size + 8;
+ }
+}
+
+FileChunk* ChunkedFile::GetChunk(std::string const& name)
+{
+ auto range = chunks.equal_range(name);
+ if (std::distance(range.first, range.second) == 1)
+ return range.first->second;
+
+ return NULL;
+}
+
+FileChunk::~FileChunk()
+{
+ for (auto subchunk : subchunks)
+ delete subchunk.second;
+
+ subchunks.clear();
+}
+
+void FileChunk::parseSubChunks()
+{
+ uint8* ptr = data + 8; // skip self
+ while (ptr < data + size)
+ {
+ u_map_fcc header = *(u_map_fcc*)ptr;
+ uint32 subsize = 0;
+ if (IsInterestingChunk(header))
+ {
+ subsize = *(uint32*)(ptr + 4);
+ if (subsize < size)
+ {
+ std::swap(header.fcc_txt[0], header.fcc_txt[3]);
+ std::swap(header.fcc_txt[1], header.fcc_txt[2]);
+
+ FileChunk* chunk = new FileChunk{ ptr, subsize };
+ chunk->parseSubChunks();
+ subchunks.insert({ std::string(header.fcc_txt, 4), chunk });
+ }
+ }
+
+ // move to next chunk
+ ptr += subsize + 8;
+ }
+}
+
+FileChunk* FileChunk::GetSubChunk(std::string const& name)
+{
+ auto range = subchunks.equal_range(name);
+ if (std::distance(range.first, range.second) == 1)
+ return range.first->second;
+
+ return NULL;
}
diff --git a/src/tools/map_extractor/loadlib/DBFilesClientList.h b/src/tools/map_extractor/loadlib/DBFilesClientList.h
new file mode 100644
index 00000000000..df7991d2ec3
--- /dev/null
+++ b/src/tools/map_extractor/loadlib/DBFilesClientList.h
@@ -0,0 +1,531 @@
+/*
+ * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef DBFilesClientList_h__
+#define DBFilesClientList_h__
+
+char const* DBFilesClientList[] =
+{
+ "DBFilesClient\\CharSections.dbc",
+ "DBFilesClient\\CharHairGeosets.dbc",
+ "DBFilesClient\\TaxiPathNode.db2",
+ "DBFilesClient\\KeyChain.db2",
+ "DBFilesClient\\UiTextureAtlas.db2",
+ "DBFilesClient\\UiTextureAtlasMember.db2",
+ "DBFilesClient\\CharacterFaceBoneSet.db2",
+ "DBFilesClient\\Startup_Strings.dbc",
+ "DBFilesClient\\VideoHardware.dbc",
+ "DBFilesClient\\AreaPOI.db2",
+ "DBFilesClient\\AreaPOIState.db2",
+ "DBFilesClient\\BattlePetAbility.db2",
+ "DBFilesClient\\BattlePetAbilityEffect.db2",
+ "DBFilesClient\\BattlePetAbilityState.db2",
+ "DBFilesClient\\BattlePetAbilityTurn.db2",
+ "DBFilesClient\\BattlePetBreedQuality.db2",
+ "DBFilesClient\\BattlePetBreedState.db2",
+ "DBFilesClient\\BattlePetEffectProperties.db2",
+ "DBFilesClient\\BattlePetNPCTeamMember.db2",
+ "DBFilesClient\\BattlePetSpecies.db2",
+ "DBFilesClient\\BattlePetSpeciesState.db2",
+ "DBFilesClient\\BattlePetSpeciesXAbility.db2",
+ "DBFilesClient\\BattlePetState.db2",
+ "DBFilesClient\\BattlePetVisual.db2",
+ "DBFilesClient\\BroadcastText.db2",
+ "DBFilesClient\\Cfg_Categories.db2",
+ "DBFilesClient\\Cfg_Configs.db2",
+ "DBFilesClient\\Cfg_Regions.db2",
+ "DBFilesClient\\CharShipmentContainer.db2",
+ "DBFilesClient\\CharShipment.db2",
+ "DBFilesClient\\ChrUpgradeBucket.db2",
+ "DBFilesClient\\ChrUpgradeBucketSpell.db2",
+ "DBFilesClient\\ChrUpgradeTier.db2",
+ "DBFilesClient\\Creature.db2",
+ "DBFilesClient\\CreatureDifficulty.db2",
+ "DBFilesClient\\Curve.db2",
+ "DBFilesClient\\CurvePoint.db2",
+ "DBFilesClient\\GameObjects.db2",
+ "DBFilesClient\\GarrAbilityCategory.db2",
+ "DBFilesClient\\GarrAbility.db2",
+ "DBFilesClient\\GarrAbilityEffect.db2",
+ "DBFilesClient\\GarrBuilding.db2",
+ "DBFilesClient\\GarrBuildingDoodadSet.db2",
+ "DBFilesClient\\GarrBuildingPlotInst.db2",
+ "DBFilesClient\\GarrClassSpec.db2",
+ "DBFilesClient\\GarrEncounter.db2",
+ "DBFilesClient\\GarrEncounterXMechanic.db2",
+ "DBFilesClient\\GarrFollItemSet.db2",
+ "DBFilesClient\\GarrFollItemSetMember.db2",
+ "DBFilesClient\\GarrFollower.db2",
+ "DBFilesClient\\GarrFollowerLevelXP.db2",
+ "DBFilesClient\\GarrFollowerQuality.db2",
+ "DBFilesClient\\GarrFollowerXAbility.db2",
+ "DBFilesClient\\GarrMechanic.db2",
+ "DBFilesClient\\GarrMechanicType.db2",
+ "DBFilesClient\\GarrMission.db2",
+ "DBFilesClient\\GarrMissionReward.db2",
+ "DBFilesClient\\GarrMissionType.db2",
+ "DBFilesClient\\GarrMissionXEncounter.db2",
+ "DBFilesClient\\GarrPlotBuilding.db2",
+ "DBFilesClient\\GarrPlotInstance.db2",
+ "DBFilesClient\\GarrPlot.db2",
+ "DBFilesClient\\GarrPlotUICategory.db2",
+ "DBFilesClient\\GarrSiteLevel.db2",
+ "DBFilesClient\\GarrSiteLevelPlotInst.db2",
+ "DBFilesClient\\GarrSpecialization.db2",
+ "DBFilesClient\\GlyphExclusiveCategory.db2",
+ "DBFilesClient\\GlyphRequiredSpec.db2",
+ "DBFilesClient\\GroupFinderActivity.db2",
+ "DBFilesClient\\GroupFinderActivityGrp.db2",
+ "DBFilesClient\\GroupFinderCategory.db2",
+ "DBFilesClient\\HighlightColor.db2",
+ "DBFilesClient\\Holidays.db2",
+ "DBFilesClient\\HolidayDescriptions.db2",
+ "DBFilesClient\\HolidayNames.db2",
+ "DBFilesClient\\Item-sparse.db2",
+ "DBFilesClient\\Item.db2",
+ "DBFilesClient\\ItemAppearance.db2",
+ "DBFilesClient\\ItemBonus.db2",
+ "DBFilesClient\\ItemBonusTreeNode.db2",
+ "DBFilesClient\\ItemCurrencyCost.db2",
+ "DBFilesClient\\ItemEffect.db2",
+ "DBFilesClient\\ItemExtendedCost.db2",
+ "DBFilesClient\\ItemModifiedAppearance.db2",
+ "DBFilesClient\\ItemToBattlePetSpecies.db2",
+ "DBFilesClient\\ItemToMountSpell.db2",
+ "DBFilesClient\\ItemUpgrade.db2",
+ "DBFilesClient\\ItemXBonusTree.db2",
+ "DBFilesClient\\LanguageWords.db2",
+ "DBFilesClient\\LfgRoleRequirement.db2",
+ "DBFilesClient\\Locale.db2",
+ "DBFilesClient\\Location.db2",
+ "DBFilesClient\\MapChallengeMode.db2",
+ "DBFilesClient\\MarketingPromotionsXLocale.db2",
+ "DBFilesClient\\ModelManifest.db2",
+ "DBFilesClient\\ModelNameToManifest.db2",
+ "DBFilesClient\\Mount.db2",
+ "DBFilesClient\\OverrideSpellData.db2",
+ "DBFilesClient\\Path.db2",
+ "DBFilesClient\\PathNode.db2",
+ "DBFilesClient\\PathNodeProperty.db2",
+ "DBFilesClient\\PathProperty.db2",
+ "DBFilesClient\\PhaseXPhaseGroup.db2",
+ "DBFilesClient\\PlayerCondition.db2",
+ "DBFilesClient\\PvpItem.db2",
+ "DBFilesClient\\QuestPackageItem.db2",
+ "DBFilesClient\\QuestLine.db2",
+ "DBFilesClient\\QuestLineXQuest.db2",
+ "DBFilesClient\\QuestPOIPointCliTask.db2",
+ "DBFilesClient\\QuestObjectiveCliTask.db2",
+ "DBFilesClient\\RulesetItemUpgrade.db2",
+ "DBFilesClient\\RulesetRaidLootUpgrade.db2",
+ "DBFilesClient\\SceneScriptPackage.db2",
+ "DBFilesClient\\SceneScriptPackageMember.db2",
+ "DBFilesClient\\SceneScript.db2",
+ "DBFilesClient\\SpellActionBarPref.db2",
+ "DBFilesClient\\SpellAuraRestrictions.db2",
+ "DBFilesClient\\SpellAuraRestrictionsDifficulty.db2",
+ "DBFilesClient\\SpellCastingRequirements.db2",
+ "DBFilesClient\\SpellClassOptions.db2",
+ "DBFilesClient\\SpellEffectCameraShakes.db2",
+ "DBFilesClient\\SpellEffectGroupSize.db2",
+ "DBFilesClient\\SpellLearnSpell.db2",
+ "DBFilesClient\\SpellMechanic.db2",
+ "DBFilesClient\\SpellMisc.db2",
+ "DBFilesClient\\SpellMiscDifficulty.db2",
+ "DBFilesClient\\SpellMissileMotion.db2",
+ "DBFilesClient\\SpellMissile.db2",
+ "DBFilesClient\\SpellPower.db2",
+ "DBFilesClient\\SpellPowerDifficulty.db2",
+ "DBFilesClient\\SpellReagents.db2",
+ "DBFilesClient\\SpellRuneCost.db2",
+ "DBFilesClient\\SpellTotems.db2",
+ "DBFilesClient\\SpellVisualEffectName.db2",
+ "DBFilesClient\\SpellVisualKitAreaModel.db2",
+ "DBFilesClient\\SpellVisualKitModelAttach.db2",
+ "DBFilesClient\\SpellVisualMissile.db2",
+ "DBFilesClient\\SpellVisualKit.db2",
+ "DBFilesClient\\SpellVisual.db2",
+ "DBFilesClient\\TaxiNodes.db2",
+ "DBFilesClient\\TaxiPath.db2",
+ "DBFilesClient\\TextureFileData.db2",
+ "DBFilesClient\\Toy.db2",
+ "DBFilesClient\\Trophy.db2",
+ "DBFilesClient\\TrophyInstance.db2",
+ "DBFilesClient\\TrophyType.db2",
+ "DBFilesClient\\Vignette.db2",
+ "DBFilesClient\\WbAccessControlList.db2",
+ "DBFilesClient\\WbCertBlacklist.db2",
+ "DBFilesClient\\WbCertWhitelist.db2",
+ "DBFilesClient\\WbPermissions.db2",
+ "DBFilesClient\\WeaponTrail.db2",
+ "DBFilesClient\\WorldBossLockout.db2",
+ "DBFilesClient\\QuestV2CliTask.db2",
+ "DBFilesClient\\UiTextureKit.db2",
+ "DBFilesClient\\StringLookups.dbc",
+ "DBFilesClient\\SpellIcon.dbc",
+ "DBFilesClient\\SpellEffect.dbc",
+ "DBFilesClient\\ParticleColor.dbc",
+ "DBFilesClient\\ObjectEffectPackageElem.dbc",
+ "DBFilesClient\\ObjectEffectPackage.dbc",
+ "DBFilesClient\\ObjectEffectModifier.dbc",
+ "DBFilesClient\\ObjectEffectGroup.dbc",
+ "DBFilesClient\\ObjectEffect.dbc",
+ "DBFilesClient\\NameGen.dbc",
+ "DBFilesClient\\LoadingScreens.dbc",
+ "DBFilesClient\\ItemVisualEffects.dbc",
+ "DBFilesClient\\ItemVisuals.dbc",
+ "DBFilesClient\\ItemDisplayInfo.dbc",
+ "DBFilesClient\\HelmetGeosetVisData.dbc",
+ "DBFilesClient\\HelmetAnimScaling.dbc",
+ "DBFilesClient\\GuildColorEmblem.dbc",
+ "DBFilesClient\\GuildColorBorder.dbc",
+ "DBFilesClient\\GuildColorBackground.dbc",
+ "DBFilesClient\\GlueScreenEmote.dbc",
+ "DBFilesClient\\GameTips.dbc",
+ "DBFilesClient\\Faction.dbc",
+ "DBFilesClient\\CreatureModelData.dbc",
+ "DBFilesClient\\CreatureFamily.dbc",
+ "DBFilesClient\\CreatureDisplayInfoExtra.dbc",
+ "DBFilesClient\\CreatureDisplayInfo.dbc",
+ "DBFilesClient\\ChrSpecialization.dbc",
+ "DBFilesClient\\CharacterLoadoutItem.dbc",
+ "DBFilesClient\\CharacterLoadout.dbc",
+ "DBFilesClient\\CharStartOutfit.dbc",
+ "DBFilesClient\\CharComponentTextureSections.dbc",
+ "DBFilesClient\\CharComponentTextureLayouts.dbc",
+ "DBFilesClient\\AnimReplacementSet.dbc",
+ "DBFilesClient\\AnimReplacement.dbc",
+ "DBFilesClient\\AnimKitSegment.dbc",
+ "DBFilesClient\\AnimKitPriority.dbc",
+ "DBFilesClient\\SoundProviderPreferences.dbc",
+ "DBFilesClient\\SpamMessages.dbc",
+ "DBFilesClient\\SoundFilterElem.dbc",
+ "DBFilesClient\\SoundFilter.dbc",
+ "DBFilesClient\\Resistances.dbc",
+ "DBFilesClient\\NamesReservedLocale.dbc",
+ "DBFilesClient\\NamesReserved.dbc",
+ "DBFilesClient\\NamesProfanity.dbc",
+ "DBFilesClient\\MovieVariation.dbc",
+ "DBFilesClient\\MovieOverlays.dbc",
+ "DBFilesClient\\MovieFileData.dbc",
+ "DBFilesClient\\Movie.dbc",
+ "DBFilesClient\\ItemSubClass.dbc",
+ "DBFilesClient\\ItemClass.dbc",
+ "DBFilesClient\\ManifestInterfaceTOCData.dbc",
+ "DBFilesClient\\ManifestInterfaceData.dbc",
+ "DBFilesClient\\FactionTemplate.dbc",
+ "DBFilesClient\\FactionGroup.dbc",
+ "DBFilesClient\\ChrRaces.dbc",
+ "DBFilesClient\\ChrClasses.dbc",
+ "DBFilesClient\\ChatProfanity.dbc",
+ "DBFilesClient\\CharacterFacialHairStyles.dbc",
+ "DBFilesClient\\CharBaseSection.dbc",
+ "DBFilesClient\\CharBaseInfo.dbc",
+ "DBFilesClient\\BannedAddOns.dbc",
+ "DBFilesClient\\AnimKitConfigBoneSet.dbc",
+ "DBFilesClient\\AnimKitConfig.dbc",
+ "DBFilesClient\\AnimKit.dbc",
+ "DBFilesClient\\AnimKitBoneSet.dbc",
+ "DBFilesClient\\AnimKitBoneSetAlias.dbc",
+ "DBFilesClient\\PhaseShiftZoneSounds.dbc",
+ "DBFilesClient\\WorldChunkSounds.dbc",
+ "DBFilesClient\\WorldStateExpression.dbc",
+ "DBFilesClient\\WorldStateZoneSounds.dbc",
+ "DBFilesClient\\ZoneMusic.dbc",
+ "DBFilesClient\\ZoneIntroMusicTable.dbc",
+ "DBFilesClient\\WorldStateUI.dbc",
+ "DBFilesClient\\WorldState.dbc",
+ "DBFilesClient\\WorldMapTransforms.dbc",
+ "DBFilesClient\\WorldMapOverlay.dbc",
+ "DBFilesClient\\WorldMapContinent.dbc",
+ "DBFilesClient\\WorldMapArea.dbc",
+ "DBFilesClient\\WorldElapsedTimer.dbc",
+ "DBFilesClient\\WorldEffect.dbc",
+ "DBFilesClient\\WeaponSwingSounds2.dbc",
+ "DBFilesClient\\WeaponImpactSounds.dbc",
+ "DBFilesClient\\World_PVP_Area.dbc",
+ "DBFilesClient\\VocalUISounds.dbc",
+ "DBFilesClient\\VehicleUIIndSeat.dbc",
+ "DBFilesClient\\VehicleUIIndicator.dbc",
+ "DBFilesClient\\VehicleSeat.dbc",
+ "DBFilesClient\\Vehicle.dbc",
+ "DBFilesClient\\UnitPowerBar.dbc",
+ "DBFilesClient\\UnitCondition.dbc",
+ "DBFilesClient\\UnitBlood.dbc",
+ "DBFilesClient\\UnitBloodLevels.dbc",
+ "DBFilesClient\\TransportRotation.dbc",
+ "DBFilesClient\\TransportPhysics.dbc",
+ "DBFilesClient\\TransportAnimation.dbc",
+ "DBFilesClient\\TradeSkillCategory.dbc",
+ "DBFilesClient\\TotemCategory.dbc",
+ "DBFilesClient\\TerrainTypeSounds.dbc",
+ "DBFilesClient\\Talent.dbc",
+ "DBFilesClient\\SummonProperties.dbc",
+ "DBFilesClient\\Stationery.dbc",
+ "DBFilesClient\\SpellTargetRestrictions.dbc",
+ "DBFilesClient\\SpellSpecialUnitEffect.dbc",
+ "DBFilesClient\\SpellShapeshiftForm.dbc",
+ "DBFilesClient\\SpellShapeshift.dbc",
+ "DBFilesClient\\SpellScaling.dbc",
+ "DBFilesClient\\SpellProcsPerMinuteMod.dbc",
+ "DBFilesClient\\SpellProcsPerMinute.dbc",
+ "DBFilesClient\\SpellRange.dbc",
+ "DBFilesClient\\SpellRadius.dbc",
+ "DBFilesClient\\SpellLevels.dbc",
+ "DBFilesClient\\SpellKeyboundOverride.dbc",
+ "DBFilesClient\\SpellItemEnchantmentCondition.dbc",
+ "DBFilesClient\\SpellItemEnchantment.dbc",
+ "DBFilesClient\\SpellInterrupts.dbc",
+ "DBFilesClient\\SpellFocusObject.dbc",
+ "DBFilesClient\\SpellFlyoutItem.dbc",
+ "DBFilesClient\\SpellFlyout.dbc",
+ "DBFilesClient\\SpellEquippedItems.dbc",
+ "DBFilesClient\\SpellEffectScaling.dbc",
+ "DBFilesClient\\SpellDuration.dbc",
+ "DBFilesClient\\SpellDispelType.dbc",
+ "DBFilesClient\\SpellDescriptionVariables.dbc",
+ "DBFilesClient\\Spell.dbc",
+ "DBFilesClient\\SpellCooldowns.dbc",
+ "DBFilesClient\\SpellCategory.dbc",
+ "DBFilesClient\\SpellCategories.dbc",
+ "DBFilesClient\\SpellCastTimes.dbc",
+ "DBFilesClient\\SpellAuraVisXChrSpec.dbc",
+ "DBFilesClient\\SpellAuraVisibility.dbc",
+ "DBFilesClient\\SpellAuraOptions.dbc",
+ "DBFilesClient\\SpellActivationOverlay.dbc",
+ "DBFilesClient\\SpecializationSpells.dbc",
+ "DBFilesClient\\SoundOverride.dbc",
+ "DBFilesClient\\SoundAmbienceFlavor.dbc",
+ "DBFilesClient\\SoundAmbience.dbc",
+ "DBFilesClient\\SkillTiers.dbc",
+ "DBFilesClient\\SkillRaceClassInfo.dbc",
+ "DBFilesClient\\SkillLine.dbc",
+ "DBFilesClient\\SkillLineAbilitySortedSpell.dbc",
+ "DBFilesClient\\SkillLineAbility.dbc",
+ "DBFilesClient\\ServerMessages.dbc",
+ "DBFilesClient\\ScreenLocation.dbc",
+ "DBFilesClient\\ScreenEffect.dbc",
+ "DBFilesClient\\ScenarioEventEntry.dbc",
+ "DBFilesClient\\ScenarioStep.dbc",
+ "DBFilesClient\\Scenario.dbc",
+ "DBFilesClient\\ScalingStatDistribution.dbc",
+ "DBFilesClient\\RulesetRaidOverride.dbc",
+ "DBFilesClient\\RandPropPoints.dbc",
+ "DBFilesClient\\ResearchSite.dbc",
+ "DBFilesClient\\ResearchProject.dbc",
+ "DBFilesClient\\ResearchField.dbc",
+ "DBFilesClient\\ResearchBranch.dbc",
+ "DBFilesClient\\RacialMounts.dbc",
+ "DBFilesClient\\QuestFeedbackEffect.dbc",
+ "DBFilesClient\\QuestV2.dbc",
+ "DBFilesClient\\QuestXP.dbc",
+ "DBFilesClient\\QuestSort.dbc",
+ "DBFilesClient\\QuestPOIPoint.dbc",
+ "DBFilesClient\\QuestPOIBlob.dbc",
+ "DBFilesClient\\QuestMoneyReward.dbc",
+ "DBFilesClient\\QuestInfo.dbc",
+ "DBFilesClient\\QuestFactionReward.dbc",
+ "DBFilesClient\\PvpDifficulty.dbc",
+ "DBFilesClient\\PowerDisplay.dbc",
+ "DBFilesClient\\Phase.dbc",
+ "DBFilesClient\\PaperDollItemFrame.dbc",
+ "DBFilesClient\\PageTextMaterial.dbc",
+ "DBFilesClient\\Package.dbc",
+ "DBFilesClient\\NPCSounds.dbc",
+ "DBFilesClient\\MountType.dbc",
+ "DBFilesClient\\MountCapability.dbc",
+ "DBFilesClient\\ModifierTree.dbc",
+ "DBFilesClient\\MinorTalent.dbc",
+ "DBFilesClient\\Material.dbc",
+ "DBFilesClient\\MapDifficulty.dbc",
+ "DBFilesClient\\ManifestInterfaceItemIcon.dbc",
+ "DBFilesClient\\ManifestInterfaceActionIcon.dbc",
+ "DBFilesClient\\MailTemplate.dbc",
+ "DBFilesClient\\LockType.dbc",
+ "DBFilesClient\\Lock.dbc",
+ "DBFilesClient\\LoadingScreenTaxiSplines.dbc",
+ "DBFilesClient\\LfgDungeons.dbc",
+ "DBFilesClient\\LfgDungeonsGroupingMap.dbc",
+ "DBFilesClient\\LfgDungeonGroup.dbc",
+ "DBFilesClient\\LfgDungeonExpansion.dbc",
+ "DBFilesClient\\Languages.dbc",
+ "DBFilesClient\\JournalTierXInstance.dbc",
+ "DBFilesClient\\JournalTier.dbc",
+ "DBFilesClient\\JournalSectionXDifficulty.dbc",
+ "DBFilesClient\\JournalItemXDifficulty.dbc",
+ "DBFilesClient\\JournalInstance.dbc",
+ "DBFilesClient\\JournalEncounterXDifficulty.dbc",
+ "DBFilesClient\\JournalEncounterSection.dbc",
+ "DBFilesClient\\JournalEncounter.dbc",
+ "DBFilesClient\\JournalEncounterItem.dbc",
+ "DBFilesClient\\JournalEncounterCreature.dbc",
+ "DBFilesClient\\ItemUpgradePath.dbc",
+ "DBFilesClient\\ItemSubClassMask.dbc",
+ "DBFilesClient\\ItemSpec.dbc",
+ "DBFilesClient\\ItemSpecOverride.dbc",
+ "DBFilesClient\\ItemSetSpell.dbc",
+ "DBFilesClient\\ItemSet.dbc",
+ "DBFilesClient\\ItemRandomSuffix.dbc",
+ "DBFilesClient\\ItemRandomProperties.dbc",
+ "DBFilesClient\\ItemPurchaseGroup.dbc",
+ "DBFilesClient\\ItemPriceBase.dbc",
+ "DBFilesClient\\ItemPetFood.dbc",
+ "DBFilesClient\\ItemNameDescription.dbc",
+ "DBFilesClient\\ItemLimitCategory.dbc",
+ "DBFilesClient\\ItemGroupSounds.dbc",
+ "DBFilesClient\\ItemDisenchantLoot.dbc",
+ "DBFilesClient\\ItemDamageWand.dbc",
+ "DBFilesClient\\ItemDamageTwoHandCaster.dbc",
+ "DBFilesClient\\ItemDamageTwoHand.dbc",
+ "DBFilesClient\\ItemDamageThrown.dbc",
+ "DBFilesClient\\ItemDamageRanged.dbc",
+ "DBFilesClient\\ItemDamageOneHandCaster.dbc",
+ "DBFilesClient\\ItemDamageOneHand.dbc",
+ "DBFilesClient\\ItemDamageAmmo.dbc",
+ "DBFilesClient\\ItemBagFamily.dbc",
+ "DBFilesClient\\ItemArmorShield.dbc",
+ "DBFilesClient\\ItemArmorTotal.dbc",
+ "DBFilesClient\\ItemArmorQuality.dbc",
+ "DBFilesClient\\ImportPriceWeapon.dbc",
+ "DBFilesClient\\ImportPriceShield.dbc",
+ "DBFilesClient\\ImportPriceQuality.dbc",
+ "DBFilesClient\\ImportPriceArmor.dbc",
+ "DBFilesClient\\GuildPerkSpells.dbc",
+ "DBFilesClient\\gtSpellScaling.dbc",
+ "DBFilesClient\\gtResilienceDR.dbc",
+ "DBFilesClient\\gtRegenMPPerSpt.dbc",
+ "DBFilesClient\\gtOCTLevelExperience.dbc",
+ "DBFilesClient\\gtOCTHpPerStamina.dbc",
+ "DBFilesClient\\gtOCTClassCombatRatingScalar.dbc",
+ "DBFilesClient\\gtOCTBaseMPByClass.dbc",
+ "DBFilesClient\\gtOCTBaseHPByClass.dbc",
+ "DBFilesClient\\gtNPCManaCostScaler.dbc",
+ "DBFilesClient\\gtItemSocketCostPerLevel.dbc",
+ "DBFilesClient\\gtChanceToSpellCritBase.dbc",
+ "DBFilesClient\\gtChanceToSpellCrit.dbc",
+ "DBFilesClient\\gtChanceToMeleeCritBase.dbc",
+ "DBFilesClient\\gtChanceToMeleeCrit.dbc",
+ "DBFilesClient\\gtCombatRatings.dbc",
+ "DBFilesClient\\gtBattlePetXP.dbc",
+ "DBFilesClient\\gtBattlePetTypeDamageMod.dbc",
+ "DBFilesClient\\gtBarberShopCostBase.dbc",
+ "DBFilesClient\\gtArmorMitigationByLvl.dbc",
+ "DBFilesClient\\GMTicketCategory.dbc",
+ "DBFilesClient\\GMSurveySurveys.dbc",
+ "DBFilesClient\\GMSurveyQuestions.dbc",
+ "DBFilesClient\\GMSurveyCurrentSurvey.dbc",
+ "DBFilesClient\\GMSurveyAnswers.dbc",
+ "DBFilesClient\\GlyphSlot.dbc",
+ "DBFilesClient\\GlyphProperties.dbc",
+ "DBFilesClient\\GemProperties.dbc",
+ "DBFilesClient\\GarrUiAnimRaceInfo.dbc",
+ "DBFilesClient\\GarrUiAnimClassInfo.dbc",
+ "DBFilesClient\\GameTables.dbc",
+ "DBFilesClient\\GameObjectDisplayInfo.dbc",
+ "DBFilesClient\\GameObjectDiffAnimMap.dbc",
+ "DBFilesClient\\GameObjectArtKit.dbc",
+ "DBFilesClient\\FriendshipReputation.dbc",
+ "DBFilesClient\\FriendshipRepReaction.dbc",
+ "DBFilesClient\\FootstepTerrainLookup.dbc",
+ "DBFilesClient\\CriteriaTree.dbc",
+ "DBFilesClient\\Exhaustion.dbc",
+ "DBFilesClient\\EnvironmentalDamage.dbc",
+ "DBFilesClient\\EmotesText.dbc",
+ "DBFilesClient\\EmotesTextSound.dbc",
+ "DBFilesClient\\EmotesTextData.dbc",
+ "DBFilesClient\\Emotes.dbc",
+ "DBFilesClient\\DurabilityQuality.dbc",
+ "DBFilesClient\\DurabilityCosts.dbc",
+ "DBFilesClient\\DungeonMapChunk.dbc",
+ "DBFilesClient\\DungeonMap.dbc",
+ "DBFilesClient\\DungeonEncounter.dbc",
+ "DBFilesClient\\Difficulty.dbc",
+ "DBFilesClient\\DestructibleModelData.dbc",
+ "DBFilesClient\\DeathThudLookups.dbc",
+ "DBFilesClient\\CurrencyCategory.dbc",
+ "DBFilesClient\\CurrencyTypes.dbc",
+ "DBFilesClient\\CriteriaTreeXEffect.dbc",
+ "DBFilesClient\\Criteria.dbc",
+ "DBFilesClient\\CreatureType.dbc",
+ "DBFilesClient\\CreatureSpellData.dbc",
+ "DBFilesClient\\CreatureSoundData.dbc",
+ "DBFilesClient\\CreatureMovementInfo.dbc",
+ "DBFilesClient\\CreatureImmunities.dbc",
+ "DBFilesClient\\CombatCondition.dbc",
+ "DBFilesClient\\CinematicSequences.dbc",
+ "DBFilesClient\\CinematicCamera.dbc",
+ "DBFilesClient\\ChrClassesXPowerTypes.dbc",
+ "DBFilesClient\\ChatChannels.dbc",
+ "DBFilesClient\\CharTitles.dbc",
+ "DBFilesClient\\CastableRaidBuffs.dbc",
+ "DBFilesClient\\CameraShakes.dbc",
+ "DBFilesClient\\CameraMode.dbc",
+ "DBFilesClient\\BattlemasterList.dbc",
+ "DBFilesClient\\BarberShopStyle.dbc",
+ "DBFilesClient\\BankBagSlotPrices.dbc",
+ "DBFilesClient\\AuctionHouse.dbc",
+ "DBFilesClient\\ArmorLocation.dbc",
+ "DBFilesClient\\AreaTriggerCylinder.dbc",
+ "DBFilesClient\\AreaTriggerSphere.dbc",
+ "DBFilesClient\\AreaTriggerBox.dbc",
+ "DBFilesClient\\AreaTriggerActionSet.dbc",
+ "DBFilesClient\\AreaTrigger.dbc",
+ "DBFilesClient\\AreaAssignment.dbc",
+ "DBFilesClient\\AreaGroup.dbc",
+ "DBFilesClient\\Achievement_Category.dbc",
+ "DBFilesClient\\Achievement.dbc",
+ "DBFilesClient\\DeclinedWordCases.dbc",
+ "DBFilesClient\\DeclinedWord.dbc",
+ "DBFilesClient\\DeviceBlacklist.db2",
+ "DBFilesClient\\DriverBlacklist.db2",
+ "DBFilesClient\\DeviceDefaultSettings.db2",
+ "DBFilesClient\\WindSettings.db2",
+ "DBFilesClient\\ZoneLightPoint.dbc",
+ "DBFilesClient\\ZoneLight.dbc",
+ "DBFilesClient\\WMOAreaTable.dbc",
+ "DBFilesClient\\Weather.dbc",
+ "DBFilesClient\\TerrainType.dbc",
+ "DBFilesClient\\TerrainMaterial.dbc",
+ "DBFilesClient\\SpellChainEffects.dbc",
+ "DBFilesClient\\SoundEntriesFallbacks.dbc",
+ "DBFilesClient\\SoundEmitters.dbc",
+ "DBFilesClient\\SoundEmitterPillPoints.dbc",
+ "DBFilesClient\\SoundBusName.dbc",
+ "DBFilesClient\\LiquidType.dbc",
+ "DBFilesClient\\LiquidObject.dbc",
+ "DBFilesClient\\LiquidMaterial.dbc",
+ "DBFilesClient\\LightSkybox.dbc",
+ "DBFilesClient\\Light.dbc",
+ "DBFilesClient\\GroundEffectTexture.dbc",
+ "DBFilesClient\\GroundEffectDoodad.dbc",
+ "DBFilesClient\\FootprintTextures.dbc",
+ "DBFilesClient\\FeedbackPath.dbc",
+ "DBFilesClient\\Map.dbc",
+ "DBFilesClient\\LightParams.dbc",
+ "DBFilesClient\\LightData.dbc",
+ "DBFilesClient\\AreaTable.dbc",
+ "DBFilesClient\\AnimationData.dbc",
+ "DBFilesClient\\SoundEntries.dbc",
+ "DBFilesClient\\SoundEntriesAdvanced.dbc",
+ "DBFilesClient\\SoundBus.dbc",
+ "DBFilesClient\\ModelFileData.dbc",
+ "DBFilesClient\\ManifestMP3.dbc",
+ "DBFilesClient\\FileData.dbc",
+ nullptr // terminator
+};
+
+#endif // DBFilesClientList_h__
diff --git a/src/tools/map_extractor/loadlib/loadlib.h b/src/tools/map_extractor/loadlib/loadlib.h
index 2bea59e2c97..873aa3346b6 100644
--- a/src/tools/map_extractor/loadlib/loadlib.h
+++ b/src/tools/map_extractor/loadlib/loadlib.h
@@ -19,7 +19,9 @@
#ifndef LOAD_LIB_H
#define LOAD_LIB_H
-#include "StormLib.h"
+#include "CascLib.h"
+#include <map>
+#include <string>
#ifdef _WIN32
typedef __int64 int64;
@@ -71,21 +73,41 @@ struct file_MVER
};
-class FileLoader{
+class FileChunk
+{
+public:
+ ~FileChunk();
+
+ uint8* data;
+ uint32 size;
+
+ template<class T>
+ T* As() { return (T*)data; }
+ void parseSubChunks();
+ std::multimap<std::string, FileChunk*> subchunks;
+ FileChunk* GetSubChunk(std::string const& name);
+};
+
+class ChunkedFile
+{
+public:
uint8 *data;
uint32 data_size;
-public:
- virtual bool prepareLoadedData();
- uint8 *GetData() {return data;}
- uint32 GetDataSize() {return data_size;}
- file_MVER *version;
- FileLoader();
- ~FileLoader();
+ uint8 *GetData() { return data; }
+ uint32 GetDataSize() { return data_size; }
+
+ ChunkedFile();
+ virtual ~ChunkedFile();
+ bool prepareLoadedData();
bool loadFile(HANDLE mpq, char *filename, bool log = true);
- virtual void free();
-};
+ void free();
+ void parseChunks();
+ std::multimap<std::string, FileChunk*> chunks;
+ FileChunk* GetChunk(std::string const& name);
+};
+
#pragma pack(pop)
#endif
diff --git a/src/tools/map_extractor/wdt.cpp b/src/tools/map_extractor/wdt.cpp
deleted file mode 100644
index 59444b46b88..00000000000
--- a/src/tools/map_extractor/wdt.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
- * Copyright (C) 2005-2011 MaNGOS <http://getmangos.com/>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#define _CRT_SECURE_NO_DEPRECATE
-
-#include "wdt.h"
-
-u_map_fcc MWMOMagic = { {'O', 'M', 'W', 'M'} };
-u_map_fcc MPHDMagic = { {'D', 'H', 'P', 'M'} };
-u_map_fcc MAINMagic = { {'N', 'I', 'A', 'M'} };
-
-bool wdt_MWMO::prepareLoadedData()
-{
- if (fcc != MWMOMagic.fcc)
- return false;
- return true;
-}
-
-bool wdt_MPHD::prepareLoadedData()
-{
- if (fcc != MPHDMagic.fcc)
- return false;
- return true;
-}
-
-bool wdt_MAIN::prepareLoadedData()
-{
- if (fcc != MAINMagic.fcc)
- return false;
- return true;
-}
-
-WDT_file::WDT_file()
-{
- mphd = 0;
- main = 0;
- wmo = 0;
-}
-
-WDT_file::~WDT_file()
-{
- free();
-}
-
-void WDT_file::free()
-{
- mphd = 0;
- main = 0;
- wmo = 0;
- FileLoader::free();
-}
-
-bool WDT_file::prepareLoadedData()
-{
- // Check parent
- if (!FileLoader::prepareLoadedData())
- return false;
-
- mphd = (wdt_MPHD *)((uint8*)version+version->size+8);
- if (!mphd->prepareLoadedData())
- return false;
- main = (wdt_MAIN *)((uint8*)mphd + mphd->size+8);
- if (!main->prepareLoadedData())
- return false;
- wmo = (wdt_MWMO *)((uint8*)main+ main->size+8);
- if (!wmo->prepareLoadedData())
- wmo = NULL; // optional as of cataclysm
- return true;
-}
diff --git a/src/tools/map_extractor/wdt.h b/src/tools/map_extractor/wdt.h
index d897cbfd854..ac26e7daade 100644
--- a/src/tools/map_extractor/wdt.h
+++ b/src/tools/map_extractor/wdt.h
@@ -27,64 +27,24 @@
#pragma pack(push, 1)
-class wdt_MWMO{
- union{
- uint32 fcc;
- char fcc_txt[4];
- };
-public:
- uint32 size;
- bool prepareLoadedData();
-};
-
-class wdt_MPHD{
- union{
- uint32 fcc;
- char fcc_txt[4];
- };
-public:
- uint32 size;
- uint32 data1;
- uint32 data2;
- uint32 data3;
- uint32 data4;
- uint32 data5;
- uint32 data6;
- uint32 data7;
- uint32 data8;
- bool prepareLoadedData();
-};
-
-class wdt_MAIN{
- union{
+class wdt_MAIN
+{
+ union
+ {
uint32 fcc;
char fcc_txt[4];
};
public:
uint32 size;
- struct adtData{
+ struct adtData
+ {
uint32 flag;
uint32 data1;
} adt_list[64][64];
-
- bool prepareLoadedData();
-};
-
-class WDT_file : public FileLoader{
-public:
- bool prepareLoadedData();
-
- WDT_file();
- ~WDT_file();
- void free();
-
- wdt_MPHD *mphd;
- wdt_MAIN *main;
- wdt_MWMO *wmo;
};
#pragma pack(pop)
-#endif \ No newline at end of file
+#endif
diff --git a/src/tools/vmap4_assembler/CMakeLists.txt b/src/tools/vmap4_assembler/CMakeLists.txt
index 041d44e014c..14d5c5e61ba 100644
--- a/src/tools/vmap4_assembler/CMakeLists.txt
+++ b/src/tools/vmap4_assembler/CMakeLists.txt
@@ -21,7 +21,7 @@ include_directories(
)
add_executable(vmap4assembler VMapAssembler.cpp)
-add_dependencies(vmap4assembler storm)
+add_dependencies(vmap4assembler casc)
target_link_libraries(vmap4assembler
collision
diff --git a/src/tools/vmap4_extractor/CMakeLists.txt b/src/tools/vmap4_extractor/CMakeLists.txt
index a98cc55666c..f1c2084b00b 100644
--- a/src/tools/vmap4_extractor/CMakeLists.txt
+++ b/src/tools/vmap4_extractor/CMakeLists.txt
@@ -22,7 +22,7 @@ if( NOT MSVC )
endif()
include_directories(
- ${CMAKE_SOURCE_DIR}/dep/StormLib/src
+ ${CMAKE_SOURCE_DIR}/dep/CascLib/src
)
add_executable(vmap4extractor ${sources})
@@ -30,10 +30,10 @@ add_executable(vmap4extractor ${sources})
target_link_libraries(vmap4extractor
${BZIP2_LIBRARIES}
${ZLIB_LIBRARIES}
- storm
+ casc
)
-add_dependencies(vmap4extractor storm)
+add_dependencies(vmap4extractor casc)
if( UNIX )
install(TARGETS vmap4extractor DESTINATION bin)