Merge commit 'origin' into bartavelle

develop
simon 2010-04-20 11:48:48 +02:00
commit ae01bfe18e
4 changed files with 308 additions and 137 deletions

@ -417,75 +417,75 @@ namespace DFHack
{0 ,EMPTY, AIR, VAR_1}, {0 ,EMPTY, AIR, VAR_1},
{"glowing floor" ,FLOOR, CYAN_GLOW, VAR_1}, {"glowing floor" ,FLOOR, CYAN_GLOW, VAR_1},
{0 ,EMPTY, AIR, VAR_1}, {0 ,EMPTY, AIR, VAR_1},
{"smooth obsidian wall",WALL,OBSIDIAN,VAR_1}, {"smooth obsidian wall RD2",WALL,OBSIDIAN,VAR_1},
// 270 // 270
{"smooth obsidian wall",WALL,OBSIDIAN,VAR_1}, {"smooth obsidian wall R2D",WALL,OBSIDIAN,VAR_1},
{"smooth obsidian wall",WALL,OBSIDIAN,VAR_1}, {"smooth obsidian wall R2U",WALL,OBSIDIAN,VAR_1},
{"smooth obsidian wall",WALL,OBSIDIAN,VAR_1}, {"smooth obsidian wall RU2",WALL,OBSIDIAN,VAR_1},
{"smooth obsidian wall",WALL,OBSIDIAN,VAR_1}, {"smooth obsidian wall L2U",WALL,OBSIDIAN,VAR_1},
{"smooth obsidian wall",WALL,OBSIDIAN,VAR_1}, {"smooth obsidian wall LU2",WALL,OBSIDIAN,VAR_1},
{"smooth obsidian wall",WALL,OBSIDIAN,VAR_1}, {"smooth obsidian wall L2D",WALL,OBSIDIAN,VAR_1},
{"smooth obsidian wall",WALL,OBSIDIAN,VAR_1}, {"smooth obsidian wall LD2",WALL,OBSIDIAN,VAR_1},
{"smooth obsidian wall",WALL,OBSIDIAN,VAR_1}, {"smooth obsidian wall LRUD",WALL,OBSIDIAN,VAR_1},
{"smooth obsidian wall",WALL,OBSIDIAN,VAR_1}, {"smooth obsidian wall RUD",WALL,OBSIDIAN,VAR_1},
{"smooth obsidian wall",WALL,OBSIDIAN,VAR_1}, {"smooth obsidian wall LRD",WALL,OBSIDIAN,VAR_1},
// 280 // 280
{"smooth obsidian wall",WALL,OBSIDIAN,VAR_1}, {"smooth obsidian wall LRU",WALL,OBSIDIAN,VAR_1},
{"smooth obsidian wall",WALL,OBSIDIAN,VAR_1}, {"smooth obsidian wall LUD",WALL,OBSIDIAN,VAR_1},
{"smooth obsidian wall",WALL,OBSIDIAN,VAR_1}, {"smooth obsidian wall RD",WALL,OBSIDIAN,VAR_1},
{"smooth obsidian wall",WALL,OBSIDIAN,VAR_1}, {"smooth obsidian wall RU",WALL,OBSIDIAN,VAR_1},
{"smooth obsidian wall",WALL,OBSIDIAN,VAR_1}, {"smooth obsidian wall LU",WALL,OBSIDIAN,VAR_1},
{"smooth obsidian wall",WALL,OBSIDIAN,VAR_1}, {"smooth obsidian wall LD",WALL,OBSIDIAN,VAR_1},
{"smooth obsidian wall",WALL,OBSIDIAN,VAR_1}, {"smooth obsidian wall UD",WALL,OBSIDIAN,VAR_1},
{"smooth obsidian wall",WALL,OBSIDIAN,VAR_1}, {"smooth obsidian wall LR",WALL,OBSIDIAN,VAR_1},
{"smooth featstone? wall",WALL,FEATSTONE,VAR_1}, {"smooth featstone wall RD2",WALL,FEATSTONE,VAR_1},
{"smooth featstone? wall",WALL,FEATSTONE,VAR_1}, {"smooth featstone wall R2D",WALL,FEATSTONE,VAR_1},
// 290 // 290
{"smooth featstone? wall",WALL,FEATSTONE,VAR_1}, {"smooth featstone wall R2U",WALL,FEATSTONE,VAR_1},
{"smooth featstone? wall",WALL,FEATSTONE,VAR_1}, {"smooth featstone wall RU2",WALL,FEATSTONE,VAR_1},
{"smooth featstone? wall",WALL,FEATSTONE,VAR_1}, {"smooth featstone wall L2U",WALL,FEATSTONE,VAR_1},
{"smooth featstone? wall",WALL,FEATSTONE,VAR_1}, {"smooth featstone wall LU2",WALL,FEATSTONE,VAR_1},
{"smooth featstone? wall",WALL,FEATSTONE,VAR_1}, {"smooth featstone wall L2D",WALL,FEATSTONE,VAR_1},
{"smooth featstone? wall",WALL,FEATSTONE,VAR_1}, {"smooth featstone wall LD2",WALL,FEATSTONE,VAR_1},
{"smooth featstone? wall",WALL,FEATSTONE,VAR_1}, {"smooth featstone wall LRUD",WALL,FEATSTONE,VAR_1},
{"smooth featstone? wall",WALL,FEATSTONE,VAR_1}, {"smooth featstone wall RUD",WALL,FEATSTONE,VAR_1},
{"smooth featstone? wall",WALL,FEATSTONE,VAR_1}, {"smooth featstone wall LRD",WALL,FEATSTONE,VAR_1},
{"smooth featstone? wall",WALL,FEATSTONE,VAR_1}, {"smooth featstone wall LRU",WALL,FEATSTONE,VAR_1},
//300 //300
{"smooth featstone? wall",WALL,FEATSTONE,VAR_1}, {"smooth featstone wall LUD",WALL,FEATSTONE,VAR_1},
{"smooth featstone? wall",WALL,FEATSTONE,VAR_1}, {"smooth featstone wall RD",WALL,FEATSTONE,VAR_1},
{"smooth featstone? wall",WALL,FEATSTONE,VAR_1}, {"smooth featstone wall RU",WALL,FEATSTONE,VAR_1},
{"smooth featstone? wall",WALL,FEATSTONE,VAR_1}, {"smooth featstone wall LU",WALL,FEATSTONE,VAR_1},
{"smooth featstone? wall",WALL,FEATSTONE,VAR_1}, {"smooth featstone wall LD",WALL,FEATSTONE,VAR_1},
{"smooth featstone? wall",WALL,FEATSTONE,VAR_1}, {"smooth featstone wall UD",WALL,FEATSTONE,VAR_1},
{"smooth featstone? wall",WALL,FEATSTONE,VAR_1}, {"smooth featstone wall LR",WALL,FEATSTONE,VAR_1},
{"smooth stone wall",WALL,STONE,VAR_1}, {"smooth stone wall RD2",WALL,STONE,VAR_1},
{"smooth stone wall",WALL,STONE,VAR_1}, {"smooth stone wall R2D",WALL,STONE,VAR_1},
{"smooth stone wall",WALL,STONE,VAR_1}, {"smooth stone wall R2U",WALL,STONE,VAR_1},
//310 //310
{"smooth stone wall",WALL,STONE,VAR_1}, {"smooth stone wall RU2",WALL,STONE,VAR_1},
{"smooth stone wall",WALL,STONE,VAR_1}, {"smooth stone wall L2U",WALL,STONE,VAR_1},
{"smooth stone wall",WALL,STONE,VAR_1}, {"smooth stone wall LU2",WALL,STONE,VAR_1},
{"smooth stone wall",WALL,STONE,VAR_1}, {"smooth stone wall L2D",WALL,STONE,VAR_1},
{"smooth stone wall",WALL,STONE,VAR_1}, {"smooth stone wall LD2",WALL,STONE,VAR_1},
{"smooth stone wall",WALL,STONE,VAR_1}, {"smooth stone wall LRUD",WALL,STONE,VAR_1},
{"smooth stone wall",WALL,STONE,VAR_1}, {"smooth stone wall RUD",WALL,STONE,VAR_1},
{"smooth stone wall",WALL,STONE,VAR_1}, {"smooth stone wall LRD",WALL,STONE,VAR_1},
{"smooth stone wall",WALL,STONE,VAR_1}, {"smooth stone wall LRU",WALL,STONE,VAR_1},
{"smooth stone wall",WALL,STONE,VAR_1}, {"smooth stone wall LUD",WALL,STONE,VAR_1},
//320 //320
{"smooth stone wall",WALL,STONE,VAR_1}, {"smooth stone wall RD",WALL,STONE,VAR_1},
{"smooth stone wall",WALL,STONE,VAR_1}, {"smooth stone wall RU",WALL,STONE,VAR_1},
{"smooth stone wall",WALL,STONE,VAR_1}, {"smooth stone wall LU",WALL,STONE,VAR_1},
{"smooth stone wall",WALL,STONE,VAR_1}, {"smooth stone wall LD",WALL,STONE,VAR_1},
{"smooth stone wall",WALL,STONE,VAR_1}, {"smooth stone wall UD",WALL,STONE,VAR_1},
{"smooth stone wall",WALL,STONE,VAR_1}, {"smooth stone wall LR",WALL,STONE,VAR_1},
{"obsidian fortification",FORTIFICATION,OBSIDIAN,VAR_1}, {"obsidian fortification",FORTIFICATION,OBSIDIAN,VAR_1},
{"featstone? fortification",FORTIFICATION,FEATSTONE,VAR_1}, {"featstone? fortification",FORTIFICATION,FEATSTONE,VAR_1},
{"cracked obsidian wall",WALL,OBSIDIAN,VAR_1}, {"cracked obsidian wall",WALL,OBSIDIAN,VAR_1},
@ -494,10 +494,14 @@ namespace DFHack
// 330 // 330
{"worn obsidian wall",WALL,OBSIDIAN,VAR_1}, {"worn obsidian wall",WALL,OBSIDIAN,VAR_1},
{"obsidian wall",WALL,OBSIDIAN,VAR_1}, {"obsidian wall",WALL,OBSIDIAN,VAR_1},
{"cracked stone wall",WALL,STONE,VAR_1}, /*MAPTILE_FEATSTONE_WALL_WORN1,
{"damaged stone wall",WALL,STONE,VAR_1}, MAPTILE_FEATSTONE_WALL_WORN2,
{"worn stone wall",WALL,STONE,VAR_1}, MAPTILE_FEATSTONE_WALL_WORN3,
{"stone wall",WALL,STONE,VAR_1}, MAPTILE_FEATSTONE_WALL,*/
{"cracked featstone wall",WALL,STONE,VAR_1},
{"damaged featstone wall",WALL,STONE,VAR_1},
{"worn featstone wall",WALL,STONE,VAR_1},
{"featstone wall",WALL,STONE,VAR_1},
{"stone floor",FLOOR,STONE,VAR_1}, {"stone floor",FLOOR,STONE,VAR_1},
{"stone floor",FLOOR,STONE,VAR_2}, {"stone floor",FLOOR,STONE,VAR_2},
{"stone floor",FLOOR,STONE,VAR_3}, {"stone floor",FLOOR,STONE,VAR_3},
@ -508,16 +512,16 @@ namespace DFHack
{"obsidian floor",FLOOR,OBSIDIAN,VAR_2}, {"obsidian floor",FLOOR,OBSIDIAN,VAR_2},
{"obsidian floor",FLOOR,OBSIDIAN,VAR_3}, {"obsidian floor",FLOOR,OBSIDIAN,VAR_3},
{"obsidian floor",FLOOR,OBSIDIAN,VAR_4}, {"obsidian floor",FLOOR,OBSIDIAN,VAR_4},
{"featstone? floor",FLOOR,FEATSTONE,VAR_1}, {"featstone floor 1",FLOOR,FEATSTONE,VAR_1},
{"featstone? floor",FLOOR,FEATSTONE,VAR_2}, {"featstone floor 2",FLOOR,FEATSTONE,VAR_2},
{"featstone? floor",FLOOR,FEATSTONE,VAR_3}, {"featstone floor 3",FLOOR,FEATSTONE,VAR_3},
{"featstone? floor",FLOOR,FEATSTONE,VAR_4}, {"featstone floor 4",FLOOR,FEATSTONE,VAR_4},
{"grass",FLOOR,GRASS,VAR_1}, {"grass 1",FLOOR,GRASS,VAR_1},
{"grass",FLOOR,GRASS,VAR_2}, {"grass 2",FLOOR,GRASS,VAR_2},
// 350 // 350
{"grass",FLOOR,GRASS,VAR_3}, {"grass 3",FLOOR,GRASS,VAR_3},
{"grass",FLOOR,GRASS,VAR_4}, {"grass 4",FLOOR,GRASS,VAR_4},
{"soil floor",FLOOR,SOIL,VAR_1}, {"soil floor",FLOOR,SOIL,VAR_1},
{"soil floor",FLOOR,SOIL,VAR_2}, {"soil floor",FLOOR,SOIL,VAR_2},
{"soil floor",FLOOR,SOIL,VAR_3}, {"soil floor",FLOOR,SOIL,VAR_3},
@ -533,58 +537,58 @@ namespace DFHack
{"damaged ice wall",WALL,ICE,VAR_1}, {"damaged ice wall",WALL,ICE,VAR_1},
{"worn ice wall",WALL,ICE,VAR_1}, {"worn ice wall",WALL,ICE,VAR_1},
{"ice wall",WALL,ICE,VAR_1}, {"ice wall",WALL,ICE,VAR_1},
{"river",FLOOR,SOIL,VAR_1}, {"river N",FLOOR,SOIL,VAR_1},
{"river",FLOOR,SOIL,VAR_1}, {"river S",FLOOR,SOIL,VAR_1},
{"river",FLOOR,SOIL,VAR_1}, {"river E",FLOOR,SOIL,VAR_1},
{"river",FLOOR,SOIL,VAR_1}, {"river W",FLOOR,SOIL,VAR_1},
{"river",FLOOR,SOIL,VAR_1}, {"river NW",FLOOR,SOIL,VAR_1},
//370 //370
{"river",FLOOR,SOIL,VAR_1}, {"river NE",FLOOR,SOIL,VAR_1},
{"river",FLOOR,SOIL,VAR_1}, {"river SW",FLOOR,SOIL,VAR_1},
{"river",FLOOR,SOIL,VAR_1}, {"river SE",FLOOR,SOIL,VAR_1},
{"stream",FLOOR,SOIL,VAR_1}, {"stream bed N",FLOOR,SOIL,VAR_1},
{"stream",FLOOR,SOIL,VAR_1}, {"stream bed S",FLOOR,SOIL,VAR_1},
{"stream",FLOOR,SOIL,VAR_1}, {"stream bed E",FLOOR,SOIL,VAR_1},
{"stream",FLOOR,SOIL,VAR_1}, {"stream bed W",FLOOR,SOIL,VAR_1},
{"stream",FLOOR,SOIL,VAR_1}, {"stream bed NW",FLOOR,SOIL,VAR_1},
{"stream",FLOOR,SOIL,VAR_1}, {"stream bed NE",FLOOR,SOIL,VAR_1},
{"stream",FLOOR,SOIL,VAR_1}, {"stream bed SW",FLOOR,SOIL,VAR_1},
// 380 // 380
{"stream",FLOOR,SOIL,VAR_1}, {"stream bed SE",FLOOR,SOIL,VAR_1},
{"stream top",FLOOR,SOIL,VAR_1}, {"stream top",FLOOR,SOIL,VAR_1},
{0 ,EMPTY, AIR, VAR_1}, {0 ,EMPTY, AIR, VAR_1},
{0 ,EMPTY, AIR, VAR_1}, {0 ,EMPTY, AIR, VAR_1},
{0 ,EMPTY, AIR, VAR_1}, {0 ,EMPTY, AIR, VAR_1},
{0 ,EMPTY, AIR, VAR_1}, {0 ,EMPTY, AIR, VAR_1},
{0 ,EMPTY, AIR, VAR_1}, {0 ,EMPTY, AIR, VAR_1},
{"dry grass",FLOOR,GRASS_DRY,VAR_1}, {"dry grass 1",FLOOR,GRASS_DRY,VAR_1},
{"dry grass",FLOOR,GRASS_DRY,VAR_2}, {"dry grass 2",FLOOR,GRASS_DRY,VAR_2},
{"dry grass",FLOOR,GRASS_DRY,VAR_3}, {"dry grass 3",FLOOR,GRASS_DRY,VAR_3},
// 390 // 390
{"dry grass",FLOOR,GRASS_DRY,VAR_4}, {"dry grass 4",FLOOR,GRASS_DRY,VAR_4},
{"dead tree",TREE_DEAD,SOIL,VAR_1}, {"dead tree",TREE_DEAD,SOIL,VAR_1},
{"dead sapling",SAPLING_DEAD,SOIL,VAR_1}, {"dead sapling",SAPLING_DEAD,SOIL,VAR_1},
{"dead shrub",SHRUB_DEAD,SOIL,VAR_1}, {"dead shrub",SHRUB_DEAD,SOIL,VAR_1},
{"dead grass",FLOOR,GRASS_DEAD,VAR_1}, {"dead grass 1",FLOOR,GRASS_DEAD,VAR_1},
{"dead grass",FLOOR,GRASS_DEAD,VAR_2}, {"dead grass 2",FLOOR,GRASS_DEAD,VAR_2},
{"dead grass",FLOOR,GRASS_DEAD,VAR_3}, {"dead grass 3",FLOOR,GRASS_DEAD,VAR_3},
{"dead grass",FLOOR,GRASS_DEAD,VAR_4}, {"dead grass 4",FLOOR,GRASS_DEAD,VAR_4},
{"grass",FLOOR,GRASS2,VAR_1}, {"grass B1",FLOOR,GRASS2,VAR_1},
{"grass",FLOOR,GRASS2,VAR_2}, {"grass B2",FLOOR,GRASS2,VAR_2},
// 400 // 400
{"grass",FLOOR,GRASS2,VAR_3}, {"grass B3",FLOOR,GRASS2,VAR_3},
{"grass",FLOOR,GRASS2,VAR_4}, {"grass B4",FLOOR,GRASS2,VAR_4},
{"boulder",BOULDER,STONE,VAR_1}, {"boulder",BOULDER,STONE,VAR_1},
{"obsidian boulder",BOULDER,OBSIDIAN,VAR_1}, {"obsidian boulder",BOULDER,OBSIDIAN,VAR_1},
{"featstone? boulder",BOULDER,FEATSTONE,VAR_1}, {"featstone? boulder",BOULDER,FEATSTONE,VAR_1},
{"pebbles",PEBBLES,STONE,VAR_1}, {"pebbles 1",PEBBLES,STONE,VAR_1},
{"pebbles",PEBBLES,STONE,VAR_2}, {"pebbles 2",PEBBLES,STONE,VAR_2},
{"pebbles",PEBBLES,STONE,VAR_3}, {"pebbles 3",PEBBLES,STONE,VAR_3},
{"pebbles",PEBBLES,STONE,VAR_4}, {"pebbles 4",PEBBLES,STONE,VAR_4},
{"obsidian shards",PEBBLES,OBSIDIAN,VAR_1}, {"obsidian shards",PEBBLES,OBSIDIAN,VAR_1},
// 410 // 410

