* stuffextract is up to date, no need for changes.

* implemented extraction of ItemDisplayInfo.dbc to stuffextract. output scp file not used by PseuWoW yet.
This commit is contained in:
False.Genesis 2007-09-09 19:44:19 +00:00
parent 97f5d0da98
commit 6d92af5c58
2 changed files with 65 additions and 2 deletions

View File

@ -258,4 +258,46 @@ static const char *AreaTableFormat = {
"xxxxxxx" "xxxxxxx"
}; };
enum ItemDisplayInfoEnum
{
ITEMDISPLAYINFO_ID = 0,
ITEMDISPLAYINFO_MODEL_L = 1, // model file (left) (default)
ITEMDISPLAYINFO_MODEL_R = 2, // model file (right) (for example for shoulders)
ITEMDISPLAYINFO_NAME_L = 3, // (internal name?)
ITEMDISPLAYINFO_NAME_R = 4, // (internal name?)
ITEMDISPLAYINFO_ICON = 5, // icon filename
ITEMDISPLAYINFO_FLAG1 = 6, // must be some kind of flag. 0 - 5.
ITEMDISPLAYINFO_FLAG2 = 7, // some flag? 0, 1 or 2.
ITEMDISPLAYINFO_FLAG3 = 8, // some flag? 0 or 1.
ITEMDISPLAYINFO_FLAG4 = 9, // some flag? 0, 1 or 2.
ITEMDISPLAYINFO_FLAG5 = 10, // some flag? mostly 0, sometimes other values (for ex. polearms have 4081 ?!)
ITEMDISPLAYINFO_FLAGS = 11, // these is NOT the inventorytype...
ITEMDISPLAYINFO_HELM1 = 12, // only set if model is a helm. might be related to hair/ears/traits showing on or off.
ITEMDISPLAYINFO_HELM2 = 13, // ^ same.
ITEMDISPLAYINFO_AU = 14, // the following fields contain strings that end with AU, AL, HA, TU, etc.
ITEMDISPLAYINFO_AL = 15, // sometimes they are set, sometimes not.
ITEMDISPLAYINFO_HA = 16,
ITEMDISPLAYINFO_TU = 17,
ITEMDISPLAYINFO_TL = 18,
ITEMDISPLAYINFO_LU = 19,
ITEMDISPLAYINFO_LL = 20,
ITEMDISPLAYINFO_FO = 21,
ITEMDISPLAYINFO_UNK = 22, // mostly 0. quite sure this is not a string.
ITEMDISPLAYINFO_END = 23
};
static const char *ItemDisplayInfoFieldNames[] = {
"","model_l","model_r","name_l","name_r","icon","flag1","flag2","flag3","flag4", // 0-9
"flag5","flags","helm1","helm2","AU","AL","HA","TU","TL","LU", // 10-19
"LL","FO","unk", // 20-22
""
};
static const char *ItemDisplayInfoFormat = {
"isssssiiii"
"iiiissssss"
"ssi"
};
#endif #endif

View File

@ -54,12 +54,16 @@ std::string AutoGetDataString(DBCFile::Iterator& it, const char* format, uint32
{ {
if(format[field]=='i') if(format[field]=='i')
{ {
if((*it).getInt(field) == 0)
return ""; // do not explicitly write int fields that are 0
std::stringstream s; std::stringstream s;
s << (*it).getInt(field); s << (*it).getInt(field);
return s.str(); return s.str();
} }
else if(format[field]=='f') else if(format[field]=='f')
{ {
if((*it).getFloat(field) == 0)
return ""; // do not explicitly write float fields that are 0
std::stringstream s; std::stringstream s;
s << (*it).getFloat(field); s << (*it).getFloat(field);
return s.str(); return s.str();
@ -100,8 +104,8 @@ void OutSCP(char *fn, SCPStorageMap& scp)
bool ConvertDBC(void) bool ConvertDBC(void)
{ {
std::map<uint8,std::string> racemap; // needed to extract other dbc files correctly std::map<uint8,std::string> racemap; // needed to extract other dbc files correctly
SCPStorageMap EmoteDataStorage,RaceDataStorage,SoundDataStorage,MapDataStorage,AreaDataStorage; // will store the converted data from dbc files SCPStorageMap EmoteDataStorage,RaceDataStorage,SoundDataStorage,MapDataStorage,AreaDataStorage,ItemDisplayInfoStorage; // will store the converted data from dbc files
DBCFile EmotesText,EmotesTextData,EmotesTextSound,ChrRaces,SoundEntries,Map,AreaTable; DBCFile EmotesText,EmotesTextData,EmotesTextSound,ChrRaces,SoundEntries,Map,AreaTable,ItemDisplayInfo;
printf("Opening DBC archive...\n"); printf("Opening DBC archive...\n");
MPQHelper mpq("dbc"); MPQHelper mpq("dbc");
@ -113,6 +117,7 @@ bool ConvertDBC(void)
SoundEntries.openmem(mpq.ExtractFile("DBFilesClient\\SoundEntries.dbc")); SoundEntries.openmem(mpq.ExtractFile("DBFilesClient\\SoundEntries.dbc"));
Map.openmem(mpq.ExtractFile("DBFilesClient\\Map.dbc")); Map.openmem(mpq.ExtractFile("DBFilesClient\\Map.dbc"));
AreaTable.openmem(mpq.ExtractFile("DBFilesClient\\AreaTable.dbc")); AreaTable.openmem(mpq.ExtractFile("DBFilesClient\\AreaTable.dbc"));
ItemDisplayInfo.openmem(mpq.ExtractFile("DBFilesClient\\ItemDisplayInfo.dbc"));
//... //...
printf("DBC files opened.\n"); printf("DBC files opened.\n");
//... //...
@ -235,6 +240,21 @@ bool ConvertDBC(void)
} }
} }
printf("itemdisplayinfo..");
for(DBCFile::Iterator it = ItemDisplayInfo.begin(); it != ItemDisplayInfo.end(); ++it)
{
uint32 id = it->getUInt(ITEMDISPLAYINFO_ID);
for(uint32 field=ITEMDISPLAYINFO_ID; field < ITEMDISPLAYINFO_END; field++)
{
if(strlen(ItemDisplayInfoFieldNames[field]))
{
std::string value = AutoGetDataString(it,ItemDisplayInfoFormat,field);
if(value.size()) // only store if not null
ItemDisplayInfoStorage[id].push_back(std::string(ItemDisplayInfoFieldNames[field]) + "=" + value);
}
}
}
//... //...
@ -249,6 +269,7 @@ bool ConvertDBC(void)
printf("sound.."); OutSCP(SCPDIR "/sound.scp",SoundDataStorage); printf("sound.."); OutSCP(SCPDIR "/sound.scp",SoundDataStorage);
printf("map.."); OutSCP(SCPDIR "/map.scp",MapDataStorage); printf("map.."); OutSCP(SCPDIR "/map.scp",MapDataStorage);
printf("area.."); OutSCP(SCPDIR "/area.scp",AreaDataStorage); printf("area.."); OutSCP(SCPDIR "/area.scp",AreaDataStorage);
printf("itemdisplayinfo."); OutSCP(SCPDIR "/itemdisplayinfo.scp",ItemDisplayInfoStorage);
//... //...
printf("DONE!\n"); printf("DONE!\n");