TrinityCore
Loading...
Searching...
No Matches
System.cpp File Reference
#include "dbcfile.h"
#include "Banner.h"
#include "Locales.h"
#include "mpq_libmpq.h"
#include "StringFormat.h"
#include "Util.h"
#include "adt.h"
#include "wdt.h"
#include <boost/filesystem/directory.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/path.hpp>
#include <deque>
#include <fstream>
#include <set>
#include <unordered_map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <G3D/Plane.h>
#include <boost/filesystem.hpp>
#include "WheatyExceptionReport.h"
+ Include dependency graph for System.cpp:

Go to the source code of this file.

Classes

struct  map_id
 
struct  LiquidTypeEntry
 
struct  map_fileheader
 
struct  map_areaHeader
 
struct  map_heightHeader
 
struct  map_liquidHeader
 

Macros

#define MAX_PATH_LENGTH   128
 
#define MAP_AREA_NO_AREA   0x0001
 
#define MAP_HEIGHT_NO_HEIGHT   0x0001
 
#define MAP_HEIGHT_AS_INT16   0x0002
 
#define MAP_HEIGHT_AS_INT8   0x0004
 
#define MAP_HEIGHT_HAS_FLIGHT_BOUNDS   0x0008
 
#define MAP_LIQUID_TYPE_NO_WATER   0x00
 
#define MAP_LIQUID_TYPE_WATER   0x01
 
#define MAP_LIQUID_TYPE_OCEAN   0x02
 
#define MAP_LIQUID_TYPE_MAGMA   0x04
 
#define MAP_LIQUID_TYPE_SLIME   0x08
 
#define MAP_LIQUID_TYPE_DARK_WATER   0x10
 
#define MAP_LIQUID_NO_TYPE   0x0001
 
#define MAP_LIQUID_NO_HEIGHT   0x0002
 

Enumerations

enum  Extract { EXTRACT_MAP = 1 , EXTRACT_DBC = 2 , EXTRACT_CAMERA = 4 }
 

Functions

void CreateDir (boost::filesystem::path const &path)
 
void Usage (char const *prg)
 
void HandleArgs (int argc, char *arg[])
 
uint32 ReadBuild (int locale)
 
uint32 ReadMapDBC ()
 
void ReadLiquidTypeTableDBC ()
 
float selectUInt8StepStore (float maxDiff)
 
float selectUInt16StepStore (float maxDiff)
 
bool ConvertADT (std::string const &inputPath, std::string const &outputPath, int, int, uint32 build)
 
void ExtractMapsFromMpq (uint32 build)
 
bool ExtractFile (char const *mpq_name, std::string const &filename)
 
void ExtractDBCFiles (int locale, bool basicLocale)
 
void ExtractCameraFiles (int locale, bool basicLocale)
 
int main (int argc, char *arg[])
 
 INIT_CRASH_HANDLER ()
 

Variables

std::vector< map_idmap_ids
 
std::unordered_map< uint32, LiquidTypeEntryLiquidTypes
 
char output_path [MAX_PATH_LENGTH] = "."
 
char input_path [MAX_PATH_LENGTH] = "."
 
int CONF_extract = EXTRACT_MAP | EXTRACT_DBC | EXTRACT_CAMERA
 
bool CONF_allow_height_limit = true
 
float CONF_use_minHeight = -500.0f
 
bool CONF_allow_float_to_int = true
 
float CONF_float_to_int8_limit = 2.0f
 
float CONF_float_to_int16_limit = 2048.0f
 
float CONF_flat_height_delta_limit = 0.005f
 
float CONF_flat_liquid_delta_limit = 0.001f
 
static constexpr std::array< std::string_view, 12 > MpqLocaleNames = { "enGB", "enUS", "deDE", "esES", "frFR", "koKR", "zhCN", "zhTW", "enCN", "enTW", "esMX", "ruRU" }
 
static char const * MAP_MAGIC = "MAPS"
 
static uint32 const MAP_VERSION_MAGIC = 10
 
static char const * MAP_AREA_MAGIC = "AREA"
 
static char const * MAP_HEIGHT_MAGIC = "MHGT"
 
static char const * MAP_LIQUID_MAGIC = "MLIQ"
 
uint16 area_ids [ADT_CELLS_PER_GRID][ADT_CELLS_PER_GRID]
 
float V8 [ADT_GRID_SIZE][ADT_GRID_SIZE]
 
float V9 [ADT_GRID_SIZE+1][ADT_GRID_SIZE+1]
 
uint16 uint16_V8 [ADT_GRID_SIZE][ADT_GRID_SIZE]
 