@ -114,9 +114,10 @@ namespace DFHack
e_traffic traffic : 2; // needs enum e_traffic traffic : 2; // needs enum
unsigned int flow_forbid : 1; // what? unsigned int flow_forbid : 1; // what?
unsigned int liquid_static : 1; unsigned int liquid_static : 1;
unsigned int moss : 1;// I LOVE MOSS unsigned int feature_type_1 : 1; // this tile is a part of a feature
unsigned int feature_present : 1; // another wtf... is this required for magma pipes to work? unsigned int feature_type_2 : 1; // this tile is a part of a feature
unsigned int liquid_character : 2; // those ripples on streams? unsigned int liquid_character : 2; // those ripples on streams?
}; };
union t_designation union t_designation

@ -22,9 +22,76 @@ using namespace std;
#include <modules/Maps.h> #include <modules/Maps.h>
#include <modules/Constructions.h> #include <modules/Constructions.h>
#include "miscutils.h" #include "miscutils.h"
#include <DFTileTypes.h>
using namespace DFHack; using namespace DFHack;
/*
int __userpurge get_feature_at<eax>(__int16 tZ<ax>, __int16 tY<cx>, int world_base<ebx>, signed __int16 tX)
{
int block; // ebp@1
signed __int16 __tX; // di@1
signed int _tY; // esi@1
int designation; // eax@2
int _tX; // ecx@2
signed int v9; // eax@4
int v10; // edx@4
__int64 region_x_local; // qax@4
__int16 v12; // cx@4
__int16 v13; // ax@5
int v14; // esi@5
int result; // eax@7
unsigned int some_stuff; // ebp@10
int v17; // edx@11
int _designation; // [sp+10h] [bp+4h]@2
__tX = tX;
LOWORD(_tY) = tY;
block = getBlock(world_base, tX, tY, tZ);
if ( !block )
goto LABEL_17;
_tX = tX;
_tY = (signed __int16)_tY;
designation = *(_DWORD *)(block + 0x29C + 4 * ((signed __int16)_tY % 16 + 16 * tX % 16));
_designation = designation;
if ( designation & 0x10000000 && *(_WORD *)(block + 0x2C) != -1 )// first feature_present bit - adamantine
{
region_x_local = __tX / 48 + *(_DWORD *)(world_base + 0x525C8);// tile_x / 48 + region_x
v12 = ((BYTE4(region_x_local) & 0xF) + (_DWORD)region_x_local) >> 4;
WORD2(region_x_local) = (_tY / 48 + *(_DWORD *)(world_base + 0x525CC)) / 16;// tile_y / 48 + region_y
v9 = v12;
_tX = SWORD2(region_x_local);
v10 = *(_DWORD *)(*(_DWORD *)(*(_DWORD *)(world_base + 0x54440) + 4 * (v9 >> 4))
+ 16 * (SWORD2(region_x_local) >> 4)
+ 4);
if ( v10 )
{
_tX %= 16;
v14 = v10 + 24 * ((signed __int16)_tX + 16 * v9 % 16);
v13 = *(_WORD *)(block + 0x2C);
if ( v13 >= 0 )
{
_tX = (*(_DWORD *)(v14 + 16) - *(_DWORD *)(v14 + 12)) >> 2;
if ( v13 < (unsigned int)_tX )
return *(_DWORD *)sub_519100(_tX, v10);
}
}
designation = _designation;
}
if ( designation & 0x20000000 && (some_stuff = *(_DWORD *)(block + 0x30), some_stuff != -1) )// second feature_present bit - slade and hell
{
v17 = (*(_DWORD *)(world_base + 0x54384) - *(_DWORD *)(world_base + 0x54380)) >> 2;
if ( some_stuff >= v17 )
_invalid_parameter_noinfo(_tX, v17);
result = *(_DWORD *)(*(_DWORD *)(*(_DWORD *)(world_base + 0x54380) + 4 * some_stuff) + 0x100);
}
else
{
LABEL_17:
result = 0;
}
return result;
}
*/
int main (int numargs, const char ** args) int main (int numargs, const char ** args)
{ {
DFHack::API DF("Memory.xml"); DFHack::API DF("Memory.xml");
@ -40,46 +107,127 @@ int main (int numargs, const char ** args)
#endif #endif
return 1; return 1;
} }
/*
DFHack::Position *Pos = DF.getPosition();
DFHack::Position *Pos = DF.getPosition();
DFHack::memory_info* mem = DF.getMemoryInfo();
DFHack::Maps *Maps = DF.getMaps(); DFHack::Maps *Maps = DF.getMaps();
DFHack::Process * p = DF.getProcess();
uint32_t designatus = mem->getOffset("map_data_designation");
uint32_t block_feature1 = mem->getOffset("map_data_feature1");
uint32_t block_feature2 = mem->getOffset("map_data_feature2");
uint32_t region_x_offset = mem->getAddress("region_x");
uint32_t region_y_offset = mem->getAddress("region_y");
uint32_t region_z_offset = mem->getAddress("region_z");
uint32_t feature1_start_ptr = mem->getAddress("feature1_start_ptr");
uint32_t regionX, regionY, regionZ;
// read position of the region inside DF world
p->readDWord (region_x_offset, regionX);
p->readDWord (region_y_offset, regionY);
p->readDWord (region_z_offset, regionZ);
Maps->Start(); Maps->Start();
int32_t cx, cy, cz; int32_t cursorX, cursorY, cursorZ;
Pos->getCursorCoords(cx,cy,cz); Pos->getCursorCoords(cursorX,cursorY,cursorZ);
if(cx != -30000) if(cursorX != -30000)
{ {
uint32_t bx = cx / 16; uint32_t blockX = cursorX / 16;
uint32_t tx = cx % 16; uint32_t tileX = cursorX % 16;
uint32_t by = cy / 16; uint32_t blockY = cursorY / 16;
uint32_t ty = cy % 16; uint32_t tileY = cursorY % 16;
mapblock40d block; mapblock40d block;
if(Maps->ReadBlock40d(bx,by,cz,&block)) if(Maps->ReadBlock40d(blockX,blockY,cursorZ,&block))
{ {
int16_t tiletype = block.tiletypes[tx][ty]; printf("block addr: 0x%x\n", block.origin);
cout << tiletype << endl; int16_t tiletype = block.tiletypes[tileX][tileY];
} naked_designation &des = block.designation[tileX][tileY].bits;
} uint32_t &desw = block.designation[tileX][tileY].whole;
*/ print_bits<uint32_t>(block.designation[tileX][tileY].whole,cout);
vector <string> classIdStrings; cout << endl;
DFHack::memory_info * minfo = DF.getMemoryInfo(); print_bits<uint32_t>(block.occupancy[tileX][tileY].whole,cout);
if(!minfo) cout << endl;
{ // tiletype
cerr <<"FAIL!" << endl; cout <<"tiletype: " << tiletype;
return 1; if(tileTypeTable[tiletype].name)
} cout << " = " << tileTypeTable[tiletype].name;
for(int i = 0; ; i++) cout << endl;
{ // features present
string temp; if(des.feature_type_1)
if(!minfo->resolveClassIDToClassname(i, temp)) {
{ cout << "feature type 1 present: " << p->readDWord(block.origin + block_feature1) << endl;
break; int32_t idx = p->readDWord(block.origin + block_feature1);
if(idx != -1)
{
uint64_t region_x_local = cursorX / 48 + regionX;
// blah, dumb disassembly. too tired to think
uint16_t v12 = ((region_x_local % 16) + region_x_local) / 16;
uint64_t region_y_local = (cursorY / 48 + regionY) / 16;
// deref pointer to the humongo-structure
uint32_t base = p->readDWord(feature1_start_ptr);
// this is just a few pointers to arrays of 16B (4 DWORD) structs
uint32_t array_elem = p->readDWord(base + (v12 / 16) * 4);
// second element of the struct is a pointer
uint32_t wtf = p->readDWord(array_elem + (16*(region_y_local/16)) + 4);
if(wtf)
{
uint32_t feat_vector = wtf + 24 * (region_y_local % 16);
DfVector<uint32_t> p_features(p, feat_vector);
printf("feature addr: 0x%x\n", p_features[idx]);
string name = p->readClassName(p->readDWord( p_features[idx] ));
cout << name << endl;
}
}
}
if(des.feature_type_2)
{
int32_t idx = p->readDWord(block.origin + block_feature2);
cout << "feature type 2 present: " << idx << endl;
if(idx != -1)
{
DfVector<uint32_t> p_features (p,mem->getAddress("feature2_vector"));
if(idx < p_features.size())
{
uint32_t feat_ptr = p->readDWord(p_features[idx] + mem->getOffset("feature2_funcptr_"));
printf("feature descriptor?: 0x%x\n", feat_ptr);
string name = p->readClassName(p->readDWord( feat_ptr));
cout << name << endl;
}
}
}
// biome, geolayer
cout << "biome: " << des.biome << endl;
cout << "geolayer: " << des.geolayer_index << endl;
// liquids
if(des.flow_size)
{
if(des.liquid_type == DFHack::liquid_magma)
cout <<"magma: ";
else cout <<"water: ";
cout << des.flow_size << endl;
}
if(des.flow_forbid)
cout << "flow forbid" << endl;
if(des.pile)
cout << "stockpile?" << endl;
if(des.rained)
cout << "rained?" << endl;
if(des.smooth)
cout << "smooth?" << endl;
uint32_t designato = block.origin + designatus + (tileX * 16 + tileY) * sizeof(t_designation);
printf("designation offset: 0x%x\n", designato);
/*
block.designation[tx][ty].bits.moss = 1;
block.designation[tx][ty].bits.geolayer_index = 15;
block.tiletypes[tx][ty] = 344;
print_bits<uint32_t>(block.designation[tx][ty].whole,cout);
Maps->WriteDesignations(bx,by,cz,&(block.designation));
Maps->WriteTileTypes(bx,by,cz,&(block.tiletypes));
*/
} }
classIdStrings.push_back(temp);
} }
for (int i = 0; i < classIdStrings.size(); i++)
cout << i << ": " << classIdStrings[i] << endl;
#ifndef LINUX_BUILD #ifndef LINUX_BUILD
cout << "Done. Press any key to continue" << endl; cout << "Done. Press any key to continue" << endl;
cin.ignore(); cin.ignore();

