Some generic material is decoded, although not well

develop
simon 2010-04-30 17:42:31 +02:00
parent 72abababa8
commit 9f939687ec
4 changed files with 40 additions and 2 deletions

@ -46,6 +46,11 @@ namespace DFHack
char adjective[128]; char adjective[128];
}; };
struct t_matglossOther
{
char rawname[128];
};
struct t_creatureextract struct t_creatureextract
{ {
char rawname[128]; char rawname[128];
@ -89,6 +94,7 @@ namespace DFHack
std::vector<t_matgloss> race; std::vector<t_matgloss> race;
std::vector<t_creaturetype> raceEx; std::vector<t_creaturetype> raceEx;
std::vector<t_descriptor_color> color; std::vector<t_descriptor_color> color;
std::vector<t_matglossOther> other;
bool ReadInorganicMaterials (void); bool ReadInorganicMaterials (void);
bool ReadOrganicMaterials (void); bool ReadOrganicMaterials (void);
@ -97,6 +103,7 @@ namespace DFHack
bool ReadCreatureTypes (void); bool ReadCreatureTypes (void);
bool ReadCreatureTypesEx (void); bool ReadCreatureTypesEx (void);
bool ReadDescriptorColors(void); bool ReadDescriptorColors(void);
bool ReadOthers (void);
void ReadAllMaterials(void); void ReadAllMaterials(void);

@ -240,6 +240,28 @@ bool Materials::ReadCreatureTypes (void)
return true; return true;
} }
bool Materials::ReadOthers(void)
{
Process * p = d->owner;
uint32_t matBase = p->getDescriptor()->getAddress ("mat_other");
uint32_t i = 0;
uint32_t ptr;
other.clear();
while(1)
{
t_matglossOther mat;
ptr = p->readDWord(matBase + i*4);
if(ptr==0)
break;
p->readSTLString(ptr, mat.rawname, sizeof(mat.rawname));
other.push_back(mat);
i++;
}
return true;
}
bool Materials::ReadDescriptorColors (void) bool Materials::ReadDescriptorColors (void)
{ {
Process * p = d->owner; Process * p = d->owner;
@ -319,6 +341,7 @@ void Materials::ReadAllMaterials(void)
this->ReadCreatureTypes(); this->ReadCreatureTypes();
this->ReadCreatureTypesEx(); this->ReadCreatureTypesEx();
this->ReadDescriptorColors(); this->ReadDescriptorColors();
this->ReadOthers();
} }
std::string Materials::getDescription(t_material & mat) std::string Materials::getDescription(t_material & mat)

@ -32,7 +32,12 @@ std::string getMatDesc(int32_t typeB, int32_t typeC, int32_t typeD)
if(typeC>0x292) if(typeC>0x292)
return "?"; return "?";
else else
return "stuff"; {
if(typeC>=Materials->other.size())
return "stuff";
else
return Materials->other[typeC].rawname;
}
else else
return Materials->inorganic[typeD].id; return Materials->inorganic[typeD].id;
} }

@ -1443,7 +1443,10 @@ map_data_1b60_offset 0x1B9c
========= =========
soil, stone, metal soil, stone, metal
inorganics vector = WORLD + 0x54B7C = 0x16B0D4C inorganics vector = WORLD + 0x54B7C = 0x16B0D4C
<Address name="mat_inorganics">0x16B0D4C</Address> <Address name="mat_inorganics">0x16B0D4C</Address>
stuff like glass, coke, ...
<Address name="mat_other">0x16BA114</Address>
wood and plant matter, WORLD + 0x54B94 wood and plant matter, WORLD + 0x54B94
<Address name="mat_organics_all">0x16B0D64</Address> <Address name="mat_organics_all">0x16B0D64</Address>