Fix creature moods on 0.31.01 and 0.31.02

develop
Petr Mrázek 2010-04-27 20:18:46 +02:00
parent 06ce1c7225
commit df3efe23fb
2 changed files with 86 additions and 77 deletions

@ -242,67 +242,67 @@ void printCreature(DFHack::API & DF, const DFHack::t_creature & creature)
}
cout << endl;
if(creature.mood != -1)
{
cout << "mood: " << creature.mood << ", skill: " << mem->getSkill(creature.mood_skill) << endl;
vector<DFHack::t_material> mymat;
char maintype[512];
if(Creatures->ReadJob(&creature, mymat))
{
for(unsigned int i = 0; i < mymat.size(); i++)
{
strcpy(maintype, "???");
switch(mymat[i].typeA)
{
case 0:
if(mymat[i].typeD>=0)
{
if(mymat[i].typeD<=mat.metalMat.size())
sprintf(maintype, "%s bar", mat.metalMat[mymat[i].typeD].id);
else
strcpy(maintype, "invalid metal bar");
}
else
strcpy(maintype, "any metal bar");
break;
case 1:
strcpy(maintype, "cut gem");
break;
case 2:
strcpy(maintype, "block");
break;
case 3:
switch(mymat[i].typeC)
{
case 3: strcpy(maintype, "raw green glass"); break;
case 4: strcpy(maintype, "raw clear glass"); break;
case 5: strcpy(maintype, "raw crystal glass"); break;
default: strcpy(maintype, "raw gems"); break;
}
break;
case 4:
strcpy(maintype, "raw stone");
break;
case 5:
strcpy(maintype, "wood log");
break;
case 24:
strcpy(maintype, "weapon?");
break;
case 54:
strcpy(maintype, "leather");
break;
case 57:
strcpy(maintype, "cloth");
break;
default:
strcpy(maintype, "unknown");
break;
}
printf("\t%s(%d)\t%d %d %d - %.8x\n", maintype, mymat[i].typeA, mymat[i].typeB, mymat[i].typeC, mymat[i].typeD, mymat[i].flags);
}
}
}
if(creature.mood != -1)
{
cout << "mood: " << creature.mood << ", skill: " << mem->getSkill(creature.mood_skill) << endl;
vector<DFHack::t_material> mymat;
char maintype[512];
if(Creatures->ReadJob(&creature, mymat))
{
for(unsigned int i = 0; i < mymat.size(); i++)
{
strcpy(maintype, "???");
switch(mymat[i].typeA)
{
case 0:
if(mymat[i].typeD>=0)
{
if(mymat[i].typeD<=mat.metalMat.size())
sprintf(maintype, "%s bar", mat.metalMat[mymat[i].typeD].id);
else
strcpy(maintype, "invalid metal bar");
}
else
strcpy(maintype, "any metal bar");
break;
case 1:
strcpy(maintype, "cut gem");
break;
case 2:
strcpy(maintype, "block");
break;
case 3:
switch(mymat[i].typeC)
{
case 3: strcpy(maintype, "raw green glass"); break;
case 4: strcpy(maintype, "raw clear glass"); break;
case 5: strcpy(maintype, "raw crystal glass"); break;
default: strcpy(maintype, "raw gems"); break;
}
break;
case 4:
strcpy(maintype, "raw stone");
break;
case 5:
strcpy(maintype, "wood log");
break;
case 24:
strcpy(maintype, "weapon?");
break;
case 54:
strcpy(maintype, "leather");
break;
case 57:
strcpy(maintype, "cloth");
break;
default:
strcpy(maintype, "unknown");
break;
}
printf("\t%s(%d)\t%d %d %d - %.8x\n", maintype, mymat[i].typeA, mymat[i].typeB, mymat[i].typeC, mymat[i].typeD, mymat[i].flags);
}
}
}
/*
if(creature.pregnancy_timer > 0)
@ -494,7 +494,10 @@ int main (int numargs, char ** args)
addrs.push_back(temp.origin);
}
}
interleave_hex(DF,addrs,200);
if(addrs.size() <= 10)
{
interleave_hex(DF,addrs,200);
}
/*
uint32_t currentIdx;
DFHack::t_creature currentCreature;

@ -1064,6 +1064,8 @@ size=212
<Offset name="map_data_feature_local">0x2C</Offset> local features
<Offset name="map_data_feature_global">0x30</Offset> global features
Map Features
============
WORLD + 0x54374
<Address name="global_feature_vector">0x16AF4FC</Address>
<Offset name= "global_feature_funcptr_">0x100</Offset>
@ -1150,7 +1152,7 @@ map_data_1b60_offset 0x1B9c
<Offset name="creature_civ">0X120</Offset>
<Offset name="creature_soulskill_vector">0X1F4</Offset>
<Offset name="creature_pickup_equipment_bit">0X21C</Offset>
<Offset name="creature_mood">0x238</Offset>
<Offset name="creature_mood">0x288</Offset>
<Offset name="creature_pregnancy">0x28C</Offset>
<Offset name="creature_pregnancy_ptr">0x290</Offset>
@ -1165,6 +1167,10 @@ map_data_1b60_offset 0x1B9c
<Offset name="creature_disease_resistance">0x4F0</Offset>
-->
<Offset name="creature_current_job">0x390</Offset> <!-- from chmod -->
<Offset name="creature_mood_skill">0x394</Offset> the skill that will be increased at the end of the mood (or not)
<Offset name="creature_appearance_vector">0x604</Offset> seems to be indexes in the list of possible colors defined in the raws for each group
<Offset name="creature_artifact_name">0x6D0</Offset>
<Offset name="creature_labors">0x770</Offset>
<Offset name="creature_soul_vector">0x073C</Offset>
@ -1178,6 +1184,20 @@ map_data_1b60_offset 0x1B9c
<Offset name="soul_traits">0x224</Offset>
<Offset name="soul_mental">0x88</Offset>
Job structure
=============
<Offset name="job_id">0x0</Offset> Incrementaly assigned
<Offset name="job_type">0x8</Offset> seems to be just like the old occupations
<Offset name="job_materials_vector">0xa4</Offset>
Job materials
=============
<Offset name="job_material_maintype">0x0</Offset> like mood materials, 0=bars, 4=stone, 5=wood, 57=cloth, 54=leather ...
<Offset name="job_material_sectype1">0x2</Offset> subsubtype ?
<Offset name="job_material_sectype2">0x4</Offset> subtype ?
<Offset name="job_material_sectype3">0x8</Offset> index of material (for example, 2 is for silver)
<Offset name="job_material_flags">0x18</Offset> set only for shell / bone mood requirements ?
<!--
mid = AddStrucMember(id,"analytical_ability", 0X88, 0x60000400, GetStrucIdByName("s_attrib"), 28);
mid = AddStrucMember(id,"focus", 0XA4, 0x60000400, GetStrucIdByName("s_attrib"), 28);
@ -1418,20 +1438,6 @@ map_data_1b60_offset 0x1B9c
<Offset name="creature_default_soul">0x0758</Offset>
<Offset name="creature_happiness">0x834</Offset>
Job structure
=============
<Offset name="job_id">0x0</Offset> Incrementaly assigned
<Offset name="job_type">0x8</Offset> seems to be just like the old occupations
<Offset name="job_materials_vector">0xa4</Offset>
Job materials
=============
<Offset name="job_material_maintype">0x0</Offset> like mood materials, 0=bars, 4=stone, 5=wood, 57=cloth, 54=leather ...
<Offset name="job_material_sectype1">0x2</Offset> subsubtype ?
<Offset name="job_material_sectype2">0x4</Offset> subtype ?
<Offset name="job_material_sectype3">0x8</Offset> index of material (for example, 2 is for silver)
<Offset name="job_material_flags">0x18</Offset> set only for shell / bone mood requirements ?
Materials
=========
soil, stone, metal