@ -1061,6 +1061,15 @@ size=212
<Offset name="map_data_temperature2_offset">0x179c</Offset> <Offset name="map_data_temperature2_offset">0x179c</Offset>
<Offset name="map_data_biome_stuffs">0x1D9C</Offset> <Offset name="map_data_biome_stuffs">0x1D9C</Offset>
<Offset name="map_data_pathfinding_offset">0x0D9c</Offset> <Offset name="map_data_pathfinding_offset">0x0D9c</Offset>
<Offset name="map_data_feature1">0x2C</Offset> adamantine?
<Offset name="map_data_feature2">0x30</Offset> hell?
WORLD + 0x54374
<Address name="feature2_vector">0x16AF4FC</Address>
<Offset name= "feature2_funcptr_">0x100</Offset>
WORLD + 0x54440
<Address name="feature1_start_ptr">0x16AF5C8</Address>
<!-- <!--
map_data_map_x_offset 0x0058 map_data_map_x_offset 0x0058
map_data_map_y_offset 0x005A map_data_map_y_offset 0x005A
@ -1088,8 +1097,11 @@ map_data_1b60_offset 0x1B9c
<Address name="z_count">0x016ad74C</Address> <Address name="z_count">0x016ad74C</Address>
* Suspected region coords * * Suspected region coords *
WORLD + 0x525C8
<Address name="region_x">0x016ad750</Address> <Address name="region_x">0x016ad750</Address>
WORLD + 0x525CC
<Address name="region_y">0x016ad754</Address> <Address name="region_y">0x016ad754</Address>
WORLD + 0x525D0
<Address name="region_z">0x016ad758</Address> <Address name="region_z">0x016ad758</Address>
* World size * (WORDs) * World size * (WORDs)
@ -1135,7 +1147,7 @@ map_data_1b60_offset 0x1B9c
<Offset name="creature_flags2">0xFC</Offset> <Offset name="creature_flags2">0xFC</Offset>
<Offset name="creature_sex">0x110</Offset> <Offset name="creature_sex">0x110</Offset>
<Offset name="creature_id">0x114</Offset> <Offset name="creature_id">0x114</Offset>
<Offset name="creature_civ">0X120</Offset> <Offset name="creature_civ">0X120</Offset>
<Offset name="creature_soulskill_vector">0X1F4</Offset> <Offset name="creature_soulskill_vector">0X1F4</Offset>
<Offset name="creature_pickup_equipment_bit">0X21C</Offset> <Offset name="creature_pickup_equipment_bit">0X21C</Offset>
<Offset name="creature_mood">0x238</Offset> <Offset name="creature_mood">0x238</Offset>
@ -1201,8 +1213,8 @@ map_data_1b60_offset 0x1B9c
WORLD + 0x54CD0 WORLD + 0x54CD0
<Address name="creature_type_vector">0x016AFE58</Address> <Address name="creature_type_vector">0x016AFE58</Address>
<Offset name="creature_type_caste_vector">0x138</Offset> <Offset name="creature_type_caste_vector">0x138</Offset>
<Offset name="creature_tile">0xE0</Offset> <Offset name="creature_tile">0xE0</Offset>
<Offset name="creature_tile_color">0xF6</Offset> <Offset name="creature_tile_color">0xF6</Offset>
<!-- <!--
NOT used yet NOT used yet
@ -1363,6 +1375,11 @@ map_data_1b60_offset 0x1B9c
<Address name="geoblock_vector">0x16B0574</Address> <Address name="geoblock_vector">0x16B0574</Address>
<Address name="ptr2_region_array">0x16B05BC</Address> <Address name="ptr2_region_array">0x16B05BC</Address>
* features *
WORLD + 0x54374
<Address name="feature2_vector">0x16B0544</Address>
<Address name="feature1_start_ptr">0x16B0610</Address>
Creatures Creatures
========= =========
<Address name="creature_vector">0x166FD0C</Address> <Address name="creature_vector">0x166FD0C</Address>
@ -1397,6 +1414,7 @@ map_data_1b60_offset 0x1B9c
<Offset name="creature_default_soul">0x0758</Offset> <Offset name="creature_default_soul">0x0758</Offset>
<Offset name="creature_happiness">0x834</Offset> <Offset name="creature_happiness">0x834</Offset>
Materials Materials
========= =========
soil, stone, metal soil, stone, metal