aboutsummaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/map_extractor/CMakeLists.txt57
-rw-r--r--src/tools/map_extractor/System.cpp74
-rw-r--r--src/tools/mmaps_generator/CMakeLists.txt62
-rw-r--r--src/tools/mmaps_generator/MapBuilder.cpp4
-rw-r--r--src/tools/vmap4_assembler/CMakeLists.txt20
-rw-r--r--src/tools/vmap4_extractor/CMakeLists.txt36
6 files changed, 145 insertions, 108 deletions
diff --git a/src/tools/map_extractor/CMakeLists.txt b/src/tools/map_extractor/CMakeLists.txt
index d0f3e42cef8..c0bd102f8e6 100644
--- a/src/tools/map_extractor/CMakeLists.txt
+++ b/src/tools/map_extractor/CMakeLists.txt
@@ -9,41 +9,38 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-file(GLOB_RECURSE mapextractor_SRCS *.cpp *.h)
-
-set(include_Dirs
- ${CMAKE_SOURCE_DIR}
- ${CMAKE_SOURCE_DIR}/dep/cppformat
- ${CMAKE_SOURCE_DIR}/dep/g3dlite/include
- ${CMAKE_SOURCE_DIR}/dep/libmpq
- ${CMAKE_SOURCE_DIR}/src/common
- ${CMAKE_SOURCE_DIR}/src/common/Utilities
- ${CMAKE_SOURCE_DIR}/src/server/shared
- ${CMAKE_CURRENT_SOURCE_DIR}/loadlib
-)
-
-if( WIN32 )
- set(include_Dirs
- ${include_Dirs}
- ${CMAKE_SOURCE_DIR}/dep/libmpq/win
- )
-endif()
-
-include_directories(${include_Dirs})
+CollectSourceFiles(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ PRIVATE_SOURCES)
add_executable(mapextractor
- ${mapextractor_SRCS}
+ ${PRIVATE_SOURCES}
)
+target_include_directories(mapextractor
+ PUBLIC
+ ${CMAKE_SOURCE_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}/loadlib)
+
target_link_libraries(mapextractor
- common
- format
- g3dlib
- mpq
- ${BZIP2_LIBRARIES}
- ${ZLIB_LIBRARIES}
- ${Boost_LIBRARIES}
-)
+ PUBLIC
+ common
+ mpq)
+
+CollectIncludeDirectories(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ PUBLIC_INCLUDES)
+
+target_include_directories(mapextractor
+ PUBLIC
+ ${PUBLIC_INCLUDES}
+ PRIVATE
+ ${CMAKE_CURRENT_BINARY_DIR})
+
+set_target_properties(mapextractor
+ PROPERTIES
+ FOLDER
+ "tools")
if( UNIX )
install(TARGETS mapextractor DESTINATION bin)
diff --git a/src/tools/map_extractor/System.cpp b/src/tools/map_extractor/System.cpp
index f3a761fd437..9d3dc47bce0 100644
--- a/src/tools/map_extractor/System.cpp
+++ b/src/tools/map_extractor/System.cpp
@@ -53,12 +53,13 @@ char input_path[MAX_PATH_LENGTH] = ".";
// **************************************************
enum Extract
{
- EXTRACT_MAP = 1,
- EXTRACT_DBC = 2
+ EXTRACT_MAP = 1,
+ EXTRACT_DBC = 2,
+ EXTRACT_CAMERA = 4
};
// Select data for extract
-int CONF_extract = EXTRACT_MAP | EXTRACT_DBC;
+int CONF_extract = EXTRACT_MAP | EXTRACT_DBC | EXTRACT_CAMERA;
// 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;
@@ -103,7 +104,7 @@ void Usage(char* prg)
"%s -[var] [value]\n"\
"-i set input path (max %d characters)\n"\
"-o set output path (max %d characters)\n"\
- "-e extract only MAP(1)/DBC(2) - standard: both(3)\n"\
+ "-e extract only MAP(1)/DBC(2)/Camera(4) - standard: all(7)\n"\
"-f height stored as int (less map size but lost some accuracy) 1 by default\n"\
"Example: %s -f 0 -i \"c:\\games\\game\"", prg, MAX_PATH_LENGTH - 1, MAX_PATH_LENGTH - 1, prg);
exit(1);
@@ -151,7 +152,7 @@ void HandleArgs(int argc, char * arg[])
if(c + 1 < argc) // all ok
{
CONF_extract=atoi(arg[(c++) + 1]);
- if(!(CONF_extract > 0 && CONF_extract < 4))
+ if(!(CONF_extract > 0 && CONF_extract < 8))
Usage(arg[0]);
}
else
@@ -1025,6 +1026,56 @@ void ExtractDBCFiles(int locale, bool basicLocale)
printf("Extracted %u DBC files\n\n", count);
}
+void ExtractCameraFiles(int locale, bool basicLocale)
+{
+ printf("Extracting camera files...\n");
+ DBCFile camdbc("DBFilesClient\\CinematicCamera.dbc");
+
+ if (!camdbc.open())
+ {
+ printf("Unable to open CinematicCamera.dbc. Camera extract aborted.\n");
+ return;
+ }
+
+ // get camera file list from DBC
+ std::vector<std::string> camerafiles;
+ size_t cam_count = camdbc.getRecordCount();
+
+ for (size_t i = 0; i < cam_count; ++i)
+ {
+ std::string camFile(camdbc.getRecord(i).getString(1));
+ size_t loc = camFile.find(".mdx");
+ if (loc != std::string::npos)
+ camFile.replace(loc, 4, ".m2");
+ camerafiles.push_back(std::string(camFile));
+ }
+
+ std::string path = output_path;
+ path += "/Cameras/";
+ CreateDir(path);
+ if (!basicLocale)
+ {
+ path += langs[locale];
+ path += "/";
+ CreateDir(path);
+ }
+
+ // extract M2s
+ uint32 count = 0;
+ for (std::string thisFile : camerafiles)
+ {
+ std::string filename = path;
+ filename += (thisFile.c_str() + strlen("Cameras\\"));
+
+ if (boost::filesystem::exists(filename))
+ continue;
+
+ if (ExtractFile(thisFile.c_str(), filename))
+ ++count;
+ }
+ printf("Extracted %u camera files\n", count);
+}
+
void LoadLocaleMPQFiles(int const locale)
{
std::string fileName = Trinity::StringFormat("%s/Data/%s/locale-%s.MPQ", input_path, langs[locale], langs[locale]);
@@ -1111,6 +1162,19 @@ int main(int argc, char * arg[])
return 0;
}
+ if (CONF_extract & EXTRACT_CAMERA)
+ {
+ printf("Using locale: %s\n", langs[FirstLocale]);
+
+ // Open MPQs
+ LoadLocaleMPQFiles(FirstLocale);
+ LoadCommonMPQFiles();
+
+ ExtractCameraFiles(FirstLocale, true);
+ // Close MPQs
+ CloseMPQFiles();
+ }
+
if (CONF_extract & EXTRACT_MAP)
{
printf("Using locale: %s\n", langs[FirstLocale]);
diff --git a/src/tools/mmaps_generator/CMakeLists.txt b/src/tools/mmaps_generator/CMakeLists.txt
index 4eb416a106b..64c82101f61 100644
--- a/src/tools/mmaps_generator/CMakeLists.txt
+++ b/src/tools/mmaps_generator/CMakeLists.txt
@@ -8,51 +8,33 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-file(GLOB_RECURSE mmap_gen_sources *.cpp *.h)
+CollectSourceFiles(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ PRIVATE_SOURCES)
-set(mmap_gen_Includes
- ${CMAKE_BINARY_DIR}
- ${CMAKE_SOURCE_DIR}/dep/libmpq
- ${CMAKE_SOURCE_DIR}/dep/zlib
- ${CMAKE_SOURCE_DIR}/dep/bzip2
- ${CMAKE_SOURCE_DIR}/dep/g3dlite/include
- ${CMAKE_SOURCE_DIR}/dep/recastnavigation/Recast
- ${CMAKE_SOURCE_DIR}/dep/recastnavigation/Recast/Include
- ${CMAKE_SOURCE_DIR}/dep/recastnavigation/Detour
- ${CMAKE_SOURCE_DIR}/dep/recastnavigation/Detour/Include
- ${CMAKE_SOURCE_DIR}/src/server/shared
- ${CMAKE_SOURCE_DIR}/src/server/game/Conditions
- ${CMAKE_SOURCE_DIR}/src/common
- ${CMAKE_SOURCE_DIR}/src/common/Collision
- ${CMAKE_SOURCE_DIR}/src/common/Collision/Management
- ${CMAKE_SOURCE_DIR}/src/common/Collision/Maps
- ${CMAKE_SOURCE_DIR}/src/common/Collision/Models
- ${CMAKE_SOURCE_DIR}/src/common/Debugging
- ${CMAKE_SOURCE_DIR}/src/common/Threading
- ${CMAKE_SOURCE_DIR}/src/common/Utilities
-)
+add_executable(mmaps_generator ${PRIVATE_SOURCES})
-if( WIN32 )
- set(mmap_gen_Includes
- ${mmap_gen_Includes}
- ${CMAKE_SOURCE_DIR}/dep/libmpq/win
- )
-endif()
+target_link_libraries(mmaps_generator
+ PUBLIC
+ common
+ Recast
+ Detour
+ mpq)
-include_directories(${mmap_gen_Includes})
+CollectIncludeDirectories(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ PUBLIC_INCLUDES)
-add_executable(mmaps_generator ${mmap_gen_sources})
+target_include_directories(mmaps_generator
+ PUBLIC
+ ${PUBLIC_INCLUDES}
+ PRIVATE
+ ${CMAKE_CURRENT_BINARY_DIR})
-target_link_libraries(mmaps_generator
- common
- g3dlib
- Recast
- Detour
- ${BZIP2_LIBRARIES}
- ${ZLIB_LIBRARIES}
- ${CMAKE_THREAD_LIBS_INIT}
- ${Boost_LIBRARIES}
-)
+set_target_properties(mmaps_generator
+ PROPERTIES
+ FOLDER
+ "tools")
if( UNIX )
install(TARGETS mmaps_generator DESTINATION bin)
diff --git a/src/tools/mmaps_generator/MapBuilder.cpp b/src/tools/mmaps_generator/MapBuilder.cpp
index 3a63f9718db..80b7b266f27 100644
--- a/src/tools/mmaps_generator/MapBuilder.cpp
+++ b/src/tools/mmaps_generator/MapBuilder.cpp
@@ -699,7 +699,7 @@ namespace MMAP
iv.polyMesh = rcAllocPolyMesh();
if (!iv.polyMesh)
{
- printf("%s alloc iv.polyMesh FIALED!\n", tileString);
+ printf("%s alloc iv.polyMesh FAILED!\n", tileString);
delete[] pmmerge;
delete[] dmmerge;
delete[] tiles;
@@ -710,7 +710,7 @@ namespace MMAP
iv.polyMeshDetail = rcAllocPolyMeshDetail();
if (!iv.polyMeshDetail)
{
- printf("%s alloc m_dmesh FIALED!\n", tileString);
+ printf("%s alloc m_dmesh FAILED!\n", tileString);
delete[] pmmerge;
delete[] dmmerge;
delete[] tiles;
diff --git a/src/tools/vmap4_assembler/CMakeLists.txt b/src/tools/vmap4_assembler/CMakeLists.txt
index c33b2996685..58cb066f75b 100644
--- a/src/tools/vmap4_assembler/CMakeLists.txt
+++ b/src/tools/vmap4_assembler/CMakeLists.txt
@@ -9,17 +9,6 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-include_directories(
- ${CMAKE_SOURCE_DIR}/dep/g3dlite/include
- ${CMAKE_SOURCE_DIR}/src/server/shared
- ${CMAKE_SOURCE_DIR}/src/server/shared/Debugging
- ${CMAKE_SOURCE_DIR}/src/common
- ${CMAKE_SOURCE_DIR}/src/common/Collision
- ${CMAKE_SOURCE_DIR}/src/common/Collision/Maps
- ${CMAKE_SOURCE_DIR}/src/common/Collision/Models
- ${ZLIB_INCLUDE_DIR}
-)
-
add_executable(vmap4assembler VMapAssembler.cpp)
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
@@ -28,9 +17,12 @@ endif()
target_link_libraries(vmap4assembler
common
- g3dlib
- ${ZLIB_LIBRARIES}
-)
+ zlib)
+
+set_target_properties(vmap4assembler
+ PROPERTIES
+ FOLDER
+ "tools")
if( UNIX )
install(TARGETS vmap4assembler DESTINATION bin)
diff --git a/src/tools/vmap4_extractor/CMakeLists.txt b/src/tools/vmap4_extractor/CMakeLists.txt
index 55e66b32ea8..f13aaec15b2 100644
--- a/src/tools/vmap4_extractor/CMakeLists.txt
+++ b/src/tools/vmap4_extractor/CMakeLists.txt
@@ -9,28 +9,30 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-file(GLOB_RECURSE sources *.cpp *.h)
+CollectSourceFiles(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ PRIVATE_SOURCES)
-set(include_Dirs
- ${CMAKE_SOURCE_DIR}/dep/libmpq
-)
+add_executable(vmap4extractor ${PRIVATE_SOURCES})
-if( WIN32 )
- set(include_Dirs
- ${include_Dirs}
- ${CMAKE_SOURCE_DIR}/dep/libmpq/win
- )
-endif()
+target_link_libraries(vmap4extractor
+ PUBLIC
+ mpq)
-include_directories(${include_Dirs})
+CollectIncludeDirectories(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ PUBLIC_INCLUDES)
-add_executable(vmap4extractor ${sources})
+target_include_directories(vmap4extractor
+ PUBLIC
+ ${PUBLIC_INCLUDES}
+ PRIVATE
+ ${CMAKE_CURRENT_BINARY_DIR})
-target_link_libraries(vmap4extractor
- mpq
- ${BZIP2_LIBRARIES}
- ${ZLIB_LIBRARIES}
-)
+set_target_properties(vmap4extractor
+ PROPERTIES
+ FOLDER
+ "tools")
if( UNIX )
install(TARGETS vmap4extractor DESTINATION bin)