59 printf(
"Extracting GameObject models...");
63 printf(
"Fatal error: Invalid GameObjectDisplayInfo.dbc file format!\n");
70 printf(
"Fatal error: Invalid FileData.dbc file format!\n");
78 std::string modelListPath = basepath +
"temp_gameobject_models";
79 FILE*
model_list = fopen(modelListPath.c_str(),
"wb");
82 printf(
"Fatal error: Could not open file %s\n", modelListPath.c_str());
86 size_t maxFileId = fileData.getMaxId() + 1;
88 memset(fileDataIndex, 0, maxFileId *
sizeof(
uint32));
89 size_t files = fileData.getRecordCount();
90 for (
uint32 i = 0; i < files; ++i)
91 fileDataIndex[fileData.getRecord(i).getUInt(0)] = i;
95 uint32 fileId = it->getUInt(1);
99 uint32 fileIndex = fileDataIndex[fileId];
103 std::string filename = fileData.getRecord(fileIndex).getString(1);
104 std::string filepath = fileData.getRecord(fileIndex).getString(2);
106 path = filepath + filename;
108 if (path.length() < 4)
122 if (!strcmp(ch_ext,
".wmo"))
124 else if (!strcmp(ch_ext,
".mdl"))
126 else if (!strcmp(ch_ext,
".mdx") || !strcmp(ch_ext,
".m2"))
131 uint32 displayId = it->getUInt(0);
132 uint32 path_length = strlen(name);
133 fwrite(&displayId,
sizeof(
uint32), 1, model_list);
134 fwrite(&path_length,
sizeof(
uint32), 1, model_list);
135 fwrite(name,
sizeof(
char), path_length, model_list);
141 delete[] fileDataIndex;
bool ExtractSingleWmo(std::string &fname)
Definition: vmapexport.cpp:281
ModelList model_list
Definition: GameObjectModel.cpp:41
void FixNameCase(char *name, size_t len)
Definition: adtfile.cpp:47
void strToLower(char *str)
Definition: vmapexport.cpp:218
void FixNameSpaces(char *name, size_t len)
Definition: adtfile.cpp:64
uint32_t uint32
Definition: Define.h:150
char * GetExtension(char *FileName)
Definition: adtfile.cpp:73
char const * GetPlainName(char const *FileName)
Definition: adtfile.cpp:29
const char * szWorkDirWmo
Definition: vmapexport.cpp:81
void printf(BasicWriter< Char > &w, BasicCStringRef< Char > format, ArgList args)
Definition: format.h:3083