Creature tile description support

Reading of the tile character and colors in the race structure, plus
offsets in Memory.xml.
Upgrade of creaturedump
develop
simon 2010-04-19 11:23:11 +02:00
parent 6d06cfcee1
commit 9705e05d8c
4 changed files with 26 additions and 5 deletions

@ -41,6 +41,13 @@ namespace DFHack
{
char rawname[128];
vector <t_creaturecaste> castes;
uint8_t tile_character;
struct
{
uint16_t fore;
uint16_t back;
uint16_t bright;
} tilecolor;
};
class DFHACK_EXPORT Materials

@ -232,6 +232,8 @@ bool Materials::ReadCreatureTypesEx (vector<t_creaturetype> & creatures)
uint32_t sizeof_string = mem->getHexValue ("sizeof_string");
uint32_t size = p_races.size();
uint32_t sizecas = 0;
uint32_t tile_offset = mem->getOffset ("creature_tile");
uint32_t tile_color_offset = mem->getOffset ("creature_tile_color");
creatures.clear();
creatures.reserve (size);
for (uint32_t i = 0; i < size;i++)
@ -250,6 +252,10 @@ bool Materials::ReadCreatureTypesEx (vector<t_creaturetype> & creatures)
p->readSTLString (caste_start + 3 * sizeof_string, caste.adjective, sizeof(caste.adjective));
mat.castes.push_back(caste);
}
mat.tile_character = p->readByte( p_races[i] + tile_offset );
mat.tilecolor.fore = p->readWord( p_races[i] + tile_color_offset );
mat.tilecolor.back = p->readWord( p_races[i] + tile_color_offset + 2 );
mat.tilecolor.bright = p->readWord( p_races[i] + tile_color_offset + 4 );
creatures.push_back(mat);
}
return true;

@ -33,7 +33,7 @@ enum likeType
FOOD = 3
};
vector<DFHack::t_matgloss> creaturestypes;
vector<DFHack::t_creaturetype> creaturestypes;
matGlosses mat;
vector< vector <DFHack::t_itemType> > itemTypes;
DFHack::memory_info *mem;
@ -147,7 +147,13 @@ likeType printLike40d(DFHack::t_like like, const matGlosses & mat,const vector<
void printCreature(DFHack::API & DF, const DFHack::t_creature & creature)
{
cout << "address: " << hex << creature.origin << dec << " creature type: " << creaturestypes[creature.race].id << ", position: " << creature.x << "x " << creature.y << "y "<< creature.z << "z" << endl;
cout << "address: " << hex << creature.origin << dec << " creature type: " << creaturestypes[creature.race].rawname
<< "[" << creaturestypes[creature.race].tile_character
<< "," << creaturestypes[creature.race].tilecolor.fore
<< "," << creaturestypes[creature.race].tilecolor.back
<< "," << creaturestypes[creature.race].tilecolor.bright
<< "]"
<< ", position: " << creature.x << "x " << creature.y << "y "<< creature.z << "z" << endl;
bool addendl = false;
if(creature.name.first_name[0])
{
@ -394,7 +400,7 @@ int main (int numargs, char ** args)
mem = DF.getMemoryInfo();
// get stone matgloss mapping
if(!Materials->ReadCreatureTypes(creaturestypes))
if(!Materials->ReadCreatureTypesEx(creaturestypes))
{
cerr << "Can't get the creature types." << endl;
return 1;
@ -411,7 +417,7 @@ int main (int numargs, char ** args)
{
DFHack::t_creature temp;
Creatures->ReadCreature(i,temp);
if(check.empty() || string(creaturestypes[temp.race].id) == check)
if(check.empty() || string(creaturestypes[temp.race].rawname) == check)
{
cout << "index " << i << " ";

@ -1200,7 +1200,9 @@ map_data_1b60_offset 0x1B9c
WORLD + 0x54CD0
<Address name="creature_type_vector">0x016AFE58</Address>
<Offset name="creature_type_caste_vector">0x138</Offset>
<Offset name="creature_tile">0xE0</Offset>
<Offset name="creature_tile_color">0xF6</Offset>
<!--
NOT used yet