|
|
|
@ -44,10 +44,9 @@ using namespace std;
|
|
|
|
|
#include "df/world.h"
|
|
|
|
|
#include "df/ui.h"
|
|
|
|
|
#include "df/item.h"
|
|
|
|
|
#include "df/inorganic_raw.h"
|
|
|
|
|
#include "df/plant_raw.h"
|
|
|
|
|
#include "df/plant_raw_flags.h"
|
|
|
|
|
#include "df/creature_raw.h"
|
|
|
|
|
#include "df/caste_raw.h"
|
|
|
|
|
#include "df/body_part_raw.h"
|
|
|
|
|
#include "df/historical_figure.h"
|
|
|
|
|
|
|
|
|
|
#include "df/job_item.h"
|
|
|
|
@ -55,9 +54,15 @@ using namespace std;
|
|
|
|
|
#include "df/dfhack_material_category.h"
|
|
|
|
|
#include "df/matter_state.h"
|
|
|
|
|
#include "df/material_vec_ref.h"
|
|
|
|
|
#include "df/builtin_mats.h"
|
|
|
|
|
|
|
|
|
|
#include "df/descriptor_color.h"
|
|
|
|
|
#include "df/descriptor_pattern.h"
|
|
|
|
|
#include "df/descriptor_shape.h"
|
|
|
|
|
|
|
|
|
|
using namespace DFHack;
|
|
|
|
|
using namespace df::enums;
|
|
|
|
|
using df::global::world;
|
|
|
|
|
|
|
|
|
|
bool MaterialInfo::decode(df::item *item)
|
|
|
|
|
{
|
|
|
|
@ -514,16 +519,8 @@ Materials::Materials()
|
|
|
|
|
Core & c = Core::getInstance();
|
|
|
|
|
d = new Private;
|
|
|
|
|
d->owner = c.p;
|
|
|
|
|
df_organic = 0;
|
|
|
|
|
df_trees = 0;
|
|
|
|
|
df_plants = 0;
|
|
|
|
|
df_inorganic = 0;
|
|
|
|
|
OffsetGroup *OG_Materials = d->OG_Materials = c.vinfo->getGroup("Materials");
|
|
|
|
|
{
|
|
|
|
|
OG_Materials->getSafeAddress("inorganics",(void * &)df_inorganic);
|
|
|
|
|
OG_Materials->getSafeAddress("organics_all",(void * &)df_organic);
|
|
|
|
|
OG_Materials->getSafeAddress("organics_plants",(void * &)df_plants);
|
|
|
|
|
OG_Materials->getSafeAddress("organics_trees",(void * &)df_trees);
|
|
|
|
|
d->vector_races = OG_Materials->getAddress("creature_type_vector");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -563,47 +560,29 @@ bool t_matglossInorganic::isGem()
|
|
|
|
|
return is_gem;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// good for now
|
|
|
|
|
inline bool ReadNamesOnly(Process* p, void * address, vector<t_matgloss> & names)
|
|
|
|
|
{
|
|
|
|
|
vector <string *> * p_names = (vector <string *> *) address;
|
|
|
|
|
uint32_t size = p_names->size();
|
|
|
|
|
names.clear();
|
|
|
|
|
names.reserve (size);
|
|
|
|
|
for (uint32_t i = 0; i < size;i++)
|
|
|
|
|
{
|
|
|
|
|
t_matgloss mat;
|
|
|
|
|
mat.id = *p_names->at(i);
|
|
|
|
|
names.push_back(mat);
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Materials::CopyInorganicMaterials (std::vector<t_matglossInorganic> & inorganic)
|
|
|
|
|
{
|
|
|
|
|
Process * p = d->owner;
|
|
|
|
|
if(!df_inorganic)
|
|
|
|
|
return false;
|
|
|
|
|
uint32_t size = df_inorganic->size();
|
|
|
|
|
uint32_t size = world->raws.inorganics.size();
|
|
|
|
|
inorganic.clear();
|
|
|
|
|
inorganic.reserve (size);
|
|
|
|
|
for (uint32_t i = 0; i < size;i++)
|
|
|
|
|
{
|
|
|
|
|
df_inorganic_type * orig = df_inorganic->at(i);
|
|
|
|
|
df::inorganic_raw *orig = world->raws.inorganics[i];
|
|
|
|
|
t_matglossInorganic mat;
|
|
|
|
|
mat.id = orig->ID;
|
|
|
|
|
mat.name = orig->mat.STONE_NAME;
|
|
|
|
|
|
|
|
|
|
mat.ore_types = orig->METAL_ORE_matID;
|
|
|
|
|
mat.ore_chances = orig->METAL_ORE_prob;
|
|
|
|
|
mat.strand_types = orig->THREAD_METAL_matID;
|
|
|
|
|
mat.strand_chances = orig->THREAD_METAL_prob;
|
|
|
|
|
mat.value = orig->mat.MATERIAL_VALUE;
|
|
|
|
|
mat.wall_tile = orig->mat.TILE;
|
|
|
|
|
mat.boulder_tile = orig->mat.ITEM_SYMBOL;
|
|
|
|
|
mat.bright = orig->mat.BASIC_COLOR_bright;
|
|
|
|
|
mat.fore = orig->mat.BASIC_COLOR_foreground;
|
|
|
|
|
mat.is_gem = orig->mat.mat_flags.is_set(MATERIAL_IS_GEM);
|
|
|
|
|
mat.id = orig->id;
|
|
|
|
|
mat.name = orig->material.stone_name;
|
|
|
|
|
|
|
|
|
|
mat.ore_types = orig->metal_ore.mat_index;
|
|
|
|
|
mat.ore_chances = orig->metal_ore.probability;
|
|
|
|
|
mat.strand_types = orig->thread_metal.mat_index;
|
|
|
|
|
mat.strand_chances = orig->thread_metal.probability;
|
|
|
|
|
mat.value = orig->material.material_value;
|
|
|
|
|
mat.wall_tile = orig->material.tile;
|
|
|
|
|
mat.boulder_tile = orig->material.item_symbol;
|
|
|
|
|
mat.fore = orig->material.basic_color[0];
|
|
|
|
|
mat.bright = orig->material.basic_color[1];
|
|
|
|
|
mat.is_gem = orig->material.flags.is_set(material_flags::IS_GEM);
|
|
|
|
|
inorganic.push_back(mat);
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
@ -611,58 +590,77 @@ bool Materials::CopyInorganicMaterials (std::vector<t_matglossInorganic> & inorg
|
|
|
|
|
|
|
|
|
|
bool Materials::CopyOrganicMaterials (std::vector<t_matgloss> & organic)
|
|
|
|
|
{
|
|
|
|
|
if(df_organic)
|
|
|
|
|
return ReadNamesOnly(d->owner, (void *) df_organic, organic );
|
|
|
|
|
else return false;
|
|
|
|
|
uint32_t size = world->raws.plants.all.size();
|
|
|
|
|
organic.clear();
|
|
|
|
|
organic.reserve (size);
|
|
|
|
|
for (uint32_t i = 0; i < size;i++)
|
|
|
|
|
{
|
|
|
|
|
t_matgloss mat;
|
|
|
|
|
mat.id = world->raws.plants.all[i]->id;
|
|
|
|
|
organic.push_back(mat);
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Materials::CopyWoodMaterials (std::vector<t_matgloss> & tree)
|
|
|
|
|
{
|
|
|
|
|
if(df_trees)
|
|
|
|
|
return ReadNamesOnly(d->owner, (void *) df_trees, tree );
|
|
|
|
|
else return false;
|
|
|
|
|
uint32_t size = world->raws.plants.trees.size();
|
|
|
|
|
tree.clear();
|
|
|
|
|
tree.reserve (size);
|
|
|
|
|
for (uint32_t i = 0; i < size;i++)
|
|
|
|
|
{
|
|
|
|
|
t_matgloss mat;
|
|
|
|
|
mat.id = world->raws.plants.trees[i]->id;
|
|
|
|
|
tree.push_back(mat);
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Materials::CopyPlantMaterials (std::vector<t_matgloss> & plant)
|
|
|
|
|
{
|
|
|
|
|
if(df_plants)
|
|
|
|
|
return ReadNamesOnly(d->owner, (void *) df_plants, plant );
|
|
|
|
|
else return false;
|
|
|
|
|
uint32_t size = world->raws.plants.bushes.size();
|
|
|
|
|
plant.clear();
|
|
|
|
|
plant.reserve (size);
|
|
|
|
|
for (uint32_t i = 0; i < size;i++)
|
|
|
|
|
{
|
|
|
|
|
t_matgloss mat;
|
|
|
|
|
mat.id = world->raws.plants.bushes[i]->id;
|
|
|
|
|
plant.push_back(mat);
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Materials::ReadCreatureTypes (void)
|
|
|
|
|
{
|
|
|
|
|
return ReadNamesOnly(d->owner, d->vector_races, race );
|
|
|
|
|
uint32_t size = world->raws.creatures.all.size();
|
|
|
|
|
race.clear();
|
|
|
|
|
race.reserve (size);
|
|
|
|
|
for (uint32_t i = 0; i < size;i++)
|
|
|
|
|
{
|
|
|
|
|
t_matgloss mat;
|
|
|
|
|
mat.id = world->raws.creatures.all[i]->creature_id;
|
|
|
|
|
race.push_back(mat);
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Materials::ReadOthers(void)
|
|
|
|
|
{
|
|
|
|
|
Process * p = d->owner;
|
|
|
|
|
char * matBase = d->OG_Materials->getAddress ("other");
|
|
|
|
|
uint32_t i = 0;
|
|
|
|
|
std::string * ptr;
|
|
|
|
|
|
|
|
|
|
uint32_t size = df::enums::builtin_mats::_last_item_of_builtin_mats + 1;
|
|
|
|
|
other.clear();
|
|
|
|
|
|
|
|
|
|
while(1)
|
|
|
|
|
other.reserve(size);
|
|
|
|
|
for (uint32_t i = 0; i < size;i++)
|
|
|
|
|
{
|
|
|
|
|
t_matglossOther mat;
|
|
|
|
|
ptr = (std::string *) p->readPtr(matBase + i*4);
|
|
|
|
|
if(ptr==0)
|
|
|
|
|
break;
|
|
|
|
|
mat.id = *ptr;
|
|
|
|
|
mat.id = world->raws.mat_table.builtin[i]->id;
|
|
|
|
|
other.push_back(mat);
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Materials::ReadDescriptorColors (void)
|
|
|
|
|
{
|
|
|
|
|
Process * p = d->owner;
|
|
|
|
|
OffsetGroup * OG_Descriptors = p->getDescriptor()->getGroup("Materials")->getGroup("descriptors");
|
|
|
|
|
vector <char *> & p_colors = *(vector<char*> *) OG_Descriptors->getAddress ("colors_vector");
|
|
|
|
|
uint32_t size = p_colors.size();
|
|
|
|
|
uint32_t size = world->raws.language.colors.size();
|
|
|
|
|
|
|
|
|
|
color.clear();
|
|
|
|
|
if(size == 0)
|
|
|
|
@ -670,132 +668,134 @@ bool Materials::ReadDescriptorColors (void)
|
|
|
|
|
color.reserve(size);
|
|
|
|
|
for (uint32_t i = 0; i < size;i++)
|
|
|
|
|
{
|
|
|
|
|
df::descriptor_color *c = world->raws.language.colors[i];
|
|
|
|
|
t_descriptor_color col;
|
|
|
|
|
col.id = p->readSTLString (p_colors[i] + OG_Descriptors->getOffset ("rawname") );
|
|
|
|
|
col.name = p->readSTLString (p_colors[i] + OG_Descriptors->getOffset ("name") );
|
|
|
|
|
col.red = p->readFloat( p_colors[i] + OG_Descriptors->getOffset ("color_r") );
|
|
|
|
|
col.green = p->readFloat( p_colors[i] + OG_Descriptors->getOffset ("color_v") );
|
|
|
|
|
col.blue = p->readFloat( p_colors[i] + OG_Descriptors->getOffset ("color_b") );
|
|
|
|
|
col.id = c->id;
|
|
|
|
|
col.name = c->name;
|
|
|
|
|
col.red = c->red;
|
|
|
|
|
col.green = c->green;
|
|
|
|
|
col.blue = c->blue;
|
|
|
|
|
color.push_back(col);
|
|
|
|
|
}
|
|
|
|
|
return ReadNamesOnly(d->owner, OG_Descriptors->getAddress ("all_colors_vector"), alldesc );
|
|
|
|
|
|
|
|
|
|
size = world->raws.language.patterns.size();
|
|
|
|
|
alldesc.clear();
|
|
|
|
|
alldesc.reserve(size);
|
|
|
|
|
for (uint32_t i = 0; i < size;i++)
|
|
|
|
|
{
|
|
|
|
|
t_matgloss mat;
|
|
|
|
|
mat.id = world->raws.language.patterns[i]->id;
|
|
|
|
|
alldesc.push_back(mat);
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool Materials::ReadCreatureTypesEx (void)
|
|
|
|
|
{
|
|
|
|
|
Process *p = d->owner;
|
|
|
|
|
VersionInfo *mem = p->getDescriptor();
|
|
|
|
|
OffsetGroup * OG_string = mem->getGroup("string");
|
|
|
|
|
uint32_t sizeof_string = OG_string->getHexValue ("sizeof");
|
|
|
|
|
|
|
|
|
|
OffsetGroup * OG_Mats = mem->getGroup("Materials");
|
|
|
|
|
vector <char *> & p_races = *(vector<char*> *) OG_Mats->getAddress ("creature_type_vector");
|
|
|
|
|
|
|
|
|
|
OffsetGroup * OG_Creature = OG_Mats->getGroup("creature");
|
|
|
|
|
uint32_t castes_vector_offset = OG_Creature->getOffset ("caste_vector");
|
|
|
|
|
uint32_t extract_vector_offset = OG_Creature->getOffset ("extract_vector");
|
|
|
|
|
uint32_t tile_offset = OG_Creature->getOffset ("tile");
|
|
|
|
|
uint32_t tile_color_offset = OG_Creature->getOffset ("tile_color");
|
|
|
|
|
|
|
|
|
|
bool have_advanced = false;
|
|
|
|
|
uint32_t caste_colormod_offset;
|
|
|
|
|
uint32_t caste_attributes_offset;
|
|
|
|
|
uint32_t caste_bodypart_offset;
|
|
|
|
|
uint32_t bodypart_id_offset;
|
|
|
|
|
uint32_t bodypart_category_offset;
|
|
|
|
|
uint32_t color_modifier_part_offset;
|
|
|
|
|
uint32_t color_modifier_startdate_offset;
|
|
|
|
|
uint32_t color_modifier_enddate_offset;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
OffsetGroup * OG_Caste = OG_Creature->getGroup("caste");
|
|
|
|
|
caste_colormod_offset = OG_Caste->getOffset ("color_modifiers");
|
|
|
|
|
caste_attributes_offset = OG_Caste->getOffset ("attributes");
|
|
|
|
|
caste_bodypart_offset = OG_Caste->getOffset ("bodypart_vector");
|
|
|
|
|
OffsetGroup * OG_CasteBodyparts = OG_Creature->getGroup("caste_bodyparts");
|
|
|
|
|
bodypart_id_offset = OG_CasteBodyparts->getOffset ("id");
|
|
|
|
|
bodypart_category_offset = OG_CasteBodyparts->getOffset ("category");
|
|
|
|
|
OffsetGroup * OG_CasteColorMods = OG_Creature->getGroup("caste_color_mods");
|
|
|
|
|
color_modifier_part_offset = OG_CasteColorMods->getOffset ("part");
|
|
|
|
|
color_modifier_startdate_offset = OG_CasteColorMods->getOffset ("startdate");
|
|
|
|
|
color_modifier_enddate_offset = OG_CasteColorMods->getOffset ("enddate");
|
|
|
|
|
have_advanced = true;
|
|
|
|
|
}
|
|
|
|
|
catch (Error::All &){};
|
|
|
|
|
|
|
|
|
|
uint32_t size = p_races.size();
|
|
|
|
|
uint32_t sizecas = 0;
|
|
|
|
|
uint32_t sizecolormod;
|
|
|
|
|
uint32_t sizecolorlist;
|
|
|
|
|
uint32_t sizebp;
|
|
|
|
|
uint32_t size = world->raws.creatures.all.size();
|
|
|
|
|
raceEx.clear();
|
|
|
|
|
raceEx.reserve (size);
|
|
|
|
|
for (uint32_t i = 0; i < size;i++)
|
|
|
|
|
for (uint32_t i = 0; i < size; i++)
|
|
|
|
|
{
|
|
|
|
|
df::creature_raw *cr = world->raws.creatures.all[i];
|
|
|
|
|
t_creaturetype mat;
|
|
|
|
|
mat.id = p->readSTLString (p_races[i]);
|
|
|
|
|
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 );
|
|
|
|
|
|
|
|
|
|
vector <char *> & p_castes = *(vector<char*> *) (p_races[i] + castes_vector_offset);
|
|
|
|
|
sizecas = p_castes.size();
|
|
|
|
|
mat.id = cr->creature_id;
|
|
|
|
|
mat.tile_character = cr->creature_tile;
|
|
|
|
|
mat.tilecolor.fore = cr->color[0];
|
|
|
|
|
mat.tilecolor.back = cr->color[1];
|
|
|
|
|
mat.tilecolor.bright = cr->color[2];
|
|
|
|
|
|
|
|
|
|
uint32_t sizecas = cr->caste.size();
|
|
|
|
|
for (uint32_t j = 0; j < sizecas;j++)
|
|
|
|
|
{
|
|
|
|
|
df::caste_raw *ca = cr->caste[j];
|
|
|
|
|
/* caste name */
|
|
|
|
|
t_creaturecaste caste;
|
|
|
|
|
char * caste_start = p_castes[j];
|
|
|
|
|
caste.id = p->readSTLString (caste_start);
|
|
|
|
|
caste.singular = p->readSTLString (caste_start + sizeof_string);
|
|
|
|
|
caste.plural = p->readSTLString (caste_start + 2 * sizeof_string);
|
|
|
|
|
caste.adjective = p->readSTLString (caste_start + 3 * sizeof_string);
|
|
|
|
|
//cout << "Caste " << caste.rawname << " " << caste.singular << ": 0x" << hex << caste_start << endl;
|
|
|
|
|
if(have_advanced)
|
|
|
|
|
caste.id = ca->caste_id;
|
|
|
|
|
caste.singular = ca->caste_name[0];
|
|
|
|
|
caste.plural = ca->caste_name[1];
|
|
|
|
|
caste.adjective = ca->caste_name[2];
|
|
|
|
|
/*
|
|
|
|
|
// color mod reading
|
|
|
|
|
// Caste + offset > color mod vector
|
|
|
|
|
vector <char *> & p_colormod = *(vector<char*> *) (world->raws.creatures.all[i]->caste + caste_colormod_offset);
|
|
|
|
|
uint32_t sizecolormod = p_colormod.size();
|
|
|
|
|
caste.ColorModifier.resize(sizecolormod);
|
|
|
|
|
for(uint32_t k = 0; k < sizecolormod;k++)
|
|
|
|
|
{
|
|
|
|
|
/* color mod reading */
|
|
|
|
|
// Caste + offset > color mod vector
|
|
|
|
|
vector <char *> & p_colormod = *(vector<char*> *) (caste_start + caste_colormod_offset);
|
|
|
|
|
sizecolormod = p_colormod.size();
|
|
|
|
|
caste.ColorModifier.resize(sizecolormod);
|
|
|
|
|
for(uint32_t k = 0; k < sizecolormod;k++)
|
|
|
|
|
{
|
|
|
|
|
// color mod [0] -> color list
|
|
|
|
|
vector <uint32_t> & p_colorlist = *(vector<uint32_t> *) (p_colormod[k]);
|
|
|
|
|
sizecolorlist = p_colorlist.size();
|
|
|
|
|
caste.ColorModifier[k].colorlist.resize(sizecolorlist);
|
|
|
|
|
for(uint32_t l = 0; l < sizecolorlist; l++)
|
|
|
|
|
caste.ColorModifier[k].colorlist[l] = p_colorlist[l];
|
|
|
|
|
// color mod [color_modifier_part_offset] = string part
|
|
|
|
|
caste.ColorModifier[k].part = p->readSTLString( p_colormod[k] + color_modifier_part_offset);
|
|
|
|
|
caste.ColorModifier[k].startdate = p->readDWord( p_colormod[k] + color_modifier_startdate_offset );
|
|
|
|
|
caste.ColorModifier[k].enddate = p->readDWord( p_colormod[k] + color_modifier_enddate_offset );
|
|
|
|
|
}
|
|
|
|
|
/* body parts */
|
|
|
|
|
vector <char *> & p_bodypart = *(vector<char*> *) (caste_start + caste_bodypart_offset);
|
|
|
|
|
caste.bodypart.empty();
|
|
|
|
|
sizebp = p_bodypart.size();
|
|
|
|
|
for(uint32_t k = 0; k < sizebp; k++)
|
|
|
|
|
{
|
|
|
|
|
t_bodypart part;
|
|
|
|
|
part.id = p->readSTLString (p_bodypart[k] + bodypart_id_offset);
|
|
|
|
|
part.category = p->readSTLString (p_bodypart[k] + bodypart_category_offset);
|
|
|
|
|
caste.bodypart.push_back(part);
|
|
|
|
|
}
|
|
|
|
|
p->read(caste_start + caste_attributes_offset, sizeof(t_attrib) * NUM_CREAT_ATTRIBS, (uint8_t *)&caste.strength);
|
|
|
|
|
// color mod [0] -> color list
|
|
|
|
|
vector <uint32_t> & p_colorlist = *(vector<uint32_t> *) (p_colormod[k]);
|
|
|
|
|
uint32_t sizecolorlist = p_colorlist.size();
|
|
|
|
|
caste.ColorModifier[k].colorlist.resize(sizecolorlist);
|
|
|
|
|
for(uint32_t l = 0; l < sizecolorlist; l++)
|
|
|
|
|
caste.ColorModifier[k].colorlist[l] = p_colorlist[l];
|
|
|
|
|
// color mod [color_modifier_part_offset] = string part
|
|
|
|
|
caste.ColorModifier[k].part = p->readSTLString( p_colormod[k] + color_modifier_part_offset);
|
|
|
|
|
caste.ColorModifier[k].startdate = p->readDWord( p_colormod[k] + color_modifier_startdate_offset );
|
|
|
|
|
caste.ColorModifier[k].enddate = p->readDWord( p_colormod[k] + color_modifier_enddate_offset );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
*/
|
|
|
|
|
// body parts
|
|
|
|
|
caste.bodypart.empty();
|
|
|
|
|
uint32_t sizebp = ca->body_parts.size();
|
|
|
|
|
for (uint32_t k = 0; k < sizebp; k++)
|
|
|
|
|
{
|
|
|
|
|
df::body_part_raw *bp = ca->body_parts[k];
|
|
|
|
|
t_bodypart part;
|
|
|
|
|
part.id = bp->part_code;
|
|
|
|
|
part.category = bp->part_name;
|
|
|
|
|
caste.bodypart.push_back(part);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
t_attrib *phys[] = {
|
|
|
|
|
&caste.strength,
|
|
|
|
|
&caste.agility,
|
|
|
|
|
&caste.toughness,
|
|
|
|
|
&caste.endurance,
|
|
|
|
|
&caste.recuperation,
|
|
|
|
|
&caste.disease_resistance
|
|
|
|
|
};
|
|
|
|
|
for (uint32_t k = 0; k < 6; k++)
|
|
|
|
|
{
|
|
|
|
|
memset(&caste.strength, 0, sizeof(t_attrib) * NUM_CREAT_ATTRIBS);
|
|
|
|
|
phys[k]->level = ca->attributes.phys_att_range[k][0];
|
|
|
|
|
phys[k]->field_4 = ca->attributes.phys_att_range[k][1];
|
|
|
|
|
phys[k]->field_8 = ca->attributes.phys_att_range[k][2];
|
|
|
|
|
phys[k]->field_C = ca->attributes.phys_att_range[k][3];
|
|
|
|
|
phys[k]->leveldiff = ca->attributes.phys_att_range[k][4];
|
|
|
|
|
phys[k]->field_14 = ca->attributes.phys_att_range[k][5];
|
|
|
|
|
phys[k]->field_18 = ca->attributes.phys_att_range[k][6];
|
|
|
|
|
}
|
|
|
|
|
t_attrib *ment[] = {
|
|
|
|
|
&caste.analytical_ability,
|
|
|
|
|
&caste.focus,
|
|
|
|
|
&caste.willpower,
|
|
|
|
|
&caste.creativity,
|
|
|
|
|
&caste.intuition,
|
|
|
|
|
&caste.patience,
|
|
|
|
|
&caste.memory,
|
|
|
|
|
&caste.linguistic_ability,
|
|
|
|
|
&caste.spatial_sense,
|
|
|
|
|
&caste.musicality,
|
|
|
|
|
&caste.kinesthetic_sense,
|
|
|
|
|
&caste.empathy,
|
|
|
|
|
&caste.social_awareness
|
|
|
|
|
};
|
|
|
|
|
for (uint32_t k = 0; k < 13; k++)
|
|
|
|
|
{
|
|
|
|
|
ment[k]->level = ca->attributes.ment_att_range[k][0];
|
|
|
|
|
ment[k]->field_4 = ca->attributes.ment_att_range[k][1];
|
|
|
|
|
ment[k]->field_8 = ca->attributes.ment_att_range[k][2];
|
|
|
|
|
ment[k]->field_C = ca->attributes.ment_att_range[k][3];
|
|
|
|
|
ment[k]->leveldiff = ca->attributes.ment_att_range[k][4];
|
|
|
|
|
ment[k]->field_14 = ca->attributes.ment_att_range[k][5];
|
|
|
|
|
ment[k]->field_18 = ca->attributes.ment_att_range[k][6];
|
|
|
|
|
}
|
|
|
|
|
mat.castes.push_back(caste);
|
|
|
|
|
}
|
|
|
|
|
vector <void *> & p_extract = *(vector<void*> *) (p_races[i] + extract_vector_offset);
|
|
|
|
|
for(uint32_t j = 0; j < p_extract.size(); j++)
|
|
|
|
|
for (uint32_t j = 0; j < world->raws.creatures.all[i]->material.size(); j++)
|
|
|
|
|
{
|
|
|
|
|
t_creatureextract extract;
|
|
|
|
|
extract.id = p->readSTLString( p_extract[j] );
|
|
|
|
|
extract.id = world->raws.creatures.all[i]->material[j]->id;
|
|
|
|
|
mat.extract.push_back(extract);
|
|
|
|
|
}
|
|
|
|
|
raceEx.push_back(mat);
|
|
|
|
@ -813,119 +813,33 @@ bool Materials::ReadAllMaterials(void)
|
|
|
|
|
return ok;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// miserable pile of magic. The material system is insane.
|
|
|
|
|
// FIXME: this contains potential errors when the indexes are -1 and compared to unsigned numbers!
|
|
|
|
|
std::string Materials::getDescription(const t_material & mat)
|
|
|
|
|
{
|
|
|
|
|
std::string out;
|
|
|
|
|
int32_t typeC;
|
|
|
|
|
if ( (mat.material<419) || (mat.material>618) )
|
|
|
|
|
{
|
|
|
|
|
if ( (mat.material<19) || (mat.material>218) )
|
|
|
|
|
{
|
|
|
|
|
if (mat.material)
|
|
|
|
|
if (mat.material>0x292)
|
|
|
|
|
return "?";
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (mat.material>=this->other.size())
|
|
|
|
|
{
|
|
|
|
|
if (mat.itemType == 0) {
|
|
|
|
|
if(mat.material<0)
|
|
|
|
|
return "any inorganic";
|
|
|
|
|
else
|
|
|
|
|
return this->df_inorganic->at(mat.material)->ID;
|
|
|
|
|
}
|
|
|
|
|
if(mat.material<0)
|
|
|
|
|
return "any";
|
|
|
|
|
if(mat.material>=this->raceEx.size())
|
|
|
|
|
return "stuff";
|
|
|
|
|
return this->raceEx[mat.material].id;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (mat.index==-1)
|
|
|
|
|
return std::string(this->other[mat.material].id);
|
|
|
|
|
else
|
|
|
|
|
return std::string(this->other[mat.material].id) + " derivate";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if(mat.index<0)
|
|
|
|
|
return "any inorganic";
|
|
|
|
|
else if (mat.index < df_inorganic->size())
|
|
|
|
|
return this->df_inorganic->at(mat.index)->ID;
|
|
|
|
|
else
|
|
|
|
|
return "INDEX OUT OF BOUNDS!";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (mat.index>=this->raceEx.size())
|
|
|
|
|
return "unknown race";
|
|
|
|
|
typeC = mat.material;
|
|
|
|
|
typeC -=19;
|
|
|
|
|
if ((typeC<0) || (typeC>=this->raceEx[mat.index].extract.size()))
|
|
|
|
|
{
|
|
|
|
|
return string(this->raceEx[mat.index].id).append(" extract");
|
|
|
|
|
}
|
|
|
|
|
return std::string(this->raceEx[mat.index].id).append(" ").append(this->raceEx[mat.index].extract[typeC].id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
MaterialInfo mi(mat.material, mat.index);
|
|
|
|
|
if (mi.creature)
|
|
|
|
|
return mi.creature->creature_id + " " + mi.material->id;
|
|
|
|
|
else if (mi.plant)
|
|
|
|
|
return mi.plant->id + " " + mi.material->id;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return this->df_organic->at(mat.material)->ID;
|
|
|
|
|
}
|
|
|
|
|
return out;
|
|
|
|
|
return mi.material->id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//type of material only so we know which vector to retrieve
|
|
|
|
|
// FIXME: this also contains potential errors when the indexes are -1 and compared to unsigned numbers!
|
|
|
|
|
// type of material only so we know which vector to retrieve
|
|
|
|
|
// This is completely worthless now
|
|
|
|
|
std::string Materials::getType(const t_material & mat)
|
|
|
|
|
{
|
|
|
|
|
if((mat.material<419) || (mat.material>618))
|
|
|
|
|
{
|
|
|
|
|
if((mat.material<19) || (mat.material>218))
|
|
|
|
|
{
|
|
|
|
|
if(mat.material)
|
|
|
|
|
{
|
|
|
|
|
if(mat.material>0x292)
|
|
|
|
|
{
|
|
|
|
|
return "unknown";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if(mat.material>=this->other.size())
|
|
|
|
|
{
|
|
|
|
|
if(mat.material<0)
|
|
|
|
|
return "any";
|
|
|
|
|
|
|
|
|
|
if(mat.material>=this->raceEx.size())
|
|
|
|
|
return "unknown";
|
|
|
|
|
|
|
|
|
|
return "racex";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (mat.index==-1)
|
|
|
|
|
return "other";
|
|
|
|
|
else
|
|
|
|
|
return "other derivate";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return "inorganic";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (mat.index>=this->raceEx.size())
|
|
|
|
|
return "unknown";
|
|
|
|
|
|
|
|
|
|
return "racex extract";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
MaterialInfo mi(mat.material, mat.index);
|
|
|
|
|
switch (mi.mode)
|
|
|
|
|
{
|
|
|
|
|
return "organic";
|
|
|
|
|
case MaterialInfo::Builtin:
|
|
|
|
|
return "builtin";
|
|
|
|
|
case MaterialInfo::Inorganic:
|
|
|
|
|
return "inorganic";
|
|
|
|
|
case MaterialInfo::Creature:
|
|
|
|
|
return "creature";
|
|
|
|
|
case MaterialInfo::Plant:
|
|
|
|
|
return "plant";
|
|
|
|
|
default:
|
|
|
|
|
return "unknown";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|