uint16 uint16_V9 [ADT_GRID_SIZE+1][ADT_GRID_SIZE+1]
 
uint8 uint8_V8 [ADT_GRID_SIZE][ADT_GRID_SIZE]
 
uint8 uint8_V9 [ADT_GRID_SIZE+1][ADT_GRID_SIZE+1]
 
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]
 
int16 flight_box_max [3][3]
 
int16 flight_box_min [3][3]
 

Macro Definition Documentation

◆ MAP_AREA_NO_AREA

#define MAP_AREA_NO_AREA   0x0001

Definition at line 277 of file System.cpp.

◆ MAP_HEIGHT_AS_INT16

#define MAP_HEIGHT_AS_INT16   0x0002

Definition at line 287 of file System.cpp.

◆ MAP_HEIGHT_AS_INT8

#define MAP_HEIGHT_AS_INT8   0x0004

Definition at line 288 of file System.cpp.

◆ MAP_HEIGHT_HAS_FLIGHT_BOUNDS

#define MAP_HEIGHT_HAS_FLIGHT_BOUNDS   0x0008

Definition at line 289 of file System.cpp.

◆ MAP_HEIGHT_NO_HEIGHT

#define MAP_HEIGHT_NO_HEIGHT   0x0001

Definition at line 286 of file System.cpp.

◆ MAP_LIQUID_NO_HEIGHT

#define MAP_LIQUID_NO_HEIGHT   0x0002

Definition at line 308 of file System.cpp.

◆ MAP_LIQUID_NO_TYPE

#define MAP_LIQUID_NO_TYPE   0x0001

Definition at line 307 of file System.cpp.

◆ MAP_LIQUID_TYPE_DARK_WATER

#define MAP_LIQUID_TYPE_DARK_WATER   0x10

Definition at line 305 of file System.cpp.

◆ MAP_LIQUID_TYPE_MAGMA

#define MAP_LIQUID_TYPE_MAGMA   0x04

Definition at line 302 of file System.cpp.

◆ MAP_LIQUID_TYPE_NO_WATER

#define MAP_LIQUID_TYPE_NO_WATER   0x00

Definition at line 299 of file System.cpp.

◆ MAP_LIQUID_TYPE_OCEAN

#define MAP_LIQUID_TYPE_OCEAN   0x02

Definition at line 301 of file System.cpp.

◆ MAP_LIQUID_TYPE_SLIME

#define MAP_LIQUID_TYPE_SLIME   0x08

Definition at line 303 of file System.cpp.

◆ MAP_LIQUID_TYPE_WATER

#define MAP_LIQUID_TYPE_WATER   0x01

Definition at line 300 of file System.cpp.

◆ MAX_PATH_LENGTH

#define MAX_PATH_LENGTH   128

Definition at line 54 of file System.cpp.

Enumeration Type Documentation

◆ Extract

enum Extract
Enumerator
EXTRACT_MAP 
EXTRACT_DBC 
EXTRACT_CAMERA 

Definition at line 61 of file System.cpp.

Function Documentation

◆ ConvertADT()

bool ConvertADT ( std::string const &  inputPath,
std::string const &  outputPath,
int  ,
int  ,
uint32  build 
)

Definition at line 351 of file System.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CreateDir()

void CreateDir ( boost::filesystem::path const &  path)

Definition at line 83 of file System.cpp.

+ Here is the caller graph for this function:

◆ ExtractCameraFiles()

void ExtractCameraFiles ( int  locale,
bool  basicLocale 
)

Definition at line 1027 of file System.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ExtractDBCFiles()

void ExtractDBCFiles ( int  locale,
bool  basicLocale 
)

Definition at line 977 of file System.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ExtractFile()

bool ExtractFile ( char const *  mpq_name,
std::string const &  filename 
)

Definition at line 961 of file System.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ExtractMapsFromMpq()

void ExtractMapsFromMpq ( uint32  build)

Definition at line 913 of file System.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HandleArgs()

void HandleArgs ( int  argc,
char *  arg[] 
)

Definition at line 106 of file System.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ INIT_CRASH_HANDLER()

INIT_CRASH_HANDLER ( )

◆ main()

int main ( int  argc,
char *  arg[] 
)

Definition at line 1077 of file System.cpp.

+ Here is the call graph for this function:

◆ ReadBuild()

uint32 ReadBuild ( int  locale)

Definition at line 163 of file System.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ReadLiquidTypeTableDBC()

void ReadLiquidTypeTableDBC ( )

Definition at line 232 of file System.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ReadMapDBC()

