Color descriptors handling

develop
simon 2010-04-20 18:25:52 +02:00
parent 10ff8d73d1
commit 72376d1d35
2 changed files with 31 additions and 0 deletions

@ -17,6 +17,15 @@ namespace DFHack
char name[128]; //this is the name displayed ingame char name[128]; //this is the name displayed ingame
}; };
struct t_descriptor_color
{
char id[128]; // id in the raws
float r;
float v;
float b;
char name[128]; //displayed name
};
struct t_matglossPlant struct t_matglossPlant
{ {
char id[128]; //the id in the raws char id[128]; //the id in the raws
@ -67,6 +76,8 @@ namespace DFHack
// TODO: maybe move to creatures? // TODO: maybe move to creatures?
bool ReadCreatureTypes (std::vector<t_matgloss> & output); bool ReadCreatureTypes (std::vector<t_matgloss> & output);
bool ReadCreatureTypesEx (vector<t_creaturetype> & creatures); bool ReadCreatureTypesEx (vector<t_creaturetype> & creatures);
bool ReadDescriptorColors(std::vector<t_descriptor_color> & output);
private: private:
class Private; class Private;
Private* d; Private* d;

@ -223,6 +223,26 @@ bool Materials::ReadCreatureTypes (vector<t_matgloss> & creatures)
return true; return true;
} }
bool Materials::ReadDescriptorColors (vector<t_descriptor_color> & color)
{
Process * p = d->owner;
DfVector <uint32_t> p_colors (p, p->getDescriptor()->getAddress ("descriptor_colors_vector"));
uint32_t size = p_colors.size();
color.clear();
color.reserve(size);
for (uint32_t i = 0; i < size;i++)
{
t_descriptor_color col;
p->readSTLString (p_colors[i] + p->getDescriptor()->getOffset ("descriptor_rawname"), col.id, 128);
p->readSTLString (p_colors[i] + p->getDescriptor()->getOffset ("descriptor_name"), col.name, 128);
col.r = p->readFloat( p_colors[i] + p->getDescriptor()->getOffset ("descriptor_color_r") );
col.v = p->readFloat( p_colors[i] + p->getDescriptor()->getOffset ("descriptor_color_v") );
col.b = p->readFloat( p_colors[i] + p->getDescriptor()->getOffset ("descriptor_color_b") );
color.push_back(col);
}
}
bool Materials::ReadCreatureTypesEx (vector<t_creaturetype> & creatures) bool Materials::ReadCreatureTypesEx (vector<t_creaturetype> & creatures)
{ {
Process *p = d->owner; Process *p = d->owner;