Body parts are decoded

Color modifiers parts are decoded
develop
simon 2010-05-05 13:48:01 +02:00
parent 0c0eaa66d8
commit d435313632
4 changed files with 65 additions and 10 deletions

@ -37,6 +37,20 @@ namespace DFHack
char food_name[128];
char extract_name[128];
};
struct t_bodypart
{
char id[128];
char category[128];
char single[128];
char plural[128];
};
struct t_colormodifier
{
char part[128];
std::vector<uint32_t> colorlist;
};
struct t_creaturecaste
{
@ -44,7 +58,8 @@ namespace DFHack
char singular[128];
char plural[128];
char adjective[128];
std::vector<std::vector<uint32_t> > ColorModifier;
std::vector<t_colormodifier> ColorModifier;
std::vector<t_bodypart> bodypart;
};
struct t_matglossOther

@ -295,10 +295,18 @@ bool Materials::ReadCreatureTypesEx (void)
uint32_t extract_vector_offset = mem->getOffset ("creature_type_extract_vector");
uint32_t sizeof_string = mem->getHexValue ("sizeof_string");
uint32_t caste_colormod_offset = mem->getOffset ("caste_color_modifiers");
uint32_t caste_bodypart_offset = mem->getOffset ("caste_bodypart_vector");
uint32_t bodypart_id_offset = mem->getOffset ("bodypart_id");
uint32_t bodypart_category_offset = mem->getOffset ("bodypart_category");
uint32_t bodypart_layers_offset = mem->getOffset ("bodypart_layers_vector");
uint32_t bodypart_singular_offset = mem->getOffset ("bodypart_singular_vector");
uint32_t bodypart_plural_offset = mem->getOffset ("bodypart_plural_vector");
uint32_t color_modifier_part_offset = mem->getOffset ("color_modifier_part");
uint32_t size = p_races.size();
uint32_t sizecas = 0;
uint32_t sizecolormod;
uint32_t sizecolorlist;
uint32_t sizebp;
uint32_t tile_offset = mem->getOffset ("creature_tile");
uint32_t tile_color_offset = mem->getOffset ("creature_tile_color");
raceEx.clear();
@ -311,24 +319,40 @@ bool Materials::ReadCreatureTypesEx (void)
sizecas = p_castes.size();
for (uint32_t j = 0; j < sizecas;j++)
{
/* caste name */
t_creaturecaste caste;
uint32_t caste_start = p_castes[j];
p->readSTLString (caste_start, caste.rawname, sizeof(caste.rawname));
p->readSTLString (caste_start + sizeof_string, caste.singular, sizeof(caste.singular));
p->readSTLString (caste_start + 2 * sizeof_string, caste.plural, sizeof(caste.plural));
p->readSTLString (caste_start + 3 * sizeof_string, caste.adjective, sizeof(caste.adjective));
/* color mod reading */
DfVector <uint32_t> p_colormod(p, caste_start + caste_colormod_offset);
sizecolormod = p_colormod.size();
caste.ColorModifier.resize(sizecolormod);
for(uint32_t k = 0; k < sizecolormod;k++)
{
DfVector <uint32_t> p_colorlist(p, p_colormod[k]);
sizecolorlist = p_colorlist.size();
caste.ColorModifier[k].resize(sizecolorlist);
caste.ColorModifier[k].colorlist.resize(sizecolorlist);
for(uint32_t l = 0; l < sizecolorlist; l++)
caste.ColorModifier[k][l] = p_colorlist[l];
caste.ColorModifier[k].colorlist[l] = p_colorlist[l];
p->readSTLString( p_colormod[k] + color_modifier_part_offset, caste.ColorModifier[k].part, sizeof(caste.ColorModifier[k].part));
}
/* body parts */
DfVector <uint32_t> p_bodypart(p, caste_start + caste_bodypart_offset);
caste.bodypart.empty();
sizebp = p_bodypart.size();
for(uint32_t k = 0; k < sizebp; k++)
{
t_bodypart part;
p->readSTLString (p_bodypart[k] + bodypart_id_offset, part.id, sizeof(part.id));
p->readSTLString (p_bodypart[k] + bodypart_category_offset, part.category, sizeof(part.category));
caste.bodypart.push_back(part);
}
mat.castes.push_back(caste);
}
mat.tile_character = p->readByte( p_races[i] + tile_offset );

@ -100,16 +100,22 @@ int main (int numargs, const char ** args)
cout << endl;
for(uint32_t k = 0; k < castes[j].ColorModifier.size(); k++)
{
cout << " colormod[" << k << "] ";
for(uint32_t l = 0; l < castes[j].ColorModifier[k].size(); l++)
cout << " colormod[" << castes[j].ColorModifier[k].part << "] ";
for(uint32_t l = 0; l < castes[j].ColorModifier[k].colorlist.size(); l++)
{
if( castes[j].ColorModifier[k][l] < Materials->color.size() )
cout << Materials->color[castes[j].ColorModifier[k][l]].name << " ";
if( castes[j].ColorModifier[k].colorlist[l] < Materials->color.size() )
cout << Materials->color[castes[j].ColorModifier[k].colorlist[l]].name << " ";
else
cout << Materials->alldesc[castes[j].ColorModifier[k][l]].id << " ";
cout << Materials->alldesc[castes[j].ColorModifier[k].colorlist[l]].id << " ";
}
cout << endl;
}
cout << " body: ";
for(uint32_t k = 0; k < castes[j].bodypart.size(); k++)
{
cout << castes[j].bodypart[k].category << " ";
}
cout << endl;
}
cout << endl;
}

@ -1435,7 +1435,7 @@ map_data_1b60_offset 0x1B9c
-->
<Offset name="creature_current_job">0x390</Offset> <!-- from chmod -->
<Offset name="creature_mood_skill">0x394</Offset> the skill that will be increased at the end of the mood (or not)
<Offset name="creature_appearance_vector">0x604</Offset> seems to be indexes in the list of possible colors defined in the raws for each group
<Offset name="creature_appearance_vector">0x604</Offset>
<Offset name="creature_artifact_name">0x6D4</Offset>
<Offset name="creature_labors">0x774</Offset>
<Offset name="creature_soul_vector">0x0740</Offset>
@ -1444,7 +1444,17 @@ map_data_1b60_offset 0x1B9c
Castes
======
<Offset name="caste_bodypart_vector">0x51C</Offset>
<Offset name="caste_color_modifiers">0xACC</Offset>
<Offset name="color_modifier_part">0x70</Offset>
Body Parts
==========
<Offset name="bodypart_id">0x0</Offset>
<Offset name="bodypart_category">0x1C</Offset>
<Offset name="bodypart_layers_vector">0x44</Offset>
<Offset name="bodypart_singular_vector">0x78</Offset>
<Offset name="bodypart_plural_vector">0x90</Offset>
Materials
=========