Add pregnancy and blood stuff to the creature struct

develop
Zhentar 2010-03-21 15:47:24 -05:00
parent 71f8474e11
commit 4287abbc94
4 changed files with 32 additions and 15 deletions

@ -152,7 +152,7 @@ void printCreature(DFHack::API & DF, const DFHack::t_creature & creature)
{
if(string(creaturestypes[creature.type].id) == "DWARF")
{
cout << "address: " << creature.origin << " creature type: " << creaturestypes[creature.type].id << ", position: " << creature.x << "x " << creature.y << "y "<< creature.z << "z" << endl;
cout << "address: " << hex << creature.origin << dec << " creature type: " << creaturestypes[creature.type].id << ", position: " << creature.x << "x " << creature.y << "y "<< creature.z << "z" << endl;
bool addendl = false;
if(creature.name.first_name[0])
{
@ -170,17 +170,7 @@ void printCreature(DFHack::API & DF, const DFHack::t_creature & creature)
cout << ", trans name: " << transName;
addendl=true;
}
//cout << ", generic name: " << DF.TranslateName(creature.last_name,names,"GENERIC");
/*
if(!creature.trans_name.empty()){
cout << ", trans name: " << creature.trans_name;
addendl =true;
}
if(!creature.generic_name.empty()){
cout << ", generic name: " << creature.generic_name;
addendl=true;
}
*/
cout << ", likes: ";
for(uint32_t i = 0;i<creature.numLikes; i++)
{
@ -223,6 +213,12 @@ void printCreature(DFHack::API & DF, const DFHack::t_creature & creature)
cout <<"Male";
}
cout << endl;
if(creature.pregnancy_timer > 0)
cout << "gives birth in " << creature.pregnancy_timer/1200 << " days. ";
cout << "Blood: " << creature.blood_current << "/" << creature.blood_max << " bleeding: " << creature.bleed_rate;
cout << endl;
/*
//skills
for(unsigned int i = 0; i < creature.skills.size();i++){

@ -97,6 +97,10 @@ public:
uint32_t creature_likes_offset;
uint32_t creature_artifact_name_offset;
uint32_t creature_mood_offset;
uint32_t creature_pregnancy_offset;
uint32_t creature_blood_max_offset;
uint32_t creature_blood_current_offset;
uint32_t creature_bleed_offset;
uint32_t item_material_offset;
@ -1030,7 +1034,10 @@ bool API::InitReadCreatures( uint32_t &numcreatures )
d->creature_likes_offset = minfo->getOffset("creature_likes");
d->creature_artifact_name_offset = minfo->getOffset("creature_artifact_name");
d->creature_mood_offset = minfo->getOffset("creature_mood");
d->creature_pregnancy_offset = minfo->getOffset("creature_pregnancy");
d->creature_blood_max_offset = minfo->getOffset("creature_blood_max");
d->creature_blood_current_offset = minfo->getOffset("creature_blood_current");
d->creature_bleed_offset = minfo->getOffset("creature_bleed");
d->p_cre = new DfVector (d->p->readVector (creatures, 4));
//InitReadNameTables();
d->creaturesInited = true;
@ -1308,6 +1315,13 @@ bool API::ReadCreature (const int32_t index, t_creature & furball)
g_pProcess->readDWord (temp + d->creature_money_offset, furball.money);
furball.squad_leader_id = (int32_t) g_pProcess->readDWord (temp + d->creature_squad_leader_id_offset);
g_pProcess->readByte (temp + d->creature_sex_offset, furball.sex);
g_pProcess->readDWord(temp+d->creature_pregnancy_offset, furball.pregnancy_timer);
furball.blood_max = (int32_t) g_pProcess->readDWord(temp+d->creature_blood_max_offset);
furball.blood_current = (int32_t) g_pProcess->readDWord(temp+d->creature_blood_current_offset);
g_pProcess->readDWord(temp+d->creature_bleed_offset, furball.bleed_rate);
return true;
}

@ -607,6 +607,10 @@ struct t_creature
uint32_t money;
int32_t squad_leader_id;
uint8_t sex;
uint32_t pregnancy_timer; //Countdown timer to giving birth
int32_t blood_max;
int32_t blood_current;
uint32_t bleed_rate;
};
//raw
struct t_item_df40d

@ -1221,9 +1221,13 @@
<Offset name="creature_id">0x10C</Offset>
<Offset name="creature_squad_name">0x198</Offset>
<Offset name="creature_mood">0x238</Offset>
<Offset name="creature_pregnancy">0x23C</Offset>
<Offset name="creature_squad_leader_id">0x268</Offset>
<Offset name="creature_money">0x2F8</Offset>
<Offset name="creature_current_job">0x314</Offset>
<Offset name="creature_blood_max">0x3C0</Offset>
<Offset name="creature_blood_current">0x3C4</Offset>
<Offset name="creature_bleed">0x3C8</Offset>
<Offset name="creature_artifact_name">0x484</Offset>
<Offset name="creature_strength">0x4F0</Offset>
<Offset name="creature_agility">0x4F4</Offset>
@ -1233,8 +1237,7 @@
<Offset name="creature_labors">0x544</Offset>
<Offset name="creature_happiness">0x610</Offset>
<Offset name="creature_traits">0x700</Offset>
<!-- tree and shrub offsets -->
<!-- tree and shrub offsets -->
<Offset name="tree_desc_offset">0x70</Offset>
<!-- map block offsets -->