One more vein type. No ready for use.

develop
Petr Mrázek 2011-02-27 20:43:44 +01:00
parent d033496b8e
commit c6a402c2b8
5 changed files with 71 additions and 12 deletions

@ -2033,6 +2033,10 @@
<Address name="current_tick" value="0xe2e180" /> maybe
<Address name="current_year" value="0xf0d268" />
<Address name="current_weather" value="0x15027A0" />
fortress = 0, adventure = 1, arena = 0 0xb4a814
Game mode: 0xb4a818 . fortress = 0, adventure = 1, arena = 4
0xe2e2a2 seems to be a copy of the first one
</Group>
<Group name="Translations" valid="true">
<Address name="language_vector" value="0x0171ea94 0x016e553c"/>

@ -68,7 +68,7 @@ namespace DFHack
int32_t type;
/// bit mask describing how the vein maps to the map block
/// assignment[y] & (1 << x) describes the tile (x, y) of the block
int16_t assignment[16];
int16_t assignment[16];
uint32_t flags;
/// this is NOT part of the DF vein, but an address of the vein as seen by DFhack.
uint32_t address_of;
@ -112,6 +112,18 @@ namespace DFHack
/// this is NOT part of the DF vein, but an address of the vein as seen by DFhack.
uint32_t address_of;
};
struct t_worldconstruction
{
uint32_t vtable;
/// material vector index
uint32_t material;
/// 16x16 array of bits
uint16_t assignment[16];
/// this is NOT part of the structure, but an address of it as seen by DFhack.
uint32_t address_of;
};
enum BiomeOffset
{
eNorthWest,
@ -431,7 +443,8 @@ namespace DFHack
std::vector<t_vein>* veins,
std::vector<t_frozenliquidvein>* ices = 0,
std::vector<t_spattervein>* splatter = 0,
std::vector<t_grassvein>* grass = 0
std::vector<t_grassvein>* grass = 0,
std::vector<t_worldconstruction>* constructions = 0
);
/// read all plants in this block
bool ReadVegetation(uint32_t x, uint32_t y, uint32_t z, std::vector<t_tree>* plants);

@ -151,6 +151,8 @@ Maps::Maps(DFContextShared* _d)
mem->resolveClassnameToVPtr("block_square_event_material_spatterst",off.vein_spatter_vptr);
off.vein_grass_vptr = 0;
mem->resolveClassnameToVPtr("block_square_event_grassst",off.vein_grass_vptr);
off.vein_worldconstruction_vptr = 0;
mem->resolveClassnameToVPtr("block_square_event_world_constructionst",off.vein_worldconstruction_vptr);
// upload offsets to SHM server if possible
d->maps_module = 0;
@ -547,13 +549,14 @@ bool Maps::WriteGlobalFeature(uint32_t x, uint32_t y, uint32_t z, int16_t global
/*
* Block events
*/
bool Maps::ReadVeins(uint32_t x, uint32_t y, uint32_t z, vector <t_vein>* veins, vector <t_frozenliquidvein>* ices, vector <t_spattervein> *splatter, vector <t_grassvein> *grass)
bool Maps::ReadVeins(uint32_t x, uint32_t y, uint32_t z, vector <t_vein>* veins, vector <t_frozenliquidvein>* ices, vector <t_spattervein> *splatter, vector <t_grassvein> *grass, vector <t_worldconstruction> *constructions)
{
MAPS_GUARD
t_vein v;
t_frozenliquidvein fv;
t_spattervein sv;
t_grassvein gv;
t_worldconstruction wcv;
Process* p = d->owner;
uint32_t addr = d->block[x*d->y_block_count*d->z_block_count + y*d->z_block_count + z];
@ -561,6 +564,7 @@ bool Maps::ReadVeins(uint32_t x, uint32_t y, uint32_t z, vector <t_vein>* veins,
if(ices) ices->clear();
if(splatter) splatter->clear();
if(grass) splatter->clear();
if(constructions) constructions->clear();
Server::Maps::maps_offsets &off = d->offsets;
if (addr)
@ -608,6 +612,14 @@ try_again:
// store it in the vector
grass->push_back (gv);
}
else if(constructions && type == off.vein_worldconstruction_vptr)
{
// read the splatter vein data (dereference pointer)
p->read (temp, sizeof(t_worldconstruction), (uint8_t *) &wcv);
wcv.address_of = temp;
// store it in the vector
constructions->push_back (wcv);
}
else
{
string cname = p->readClassName(type);
@ -631,12 +643,15 @@ try_again:
off.vein_grass_vptr = type;
goto try_again;
}
#ifdef DEBUG
else if(constructions && cname=="block_square_event_world_constructionst")
{
off.vein_worldconstruction_vptr = type;
goto try_again;
}
else
{
cerr << "unknown vein " << cname << endl;
cerr << "unknown vein " << cname << hex << " 0x" << temp << " block: 0x" << addr << dec << endl;
}
#endif
// or it was something we don't care about
}
}