uint32 ReadMapDBC ( )

Definition at line 200 of file System.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ selectUInt16StepStore()

float selectUInt16StepStore ( float  maxDiff)

Definition at line 328 of file System.cpp.

+ Here is the caller graph for this function:

◆ selectUInt8StepStore()

float selectUInt8StepStore ( float  maxDiff)

Definition at line 323 of file System.cpp.

+ Here is the caller graph for this function:

◆ Usage()

void Usage ( char const *  prg)

Definition at line 93 of file System.cpp.

+ Here is the caller graph for this function:

Variable Documentation

◆ area_ids

Definition at line 333 of file System.cpp.

◆ CONF_allow_float_to_int

bool CONF_allow_float_to_int = true

Definition at line 75 of file System.cpp.

◆ CONF_allow_height_limit

bool CONF_allow_height_limit = true

Definition at line 71 of file System.cpp.

◆ CONF_extract

int CONF_extract = EXTRACT_MAP | EXTRACT_DBC | EXTRACT_CAMERA

Definition at line 69 of file System.cpp.

◆ CONF_flat_height_delta_limit

float CONF_flat_height_delta_limit = 0.005f

Definition at line 78 of file System.cpp.

◆ CONF_flat_liquid_delta_limit

float CONF_flat_liquid_delta_limit = 0.001f

Definition at line 79 of file System.cpp.

◆ CONF_float_to_int16_limit

float CONF_float_to_int16_limit = 2048.0f

Definition at line 77 of file System.cpp.

◆ CONF_float_to_int8_limit

float CONF_float_to_int8_limit = 2.0f

Definition at line 76 of file System.cpp.

◆ CONF_use_minHeight

float CONF_use_minHeight = -500.0f

Definition at line 72 of file System.cpp.

◆ flight_box_max

int16 flight_box_max[3][3]

Definition at line 348 of file System.cpp.

◆ flight_box_min

int16 flight_box_min[3][3]

Definition at line 349 of file System.cpp.

◆ holes

Definition at line 346 of file System.cpp.

◆ input_path

char input_path[MAX_PATH_LENGTH] = "."

Definition at line 56 of file System.cpp.

◆ liquid_entry

Definition at line 342 of file System.cpp.

◆ liquid_flags

Definition at line 343 of file System.cpp.

◆ liquid_height

float liquid_height[ADT_GRID_SIZE+1][ADT_GRID_SIZE+1]

Definition at line 345 of file System.cpp.

◆ liquid_show

bool liquid_show[ADT_GRID_SIZE][ADT_GRID_SIZE]

Definition at line 344 of file System.cpp.

◆ LiquidTypes

std::unordered_map<uint32, LiquidTypeEntry> LiquidTypes

Definition at line 53 of file System.cpp.

◆ MAP_AREA_MAGIC

char const* MAP_AREA_MAGIC = "AREA"
static

Definition at line 258 of file System.cpp.

◆ MAP_HEIGHT_MAGIC

char const* MAP_HEIGHT_MAGIC = "MHGT"
static

Definition at line 259 of file System.cpp.

◆ map_ids

std::vector<map_id> map_ids

Definition at line 52 of file System.cpp.

◆ MAP_LIQUID_MAGIC

char const* MAP_LIQUID_MAGIC = "MLIQ"
static

Definition at line 260 of file System.cpp.

◆ MAP_MAGIC

char const* MAP_MAGIC = "MAPS"
static

Definition at line 256 of file System.cpp.

◆ MAP_VERSION_MAGIC

uint32 const MAP_VERSION_MAGIC = 10
static

Definition at line 257 of file System.cpp.

◆ MpqLocaleNames

constexpr std::array<std::string_view, 12> MpqLocaleNames = { "enGB", "enUS", "deDE", "esES", "frFR", "koKR", "zhCN", "zhTW", "enCN", "enTW", "esMX", "ruRU" }
staticconstexpr

Definition at line 81 of file System.cpp.

◆ output_path

char output_path[MAX_PATH_LENGTH] = "."

Definition at line 55 of file System.cpp.

◆ uint16_V8

Definition at line 337 of file System.cpp.

◆ uint16_V9

Definition at line 338 of file System.cpp.

◆ uint8_V8

Definition at line 339 of file System.cpp.

◆ uint8_V9

Definition at line 340 of file System.cpp.

◆ V8

Definition at line 335 of file System.cpp.

◆ V9

float V9[ADT_GRID_SIZE+1][ADT_GRID_SIZE+1]

Definition at line 336 of file System.cpp.