From 6d92af5c58df6c307bbbdbca4f00535f1a1b48b8 Mon Sep 17 00:00:00 2001 From: "False.Genesis" Date: Sun, 9 Sep 2007 19:44:19 +0000 Subject: [PATCH] * stuffextract is up to date, no need for changes. * implemented extraction of ItemDisplayInfo.dbc to stuffextract. output scp file not used by PseuWoW yet. --- src/tools/stuffextract/DBCFieldData.h | 42 +++++++++++++++++++++++++ src/tools/stuffextract/StuffExtract.cpp | 25 +++++++++++++-- 2 files changed, 65 insertions(+), 2 deletions(-) diff --git a/src/tools/stuffextract/DBCFieldData.h b/src/tools/stuffextract/DBCFieldData.h index 5ae344a..86162dd 100644 --- a/src/tools/stuffextract/DBCFieldData.h +++ b/src/tools/stuffextract/DBCFieldData.h @@ -258,4 +258,46 @@ static const char *AreaTableFormat = { "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 diff --git a/src/tools/stuffextract/StuffExtract.cpp b/src/tools/stuffextract/StuffExtract.cpp index b522521..b74581c 100644 --- a/src/tools/stuffextract/StuffExtract.cpp +++ b/src/tools/stuffextract/StuffExtract.cpp @@ -54,12 +54,16 @@ std::string AutoGetDataString(DBCFile::Iterator& it, const char* format, uint32 { if(format[field]=='i') { + if((*it).getInt(field) == 0) + return ""; // do not explicitly write int fields that are 0 std::stringstream s; s << (*it).getInt(field); return s.str(); } else if(format[field]=='f') { + if((*it).getFloat(field) == 0) + return ""; // do not explicitly write float fields that are 0 std::stringstream s; s << (*it).getFloat(field); return s.str(); @@ -100,8 +104,8 @@ void OutSCP(char *fn, SCPStorageMap& scp) bool ConvertDBC(void) { std::map racemap; // needed to extract other dbc files correctly - SCPStorageMap EmoteDataStorage,RaceDataStorage,SoundDataStorage,MapDataStorage,AreaDataStorage; // will store the converted data from dbc files - DBCFile EmotesText,EmotesTextData,EmotesTextSound,ChrRaces,SoundEntries,Map,AreaTable; + SCPStorageMap EmoteDataStorage,RaceDataStorage,SoundDataStorage,MapDataStorage,AreaDataStorage,ItemDisplayInfoStorage; // will store the converted data from dbc files + DBCFile EmotesText,EmotesTextData,EmotesTextSound,ChrRaces,SoundEntries,Map,AreaTable,ItemDisplayInfo; printf("Opening DBC archive...\n"); MPQHelper mpq("dbc"); @@ -113,6 +117,7 @@ bool ConvertDBC(void) SoundEntries.openmem(mpq.ExtractFile("DBFilesClient\\SoundEntries.dbc")); Map.openmem(mpq.ExtractFile("DBFilesClient\\Map.dbc")); AreaTable.openmem(mpq.ExtractFile("DBFilesClient\\AreaTable.dbc")); + ItemDisplayInfo.openmem(mpq.ExtractFile("DBFilesClient\\ItemDisplayInfo.dbc")); //... 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("map.."); OutSCP(SCPDIR "/map.scp",MapDataStorage); printf("area.."); OutSCP(SCPDIR "/area.scp",AreaDataStorage); + printf("itemdisplayinfo."); OutSCP(SCPDIR "/itemdisplayinfo.scp",ItemDisplayInfoStorage); //... printf("DONE!\n");