added more information to probe.

added pit-with-floor option to hellhole.
bug fixes for the fake magma pipe in hellhole.
develop
zilpin 2010-10-20 12:31:16 -04:00
parent d16618afe1
commit 92d0468694
3 changed files with 157 additions and 69 deletions

@ -997,6 +997,7 @@ namespace DFHack
if( tclass == tileTypeTable[tt].c ){ if( tclass == tileTypeTable[tt].c ){
//shortcut null entries //shortcut null entries
if(!tileTypeTable[tt].name) continue; if(!tileTypeTable[tt].name) continue;
//Special flag match is absolutely mandatory! //Special flag match is absolutely mandatory!
if( source->s != tileTypeTable[tt].s ) continue; if( source->s != tileTypeTable[tt].s ) continue;

@ -39,6 +39,7 @@ void waitmsec (int delay)
#define PITTYPEMACRO \ #define PITTYPEMACRO \
X(pitTypeChasm,"Bottomless Chasm" ) \ X(pitTypeChasm,"Bottomless Chasm" ) \
X(pitTypeEerie,"Bottomless Eerie Pit" ) \ X(pitTypeEerie,"Bottomless Eerie Pit" ) \
X(pitTypeFloor,"Pit with a floor" ) \
X(pitTypeMagma,"Magma Pit (similar to volcanoe, no hell access)" ) X(pitTypeMagma,"Magma Pit (similar to volcanoe, no hell access)" )
//end PITTYPEMACRO //end PITTYPEMACRO
@ -208,13 +209,13 @@ int main (void)
//Hole Diameter //Hole Diameter
int holeradius=6; int holeradius=6;
if( pitTypeInvalid != pittype && pitTypeMagma != pittype ){ if( pitTypeInvalid != pittype ){
holeradius = getint( "Enter hole radius, 0 to 8", 0, 8, holeradius ); holeradius = getint( "Enter hole radius, 0 to 8", 0, 8, holeradius );
} }
//Wall thickness //Wall thickness
int wallthickness=1; int wallthickness=1;
if( pitTypeInvalid != pittype && pitTypeMagma != pittype ){ if( pitTypeInvalid != pittype ){
wallthickness = getint( "Enter wall thickness, 0 to 8", 0, 8, wallthickness ); wallthickness = getint( "Enter wall thickness, 0 to 8", 0, 8, wallthickness );
} }
@ -271,12 +272,19 @@ int main (void)
//263 is semi-molten rock, 331 is obsidian //263 is semi-molten rock, 331 is obsidian
uint32_t whell=263, wmolten=263, wmagma=331, wcave=331; uint32_t whell=263, wmolten=263, wmagma=331, wcave=331;
//The Tile Type to use for the hole's floor at bottom of the map //The Tile Type to use for the hole's floor at bottom of the map
//35 is chasm, 42 is eerie pit , 340 is obsidian floor //35 is chasm, 42 is eerie pit , 340 is obsidian floor, 344 is featstone floor, 264 is 'magma flow' floor
uint32_t floor=35, cap=340; uint32_t floor=35, cap=340;
if( pitTypeEerie == pittype ) floor=42; switch( pittype ){
case pitTypeEerie: floor=42; break;
case pitTypeFloor: floor=344; break;
case pitTypeMagma: floor=264; break;
default:
floor=35;
}
//Should tiles be revealed? //Should tiles be revealed?
int reveal=1; int reveal=0;
//Pattern to dig //Pattern to dig
@ -318,10 +326,10 @@ int main (void)
if( x>0 && 1==pattern[x-1][y ] ){ pattern[x][y]=2; continue; } if( x>0 && 1==pattern[x-1][y ] ){ pattern[x][y]=2; continue; }
if( y>0 && 1==pattern[x ][y-1] ){ pattern[x][y]=2; continue; } if( y>0 && 1==pattern[x ][y-1] ){ pattern[x][y]=2; continue; }
if( x<15 && 1==pattern[x+1][y ] ){ pattern[x][y]=2; continue; } if( x<15 && 1==pattern[x+1][y ] ){ pattern[x][y]=2; continue; }
if( x<15&& y>0 && 1==pattern[x+1][y-1] ){ pattern[x][y]=2; continue; } if( x<15 && y>0 && 1==pattern[x+1][y-1] ){ pattern[x][y]=2; continue; }
if( x<15&& y<15&& 1==pattern[x+1][y+1] ){ pattern[x][y]=2; continue; } if( x<15 && y<15 && 1==pattern[x+1][y+1] ){ pattern[x][y]=2; continue; }
if( y<15&& 1==pattern[x ][y+1] ){ pattern[x][y]=2; continue; } if( y<15 && 1==pattern[x ][y+1] ){ pattern[x][y]=2; continue; }
if( x>0 && y<15&& 1==pattern[x-1][y+1] ){ pattern[x][y]=2; continue; } if( x>0 && y<15 && 1==pattern[x-1][y+1] ){ pattern[x][y]=2; continue; }
} }
} }
} }
@ -465,9 +473,13 @@ int main (void)
const TileRow * tp; const TileRow * tp;
t_designation * d; t_designation * d;
//////////////////////////////////////
//From top to bottom, dig this dude. //From top to bottom, dig this dude.
//////////////////////////////////////
//Top level, cap. //Top level, cap.
//Might make this an option in the future
if(-1){
Mapz->ReadBlock40d( bx, by, bz , &block ); Mapz->ReadBlock40d( bx, by, bz , &block );
for(uint32_t x=0;x<16;++x){ for(uint32_t x=0;x<16;++x){
for(uint32_t y=0;y<16;++y){ for(uint32_t y=0;y<16;++y){
@ -496,8 +508,11 @@ int main (void)
Mapz->WriteDesignations(bx,by,bz, &block.designation ); Mapz->WriteDesignations(bx,by,bz, &block.designation );
Mapz->WriteTileTypes(bx,by,bz, &block.tiletypes ); Mapz->WriteTileTypes(bx,by,bz, &block.tiletypes );
Mapz->WriteDirtyBit(bx,by,bz,1); Mapz->WriteDirtyBit(bx,by,bz,1);
}
///////////////////////////////////////////////////////////////////////////////////////////////
//Various behaviour flags. //Various behaviour flags.
int magmacount=0;
int moltencount=0; int moltencount=0;
int solidcount=0; int solidcount=0;
int emptycount=0; int emptycount=0;
@ -508,6 +523,7 @@ int main (void)
uint32_t t; uint32_t t;
for(int32_t z = bz-1; z>0 ; --z){ for(int32_t z = bz-1; z>0 ; --z){
moltencount=0; moltencount=0;
magmacount=0;
solidcount=0; solidcount=0;
emptycount=0; emptycount=0;
hellcount=0; hellcount=0;
@ -527,18 +543,16 @@ int main (void)
switch( tp->m ){ switch( tp->m ){
case MAGMA: case MAGMA:
++moltencount; ++moltencount;
case FEATSTONE:
case HFS:
//Making a fake volcanoe/magma pipe? //Making a fake volcanoe/magma pipe?
if( pitTypeMagma == pittype ){ if( pitTypeMagma == pittype ){
//Leave tile unchanged. //Leave tile unchanged.
tpat=0; tpat=0;
} }
break; break;
case OBSIDIAN:
case FEATSTONE:
case HFS:
//ignore, even though it is technically solid
break;
case VEIN: case VEIN:
case OBSIDIAN:
default: default:
if( EMPTY != tp->c ){ if( EMPTY != tp->c ){
++emptycount; ++emptycount;
@ -547,6 +561,15 @@ int main (void)
} }
} }
//No walls if magma found anywhere for a magma pipe
if( d->bits.flow_size && liquid_magma==d->bits.liquid_type ){
++magmacount;
if(pitTypeMagma == pittype){
tpat=0;
}
}
//Check hell status //Check hell status
if( if(
(block.local_feature > -1 && feature_Underworld==local_features[pc][block.local_feature]->type ) (block.local_feature > -1 && feature_Underworld==local_features[pc][block.local_feature]->type )
@ -560,6 +583,15 @@ int main (void)
//Leave tile unchanged. //Leave tile unchanged.
tpat=0; tpat=0;
} }
//Never should have gotten here
if(pitTypeMagma == pittype){
x=y=255;
z=0;
tpat=0;
continue;
}
} }
@ -587,6 +619,11 @@ int main (void)
}else{ }else{
d->bits.liquid_type=liquid_water; d->bits.liquid_type=liquid_water;
} }
}else{
//Otherwise, remove all liquids.
d->bits.flow_size=0;
d->bits.liquid_character = liquid_fresh;
d->bits.liquid_type=liquid_water;
} }
break; break;
@ -615,9 +652,10 @@ int main (void)
//If the tile already is a feature, or if it is a vein, we're done. //If the tile already is a feature, or if it is a vein, we're done.
//Otherwise, adopt block features. //Otherwise, adopt block features.
if( VEIN!=tp->m && !d->bits.feature_global && !d->bits.feature_local ){ //Adamantine (a local feature) trumps veins.
{
//Local Feature? //Local Feature?
if( block.local_feature > -1 ){ if( block.local_feature > -1 && !d->bits.feature_global ){
switch( n=local_features[pc][block.local_feature]->type ){ switch( n=local_features[pc][block.local_feature]->type ){
case feature_Adamantine_Tube: case feature_Adamantine_Tube:
case feature_Underworld: case feature_Underworld:
@ -632,7 +670,7 @@ int main (void)
} }
} }
//Global Feature? //Global Feature?
else if(block.global_feature > -1 ){ else if(block.global_feature > -1 && !d->bits.feature_local ){
switch( n=global_features[block.global_feature].type ){ switch( n=global_features[block.global_feature].type ){
case feature_Adamantine_Tube: case feature_Adamantine_Tube:
case feature_Underworld: case feature_Underworld:
@ -668,13 +706,17 @@ int main (void)
d->bits.liquid_type=liquid_water; d->bits.liquid_type=liquid_water;
break; break;
default: default:
cout << ".err,bad pattern."; cout << ".error,bad pattern.";
} }
//For all tiles. //For all tiles.
if(reveal) d->bits.hidden = 0; //topblock.designation[x][y].bits.hidden; if(reveal) d->bits.hidden = 0; //topblock.designation[x][y].bits.hidden;
//Always clear the dig designation. //Always clear the dig designation.
d->bits.dig=designation_no; d->bits.dig=designation_no;
//Make it underground, because it is capped
d->bits.subterranean=1;
d->bits.light=0;
d->bits.skyview=0;
//unlock fluids, so they fall down the pit. //unlock fluids, so they fall down the pit.
d->bits.flow_forbid = d->bits.liquid_static=0; d->bits.flow_forbid = d->bits.liquid_static=0;
block.blockflags.bits.liquid_1 = block.blockflags.bits.liquid_2 = 1; block.blockflags.bits.liquid_1 = block.blockflags.bits.liquid_2 = 1;
@ -693,7 +735,7 @@ int main (void)
Mapz->WriteDirtyBit(bx,by,z,1); Mapz->WriteDirtyBit(bx,by,z,1);
//Making a fake volcanoe/magma pipe? //Making a fake volcanoe/magma pipe?
if( pitTypeMagma == pittype && !solidcount){ if( pitTypeMagma == pittype && !solidcount && (moltencount || magmacount) ){
//Nothing «solid», we're making a magma pipe, we're done. //Nothing «solid», we're making a magma pipe, we're done.
z=0; z=0;
} }
@ -702,24 +744,31 @@ int main (void)
//The bottom level is special. //The bottom level is special.
if( pitTypeMagma != pittype ) { if(-1){
Mapz->ReadBlock40d( bx, by, 0 , &block ); Mapz->ReadBlock40d( bx, by, 0 , &block );
for(uint32_t x=0;x<16;++x){ for(uint32_t x=0;x<16;++x){
for(uint32_t y=0;y<16;++y){ for(uint32_t y=0;y<16;++y){
//Only the portion below the empty space is handled. //Only the portion below the empty space is handled.
if(pattern[x][y]){ if(1==pattern[x][y]){
if( 1==pattern[x][y] ) t=floor; //if( 1==pattern[x][y] ) t=floor;
else if( 3==pattern[x][y] ) t=331; //else if( 3==pattern[x][y] ) t=331;
else continue; //else continue;
tp = getTileTypeP(block.tiletypes[x][y]); tp = getTileTypeP(block.tiletypes[x][y]);
d = &block.designation[x][y]; d = &block.designation[x][y];
//Special handling for magma pipe.
//Need to be sure that solid blocks have a floor above them.
//Only solid blocks will have a floor drawn; empty blocks will be ignored.
if( pitTypeMagma == pittype ) {
if( EMPTY == tp->c || RAMP_TOP == tp->c || STAIR_DOWN == tp->c ) continue;
}
//For all tiles. //For all tiles.
if(reveal) d->bits.hidden = 0; //topblock.designation[x][y].bits.hidden; if(reveal) d->bits.hidden = 0; //topblock.designation[x][y].bits.hidden;
//Always clear the dig designation. //Always clear the dig designation.
d->bits.dig=designation_no; d->bits.dig=designation_no;
//unlock fluids, so they fall down the pit. //unlock fluids
d->bits.flow_forbid = d->bits.liquid_static=0; d->bits.flow_forbid = d->bits.liquid_static=0;
block.blockflags.bits.liquid_1 = block.blockflags.bits.liquid_2 = 1; block.blockflags.bits.liquid_1 = block.blockflags.bits.liquid_2 = 1;
//Set the tile. //Set the tile.

@ -8,8 +8,8 @@
#include <ctime> #include <ctime>
#include <cstdio> #include <cstdio>
#define DFHACK_WANT_MISCUTILS #define DFHACK_WANT_MISCUTILS 1
#define DFHACK_WANT_TILETYPES #define DFHACK_WANT_TILETYPES 1
#include <DFHack.h> #include <DFHack.h>
using namespace DFHack; using namespace DFHack;
@ -18,6 +18,7 @@ int main (int numargs, const char ** args)
DFHack::ContextManager DFMgr("Memory.xml"); DFHack::ContextManager DFMgr("Memory.xml");
DFHack::Context *DF = DFMgr.getSingleContext(); DFHack::Context *DF = DFMgr.getSingleContext();
BEGIN_PROBE:
try try
{ {
DF->Attach(); DF->Attach();
@ -31,6 +32,7 @@ int main (int numargs, const char ** args)
return 1; return 1;
} }
DFHack::Position *Pos = DF->getPosition(); DFHack::Position *Pos = DF->getPosition();
DFHack::VersionInfo* mem = DF->getMemoryInfo(); DFHack::VersionInfo* mem = DF->getMemoryInfo();
DFHack::Maps *Maps = DF->getMaps(); DFHack::Maps *Maps = DF->getMaps();
@ -57,6 +59,11 @@ int main (int numargs, const char ** args)
Maps->Start(); Maps->Start();
vector<DFHack::t_feature> global_features;
std::map <DFHack::planecoord, std::vector<DFHack::t_feature *> > local_features;
Maps->ReadLocalFeatures(local_features);
Maps->ReadGlobalFeatures(global_features);
int32_t cursorX, cursorY, cursorZ; int32_t cursorX, cursorY, cursorZ;
Pos->getCursorCoords(cursorX,cursorY,cursorZ); Pos->getCursorCoords(cursorX,cursorY,cursorZ);
if(cursorX != -30000) if(cursorX != -30000)
@ -82,7 +89,15 @@ int main (int numargs, const char ** args)
// tiletype // tiletype
std::cout <<"tiletype: " << tiletype; std::cout <<"tiletype: " << tiletype;
if(tileTypeTable[tiletype].name) if(tileTypeTable[tiletype].name)
std::cout << " = " << tileTypeTable[tiletype].name; std::cout << " = " << tileTypeTable[tiletype].name << std::endl;
printf("%-10s: %4d %s\n","Class",tileTypeTable[tiletype].c,TileClassString[ tileTypeTable[tiletype].c ] , 0);
printf("%-10s: %4d %s\n","Material",tileTypeTable[tiletype].c,TileMaterialString[ tileTypeTable[tiletype].m ] , 0);
printf("%-10s: %4d %s\n","Special",tileTypeTable[tiletype].c,TileSpecialString[ tileTypeTable[tiletype].s ] , 0);
printf("%-10s: %4d\n","Variant",tileTypeTable[tiletype].v , 0);
printf("%-10s: %s\n","Direction",tileTypeTable[tiletype].d.getStr() , 0);
std::cout << std::endl; std::cout << std::endl;
std::cout <<"temperature1: " << tmpb1[tileX][tileY] << " U" << std::endl; std::cout <<"temperature1: " << tmpb1[tileX][tileY] << " U" << std::endl;
std::cout <<"temperature2: " << tmpb2[tileX][tileY] << " U" << std::endl; std::cout <<"temperature2: " << tmpb2[tileX][tileY] << " U" << std::endl;
@ -109,24 +124,47 @@ int main (int numargs, const char ** args)
std::cout << "smooth?" << std::endl; std::cout << "smooth?" << std::endl;
uint32_t designato = block.origin + designatus + (tileX * 16 + tileY) * sizeof(t_designation); uint32_t designato = block.origin + designatus + (tileX * 16 + tileY) * sizeof(t_designation);
printf("designation offset: 0x%x\n", designato); printf("designation offset: 0x%x\n", designato);
if(des.light)
std::cout << "Light "; #define PRINT_FLAG( X ) printf("%-16s= %c\n", #X , ( des.X ? 'Y' : ' ' ) )
else PRINT_FLAG( hidden );
std::cout << " "; PRINT_FLAG( light );
if(des.skyview) PRINT_FLAG( skyview );
std::cout << "SkyView "; PRINT_FLAG( subterranean );
else PRINT_FLAG( water_table );
std::cout << " "; //PRINT_FLAG( rained );
if(des.subterranean)
std::cout << "Underground "; planecoord pc;
else pc.dim.x=blockX; pc.dim.y=blockY;
std::cout << " ";
PRINT_FLAG( feature_local );
if( des.feature_local ){
printf("%-16s %4d (%2d) %s\n", "",
block.local_feature,
local_features[pc][block.local_feature]->type,
sa_feature[local_features[pc][block.local_feature]->type]
);
}
PRINT_FLAG( feature_global );
if( des.feature_global ){
printf("%-16s %4d (%2d) %s\n", "",
block.global_feature,
global_features[block.global_feature].type,
sa_feature[global_features[block.global_feature].type]
);
}
#undef PRINT_FLAG
std::cout << std::endl; std::cout << std::endl;
} }
} }
DF->Detach();
#ifndef LINUX_BUILD #ifndef LINUX_BUILD
std::cout << "Done. Press any key to continue" << std::endl; //std::cout << "Done. Press any key to continue" << std::endl;
std::cout << "Press any key to refresh..." << std::endl;
cin.ignore(); cin.ignore();
goto BEGIN_PROBE;
#endif #endif
return 0; return 0;
} }