The mysterious variable is mysterious, 31.22 support, needs testing

develop
Petr Mrázek 2011-03-24 23:21:50 +01:00
parent ecb239f64c
commit 754647fe96
5 changed files with 51 additions and 4 deletions

@ -760,6 +760,7 @@
<Offset name="pathfinding" /> <Offset name="pathfinding" />
<Offset name="feature_local" description="Index into a local feature vector (adamantine, etc. Complicated, see source)" /> <Offset name="feature_local" description="Index into a local feature vector (adamantine, etc. Complicated, see source)" />
<Offset name="feature_global" description="Index into the global feature vector (hell, etc.)." /> <Offset name="feature_global" description="Index into the global feature vector (hell, etc.)." />
<Offset name="mystery_offset" description="It's a mystery! I mean Kittens!" />
</Group> </Group>
<Group name="features"> <Group name="features">
<Group name="global"> <Group name="global">
@ -2095,7 +2096,38 @@
<PETimeStamp value="0x4D743DA7" /> <PETimeStamp value="0x4D743DA7" />
<MD5 value="3aadcbd781f7d70d5ee552b92c03bc6b" /> <MD5 value="3aadcbd781f7d70d5ee552b92c03bc6b" />
</Version> </Version>
<Version name="v0.31.22 SDL" os="windows" base="v0.31.21 SDL" rebase="-0x1CFE0">
<PETimeStamp value="0x4D8B30FC" />
<MD5 value="e31538a48efcfa6598b15bb938906c6b" />
<Offsets>
<Group name="Position">
<Address name="cursor_xyz" value="0xb337f0" />
<Address name="window_dims" value="0xb3407c" />
<Address name="window_x" value="0xeaf984" />
<Address name="window_y" value="0xeddba0" />
<Address name="window_z" value="0xeddb7c" />
</Group>
<Group name="Maps">
<Group name="block">
<!--
<Offset name="vein_vector" value="0x8" />
<Offset name="feature_local" value="0x24" />
<Offset name="feature_global" value="0x28" />
-->
<Offset name="mystery_offset" value="0x2C" />
<Offset name="vegetation_vector" value="0x64" />
<Offset name="type" value="0x7e" />
<Offset name="designation" value="0x280" />
<Offset name="occupancy" value="0x680" />
<Offset name="pathfinding" value="0xd80" />
<Offset name="temperature1" value="0x1580" />
<Offset name="temperature2" value="0x1780" />
<Offset name="biome_stuffs" value="0x1d80" />
-->
</Group>
</Group>
</Offsets>
</Version>
.-"""-. .-"""-.
' \ ' \
|,. ,-. | _________________________ |,. ,-. | _________________________

@ -184,7 +184,8 @@ SET_TARGET_PROPERTIES(dfhack PROPERTIES DEBUG_POSTFIX "-debug" )
TARGET_LINK_LIBRARIES(dfhack ${PROJECT_LIBS}) TARGET_LINK_LIBRARIES(dfhack ${PROJECT_LIBS})
ADD_CUSTOM_COMMAND( TARGET dfhack POST_BUILD #ADD_CUSTOM_COMMAND( TARGET dfhack POST_BUILD
ADD_CUSTOM_TARGET( memxmlcopy ALL
COMMAND ${CMAKE_COMMAND} -E copy ${dfhack_SOURCE_DIR}/Memory.xml ${dfhack_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/) COMMAND ${CMAKE_COMMAND} -E copy ${dfhack_SOURCE_DIR}/Memory.xml ${dfhack_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/)
install(TARGETS dfhack install(TARGETS dfhack

@ -475,6 +475,7 @@ namespace DFHack
int16_t global_feature; int16_t global_feature;
/// index into the local feature vector... complicated /// index into the local feature vector... complicated
int16_t local_feature; int16_t local_feature;
int32_t mystery;
} mapblock40d; } mapblock40d;
class DFContextShared; class DFContextShared;

@ -85,6 +85,7 @@ struct Maps::Private
uint32_t temperature2_offset; uint32_t temperature2_offset;
uint32_t global_feature_offset; uint32_t global_feature_offset;
uint32_t local_feature_offset; uint32_t local_feature_offset;
uint32_t mystery;
uint32_t vein_mineral_vptr; uint32_t vein_mineral_vptr;
uint32_t vein_ice_vptr; uint32_t vein_ice_vptr;
@ -198,7 +199,14 @@ Maps::Maps(DFContextShared* _d)
off.temperature1_offset = OG_MapBlock->getOffset ("temperature1"); off.temperature1_offset = OG_MapBlock->getOffset ("temperature1");
off.temperature2_offset = OG_MapBlock->getOffset ("temperature2"); off.temperature2_offset = OG_MapBlock->getOffset ("temperature2");
} }
try
{
off.mystery = OG_MapBlock->getOffset ("mystery_offset");
}
catch(Error::AllMemdef &)
{
off.mystery = 0;
}
try try
{ {
OffsetGroup *OG_Geology = OG_Maps->getGroup("geology"); OffsetGroup *OG_Geology = OG_Maps->getGroup("geology");
@ -314,6 +322,8 @@ bool Maps::Start()
// test for wrong map dimensions // test for wrong map dimensions
if (mx == 0 || mx > 48 || my == 0 || my > 48 || mz == 0) if (mx == 0 || mx > 48 || my == 0 || my > 48 || mz == 0)
{ {
cout << hex << off.x_count_offset << " " << off.y_count_offset << " " << off.z_count_offset << endl;
cout << dec << mx << " "<< my << " "<< mz << endl;
throw Error::BadMapDimensions(mx, my); throw Error::BadMapDimensions(mx, my);
//return false; //return false;
} }
@ -408,6 +418,7 @@ bool Maps::ReadBlock40d(uint32_t x, uint32_t y, uint32_t z, mapblock40d * buffer
p->read (addr + d->offsets.biome_stuffs, sizeof (biome_indices40d), (uint8_t *) buffer->biome_indices); p->read (addr + d->offsets.biome_stuffs, sizeof (biome_indices40d), (uint8_t *) buffer->biome_indices);
p->readWord(addr + d->offsets.global_feature_offset, (uint16_t&) buffer->global_feature); p->readWord(addr + d->offsets.global_feature_offset, (uint16_t&) buffer->global_feature);
p->readWord(addr + d->offsets.local_feature_offset, (uint16_t&)buffer->local_feature); p->readWord(addr + d->offsets.local_feature_offset, (uint16_t&)buffer->local_feature);
p->readDWord(addr + d->offsets.mystery, (uint32_t&)buffer->mystery);
buffer->origin = addr; buffer->origin = addr;
uint32_t addr_of_struct = p->readDWord(addr); uint32_t addr_of_struct = p->readDWord(addr);
buffer->blockflags.whole = p->readDWord(addr_of_struct); buffer->blockflags.whole = p->readDWord(addr_of_struct);

@ -159,8 +159,10 @@ int main (int numargs, const char ** args)
sa_feature(global_features[block.global_feature].type) sa_feature(global_features[block.global_feature].type)
); );
} }
#undef PRINT_FLAG #undef PRINT_FLAG
cout << "local feature idx: " << block.local_feature << endl;
cout << "global feature idx: " << block.global_feature << endl;
cout << "mystery: " << block.mystery << endl;
std::cout << std::endl; std::cout << std::endl;
} }
} }