@ -36,6 +36,9 @@ public:
, pm ( NULL ) , p ( NULL ) , offset_descriptor ( NULL )
, p_cons ( NULL ) , p_bld ( NULL ) , p_veg ( NULL )
{ }
void readName ( t_name & name , uint32_t address ) ;
uint32_t * block ;
uint32_t x_block_count , y_block_count , z_block_count ;
uint32_t regionX , regionY , regionZ ;
@ -61,12 +64,15 @@ public:
uint32_t view_screen_offset ;
uint32_t current_menu_state_offset ;
uint32_t name_firstname_offset ;
uint32_t name_nickname_offset ;
uint32_t name_words_offset ;
uint32_t creature_pos_offset ;
uint32_t creature_type_offset ;
uint32_t creature_flags1_offset ;
uint32_t creature_flags2_offset ;
uint32_t creature_name_offset ;
uint32_t creature_custom_profession_offset ;
uint32_t creature_profession_offset ;
uint32_t creature_sex_offset ;
@ -85,6 +91,7 @@ public:
uint32_t creature_traits_offset ;
uint32_t creature_likes_offset ;
uint32_t creature_artifact_name_offset ;
uint32_t creature_mood_offset ;
uint32_t item_material_offset ;
@ -869,6 +876,9 @@ bool API::InitReadCreatures( uint32_t &numcreatures )
try
{
memory_info * minfo = d - > offset_descriptor ;
d - > name_firstname_offset = minfo - > getOffset ( " name_firstname " ) ;
d - > name_nickname_offset = minfo - > getOffset ( " name_nickname " ) ;
d - > name_words_offset = minfo - > getOffset ( " name_words " ) ;
int creatures = d - > offset_descriptor - > getAddress ( " creatures " ) ;
d - > creature_pos_offset = minfo - > getOffset ( " creature_position " ) ;
d - > creature_type_offset = minfo - > getOffset ( " creature_race " ) ;
@ -893,6 +903,7 @@ bool API::InitReadCreatures( uint32_t &numcreatures )
d - > creature_traits_offset = minfo - > getOffset ( " creature_traits " ) ;
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 - > p_cre = new DfVector ( d - > p - > readVector ( creatures , 4 ) ) ;
//InitReadNameTables();
@ -974,7 +985,7 @@ bool API::ReadSettlement(const int32_t index, t_settlement & settlement)
// read pointer from vector at position
uint32_t temp = * ( uint32_t * ) d - > p_settlements - > at ( index ) ;
settlement . origin = temp ;
g_pProcess - > read ( temp + d - > settlement_name_offset , 2 * sizeof ( int32_t ) , ( uint8_t * ) & settlement . name ) ;
d - > readName ( settlement . name , temp + d - > settlement_name_offset ) ;
g_pProcess - > read ( temp + d - > settlement_world_xy_offset , 2 * sizeof ( int16_t ) , ( uint8_t * ) & settlement . world_x ) ;
g_pProcess - > read ( temp + d - > settlement_local_xy_offset , 4 * sizeof ( int16_t ) , ( uint8_t * ) & settlement . local_x1 ) ;
return true ;
@ -987,7 +998,7 @@ bool API::ReadCurrentSettlement(t_settlement & settlement)
uint32_t temp = * ( uint32_t * ) d - > p_current_settlement - > at ( 0 ) ;
settlement . origin = temp ;
g_pProcess - > read ( temp + d - > settlement_name_offset , 2 * sizeof ( int32_t ) , ( uint8_t * ) & settlement . name ) ;
d - > readName ( settlement . name , temp + d - > settlement_name_offset ) ;
g_pProcess - > read ( temp + d - > settlement_world_xy_offset , 2 * sizeof ( int16_t ) , ( uint8_t * ) & settlement . world_x ) ;
g_pProcess - > read ( temp + d - > settlement_local_xy_offset , 4 * sizeof ( int16_t ) , ( uint8_t * ) & settlement . local_x1 ) ;
return true ;
@ -1101,11 +1112,11 @@ bool API::getItemIndexesInBox(vector<uint32_t> &indexes,
return true ;
}
void readName( t_name & name , uint32_t address )
void API: : Private : : readName( t_name & name , uint32_t address )
{
g_pProcess - > readSTLString ( address , name . first_name , 128 ) ;
g_pProcess - > readSTLString ( address + sizeof ( string ) , name . nickname , 128 ) ;
g_pProcess - > read ( address + 2 * sizeof ( string ) , 48 , ( uint8_t * ) name . words ) ;
g_pProcess - > readSTLString ( address + name_firstname_offset , name . first_name , 128 ) ;
g_pProcess - > readSTLString ( address + name_nickname_offset , name . nickname , 128 ) ;
g_pProcess - > read ( address + name_words_offset , 48 , ( uint8_t * ) name . words ) ;
}
bool API : : ReadCreature ( const int32_t index , t_creature & furball )
@ -1120,14 +1131,12 @@ bool API::ReadCreature (const int32_t index, t_creature & furball)
g_pProcess - > readDWord ( temp + d - > creature_flags1_offset , furball . flags1 . whole ) ;
g_pProcess - > readDWord ( temp + d - > creature_flags2_offset , furball . flags2 . whole ) ;
// names
readName( furball . name , temp + d - > creature_name_offset ) ;
readName( furball . squad_name , temp + d - > creature_squad_name_offset ) ;
readName( furball . artifact_name , temp + d - > creature_artifact_name_offset ) ;
d- > readName( furball . name , temp + d - > creature_name_offset ) ;
d- > readName( furball . squad_name , temp + d - > creature_squad_name_offset ) ;
d- > readName( furball . artifact_name , temp + d - > creature_artifact_name_offset ) ;
// custom profession
fill_char_buf ( furball . custom_profession , d - > p - > readSTLString ( temp + d - > creature_custom_profession_offset ) ) ;
// labors
g_pProcess - > read ( temp + d - > creature_labors_offset , NUM_CREATURE_LABORS , furball . labors ) ;
// traits
@ -1168,6 +1177,9 @@ bool API::ReadCreature (const int32_t index, t_creature & furball)
g_pProcess - > read ( temp2 , sizeof ( t_like ) , ( uint8_t * ) & furball . likes [ i ] ) ;
}
g_pProcess - > readWord ( temp + d - > creature_mood_offset , furball . mood ) ;
g_pProcess - > readDWord ( temp + d - > creature_happiness_offset , furball . happiness ) ;
g_pProcess - > readDWord ( temp + d - > creature_id_offset , furball . id ) ;
g_pProcess - > readDWord ( temp + d - > creature_agility_offset , furball . agility ) ;