Minor rearrangement with no impact

develop
Petr Mrázek 2011-05-07 03:44:10 +02:00
parent 97df735db5
commit fc0f6f1e48
4 changed files with 69 additions and 24 deletions

@ -3002,6 +3002,7 @@
<Version name="v0.31.25 linux" os="linux" base="v0.31.24 linux" rebase="0x300"> <Version name="v0.31.25 linux" os="linux" base="v0.31.24 linux" rebase="0x300">
<MD5 value="fc15065c4d1977ca019c6dad220413d1" /> <MD5 value="fc15065c4d1977ca019c6dad220413d1" />
<Offsets> <Offsets>
WORLD: 0x93f77a0
<Group name="Creatures"> <Group name="Creatures">
Address name="vector" value="0x0940b174" Address name="vector" value="0x0940b174"
<Group name="creature"> <Group name="creature">

@ -116,6 +116,10 @@ bool Context::Resume()
} }
bool Context::ForceResume() bool Context::ForceResume()
{ {
for(unsigned int i = 0 ; i < d->allModules.size(); i++)
{
d->allModules[i]->OnResume();
}
return d->p->forceresume(); return d->p->forceresume();
} }
bool Context::isSuspended() bool Context::isSuspended()

@ -639,6 +639,10 @@ bool Maps::StopFeatures()
} }
return false; return false;
} }
typedef uint32_t _DWORD;
typedef uint8_t _BYTE;
#define BYTEn(x, n) (*((_BYTE*)&(x)+n))
#define BYTE4(x) BYTEn(x, 4)
bool Maps::StartFeatures() bool Maps::StartFeatures()
{ {
@ -679,6 +683,34 @@ bool Maps::StartFeatures()
for(uint32_t blockX = 0; blockX < d->x_block_count; blockX ++) for(uint32_t blockX = 0; blockX < d->x_block_count; blockX ++)
for(uint32_t blockY = 0; blockY < d->x_block_count; blockY ++) for(uint32_t blockY = 0; blockY < d->x_block_count; blockY ++)
{ {
int16_t zz; // bx@1
signed int xx; // edx@2
signed int yy; // edi@4
int v7; // eax@7
int block; // ebx@8
int designation; // eax@9
int32_t x_cooked_; // eax@11
int16_t y_cooked; // dx@11
int loc_f_array16x16; // esi@11
int64_t x_esquare; // qax@11
int64_t x_cooked; // si@11
int64_t y_esquare; // qax@11
int v16; // eax@12
int local_f_idx; // edx@12
int v18; // eax@12
int result; // eax@14
int v20; // ebx@17
int designation_; // [sp+14h] [bp+4h]@9
x_esquare = blockX / 3 + d->regionX; // *(_DWORD *)(WORLD + 0x55720);
x_cooked = ((BYTE4(x_esquare) & 0xF) + (_DWORD)x_esquare) >> 4;
y_esquare = blockY / 3 + d->regionY;
y_cooked = ((BYTE4(y_esquare) & 0xF) + (_DWORD)y_esquare) >> 4;
x_cooked_ = x_cooked;
uint32_t array_elem = p->readDWord(base + 4 * (x_cooked >> 4));
loc_f_array16x16 = p->readDWord((y_cooked & 0xFFFFFFF0) + 4 + array_elem);
/*
// region X coord (48x48 tiles) // region X coord (48x48 tiles)
uint16_t region_x_local = ( (blockX / 3) + d->regionX ) / 16; uint16_t region_x_local = ( (blockX / 3) + d->regionX ) / 16;
// region Y coord (48x48 tiles) // region Y coord (48x48 tiles)
@ -688,11 +720,16 @@ bool Maps::StartFeatures()
uint32_t array_elem = p->readDWord(base + (region_x_local / 16) * 4); uint32_t array_elem = p->readDWord(base + (region_x_local / 16) * 4);
// 16B structs, second DWORD of the struct is a pointer // 16B structs, second DWORD of the struct is a pointer
uint32_t loc_f_array16x16 = p->readDWord(array_elem + ( sizeof_elem * ( (uint32_t)region_y_local/16)) + offset_elem); uint32_t loc_f_array16x16 = p->readDWord(array_elem
+ ( sizeof_elem * ( (uint32_t)region_y_local/16))
+ offset_elem);
*/
if(loc_f_array16x16) if(loc_f_array16x16)
{ {
// wtf + sizeof(vector<ptr>) * crap; // wtf + sizeof(vector<ptr>) * crap;
uint32_t feat_vector = loc_f_array16x16 + sizeof_vec * (16 * (region_x_local % 16) + (region_y_local % 16)); //uint32_t feat_vector = loc_f_array16x16 + sizeof_vec * (16 * (region_x_local % 16) + (region_y_local % 16));
uint32_t feat_vector = loc_f_array16x16 + sizeof_vec/*16*/ * (y_cooked % 16 + 16 * x_cooked_ % 16);
//loc_f_array16x16 + sizeof_vec * (16 * (x_cooked % 16) + (region_y_local % 16));
DfVector<uint32_t> p_features(p, feat_vector); DfVector<uint32_t> p_features(p, feat_vector);
uint32_t size = p_features.size(); uint32_t size = p_features.size();
DFCoord pc(blockX,blockY); DFCoord pc(blockX,blockY);

@ -70,11 +70,7 @@ int main (int numargs, const char ** args)
p->readDWord (region_y_offset, (uint32_t &)regionY); p->readDWord (region_y_offset, (uint32_t &)regionY);
p->readDWord (region_z_offset, (uint32_t &)regionZ); p->readDWord (region_z_offset, (uint32_t &)regionZ);
vector<DFHack::t_feature> global_features; bool have_features = Maps->StartFeatures();
std::map <DFHack::DFCoord, std::vector<DFHack::t_feature *> > local_features;
bool have_local = Maps->ReadLocalFeatures(local_features);
bool have_global = Maps->ReadGlobalFeatures(global_features);
int32_t cursorX, cursorY, cursorZ; int32_t cursorX, cursorY, cursorZ;
Gui->getCursorCoords(cursorX,cursorY,cursorZ); Gui->getCursorCoords(cursorX,cursorY,cursorZ);
@ -172,26 +168,33 @@ int main (int numargs, const char ** args)
PRINT_FLAG( rained ); PRINT_FLAG( rained );
DFCoord pc(blockX, blockY); DFCoord pc(blockX, blockY);
PRINT_FLAG( feature_local );
if(have_features)
if( des.feature_local && have_local )
{ {
printf("%-16s %4d (%2d) %s\n", "", t_feature * local = 0;
block.local_feature, t_feature * global = 0;
local_features[pc][block.local_feature]->type, Maps->ReadFeatures(&(b->raw),&local,&global);
sa_feature(local_features[pc][block.local_feature]->type) PRINT_FLAG( feature_local );
); if(local)
{
printf("%-16s", "");
printf(" %4d", block.local_feature);
printf(" (%2d)", local->type);
printf(" %s\n", sa_feature(local->type));
}
PRINT_FLAG( feature_global );
if(global)
{
printf("%-16s", "");
printf(" %4d", block.global_feature);
printf(" (%2d)", global->type);
printf(" %s\n", sa_feature(global->type));
}
} }
else
PRINT_FLAG( feature_global );
if( des.feature_global && have_global )
{ {
printf("%-16s %4d (%2d) %s\n", "", PRINT_FLAG( feature_local );
block.global_feature, PRINT_FLAG( feature_global );
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 << "local feature idx: " << block.local_feature << endl;