Merge branch 'master' of git://genodeen.net/adeon_dfhack

Conflicts:
	CMakeLists.txt
	library/modules/Position.cpp
develop
Petr Mrázek 2010-08-28 22:47:38 +02:00
commit 2dd8aed7a0
6 changed files with 36 additions and 29 deletions

1
.gitignore vendored

@ -9,6 +9,7 @@ output/*
# a file generated by cmake
dfhack/include/config.h
library/private/config.h
# any build folders
build*/

@ -4,6 +4,11 @@ cmake_minimum_required(VERSION 2.6)
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules)
SET ( DFHACK_VERSION "0.4.1.0-dev" )
# Set this to project source dir. When dfhack is used
# as a submodule, CMAKE_SOURCE_DIR is not pointing to
# the root where this particular CMakeLists.txt file sits.
SET(CMAKE_SOURCE_DIR ${PROJECT_SOURCE_DIR})
# disable warning, autosearch
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
@ -59,4 +64,4 @@ ENDIF(BUILD_DFHACK_PLAYGROUND)
IF(BUILD_DFHACK_DOCUMENTATION)
add_subdirectory (doc)
ENDIF(BUILD_DFHACK_DOCUMENTATION)
ENDIF(BUILD_DFHACK_DOCUMENTATION)

@ -2361,6 +2361,7 @@ map_data_1b60_offset 0x1B9c
</Entry>
<Entry version="v0.31.12" os="linux" id="30_12lin" base="30_11lin" rebase="-0x1000">
<String name="md5">e79cead03187ecb692961b316b7cdcd4</String>
<Address name="screen_tiles_pointer">0x09487970</Address>
</Entry>
</MemoryDescriptors>
</DFExtractor>

@ -178,10 +178,7 @@ bool Position::getScreenTiles (int32_t width, int32_t height, t_screen screen[])
if(!d->Inited) return false;
if(!d->StartedScreen) return false;
uint32_t screen_addr;
d->owner->readDWord(d->screen_tiles_ptr_offset,(uint32_t &) screen_addr);
//d->owner->read (d->screen_tiles_ptr_offset, sizeof(uint32_t), (uint8_t *) screen_addr);
uint32_t screen_addr = d->owner->readDWord(d->screen_tiles_ptr_offset);
uint8_t* tiles = new uint8_t[width*height*4/* + 80 + width*height*4*/];
d->owner->read (screen_addr, (width*height*4/* + 80 + width*height*4*/), (uint8_t *) tiles);
@ -190,12 +187,12 @@ bool Position::getScreenTiles (int32_t width, int32_t height, t_screen screen[])
{
for(int32_t ix=0; ix<width; ix++)
{
screen[ix + iy*width].symbol = tiles[iy*4 + ix*height*4 +0];
screen[ix + iy*width].foreground = tiles[iy*4 + ix*height*4 +1];
screen[ix + iy*width].background = tiles[iy*4 + ix*height*4 +2];
screen[ix + iy*width].bright = tiles[iy*4 + ix*height*4 +3];
screen[ix + iy*width].gtile = tiles[iy*4 + ix*height*4 +4];
screen[ix + iy*width].grayscale = tiles[iy*4 + ix*height*4 +5];
screen[ix + iy*width].symbol = tiles[(iy + ix*height)*4 +0];
screen[ix + iy*width].foreground = tiles[(iy + ix*height)*4 +1];
screen[ix + iy*width].background = tiles[(iy + ix*height)*4 +2];
screen[ix + iy*width].bright = tiles[(iy + ix*height)*4 +3];
//screen[ix + iy*width].gtile = tiles[width*height*4 + 80 + iy + ix*height +0];
//screen[ix + iy*width].grayscale = tiles[width*height*4 + 80 + iy + ix*height +1];
}
}

@ -271,16 +271,17 @@ void printCreature(DFHack::Context * DF, const DFHack::t_creature & creature)
}
}
std::vector<uint32_t> inventory;
std::vector<uint32_t> inventory;
if( Creatures->ReadInventoryPtr(creature.origin, inventory) )
{
printf("\tInventory:\n");
for(unsigned int i = 0; i < inventory.size(); i++)
{
printf("\t\t%s\n", Items->getItemDescription(inventory[i], Materials).c_str());
}
}
if( Creatures->ReadInventoryPtr(creature.origin, inventory) )
{
DFHack::Items * Items = DF->getItems();
printf("\tInventory:\n");
for(unsigned int i = 0; i < inventory.size(); i++)
{
printf("\t\t%s\n", Items->getItemDescription(inventory[i], Materials).c_str());
}
}
/*
if(creature.pregnancy_timer > 0)
@ -426,7 +427,6 @@ int main (int numargs, char ** args)
Creatures = DF->getCreatures();
Materials = DF->getMaterials();
Items = DF->getItems();
World = DF->getWorld();
current_year = World->ReadCurrentYear();
current_tick = World->ReadCurrentTick();

@ -159,15 +159,18 @@ int main (int numargs, const char ** args)
}
DFHack::Position *Pos = DF->getPosition();
DFHack::memory_info* mem = DF->getMemoryInfo();
DFHack::VersionInfo* mem = DF->getMemoryInfo();
DFHack::Process * p = DF->getProcess();
uint32_t designations = mem->getOffset("map_data_designation");
uint32_t block_feature1 = mem->getOffset("map_data_feature_local");
uint32_t block_feature2 = mem->getOffset("map_data_feature_global");
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("local_feature_start_ptr");
OffsetGroup * OG_Maps = mem->getGroup("Maps");
OffsetGroup * OG_MapBlock = OG_Maps->getGroup("block");
OffsetGroup * OG_LocalFt = OG_Maps->getGroup("features")->getGroup("local");
uint32_t designations = OG_MapBlock->getOffset("designation");
uint32_t block_feature1 = OG_MapBlock->getOffset("feature_local");
uint32_t block_feature2 = OG_MapBlock->getOffset("feature_global");
uint32_t region_x_offset = OG_Maps->getAddress("region_x");
uint32_t region_y_offset = OG_Maps->getAddress("region_y");
uint32_t region_z_offset = OG_Maps->getAddress("region_z");
uint32_t feature1_start_ptr = OG_LocalFt->getAddress("start_ptr");
int32_t regionX, regionY, regionZ;
// read position of the region inside DF world