mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 00:48:56 +01:00
Tools/Misc: Partial cherry-pick of fe4d11c65a
This commit is contained in:
@@ -41,8 +41,8 @@ typedef struct
|
||||
uint32 id;
|
||||
} map_id;
|
||||
|
||||
map_id *map_ids;
|
||||
uint16 *LiqType;
|
||||
std::vector<map_id> map_ids;
|
||||
std::vector<uint16> LiqType;
|
||||
#define MAX_PATH_LENGTH 128
|
||||
char output_path[MAX_PATH_LENGTH] = ".";
|
||||
char input_path[MAX_PATH_LENGTH] = ".";
|
||||
@@ -210,7 +210,7 @@ uint32 ReadMapDBC()
|
||||
}
|
||||
|
||||
size_t map_count = dbc.getRecordCount();
|
||||
map_ids = new map_id[map_count];
|
||||
map_ids.resize(map_count);
|
||||
for(uint32 x = 0; x < map_count; ++x)
|
||||
{
|
||||
map_ids[x].id = dbc.getRecord(x).getUInt(0);
|
||||
@@ -242,8 +242,7 @@ void ReadLiquidTypeTableDBC()
|
||||
|
||||
size_t liqTypeCount = dbc.getRecordCount();
|
||||
size_t liqTypeMaxId = dbc.getMaxId();
|
||||
LiqType = new uint16[liqTypeMaxId + 1];
|
||||
memset(LiqType, 0xff, (liqTypeMaxId + 1) * sizeof(uint16));
|
||||
LiqType.resize(liqTypeMaxId + 1, 0xFFFF);
|
||||
|
||||
for(uint32 x = 0; x < liqTypeCount; ++x)
|
||||
LiqType[dbc.getRecord(x).getUInt(0)] = dbc.getRecord(x).getUInt(3);
|
||||
@@ -956,7 +955,6 @@ void ExtractMapsFromMpq(uint32 build)
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
delete[] map_ids;
|
||||
}
|
||||
|
||||
bool ExtractFile( char const* mpq_name, std::string const& filename )
|
||||
|
||||
@@ -53,8 +53,8 @@ typedef struct
|
||||
unsigned int id;
|
||||
}map_id;
|
||||
|
||||
map_id * map_ids;
|
||||
uint16 *LiqType = 0;
|
||||
std::vector<map_id> map_ids;
|
||||
std::vector<uint16> LiqType;
|
||||
uint32 map_count;
|
||||
char output_path[128]=".";
|
||||
char input_path[1024]=".";
|
||||
@@ -101,8 +101,7 @@ void ReadLiquidTypeTableDBC()
|
||||
|
||||
size_t LiqType_count = dbc.getRecordCount();
|
||||
size_t LiqType_maxid = dbc.getRecord(LiqType_count - 1).getUInt(0);
|
||||
LiqType = new uint16[LiqType_maxid + 1];
|
||||
memset(LiqType, 0xff, (LiqType_maxid + 1) * sizeof(uint16));
|
||||
LiqType.resize(LiqType_maxid + 1, 0xFFFF);
|
||||
|
||||
for(uint32 x = 0; x < LiqType_count; ++x)
|
||||
LiqType[dbc.getRecord(x).getUInt(0)] = dbc.getRecord(x).getUInt(3);
|
||||
@@ -501,7 +500,7 @@ int main(int argc, char ** argv)
|
||||
return 1;
|
||||
}
|
||||
map_count = dbc->getRecordCount();
|
||||
map_ids = new map_id[map_count];
|
||||
map_ids.resize(map_count);
|
||||
for (unsigned int x = 0; x < map_count; ++x)
|
||||
{
|
||||
map_ids[x].id = dbc->getRecord(x).getUInt(0);
|
||||
@@ -511,7 +510,6 @@ int main(int argc, char ** argv)
|
||||
if (strlen(map_name) >= max_map_name_length)
|
||||
{
|
||||
delete dbc;
|
||||
delete[] map_ids;
|
||||
printf("FATAL ERROR: Map name too long.\n");
|
||||
return 1;
|
||||
}
|
||||
@@ -523,7 +521,6 @@ int main(int argc, char ** argv)
|
||||
|
||||
delete dbc;
|
||||
ParsMapFiles();
|
||||
delete[] map_ids;
|
||||
//nError = ERROR_SUCCESS;
|
||||
// Extract models, listed in DameObjectDisplayInfo.dbc
|
||||
ExtractGameobjectModels();
|
||||
@@ -537,6 +534,5 @@ int main(int argc, char ** argv)
|
||||
}
|
||||
|
||||
printf("Extract %s. Work complete. No errors.\n", versionString);
|
||||
delete[] LiqType;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -27,11 +27,11 @@
|
||||
#undef min
|
||||
#undef max
|
||||
|
||||
extern uint16 *LiqType;
|
||||
extern std::vector<uint16> LiqType;
|
||||
|
||||
WMORoot::WMORoot(std::string &filename)
|
||||
: filename(filename), col(0), nTextures(0), nGroups(0), nP(0), nLights(0),
|
||||
nModels(0), nDoodads(0), nDoodadSets(0), RootWMOID(0), liquidType(0)
|
||||
: filename(filename), color(0), nTextures(0), nGroups(0), nPortals(0), nLights(0),
|
||||
nDoodadNames(0), nDoodadDefs(0), nDoodadSets(0), RootWMOID(0), flags(0)
|
||||
{
|
||||
memset(bbcorn1, 0, sizeof(bbcorn1));
|
||||
memset(bbcorn2, 0, sizeof(bbcorn2));
|
||||
@@ -63,16 +63,16 @@ bool WMORoot::open()
|
||||
{
|
||||
f.read(&nTextures, 4);
|
||||
f.read(&nGroups, 4);
|
||||
f.read(&nP, 4);
|
||||
f.read(&nPortals, 4);
|
||||
f.read(&nLights, 4);
|
||||
f.read(&nModels, 4);
|
||||
f.read(&nDoodads, 4);
|
||||
f.read(&nDoodadNames, 4);
|
||||
f.read(&nDoodadDefs, 4);
|
||||
f.read(&nDoodadSets, 4);
|
||||
f.read(&col, 4);
|
||||
f.read(&color, 4);
|
||||
f.read(&RootWMOID, 4);
|
||||
f.read(bbcorn1, 12);
|
||||
f.read(bbcorn2, 12);
|
||||
f.read(&liquidType, 4);
|
||||
f.read(&flags, 4);
|
||||
break;
|
||||
}
|
||||
/*
|
||||
@@ -407,7 +407,7 @@ int WMOGroup::ConvertToVMAPGroupWmo(FILE *output, WMORoot *rootWMO, bool precise
|
||||
|
||||
// according to WoW.Dev Wiki:
|
||||
uint32 liquidEntry;
|
||||
if (rootWMO->liquidType & 4)
|
||||
if (rootWMO->flags & 4)
|
||||
liquidEntry = liquidType;
|
||||
else if (liquidType == 15)
|
||||
liquidEntry = 0;
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
#include "vec3d.h"
|
||||
#include "loadlib/loadlib.h"
|
||||
|
||||
@@ -51,8 +52,8 @@ class WMORoot
|
||||
private:
|
||||
std::string filename;
|
||||
public:
|
||||
unsigned int col;
|
||||
uint32 nTextures, nGroups, nP, nLights, nModels, nDoodads, nDoodadSets, RootWMOID, liquidType;
|
||||
unsigned int color;
|
||||
uint32 nTextures, nGroups, nPortals, nLights, nDoodadNames, nDoodadDefs, nDoodadSets, RootWMOID, flags;
|
||||
float bbcorn1[3];
|
||||
float bbcorn2[3];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user