@ -59,6 +59,7 @@ typedef struct
uint32_t vein_ice_vptr;
uint32_t vein_spatter_vptr;
uint32_t vein_grass_vptr;
uint32_t vein_worldconstruction_vptr;
/*
GEOLOGY
*/

@ -537,6 +537,7 @@ main(int argc, char *argv[])
vector<t_frozenliquidvein> IceVeinVector;
vector<t_spattervein> splatter;
vector<t_grassvein> grass;
vector<t_worldconstruction> wconstructs;
t_temperatures b_temp1;
t_temperatures b_temp2;
@ -784,7 +785,7 @@ main(int argc, char *argv[])
if(hasInorgMats)
do_features(DF, Block, cursorX, cursorY, 50,10, Mats->inorganic);
// read veins
Maps->ReadVeins(cursorX+i,cursorY+j,cursorZ,&veinVector,&IceVeinVector,&splatter,&grass);
Maps->ReadVeins(cursorX+i,cursorY+j,cursorZ,&veinVector,&IceVeinVector,&splatter,&grass, &wconstructs);
// get pointer to block
blockaddr = Maps->getBlockPtr(cursorX+i,cursorY+j,cursorZ);
@ -885,11 +886,12 @@ main(int argc, char *argv[])
uint32_t icesize = IceVeinVector.size();
uint32_t splattersize = splatter.size();
uint32_t grasssize = grass.size();
uint32_t totalVeinSize = mineralsize+ icesize + splattersize + grasssize;
uint32_t wconstrsize = wconstructs.size();
uint32_t totalVeinSize = mineralsize+ icesize + splattersize + grasssize + wconstrsize;
if(vein == totalVeinSize) vein = totalVeinSize - 1;
if(vein < -1) vein = -1;
cprintf("X %d/%d, Y %d/%d, Z %d/%d. Vein %d of %d",cursorX+1,x_max,cursorY+1,y_max,cursorZ,z_max,vein+1,totalVeinSize);
if(!veinVector.empty() || !IceVeinVector.empty() || !splatter.empty() || !grass.empty())
if(!veinVector.empty() || !IceVeinVector.empty() || !splatter.empty() || !grass.empty() || !wconstructs.empty())
{
if(vein != -1 && vein < totalVeinSize)
{
@ -968,7 +970,7 @@ main(int argc, char *argv[])
cprintf("Spatter: %s",PrintSplatterType(splatter[realvein].mat1,splatter[realvein].mat2,Mats->race).c_str());
}
}
else
else if(vein < mineralsize + icesize + splattersize + grasssize)
{
realvein = vein - mineralsize - icesize - splattersize;
t_grassvein & grassy =grass[realvein];
@ -985,8 +987,32 @@ main(int argc, char *argv[])
}
}
}
gotoxy(50,3);
cprintf("Grass: 0x%x, %s",grassy.address_of, Mats->organic[grassy.material].id);
if(hasPlantMats)
{
gotoxy(50,3);
cprintf("Grass: 0x%x, %s",grassy.address_of, Mats->organic[grassy.material].id);
}
}
else
{
realvein = vein - mineralsize - icesize - splattersize - grasssize;
t_worldconstruction & wconstr=wconstructs[realvein];
for(uint32_t j = 0; j < 16; j++)
{
for(uint32_t k = 0; k < 16; k++)
{
bool set = !!(((1 << k) & wconstr.assignment[j]) >> k);
if(set)
{
putch(k+16,j+16,'$',COLOR_RED);
}
}
}
if(hasInorgMats)
{
gotoxy(50,3);
cprintf("Road: 0x%x, %d - %s", wconstr.address_of, wconstr.material,Mats->inorganic[wconstr.material].id);
}
}
}
}