- v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
- Use this page to report any issues related to the migration.
Difference between revisions of "40d:Memory hacking/v0.27.169.33f"
(race_type object) |
m |
||
(5 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
+ | [[Category:Hacking]] | ||
== Addresses == | == Addresses == | ||
<pre> | <pre> | ||
Line 50: | Line 51: | ||
00000054 s_p_c ends</pre> | 00000054 s_p_c ends</pre> | ||
− | This structure groups color information. It is not obvious whether the original code has a color substructure, but I decided to make one anyway. I have not tested whether the red, green, blue fields are in the proper order. | + | This structure groups color information. It is not obvious whether the original code has a color substructure, but I decided to make one anyway. I have not tested whether the red, green, blue fields are in the proper order. '''Edit:''' this appears to be foreground color, background color, and the bold flag, just like the [[Color|raws define it]]. |
<pre>00000000 color_type struc ; (sizeof=0x6) | <pre>00000000 color_type struc ; (sizeof=0x6) | ||
Line 447: | Line 448: | ||
This work done by [[User:0x517A5D|0x517A5D]] 22:36, 19 December 2007 (EST) | This work done by [[User:0x517A5D|0x517A5D]] 22:36, 19 December 2007 (EST) | ||
+ | |||
+ | :A thought: If ''I'' was designing this structure, all of these seldom-used fields would be kept off in a vector of strings and parsed when needed. I mean, <code>remains_color</code> is used <u>once</u> in the entire game, and it's for a creature that (I think) can't even appear! <code>demon_sphere_vector</code>? <code>cheese_liquid_density</code>? Now, really.<br/>—[[User:0x517A5D|0x517A5D]] 15:28, 21 December 2007 (EST) |
Latest revision as of 22:02, 14 December 2011
Addresses[edit]
pe_header_timestamp == 4763710C map_data_loc == 01462568 map_x_count_loc == 01462580 map_y_count_loc == 01462584 map_z_count_loc == 01462588 race_data_vector_loc == 01463F48 dwarven_race_index_loc == 01241AD0 main_creature_vector_loc == 01420A38 another_creature_vector_loc == 01420A48 yet_another_creature_vector_loc == 01420A88 whathe_another_creature_vector_loc == 01420A18 number_of_dwarves_loc == 0078A555 initial_starting_points_loc == 0078970A art_defacement_malus_loc == 007A489F current_unit_focus_loc == 00C39548 next_creature_id_loc == 00C119F4 language_vector_loc == 01464068 metal_tokens_vector_loc == 01463F18 starting_skills_limit_loc == 0078654B starting_skills_increment_loc == 00786466 starting_skills_decrement_loc == 00786608 creature.happiness_level == 00000508
Does anyone need other locations? Ask in the Talk subpage.
Racial Data[edit]
I shall use assembly language syntax instead of C, as that's what my disassembler delivers.
The race_data_vector
is an array of pointers to instances of an object we will hereby call race_type
. The instances are, of course, generated from the [CREATURE] entries in the raw files.
race_type
appears to contain several custom sub-objects as well as standard ones such as strings.
This structure merely groups two strings, a singular noun and a plural noun.
00000000 s_p struc ; (sizeof=0x38) 00000000 singular string ? 0000001C plural string ? 00000038 s_p ends
This structure groups three strings, a singular noun and a plural noun and a noun I call "corpse" as it is used when displaying info about a corpse. (It is probably used in other ways as well.)
00000000 s_p_c struc ; (sizeof=0x54) 00000000 singular string ? 0000001C plural string ? 00000038 corpse_prefix? string ? 00000054 s_p_c ends
This structure groups color information. It is not obvious whether the original code has a color substructure, but I decided to make one anyway. I have not tested whether the red, green, blue fields are in the proper order. Edit: this appears to be foreground color, background color, and the bold flag, just like the raws define it.
00000000 color_type struc ; (sizeof=0x6) 00000000 red? dw ? 00000002 green? dw ? 00000004 blue? dw ? 00000006 color_type ends
This structure groups certain temperature-related information.
00000000 temperature_table struc ; (sizeof=0xE) 00000000 spec_heat dw ? 00000002 heatdam_point dw ? 00000004 colddam_point dw ? 00000006 ignite_point dw ? 00000008 melting_point dw ? 0000000A boiling_point dw ? 0000000C fixed_temp dw ? 0000000E temperature_table ends
Finally the (huge) race_type
object. Note the lack of a vtable, implying that race_type
is probably not subclassed.
00000000 race_type struc ; (sizeof=0x20A0) 00000000 token string ? ; TOAD, COW, EQUIPMENT_WAGON 0000001C name s_p_c ? ; cow:cows:bovine 00000070 chunk s_p ? ; remains:remains 00000070 ; chunk:chunks 000000A8 extract string ? ; cow's milk 000000A8 ; phantom spider venom 000000A8 ; liquid fire 000000C4 extract_cheese string ? ; cow cheese 000000E0 extract_antidote string ? 000000FC vermin_bite_verb string ? 00000118 gnawer_verb string ? 00000134 babyname s_p ? ; warning: token BABYNAME not in raws 0000016C childname s_p ? ; puppy, x calf, x fry 000001A4 craftsman_name s_p ? ; craftsdwarf:craftsdwarves 000001DC fisherman_name s_p ? 00000214 hammerman_name s_p ? 0000024C spearman_name s_p ? 00000284 crossbowman_name s_p ? ; marksdwarf:marksdwarves 000002BC axeman_name s_p ? 000002F4 swordsman_name s_p ? 0000032C maceman_name s_p ? 00000364 pikeman_name s_p ? ; pikedwarf:pikedwarves (!) 0000039C bowman_name s_p ? ; bowdwarf:bowdwarves (!) 000003D4 specname_male s_p_c ? ; bull:bulls:bull 00000428 specname_female s_p_c ? ; mermaid:mermaids:mermaid 0000047C tile db ? 0000047D alttile db ? 0000047E bloodtype db ? ; default 9 0000047F glowtile db ? 00000480 t temperature_table ? 0000048E silk_t temperature_table ? 0000049C leather_t temperature_table ? 000004AA bone_t temperature_table ? 000004B8 extract_t temperature_table ? 000004C6 cheese_t temperature_table ? 000004D4 drink_t temperature_table ? 000004E2 homeotherm dw ? ; default 60001 000004E4 field_4E4 dw ? 000004E6 field_4E6 dw ? 000004E8 color color_type ? ; a sub-object may start here 000004EE population_number_high dw ? 000004F0 population_number_low dw ? 000004F2 cluster_number_high dw ? 000004F4 cluster_number_low dw ? 000004F6 triggerable_group_high dw ? 000004F8 triggerable_group_low dw ? 000004FA probably_littersize_high dw ? ; default 3 000004FC probably_littersize_low dw ? 000004FE genpower dw ? 00000500 value dw ? 00000502 extract_field3 dw ? 00000504 extract_field4 dw ? 00000506 extract_cheese_value dw ? 00000508 extract_cheese_field3 dw ? 0000050A extract_cheese_field4 dw ? 0000050C penetrate_power dw ? 0000050E frequency dw ? ; default 50 00000510 antidote_value dw ? 00000512 antidote_field3 dw ? 00000514 antidote_field4 dw ? 00000516 vermin_bite_field1 dw ? 00000518 vermin_bite_field3 dw ? 0000051A grasstrample dw ? ; default 5 0000051C building_destroyer_level dw ? 0000051E damblock dw ? 00000520 corpse_item_type dw ? 00000522 corpse_item_subtype dw ? 00000524 corpse_material_type dw ? 00000526 corpse_material_subtype dw ? 00000528 itemcorpse_quality dw ? 0000052A racegloss dw ? ; default -1 0000052C remains_color color_type ? ; default 5:0:0 00000532 difficulty dw ? 00000534 fat dw ? 00000536 glowcolor1 color_type ? 0000053C material_type dw ? 0000053E material_subtype dw ? 00000540 layering dw ? 00000542 beach_frequency dw ? 00000544 speed dd ? ; default 900 00000548 modvalue dd ? 0000054C extract_value dd ? 00000550 cheese_value dd ? 00000554 antidote_field5 dd ? 00000558 petvalue dd ? 0000055C extract_size dd ? ; default 1 00000560 milking_related_number dd ? ; default 100800, 1 year 00000564 viewrange dd ? ; default 20 00000568 size dd ? ; default 6 0000056C maxage_low dd ? 00000570 maxage_high dd ? 00000574 baby_count dd ? 00000578 child_count? dd ? 0000057C density dd ? ; default 0FBBC7818h 00000580 silk_solid_density dd ? ; default 1353 00000584 silk_liquid_density dd ? ; default 0FBBC7818h 00000588 leather_solid_density dd ? ; default 0FBBC7818h 0000058C leather_liquid_density dd ? ; default 0FBBC7818h 00000590 bone_solid_density dd ? ; default 0FBBC7818h 00000594 bone_liquid_density dd ? ; default 0FBBC7818h 00000598 extract_solid_density dd ? ; default 1200 0000059C extract_liquid_density dd ? ; default 1200 000005A0 cheese_solid_density dd ? ; default 1200 000005A4 cheese_liquid_density dd ? ; default 1200 000005A8 drink_solid_density dd ? ; default 1200 000005AC drink_liquid_density dd ? ; default 1200 000005B0 swim_speed dd ? 000005B4 trade_capacity dd ? 000005B8 prefstring_vector vector ? 000005C8 body_vector vector ? 000005D8 attack_vector vector ? 000005E8 personality_traits_min? dw 30 dup(?) ; base 10 00000624 personality_traits_avg? dw 30 dup(?) ; default 50's 00000660 personality_traits_max? dw 30 dup(?) ; default 100's 0000069C demon_sphere_vector vector ? 000006AC flags_ptr dd ? ; ptr to flags bitfield size 19h 000006B0 flags_size dd ? ; 19h, size of bitfield 000006B4 field_6B4 dd 6 dup(?) 000006CC field_6CC dd 6 dup(?) 000006E4 field_6E4 dd 7 dup(?) 00000700 field_700 dd 7 dup(?) 0000071C field_71C dd 7 dup(?) 00000738 field_738 dd 7 dup(?) 00000754 field_754 dd 7 dup(?) 00000770 field_770 dd 7 dup(?) 0000078C field_78C dd 7 dup(?) 000007A8 field_7A8 dd 7 dup(?) 000007C4 field_7C4 dd 7 dup(?) 000007E0 field_7E0 dd 7 dup(?) 000007FC field_7FC dd 7 dup(?) 00000818 field_818 dd 7 dup(?) 00000834 field_834 dd 114 dup(?) 000009FC field_9FC dd 114 dup(?) 00000BC4 field_BC4 dd 114 dup(?) 00000D8C field_D8C dd 114 dup(?) 00000F54 field_F54 dd 114 dup(?) 0000111C field_111C dd 114 dup(?) 000012E4 field_12E4 dd 114 dup(?) ; associated with field_834 000014AC field_14AC dd 114 dup(?) 00001674 field_1674 dd 114 dup(?) 0000183C field_183C dd 114 dup(?) 00001A04 field_1A04 dd 114 dup(?) 00001BCC field_1BCC dd 114 dup(?) 00001D94 field_1D94 db 6 dup(?) ; probably flags, 00001D94 ; associated with field_6B4 and field_6CC, 00001D94 ; somehow related to ADD_COLOR 00001D9A field_1D9A db 7 dup(?) ; associated with field_6E4 00001DA1 field_1DA1 db 7 dup(?) ; associated with field_700 00001DA8 field_1DA8 db 7 dup(?) ; associated with field_71C 00001DAF field_1DAF db 7 dup(?) 00001DB6 field_1DB6 db 7 dup(?) ; associated with field_754 00001DBD field_1DBD db 7 dup(?) ; associated with field_770 00001DC4 field_1DC4 db 114 dup(?) ; probably flags 00001DC4 ; associated with field_834 and field_12E4 00001DC4 ; somehow related to ADD_COLOR 00001E36 field_1E36 db 114 dup(?) ; associated with field_9FC 00001EA8 field_1EA8 db 114 dup(?) ; associated with field_BC4 00001F1A field_1F1A db 114 dup(?) 00001F8C field_1F8C db 114 dup(?) ; associated wiuth field_F54 00001FFE field_1FFE db 114 dup(?) ; associated with field_111C 00002070 speech_vector?_1 vector ? 00002080 speech_vector?_2 vector ? 00002090 speech_vector?_3 vector ? 000020A0 race_type ends
Most everything that the raws can set on a creature has been found. The arrays near the end are not set by the raws, and are currently unknown.
race_type.flags_ptr
needs further explanation. The object does not contain the associated flags; instead it has a pointer to a bitvector of flags. To test a flag in the bitvector, divide the flag number by 8 (number of bits in a byte). The quotient is the byte to test, the remainder is the number of bits to shift the mask. Flag 0x43, for example, is tested by (BYTE *)(race.flags_ptr)[8] & (1 << 3)
.
The flags:
0: ?? used but not set by raws 1: ?? 2: LOCKPICKER 3: AMPHIBIOUS 4: AQUATIC (also sets AMPHIBIOUS) 5: MISCHIEVIOUS 6: PATTERNFLIER 7: CURIOUSBEAST 8: CURIOUSBEAST_ITEM 9: CURIOUSBEAST_GUZZLER A: FLEEQUICK B: VERMINHUNTER C: VERMIN_EATER D: VERMIN_GROUNDER E: VERMIN_ROTTER F: ?? 10: SWIMS_LEARNED 11: VERMIN_SOIL 12: VERMIN_SOIL_COLONY 13: ?? 14: ?? 15: NO_EAT 16: NO_DRINK 17: NO_SLEEP 18: COMMON_DOMESTIC 19: WAGON_PULLER 1A: PACK_ANIMAL 1B: LARGE_ROAMING 1C: VERMIN_FISH 1D: FLIER 1E: LARGE_PREDATOR 1F: MAGMA_VISION 20: LOOSE_CLUSTERS 21: FIREIMMUNE 22: FIREIMMUNE_SUPER 23: WEBBER 24: WEBIMMUNE 25: FANCIFUL 26: FISHITEM 27: IMMOBILE_LAND 28: IMMOLATE 29: MILKABLE 2A: NO_SPRING 2B: NO_SUMMER 2C: NO_AUTUMN 2D: NO_WINTER 2E: BENIGN 2F: VERMIN_NOROAM 30: VERMIN_NOTRAP 31: VERMIN_NOFISH 32: EXTRACT_PERMANENT 33: EXTRACT_PARALYZE 34: EXTRACT_STUN 35: EXTRACT_PARALYZE_INTERMITTENT 36: EXTRACT_STUN_INTERMITTENT 37: AMBUSHPREDATOR 38: CHITIN 39: GNAWER 3A: NOT_BUTCHERABLE 3B: BUTCHERABLE_NONSTANDARD 3C: COOKABLE_LIVE 3D: EXTRACT_COOKABLE 3E: FIREBREATH 3F: DRAGONFIREBREATH 40: MEANDERER 41: THICKWEB 42: TRAINABLE 43: PET 44: PET_EXOTIC 45: CAN_CIV 46: CAN_SPEAK 47: CAN_LEARN note: INTELLIGENT sets 45, 46, 47 48: UTTERANCES 49: BONECARN (also sets CARNIVORE) 4A: CARNIVORE 4B: UNDERSWIM 4C: NOEXERT 4D: NOPAIN 4E: EXTRAVISION 4F: NOBREATHE 50: NOSTUN 51: NONAUSEA 52: NOBLEAD 53: TRANCES 54: NOEMOTION 55: RECKLESS 56: NOSTUCKINS 57: SEVERONBREAKS 58: NOSKULL 59: NOSKIN 5A: NOBONES 5B: NOMEAT 5C: PARALYZEIMMUNE 5D: NOFEAR 5E: CANOPENDOORS 5F: has ITEMCORPSE see also fields 520-526 60: USE_RACEGLOSS as corpse material subtype 61: NOSMELLYROT 62: REMAINS_UNDETERMINED 63: HASSHELL 64: PEARL 65: IVORY 66: HORN 67: NARROW 68: STOUT 69: LIKES_FIGHTING 6A: VERMIN_HATABLE 6B: VEGETATION 6C: MAGICAL 6D: GOOD 6E: NATURAL 6F: EVIL 70: SAVAGE 71: BABY see also field 574 72: CHILD see also field 578 73: MULTIPLE_LITTER_RARE 74: MOUNT 75: MOUNT_EXOTIC 76: FEATURE_ATTACK_GROUP 77: VERMIN_MICRO 78: BIOME_POOL_TEMPERATE_BRACKISHWATER 79: EQUIPS 7A: ENDING 7B: DEFENDER 7C: NOTHOUGHT 7D: TRAPAVOID 7E: CAVE_ADAPT 7F: MEGABEAST 80: SEMIMEGABEAST 81: ALL_ACTIVE 82: DIURNAL 83: NOCTURNAL 84: CREPUSCULAR 85: MATUTINAL 86: VESPERTINE 87: LIGHT_GEN 88: BIOME_MOUNTAIN 89: BIOME_GLACIER 8A: BIOME_TUNDRA 8B: BIOME_SWAMP_TEMPERATE_FRESHWATER 8C: BIOME_SWAMP_TEMPERATE_SALTWATER 8D: BIOME_MARSH_TEMPERATE_FRESHWATER 8E: BIOME_MARSH_TEMPERATE_SALTWATER 8F: BIOME_SWAMP_TROPICAL_FRESHWATER 90: BIOME_SWAMP_TROPICAL_SALTWATER 91: BIOME_SWAMP_MANGROVE 92: BIOME_MARSH_TROPICAL_FRESHWATER 93: BIOME_MARSH_TROPICAL_SALTWATER 94: BIOME_FOREST_TAIGA 95: BIOME_FOREST_TEMPERATE_CONIFER 96: BIOME_FOREST_TEMPERATE_BROADLEAF 97: BIOME_FOREST_TROPICAL_CONIFER 98: BIOME_FOREST_TROPICAL_DRY_BROADLEAF 99: BIOME_FOREST_TROPICAL_MOIST_BROADLEAF 9A: BIOME_GRASSLAND_TEMPERATE 9B: BIOME_SAVANNA_TEMPERATE 9C: BIOME_SHRUBLAND_TEMPERATE 9D: BIOME_GRASSLAND_TROPICAL 9E: BIOME_SAVANNA_TROPICAL 9F: BIOME_SHRUBLAND_TROPICAL A0: BIOME_DESERT_BADLAND A1: BIOME_DESERT_ROCK A2: BIOME_DESERT_SAND A3: BIOME_OCEAN_TROPICAL A4: BIOME_OCEAN_TEMPERATE A5: BIOME_OCEAN_ARCTIC A6: BIOME_POOL_TEMPERATE_FRESHWATER A7: BIOME_SUBTERRANEAN_WATER A8: BIOME_SUBTERRANEAN_CHASM A9: BIOME_SUBTERRANEAN_LAVA AA: FEMALE AB: MALE AC: NO_GENDER AD: LISP AE: MATERIAL AF: both MATERIAL & USE_RACEGLOSS B0: ALCOHOL_DEPENDENT B1: SWIMS_INNATE (also sets SWIMS_LEARNED) B2: BIOME_POOL_TEMPERATE_SALTWATER B3: BIOME_POOL_TROPICAL_FRESHWATER B4: BIOME_POOL_TROPICAL_BRACKISHWATER B5: BIOME_POOL_TROPICAL_SALTWATER B6: BIOME_LAKE_TEMPERATE_FRESHWATER B7: BIOME_LAKE_TEMPERATE_BRACKISHWATER B8: BIOME_LAKE_TEMPERATE_SALTWATER B9: BIOME_LAKE_TROPICAL_FRESHWATER BA: BIOME_LAKE_TROPICAL_BRACKISHWATER BB: BIOME_LAKE_TROPICAL_SALTWATER BC: BIOME_RIVER_TEMPERATE_FRESHWATER BD: BIOME_RIVER_TEMPERATE_BRACKISHWATER BE: BIOME_RIVER_TEMPERATE_SALTWATER BF: BIOME_RIVER_TROPICAL_FRESHWATER C0: BIOME_RIVER_TROPICAL_BRACKISHWATER C1: BIOME_RIVER_TROPICAL_SALTWATER EQUIPMENT_WAGON sets 1, 15-17, 3A, 4C-5D, 61, 7C, AC the following set multiple biome flags: BIOME_ALL_MAIN, BIOME_ANY_LAND, BIOME_ANY_OCEAN, BIOME_ANY_LAKE, BIOME_ANY_RIVER, BIOME_ANY_POOL, BIOME_NOT_FREEZING, BIOME_ANY_TEMPERATE, BIOME_ANY_TROPICAL, BIOME_ANY_TEMPERATE_FOREST, BIOME_ANY_TROPICAL_FOREST, BIOME_ANY_WETLAND, BIOME_ANY_DESERT
This work done by 0x517A5D 22:36, 19 December 2007 (EST)
- A thought: If I was designing this structure, all of these seldom-used fields would be kept off in a vector of strings and parsed when needed. I mean,
remains_color
is used once in the entire game, and it's for a creature that (I think) can't even appear!demon_sphere_vector
?cheese_liquid_density
? Now, really.
—0x517A5D 15:28, 21 December 2007 (EST)