|
|
@ -44,10 +44,9 @@ using namespace std;
|
|
|
|
#include "df/world.h"
|
|
|
|
#include "df/world.h"
|
|
|
|
#include "df/ui.h"
|
|
|
|
#include "df/ui.h"
|
|
|
|
#include "df/item.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/creature_raw.h"
|
|
|
|
|
|
|
|
#include "df/caste_raw.h"
|
|
|
|
|
|
|
|
#include "df/body_part_raw.h"
|
|
|
|
#include "df/historical_figure.h"
|
|
|
|
#include "df/historical_figure.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "df/job_item.h"
|
|
|
|
#include "df/job_item.h"
|
|
|
@ -55,9 +54,15 @@ using namespace std;
|
|
|
|
#include "df/dfhack_material_category.h"
|
|
|
|
#include "df/dfhack_material_category.h"
|
|
|
|
#include "df/matter_state.h"
|
|
|
|
#include "df/matter_state.h"
|
|
|
|
#include "df/material_vec_ref.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 DFHack;
|
|
|
|
using namespace df::enums;
|
|
|
|
using namespace df::enums;
|
|
|
|
|
|
|
|
using df::global::world;
|
|
|
|
|
|
|
|
|
|
|
|
bool MaterialInfo::decode(df::item *item)
|
|
|
|
bool MaterialInfo::decode(df::item *item)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -514,16 +519,8 @@ Materials::Materials()
|
|
|
|
Core & c = Core::getInstance();
|
|
|
|
Core & c = Core::getInstance();
|
|
|
|
d = new Private;
|
|
|
|
d = new Private;
|
|
|
|
d->owner = c.p;
|
|
|
|
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");
|
|
|
|
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");
|
|
|
|
d->vector_races = OG_Materials->getAddress("creature_type_vector");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -563,47 +560,29 @@ bool t_matglossInorganic::isGem()
|
|
|
|
return is_gem;
|
|
|
|
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)
|
|
|
|
bool Materials::CopyInorganicMaterials (std::vector<t_matglossInorganic> & inorganic)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Process * p = d->owner;
|
|
|
|
Process * p = d->owner;
|
|
|
|
if(!df_inorganic)
|
|
|
|
uint32_t size = world->raws.inorganics.size();
|
|
|
|
return false;
|
|
|
|
|
|
|
|
uint32_t size = df_inorganic->size();
|
|
|
|
|
|
|
|
inorganic.clear();
|
|
|
|
inorganic.clear();
|
|
|
|
inorganic.reserve (size);
|
|
|
|
inorganic.reserve (size);
|
|
|
|
for (uint32_t i = 0; i < size;i++)
|
|
|
|
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;
|
|
|
|
t_matglossInorganic mat;
|
|
|
|
mat.id = orig->ID;
|
|
|
|
mat.id = orig->id;
|
|
|
|
mat.name = orig->mat.STONE_NAME;
|
|
|
|
mat.name = orig->material.stone_name;
|
|
|
|
|
|
|
|
|
|
|
|
mat.ore_types = orig->METAL_ORE_matID;
|
|
|
|
mat.ore_types = orig->metal_ore.mat_index;
|
|
|
|
mat.ore_chances = orig->METAL_ORE_prob;
|
|
|
|
mat.ore_chances = orig->metal_ore.probability;
|
|
|
|
mat.strand_types = orig->THREAD_METAL_matID;
|
|
|
|
mat.strand_types = orig->thread_metal.mat_index;
|
|
|
|
mat.strand_chances = orig->THREAD_METAL_prob;
|
|
|
|
mat.strand_chances = orig->thread_metal.probability;
|
|
|
|
mat.value = orig->mat.MATERIAL_VALUE;
|
|
|
|
mat.value = orig->material.material_value;
|
|
|
|
mat.wall_tile = orig->mat.TILE;
|
|
|
|
mat.wall_tile = orig->material.tile;
|
|
|
|
mat.boulder_tile = orig->mat.ITEM_SYMBOL;
|
|
|
|
mat.boulder_tile = orig->material.item_symbol;
|
|
|
|
mat.bright = orig->mat.BASIC_COLOR_bright;
|
|
|
|
mat.fore = orig->material.basic_color[0];
|
|
|
|
mat.fore = orig->mat.BASIC_COLOR_foreground;
|
|
|
|
mat.bright = orig->material.basic_color[1];
|
|
|
|
mat.is_gem = orig->mat.mat_flags.is_set(MATERIAL_IS_GEM);
|
|
|
|
mat.is_gem = orig->material.flags.is_set(material_flags::IS_GEM);
|
|
|
|
inorganic.push_back(mat);
|
|
|
|
inorganic.push_back(mat);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
@ -611,58 +590,77 @@ bool Materials::CopyInorganicMaterials (std::vector<t_matglossInorganic> & inorg
|
|
|
|
|
|
|
|
|
|
|
|
bool Materials::CopyOrganicMaterials (std::vector<t_matgloss> & organic)
|
|
|
|
bool Materials::CopyOrganicMaterials (std::vector<t_matgloss> & organic)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(df_organic)
|
|
|
|
uint32_t size = world->raws.plants.all.size();
|
|
|
|
return ReadNamesOnly(d->owner, (void *) df_organic, organic );
|
|
|
|
organic.clear();
|
|
|
|
else return false;
|
|
|
|
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)
|
|
|
|
bool Materials::CopyWoodMaterials (std::vector<t_matgloss> & tree)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(df_trees)
|
|
|
|
uint32_t size = world->raws.plants.trees.size();
|
|
|
|
return ReadNamesOnly(d->owner, (void *) df_trees, tree );
|
|
|
|
tree.clear();
|
|
|
|
else return false;
|
|
|
|
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)
|
|
|
|
bool Materials::CopyPlantMaterials (std::vector<t_matgloss> & plant)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(df_plants)
|
|
|
|
uint32_t size = world->raws.plants.bushes.size();
|
|
|
|
return ReadNamesOnly(d->owner, (void *) df_plants, plant );
|
|
|
|
plant.clear();
|
|
|
|
else return false;
|
|
|
|
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)
|
|
|
|
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)
|
|
|
|
bool Materials::ReadOthers(void)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Process * p = d->owner;
|
|
|
|
uint32_t size = df::enums::builtin_mats::_last_item_of_builtin_mats + 1;
|
|
|
|
char * matBase = d->OG_Materials->getAddress ("other");
|
|
|
|
|
|
|
|
uint32_t i = 0;
|
|
|
|
|
|
|
|
std::string * ptr;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
other.clear();
|
|
|
|
other.clear();
|
|
|
|
|
|
|
|
other.reserve(size);
|
|
|
|
while(1)
|
|
|
|
for (uint32_t i = 0; i < size;i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
t_matglossOther mat;
|
|
|
|
t_matglossOther mat;
|
|
|
|
ptr = (std::string *) p->readPtr(matBase + i*4);
|
|
|
|
mat.id = world->raws.mat_table.builtin[i]->id;
|
|
|
|
if(ptr==0)
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
mat.id = *ptr;
|
|
|
|
|
|
|
|
other.push_back(mat);
|
|
|
|
other.push_back(mat);
|
|
|
|
i++;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool Materials::ReadDescriptorColors (void)
|
|
|
|
bool Materials::ReadDescriptorColors (void)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Process * p = d->owner;
|
|
|
|
uint32_t size = world->raws.language.colors.size();
|
|
|
|
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();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
color.clear();
|
|
|
|
color.clear();
|
|
|
|
if(size == 0)
|
|
|
|
if(size == 0)
|
|
|
@ -670,100 +668,64 @@ bool Materials::ReadDescriptorColors (void)
|
|
|
|
color.reserve(size);
|
|
|
|
color.reserve(size);
|
|
|
|
for (uint32_t i = 0; i < size;i++)
|
|
|
|
for (uint32_t i = 0; i < size;i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
df::descriptor_color *c = world->raws.language.colors[i];
|
|
|
|
t_descriptor_color col;
|
|
|
|
t_descriptor_color col;
|
|
|
|
col.id = p->readSTLString (p_colors[i] + OG_Descriptors->getOffset ("rawname") );
|
|
|
|
col.id = c->id;
|
|
|
|
col.name = p->readSTLString (p_colors[i] + OG_Descriptors->getOffset ("name") );
|
|
|
|
col.name = c->name;
|
|
|
|
col.red = p->readFloat( p_colors[i] + OG_Descriptors->getOffset ("color_r") );
|
|
|
|
col.red = c->red;
|
|
|
|
col.green = p->readFloat( p_colors[i] + OG_Descriptors->getOffset ("color_v") );
|
|
|
|
col.green = c->green;
|
|
|
|
col.blue = p->readFloat( p_colors[i] + OG_Descriptors->getOffset ("color_b") );
|
|
|
|
col.blue = c->blue;
|
|
|
|
color.push_back(col);
|
|
|
|
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;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool Materials::ReadCreatureTypesEx (void)
|
|
|
|
bool Materials::ReadCreatureTypesEx (void)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Process *p = d->owner;
|
|
|
|
uint32_t size = world->raws.creatures.all.size();
|
|
|
|
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;
|
|
|
|
|
|
|
|
raceEx.clear();
|
|
|
|
raceEx.clear();
|
|
|
|
raceEx.reserve (size);
|
|
|
|
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;
|
|
|
|
t_creaturetype mat;
|
|
|
|
mat.id = p->readSTLString (p_races[i]);
|
|
|
|
mat.id = cr->creature_id;
|
|
|
|
mat.tile_character = p->readByte( p_races[i] + tile_offset );
|
|
|
|
mat.tile_character = cr->creature_tile;
|
|
|
|
mat.tilecolor.fore = p->readWord( p_races[i] + tile_color_offset );
|
|
|
|
mat.tilecolor.fore = cr->color[0];
|
|
|
|
mat.tilecolor.back = p->readWord( p_races[i] + tile_color_offset + 2 );
|
|
|
|
mat.tilecolor.back = cr->color[1];
|
|
|
|
mat.tilecolor.bright = p->readWord( p_races[i] + tile_color_offset + 4 );
|
|
|
|
mat.tilecolor.bright = cr->color[2];
|
|
|
|
|
|
|
|
|
|
|
|
vector <char *> & p_castes = *(vector<char*> *) (p_races[i] + castes_vector_offset);
|
|
|
|
uint32_t sizecas = cr->caste.size();
|
|
|
|
sizecas = p_castes.size();
|
|
|
|
|
|
|
|
for (uint32_t j = 0; j < sizecas;j++)
|
|
|
|
for (uint32_t j = 0; j < sizecas;j++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
df::caste_raw *ca = cr->caste[j];
|
|
|
|
/* caste name */
|
|
|
|
/* caste name */
|
|
|
|
t_creaturecaste caste;
|
|
|
|
t_creaturecaste caste;
|
|
|
|
char * caste_start = p_castes[j];
|
|
|
|
caste.id = ca->caste_id;
|
|
|
|
caste.id = p->readSTLString (caste_start);
|
|
|
|
caste.singular = ca->caste_name[0];
|
|
|
|
caste.singular = p->readSTLString (caste_start + sizeof_string);
|
|
|
|
caste.plural = ca->caste_name[1];
|
|
|
|
caste.plural = p->readSTLString (caste_start + 2 * sizeof_string);
|
|
|
|
caste.adjective = ca->caste_name[2];
|
|
|
|
caste.adjective = p->readSTLString (caste_start + 3 * sizeof_string);
|
|
|
|
/*
|
|
|
|
//cout << "Caste " << caste.rawname << " " << caste.singular << ": 0x" << hex << caste_start << endl;
|
|
|
|
// color mod reading
|
|
|
|
if(have_advanced)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
/* color mod reading */
|
|
|
|
|
|
|
|
// Caste + offset > color mod vector
|
|
|
|
// Caste + offset > color mod vector
|
|
|
|
vector <char *> & p_colormod = *(vector<char*> *) (caste_start + caste_colormod_offset);
|
|
|
|
vector <char *> & p_colormod = *(vector<char*> *) (world->raws.creatures.all[i]->caste + caste_colormod_offset);
|
|
|
|
sizecolormod = p_colormod.size();
|
|
|
|
uint32_t sizecolormod = p_colormod.size();
|
|
|
|
caste.ColorModifier.resize(sizecolormod);
|
|
|
|
caste.ColorModifier.resize(sizecolormod);
|
|
|
|
for(uint32_t k = 0; k < sizecolormod;k++)
|
|
|
|
for(uint32_t k = 0; k < sizecolormod;k++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// color mod [0] -> color list
|
|
|
|
// color mod [0] -> color list
|
|
|
|
vector <uint32_t> & p_colorlist = *(vector<uint32_t> *) (p_colormod[k]);
|
|
|
|
vector <uint32_t> & p_colorlist = *(vector<uint32_t> *) (p_colormod[k]);
|
|
|
|
sizecolorlist = p_colorlist.size();
|
|
|
|
uint32_t sizecolorlist = p_colorlist.size();
|
|
|
|
caste.ColorModifier[k].colorlist.resize(sizecolorlist);
|
|
|
|
caste.ColorModifier[k].colorlist.resize(sizecolorlist);
|
|
|
|
for(uint32_t l = 0; l < sizecolorlist; l++)
|
|
|
|
for(uint32_t l = 0; l < sizecolorlist; l++)
|
|
|
|
caste.ColorModifier[k].colorlist[l] = p_colorlist[l];
|
|
|
|
caste.ColorModifier[k].colorlist[l] = p_colorlist[l];
|
|
|
@ -772,30 +734,68 @@ bool Materials::ReadCreatureTypesEx (void)
|
|
|
|
caste.ColorModifier[k].startdate = p->readDWord( p_colormod[k] + color_modifier_startdate_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 );
|
|
|
|
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);
|
|
|
|
// body parts
|
|
|
|
caste.bodypart.empty();
|
|
|
|
caste.bodypart.empty();
|
|
|
|
sizebp = p_bodypart.size();
|
|
|
|
uint32_t sizebp = ca->body_parts.size();
|
|
|
|
for (uint32_t k = 0; k < sizebp; k++)
|
|
|
|
for (uint32_t k = 0; k < sizebp; k++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
df::body_part_raw *bp = ca->body_parts[k];
|
|
|
|
t_bodypart part;
|
|
|
|
t_bodypart part;
|
|
|
|
part.id = p->readSTLString (p_bodypart[k] + bodypart_id_offset);
|
|
|
|
part.id = bp->part_code;
|
|
|
|
part.category = p->readSTLString (p_bodypart[k] + bodypart_category_offset);
|
|
|
|
part.category = bp->part_name;
|
|
|
|
caste.bodypart.push_back(part);
|
|
|
|
caste.bodypart.push_back(part);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
p->read(caste_start + caste_attributes_offset, sizeof(t_attrib) * NUM_CREAT_ATTRIBS, (uint8_t *)&caste.strength);
|
|
|
|
|
|
|
|
}
|
|
|
|
t_attrib *phys[] = {
|
|
|
|
else
|
|
|
|
&caste.strength,
|
|
|
|
|
|
|
|
&caste.agility,
|
|
|
|
|
|
|
|
&caste.toughness,
|
|
|
|
|
|
|
|
&caste.endurance,
|
|
|
|
|
|
|
|
&caste.recuperation,
|
|
|
|
|
|
|
|
&caste.disease_resistance
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
for (uint32_t k = 0; k < 6; k++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
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++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
memset(&caste.strength, 0, sizeof(t_attrib) * NUM_CREAT_ATTRIBS);
|
|
|
|
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);
|
|
|
|
mat.castes.push_back(caste);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
vector <void *> & p_extract = *(vector<void*> *) (p_races[i] + extract_vector_offset);
|
|
|
|
for (uint32_t j = 0; j < world->raws.creatures.all[i]->material.size(); j++)
|
|
|
|
for(uint32_t j = 0; j < p_extract.size(); j++)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
t_creatureextract extract;
|
|
|
|
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);
|
|
|
|
mat.extract.push_back(extract);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
raceEx.push_back(mat);
|
|
|
|
raceEx.push_back(mat);
|
|
|
@ -813,119 +813,33 @@ bool Materials::ReadAllMaterials(void)
|
|
|
|
return ok;
|
|
|
|
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 Materials::getDescription(const t_material & mat)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::string out;
|
|
|
|
MaterialInfo mi(mat.material, mat.index);
|
|
|
|
int32_t typeC;
|
|
|
|
if (mi.creature)
|
|
|
|
if ( (mat.material<419) || (mat.material>618) )
|
|
|
|
return mi.creature->creature_id + " " + mi.material->id;
|
|
|
|
{
|
|
|
|
else if (mi.plant)
|
|
|
|
if ( (mat.material<19) || (mat.material>218) )
|
|
|
|
return mi.plant->id + " " + mi.material->id;
|
|
|
|
{
|
|
|
|
|
|
|
|
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
|
|
|
|
else
|
|
|
|
return "INDEX OUT OF BOUNDS!";
|
|
|
|
return mi.material->id;
|
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return this->df_organic->at(mat.material)->ID;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return out;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// type of material only so we know which vector to retrieve
|
|
|
|
// 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!
|
|
|
|
// This is completely worthless now
|
|
|
|
std::string Materials::getType(const t_material & mat)
|
|
|
|
std::string Materials::getType(const t_material & mat)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if((mat.material<419) || (mat.material>618))
|
|
|
|
MaterialInfo mi(mat.material, mat.index);
|
|
|
|
{
|
|
|
|
switch (mi.mode)
|
|
|
|
if((mat.material<19) || (mat.material>218))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if(mat.material)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(mat.material>0x292)
|
|
|
|
case MaterialInfo::Builtin:
|
|
|
|
{
|
|
|
|
return "builtin";
|
|
|
|
return "unknown";
|
|
|
|
case MaterialInfo::Inorganic:
|
|
|
|
}
|
|
|
|
|
|
|
|
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";
|
|
|
|
return "inorganic";
|
|
|
|
}
|
|
|
|
case MaterialInfo::Creature:
|
|
|
|
else
|
|
|
|
return "creature";
|
|
|
|
{
|
|
|
|
case MaterialInfo::Plant:
|
|
|
|
if (mat.index>=this->raceEx.size())
|
|
|
|
return "plant";
|
|
|
|
|
|
|
|
default:
|
|
|
|
return "unknown";
|
|
|
|
return "unknown";
|
|
|
|
|
|
|
|
|
|
|
|
return "racex extract";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return "organic";
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|